fix(import): rebuild global teamwiki nav after every import - #313
Merged
Conversation
m0Nst3r873
force-pushed
the
fix/batch-import-nav-rebuild
branch
3 times, most recently
from
August 24, 2026 08:59
4ca1c1d to
ff2f759
Compare
Local (--dir) and batch (--from-repo-list) imports populated evidence/code/<repo>/ but never rebuilt the top-level teamwiki/router.md and index.md, leaving global navigation frozen at the first single-repo import. Call rebuildWikiIndex after each so newly imported repos appear. Also fix --from-org rebuild using a hardcoded team-repo path instead of the configured localPath, and guard it behind dryRun. Unify navigation generation on rebuildWikiIndex: drop the single-repo append-only block that only appended a bullet without refreshing stats or reflecting deletions, and produced a format divergent from the batch rebuild. Single-repo --from-repo now runs a full rebuild too; batch paths skip it (skipAutoPush) and rebuild once at the end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
m0Nst3r873
force-pushed
the
fix/batch-import-nav-rebuild
branch
from
August 24, 2026 09:27
ff2f759 to
77bb068
Compare
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.
Problem
Importing repos into the team knowledge base (
teamwiki) populated eachrepo's own
evidence/code/<repo>/index.md, but the global navigationfiles
teamwiki/router.mdandteamwiki/index.mdwere never rebuilt afterimport. They stayed frozen at whatever the very first single-repo import
wrote. A user who ran
teamai import --dir .across 22 repos ended up with22 per-repo pages but a global index that still listed only the first repo.
Root cause
rebuildWikiIndex()(scans all ofevidence/code/and rewrites the globalnav) already existed, but the import paths did not all call it:
--dir(local)src/import.tsrebuildWikiIndexafter graph aggregation, before push--from-repo-listsrc/import-repo-list.tsrebuildWikiIndexat end of batch--from-orgsrc/import-org.tscwd/.teamai/team-repopath that silently misses when the team repo is configured elsewhereautoDetectInit()localConfig.repo.localPath--from-repo(single)Changes
src/import.ts— rebuild global nav on local--dirimportsrc/import-repo-list.ts— rebuild global nav after batch importsrc/import-org.ts— fix hardcoded team-repo path; unify failure log towarnsrc/__tests__/rebuild-wiki-index.test.ts— new regression testTest Plan
npx tsc --noEmit— passesnpm run build— passesvitest run src/__tests__/rebuild-wiki-index.test.ts— 2 passed: synthesize 3 repos underevidence/code/+ a stale one-repo top-level nav, runrebuildWikiIndex, assert all 3 repos appear,仓库: 3, aggregatedFacts: 60, and stale content is overwritten; empty-dir no-op verified.🤖 Generated with Claude Code