Skip to content

fix: publish teamwiki after codebase --deep-enrich in team repo - #1560

Merged
SaulMoro merged 2 commits into
Tencent:mainfrom
Hstealth:cursor/fix-deep-enrich-publish-6912
Oct 29, 2026
Merged

SaulMoro merged 2 commits into
Tencent:mainfrom
Hstealth:cursor/fix-deep-enrich-publish-6912

Conversation

@Hstealth

Copy link
Copy Markdown
Contributor

Problem

Fixes #1537.

In a team repo (no --output), teamai codebase --deep-enrich --project <slug> wrote deep-enrich artifacts into the local team clone, printed success, and exited 0 without committing or pushing. The clone stayed dirty (teamwiki/router.md, new files under teamwiki/evidence/code/...), and a later teamai push failed with uncommitted teamwiki changes.

Fix

Follow the same pattern as teamai codebase --reconcile and teamai import:

  • When the target is the team repo, acquire the teamwiki import lock.
  • After deepEnrich finishes writing, call autoPushTeamRepo with the project evidence directory plus teamwiki/router.md and teamwiki/index.md (the paths deep enrich updates).
  • Log Pushed to team knowledge repo (...) when a commit is pushed.

--output and --dry-run behavior is unchanged (no publish).

Incomplete deep-enrich retry hints for team-repo imports now recommend teamai codebase --deep-enrich --project <slug> (with shellArg quoting when the slug contains shell metacharacters) instead of re-running the full import.

Tests

  • Added unit coverage in src/__tests__/codebase-deep-enrich.test.ts for team-repo publish (remote receives graph docs, clone clean) and dry-run (no publish).
  • Updated import retry expectations in import-dir.test.ts and import-repo-list.test.ts.
  • Updated bilingual knowledge guide examples for the new retry command.

Verification

npm run build
npx vitest run codebase-deep-enrich import-dir import-repo-list codebase-reconcile
npx tsc --noEmit
npm run lint

Real CLI (isolated HOME, local bare remote, kind: git member config):

node dist/index.js codebase --deep-enrich --project svc

Result: exit code 1 (AI docs missing without a tool on PATH, as expected), ✔ Pushed to team knowledge repo (...), git -C <team-clone> status --short empty, and teamwiki/evidence/code/svc/docs/graph-g1-relations.md present on origin/main.

mnaumanofficial13-svg and others added 2 commits October 29, 2026 13:59
When deep enrichment writes into the team clone, take the import lock and
push the generated evidence docs plus router/index updates via
autoPushTeamRepo, matching codebase --reconcile and import.

Also point incomplete deep-enrich retry messages at
teamai codebase --deep-enrich --project <slug> for team-repo imports.

Fixes Tencent#1537

Co-authored-by: hstealth <Hstealth@users.noreply.github.com>
Use shellArg(slug) for team-repo retry commands and drop the unused
importArgs parameter from failIncompleteDeepEnrich.

Co-authored-by: hstealth <Hstealth@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

No findings in the specified PR diff.

The description includes sufficient real-CLI verification: generated graph docs reached origin/main, publishing was reported, and the team clone was clean. Exit code 1 is documented as expected because AI docs remained incomplete.

Review was read-only; no PR code was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Approving at d8820c4. This closes #1537. In a team repo, codebase --deep-enrich now takes the teamwiki lock and publishes what it wrote, as --reconcile already does.

What I checked

  • The publish list covers every path deep enrich writes: the project's evidence directory (docs and _review/progress.json), plus teamwiki/router.md and teamwiki/index.md. pushRepoDirectly drops paths that do not exist before git add, so a wiki with no index.md does not fail.
  • cacheDir, the one argument the import passes and this command does not, is never read in deep-enrich.ts. Pointing the retry hint at codebase --deep-enrich instead of a full re-import loses nothing, now that the command publishes.
  • The new team-repo test fails on main's codebase-cmd.ts (expected false to be true) and passes at the head.
  • npm run build, npx tsc --noEmit and npm run lint pass. npx vitest run codebase-deep-enrich import-dir import-repo-list codebase-reconcile commands-reference: 88 passed.
  • Real CLI with the built head: isolated HOME, a local bare remote and a stub claude that fails.
    • teamai import --dir "./my svc" exits 1 and prints Run `teamai codebase --deep-enrich --project 'my svc'` to retry.
    • I left an uncommitted teamwiki/product/login.md in the clone, then ran that printed command as-is. It exits 1 (AI docs missing, as expected) and prints ✔ Pushed to team knowledge repo. The remote gets [teamai] Deep enrich: my svc with the graph docs, router.md and progress.json.
    • The member's product page stays out of that commit and uncommitted in the clone.
  • The branch merges cleanly into current main (2ee2087), and no file overlaps.

CI review: no findings. I agree.

Note, not blocking: if main moves during a long deep-enrich run, the push is rejected and the error says to run teamai pull and rerun. That matches --reconcile and import, so it is not a change in this PR.

@SaulMoro
SaulMoro merged commit 7a0c52a into Tencent:main Oct 29, 2026
18 checks passed
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…ent#1560)

In a team repo, `teamai codebase --deep-enrich --project <slug>` now takes the teamwiki lock and publishes what it wrote (the project's evidence directory, `teamwiki/router.md` and `teamwiki/index.md`), as `--reconcile` and `import` do, so the clone is left clean and the next `teamai push` no longer fails. `--output` and `--dry-run` do not publish.

An incomplete deep enrich after a team-repo import now suggests `teamai codebase --deep-enrich --project <slug>` (slug shell-quoted) instead of re-running the import.

Fixes Tencent#1537.
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.

[bug] codebase --deep-enrich in a team repo reports success but never publishes, and leaves the team clone dirty

4 participants