Skip to content

fix(import): rebuild global teamwiki nav after every import - #313

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:fix/batch-import-nav-rebuild
Aug 24, 2026
Merged

fix(import): rebuild global teamwiki nav after every import#313
jeff-r2026 merged 1 commit into
Tencent:mainfrom
m0Nst3r873:fix/batch-import-nav-rebuild

Conversation

@m0Nst3r873

Copy link
Copy Markdown
Collaborator

Problem

Importing repos into the team knowledge base (teamwiki) populated each
repo's own evidence/code/<repo>/index.md, but the global navigation
files teamwiki/router.md and teamwiki/index.md were never rebuilt after
import. They stayed frozen at whatever the very first single-repo import
wrote. A user who ran teamai import --dir . across 22 repos ended up with
22 per-repo pages but a global index that still listed only the first repo.

Root cause

rebuildWikiIndex() (scans all of evidence/code/ and rewrites the global
nav) already existed, but the import paths did not all call it:

Path Before Fix
--dir (local) src/import.ts copies evidence, never rebuilds nav call rebuildWikiIndex after graph aggregation, before push
--from-repo-list src/import-repo-list.ts no rebuild after batch call rebuildWikiIndex at end of batch
--from-org src/import-org.ts rebuilds, but with a hardcoded cwd/.teamai/team-repo path that silently misses when the team repo is configured elsewhere derive path from autoDetectInit() localConfig.repo.localPath
--from-repo (single) append logic, serial, idempotent unchanged — no rebuild needed

Changes

  • src/import.ts — rebuild global nav on local --dir import
  • src/import-repo-list.ts — rebuild global nav after batch import
  • src/import-org.ts — fix hardcoded team-repo path; unify failure log to warn
  • src/__tests__/rebuild-wiki-index.test.ts — new regression test

Test Plan

  • npx tsc --noEmit — passes
  • npm run build — passes
  • vitest run src/__tests__/rebuild-wiki-index.test.ts — 2 passed: synthesize 3 repos under evidence/code/ + a stale one-repo top-level nav, run rebuildWikiIndex, assert all 3 repos appear, 仓库: 3, aggregated Facts: 60, and stale content is overwritten; empty-dir no-op verified.

🤖 Generated with Claude Code

@m0Nst3r873
m0Nst3r873 force-pushed the fix/batch-import-nav-rebuild branch 3 times, most recently from 4ca1c1d to ff2f759 Compare August 24, 2026 08:59
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
m0Nst3r873 force-pushed the fix/batch-import-nav-rebuild branch from ff2f759 to 77bb068 Compare August 24, 2026 09:27
@jeff-r2026
jeff-r2026 merged commit 948c1f4 into Tencent:main Aug 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants