fix(scope): close remaining #85 scope-isolation gaps - #97
Merged
Conversation
Tencent#73/Tencent#77 fixed recall's dual-scope merge and Tencent#91 fixed auto-recall's upvote scope, but issue Tencent#85 flagged four more spots where project vs user scope still leaked into each other: - hooks-cmd.ts: `hooks inject`/`hooks remove` reconciled the user-home copy of team hooks using the PROJECT's manifest instead of the user's own, diverging from pull.ts's per-scope reconcile and risking duplicate injection / wrongful cleanup of shared tool settings files. - tags.ts: subscribe/unsubscribe (and list/add/remove) always read and wrote ~/.teamai/config.yaml, ignoring project-scope installs. - contribute.ts: wrote new learnings to the team repo but never rebuilt the local search index, so `recall` couldn't see a contribution until the next `pull`. - types.ts/config.ts: getTeamaiHome()/resolveBaseDir() silently fell back to the user home directory when a project LocalConfig was missing `projectRoot` (e.g. a pre-migration config.yaml). Now detectProjectConfig()/loadLocalConfigForScope() backfill projectRoot from the directory the config was actually loaded from, and the scope helpers throw instead of silently degrading if it's ever still missing. Added an e2e suite (scope-isolation-e2e-issue85.test.ts) that drives the built CLI against real git fixtures to cover all four fixes end-to-end, plus unit coverage in hooks-cmd.test.ts/scope.test.ts. Closes Tencent#85 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Jul 1, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#73/#77 fixed
recall's dual-scope merge and #91 fixedauto-recall's upvote scope, but #85 flagged four more places where project vs user scope still leaked into each other. This closes the remaining gaps:hooks-cmd.ts:hooks inject/hooks removereconciled the user-home copy of team hooks using the project's manifest instead of the user's own, diverging frompull.ts's per-scope reconcile and risking duplicate injection / wrongful cleanup of shared tool settings files (e.g.~/.cursor/hooks.json).tags.ts:subscribe/unsubscribe/list/add/removealways read and wrote~/.teamai/config.yaml, ignoring project-scope installs entirely.contribute.ts: wrote new learnings to the team repo but never rebuilt the local search index, sorecallcouldn't see a fresh contribution until the nextpull.types.ts/config.ts:getTeamaiHome()/resolveBaseDir()silently fell back to the user home directory when a projectLocalConfigwas missingprojectRoot(e.g. a pre-migrationconfig.yaml). NowdetectProjectConfig()/loadLocalConfigForScope()backfillprojectRootfrom the directory the config was actually loaded from, and the scope helpers throw instead of silently degrading if it's ever still missing.Closes #85
Test plan
npx tsc --noEmit— zero errorsnpx vitest run— 130 files / 1686 tests passedscope-isolation-e2e-issue85.test.ts) drives the built CLI against real git fixtures, covering all four fixes: hooks manifest scoping + inject idempotency + remove cleanup, tags scope isolation, contribute→recall immediacy, and the projectRoot backfillhooks-cmd.test.tsto assert the project/user manifest paths are distinct and correctly scopedscope.test.tscases that previously asserted the old silent-fallback behavior to assert the new throw instead🤖 Generated with Claude Code