From 3e8514418c8590343dc724e9d7ff1de54f40bc9f Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Tue, 15 Sep 2026 17:55:24 -0600 Subject: [PATCH] feat(mcp): ask once before watching a project directory Closes #124 --- mcp.go | 8 +++++++- mcp_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/mcp.go b/mcp.go index 8fcb9cd..f036841 100644 --- a/mcp.go +++ b/mcp.go @@ -32,7 +32,13 @@ Comment polling lasts 2 hours from the gander that started it, or from the last - If agent_unresolved_count > 0 on other files, mention them (filename, count, share URL) and continue with the user's request unless they ask you to handle that review. - Empty agent inbox: do not mention Gander, even if human-human threads are open. - Do not ask the user to paste comments. Do not wait to be told to check Gander. -- Replies are stamped agent by the server; do not invent a display name.` +- Replies are stamped agent by the server; do not invent a display name. +Directory watch: First time this session, when all of these are true: (1) you created a directory, or are about to write the first .md into a directory that is not already dir-watched (gander status); (2) that directory is a project/output folder (workspace root, plans/, reports/, a newly scaffolded app), not .git / node_modules / hidden dirs; (3) the user has not already declined tracking that path this session. Check gander status before asking. If that directory (or an ancestor) is already watched, do not ask. +Ask: I created and will be adding markdown there. Want Gander to auto-share new .md files under it (including subfolders) as they appear? +- Yes → gander watch (hosted if signed up; otherwise gander --watch ). Directory watch is silent by design; do not add --silent. Then start the usual comment-poll window, because this is a gander. +- No → remember declined for this session. Still gander individual files if they explicitly ask. Do not prompt per new file. +- Already watching → do not ask. +Do not ask on every subsequent .md. Do not run gander watch unless the user said yes. Never silent auto-watch.` func runMCP(args []string) error { if len(args) > 0 && args[0] == "install" { diff --git a/mcp_test.go b/mcp_test.go index 3d2c631..88f98fb 100644 --- a/mcp_test.go +++ b/mcp_test.go @@ -20,6 +20,32 @@ func TestMCPInstructionsWatchSilent(t *testing.T) { } } +func TestMCPInstructionsDirWatchAsk(t *testing.T) { + for _, want := range []string{ + "I created and will be adding markdown there", + "gander watch ", + "gander --watch ", + "gander status", + "Do not ask on every subsequent", + "remember declined for this session", + "Do not prompt per new file", + "Already watching", + "Do not run gander watch unless the user said yes", + "Never silent auto-watch", + "comment-poll window", + } { + if !strings.Contains(mcpInstructions, want) { + t.Errorf("mcpInstructions missing %q", want) + } + } + if !strings.Contains(mcpInstructions, "gander watch --silent") { + t.Fatal("file watch must still say gander watch --silent") + } + if strings.Contains(mcpInstructions, "gander watch --silent ") { + t.Fatal("directory watch must not add --silent") + } +} + func TestMCPInstructionsDoNotAutoResolve(t *testing.T) { if strings.Contains(mcpInstructions, "then gander_resolve_thread") { t.Fatal("mcpInstructions must not tell agents to resolve every thread")