Add multi-depository support with global config

- Implement global CLI config at ~/.config/jade/config.yml
- Add jade depo commands (add, list, remove, set-default)
- Support depository short names and context-aware detection
- Remove tag_prefix config, hardcode + syntax for consistency
- Update depository resolution: flag -> context -> default
- Auto-initialize .jade/ directory structure when adding depos
- Update documentation with new multi-depository workflow
This commit is contained in:
2026-01-03 16:25:23 +01:00
parent 0ebfaf835d
commit 1d87d93172
9 changed files with 515 additions and 158 deletions
+60 -19
View File
@@ -4,12 +4,13 @@ A simple CLI tool for managing markdown notes in a depository (vault). Inspired
## Features
- **Multi-Depository Support**: Manage multiple note repositories with short names
- **Note Management**: Create, edit, list, and delete markdown notes
- **Tag Support**: Extract and search notes by tags (default `+tag` syntax, configurable)
- **Tag Support**: Extract and search notes by tags (`+tag` syntax)
- **Full-Text Search**: Search note content using ripgrep
- **Link Support**: Parse both `[[wiki-style]]` and `[markdown](links)`
- **Trash System**: Deleted notes moved to `.jade/trash/` instead of permanent deletion
- **Flexible Configuration**: Per-depository settings for tag prefix and other options
- **Context-Aware**: Automatically detects which depository you're in
## Installation
@@ -19,24 +20,53 @@ go build -o jade
## Usage
### Managing Depositories
Before you can use jade, you need to add at least one depository:
```bash
# Add a depository with a short name
jade depo add personal ~/my-notes
# Add depository using current directory
cd ~/work/meeting-notes
jade depo add work
# List all depositories
jade depo list
# Set default depository
jade depo set-default personal
# Remove a depository (doesn't delete files)
jade depo remove work
```
### Open Depository
```bash
# Open the depository directory in your $EDITOR
# Open the default depository in your $EDITOR
jade
# This opens ~/jade-depository (or your configured path) in your editor
# Works great with neovim, vim, or any editor that supports directory opening
# Open a specific depository
jade --depo work
```
### Initialize and List Notes
### List Notes
```bash
# List all notes in the default depository (~/jade-depository)
# List all notes in the default depository
jade list
# Use a specific depository
# Use a specific depository by name
jade --depo work list
# Or by path
jade --depo /path/to/notes list
# Context-aware: if you're inside a registered depository, jade uses it automatically
cd ~/my-notes
jade list # Uses the depository that contains current directory
```
### Create a Note
@@ -87,24 +117,33 @@ jade tags
## Configuration
Configuration is stored in `<depo_path>/.jade/config.yml` and is created automatically when you first run jade.
Jade uses a two-level configuration system:
### Global CLI Config (`~/.config/jade/config.yml`)
Manages your depositories and default settings:
Example config:
```yaml
depo_path: /home/user/jade-depository
tag_prefix: "+"
depositories:
personal: /home/user/my-notes
work: /home/user/work/notes
default_depository: personal
```
You can override these with flags:
- `--depo`: Depository path
- `--config`: Config file path (if you need to override the default location)
This file is automatically created and managed by `jade depo` commands.
### Per-Depository Structure
Each depository contains a `.jade/` directory for metadata:
- `.jade/trash/` - Deleted notes
- Future: `.jade/index.db` - SQLite index for fast search
## Depository Structure
```
jade-depository/
my-notes/
├── .jade/
│ ├── config.yml # Configuration file
│ └── trash/ # Deleted notes go here
├── note-1.md
├── note-2.md
@@ -112,7 +151,7 @@ jade-depository/
└── note-3.md
```
The `.jade/` directory is automatically created and contains configuration and metadata. You can optionally add it to `.gitignore` if you don't want to track it in version control.
The `.jade/` directory is automatically created and contains metadata. You can optionally add it to `.gitignore` if you don't want to track it in version control, or commit it to sync trash/metadata across devices.
## Note Format
@@ -139,9 +178,11 @@ Tags can appear anywhere in +content.
### v1.0 (Current)
- [x] Basic note operations (add, edit, delete, list)
- [x] Tag extraction and listing
- [x] Tag extraction and listing (`+tag` syntax)
- [x] Content and tag search
- [x] Trash system
- [x] Multi-depository support with short names
- [x] Context-aware depository detection
### v1.1 (Future)
- [ ] SQLite indexing for faster search