feat(mcp): extract a DirScope embeddable — make dir= as modular as RepoScope, with an enforced tool matrix #62
Labels
No labels
breaking
bug
documentation
enhancement
epic
good first issue
help wanted
refactoring
resolution/duplicate
resolution/invalid
resolution/wontfix
security
severity/critical
severity/high
severity/low
severity/medium
status/abandoned
status/blocked
status/needs-decision
status/needs-info
status/needs-verification
testing
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
sixfold-space/madtea#62
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
owner_repois already a reusable modular bit:RepoScope(internal/mcp/helpers.go:31) is embedded in ~25 tool input structs, with cwd-mismatch guarding centralized in repoguard.go and per-target forge/credential resolution landed by ADR 0025.dir=is only half-modular. The machinery is shared —resolveLocalRepoDir(internal/mcp/dirguard.go:69), the foreign-repo guards (internal/mcp/foreignrepo.go:IsForeignRepoDir,IsForeignPrimaryCheckoutDir), andconfig.GetConfigForDir(ADR 0025 T5) — but there is no embeddable counterpart toRepoScope. Every dir-taking tool declares its own ad-hocDir stringfield (tools_auth.go:29, the localgit/worktrees inputs, orchestrate's pull shape at tools_workflow.go:22), and tools that never declared the field simply don't have it. That is exactly how the #14 gap happened: orchestrate's reconcile shape has nodir=/owner_repo=, so the merge-failure rail is unfollowable for foreign-repo PRs.Ask
DirScopeembeddable, symmetric withRepoScope: the schema fragment (dirparam + doc string) plus ONE shared resolve-and-guard entry point that returns the resolved dir, its foreign/primary/worktree classification, and the dir-resolved config — so a tool opts in with an embed line and a helper call, not a re-implementation.DirScope; remote-API →RepoScope; both where the operation spans layers (finish, orchestrate, pull/push). Per-tool semantics stay a deliberate decision, not blanket: some tools must document or refuse a scope rather than silently accept it (e.g.madt_searchalready documents thatowner_repodoes not filter it).DirScope(or takes an undeclared scope) fails CI rather than shipping the next #14-style gap.Dir stringfields onto the embeddable in the same change (no schema-visible rename — the JSON param staysdir).Acceptance
DirScopeexists and every current dir-taking tool embeds it; grep shows no ad-hocDir stringfields left in tool input structs.Refs #14, #18. Groundwork landed by ADR 0025 (#30).