@team-ai/teamai-cli 0.40.8 → 0.50.0

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 (163) hide show
  1. package/CHANGELOG.md +169 -11
  2. package/README.ja.md +32 -29
  3. package/README.ko.md +32 -29
  4. package/README.md +32 -29
  5. package/README.th.md +32 -29
  6. package/README.zh-CN.md +32 -29
  7. package/agents/README.md +68 -0
  8. package/agents/README.zh-CN.md +68 -0
  9. package/agents/teamai-recall.md +10 -9
  10. package/dist/cli.js +209814 -135972
  11. package/dist/index.js +291 -0
  12. package/dist/runtime-paseo.js +27562 -0
  13. package/dist/runtime-sandbox.js +94740 -0
  14. package/dist/runtime-t3.js +41891 -0
  15. package/drivers/teamai-claude.yaml +6 -0
  16. package/drivers/teamai-codex.yaml +6 -0
  17. package/drivers/teamai-local.yaml +5 -0
  18. package/drivers/teamai-opencode.yaml +6 -0
  19. package/drivers/teamai-paseo.yaml +6 -0
  20. package/drivers/teamai-sandbox.yaml +7 -0
  21. package/drivers/teamai-t3.yaml +8 -0
  22. package/hooks/teamai-env-hint/HOOK.yaml +1 -0
  23. package/hooks/teamai-env-hint/README.md +80 -0
  24. package/hooks/teamai-env-hint/README.zh-CN.md +80 -0
  25. package/hooks/teamai-env-hint/exec.md +1 -0
  26. package/hooks/teamai-env-hint/secrets-rule.md +1 -0
  27. package/hooks/teamai-env-hint/secrets.md +1 -0
  28. package/hooks/teamai-env-hint/variables.md +1 -0
  29. package/hooks/teamai-friction-reminder/HOOK.yaml +1 -0
  30. package/hooks/teamai-friction-reminder/README.md +117 -0
  31. package/hooks/teamai-friction-reminder/README.zh-CN.md +117 -0
  32. package/hooks/teamai-friction-reminder/action-gap.md +1 -0
  33. package/hooks/teamai-friction-reminder/action-gap.zh.md +1 -0
  34. package/hooks/teamai-friction-reminder/action-share-learnings.md +1 -0
  35. package/hooks/teamai-friction-reminder/action-share-learnings.zh.md +1 -0
  36. package/hooks/teamai-friction-reminder/action.md +1 -0
  37. package/hooks/teamai-friction-reminder/action.zh.md +1 -0
  38. package/hooks/teamai-friction-reminder/gap-reasons.md +1 -0
  39. package/hooks/teamai-friction-reminder/gap-reasons.zh.md +1 -0
  40. package/hooks/teamai-friction-reminder/gap.md +1 -0
  41. package/hooks/teamai-friction-reminder/gap.zh.md +1 -0
  42. package/hooks/teamai-friction-reminder/params.yaml +12 -0
  43. package/hooks/teamai-friction-reminder/problem-reasons.md +1 -0
  44. package/hooks/teamai-friction-reminder/problem-reasons.zh.md +1 -0
  45. package/hooks/teamai-friction-reminder/problem.md +1 -0
  46. package/hooks/teamai-friction-reminder/problem.zh.md +1 -0
  47. package/hooks/teamai-friction-reminder/reason-correction.md +1 -0
  48. package/hooks/teamai-friction-reminder/reason-correction.zh.md +1 -0
  49. package/hooks/teamai-friction-reminder/reason-interrupt.md +1 -0
  50. package/hooks/teamai-friction-reminder/reason-interrupt.zh.md +1 -0
  51. package/hooks/teamai-friction-reminder/reason-tool-error.md +1 -0
  52. package/hooks/teamai-friction-reminder/reason-tool-error.zh.md +1 -0
  53. package/hooks/teamai-friction-reminder/reason-tool-reject.md +1 -0
  54. package/hooks/teamai-friction-reminder/reason-tool-reject.zh.md +1 -0
  55. package/hooks/teamai-friction-reminder/task.md +1 -0
  56. package/hooks/teamai-friction-reminder/task.zh.md +1 -0
  57. package/hooks/teamai-mr-hint/HOOK.yaml +1 -0
  58. package/hooks/teamai-mr-hint/README.md +81 -0
  59. package/hooks/teamai-mr-hint/README.zh-CN.md +81 -0
  60. package/hooks/teamai-mr-hint/offer-command.en.md +7 -0
  61. package/hooks/teamai-mr-hint/offer-command.md +10 -0
  62. package/hooks/teamai-mr-hint/offer-workflow.en.md +7 -0
  63. package/hooks/teamai-mr-hint/offer-workflow.md +10 -0
  64. package/hooks/teamai-mr-hint/params.yaml +2 -0
  65. package/hooks/teamai-package-hint/HOOK.yaml +1 -0
  66. package/hooks/teamai-package-hint/README.md +64 -0
  67. package/hooks/teamai-package-hint/README.zh-CN.md +64 -0
  68. package/hooks/teamai-package-hint/message.md +3 -0
  69. package/hooks/teamai-todowrite-hint/HOOK.yaml +1 -0
  70. package/hooks/teamai-todowrite-hint/README.md +68 -0
  71. package/hooks/teamai-todowrite-hint/README.zh-CN.md +68 -0
  72. package/hooks/teamai-todowrite-hint/message.en.md +6 -0
  73. package/hooks/teamai-todowrite-hint/message.md +9 -0
  74. package/package.json +41 -14
  75. package/rules/teamai-recall/README.md +78 -0
  76. package/rules/teamai-recall/README.zh-CN.md +78 -0
  77. package/rules/teamai-recall/RULE.en.md +36 -0
  78. package/rules/teamai-recall/RULE.md +43 -0
  79. package/rules/teamai-recall/block-direct.md +27 -0
  80. package/rules/teamai-recall/block.en.md +42 -0
  81. package/rules/teamai-recall/block.md +44 -0
  82. package/runtimes/teamai-paseo.yaml +5 -0
  83. package/runtimes/teamai-sandbox.yaml +3 -0
  84. package/runtimes/teamai-t3.yaml +5 -0
  85. package/sandboxes/teamai-bwrap.yaml +2 -0
  86. package/sandboxes/teamai-default.yaml +4 -0
  87. package/sandboxes/teamai-docker.yaml +5 -0
  88. package/sandboxes/teamai-podman.yaml +4 -0
  89. package/sandboxes/teamai-sbx.yaml +4 -0
  90. package/sandboxes/teamai-seatbelt.yaml +2 -0
  91. package/sandboxes/teamai-vercel.yaml +4 -0
  92. package/scorers/README.md +103 -0
  93. package/scorers/README.zh-CN.md +103 -0
  94. package/scorers/teamai-adoption.md +11 -0
  95. package/scorers/teamai-correctness.md +17 -0
  96. package/scorers/teamai-routing.md +11 -0
  97. package/skill-data/core/SKILL.md +4 -3
  98. package/skill-data/core/references/commands.md +300 -67
  99. package/skill-data/core/references/contribute-member.md +4 -4
  100. package/skill-data/core/references/troubleshooting.md +128 -18
  101. package/skill-data/setup/references/join-member.md +13 -9
  102. package/skill-data/setup/references/manage-admin.md +41 -17
  103. package/skill-data/setup/references/setup-admin.md +2 -2
  104. package/skill-data/setup/references/uninstall.md +30 -9
  105. package/skill-data/share/SKILL.md +17 -12
  106. package/skill-data/share/references/doc-template.md +3 -4
  107. package/skill-data/wiki/SKILL.md +1 -1
  108. package/skill-data/wiki/references/agents/graph-rag-agent.md +5 -1
  109. package/skill-data/workflow/SKILL.md +39 -16
  110. package/skill-data/workflow/references/fleet.md +13 -0
  111. package/skill-data/workflow/references/judging.md +17 -10
  112. package/skill-data/workflow/references/places.md +64 -7
  113. package/skill-data/workflow/references/sandbox.md +3 -3
  114. package/skill-data/workflow/references/session-hosts.md +27 -0
  115. package/skill-data/workflow-local/SKILL.md +4 -3
  116. package/skill-data/workflow-local/references/ci.md +1 -1
  117. package/skills/teamai/SKILL.md +4 -3
  118. package/workflows/README.md +103 -0
  119. package/workflows/README.zh-CN.md +103 -0
  120. package/workflows/teamai-benchmark.yaml +78 -0
  121. package/workflows/teamai-ci-extract-mr.yaml +66 -0
  122. package/workflows/teamai-codebase-deep-enrich/README.md +123 -0
  123. package/workflows/teamai-codebase-deep-enrich/README.zh-CN.md +123 -0
  124. package/workflows/teamai-codebase-deep-enrich/WORKFLOW.yaml +119 -0
  125. package/workflows/teamai-codebase-deep-enrich/architecture.md +30 -0
  126. package/workflows/teamai-codebase-deep-enrich/component.md +30 -0
  127. package/workflows/teamai-codebase-deep-enrich/params.yaml +1 -0
  128. package/workflows/teamai-codebase-deep-enrich/scenarios.md +32 -0
  129. package/workflows/teamai-codebase-enrich.yaml +98 -0
  130. package/workflows/teamai-draft-learning-updates/README.md +116 -0
  131. package/workflows/teamai-draft-learning-updates/README.zh-CN.md +116 -0
  132. package/workflows/teamai-draft-learning-updates/WORKFLOW.yaml +61 -0
  133. package/workflows/teamai-draft-learning-updates/params.yaml +4 -0
  134. package/workflows/teamai-finished-sessions/README.md +101 -0
  135. package/workflows/teamai-finished-sessions/README.zh-CN.md +101 -0
  136. package/workflows/teamai-finished-sessions/WORKFLOW.yaml +43 -0
  137. package/workflows/teamai-finished-sessions/params.yaml +1 -0
  138. package/workflows/teamai-import-from-iwiki.yaml +90 -0
  139. package/workflows/teamai-import-from-mr/README.md +104 -0
  140. package/workflows/teamai-import-from-mr/README.zh-CN.md +104 -0
  141. package/workflows/teamai-import-from-mr/WORKFLOW.yaml +94 -0
  142. package/workflows/teamai-import-from-mr/draft.en.md +48 -0
  143. package/workflows/teamai-import-from-mr/draft.zh.md +48 -0
  144. package/workflows/teamai-import-from-repo/README.md +106 -0
  145. package/workflows/teamai-import-from-repo/README.zh-CN.md +106 -0
  146. package/workflows/teamai-import-from-repo/WORKFLOW.yaml +109 -0
  147. package/workflows/teamai-import-from-repo/narrative.md +83 -0
  148. package/workflows/teamai-import-learnings.yaml +83 -0
  149. package/workflows/teamai-import-rules.yaml +34 -0
  150. package/workflows/teamai-new-scorer.yaml +54 -0
  151. package/workflows/teamai-promote-learning/README.md +122 -0
  152. package/workflows/teamai-promote-learning/README.zh-CN.md +122 -0
  153. package/workflows/teamai-promote-learning/WORKFLOW.yaml +102 -0
  154. package/workflows/teamai-promote-learning/params.yaml +4 -0
  155. package/workflows/teamai-score.yaml +121 -0
  156. package/workflows/teamai-self-improvement.yaml +37 -0
  157. package/workflows/teamai-session-to-task.yaml +69 -0
  158. package/workflows/teamai-sessions-to-tasks.yaml +62 -0
  159. package/workflows/teamai-share-learnings-from-sessions.yaml +36 -0
  160. package/workflows/teamai-share-learnings.yaml +25 -0
  161. package/workflows/teamai-share-session.yaml +21 -0
  162. package/workflows/teamai-try-scorer.yaml +32 -0
  163. package/skill-data/workflow/references/hosts.md +0 -27
@@ -0,0 +1,103 @@
1
+ # Default workflows
2
+
3
+ English | [中文](README.zh-CN.md)
4
+
5
+ The workflows teamai ships. Each `<name>.yaml` here is one workflow. A workflow that keeps its prompts in files has a folder, `<name>/WORKFLOW.yaml`, with its own README. The [guide](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/workflow.md#default-workflows) says what each workflow does.
6
+
7
+ ## Read a workflow's interface
8
+
9
+ The file is the interface. Its `inputs:` and `outputs:` are what a command, or another workflow, passes and reads. To see the inputs as teamai checks them, with the version that runs here:
10
+
11
+ ```bash
12
+ teamai workflow start teamai-share-learnings --describe
13
+ ```
14
+
15
+ | Key in the file | What it tells you |
16
+ |---|---|
17
+ | `inputs:`, `outputs:` | What a caller passes and reads. A replacement keeps them |
18
+ | `invoke:` | Whether an agent session can start the workflow. See the table below |
19
+ | A step with `workflow: <name>` | The workflow runs that other workflow |
20
+ | A step with `prompt:`, `answer:` or `answer_file:` | The workflow needs an AI tool |
21
+ | A step with `scorers:`, or `workflow: teamai-score` | The workflow needs a judge |
22
+ | A step with `workspace: { team: ... }` and `deliver: pr` | The workflow pushes a branch of the team repo and opens a pull request |
23
+ | A step with `requires: { isolation: sandbox }` | The step runs only on a machine that declares a sandbox |
24
+
25
+ | `invoke` | What `teamai pull` does |
26
+ |---|---|
27
+ | `allow` | Writes a skill that lets an agent session find the workflow. On Claude Code and CodeBuddy, the skill also pre-approves the `workflow start` command |
28
+ | `ask` | Writes the skill, with no pre-approval |
29
+ | `deny` | Writes no skill. Only a command or another workflow starts it |
30
+
31
+ ## Replace one
32
+
33
+ ```bash
34
+ cp "$(npm root -g)/teamai-cli/workflows/teamai-share-learnings-from-sessions.yaml" workflows/
35
+ ```
36
+
37
+ ```yaml
38
+ # workflows/teamai-share-learnings-from-sessions.yaml in the team repo
39
+ invoke: allow # let an agent session start it without asking
40
+ ```
41
+
42
+ Push the file. The next `teamai pull` uses the team's file instead of teamai's. A replacement can change everything in the file: `description`, `invoke`, `alias`, the prompts, the steps, their order and each `timeout`.
43
+
44
+ ### Which version runs
45
+
46
+ ```mermaid
47
+ flowchart TD
48
+ pull([teamai pull]) --> has{"The team repo has workflows/&lt;name&gt;.yaml or workflows/&lt;name&gt;/WORKFLOW.yaml?"}
49
+ has -- no --> tai([teamai's workflow])
50
+ has -- yes --> valid{The team's file has a runnable version?}
51
+ valid -- no --> warn1([teamai's workflow, and pull says why])
52
+ valid -- yes --> score{"It is teamai-score, and it changes what a label means?"}
53
+ score -- yes --> warn1
54
+ score -- no --> team([The team's workflow])
55
+ team --> callers{"Each command and workflow that starts it still passes inputs it declares?"}
56
+ callers -- yes --> ok([Every caller starts])
57
+ callers -- no --> warn2(["Pull warns that the caller cannot start"])
58
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
59
+ classDef warn fill:#b5762f,stroke:#865520,color:#fff;
60
+ class tai,team,ok out;
61
+ class warn1,warn2 warn;
62
+ ```
63
+
64
+ ### What a replacement keeps
65
+
66
+ | Workflow | Keep | Otherwise, pull |
67
+ |---|---|---|
68
+ | Every workflow | The names and types of its `inputs:` and `outputs:` | Uses the team's workflow, and warns that the caller cannot start |
69
+ | `teamai-score` | What each label means. See [what it may change](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/scorers.md#replace-it-for-your-team) | Uses teamai's, and reports `score_override_*` |
70
+ | `teamai-score` | Its name. An `alias: teamai-score` on another file does not replace it | Uses teamai's, and reports `default_override_alias` |
71
+
72
+ ## Which AI tool answers a prompt
73
+
74
+ When a step names no `tool:` and no `agent:`, the first of these that names a tool wins:
75
+
76
+ ```mermaid
77
+ flowchart LR
78
+ f["--tools default=&lt;tool&gt;"] --> e[TEAMAI_AI_TOOL] --> w[workflows.tools.default] --> p["ai.tool in the scope config"] --> m["ai.tool in ~/.teamai/config.yaml"] --> none([No tool. The prompt step cannot run here])
79
+ classDef flag fill:#6b6b6b,stroke:#4a4a4a,color:#fff;
80
+ classDef cfg fill:#3b6ea5,stroke:#2b5079,color:#fff;
81
+ classDef warn fill:#b5762f,stroke:#865520,color:#fff;
82
+ class f,e flag;
83
+ class w,p,m cfg;
84
+ class none warn;
85
+ ```
86
+
87
+ `teamai-score` picks its judge from the scorer instead. See [choose the judge's model](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/scorers.md#choose-the-judges-model).
88
+
89
+ ## Settings that change them
90
+
91
+ | Setting | Team `teamai.yaml` | Member config | Environment or flag | Effect |
92
+ |---|---|---|---|---|
93
+ | AI tool | | `workflows.tools.default`, `ai.tool` | `TEAMAI_AI_TOOL`, `--tools` | Picks the tool that answers each prompt, in the order above |
94
+ | Driver | `workflows.driver` | `workflows.driver` | | Picks the driver a command starts its run on. Unset means this machine |
95
+ | Parallel steps | | `workflows.max_parallel` | | Sets how many command steps the local driver runs at once |
96
+ | Approvals without a person | | `workflows.auto_approve` | `--auto-approve` | Answers optional approvals yes and takes the default of each choice |
97
+ | Sandbox | | `workflows.sandbox` | `--sandbox` | Declares this machine a sandbox, so a step that requires one can run here |
98
+ | What a step may use | | `workflows.allow: { network, env }` | | Holds a step that needs the network, or an env key, that this machine does not allow |
99
+ | Retention | | `workflows.retention` | | Sets how long `teamai doctor --fix` leaves the branches and worktrees a finished run left |
100
+ | Recall | `sharing.recall.enabled` | `recallEnabled` | `TEAMAI_RECALL_DISABLED=1` | When off, pull writes no skill for a workflow that needs recall, such as `teamai-share-learnings` |
101
+ | Session scoring | `sessions.publish`, and `scorers/scoring.yaml` | `sessions`, `scoring` | `TEAMAI_MODE`, `CI` | Decide what `teamai-finished-sessions` publishes and judges. See [finished sessions](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/scorers.md#finished-sessions) |
102
+
103
+ The member config is `~/.teamai/projects/<slug>/config.yaml` in a workspace, then `~/.teamai/config.yaml`. The environment and flags win over the member config, and the member config wins over the team. See [member settings](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/reference.md#member-settings) for the defaults.
@@ -0,0 +1,103 @@
1
+ # 默认工作流
2
+
3
+ [English](README.md) | 中文
4
+
5
+ teamai 自带的工作流。这里每个 `<name>.yaml` 是一个工作流。把提示词放在文件里的工作流有一个文件夹 `<name>/WORKFLOW.yaml`,并有自己的 README。[指南](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/zh-CN/workflow.md#默认工作流)说明每个工作流做什么。
6
+
7
+ ## 读懂工作流的接口
8
+
9
+ 文件就是接口。它的 `inputs:` 和 `outputs:` 是命令或另一个工作流传入和读取的内容。要用这里运行的版本,按 teamai 检查的方式查看输入:
10
+
11
+ ```bash
12
+ teamai workflow start teamai-share-learnings --describe
13
+ ```
14
+
15
+ | 文件里的键 | 它说明什么 |
16
+ |---|---|
17
+ | `inputs:`、`outputs:` | 调用方传入和读取什么。替换要保留它们 |
18
+ | `invoke:` | agent 会话能否启动这个工作流。见下表 |
19
+ | 带 `workflow: <name>` 的步骤 | 这个工作流会运行那个工作流 |
20
+ | 带 `prompt:`、`answer:` 或 `answer_file:` 的步骤 | 这个工作流需要 AI 工具 |
21
+ | 带 `scorers:` 或 `workflow: teamai-score` 的步骤 | 这个工作流需要评审者 |
22
+ | 带 `workspace: { team: ... }` 和 `deliver: pr` 的步骤 | 这个工作流推送团队仓库的一个分支,并开一个拉取请求 |
23
+ | 带 `requires: { isolation: sandbox }` 的步骤 | 这个步骤只在声明了沙箱的机器上运行 |
24
+
25
+ | `invoke` | `teamai pull` 做什么 |
26
+ |---|---|
27
+ | `allow` | 写入一个 skill,让 agent 会话能找到这个工作流。在 Claude Code 和 CodeBuddy 上,这个 skill 还会预先批准 `workflow start` 命令 |
28
+ | `ask` | 写入 skill,不预先批准 |
29
+ | `deny` | 不写 skill。只有命令或另一个工作流能启动它 |
30
+
31
+ ## 替换其中一个
32
+
33
+ ```bash
34
+ cp "$(npm root -g)/teamai-cli/workflows/teamai-share-learnings-from-sessions.yaml" workflows/
35
+ ```
36
+
37
+ ```yaml
38
+ # workflows/teamai-share-learnings-from-sessions.yaml in the team repo
39
+ invoke: allow # let an agent session start it without asking
40
+ ```
41
+
42
+ 推送这个文件。下一次 `teamai pull` 会用团队的文件代替 teamai 的。替换可以改动文件里的一切:`description`、`invoke`、`alias`、提示词、步骤、步骤的顺序和每个 `timeout`。
43
+
44
+ ### 运行哪个版本
45
+
46
+ ```mermaid
47
+ flowchart TD
48
+ pull([teamai pull]) --> has{"团队仓库有 workflows/&lt;name&gt;.yaml 或 workflows/&lt;name&gt;/WORKFLOW.yaml?"}
49
+ has -- 否 --> tai(["teamai 的工作流"])
50
+ has -- 是 --> valid{"团队的文件有可运行版本?"}
51
+ valid -- 否 --> warn1(["teamai 的工作流,pull 说明原因"])
52
+ valid -- 是 --> score{"它是 teamai-score,并且改变了标签的含义?"}
53
+ score -- 是 --> warn1
54
+ score -- 否 --> team(["团队的工作流"])
55
+ team --> callers{"启动它的每个命令和工作流,传入的仍是它声明的输入?"}
56
+ callers -- 是 --> ok(["每个调用方都能启动"])
57
+ callers -- 否 --> warn2(["pull 警告该调用方无法启动"])
58
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
59
+ classDef warn fill:#b5762f,stroke:#865520,color:#fff;
60
+ class tai,team,ok out;
61
+ class warn1,warn2 warn;
62
+ ```
63
+
64
+ ### 替换要保留什么
65
+
66
+ | 工作流 | 保留 | 否则 pull |
67
+ |---|---|---|
68
+ | 每个工作流 | `inputs:` 和 `outputs:` 的名字和类型 | 使用团队的工作流,并警告调用方无法启动 |
69
+ | `teamai-score` | 每个标签的含义。见[它可以改什么](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/zh-CN/scorers.md#为团队替换它) | 使用 teamai 的,并报告 `score_override_*` |
70
+ | `teamai-score` | 它的名字。另一个文件上的 `alias: teamai-score` 不会替换它 | 使用 teamai 的,并报告 `default_override_alias` |
71
+
72
+ ## 哪个 AI 工具回答提示词
73
+
74
+ 步骤既没写 `tool:` 也没写 `agent:` 时,下面第一个指定了工具的位置生效:
75
+
76
+ ```mermaid
77
+ flowchart LR
78
+ f["--tools default=&lt;tool&gt;"] --> e[TEAMAI_AI_TOOL] --> w[workflows.tools.default] --> p["scope 配置里的 ai.tool"] --> m["~/.teamai/config.yaml 里的 ai.tool"] --> none(["没有工具。提示词步骤无法在这里运行"])
79
+ classDef flag fill:#6b6b6b,stroke:#4a4a4a,color:#fff;
80
+ classDef cfg fill:#3b6ea5,stroke:#2b5079,color:#fff;
81
+ classDef warn fill:#b5762f,stroke:#865520,color:#fff;
82
+ class f,e flag;
83
+ class w,p,m cfg;
84
+ class none warn;
85
+ ```
86
+
87
+ `teamai-score` 则从评分器选出评审者。见[选择评审者的模型](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/zh-CN/scorers.md#选择评审者的模型)。
88
+
89
+ ## 影响它们的设置
90
+
91
+ | 设置 | 团队 `teamai.yaml` | 成员配置 | 环境变量或选项 | 作用 |
92
+ |---|---|---|---|---|
93
+ | AI 工具 | | `workflows.tools.default`、`ai.tool` | `TEAMAI_AI_TOOL`、`--tools` | 按上面的顺序,选出回答每个提示词的工具 |
94
+ | 驱动 | `workflows.driver` | `workflows.driver` | | 选出命令在哪个驱动上启动运行。未设置表示本机 |
95
+ | 并行步骤 | | `workflows.max_parallel` | | 设置本地驱动同时运行多少个命令步骤 |
96
+ | 无人时的审批 | | `workflows.auto_approve` | `--auto-approve` | 对可选审批回答“是”,每个选择取默认项 |
97
+ | 沙箱 | | `workflows.sandbox` | `--sandbox` | 声明本机是沙箱,需要沙箱的步骤就能在这里运行 |
98
+ | 步骤能用什么 | | `workflows.allow: { network, env }` | | 步骤需要本机不允许的网络或 env 键时,让它等待 |
99
+ | 保留期 | | `workflows.retention` | | 设置 `teamai doctor --fix` 把已结束运行留下的分支和 worktree 保留多久 |
100
+ | Recall | `sharing.recall.enabled` | `recallEnabled` | `TEAMAI_RECALL_DISABLED=1` | 关闭时,pull 不为需要 recall 的工作流写 skill,例如 `teamai-share-learnings` |
101
+ | 会话评分 | `sessions.publish` 和 `scorers/scoring.yaml` | `sessions`、`scoring` | `TEAMAI_MODE`、`CI` | 决定 `teamai-finished-sessions` 发布和评判什么。见[已结束的会话](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/zh-CN/scorers.md#已结束的会话) |
102
+
103
+ 成员配置在工作区里是 `~/.teamai/projects/<slug>/config.yaml`,其次是 `~/.teamai/config.yaml`。环境变量和选项优先于成员配置,成员配置优先于团队。默认值见[成员设置](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/zh-CN/reference.md#成员设置)。
@@ -0,0 +1,78 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-benchmark
3
+ description: Run a benchmark suite. Every arm works the same tasks in fresh clones, judged by checks it never sees.
4
+ invoke: deny
5
+ inputs: { suite: string, aliases: string, tasks: [string], arms: [string], fail_on_regression: boolean }
6
+ steps:
7
+ - id: plan
8
+ requires: { host: true }
9
+ command: teamai benchmark plan "$SUITE" --aliases "$ALIASES" --tasks "$TASKS" --arms "$ARMS"
10
+ env: { SUITE: "{{ inputs.suite }}", ALIASES: "{{ inputs.aliases }}", TASKS: "{{ inputs.tasks }}", ARMS: "{{ inputs.arms }}" }
11
+ output: { definition: workflow, plan: json }
12
+ - id: trials
13
+ needs: [plan]
14
+ workflow: { from: plan }
15
+ requires: { isolation: sandbox, strict: true }
16
+ # Judges every trial with the scorers it pinned, a criteria task's teamai:correctness:<task> included. Reading
17
+ # trials keeps a failed trial from stopping the others being judged. Without these two steps nothing judges a trial.
18
+ # batch: the suite's scorers that share a judge tool, model and stages share one judge call per trial; a correctness
19
+ # scorer is always judged alone. Set it false in a workflow of this name to judge each scorer apart.
20
+ - id: subjects
21
+ needs: [trials]
22
+ if: steps.trials.outcome != 'skipped'
23
+ requires: { host: true }
24
+ command: teamai score subjects --run "$RUN" --step trials
25
+ env: { RUN: "{{ run.id }}" }
26
+ output: { list: [string] }
27
+ - id: score
28
+ needs: [subjects]
29
+ for_each: steps.subjects.outputs.list
30
+ workflow: teamai-score
31
+ with: { subject: "{{ item }}", scorers: [], label: "", batch: true, demand: named }
32
+ timeout: 2h
33
+ continue_on_failure: true
34
+ # Calibrates each correctness judge against the check: the suite's calibration.rate of the trials of a task with a check
35
+ # and success criteria whose check failed, labelled by that judge too. store: false keeps the label out of the trial's
36
+ # verdicts: it decides nothing, and the results show it as Judge calibration. Drop these two steps to calibrate nothing.
37
+ - id: calibration-subjects
38
+ needs: [score]
39
+ if: steps.score.outcome != 'skipped'
40
+ requires: { host: true }
41
+ command: teamai score subjects --calibration --run "$RUN" --step trials
42
+ env: { RUN: "{{ run.id }}" }
43
+ output: { list: [{ subject: string, scorer: string }] }
44
+ - id: calibrate
45
+ needs: [calibration-subjects]
46
+ for_each: steps.calibration-subjects.outputs.list
47
+ workflow: teamai-score
48
+ with: { subject: "{{ item.subject }}", scorers: ["{{ item.scorer }}"], label: "", store: false, batch: false, demand: named }
49
+ timeout: 2h
50
+ continue_on_failure: true
51
+ finally:
52
+ - id: report
53
+ requires: { host: true }
54
+ command: teamai benchmark report
55
+ env: { COMPARE: "{{ inputs.fail_on_regression }}" }
56
+ output: { text: string, table: json, regression: dropped | held | no_comparable | off, unchecked: string, unmeasured: string }
57
+ # Fails when a baseline's or a trial's check could not run, naming each as report's text does: the run measured
58
+ # nothing for them. Drop it to report them without failing.
59
+ - id: checks
60
+ needs: [report]
61
+ if: steps.report.outputs.unchecked != ''
62
+ requires: { host: true }
63
+ command: node -e "process.stderr.write(process.env.UNCHECKED + '\n'); process.exit(1)"
64
+ env: { UNCHECKED: "{{ steps.report.outputs.unchecked }}" }
65
+ # Fails when no trial produced a result and a trial ended in an error, naming each such trial as report's text does:
66
+ # the run measured nothing. Drop it to report such a run without failing.
67
+ - id: results
68
+ needs: [report]
69
+ if: steps.report.outputs.unmeasured != ''
70
+ requires: { host: true }
71
+ command: node -e "process.stderr.write(process.env.UNMEASURED + '\n'); process.exit(1)"
72
+ env: { UNMEASURED: "{{ steps.report.outputs.unmeasured }}" }
73
+ - id: regression
74
+ needs: [report]
75
+ if: steps.report.outputs.regression == 'dropped'
76
+ requires: { host: true }
77
+ command: exit 1
78
+ outputs: { text: steps.report.outputs.text, table: steps.report.outputs.table }
@@ -0,0 +1,66 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-ci-extract-mr
3
+ description: Turn a merged MR or PR into a team learning in a CI job - the AI tool drafts it, then it is posted as a comment on the MR, written into the team repo's learnings/ with the teamwiki of the merged checkout updated, or both. teamai ci extract-mr starts it, with no teamai init needed.
4
+ invoke: deny
5
+ private: true
6
+ # url: the MR or PR. mode: comment posts the learning on the MR, write writes it into team_repo's learnings/ and pushes
7
+ # it, both does both. team_repo: the team repo's checkout, '' with mode comment. comment_marker: the HTML comment the
8
+ # MR comment is found and updated by. individual_comments: post the learning as its own comment, whose reactions decide
9
+ # what write keeps. output: a directory the learning is also written into as learning.md, '' for none. discussions:
10
+ # read the review threads. language: teamai.yaml's language. dry_run: say what would be posted and written, and post,
11
+ # write and push nothing.
12
+ inputs:
13
+ url: string
14
+ mode: comment | write | both
15
+ team_repo: string
16
+ comment_marker: string
17
+ individual_comments: boolean
18
+ output: string
19
+ discussions: boolean
20
+ language: en | zh
21
+ dry_run: boolean
22
+ steps:
23
+ - id: extract
24
+ workflow: teamai-import-from-mr
25
+ with:
26
+ mrs: ["{{ inputs.url }}"]
27
+ all: true
28
+ publish: false
29
+ output: false
30
+ discussions: "{{ inputs.discussions }}"
31
+ language: "{{ inputs.language }}"
32
+ - id: comment
33
+ needs: [extract]
34
+ if: steps.extract.outputs.exit_code == 0 && inputs.mode != 'write'
35
+ requires: { host: true }
36
+ command: teamai ci comment --url "$URL" --learnings "$LEARNINGS" --marker "$MARKER" --individual "$INDIVIDUAL" --preview "$PREVIEW"
37
+ env:
38
+ URL: "{{ inputs.url }}"
39
+ LEARNINGS: "{{ steps.extract.outputs.learnings }}"
40
+ MARKER: "{{ inputs.comment_marker }}"
41
+ INDIVIDUAL: "{{ inputs.individual_comments }}"
42
+ PREVIEW: "{{ inputs.dry_run }}"
43
+ - id: write
44
+ needs: [extract, comment]
45
+ if: steps.extract.outputs.exit_code == 0 && inputs.mode != 'comment'
46
+ requires: { host: true }
47
+ # Updates the team repo's teamwiki from the merged checkout through a teamai-import-from-repo run, under its import
48
+ # lock; a failed update is said and leaves the learning to be written.
49
+ command: teamai ci write --url "$URL" --learnings "$LEARNINGS" --team-repo "$TEAM_REPO" --individual "$INDIVIDUAL" --preview "$PREVIEW"
50
+ env:
51
+ URL: "{{ inputs.url }}"
52
+ LEARNINGS: "{{ steps.extract.outputs.learnings }}"
53
+ TEAM_REPO: "{{ inputs.team_repo }}"
54
+ INDIVIDUAL: "{{ inputs.individual_comments }}"
55
+ PREVIEW: "{{ inputs.dry_run }}"
56
+ writes: ["{{ inputs.team_repo }}"]
57
+ - id: artifacts
58
+ needs: [extract, comment, write]
59
+ if: steps.extract.outputs.exit_code == 0 && inputs.output != ''
60
+ requires: { host: true }
61
+ command: teamai ci artifacts --learnings "$LEARNINGS" --dir "$DIR"
62
+ env: { LEARNINGS: "{{ steps.extract.outputs.learnings }}", DIR: "{{ inputs.output }}" }
63
+ writes: ["{{ inputs.output }}"]
64
+ outputs:
65
+ text: steps.extract.outputs.text
66
+ exit_code: steps.extract.outputs.exit_code
@@ -0,0 +1,123 @@
1
+ # teamai-codebase-deep-enrich
2
+
3
+ English | [中文](README.zh-CN.md)
4
+
5
+ Writes the deep knowledge docs of a codebase that `teamai import` extracted into a teamwiki. The docs go beside the codebase's evidence: a design doc for each component, the architecture overview, the graph docs and the cross-component scenarios.
6
+
7
+ | Started by | |
8
+ |---|---|
9
+ | `teamai codebase --deep-enrich --project <slug>` | One codebase |
10
+ | [`teamai-import-from-repo`](../teamai-import-from-repo/README.md) | Each repository it imports |
11
+
12
+ ## How teamai's version runs
13
+
14
+ ```mermaid
15
+ flowchart TD
16
+ plan[Plan the components and the docs they need] --> comp
17
+ subgraph comp [For each component, up to concurrency at once, each in its own worktree]
18
+ ask[Ask the AI tool: component.md] --> write[Write the design doc]
19
+ end
20
+ comp --> arch["Ask the AI tool: architecture.md, when the plan needs an overview"]
21
+ arch --> gr[Write the graph docs]
22
+ gr --> sc["Ask the AI tool: scenarios.md, when the graph has scenarios"]
23
+ sc --> finish(["Sum up: text, exit_code, complete, missing_components, missing_architecture"])
24
+ finish --> pub{publish?}
25
+ pub -- true --> publish([Commit and push the docs])
26
+ pub -- false --> done([Done])
27
+ classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
28
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
29
+ class ask,arch,sc prompt;
30
+ class finish,publish,done out;
31
+ ```
32
+
33
+ Purple marks a prompt the AI tool answers. A component whose answer fails gets no doc. The run names it, and the next run writes it. When the AI tool cannot run at all, the run fails. `WORKFLOW.yaml` holds the steps.
34
+
35
+ ## Files
36
+
37
+ | File | What it is |
38
+ |---|---|
39
+ | `WORKFLOW.yaml` | The steps, and the `output:` each step declares |
40
+ | `component.md` | The prompt for each component's design doc |
41
+ | `architecture.md` | The prompt for the architecture overview |
42
+ | `scenarios.md` | The prompt for the scenario sequence diagrams |
43
+ | `params.yaml` | How many component docs `teamai codebase --deep-enrich` has the run write at once |
44
+
45
+ A prompt reads `{{ inputs.<name> }}`, `{{ item.<field> }}` inside a step that runs for each component, and the outputs of the steps it needs, as `{{ steps.<id>.outputs.<field> }}`.
46
+
47
+ ## Inputs
48
+
49
+ | Input | Type | Meaning |
50
+ |---|---|---|
51
+ | `wiki_root` | `string` | The teamwiki directory |
52
+ | `project` | `string` | The codebase, its directory under `evidence/code/` |
53
+ | `max_modules` | `number` | How many components get a doc. `0` means every component |
54
+ | `concurrency` | `number` | How many component docs the run writes at once. `teamai codebase --deep-enrich` passes the `concurrency` of `params.yaml` |
55
+ | `publish` | `boolean` | Commit the docs and push them to the team repo that holds `wiki_root` |
56
+
57
+ ## Outputs
58
+
59
+ | Output | Meaning |
60
+ |---|---|
61
+ | `text` | The summary the command prints |
62
+ | `exit_code` | `1` when a doc is missing |
63
+ | `complete` | `true` when the run wrote every doc |
64
+ | `missing_components` | The components with no doc. The next run writes them |
65
+ | `missing_architecture` | `true` when the architecture overview is missing |
66
+
67
+ ## Parameters
68
+
69
+ | Key | Range | What it sets |
70
+ |---|---|---|
71
+ | `concurrency` | 1-20 | How many component docs `teamai codebase --deep-enrich` and `teamai deep-enrich` have the run write at once. `teamai-import-from-repo` passes its own, `5` |
72
+
73
+ ## Replace it
74
+
75
+ Put only the files you change in `workflows/teamai-codebase-deep-enrich/` at the root of the team repo. Every other file, `WORKFLOW.yaml` included, stays teamai's and keeps getting teamai's updates. To add a section to each design doc, copy its prompt:
76
+
77
+ ```bash
78
+ mkdir -p workflows/teamai-codebase-deep-enrich
79
+ cp "$(npm root -g)/teamai-cli/workflows/teamai-codebase-deep-enrich/component.md" workflows/teamai-codebase-deep-enrich/
80
+ ```
81
+
82
+ Then add this to `component.md`:
83
+
84
+ ```markdown
85
+ End each design doc with a "Failure modes" section that lists what the component does when a dependency is down.
86
+ ```
87
+
88
+ To write fewer docs at once, against an AI tool's rate limit:
89
+
90
+ ```yaml
91
+ # workflows/teamai-codebase-deep-enrich/params.yaml
92
+ concurrency: 2
93
+ ```
94
+
95
+ Push the folder. After the next `teamai pull`, the command and `teamai-import-from-repo` run it with your files. A `workflows/teamai-codebase-deep-enrich.yaml` file replaces the folder whole, so teamai's parameters apply.
96
+
97
+ | Keep | Why |
98
+ |---|---|
99
+ | The inputs and outputs above | The callers pass those inputs and read those outputs |
100
+
101
+ ## What pull refuses
102
+
103
+ | A team folder that | Pull |
104
+ |---|---|
105
+ | Sets a value out of range, or a key the table above does not list, in `params.yaml` | Names the file and the field. The version pull last took stays in force, teamai's until it took one |
106
+
107
+ `teamai review --branch` fails such a folder before you merge it.
108
+
109
+ ## Requires
110
+
111
+ | Needs | Without it |
112
+ |---|---|
113
+ | An AI tool | When a tool named in the settings cannot run, the run fails |
114
+
115
+ ## Settings that change it
116
+
117
+ | Setting | Team `teamai.yaml` | Member config | Environment | Effect |
118
+ |---|---|---|---|---|
119
+ | AI tool | | `workflows.tools.default`, then `ai.tool` | `TEAMAI_AI_TOOL`, before both | Picks the tool that writes each doc |
120
+ | Driver | `workflows.driver` | `workflows.driver` | | Picks the driver `teamai codebase --deep-enrich` starts its run on. Unset means this machine |
121
+ | Retention | | `workflows.retention` | | Sets how long `teamai doctor --fix` leaves the worktrees and branches of the answers |
122
+
123
+ The member config is `~/.teamai/projects/<slug>/config.yaml` in a workspace, then `~/.teamai/config.yaml`. The environment wins over the member config, and the member config wins over the team. See [member settings](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/reference.md#member-settings) for the defaults.
@@ -0,0 +1,123 @@
1
+ # teamai-codebase-deep-enrich
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 为 `teamai import` 已提取到 teamwiki 的代码库编写深度知识文档。文档放在代码库的证据旁边:每个组件的设计文档、架构总览、图文档和跨组件场景。
6
+
7
+ | 启动方式 | |
8
+ |---|---|
9
+ | `teamai codebase --deep-enrich --project <slug>` | 一个代码库 |
10
+ | [`teamai-import-from-repo`](../teamai-import-from-repo/README.zh-CN.md) | 它导入的每个仓库 |
11
+
12
+ ## teamai 的版本如何运行
13
+
14
+ ```mermaid
15
+ flowchart TD
16
+ plan["规划组件和它们需要的文档"] --> comp
17
+ subgraph comp ["对每个组件,最多同时 concurrency 个,每个在自己的 worktree 里"]
18
+ ask["询问 AI 工具:component.md"] --> write["写设计文档"]
19
+ end
20
+ comp --> arch["询问 AI 工具:architecture.md,规划需要总览时"]
21
+ arch --> gr["写图文档"]
22
+ gr --> sc["询问 AI 工具:scenarios.md,图里有场景时"]
23
+ sc --> finish(["汇总:text、exit_code、complete、missing_components、missing_architecture"])
24
+ finish --> pub{"publish?"}
25
+ pub -- true --> publish(["提交并推送文档"])
26
+ pub -- false --> done(["完成"])
27
+ classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
28
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
29
+ class ask,arch,sc prompt;
30
+ class finish,publish,done out;
31
+ ```
32
+
33
+ 紫色表示由 AI 工具回答的提示词。回答失败的组件没有文档。运行会列出它,下一次运行会补写。AI 工具完全无法运行时,运行失败。`WORKFLOW.yaml` 保存这些步骤。
34
+
35
+ ## 文件
36
+
37
+ | 文件 | 是什么 |
38
+ |---|---|
39
+ | `WORKFLOW.yaml` | 步骤,以及每个步骤声明的 `output:` |
40
+ | `component.md` | 每个组件设计文档的提示词 |
41
+ | `architecture.md` | 架构总览的提示词 |
42
+ | `scenarios.md` | 场景时序图的提示词 |
43
+ | `params.yaml` | `teamai codebase --deep-enrich` 让运行同时写多少份组件文档 |
44
+
45
+ 提示词读取 `{{ inputs.<name> }}`;在为每个组件运行一次的步骤里读取 `{{ item.<field> }}`;还以 `{{ steps.<id>.outputs.<field> }}` 的形式,读取它依赖的步骤的输出。
46
+
47
+ ## 输入
48
+
49
+ | 输入 | 类型 | 含义 |
50
+ |---|---|---|
51
+ | `wiki_root` | `string` | teamwiki 目录 |
52
+ | `project` | `string` | 代码库,即它在 `evidence/code/` 下的目录 |
53
+ | `max_modules` | `number` | 为多少个组件写文档。`0` 表示所有组件 |
54
+ | `concurrency` | `number` | 运行同时写多少份组件文档。`teamai codebase --deep-enrich` 传入 `params.yaml` 的 `concurrency` |
55
+ | `publish` | `boolean` | 提交文档,并推送到存放 `wiki_root` 的团队仓库 |
56
+
57
+ ## 输出
58
+
59
+ | 输出 | 含义 |
60
+ |---|---|
61
+ | `text` | 命令打印的摘要 |
62
+ | `exit_code` | 有文档缺失时为 `1` |
63
+ | `complete` | 运行写完了所有文档时为 `true` |
64
+ | `missing_components` | 没有文档的组件。下一次运行会补写 |
65
+ | `missing_architecture` | 缺少架构总览时为 `true` |
66
+
67
+ ## 参数
68
+
69
+ | 键 | 范围 | 设置什么 |
70
+ |---|---|---|
71
+ | `concurrency` | 1-20 | `teamai codebase --deep-enrich` 和 `teamai deep-enrich` 让运行同时写多少份组件文档。`teamai-import-from-repo` 传入它自己的值 `5` |
72
+
73
+ ## 替换它
74
+
75
+ 在团队仓库根目录的 `workflows/teamai-codebase-deep-enrich/` 里只放你要改的文件。其他文件(包括 `WORKFLOW.yaml`)仍用 teamai 的,并继续获得 teamai 的更新。要给每份设计文档加一节,复制它的提示词:
76
+
77
+ ```bash
78
+ mkdir -p workflows/teamai-codebase-deep-enrich
79
+ cp "$(npm root -g)/teamai-cli/workflows/teamai-codebase-deep-enrich/component.md" workflows/teamai-codebase-deep-enrich/
80
+ ```
81
+
82
+ 然后在 `component.md` 里加上这一句:
83
+
84
+ ```markdown
85
+ End each design doc with a "Failure modes" section that lists what the component does when a dependency is down.
86
+ ```
87
+
88
+ 为了不超出 AI 工具的速率限制,同时少写几份:
89
+
90
+ ```yaml
91
+ # workflows/teamai-codebase-deep-enrich/params.yaml
92
+ concurrency: 2
93
+ ```
94
+
95
+ 推送这个文件夹。下一次 `teamai pull` 之后,命令和 `teamai-import-from-repo` 都用你的文件运行它。`workflows/teamai-codebase-deep-enrich.yaml` 单个文件会整体替换这个文件夹,此时用 teamai 的参数。
96
+
97
+ | 保留 | 原因 |
98
+ |---|---|
99
+ | 上面的输入和输出 | 调用方会传这些输入、读这些输出 |
100
+
101
+ ## pull 拒绝什么
102
+
103
+ | 团队文件夹 | pull 的处理 |
104
+ |---|---|
105
+ | 在 `params.yaml` 里设置了超出范围的值,或上表没有列出的键 | 指出文件和字段。pull 上一次接受的版本继续生效,还没接受过时用 teamai 的 |
106
+
107
+ `teamai review --branch` 会在合并前让这样的文件夹不通过。
108
+
109
+ ## 依赖
110
+
111
+ | 需要 | 没有时 |
112
+ |---|---|
113
+ | AI 工具 | 设置里指定的工具无法运行时,运行失败 |
114
+
115
+ ## 影响它的设置
116
+
117
+ | 设置 | 团队 `teamai.yaml` | 成员配置 | 环境变量 | 作用 |
118
+ |---|---|---|---|---|
119
+ | AI 工具 | | `workflows.tools.default`,其次是 `ai.tool` | `TEAMAI_AI_TOOL`,优先于两者 | 选出编写每份文档的工具 |
120
+ | 驱动 | `workflows.driver` | `workflows.driver` | | 选出 `teamai codebase --deep-enrich` 在哪个驱动上启动运行。未设置表示本机 |
121
+ | 保留期 | | `workflows.retention` | | 设置 `teamai doctor --fix` 把回答留下的 worktree 和分支保留多久 |
122
+
123
+ 成员配置在工作区里是 `~/.teamai/projects/<slug>/config.yaml`,其次是 `~/.teamai/config.yaml`。环境变量优先于成员配置,成员配置优先于团队。默认值见[成员设置](https://github.com/Tencent/teamai-cli/blob/main/docs/guide/zh-CN/reference.md#成员设置)。