Skip to content

chore: remove dead code and duplicate compat shims - #96

Merged
jeff-r2026 merged 2 commits into
mainfrom
chore/issue-86-dead-code-cleanup
Jul 1, 2026
Merged

chore: remove dead code and duplicate compat shims#96
jeff-r2026 merged 2 commits into
mainfrom
chore/issue-86-dead-code-cleanup

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Summary

Resolves #86. Batched cleanup of confirmed-dead code and duplicate compat shims:

  • wiki-engine/manifest-compiler.ts — deleted. Comment claimed it's invoked via teamai codebase --compile, but that flag was never wired into codebase-cmd.ts; zero importers.
  • wiki-engine/doc-graph-extractor.ts — deleted. Only ever exercised by its own unit test, never wired into the extract/import flow.
  • utils/source-conflict.ts (recordSourceUpdate) — deleted. Production only reads source-marks.jsonl (codebase-lint.ts has its own independent parser); nothing ever wrote to it, so multi-source-conflict detection never had data.
  • Dead exports removed: buildCodeGraphIndex/writeCodeGraph (code-graph.ts), scanInterfacesFromFacts (interface-scanner.ts), fromLegacyConfidence (reconciler-v2-types.ts), plus their exclusive private helpers — all zero-caller, zero-test-coverage.
  • save-session CLI command chain (session-collector.ts) — deleted. Never wired into any hook; its push --sessions landing path is still only an aspirational line in docs/designs/team-intelligence-platform.md; duplicates contribute-check.ts's actively-used per-session state.
  • utils/gf-cli.ts / utils/repo-url.ts — deleted. Pure backward-compat re-export shims for providers/tgit/*, referenced only by tests (several of which mocked the shim path even though the code under test had already migrated to import the provider path directly — cleaned those up too).
  • @deprecated CodeGraphIndex type alias — removed; renamed its one remaining usage (codebase-wiki-lint.ts) to GraphIndex directly. Pure type-level change, erased at compile time.

Deliberately left alone (both are live code paths, not confirmed-dead — need a maintainer call, not a unilateral deletion):

  • docs/team-codebase vs teamwiki/ dual-track: import-mr.ts still calls the old applyCodebaseSuggestions on every MR import, while src/ci/extract-mr.ts has already moved to the teamwiki graph engine. No commit/doc declares the old path superseded.
  • Legacy hidden hook subcommands (TEAMAI_LEGACY_HOOK_SUBCOMMANDS in hooks.ts) — still have real, working CLI handlers kept for migrating old tool-settings configs onto hook-dispatch. No sunset condition recorded anywhere in code or docs.

Net: 22 files changed, +5/-1183 lines.

Test plan

  • npx tsc --noEmit — clean
  • npx vitest run — 128 test files, 1656 tests passing
  • npm run build — tsup build succeeds
  • Verified via git log -S/grep that no commit ahead of this branch's base introduces new references to any removed symbol

🤖 Generated with Claude Code

jeff-r2026 and others added 2 commits July 1, 2026 16:01
Deletes code confirmed to have zero production callers and zero test
coverage beyond its own dedicated tests:

- wiki-engine/manifest-compiler.ts: comment claimed it's invoked via
  `teamai codebase --compile`, but that flag was never wired into
  codebase-cmd.ts.
- wiki-engine/doc-graph-extractor.ts: only ever exercised by its own
  unit test, never wired into the extract/import flow.
- utils/source-conflict.ts (recordSourceUpdate): production only reads
  source-marks.jsonl (codebase-lint.ts has its own independent parser),
  nothing ever writes to it, so multi-source-conflict detection never
  had data to work with.
- Dead exports: buildCodeGraphIndex/writeCodeGraph (code-graph.ts),
  scanInterfacesFromFacts (interface-scanner.ts), fromLegacyConfidence
  (reconciler-v2-types.ts), plus their exclusive private helpers.
- save-session CLI command chain (session-collector.ts): never wired
  into any hook, its `push --sessions` landing path is still only an
  aspirational line in docs/designs/team-intelligence-platform.md, and
  it duplicates contribute-check.ts's actively-used per-session state.
- utils/gf-cli.ts / utils/repo-url.ts: pure backward-compat re-export
  shims for providers/tgit/*, referenced only by tests (several of
  which were mocking the shim path even though the code under test had
  already migrated to import the provider path directly).
- @deprecated CodeGraphIndex type alias: renamed its one remaining
  usage (codebase-wiki-lint.ts) to GraphIndex directly and dropped the
  alias — pure type-level change, erased at compile time.

Two items from the issue were investigated and deliberately left
alone, since both are live code paths rather than confirmed-dead:
import-mr.ts still depends on the old docs/team-codebase
(applyCodebaseSuggestions) path even though CI's extract-mr.ts has
moved to the teamwiki graph engine, and the legacy hidden hook
subcommands (TEAMAI_LEGACY_HOOK_SUBCOMMANDS) have no sunset condition
recorded anywhere. Both need an explicit maintainer decision rather
than a unilateral deletion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Follow-up to the dead-code cleanup: this command and its e2e test
were removed, but docs/ci-e2e-setup.md's coverage table still listed
it as exercised. docs/designs/team-intelligence-platform.md and
CHANGELOG.md intentionally keep their save-session mentions (the
former is an aspirational future-design doc, the latter is a
historical record of a past release), so only this table needed a fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jeff-r2026
jeff-r2026 merged commit ac4c25d into main Jul 1, 2026
6 of 7 checks passed
@jeff-r2026
jeff-r2026 deleted the chore/issue-86-dead-code-cleanup branch July 2, 2026 08:03
@hsuchifeng hsuchifeng mentioned this pull request Jul 3, 2026
3 tasks
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.

[chore] 死代码与重复实现清理(manifest-compiler / doc-graph-extractor / utils 垫片 / legacy hook 子命令等)

1 participant