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
+1 -14
View File
@@ -5,7 +5,6 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
)
@@ -52,18 +51,6 @@ func (jd *JadeDepo) SearchContent(query string) ([]string, error) {
return results, nil
}
// SearchByTag searches for notes containing a specific tag
func (jd *JadeDepo) SearchByTag(tag string) ([]string, error) {
// Ensure tag has prefix
if !strings.HasPrefix(tag, jd.Config.TagPrefix) {
tag = jd.Config.TagPrefix + tag
}
// Use ripgrep to find the tag (escape special regex characters)
escapedTag := regexp.QuoteMeta(tag)
return jd.SearchContent(escapedTag)
}
// ListAllNotes returns all markdown notes in the depository
func (jd *JadeDepo) ListAllNotes() ([]*Note, error) {
var notes []*Note
@@ -85,7 +72,7 @@ func (jd *JadeDepo) ListAllNotes() ([]*Note, error) {
return err
}
note, err := LoadNote(jd.Config.DepoPath, relPath, jd.Config.TagPrefix)
note, err := LoadNote(jd.Config.DepoPath, relPath)
if err != nil {
// Log error but continue
fmt.Fprintf(os.Stderr, "Warning: failed to load note %s: %v\n", relPath, err)