teamai-cli 0.25.0 → 0.26.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.zh-CN.md +6 -0
  3. package/dist/index.js +6147 -3346
  4. package/package.json +4 -1
  5. package/skill-data/core/SKILL.md +114 -0
  6. package/skill-data/core/references/commands.md +339 -0
  7. package/{skills/teamai → skill-data/core}/references/contribute-member.md +13 -10
  8. package/{skills/teamai → skill-data/core}/references/troubleshooting.md +9 -1
  9. package/skill-data/setup/SKILL.md +76 -0
  10. package/{skills/teamai → skill-data/setup}/references/join-member.md +17 -14
  11. package/{skills/teamai → skill-data/setup}/references/manage-admin.md +18 -6
  12. package/{skills/teamai → skill-data/setup}/references/provider-tgit.md +9 -6
  13. package/{skills/teamai → skill-data/setup}/references/setup-admin.md +41 -35
  14. package/skill-data/share/SKILL.md +70 -0
  15. package/skill-data/share/references/doc-template.md +44 -0
  16. package/skill-data/wiki/SKILL.md +314 -0
  17. package/skill-data/wiki/references/agents/graph-rag-agent.md +344 -0
  18. package/skill-data/wiki/references/agents/kb-doc-generator.md +323 -0
  19. package/skill-data/wiki/references/methodology/phase0-collection.md +54 -0
  20. package/skill-data/wiki/references/methodology/phase1-reverse-engineering.md +89 -0
  21. package/skill-data/wiki/references/methodology/phase2-document-types.md +341 -0
  22. package/skill-data/wiki/references/methodology/phase3-ai-enhancement.md +164 -0
  23. package/skill-data/wiki/references/methodology/phase4-quality.md +232 -0
  24. package/skill-data/wiki/references/overview.md +124 -0
  25. package/skill-data/wiki/references/phases/k1-reverse-engineering.md +118 -0
  26. package/skill-data/wiki/references/phases/k2-documents.md +68 -0
  27. package/skill-data/wiki/references/phases/k3-ai-native.md +121 -0
  28. package/skill-data/wiki/references/phases/k4-quality.md +190 -0
  29. package/skill-data/wiki/references/phases/phase0-init.md +112 -0
  30. package/skill-data/wiki/references/templates/project-overview.md +148 -0
  31. package/{skills/team-wiki-codebase → skill-data/wiki}/scripts/scan_repo.py +52 -52
  32. package/{skills/team-wiki-codebase → skill-data/wiki}/scripts/validate_kb.py +68 -62
  33. package/skills/teamai/SKILL.md +28 -128
  34. package/skills/team-wiki-codebase/README.md +0 -121
  35. package/skills/team-wiki-codebase/SKILL.md +0 -905
  36. package/skills/team-wiki-codebase/references/agents/graph-rag-agent.md +0 -344
  37. package/skills/team-wiki-codebase/references/agents/kb-doc-generator.md +0 -323
  38. package/skills/team-wiki-codebase/references/methodology/phase0-collection.md +0 -54
  39. package/skills/team-wiki-codebase/references/methodology/phase1-reverse-engineering.md +0 -89
  40. package/skills/team-wiki-codebase/references/methodology/phase2-document-types.md +0 -341
  41. package/skills/team-wiki-codebase/references/methodology/phase3-ai-enhancement.md +0 -164
  42. package/skills/team-wiki-codebase/references/methodology/phase4-quality.md +0 -232
  43. package/skills/team-wiki-codebase/references/templates/project-overview.md +0 -148
  44. package/skills/teamai-share-learnings/SKILL.md +0 -87
  45. /package/{skills/teamai → skill-data/setup}/references/uninstall.md +0 -0
@@ -1,146 +1,46 @@
1
1
  ---
2
2
  name: teamai
3
3
  description: >-
4
- Guide for TeamAI — the CLI that syncs a team's AI skills, rules, docs, and env
5
- across AI coding tools (set up, join, manage, contribute, uninstall). Invoke
6
- ONLY when the user explicitly runs `/teamai`. Do NOT auto-trigger from ordinary
7
- conversation, even if words like "team", "skill", or "sync" appear.
4
+ Make every team AI native — TeamAI syncs a team's AI skills, rules, docs and env across AI coding
5
+ tools. Use when the task operates on team-shared AI configuration or team knowledge: setting up a
6
+ team repo, joining one, managing members, syncing with pull or push, or checking team status.
7
+ Also use to build or query a codebase knowledge base for a large multi-repo project (architecture
8
+ analysis, architecture reverse-engineering, code-to-knowledge, team-wiki-codebase, architecture wiki),
9
+ and to share what a session taught you back to the team (share session learnings, contribute a
10
+ learning, share what I learned with my team), including
11
+ after a friction reminder. Triggers include "set up teamai", "join the team repo", "sync team
12
+ skills", "team wiki", "share what I learned", and running /teamai. Talking about a team needs no
13
+ skill; operating on what the team shares does.
14
+ allowed-tools: Bash(teamai skill:*), Bash(npx teamai-cli skill:*)
8
15
  ---
9
16
 
10
- # TeamAI — Team AI Skills & Rules Sync
17
+ # teamai
11
18
 
12
- You are guiding a user through TeamAI. **They may not know Git.** You run the
13
- commands; they only make choices when you ask. Follow the steps literally —
14
- do not skip, reorder, or invent commands.
19
+ Make every team AI native — one shared foundation for the skills, rules, docs and env a team works with.
15
20
 
16
- ## STEP 0 — Progressive disclosure (do this first, every time)
21
+ Install: `npm i -g teamai-cli@latest` (Node.js >= 20). If `teamai skill get` is not recognised, the installed CLI predates it; upgrade the same way.
17
22
 
18
- Look at what the user typed after `/teamai`.
23
+ ## Start here
19
24
 
20
- **If they gave NO scenario** (bare `/teamai`, or only greetings/no task):
21
- print the menu below **exactly**, then **STOP and wait**. Take no other action —
22
- do not run any command, do not read any reference file yet.
25
+ This file is a discovery stub, not the usage guide. Load the workflow from the CLI before running anything, so the instructions match the installed version:
23
26
 
27
+ ```bash
28
+ teamai skill get core # daily work: routing, pull, push, status, doctor
29
+ teamai skill get core --full # adds the full command reference and troubleshooting
24
30
  ```
25
- teamai — Team AI Skills & Rules Sync
26
-
27
- Usage examples (copy one to get started):
28
-
29
- 🏗️ Admin — set up a new team repo:
30
- /teamai Help me set up TeamAI for my team from scratch
31
-
32
- 🤝 Member — join an existing team:
33
- /teamai Help me join my team's TeamAI, repo URL is https://...
34
31
 
35
- 🔧 Admin — daily management (publish & update skills, rules, MCP, env):
36
- /teamai I already have TeamAI set up, help me manage it
32
+ The CLI serves skill content that always matches the installed version, so instructions never go stale. The content in this stub cannot change between releases, which is why it just points at `skill get`.
37
33
 
38
- 📊 Anyone — open the team dashboard:
39
- /teamai Open the TeamAI dashboard
34
+ ## Specialized workflows
40
35
 
41
- 💡 Member — share a skill with the team (just ask in plain language):
42
- /teamai Share this <skill-name> skill with my team
43
-
44
- 🗑️ Anyone — remove TeamAI from this machine:
45
- /teamai Uninstall TeamAI
36
+ ```bash
37
+ teamai skill get setup # day 0: create a team repo (admin) or join one (member), manage, uninstall
38
+ teamai skill get wiki # large multi-repo codebase: architecture reverse-engineering and knowledge base
39
+ teamai skill get share # turn what this session taught you into a team learning (needs recall on)
46
40
  ```
47
41
 
48
- **If they DID describe a scenario**, match it to one row of the table below,
49
- then open that reference file and follow it step by step.
50
-
51
- | The user wants to… | Load this reference |
52
- |-----------------------------------------------------|------------------------------------------|
53
- | Set up TeamAI for a team from scratch (create repo) | `references/setup-admin.md` |
54
- | Join their team (with or without a repo URL) | `references/join-member.md` |
55
- | Manage a team: publish/update skills, rules, MCP, env, invite members | `references/manage-admin.md` |
56
- | Share / publish a skill with the team ("share this xxx skill") — any member, not just admins | `references/contribute-member.md` |
57
- | Open the team dashboard (web UI) | run `teamai dashboard` (see cheat sheet) |
58
- | Remove / uninstall TeamAI from this machine | `references/uninstall.md` |
59
-
60
- > **Sharing session *learnings* is automatic — not a menu choice, and not routed
61
- > here.** TeamAI prompts on its own at the end of a session worth sharing, and the
62
- > separate **`teamai-share-learnings`** skill summarizes it and runs
63
- > `teamai contribute`. The user never asks for it through `/teamai`. (Only when the
64
- > admin left team sharing on — the default.) The `contribute-member.md` row above is
65
- > a *different* task: a member **publishing a reusable skill** on request ("share
66
- > this xxx skill with my team").
42
+ Publishing a skill, rule or doc the user already has is in `core`; it needs no recall.
67
43
 
68
- Choosing between "set up" and "join": a user **setting up a new team** becomes its
69
- admin and creates the repo; a user **joining an existing team** needs a repo URL
70
- from their admin. If someone wants to join but has no URL, that is still the
71
- **join** flow — `join-member.md` tells them to ask their admin for it. Do **not**
72
- send a would-be member to the setup/create-repo flow just because they lack a URL.
73
-
74
- If the request is ambiguous (e.g. "help me with teamai" with no direction),
75
- ask ONE short question to pick a row, then proceed. When something breaks at any
76
- step, load `references/troubleshooting.md`.
77
-
78
- ## Global rules (apply to every scenario)
79
-
80
- 1. **Reply in the user's language — including every example and hand-off blurb.**
81
- Answer in whatever language the user used to invoke the skill (Chinese in →
82
- Chinese out, English in → English out, and so on), for the whole conversation.
83
- This applies to **everything you write**, not just prose: the reference files
84
- below are written in English, but any ready-made sentence they hand you — the
85
- invite line you give an admin to forward to members, the one-line explanations,
86
- the "what's next" summary — **must be translated into the user's language before
87
- you show it.** Do not paste an English example at a Chinese-speaking user.
88
- *Only* commands, flags, URLs, file paths, and code identifiers stay verbatim
89
- (never translate `teamai pull`, `--scope user`, `/teamai`, a repo URL, etc.).
90
- Example: for a Chinese user, the member-invite line becomes
91
- `/teamai 帮我加入团队的 TeamAI,仓库地址是 https://...`, not the English form.
92
- 2. **Never teach Git.** Do not mention branches, commits, clone, or push/pull of
93
- Git itself. TeamAI hides all of that. The user thinks in terms of "my team's
94
- skills", not repositories.
95
- 3. **Always use a full URL** for the team repo (e.g.
96
- `https://github.com/yourorg/yourrepo`). Never use the `owner/repo` short form.
97
- 4. **You run the commands.** Only pause to ask the user when you need a web login,
98
- a value only they know, or a genuine either/or choice. Show each command before
99
- you run it, in one short line.
100
- 5. **Detect the current AI tool first.** TeamAI behaves differently per host. Note
101
- which tool this conversation is running in (Claude Code, Cursor, CodeBuddy,
102
- WorkBuddy, ChatGPT App, Codex, OpenCode, Kiro, Gemini CLI, …). When you reopen a
103
- session, use the name of **this** tool — do not assume Claude Code or Cursor.
104
- Some hosts need extra manual steps for hooks — see
105
- `references/troubleshooting.md` ("Agent-specific caveats").
106
- 6. **Prerequisite:** Node.js ≥ 20. Install once with `npm install -g teamai-cli`
107
- and verify with `teamai --version`.
108
- 7. **Finish with `teamai doctor`.** Every setup/onboarding flow ends by running
109
- `teamai doctor` and resolving whatever it reports before you call it done.
110
- 8. **After init, resources appear on the NEXT session.** `teamai init` injects a
111
- session-start hook that auto-runs `teamai pull`. It is normal that the skills/
112
- rules directories are empty right after init — they fill in when the user opens
113
- a fresh session in this tool. To sync immediately, run `teamai pull`.
114
- 9. **Don't limit which AI tools get set up — cover all of them by default.** Unless
115
- the user explicitly says "only install to Claude Code" (or names specific
116
- tools), do **not** pass `--agent` to restrict the install. Let `teamai init` set
117
- up **every AI tool already installed on the machine** (omitting `--agent` gives
118
- an interactive picker; select all detected tools, or the user's stated subset).
119
- **After init, report which agents were set up** — tell the user, in their
120
- language, exactly which tools will now auto-start TeamAI (and which detected
121
- tools were skipped and why, e.g. Codex trust-gate / CodeBuddy design). Verify
122
- the real per-tool result with `teamai doctor` / `teamai hooks list`.
123
-
124
- ## Command cheat sheet (ground truth — do not invent flags)
125
-
126
- ```bash
127
- teamai init <full-repo-url> # Set up / join a team (configure provider, clone, register)
128
- teamai init <url> --scope user # Install for the whole machine instead of just this project
129
- teamai pull # Sync team resources into local AI tools now
130
- teamai push # Publish your local skills/rules/docs to the team
131
- teamai doctor # Diagnose configuration and hook problems
132
- teamai status # Show local vs team differences
133
- teamai list # List resources (skills|rules|docs|env|agents|hooks|mcp)
134
- teamai members # See team members (subcommand: teamai members list)
135
- teamai roles # Manage roles / resource namespaces
136
- teamai projects # Manage multiple projects from one repo (list|set|members)
137
- teamai packages # Install team-declared npm packages & Claude plugins
138
- teamai env # Manage shared team environment variables
139
- teamai dashboard # Open the AI coding session dashboard (web UI, default port 3721)
140
- teamai contribute --file <p> --title <t> # Contribute a knowledge doc (usually via the teamai-share-learnings skill)
141
- ```
44
+ A friction reminder at the end of a turn means `teamai skill get share`.
142
45
 
143
- Anything not in this cheat sheet: check `teamai <command> --help` before using it.
144
- Do **not** guess flags (for example, there is no member-invite flag in the CLI —
145
- inviting a member is done on the Git platform's website; see
146
- `references/manage-admin.md`).
46
+ `teamai skill list` shows everything the installed version serves. `teamai skill path <name>` prints the directory holding a skill's scripts and templates.
@@ -1,121 +0,0 @@
1
- # team-wiki-codebase — 大型代码库 AI 认知工程
2
-
3
- > TeamAI builtin skill:方法论、脚本与 Agent 规范随 `teamai pull` / `teamai init` 部署到项目的 `.codebuddy/`、`.cursor/` 等目录。TeamAI does not ship a separate team-wiki CLI. No extra plugin is required.
4
-
5
- ## 为什么需要这个 skill
6
-
7
- 大型项目的 AI 理解困境:
8
-
9
- | 痛点 | 具体表现 |
10
- |------|---------|
11
- | **上下文装不下** | 10+ 仓库、数十万行代码,远超 AI 上下文窗口 |
12
- | **关系看不清** | 微服务间的 RPC/MQ/DB 依赖散落在各仓库,没有全局视图 |
13
- | **规则记不住** | 业务约束、状态机、配置参数隐藏在深层调用链中 |
14
- | **回答不准确** | AI 只看到局部代码,缺乏全局架构认知,容易幻觉 |
15
- | **token 消耗大** | 每次提问都要重新读大量源码,效率极低 |
16
-
17
- ## 怎么解决
18
-
19
- 通过架构逆向工程,将海量代码**压缩为结构化知识库**:
20
-
21
- - 每个结论有代码 `文件:行号` 作为证据
22
- - 每条组件关系有置信度标注(`EXTRACTED` / `INFERRED` / `AMBIGUOUS`)
23
- - 每次生成后有准确性统计,超标自动警告
24
- - AI 读知识库而非读源码,**约 1/50 的 token 消耗**获得全局架构认知
25
- - Phase 0 可用 `teamai codebase --extract` 生成可证据化的结构边(TS/JS/Python/Go AST + 多语言 heuristic)
26
- - 提取后可用 `teamai codebase --deep-enrich --project <slug> --output <repo>` 生成确定性图谱文档(G1/G2/G3)与深度知识;无需单独的 team-wiki CLI
27
-
28
- ---
29
-
30
- ## 产出体系
31
-
32
- ```
33
- <output_dir>/
34
- ├── README.md ← 检索路由指引(AI 专用)
35
- ├── {项目名} 技术架构.md ← 系统全貌,~200KB
36
- ├── {项目名} 业务架构.md ← 产品能力 + 生命周期
37
- ├── {项目名} 部署架构.md ← 部署拓扑
38
- ├── XX_{组件名}设计说明.md × N ← 每组件一份,含 AI 快速理解表
39
- ├── XX_{项目名}核心API产品代码映射.md ← 产品约束→代码位置 桥梁文档
40
- ├── XX_{项目名}产品规则速查表.md
41
- ├── XX_{项目名}业务开发规范SOP.md
42
- ├── {反模式/RPC契约/排障记录} × N
43
- ├── _manifest.json ← 机器可读 manifest(供后续图谱合并)
44
- └── graph/ ← Graph RAG 图谱文档集
45
- ├── G1 组件依赖关系矩阵
46
- ├── G2 调用链路全景 + 状态机
47
- ├── G3 数据流与存储依赖图
48
- ├── G4 错误码组件映射表
49
- ├── G5 跨组件交互场景手册(≥10个时序图)
50
- ├── G6 知识图谱三元组(≥100条,含置信度)
51
- ├── G7 架构风险与影响面分析
52
- ├── G8 核心配置参数索引
53
- └── G9 业务规则约束矩阵 + AI 推理决策树
54
- ```
55
-
56
- ---
57
-
58
- ## 执行流程
59
-
60
- ```
61
- Phase 0 → 初始化:收集路径、项目名、产品文档来源;可选 CLI ast+heuristic 结构基线
62
-
63
- Phase K1 → 架构逆向:关键文件提取 → 分层分析 → 组件关系矩阵
64
- ⛔ 确认点① 架构理解确认
65
-
66
- Phase K2 → 文档生成(分批并行):
67
- 批次1~4: Type-4 组件文档(并行子 Agent 分发)
68
- ⛔ 确认点② 文档质量抽查
69
- 批次5~7: 架构总览 + 桥梁文档 + 知识增强
70
-
71
- Phase K3 → AI-Native 增强:
72
- search-anchor + 双向链接 + 检索路由规则
73
- Graph RAG 图谱文档集 G1~G9(置信度三态标注)
74
-
75
- Phase K4 → 质量评估:
76
- validate_kb.py 自动检验
77
- 全库准确性审计([UNVERIFIED] 统计 + 接口覆盖率)
78
- 跨文档一致性校验(矛盾检测 + 自动修复)
79
- RAG 检索抽检(7类问题)
80
- AI 端到端验证(10~15 个标准问题 + 代码回溯)
81
- 生成质量报告
82
- ```
83
-
84
- 支持 `--update` 增量更新(基于文件 hash 缓存,只重跑变更组件)。
85
-
86
- ---
87
-
88
- ## 文件结构
89
-
90
- ```
91
- team-wiki-codebase/
92
- ├── SKILL.md ← 主执行指令(AI 加载)
93
- ├── README.md ← 本文件
94
- ├── scripts/
95
- │ ├── scan_repo.py ← 仓库扫描辅助工具
96
- │ └── validate_kb.py ← 知识库质量校验工具
97
- └── references/
98
- ├── agents/
99
- │ ├── kb-doc-generator.md ← Type-1~8 文档生成专职 Agent
100
- │ └── graph-rag-agent.md ← G1~G9 图谱文档专职 Agent
101
- ├── methodology/
102
- │ ├── phase0-collection.md ← 源材料采集方法
103
- │ ├── phase1-reverse-engineering.md ← 架构逆向工程方法
104
- │ ├── phase2-document-types.md ← 九大文档类型规范与质量标准
105
- │ ├── phase3-ai-enhancement.md ← AI-Native 增强方法
106
- │ └── phase4-quality.md ← 质量评估 Checklist
107
- └── templates/
108
- └── project-overview.md ← 知识库 README 模板(含认知边界声明)
109
- ```
110
-
111
- ---
112
-
113
- ## 质量标准
114
-
115
- | 维度 | 达标标准 |
116
- |------|---------|
117
- | 覆盖率 | ≥90% P0 核心组件有文档 |
118
- | 准确性 | [UNVERIFIED] < 15% |
119
- | 结构质量 | 死链接=0,search-anchor 覆盖率≥95% |
120
- | AI 可用性 | RAG 检索抽检准确率≥85% |
121
- | 关系可信度 | AMBIGUOUS 关系 < 10%,全部列入待确认清单 |