teamai-cli 0.16.2 → 0.16.4

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.
package/README.en.md DELETED
@@ -1,325 +0,0 @@
1
- # TeamAI — Git-native Team AI Experience Sharing
2
-
3
- > [English](README.en.md) | [简体中文](README.md)
4
-
5
- [![CI](https://github.com/Tencent/teamai-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/Tencent/teamai-cli/actions/workflows/ci.yml)
6
- [![npm version](https://img.shields.io/npm/v/teamai-cli.svg)](https://www.npmjs.com/package/teamai-cli)
7
- [![npm downloads](https://img.shields.io/npm/dm/teamai-cli.svg)](https://www.npmjs.com/package/teamai-cli)
8
- [![Node.js](https://img.shields.io/node/v/teamai-cli.svg)](https://nodejs.org)
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
-
11
- A Git-native tool for sharing AI experience across your team. Automatically syncs skills, rules, docs, and other AI-tool configuration between team members.
12
-
13
- **Supported AI tools:** Claude Code, Codex, Cursor, CodeBuddy IDE (plus their Internal variants), as well as Gemini CLI, Windsurf, Trae, Aider, Amp, OpenClaw, and 20+ other AI coding tools (skills sync).
14
- **Supported git hosts:** **GitHub** and Tencent Gongfeng TGit (`git.woa.com`), auto-detected from the repo URL or install channel.
15
-
16
- > 📖 **Full usage guide:** [docs/usage-guide.md](docs/usage-guide.md) — covers everything from team creation to day-to-day use.
17
- > 📚 **Provider notes:** [docs/providers.md](docs/providers.md) — GitHub / TGit differences and auth setup.
18
-
19
- Questions or suggestions are welcome — please open a PR or an Issue and help build this project together.
20
-
21
- ## Install
22
-
23
- ```bash
24
- npm install -g teamai-cli
25
- ```
26
-
27
- <details>
28
- <summary>Tencent internal users: install <code>@tencent/teamai-cli</code> via tnpm</summary>
29
-
30
- ```bash
31
- npm install -g @tencent/teamai-cli --registry=http://r.tnpm.oa.com
32
- ```
33
-
34
- The two packages share identical source code; `@tencent/teamai-cli` is just the internal mirror of the public `teamai-cli`.
35
- </details>
36
-
37
- ## Quick Start
38
-
39
- ### Team members
40
-
41
- ```bash
42
- # User-scope init (default, resources installed under ~/)
43
- teamai init --repo yourteam/yourproject
44
-
45
- # Project-scope init (resources installed under the project directory)
46
- cd /path/to/my-project
47
- teamai init --repo yourteam/yourproject --scope project
48
-
49
- # Non-interactive mode (for CI/CD or AI-agent automation)
50
- teamai init --repo yourteam/yourproject --scope user --role hai_dev --force
51
- ```
52
-
53
- ### Admins
54
-
55
- First create the shared-experience repo on your git host (GitHub by default; TGit also supported) and grant write access to every team member.
56
-
57
- - **GitHub:** create with `gh repo create yourorg/yourproject --private` or via the UI. Then use Settings → Collaborators to add members, and set `master`/`main` as the default branch.
58
- - **TGit (Tencent Gongfeng):** create on [git.woa.com](https://git.woa.com/) and grant master permissions in bulk via user groups.
59
-
60
- The CLI picks a provider automatically from the repo URL:
61
-
62
- - `yourorg/yourrepo` or `https://github.com/yourorg/yourrepo` → GitHub
63
- - `https://git.woa.com/yourteam/yourrepo` → TGit
64
-
65
- ## Commands
66
-
67
- | Command | Description |
68
- |---------|-------------|
69
- | `teamai init [--scope <user\|project>] [--role <id>] [--force]` | Initialize (auto-installs gf CLI, OAuth login, links repo, registers member, configures reviewers, injects hooks) |
70
- | `teamai push [--all] [--role <id>]` | Push local new resources to a dedicated branch and open a Merge Request; new skills prompt interactively for a target namespace (override with `--role`) |
71
- | `teamai pull [--silent]` | Pull team resources and inject them into local AI tools (both scopes pulled sequentially) |
72
- | `teamai status` | Show the diff between local and the team repo |
73
- | `teamai list [type] [--source repo\|local\|all] [--agent <id>]` | List resources (skills\|rules\|docs\|env\|wiki). With `--source local` or `all`, scans skills directories of installed AI agents and tags each skill's origin (`[team]` / `[builtin]` / `[source:<name>]` / `[local-only]`) |
74
- | `teamai skill [list\|show <name>]` | List all skills by default; `show <name>` prints the skill's origin, contributors, installed-agent list, and description summary |
75
- | `teamai members` | List registered team members |
76
- | `teamai remove <type> <name>` | Remove a resource from both the team repo and local, then open an MR (skills\|rules\|wiki) |
77
- | `teamai roles` | Manage team roles (`init`/`list`/`set`/`add`/`remove`/`update`) |
78
- | `teamai source` | Manage cross-team skill subscription sources (`add`/`remove`/`list`/`browse`) |
79
- | `teamai contribute --file <path> [--scope <user\|project>]` | Push an AI-generated experience document to the team repo |
80
- | `teamai recall <query>` | Search the team knowledge base, automatically merging user + project scope results |
81
- | `teamai digest` | Generate a team AI usage weekly digest (skill leaderboard, new/updated skills, session summaries) |
82
- | `teamai hooks` | Manage AI-tool hooks (list / inject / remove) |
83
- | `teamai uninstall [--force]` | Uninstall teamai: remove hooks, rules, skills, env, docs, and `~/.teamai/` |
84
- | `teamai doctor` | Diagnose configuration problems |
85
-
86
- Global options:
87
- - `--dry-run` — preview mode, no real changes
88
- - `--verbose, -v` — verbose output
89
-
90
- ## How It Works
91
-
92
- ```
93
- Member A Member B
94
- create skill / write rules same
95
- │ │
96
- ▼ ▼
97
- teamai push teamai push
98
- │ │
99
- ▼ ▼
100
- create branch + MR create branch + MR
101
- │ │
102
- └──────► team git repo ◄─────────────┘
103
- │ ▲
104
- │ │ reviewer approves + merges MR
105
-
106
- SessionStart hook → teamai pull
107
- auto-synced to every member's local
108
- ```
109
-
110
- - `teamai push` creates a dedicated branch (`teamai/push/<user>/<timestamp>`), pushes it, then opens a Merge Request and assigns reviewers automatically.
111
- - `teamai init` lets you configure default reviewers (stored in the `reviewers` field of `teamai.yaml`).
112
- - `teamai init` injects hooks tailored to each tool's format (`SessionStart`, `Stop`, `PostToolUse`, `UserPromptSubmit`, etc.). During sessions the hooks run `teamai pull`, `teamai update`, tracking, dashboard updates, and so on (supports Claude Code, Codex, Claude Code Internal, Codex Internal, Cursor, CodeBuddy IDE, OpenClaw, WorkBuddy).
113
- - Skills sync to `~/.claude/skills/`, `~/.codex/skills/`, `~/.codex-internal/skills/`, `~/.claude-internal/skills/`, `~/.cursor/skills/`, `~/.codebuddy/skills/`.
114
- - Rules sync to each tool's rules directory and are merged into `CLAUDE.md` via marker comments (supported for claude, claude-internal, codebuddy).
115
- - Knowledge syncs to `~/.teamai/docs/`.
116
- - Learnings sync to `~/.teamai/learnings/` and back the recall index (shared team-wide, not partitioned by role).
117
- - Culture syncs the team culture file (`culture.md`): its frontmatter and body are compiled and injected into every AI tool's `CLAUDE.md`.
118
-
119
- ## Role-scoped Skills
120
-
121
- When the team resource repo enables role-scoped directories, skills are organized under role namespaces. During `teamai init`, the CLI asks you to pick a `primaryRole` and optional `additionalRoles` and writes them to your local `config.yaml`.
122
-
123
- Remote repo layout convention:
124
-
125
- ```text
126
- manifest/roles.yaml # role definitions
127
- skills/<namespace>/<skill>/ # skills organized by namespace
128
- rules/ # global, not role-scoped
129
- ```
130
-
131
- - `teamai pull` reads `manifest/roles.yaml` and only syncs skills under `primaryRole + additionalRoles` namespaces (unioned with tag-filter results).
132
- - Skills install flat from `skills/<namespace>/<skill-name>/` into `<tool>/skills/<skill-name>/` — the namespace layout is invisible to users.
133
- - If two activated namespaces contain a skill with the same name, `pull` fails outright to prevent silent overrides.
134
- - Skills outside both activated namespaces and tag-filter results are cleaned up automatically.
135
- - `rules/`, `docs/`, `learnings/` keep their original behavior and are not role-scoped (learnings are shared team-wide).
136
-
137
- Example config:
138
-
139
- ```yaml
140
- primaryRole: hai
141
- additionalRoles:
142
- - pm
143
- resourceProfileVersion: 1
144
- ```
145
-
146
- This syncs every skill from `skills/common/`, `skills/hai/`, and `skills/pm/`.
147
-
148
- ## Role-scoped Pushing
149
-
150
- In a role-scoped repo, when you push a new skill the CLI auto-detects available namespaces and prompts:
151
-
152
- ```bash
153
- # Interactive namespace selection (recommended)
154
- teamai push
155
- # Output:
156
- # Which namespace should new skills be pushed to?
157
- # 1. common
158
- # 2. hai
159
- # 3. pm
160
- # Choose namespace [1-3] (default: 1 = common):
161
-
162
- # Explicit target namespace
163
- teamai push --role pm
164
- ```
165
-
166
- - With a `primaryRole`, the list expands from `manifest/roles.yaml`.
167
- - Without a `primaryRole`, namespaces are discovered by scanning the team repo's directory structure.
168
- - When only one namespace exists, it's selected automatically — no prompt.
169
- - `--role <id>` temporarily overrides the target namespace.
170
- - Modifying an existing skill keeps its original namespace — no reselection needed.
171
-
172
- On push, the CLI checks `SKILL.md`'s YAML frontmatter (`name`/`description`) and auto-fills anything missing, so you don't have to maintain it by hand.
173
-
174
- ## Team Culture
175
-
176
- Create `culture.md` at the root of the team repo. Use YAML frontmatter for company/team info and the body for cultural guidelines:
177
-
178
- ```markdown
179
- ---
180
- company:
181
- name: Acme Corp
182
- mission: Build great things
183
- values:
184
- - Innovation
185
- - Integrity
186
- team:
187
- name: Platform
188
- mission: Enable developers
189
- goals:
190
- - Ship v2.0
191
- - Improve test coverage
192
- ---
193
-
194
- ## Coding Guidelines
195
-
196
- - Every PR needs at least one reviewer approval
197
- - Direct pushes to master are forbidden
198
- - Test coverage must stay above 80%
199
- ```
200
-
201
- `teamai pull` compiles `culture.md` into structured content and injects it into every AI tool's `CLAUDE.md` (between `<!-- [teamai:culture:start] -->` and `<!-- [teamai:culture:end] -->`). AI coding assistants pick up the team culture on every session.
202
-
203
- ## Cross-team Skill Subscription
204
-
205
- Use `teamai source` to subscribe to other teams' public skill repos. Their skills sync automatically on `pull`:
206
-
207
- ```bash
208
- # Add a subscription source
209
- teamai source add https://github.com/other-team/teamai-public.git --name other-team
210
-
211
- # List subscribed sources
212
- teamai source list
213
-
214
- # Browse skills from a source
215
- teamai source browse other-team
216
-
217
- # Remove a subscription (and clean up its skills)
218
- teamai source remove other-team
219
- ```
220
-
221
- Subscribed skills sync to your local machine on `teamai pull` and coexist with your own team's skills.
222
-
223
- ## Scope
224
-
225
- TeamAI supports two scopes that can coexist:
226
-
227
- | Dimension | User Scope (default) | Project Scope |
228
- |-----------|---------------------|---------------|
229
- | **Install location** | under `~/` (e.g. `~/.claude/skills/`) | under the project (e.g. `<project>/.claude/skills/`) |
230
- | **Config file** | `~/.teamai/config.yaml` | `<project>/.teamai/config.yaml` |
231
- | **Use case** | general team norms, cross-project skills | project-specific skills and rules |
232
- | **Init** | `teamai init --repo <group>/<repo>` | `cd <project> && teamai init --repo <group>/<repo> --scope project` |
233
-
234
- **Dual-scope cooperation:**
235
- - `teamai pull` pulls user and project scopes sequentially; they don't conflict.
236
- - `teamai contribute --scope user/project` lets you pick which repo to push to.
237
- - `teamai recall` merges knowledge bases from both scopes into a single ranking and tags each result with its origin `[user]` / `[project]`.
238
- - The `scope` field in the remote `teamai.yaml` locks the repo's type; member init must match.
239
-
240
- ## Automatic Experience Sharing
241
-
242
- When an AI coding session ends, the Stop hook evaluates session value and prompts you to share:
243
-
244
- ```
245
- AI coding session (ongoing...)
246
-
247
- ▼ PostToolUse hook continuously tracks tool calls and skill usage
248
-
249
- ▼ session ends (Stop hook fires)
250
-
251
- ├─ Smart scoring: tool-call count + tool diversity + skill usage + error retries + session duration
252
- │ (extracted from dashboard events.jsonl, one-shot, out of 100)
253
-
254
- ├─ Score < 35 → stay silent (too few or too uniform calls, not worth summarizing)
255
-
256
- ▼ Score ≥ 35
257
-
258
- AI: "This session was productive — consider running /teamai-share-learnings to share."
259
-
260
- ▼ user accepts
261
-
262
- /teamai-share-learnings (AI sub-agent)
263
- ├─ AI summarizes the session's lessons
264
- ├─ Generates a Markdown document
265
- └─ teamai contribute --file <path> → pushes directly to the team repo's learnings/
266
- ```
267
-
268
- - `/teamai-share-learnings` is a built-in CLI skill, deployed locally by `teamai pull/init`.
269
- - Each session is prompted at most once (de-duplicated); you can always ignore it.
270
- - The document lands directly in `learnings/` and is visible to teammates on their next `pull`.
271
-
272
- ## Team Knowledge Recall
273
-
274
- `teamai recall` implements the "read" side of the knowledge flywheel — the AI can search across accumulated team experience docs:
275
-
276
- ```
277
- contribute (write) → pull (sync + index) → recall (search) → upvote (vote) → better ranking
278
- ```
279
-
280
- ```bash
281
- $ teamai recall "fuse port"
282
- [1/2] MR review caught a FUSE port-conflict bug ★1 [user]
283
- Author: jeffyxu | Score: 18.5 | Tags: troubleshooting, fuse, k8s
284
-
285
- [2/2] FUSE deployment configuration best practices [project]
286
- Author: alice | Score: 12.0 | Tags: fuse, deploy
287
- ```
288
-
289
- - **Dual-scope merged search:** automatically merges user and project scope knowledge bases, each result tagged with its origin.
290
- - Hybrid CJK + English search (Intl.Segmenter + CJK bigrams).
291
- - Searches implicitly upvote matched docs; good docs naturally float up over time.
292
- - Votes are written to each scope's own repo, so attribution stays correct.
293
-
294
- ## Update
295
-
296
- ```bash
297
- teamai update # auto-detect and upgrade to latest
298
- npm update -g teamai-cli # or trigger an npm upgrade manually
299
- ```
300
-
301
- `teamai update` picks the registry based on the installed package name:
302
-
303
- - `teamai-cli` → public npm (`https://registry.npmjs.org`)
304
- - `@tencent/teamai-cli` → internal tnpm (`http://r.tnpm.oa.com`)
305
-
306
- To override the registry manually, set `TEAMAI_NPM_REGISTRY=<url>`.
307
-
308
- ### Auto-update Control
309
-
310
- Auto-update runs on the Stop hook at the end of a session. It can be controlled at two layers:
311
-
312
- | Layer | File | Field | Allowed values |
313
- |-------|------|-------|----------------|
314
- | Team default | `teamai.yaml` | `autoUpdate` | `true` (default) / `false` |
315
- | User override | `~/.teamai/config.yaml` | `updatePolicy` | `auto` / `prompt` / `skip` |
316
-
317
- The user-level `updatePolicy` always wins over the team-level `autoUpdate`.
318
-
319
- ## License
320
-
321
- [MIT](LICENSE)
322
-
323
- ## Contributing
324
-
325
- PRs are welcome! Please read [CONTRIBUTING.md](.github/CONTRIBUTING.md) first.