teamai-cli 0.26.0-beta.3 → 0.26.0-beta.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamai-cli",
3
- "version": "0.26.0-beta.3",
3
+ "version": "0.26.0-beta.5",
4
4
  "description": "TeamAI — Make Every Team AI Native (skill sync + shared knowledge base, powered by Git)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -28,6 +28,7 @@
28
28
  "test:watch": "vitest",
29
29
  "test:coverage": "vitest run --coverage",
30
30
  "typecheck": "tsc --noEmit",
31
+ "lint": "oxlint --deny-warnings --report-unused-disable-directives",
31
32
  "release": "standard-version",
32
33
  "prepublishOnly": "npm run build"
33
34
  },
@@ -80,7 +81,9 @@
80
81
  "@types/node": "^20.17.0",
81
82
  "@types/semver": "^7.8.0",
82
83
  "@vitest/coverage-v8": "^3.2.7",
84
+ "fast-check": "^4.10.2",
83
85
  "opencode-ai": "1.18.23",
86
+ "oxlint": "1.85.0",
84
87
  "standard-version": "^9.5.0",
85
88
  "tsup": "^8.3.0",
86
89
  "typescript": "^5.7.0",
@@ -105,6 +105,10 @@ teamai recall <q> # Search what the team has already learned
105
105
  Every other command, every flag, and the flags `--help` hides live in the
106
106
  generated reference below. Read it instead of guessing a flag.
107
107
 
108
+ `teamai pull` mirrors the non-hidden docs you receive into `sharing.docs.localDir`,
109
+ removing stale and local-only documents; an edited doc of a docs namespace you left
110
+ is kept and named. Use a dedicated directory; preview with `--dry-run`.
111
+
108
112
  ## References
109
113
 
110
114
  In the files below, `{SKILL_DIR}` is the directory `teamai skill path core` prints; a reference file you open on its own writes that directory as `SKILL_DIR` in braces.
@@ -20,6 +20,7 @@ Generated: do not edit by hand. Regenerate with
20
20
  - `teamai init [repo]` — Initialize teamai (configure Git provider, clone repo, register member)
21
21
  - `--repo <repo>` — Team repo (alias of the positional argument)
22
22
  - `--http <url>` — Git-free HTTP team repo (read-only consumer; only needs an API key)
23
+ - `--provider <name>` — Git provider for the team repo on this machine: tgit, github, cnb, gitlab, gitcode, or git. Skips auto-detection. `git` uses your existing Git auth and needs no platform token, but opens no PR/MR.
23
24
  - `--self` — Single-repo mode: the current git repo is the team repo (equivalent to `teamai init .`). Knowledge lives on main under .teamai/; reports go to the teamai-reports orphan branch.
24
25
  - `--token <key>` — API key for HTTP team repo / status reporting (stored 0600, never committed). Also reads TEAMAI_API_TOKEN.
25
26
  - `--scope <scope>` — Install scope: project (default, <cwd>/.teamai + <cwd>/.claude) or user (~/.teamai + ~/.claude)
@@ -81,6 +82,8 @@ Generated: do not edit by hand. Regenerate with
81
82
 
82
83
  - `teamai remove <type> <names...>` — Remove resource(s) from team repo and all local AI tools (type: skills|rules|agents|mcp)
83
84
  - `--force` — Skip confirmation prompt
85
+ - `--role <ns>` — mcp: remove the server from mcp/<ns>/mcp.yaml instead of the root mcp/mcp.yaml
86
+ - `--project <id>` — mcp: remove the server from the project's mcp namespace instead of the root mcp/mcp.yaml
84
87
 
85
88
  ## packages
86
89
 
@@ -122,12 +125,12 @@ Generated: do not edit by hand. Regenerate with
122
125
  - `teamai projects list` — List defined projects and the ones active in this directory
123
126
  - `teamai projects set [ids...]` — Set the projects active in this directory (comma-separated or repeated; empty to clear)
124
127
  - `teamai projects add <id>` — Add a project to manifest/projects.yaml, creating the file if needed (admin)
125
- - `--namespaces <ns>` — Comma-separated namespaces for every project resource type (e.g. common,checkout)
128
+ - `--namespaces <ns>` — Comma-separated namespaces for knowledge, skills, learnings and agents (e.g. common,checkout); env, hooks, mcp, models and docs are declared by hand
126
129
  - `--name <name>` — Display name for the project
127
130
  - `-d, --description <desc>` — Description for the project
128
131
  - `teamai projects update <id>` — Update a project in manifest/projects.yaml (admin)
129
- - `--add-namespaces <ns>` — Comma-separated namespaces to add to every resource type
130
- - `--remove-namespaces <ns>` — Comma-separated namespaces to remove from every resource type
132
+ - `--add-namespaces <ns>` — Comma-separated namespaces to add to knowledge, skills, learnings and agents
133
+ - `--remove-namespaces <ns>` — Comma-separated namespaces to remove from knowledge, skills, learnings and agents
131
134
  - `--name <name>` — New display name for the project
132
135
  - `-d, --description <desc>` — New description for the project
133
136
  - `teamai projects remove <id>` — Remove a project from manifest/projects.yaml (admin)
@@ -192,7 +195,11 @@ Generated: do not edit by hand. Regenerate with
192
195
  - `--reveal` — Show env variable values in plaintext (default: masked)
193
196
  - `teamai env add <key> <value>` — Add or update a team environment variable
194
197
  - `-d, --description <desc>` — Description for the variable
198
+ - `--role <ns>` — Write to env/<ns>/env.yaml instead of env/env.yaml
199
+ - `--project <id>` — Write to the project's env namespace (resources.env in manifest/projects.yaml)
195
200
  - `teamai env remove <key>` — Remove a team environment variable
201
+ - `--role <ns>` — Remove from env/<ns>/env.yaml instead of env/env.yaml
202
+ - `--project <id>` — Remove from the project's env namespace (resources.env in manifest/projects.yaml)
196
203
 
197
204
  ## hooks
198
205
 
@@ -342,7 +349,7 @@ Generated: do not edit by hand. Regenerate with
342
349
  - `teamai codebase` — Inspect and maintain team-codebase outputs
343
350
  - `--extract [path]` — Extract code knowledge and build graph from source
344
351
  - `--incremental` (hidden) — Only re-extract changed files (requires prior manifest)
345
- - `--project <name>` (hidden) — Project slug for --extract (defaults to directory name) and required for --deep-enrich
352
+ - `--project <name>` (hidden) — Project slug for --extract (defaults to the directory name; a checkout's root uses the repo's name) and required for --deep-enrich
346
353
  - `--max-files <n>` (hidden) — Max source files to scan (default: 200)
347
354
  - `--upgrade-wiki` (hidden) — Migrate docs/team-codebase/ to teamwiki/ graph format
348
355
  - `--lint` — Run global consistency lint over the teamwiki knowledge graph
@@ -97,16 +97,33 @@ The doc lands in the team's `learnings/` and appears for teammates on their next
97
97
  new rule and a new agent land in that namespace too (a project resolves each
98
98
  from its own axis — `knowledge` for rules, `agents` for agents). Without one,
99
99
  a new resource whose namespace cannot be resolved stays at the shared root and
100
- reaches the whole team. Use `--branch <name>` when a new push must target a
100
+ reaches the whole team. An edit of a skill, rule or agent you received from a
101
+ namespace goes back to that namespace, even when it replaces a shared item of
102
+ the same name; the shared one is left as it is. Use `--branch <name>` when a new push must target a
101
103
  specific branch; an existing open PR keeps its recorded branch. TeamAI refuses
102
104
  to reset a team-repo clone with user changes, so commit or stash unrelated
103
105
  modified, staged, untracked, or conflicted files before retrying.
104
106
 
107
+ In single-repo mode, a skill or rule under `.teamai/` that matches an older
108
+ version of the team's file, as it does when the branch is behind the default
109
+ branch, is skipped with a warning that it "is an older version of" that file:
110
+ pushing it would revert a teammate's update. To publish an edit of it, bring
111
+ the current version in first (`git fetch origin && git merge origin/<default>`,
112
+ or copy the team's current file over it), redo the edit on top, and push again.
113
+
105
114
  ## After contributing
106
115
 
107
116
  - Confirm it landed: `teamai list skills` (or `teamai status`).
108
117
  - Teammates receive it automatically on their next session, or via `teamai pull`.
109
118
 
119
+ Before listing rules, `push` refreshes copies whose bodies still match a recorded
120
+ sync revision. Copilot's generated `applyTo` header does not count as a local
121
+ edit: unedited old instructions update in native format, including under
122
+ `COPILOT_HOME` in user scope. Genuine local body edits remain push candidates.
123
+ Rule pre-sync leaves tools excluded by `enabledAgents` or `disabledAgents` untouched.
124
+ When only team `paths` change, `applyTo` refreshes if the local file still matches
125
+ a recorded version's generated copy; locally edited headers are kept.
126
+
110
127
  ## If push is denied
111
128
 
112
129
  A permission error usually means you don't have write access to the team repo.
@@ -48,6 +48,21 @@ This is the #1 onboarding issue. In order:
48
48
  belongs in the team repo's `manifest/roles.yaml` or `manifest/projects.yaml`,
49
49
  which the error names by entry — tell the user to ask a team admin. Do not
50
50
  delete the manifest or edit the local clone to get past it.
51
+ `recall` still searches learnings and warns once (`Recall indexed learnings
52
+ only…` or `Recall indexed the shared learnings only…`): what it names is
53
+ missing from results until the manifest is fixed and `teamai pull` rebuilds
54
+ the index, so do not report that the team has none of it. If recall also says
55
+ `Recall skips the older index at <path>…`, the smaller index could not be
56
+ written and that scope was not searched at all: resolve the error it names
57
+ (for example a read-only file or a full disk), then fix the manifest and pull.
58
+ 7. **`pull` says `Nothing was synced: <file>: <reason>`.** The project's teamai
59
+ config exists but cannot be read, so no scope syncs there, not even the user
60
+ scope, and the session-start hook syncs nothing either. Show the user the
61
+ file and the reason; `teamai doctor` checks another config and can pass
62
+ here. Moving it aside and re-running `teamai init` replaces their settings
63
+ for that project: do it only with their consent.
64
+ `recall` refuses the same way with `Nothing was searched: <file>: <reason>`:
65
+ no team knowledge was searched, so do not report that the team has none.
51
66
 
52
67
  ## Permission / access denied
53
68
 
@@ -72,11 +87,16 @@ read -rs GITLAB_TOKEN && export GITLAB_TOKEN # paste when prompted; api scope
72
87
  teamai init https://git.example.com/yourgroup/yourrepo
73
88
  ```
74
89
 
90
+ A member who only syncs and never needs the CLI to open merge requests can skip
91
+ both: `teamai init <url> --provider git` uses their existing Git authentication.
92
+
75
93
  ## Which tools actually get hooks
76
94
 
77
- `teamai hooks inject` always prints **"Hooks injected into all AI tool settings"**,
78
- even for tools where it wrote nothing. **Do not take that line as proof.** Verify
79
- per-tool instead:
95
+ `teamai hooks inject` prints **"Hooks injected into all AI tool settings"** even
96
+ for tools where it wrote nothing. **Do not take that line as proof.** (When the
97
+ team hooks cannot be resolved it exits 1 with the reason instead: the built-in
98
+ hooks are installed, the team hooks are left as they were.) Verify per-tool
99
+ instead:
80
100
 
81
101
  ```bash
82
102
  teamai doctor # flags tools whose hooks are missing
@@ -58,7 +58,11 @@ Match the login to the URL's host (do NOT create a second repo):
58
58
  before continuing. (Headless/CI only: pre-set `GITHUB_TOKEN` — a token with `repo`
59
59
  scope — instead.)
60
60
  - **`gitlab.com/...`** or self-hosted GitLab → set `GITLAB_TOKEN` (and `GITLAB_URL`
61
- for self-hosted, with `api` scope)
61
+ for self-hosted, with `api` scope). **Exception:** a member who only syncs and
62
+ never needs the CLI to open merge requests (typical for non-developers) can skip
63
+ the token: add `--provider git` to the `init` in Step 4. Git then uses their
64
+ existing SSH key or credential helper, and `push` leaves the MR for them to open
65
+ on the web.
62
66
 
63
67
  If they have no account on that platform, they register there, then ask the admin
64
68
  to add them to the repo.
@@ -92,15 +92,39 @@ above, each of which opens a PR (`--dry-run` previews). After `projects remove`,
92
92
  keep the project's content in the team repo until members have pulled: that is
93
93
  what lets their next pull clean up the copies they deployed.
94
94
 
95
- Every namespace that names a directory — `knowledge`, `skills` and `agents` in
96
- either manifest, and `learnings` in `projects.yaml` (a role's `learnings:` is
95
+ Every namespace that names a directory — `knowledge`, `skills`, `agents`, `env`,
96
+ `hooks`, `mcp`, `models` and `docs` in either manifest, and `learnings` in `projects.yaml` (a role's `learnings:` is
97
97
  ignored and unchecked) — must be a single path segment: no `/`, `\`, `:` or control character, no trailing
98
- `.` or space, and not a Windows device name (`CON`, `NUL`, `COM1`, …). Two
98
+ `.` or space, and not a Windows device name (`CON`, `NUL`, `COM1`, …). `team-codebase`
99
+ cannot be a `docs` namespace (`docs/team-codebase/` is the legacy codebase output). Two
99
100
  namespaces of one resource type may not differ only by case, across both
100
101
  manifests. A manifest that breaks this, does not parse, or is empty stops
101
102
  members' pull for that scope until it is fixed; the error names the entry. Fix
102
103
  it rather than deleting it — with no `roles.yaml`, delivery is unfiltered.
103
104
 
105
+ An item in an active namespace replaces the root item of the same name, whole:
106
+ a skill by directory name (including a root skill a member gets through a tag),
107
+ an agent by file stem, a rule by first-level file name (`rules/<ns>/<name>.md`
108
+ replaces `rules/<name>.md`), and a `claudemd/<ns>/<name>.md` file replaces
109
+ `claudemd/<name>.md`. Use this to give a project its own version of a shared
110
+ item under the same name, and keep that shared item at the root rather than in
111
+ a namespace every role activates: `rules/code-style.md` is replaced by
112
+ `rules/checkout/code-style.md` for checkout members, while a
113
+ `rules/common/code-style.md` would reach them alongside it. The same skill or
114
+ agent name in two namespaces one member has active is an error naming both
115
+ files; two namespace rules or claudemd files of one name are both delivered.
116
+ A replacement must be usable to replace anything: a skill directory needs its
117
+ `SKILL.md` (pull names one without it), and while an agent file does not parse
118
+ the root agent stays installed. `teamai doctor` lists each replacement as a note. Teams without roles or
119
+ projects are unaffected.
120
+
121
+ Docs have no override. A top-level `docs/<ns>/` that any role or project lists
122
+ under `resources.docs` reaches only members with that namespace active; a
123
+ `docs/<dir>/` nobody lists stays shared with everyone. When a member leaves the
124
+ namespace, their next pull removes its docs that still match the team copy and
125
+ keeps (and names) the ones they edited. Recall and `teamai doctor` follow the
126
+ same filter.
127
+
104
128
  ## Team dashboard (web UI)
105
129
 
106
130
  ```bash
@@ -122,15 +146,45 @@ teamai packages install code-review@claude-plugins-official # Claude plugin
122
146
  teamai push # share the updated teamai.yaml
123
147
  ```
124
148
 
125
- ## Shared environment variables
149
+ ## Shared environment variables, hooks and MCP servers
126
150
 
127
151
  ```bash
128
- teamai env list # list (values masked)
152
+ teamai env list # what reaches this directory, each with its namespace (values masked)
129
153
  teamai env list --reveal # show values in plaintext
130
- teamai env add <KEY> <VALUE> # add or update
131
- teamai env remove <KEY> # remove
154
+ teamai env add <KEY> <VALUE> # add or update in env/env.yaml
155
+ teamai env add <KEY> <VALUE> --project <id> # or --role <ns>: in that namespace's env/<ns>/env.yaml (warns if nothing declares <ns>)
156
+ teamai env remove <KEY> # remove (same --role / --project)
157
+ teamai remove mcp <name> # root mcp/mcp.yaml if it has the name, else the one namespace file; --role / --project pick a namespace
132
158
  ```
133
159
 
160
+ Env variables, team hooks and MCP servers are scoped like skills: the root file
161
+ (`env/env.yaml`, `hooks/hooks.yaml`, `mcp/mcp.yaml`) reaches everyone, and
162
+ `env/<ns>/env.yaml`, `hooks/<ns>/hooks.yaml`, `mcp/<ns>/mcp.yaml` reach only
163
+ members whose role or project lists `<ns>` under `resources.env`, `resources.hooks`
164
+ or `resources.mcp`. A namespace entry replaces the root entry of the same key, hook
165
+ id or server name. Hooks and MCP servers have no add command, and `teamai push`
166
+ does not pick up `hooks/` or `mcp/`: edit the file in the team repo, then commit
167
+ and push it with git. `teamai doctor` lists each override.
168
+
169
+ - A name twice in one file, in two active namespaces, or an active file that does
170
+ not parse: that type is not applied for affected members and their installed
171
+ state is kept. Fix the file the warning names. A hooks or MCP file with none of
172
+ its top-level keys (`server:` for `servers:`) counts as one that does not parse.
173
+ - Per-entry `projects:` (and `roles:` on env) no longer works: such an entry reaches
174
+ nobody. `roles:` on hooks and MCP still filters for one more minor release. Pull
175
+ and `teamai doctor` name the namespace file each entry belongs in; move it there.
176
+ - An env, hook or MCP entry with a key its schema does not know (a mistyped `role:`)
177
+ also reaches nobody. Pull and `teamai doctor` name the file, entry and key; correct
178
+ the key or remove it. A key a later teamai version adds is unknown to an older one,
179
+ so upgrade every member before the team uses a new entry key.
180
+ - Team model profiles work the same way: `models/<ns>/models.yaml`, declared under
181
+ `resources.models`, replaces the root profile with the same `id` for members who
182
+ have `<ns>` active. A member's API key is bound to the profile's gateway origin:
183
+ when an override points at another host, their pull leaves the agent alone and
184
+ asks them to run `teamai models switch team:<id>` to set the key for it.
185
+ - Have every member upgrade before declaring `env`, `hooks`, `mcp`, `models` or `docs` in a
186
+ manifest: teamai 0.25.0 and the 0.26.0 betas reject those keys and their pull stops.
187
+
134
188
  ## When sync fails
135
189
 
136
190
  Run `teamai doctor` first. If it reports hook or path problems, load
@@ -130,6 +130,7 @@ Use the `Glob → Grep → Read` three-step method (**adapt to the language of t
130
130
  Java: *Application.java / *Bootstrap.java / src/main/java/**/Main*.java
131
131
  TypeScript: app.ts / index.ts / main.ts / server.ts
132
132
  Rust: main.rs / src/main.rs
133
+ Swift: main.swift / App.swift
133
134
 
134
135
  2. Grep: locate the core Handlers/Routers (choose the pattern by language + framework)
135
136
  Go: grep -rn 'func.*Handler\|\.GET\|\.POST\|router\.\|@handler' <dir>
@@ -31,7 +31,7 @@ Before generating documents, build a code knowledge graph as an intermediate rep
31
31
  **Edge types**: `[CALLS]` (synchronous RPC/HTTP) / `[PUBLISHES]` (asynchronous MQ) / `[CONSUMES]` (MQ consumption) / `[READS]` (DB read) / `[WRITES]` (DB write) / `[CONFIGURES]` (config-driven) / `[MAPS_TO]` (product → code)
32
32
 
33
33
  **Construction methods** (ordered by availability):
34
- 1. **`teamai codebase --extract`**: Tree-sitter structural edges (**TS/JS/Python/Go** and more) + multi-language heuristic fact pages (writes `teamwiki/`)
34
+ 1. **`teamai codebase --extract`**: Tree-sitter structural edges (**TS/JS/Python/Go/Swift** and more) + multi-language heuristic fact pages (writes `teamwiki/`)
35
35
  2. Grep + Read (Agent K1/K2): supplement dynamic routes and config-driven calls
36
36
  3. Parse orchestration configs → module → command mapping
37
37
  4. Parse Proto/IDL/DDL → data structures and table relationships (structured files, can be parsed precisely)
@@ -22,7 +22,7 @@ Architecture reverse-engineering **compresses the huge codebase into a structure
22
22
  - Every component relation carries a confidence label (`EXTRACTED` / `INFERRED` / `AMBIGUOUS`)
23
23
  - Every generation run produces accuracy statistics, with automatic warnings when thresholds are exceeded
24
24
  - AI reads the knowledge base instead of the source and gains global architecture awareness for **about 1/50 of the tokens**
25
- - In Phase 0, `teamai codebase --extract` can generate evidence-backed structural edges (TS/JS/Python/Go AST + multi-language heuristics)
25
+ - In Phase 0, `teamai codebase --extract` can generate evidence-backed structural edges (TS/JS/Python/Go/Swift AST + multi-language heuristics)
26
26
  - After extraction, `teamai codebase --deep-enrich --project <slug> --output <repo>` can generate deterministic graph documents (G1/G2/G3) and deep knowledge; no separate team-wiki CLI is needed
27
27
 
28
28
  ---
@@ -95,7 +95,7 @@ Write to `_review/metadata.json`:
95
95
 
96
96
  **Step 0D: CLI structural baseline (per code repository, recommended)**
97
97
 
98
- Before the K1 deep read, use TeamAI to extract evidence-backed import/call structural edges (Python/Go/TS etc., `code-ast`) and merge them with the regex baseline (`code-heuristic`):
98
+ Before the K1 deep read, use TeamAI to extract evidence-backed import/call structural edges (Python/Go/TS/Swift etc., `code-ast`) and merge them with the regex baseline (`code-heuristic`):
99
99
 
100
100
  ```bash
101
101
  # For each repo. Writes <repo>/teamwiki/ (evidence pages + .indices/graph-index.json).
@@ -53,7 +53,7 @@ KEY_FILE_PATTERNS = {
53
53
  # Language extension map
54
54
  LANG_MAP = {
55
55
  ".py": "Python", ".go": "Go", ".js": "JavaScript", ".ts": "TypeScript",
56
- ".java": "Java", ".rs": "Rust", ".rb": "Ruby", ".php": "PHP",
56
+ ".java": "Java", ".rs": "Rust", ".swift": "Swift", ".rb": "Ruby", ".php": "PHP",
57
57
  ".c": "C", ".cpp": "C++", ".h": "C/C++ Header",
58
58
  ".proto": "Protobuf", ".thrift": "Thrift", ".graphql": "GraphQL",
59
59
  ".sql": "SQL", ".sh": "Shell", ".bash": "Shell",