Skip to content

feat(import): deep knowledge generation + team-wiki-codebase skill#52

Closed
m0Nst3r873 wants to merge 7 commits into
Tencent:mainfrom
m0Nst3r873:feat/deep-enrich-skill
Closed

feat(import): deep knowledge generation + team-wiki-codebase skill#52
m0Nst3r873 wants to merge 7 commits into
Tencent:mainfrom
m0Nst3r873:feat/deep-enrich-skill

Conversation

@m0Nst3r873

Copy link
Copy Markdown
Contributor

Summary

Depends on #51.

  • deep-enrich.ts: background THPC-quality knowledge generation
    • Component design docs (AI quick-understanding table + architecture)
    • Architecture overview (ASCII diagram + component matrix)
    • Graph documents G1-G3 (deterministic)
    • Progress tracking with resume support
  • Bundle team-wiki-codebase skill (909-line methodology)
  • Security fixes: prompt injection defense, JSON parse resilience, path traversal guard

19 files, +3740 lines.

Test plan

  • npx tsc --noEmit
  • npx vitest run (1470 passed)
  • teamai deep-enrich --project produces docs/*.md
  • Skill deploys to ~/.claude/skills/ on pull

jaelgeng added 6 commits June 26, 2026 11:36
Vendored from team-wiki by @lurkacai (git.woa.com/lurkacai/team-wiki).
Import paths adjusted for teamai-cli project structure.

Files copied (all pure deterministic, no AI dependency):
- core/graph-index.schema.ts: graph node/edge types, merge, save/load
- core/wiki-protocol.ts: wiki category/confidence types, slugify
- code-knowledge/code-collector.ts: file collection with git-aware filtering
- code-knowledge/code-extractors.ts: multi-language fact extraction dispatch
- code-knowledge/code-graph.ts: build CodeGraphIndex from facts
- code-knowledge/code-incremental.ts: detect changed files via manifest
- code-knowledge/extractors/*: TS/Python/Go/Java/Rust/Config extractors
- interface-scanner.ts: HTTP/MQ/RPC endpoint detection (5 languages)
- call-chain-tracer.ts: 4-layer call chain tracing
- code-graph-overlay.ts: directory-level architecture nodes
- doc-graph-extractor.ts: extract API/config/error nodes from docs
- manifest-schema.ts: V2 manifest types (entrypoints, responsibilities)
Wire up vendored modules into the teamai extraction flow:

- adapters/index.ts: unified export layer for all wiki-engine modules
- adapters/templates.ts: router.md + index.md generation templates
- codebase-extract.ts: full extraction pipeline
  collectCode → extractCodeFacts → scanInterfaces → traceCallChains
  → buildEvidencePages (interfaces.md + call-chains.md)
  → buildIndexHubOverlay → mergedGraph → graph-index.json
  → buildModuleSummaries → detectKnowledgeGaps → router/index/hot/gaps
- utils/hook-output.ts: multi-tool Stop hook output formatting
- interface-scanner: HTTP/MQ/RPC detection across languages (12 tests)
- call-chain-tracer: entry detection, layer classification (8 tests)
- code-graph-overlay: buildIndexHubOverlay node/edge generation (5 tests)
- doc-graph-extractor: structure + entity extraction (8 tests)
- hook-output: formatStopHookOutput multi-tool format (6 tests)

All tests use in-memory data, no filesystem/network dependencies.
New modules (vendored/adapted from team-wiki by @lurkacai):
- knowledge-reconciler.ts: 9-phase product↔code reconciliation
- reconciler-v2-types.ts: NumericConfidence scoring types
- manifest-compiler.ts: consume ManifestV2 → wiki pages

New teamai modules:
- enrich-with-ai.ts: per-module AI responsibility inference +
  repo-level domain classification via callClaudeParallel
- rebuild-wiki-index.ts: generate table-based router.md + stats index.md
  from _manifest.json + _domains.json + overview.md
- utils/git.ts: add autoPushTeamRepo for auto-push after import

Updated:
- wiki-engine/adapters/index.ts: export reconciler + confidence types
- wiki-engine/adapters/templates.ts: DomainGroup router + IndexStats
…ication

- import-repo.ts: add reconcile call after extraction, remove entire
  legacy AI domain classification flow (recommendDomain → domains.yaml)
- import-org.ts: add rebuildWikiIndex + autoPush after batch import
- codebase-extract.ts: integrate AI enrichment (enrichWithAI +
  writeManifest + _domains.json), domain-grouped router/index
- Tests updated to match new import flow
1. deep-enrich.ts: background THPC-quality knowledge generation
   - Phase 1: Component design docs per module (parallel AI calls)
   - Phase 2: Architecture overview document
   - Phase 3: Graph documents G1-G3 (deterministic)
   - Progress tracking with _review/progress.json resume support

2. skills/team-wiki-codebase/: bundled deep generation skill (by @lurkacai)
   - 909-line SKILL.md methodology (K0-K4 phases)
   - Sub-agents: kb-doc-generator, graph-rag-agent
   - Registered in builtin-skills.ts for auto-deploy on pull
@m0Nst3r873 m0Nst3r873 force-pushed the feat/deep-enrich-skill branch from bfb7c26 to ebb3f08 Compare June 26, 2026 03:47
Security (M1/M2/M4):
- enrich-with-ai.ts: sanitizeForPrompt() for prompt injection defense
- import-repo.ts: independent JSON.parse try/catch with warn logging
- knowledge-reconciler.ts: reject '../' and absolute paths

Integration from main:
- import-repo.ts: deep-enrich trigger + reconcile call
- index.ts: hidden deep-enrich command + recall depth option
- recall.ts + code-knowledge-recall.ts: codebase graph recall
- contribute-check.ts: scoring adjustments + hook output fix
- hook-handlers.ts: formatStopHookOutput multi-tool compat
- clone.ts: HTTPS upgrade + SSH conversion
- pull.ts: MCP registration + teamwiki sync
- ci/extract-mr.ts: graph change detection in MR pipeline
- README: teamwiki docs + CLI command table simplification
- Various test updates to match new behavior
@m0Nst3r873 m0Nst3r873 force-pushed the feat/deep-enrich-skill branch from ebb3f08 to 60b5bd0 Compare June 26, 2026 03:52
@m0Nst3r873 m0Nst3r873 closed this Jun 26, 2026
@m0Nst3r873

Copy link
Copy Markdown
Contributor Author

Closing in favor of restructured PRs with bug fixes. The code has been reorganized into functionally-complete PRs where each PR includes its CLI entry point (no dead code). See the new PR series.

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.

1 participant