agent: Obsidian is listed only when a vault has Copilot (iEthan333 on X)

detect was "obsidian's config folder exists", so every Obsidian user got a
row whose provider field could only fail ("no Obsidian vault here has
Copilot"). It now needs a vault in obsidian.json with Copilot installed
(.obsidian/plugins/copilot/manifest.json) or magpie's provider already in
its data.json, so a wired vault can still be disconnected. Every OS's config
folder (mac, Windows, Linux, Flatpak, Snap) is already read by obsidianDirs.

Siblings checked: Zoo Code and Copilot (JetBrains) already require the
plugin installed; VS Code forks and Raycast are the apps that hold the
setting themselves. None changed.

Run: go test ./internal/agent -run Obsidian (wsl-run); the new no-Copilot
vault assertion is red on the old detect (checked by hand). Full agent
package, gofmt, linux and windows vet: see push notes. Not tried: a real
Obsidian install.
This commit is contained in:
yetone
2026-11-11 14:34:37 +08:00
parent e1a2226405
commit 1ccacad632
3 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -136,8 +136,14 @@ func obsidian(home, cfg string) *Agent {
return atomic(&Agent{
ID: "obsidian", Name: "Obsidian", Icon: "obsidian", Aliases: []string{"obsidian-copilot"},
Dir: dir, Path: filepath.Join(dir, "obsidian.json"),
// Obsidian has no AI of its own: it is listed when a vault has
// Copilot (installed, or magpie's provider already written), since
// the app or its config folder alone gives magpie nothing to set
// and a row that can't be used (iEthan333 on X)
detect: func() bool {
return slices.ContainsFunc(dirs, isDir) || macBundle(obsidianApp)
return slices.ContainsFunc(vaults, func(v string) bool {
return obsCopilotHere(v) || obsCopilotWired(obsCopilotData(v))
})
},
Notice: func() string {
if wired() && Running(obsidianProc...) {
+6
View File
@@ -168,6 +168,12 @@ func TestObsidianCopilot(t *testing.T) {
t.Fatal("found with nothing of it here")
}
odir := obsidianDirs(home, cfg)[0]
// Obsidian is here, with a vault that has no Copilot: nothing to set,
// so no row (iEthan333 on X)
obsidianVault(t, odir, "0000000000000000", filepath.Join(home, "NoAI"), "", "")
if obsidian(home, cfg).Detected() {
t.Fatal("found with only a vault that has no Copilot")
}
notes := filepath.Join(home, "Documents", "Notes")
path := obsidianVault(t, odir, "a1b2c3d4e5f60718", notes, "4.0.19", obsCopilotUser)
// a second vault without Copilot, and one listed that is gone