@team-ai/teamai-cli 0.40.9 → 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 +167 -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 +210551 -136899
  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,101 @@
1
+ # teamai-finished-sessions
2
+
3
+ English | [中文](README.zh-CN.md)
4
+
5
+ Archives and scores this machine's finished sessions, as the team's session policies say, and starts again the judging that lapsed.
6
+
7
+ | Started by | Inputs |
8
+ |---|---|
9
+ | A session start, in the background | `{"publish":"policy","scorers":[]}` |
10
+ | `teamai score --drain` | `{"publish":"policy","scorers":[]}` |
11
+ | `teamai workflow start teamai-finished-sessions` from your own terminal | Any. Only a run a person started may pass other inputs |
12
+ | An agent session | Never by name: `invoke: deny` |
13
+
14
+ ## How teamai's version runs
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ sessions["List the finished sessions to archive or judge: an attended one idle for idle, an unattended one once a drain reached it"] --> share
19
+ subgraph share [For each session. One that fails leaves the others]
20
+ one["Run teamai-share-session: publish it, then score it"]
21
+ end
22
+ share --> lapsed["List the judging that lapsed"]
23
+ lapsed --> rescore
24
+ subgraph rescore [For each lapse]
25
+ again["Run teamai-score with the scorers its marks hold"]
26
+ end
27
+ classDef wf fill:#3b6ea5,stroke:#2b5079,color:#fff;
28
+ class one,again wf;
29
+ ```
30
+
31
+ Blue marks another default workflow, which a team can replace too. `WORKFLOW.yaml` holds the steps. A run ends after its `timeout`, 30 minutes, and what it cancels lapses, so the next run starts it again.
32
+
33
+ ## Files
34
+
35
+ | File | What it is |
36
+ |---|---|
37
+ | `WORKFLOW.yaml` | The steps, the `timeout`, and the `output:` each step declares |
38
+ | `params.yaml` | How long an attended session is idle before it is finished |
39
+
40
+ ## Inputs
41
+
42
+ | Input | Type | Meaning |
43
+ |---|---|---|
44
+ | `publish` | `policy \| always \| never` | `policy` lets `sessions.publish` decide for each session's run mode |
45
+ | `scorers` | `[string]` | The scorers that judge each finished session, unsampled. `[]` lets `scoring.sessions` decide |
46
+
47
+ ## Outputs
48
+
49
+ None. Each session's publishing and scoring are recorded where `teamai-share-session` and `teamai-score` keep them.
50
+
51
+ ## Parameters
52
+
53
+ | Key | Range | What it sets |
54
+ |---|---|---|
55
+ | `idle` | `10m`-`7d` | How long nothing happens in an attended session before it is finished, such as `6h` |
56
+
57
+ The dashboard, the share proposals of `teamai-share-session` and the usage report's outcomes count a session finished at the same `idle`. `teamai session list --finished --idle <duration>` overrides it for one listing.
58
+
59
+ ## Replace it
60
+
61
+ Put only the files you change in `workflows/teamai-finished-sessions/` at the root of the team repo. Every other file, `WORKFLOW.yaml` included, stays teamai's and keeps getting teamai's updates. A team whose sessions are short, and wants them judged the same afternoon:
62
+
63
+ ```yaml
64
+ # workflows/teamai-finished-sessions/params.yaml
65
+ idle: 1h
66
+ ```
67
+
68
+ Push the folder. After the next `teamai pull`, every reader above uses it.
69
+
70
+ A `WORKFLOW.yaml` of your own in the folder replaces the steps and the `timeout`, and `params.yaml` still decides when a session is finished. A `workflows/teamai-finished-sessions.yaml` file replaces the folder whole, so teamai's `idle` applies.
71
+
72
+ | Keep | Why |
73
+ |---|---|
74
+ | The inputs above | A session start and `teamai score --drain` pass them |
75
+ | A `sessions` step running `teamai session list --finished` | Its refusal of other inputs in a run no person started is what keeps an automatic start to the policies |
76
+
77
+ ## What pull refuses
78
+
79
+ | A team folder that | Pull |
80
+ |---|---|
81
+ | Sets an `idle` that is not a duration from `10m` to `7d`, or a key the table above does not list | Names the file and the field. The version pull last took stays in force, teamai's until it took one |
82
+
83
+ `teamai review --branch` fails such a folder before you merge it.
84
+
85
+ ## Requires
86
+
87
+ | Needs | Without it |
88
+ |---|---|
89
+ | A scorer that sets `sessions: true` | Nothing is judged. Publishing still follows `sessions.publish` |
90
+ | A team repo kept by git | No session is archived, since an HTTP team repo keeps no session archive |
91
+
92
+ ## Settings that change it
93
+
94
+ | Setting | Team `teamai.yaml` | Member config | Environment | Effect |
95
+ |---|---|---|---|---|
96
+ | Publishing | `sessions.publish` | `sessions.publish` | | Decides, per run mode, whether a finished session is archived |
97
+ | Scoring | `sessions` in `scorers/scoring.yaml` | `scoring.sessions` | | Decides, per run mode, whether a finished session is judged, up to `daily_limit` |
98
+ | Run mode | | | `TEAMAI_MODE`, then `CI` | Decides whether a session is attended, and finishes at `idle`, or unattended, and finishes at a drain |
99
+ | Driver | `workflows.driver` | `workflows.driver` | | Picks where `teamai score --drain` starts the run. Unset means this machine |
100
+
101
+ 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,101 @@
1
+ # teamai-finished-sessions
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 按团队的会话策略归档并评判本机已结束的会话,并重新开始已失效的评判。
6
+
7
+ | 启动方式 | 输入 |
8
+ |---|---|
9
+ | 会话启动时,在后台 | `{"publish":"policy","scorers":[]}` |
10
+ | `teamai score --drain` | `{"publish":"policy","scorers":[]}` |
11
+ | 在你自己的终端运行 `teamai workflow start teamai-finished-sessions` | 任意。只有成员启动的运行可以传其他输入 |
12
+ | agent 会话 | 从不按名称启动:`invoke: deny` |
13
+
14
+ ## teamai 的版本如何运行
15
+
16
+ ```mermaid
17
+ flowchart TD
18
+ sessions["列出要归档或评判的已结束会话:有人值守的会话空闲达到 idle,无人值守的会话在 drain 到达它时"] --> share
19
+ subgraph share ["逐个会话处理。一个失败不影响其他会话"]
20
+ one["运行 teamai-share-session:先发布,再评分"]
21
+ end
22
+ share --> lapsed["列出已失效的评判"]
23
+ lapsed --> rescore
24
+ subgraph rescore ["逐个失效项处理"]
25
+ again["用它的标记里的评分器运行 teamai-score"]
26
+ end
27
+ classDef wf fill:#3b6ea5,stroke:#2b5079,color:#fff;
28
+ class one,again wf;
29
+ ```
30
+
31
+ 蓝色表示另一个默认工作流,团队也可以替换它。`WORKFLOW.yaml` 保存这些步骤。一次运行在 `timeout`(30 分钟)后结束,被取消的部分会失效,下一次运行会重新开始它。
32
+
33
+ ## 文件
34
+
35
+ | 文件 | 是什么 |
36
+ |---|---|
37
+ | `WORKFLOW.yaml` | 步骤、`timeout`,以及每个步骤声明的 `output:` |
38
+ | `params.yaml` | 有人值守的会话空闲多久后算作已结束 |
39
+
40
+ ## 输入
41
+
42
+ | 输入 | 类型 | 含义 |
43
+ |---|---|---|
44
+ | `publish` | `policy \| always \| never` | `policy` 表示按每个会话的运行模式由 `sessions.publish` 决定 |
45
+ | `scorers` | `[string]` | 评判每个已结束会话的评分器,不抽样。`[]` 表示由 `scoring.sessions` 决定 |
46
+
47
+ ## 输出
48
+
49
+ 无。每个会话的发布和评分记录在 `teamai-share-session` 和 `teamai-score` 保存它们的地方。
50
+
51
+ ## 参数
52
+
53
+ | 键 | 范围 | 设置什么 |
54
+ |---|---|---|
55
+ | `idle` | `10m`-`7d` | 有人值守的会话多久没有任何活动后算作已结束,例如 `6h` |
56
+
57
+ dashboard、`teamai-share-session` 的分享提议和用量报告的产出,都按同一个 `idle` 把会话算作已结束。`teamai session list --finished --idle <duration>` 只对这一次列出覆盖它。
58
+
59
+ ## 替换它
60
+
61
+ 在团队仓库根目录的 `workflows/teamai-finished-sessions/` 里只放你要改的文件。其他文件(包括 `WORKFLOW.yaml`)仍用 teamai 的,并继续获得 teamai 的更新。会话都很短、希望当天下午就评判的团队:
62
+
63
+ ```yaml
64
+ # workflows/teamai-finished-sessions/params.yaml
65
+ idle: 1h
66
+ ```
67
+
68
+ 推送这个文件夹。下一次 `teamai pull` 之后,上面所有读取它的地方都用它。
69
+
70
+ 文件夹里放你自己的 `WORKFLOW.yaml` 会替换步骤和 `timeout`,`params.yaml` 仍决定会话何时算作已结束。`workflows/teamai-finished-sessions.yaml` 单个文件会整体替换这个文件夹,此时用 teamai 的 `idle`。
71
+
72
+ | 保留 | 原因 |
73
+ |---|---|
74
+ | 上面的输入 | 会话启动和 `teamai score --drain` 会传这些输入 |
75
+ | 运行 `teamai session list --finished` 的 `sessions` 步骤 | 它会拒绝非成员启动的运行传入的其他输入,自动启动因此只能按策略处理 |
76
+
77
+ ## pull 拒绝什么
78
+
79
+ | 团队文件夹 | pull 的处理 |
80
+ |---|---|
81
+ | 设置的 `idle` 不是 `10m` 到 `7d` 之间的时长,或上表没有列出的键 | 指出文件和字段。pull 上一次接受的版本继续生效,还没接受过时用 teamai 的 |
82
+
83
+ `teamai review --branch` 会在合并前让这样的文件夹不通过。
84
+
85
+ ## 依赖
86
+
87
+ | 需要 | 没有时 |
88
+ |---|---|
89
+ | 设置了 `sessions: true` 的评分器 | 不评判任何会话。发布仍按 `sessions.publish` |
90
+ | 用 git 保存的团队仓库 | 不归档任何会话,因为 HTTP 团队仓库不保存会话存档 |
91
+
92
+ ## 影响它的设置
93
+
94
+ | 设置 | 团队 `teamai.yaml` | 成员配置 | 环境变量 | 作用 |
95
+ |---|---|---|---|---|
96
+ | 发布 | `sessions.publish` | `sessions.publish` | | 按运行模式决定已结束的会话是否归档 |
97
+ | 评分 | `scorers/scoring.yaml` 的 `sessions` | `scoring.sessions` | | 按运行模式决定已结束的会话是否评判,上限为 `daily_limit` |
98
+ | 运行模式 | | | `TEAMAI_MODE`,其次是 `CI` | 决定会话是有人值守(空闲达到 `idle` 时结束)还是无人值守(drain 到达时结束) |
99
+ | 驱动 | `workflows.driver` | `workflows.driver` | | 选出 `teamai score --drain` 在哪里启动运行。未设置表示本机 |
100
+
101
+ 成员配置在工作区里是 `~/.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,43 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-finished-sessions
3
+ description: Archive and score this machine's finished sessions, as the team's session policies say.
4
+ invoke: deny
5
+ private: true
6
+ # A background pass ends after 30 minutes; what it cancels is a lapse the next start takes.
7
+ timeout: 30m
8
+ inputs:
9
+ # policy: sessions.publish decides
10
+ publish: policy | always | never
11
+ # []: scoring.sessions decides
12
+ scorers: [string]
13
+ steps:
14
+ - id: sessions
15
+ requires: { host: true }
16
+ # A session idle for the idle of params.yaml counts as finished. Only a run a person started may pass inputs other than policy and [].
17
+ command: teamai session list --finished --publish "$PUBLISH" --scorers "$SCORERS" --json
18
+ env: { PUBLISH: "{{ inputs.publish }}", SCORERS: "{{ inputs.scorers }}" }
19
+ # demand: named when the inputs name the scorers, so daily_limit counts the session but never refuses it
20
+ output: { list: [{ session: string, source: string, publish: boolean, scorers: [string], demand: string }] }
21
+ - id: share
22
+ needs: [sessions]
23
+ if: length(steps.sessions.outputs.list) > 0
24
+ for_each: steps.sessions.outputs.list
25
+ workflow: teamai-share-session
26
+ with: { session: "{{ item.session }}", source: "{{ item.source }}", publish: "{{ item.publish }}", scorers: "{{ item.scorers }}", demand: "{{ item.demand }}" }
27
+ continue_on_failure: true
28
+ - id: lapsed
29
+ # After share, whatever it did: a mark share opened is then closed, or held by this run, so no subject is judged twice.
30
+ needs: [sessions, share]
31
+ if: steps.sessions.outcome != 'cancelled' && steps.share.outcome != 'cancelled'
32
+ requires: { host: true }
33
+ command: teamai score subjects --lapsed
34
+ # passes and sessions whose teamai-score run ended without a label or a settle, and passes no run scored,
35
+ # each with the scorers to start it for: those its marks hold, named or not, and none its policy would add now
36
+ output: { list: [{ subject: string, scorers: [string] }] }
37
+ - id: rescore
38
+ needs: [lapsed]
39
+ if: length(steps.lapsed.outputs.list) > 0
40
+ for_each: steps.lapsed.outputs.list
41
+ workflow: teamai-score
42
+ with: { subject: "{{ item.subject }}", scorers: "{{ item.scorers }}", label: '', batch: false, demand: auto }
43
+ continue_on_failure: true
@@ -0,0 +1 @@
1
+ idle: 6h
@@ -0,0 +1,90 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-import-from-iwiki
3
+ description: Import the pages of an iWiki space, or one page, into the team repo - teamai-import-learnings classifies them and asks about each one - then link them to the teamwiki's code knowledge, commit and push. With dual, also ask the AI tool for the business API, external knowledge and glossary sections of docs/team-codebase/external-knowledge.md. teamai import --from-iwiki starts it.
4
+ invoke: deny
5
+ private: true
6
+ # source: a numeric space id, or a page URL holding /p/<id>; TAI_PAT_TOKEN must be set. dir: the team repo, whose rules/,
7
+ # docs/ and learnings/ take the items by type; with by_type false, the directory every item is written into, and nothing
8
+ # is pushed. all: accept every item without asking. dual: also write the sections into sections_dir, or with
9
+ # require_review queue them in review_dir/.teamai/pending-review.jsonl.
10
+ inputs:
11
+ source: string
12
+ dir: string
13
+ by_type: boolean
14
+ all: boolean
15
+ dual: boolean
16
+ sections_dir: string
17
+ review_dir: string
18
+ require_review: boolean
19
+ ends: { unconfigured-tool: failed }
20
+ steps:
21
+ - id: fetch
22
+ requires: { host: true }
23
+ command: teamai import fetch-iwiki --source "$SOURCE" --dual "$DUAL"
24
+ env: { SOURCE: "{{ inputs.source }}", DUAL: "{{ inputs.dual }}" }
25
+ output: { source: string, documents: string, candidates: [{ path: string, file: string }], dual_context: string }
26
+ - id: learnings
27
+ needs: [fetch]
28
+ if: length(steps.fetch.outputs.candidates) > 0
29
+ workflow: teamai-import-learnings
30
+ with:
31
+ candidates: "{{ steps.fetch.outputs.candidates }}"
32
+ dir: "{{ inputs.dir }}"
33
+ by_type: "{{ inputs.by_type }}"
34
+ all: "{{ inputs.all }}"
35
+ - id: publish
36
+ needs: [fetch, learnings]
37
+ if: steps.learnings.outcome == 'success'
38
+ requires: { host: true }
39
+ command: teamai import publish-iwiki --kept "$KEPT" --written "$WRITTEN" --target "$DIR" --by-type "$BY_TYPE" --documents "$DOCUMENTS"
40
+ env:
41
+ KEPT: "{{ steps.learnings.outputs.kept }}"
42
+ WRITTEN: "{{ steps.learnings.outputs.written }}"
43
+ DIR: "{{ inputs.dir }}"
44
+ BY_TYPE: "{{ inputs.by_type }}"
45
+ DOCUMENTS: "{{ steps.fetch.outputs.documents }}"
46
+ writes: ["{{ inputs.dir }}"]
47
+ - id: dual
48
+ needs: [fetch, publish]
49
+ if: inputs.dual && steps.publish.outcome == 'success'
50
+ answer: |-
51
+ 你是团队知识整理专家,请从以下 iWiki 文档中抽取三类知识,以 JSON 格式输出。
52
+
53
+ ## 文档内容
54
+
55
+ {{ steps.fetch.outputs.dual_context }}
56
+
57
+ ## 输出要求
58
+
59
+ 请严格输出以下 JSON 格式,三个字段都是可直接嵌入 Markdown 的内容:
60
+
61
+ {
62
+ "business-api": "<关于内部业务 API/接口规范的 Markdown 摘要,无相关内容则为空字符串>",
63
+ "external-knowledge": "<关于外部系统/第三方知识源的 Markdown 摘要,无相关内容则为空字符串>",
64
+ "glossary": "<项目术语表 Markdown(| 术语 | 说明 | 格式),无相关内容则为空字符串>"
65
+ }
66
+
67
+ 不要输出 JSON 以外的任何内容。
68
+ output: { text: string }
69
+ timeout: 600s
70
+ # The import is done by now: a tool that could not answer leaves the sections as they were, which sections says.
71
+ continue_on_failure: true
72
+ - id: dual-tool
73
+ needs: [dual]
74
+ # A tool the member names that cannot run fails the run, rather than leaving the sections as they were.
75
+ if: steps.dual.failure.code == 'tool_unconfigured'
76
+ end: unconfigured-tool
77
+ - id: sections
78
+ needs: [fetch, dual]
79
+ if: steps.dual.outcome == 'success' || (steps.dual.outcome == 'failed' && steps.dual.failure.code != 'tool_unconfigured')
80
+ requires: { host: true }
81
+ command: teamai import write-sections --source "$SOURCE" --reply "$REPLY" --failure "$WHY" --sections-dir "$SECTIONS" --review-dir "$REVIEW" --review "$REQUIRE_REVIEW"
82
+ env:
83
+ SOURCE: "{{ steps.fetch.outputs.source }}"
84
+ REPLY: "{{ steps.dual.outputs.text }}"
85
+ WHY: "{{ steps.dual.failure.message }}"
86
+ SECTIONS: "{{ inputs.sections_dir }}"
87
+ REVIEW: "{{ inputs.review_dir }}"
88
+ REQUIRE_REVIEW: "{{ inputs.require_review }}"
89
+ writes: ["{{ inputs.sections_dir }}", "{{ inputs.review_dir }}/.teamai"]
90
+ outputs: { written: steps.learnings.outputs.written }
@@ -0,0 +1,104 @@
1
+ # teamai-import-from-mr
2
+
3
+ English | [中文](README.zh-CN.md)
4
+
5
+ Turns merged MRs or PRs into team learnings. The AI tool drafts one learning per MR. A person accepts, edits or skips each draft. teamai publishes the accepted ones as `teamai contribute` does.
6
+
7
+ | Started by | |
8
+ |---|---|
9
+ | `teamai import --from-mr <url>...` | One URL or more |
10
+ | `teamai ci extract-mr` | Through `teamai-ci-extract-mr` |
11
+ | The [MR hint](../../hooks/teamai-mr-hint/README.md) | An offer the agent can start at session start |
12
+
13
+ ## How teamai's version runs
14
+
15
+ ```mermaid
16
+ flowchart TD
17
+ subgraph each [For each MR. A failed MR does not stop the others]
18
+ fetch[Read the MR, with its review threads when discussions is true] --> prompt["Ask the AI tool for a draft: draft.en.md or draft.zh.md, by language"]
19
+ end
20
+ each --> pub{publish?}
21
+ pub -- false --> finish
22
+ pub -- true --> all{all?}
23
+ all -- true --> publish
24
+ all -- false --> review{"For each draft, the person answers accept, edit or skip"}
25
+ review --> publish["Publish each accepted draft as teamai contribute does, or write it into dir when output is true"]
26
+ publish --> finish(["Sum up: text, exit_code, learnings"])
27
+ classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
28
+ classDef person fill:#b5762f,stroke:#865520,color:#fff;
29
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
30
+ class prompt prompt;
31
+ class review person;
32
+ class finish out;
33
+ ```
34
+
35
+ Purple marks a prompt the AI tool answers. Orange marks a question for a person. An edited draft is published with the person's note as its title. `WORKFLOW.yaml` holds the steps.
36
+
37
+ ## Files
38
+
39
+ | File | What it is |
40
+ |---|---|
41
+ | `WORKFLOW.yaml` | The steps, and the `output:` each step declares |
42
+ | `draft.en.md`, `draft.zh.md` | The prompt for each MR, picked by `language` |
43
+
44
+ A prompt reads the outputs of the steps it needs, as `{{ steps.<id>.outputs.<field> }}`.
45
+
46
+ ## Inputs
47
+
48
+ | Input | Type | Meaning |
49
+ |---|---|---|
50
+ | `mrs` | `[string]` | The MR or PR URLs |
51
+ | `all` | `boolean` | Accept every draft without asking |
52
+ | `publish` | `boolean` | When `false`, the run writes and pushes nothing, and the drafts are only its outputs |
53
+ | `dir` | `string` | The team repo. With `output`, the directory each draft goes in |
54
+ | `output` | `boolean` | Write the drafts as files into `dir` |
55
+ | `discussions` | `boolean` | Read the MRs' review threads |
56
+ | `language` | `en \| zh` | Picks the draft prompt |
57
+
58
+ ## Outputs
59
+
60
+ | Output | Meaning |
61
+ |---|---|
62
+ | `text` | The summary the command prints |
63
+ | `exit_code` | `1` when an MR failed. The other MRs still finish |
64
+ | `learnings` | The `url`, `title`, `file` and `repo_url` of each published learning |
65
+
66
+ ## Replace it
67
+
68
+ Put only the files you change in `workflows/teamai-import-from-mr/` at the root of the team repo. Every other file, `WORKFLOW.yaml` included, stays teamai's and keeps getting teamai's updates. To change the prompts, copy them:
69
+
70
+ ```bash
71
+ mkdir -p workflows/teamai-import-from-mr
72
+ cp "$(npm root -g)/teamai-cli/workflows/teamai-import-from-mr/"draft.*.md workflows/teamai-import-from-mr/
73
+ ```
74
+
75
+ A file you write replaces every language of it, and `WORKFLOW.yaml` reads `draft.zh.md` by name, so keep both. Then edit them, such as adding this to `draft.en.md`:
76
+
77
+ ```markdown
78
+ Name the service the MR changes in the title, such as "billing: ...".
79
+ ```
80
+
81
+ Push the folder. After the next `teamai pull`, the commands run it with your files. A `workflows/teamai-import-from-mr.yaml` file replaces the folder whole.
82
+
83
+ | Keep | Why |
84
+ |---|---|
85
+ | The inputs and outputs above | The commands pass those inputs and read those outputs |
86
+
87
+ ## Requires
88
+
89
+ | Needs | Without it |
90
+ |---|---|
91
+ | An AI tool | The draft steps fail |
92
+ | A person at the review, unless `all` is `true` | An unattended run cannot answer the review |
93
+ | Read access to each MR from this machine | That MR fails, and the others go on |
94
+
95
+ ## Settings that change it
96
+
97
+ | Setting | Team `teamai.yaml` | Member config | Environment | Effect |
98
+ |---|---|---|---|---|
99
+ | AI tool | | `workflows.tools.default`, then `ai.tool` | `TEAMAI_AI_TOOL`, before both | Picks the tool that writes each draft |
100
+ | Driver | `workflows.driver` | `workflows.driver` | | Picks where the command starts the run. Unset means this machine |
101
+ | Language | `language` | | | The commands pass it as the `language` input |
102
+ | MR hint | `sharing.mrHint.enabled` | `mrHintEnabled` | `TEAMAI_MR_HINT_DISABLED=1` | Decides whether session start offers this workflow |
103
+
104
+ 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,104 @@
1
+ # teamai-import-from-mr
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 把已合并的 MR 或 PR 整理成团队 learning。AI 工具为每个 MR 起草一条 learning。由人接受、编辑或跳过每份草稿。teamai 按 `teamai contribute` 的方式发布被接受的草稿。
6
+
7
+ | 启动方式 | |
8
+ |---|---|
9
+ | `teamai import --from-mr <url>...` | 一个或多个 URL |
10
+ | `teamai ci extract-mr` | 通过 `teamai-ci-extract-mr` |
11
+ | [MR 提示](../../hooks/teamai-mr-hint/README.zh-CN.md) | 会话开始时 agent 可以启动的提议 |
12
+
13
+ ## teamai 的版本如何运行
14
+
15
+ ```mermaid
16
+ flowchart TD
17
+ subgraph each ["对每个 MR。一个 MR 失败不会让其他 MR 停下"]
18
+ fetch["读取 MR,discussions 为 true 时连同它的评审讨论"] --> prompt["向 AI 工具要一份草稿:按 language 用 draft.en.md 或 draft.zh.md"]
19
+ end
20
+ each --> pub{"publish?"}
21
+ pub -- false --> finish
22
+ pub -- true --> all{"all?"}
23
+ all -- true --> publish
24
+ all -- false --> review{"对每份草稿,由人回答接受、编辑或跳过"}
25
+ review --> publish["按 teamai contribute 的方式发布每份被接受的草稿,或在 output 为 true 时把它写入 dir"]
26
+ publish --> finish(["汇总:text、exit_code、learnings"])
27
+ classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
28
+ classDef person fill:#b5762f,stroke:#865520,color:#fff;
29
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
30
+ class prompt prompt;
31
+ class review person;
32
+ class finish out;
33
+ ```
34
+
35
+ 紫色表示由 AI 工具回答的提示词。橙色表示要问人的问题。编辑过的草稿以这个人的备注作为标题发布。`WORKFLOW.yaml` 保存这些步骤。
36
+
37
+ ## 文件
38
+
39
+ | 文件 | 是什么 |
40
+ |---|---|
41
+ | `WORKFLOW.yaml` | 步骤,以及每个步骤声明的 `output:` |
42
+ | `draft.en.md`、`draft.zh.md` | 每个 MR 的提示词,按 `language` 选用 |
43
+
44
+ 提示词以 `{{ steps.<id>.outputs.<field> }}` 的形式,读取它依赖的步骤的输出。
45
+
46
+ ## 输入
47
+
48
+ | 输入 | 类型 | 含义 |
49
+ |---|---|---|
50
+ | `mrs` | `[string]` | MR 或 PR 的 URL |
51
+ | `all` | `boolean` | 不询问,接受每份草稿 |
52
+ | `publish` | `boolean` | 为 `false` 时,运行不写入也不推送任何东西,草稿只作为它的输出 |
53
+ | `dir` | `string` | 团队仓库。配合 `output` 时,是每份草稿写入的目录 |
54
+ | `output` | `boolean` | 把草稿作为文件写入 `dir` |
55
+ | `discussions` | `boolean` | 读取 MR 的评审讨论 |
56
+ | `language` | `en \| zh` | 选择草稿提示词 |
57
+
58
+ ## 输出
59
+
60
+ | 输出 | 含义 |
61
+ |---|---|
62
+ | `text` | 命令打印的摘要 |
63
+ | `exit_code` | 有 MR 失败时为 `1`。其他 MR 仍会完成 |
64
+ | `learnings` | 每条已发布 learning 的 `url`、`title`、`file` 和 `repo_url` |
65
+
66
+ ## 替换它
67
+
68
+ 在团队仓库根目录的 `workflows/teamai-import-from-mr/` 里只放你要改的文件。其他文件(包括 `WORKFLOW.yaml`)仍用 teamai 的,并继续获得 teamai 的更新。要修改提示词,先复制它们:
69
+
70
+ ```bash
71
+ mkdir -p workflows/teamai-import-from-mr
72
+ cp "$(npm root -g)/teamai-cli/workflows/teamai-import-from-mr/"draft.*.md workflows/teamai-import-from-mr/
73
+ ```
74
+
75
+ 你写的文件会替换它的所有语言版本,而 `WORKFLOW.yaml` 按名称读取 `draft.zh.md`,所以两个都要保留。然后编辑它们,例如在 `draft.en.md` 里加上这一句:
76
+
77
+ ```markdown
78
+ Name the service the MR changes in the title, such as "billing: ...".
79
+ ```
80
+
81
+ 推送这个文件夹。下一次 `teamai pull` 之后,命令都用你的文件运行它。`workflows/teamai-import-from-mr.yaml` 单个文件会整体替换这个文件夹。
82
+
83
+ | 保留 | 原因 |
84
+ |---|---|
85
+ | 上面的输入和输出 | 命令会传这些输入、读这些输出 |
86
+
87
+ ## 依赖
88
+
89
+ | 需要 | 没有时 |
90
+ |---|---|
91
+ | AI 工具 | 起草步骤失败 |
92
+ | 评审时有人在场,除非 `all` 为 `true` | 无人值守的运行无法回答评审 |
93
+ | 本机能读取每个 MR | 该 MR 失败,其他 MR 继续 |
94
+
95
+ ## 影响它的设置
96
+
97
+ | 设置 | 团队 `teamai.yaml` | 成员配置 | 环境变量 | 作用 |
98
+ |---|---|---|---|---|
99
+ | AI 工具 | | `workflows.tools.default`,其次是 `ai.tool` | `TEAMAI_AI_TOOL`,优先于两者 | 选出起草每份草稿的工具 |
100
+ | 驱动 | `workflows.driver` | `workflows.driver` | | 选出命令在哪里启动运行。未设置表示本机 |
101
+ | 语言 | `language` | | | 命令把它作为 `language` 输入传入 |
102
+ | MR 提示 | `sharing.mrHint.enabled` | `mrHintEnabled` | `TEAMAI_MR_HINT_DISABLED=1` | 决定会话开始时是否提议这个工作流 |
103
+
104
+ 成员配置在工作区里是 `~/.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,94 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-import-from-mr
3
+ description: Turn merged MRs or PRs into team learnings - the AI tool drafts one per MR, the person accepts, edits or skips each draft, and the accepted ones are published as teamai contribute does. Use when the person wants learnings from merged MRs or PRs, such as the ones the session-start hint lists.
4
+ invoke: ask
5
+ private: true
6
+ # teamai import --from-mr starts it too; its publish step also updates the teamwiki of each repository whose evidence
7
+ # the team repo holds. mrs: the MR or PR URLs. all: accept every draft without asking. publish: false writes and pushes
8
+ # nothing, so the drafts are only this run's outputs. dir: the team repo, or with output true, the directory each draft
9
+ # is written into as learning.md (learning-<n>.md for several). discussions: read the review threads. language: the
10
+ # language the learning is written in, teamai.yaml's language.
11
+ inputs:
12
+ mrs: [string]
13
+ all: boolean
14
+ publish: boolean
15
+ dir: string
16
+ output: boolean
17
+ discussions: boolean
18
+ language: en | zh
19
+ # A caller that publishes nothing has no directory to give.
20
+ defaults:
21
+ requires: { host: true }
22
+ inputs: { dir: "" }
23
+ steps:
24
+ - id: extract
25
+ for_each: { items: inputs.mrs }
26
+ # One MR that fails leaves the others; finish names it and the command exits 1.
27
+ continue_on_failure: true
28
+ workflow:
29
+ outputs:
30
+ title: steps.draft.outputs.title
31
+ file: steps.draft.outputs.file
32
+ tags: steps.draft.outputs.tags
33
+ overlaps: steps.draft.outputs.overlaps
34
+ repo_url: steps.draft.outputs.repo_url
35
+ steps:
36
+ - id: fetch
37
+ command: teamai import fetch-mr --url "$URL" --mrs "$MRS" --threads "$THREADS"
38
+ env: { URL: "{{ item }}", MRS: "{{ inputs.mrs }}", THREADS: "{{ inputs.discussions }}" }
39
+ output: { url: string, title: string, description: string, commits: string, diff: string, threads: string, thread_count: number, author: string, date: string }
40
+ - id: ask-en
41
+ needs: [fetch]
42
+ if: inputs.language == 'en'
43
+ answer_file: draft.en.md
44
+ output: { text: string }
45
+ timeout: 600s
46
+ - id: ask-zh
47
+ needs: [fetch]
48
+ if: inputs.language == 'zh'
49
+ answer_file: draft.zh.md
50
+ output: { text: string }
51
+ timeout: 600s
52
+ - id: draft
53
+ needs: [fetch, ask-en, ask-zh]
54
+ # Only one of the two prompts ran; the other renders as nothing.
55
+ command: teamai import draft-mr --url "$URL" --title "$TITLE" --reply "$REPLY"
56
+ env: { URL: "{{ steps.fetch.outputs.url }}", TITLE: "{{ steps.fetch.outputs.title }}", REPLY: "{{ steps.ask-en.outputs.text }}{{ steps.ask-zh.outputs.text }}" }
57
+ output: { title: string, file: string, tags: [string], overlaps: [string], repo_url: string }
58
+ - id: review
59
+ needs: [extract]
60
+ if: "(steps.extract.outcome == 'success' || steps.extract.outcome == 'failed') && inputs.publish && !inputs.all"
61
+ for_each: "filter(steps.extract.results, .outcome == 'success')"
62
+ workflow:
63
+ outputs: { choice: steps.ask.choice, note: steps.ask.note }
64
+ steps:
65
+ - id: ask
66
+ choose:
67
+ message: |-
68
+ {{ item.outputs.title }} from {{ item.item }}
69
+ Tags: {{ item.outputs.tags }}
70
+ Overlapping learnings: {{ item.outputs.overlaps }}
71
+ Draft: {{ item.outputs.file }}
72
+ accept publishes it; edit publishes it with your note as its title; skip leaves it out.
73
+ options: [accept, edit, skip]
74
+ - id: publish
75
+ needs: [extract, review]
76
+ if: "(steps.extract.outcome == 'success' || steps.extract.outcome == 'failed') && inputs.publish"
77
+ command: teamai import publish-mr --extracted "$EXTRACTED" --reviewed "$REVIEWED" --target "$DIR" --drafts "$DRAFTS"
78
+ env:
79
+ EXTRACTED: "{{ steps.extract.results }}"
80
+ REVIEWED: "{{ steps.review.results }}"
81
+ DIR: "{{ inputs.dir }}"
82
+ DRAFTS: "{{ inputs.output }}"
83
+ writes: ["{{ inputs.dir }}"]
84
+ output: { published: [string] }
85
+ - id: finish
86
+ needs: [extract, publish]
87
+ if: steps.extract.outcome == 'success' || steps.extract.outcome == 'failed'
88
+ command: teamai import finish-mr --extracted "$EXTRACTED"
89
+ env: { EXTRACTED: "{{ steps.extract.results }}" }
90
+ output: { text: string, exit_code: number, learnings: [{ url: string, title: string, file: string, repo_url: string }] }
91
+ outputs:
92
+ text: steps.finish.outputs.text
93
+ exit_code: steps.finish.outputs.exit_code
94
+ learnings: steps.finish.outputs.learnings