mirror of
https://github.com/Tencent/teamai-cli.git
synced 2026-10-02 03:14:40 +08:00
* fix(tags,roles): honor --dry-run in tags subscribe, tags unsubscribe and roles set (#836) The three commands saved the local config and reset lastPullRev even under the global --dry-run, which is documented as "Preview mode, no changes made". Their siblings (tags add/remove, roles init/add/remove/ update) already return early with a [dry-run] message. The roles set preview names the additional roles it would save, including none, because a real run replaces the existing list. oxlint reported the unused options parameter in tagsSubscribe and tagsUnsubscribe; rolesSet has the same bug but reads options.add. * chore(lint): add oxlint with its default rules Pinned to an exact version so a new default rule arrives in its own PR, not as a CI failure on an unrelated one. The no-unused-vars options keep oxlint's _ ignore patterns and add ignoreRestSiblings, which the rest-omit in dashboard.ts relies on to keep config and roots out of /api/workspaces. * style(lint): apply oxlint safe fixes Drop redundant escapes in regex character classes and template literals, empty-object fallbacks in object spreads (spreading undefined adds nothing), and anchored regexes that are plain startsWith/endsWith checks. No behavior change. * refactor(lint): remove unused imports and an unused catch binding Applied with oxlint --fix-suggestions and reviewed by hand. Every removed whole import is a library module with no import-time side effects. * refactor(lint): remove dead code reported by no-unused-vars Each hit was checked against its callers and git history; none is missing wiring (the two that were, tags subscribe/unsubscribe, are fixed in the preceding commit). Removed: unused locals and functions, the options parameter of tagsList, rolesList and generateDigest (read-only commands), the never-read interactive option of importFromRepo, the empty test/e2e.mjs left over from the E2E migration, and a try/catch that only rethrew. new Array(n) becomes Array.from. No behavior change. * test(lint): fix lint hits in tests - contribute dry-run test asserted nothing; it now checks that the run leaves the repo/HOME tree unchanged (verified to fail when the dry-run early return is removed). - Drop a no-op expect(result).not.toThrow on a string. - Keep undefined in two optional-chain casts so a regression fails the assertion instead of throwing a TypeError. - Remove unused locals, helpers and imports; new Array(n) becomes Array.from. * refactor(lint): write control-character classes as \p{Cc} no-control-regex flags literal control ranges. \p{Cc} names the same set (C0, DEL, C1) and reads as what it means. Checked against the old classes on every code point from U+0000 to U+10FFFF: manifest-schema and agent-format match exactly, and contribute-check's normalization pipeline produces the same output. The test assertion is now stricter and checks every control character the sanitizer removes. * refactor(lint): remove disable directives for rules that are not enabled Four eslint-disable comments named rules this repo never ran (no-await-in-loop, @typescript-eslint/no-explicit-any), so they suppressed nothing. * ci(lint): fail CI on any oxlint warning (#828) npm run lint runs oxlint --deny-warnings and runs before the type check in both GitHub Actions and Coding CI. The repo is at zero warnings, so new code must stay clean. --report-unused-disable-directives also fails on a disable comment that suppresses nothing, so a suppression cannot outlive the code it was written for. CLAUDE.md, AGENTS.md, CONTRIBUTING.md and the PR template list the command so contributors and agents run it before opening a PR. Closes #828 * chore(lint): pin oxlint 1.16.0, the newest release that accepts Node 20.0 oxlint 1.17.0 and later declare engines.node ^20.19.0 || >=22.12.0, while the repo supports Node >=20. 1.16.0 declares >=8, supports --deny-warnings and --report-unused-disable-directives, and reports 0 warnings on this branch. * Revert "fix(tags,roles): honor --dry-run in tags subscribe, tags unsubscribe and roles set (#836)" This reverts commit224d459c99. * refactor(lint): mark the unused options parameter of tags subscribe and unsubscribe With the #837 dry-run fix reverted out of this PR, both functions no longer read options. The underscore prefix keeps the signature and call sites unchanged, so #837 can rebase onto it by renaming the parameter back. * chore(lint): restore oxlint 1.85.0 This reverts commite2347efa. oxlint is a devDependency, so its Node requirement (^20.19.0 || >=22.12.0) never reaches users installing teamai-cli, and CI's node-version 20 resolves to the latest 20.x. Staying on 1.85.0 keeps the #836 warning counts and the planned type-aware follow-up on the same version. * docs(contributing): note the Node version npm run lint needs * docs(agents): note the Node version npm run lint needs
5.0 KiB
5.0 KiB
TeamAI CLI
CLI for syncing team skills, rules, docs, and env across AI coding tools. Package: teamai-cli.
TypeScript, Node 20+ (npm run lint needs ^20.19 or >=22.12), tsup (ESM), Vitest. Commands: npm run build, npx tsc --noEmit, npm run lint, npx vitest run, npm run test:e2e.
Git
- Default branch:
main. Worktrees and PRs based onorigin/main. - PR only to
Tencent/teamai-cli. Before push, checkgit log origin/main..HEAD; rebase or cherry-pick if unrelated commits appear. - 必须使用 Worktree:改代码前先
EnterWorktree,禁止在主工作目录修改。
Rules
- CLI user-facing output must be English. No Chinese in production code. Tests assert English output.
- Keep bilingual docs in sync (
README/*.zh-CN.md,docs/usage-guide.*). Behavior changes must update every affected doc (includingdocs/designs/); grep old wording before opening the PR. - README 精简:尽量少改动 README,保持简洁。确需改动时,所有语言版本(
README.md及全部README.*.md,改前先ls README*确认清单)必须全部改完并保持一致。 skill-data/与文档同等对待:那是 agent 真正读到的内容。行为变更必须同步更新受影响的 skill(core/setup/wiki/share),并在 PR 前 grep 旧措辞。skill-data/core/references/commands.md由 Commander 命令表生成,改动命令或 flag 后运行npx vitest run commands-reference -u重新生成。- 部署到 agent 的只有
skills/teamai/SKILL.md(发现入口),保持与版本无关:新增工作流是在skill-data/下加目录 + 在 stub 里加一行,不要把内容写进 stub。 - 奥卡姆剃刀:避免过早添加新 CLI 命令;非必要不加;优先复用或扩展现有命令与选项。
PR 前测试
改动运行时行为的 PR(docs-only / tests-only 之外),npm run build 后必须用真实 CLI 对本次改动做端到端验证,不能只跑 type check / unit test;一次代表性的 real-CLI 运行即可,把实际通过的验证记录贴进 PR。docs-only / tests-only 的改动无需 e2e 记录。
不要求覆盖下面的完整 provider × agent 矩阵——额外 provider / agent 的覆盖交给 CI,或在本地环境不具备时说明即可:
- Agent:Claude、Codex、CodeBuddy、OpenCode
- Provider:
git、gitlab、github
Self review before push
Review the whole branch diff, not only the last change. For every piece of shared state, list every reader and every writer.
Code Review Rules
- The PR description must document sufficient testing. For a PR that changes
runtime behavior (anything beyond a docs-only or tests-only diff), that
includes an end-to-end / real-CLI verification record, not only unit tests
or type checks — flag such a PR that lacks one as
[P1 blocking]. A docs-only or tests-only PR needs no e2e record; do not flag it for that. Do NOT require a full provider × agent matrix — one representative real-CLI run is enough. Missing coverage of extra providers (gitlab/github) or agents (Codex/CodeBuddy/OpenCode) is at most[P3 nit]when the author has flagged it as untestable in this environment or deferred to CI, never[P1 blocking]. A test record naming an older commit than the head is a note, not a blocking finding; the body may have been edited after the review pass started. - Do not over-review. Report only findings you are confident are real in the
current diff. Do not cap how many findings you report: every real bug should
surface in one pass, not be deferred to a later one. Instead, gate severity
by evidence — every
[P1 blocking]must cite either a concrete failure scenario (the input or state that triggers it and the resulting misbehavior) or the exact## Code Review Rulesitem it breaks. A finding that can cite neither is at most[P2 non-blocking]; a speculative or theoretical risk that needs an unlikely precondition to trigger is at most[P3 nit]. Never restate a finding already resolved in the current diff. - Reject over-engineering. Favor the smallest code that solves the problem; flag speculative abstractions, unused flexibility or config, error handling for cases that cannot occur, and new CLI commands added where an existing command could be reused or extended.
- Changes must be surgical. Every changed line should trace directly to the PR's stated goal; flag unrelated drive-by edits.
- Label every finding with an explicit severity a first-time reader can
understand — never a bare
P1/P2/P3code. Keep thePmarker but spell out what it means inline on each finding, using the PR author's language:[P1 blocking]for issues that must be fixed before merge,[P2 non-blocking]for suggestions that do not block merge, and[P3 nit]for minor or optional polish, theoretical edge cases, and coverage deferred to CI. (In Chinese,[P1 阻断]/[P2 非阻断]/[P3 可选].)