@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,119 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-codebase-deep-enrich
3
+ description: Write the deep knowledge docs of a codebase teamai import extracted into a teamwiki - a design doc for each component, the architecture overview, and the cross-component scenarios - beside its evidence. teamai codebase --deep-enrich starts it.
4
+ invoke: deny
5
+ private: true
6
+ # wiki_root is the teamwiki directory, project the codebase under evidence/code/; max_modules 0 takes every component.
7
+ # publish commits and pushes the docs to the team repo that holds wiki_root, for a caller that does not publish them.
8
+ inputs: { wiki_root: string, project: string, max_modules: number, concurrency: number, publish: boolean }
9
+ defaults:
10
+ requires: { host: true }
11
+ inputs: { publish: false }
12
+ ends: { unconfigured-tool: failed }
13
+ steps:
14
+ - id: plan
15
+ command: teamai codebase deep-enrich-plan --wiki-root "$WIKI_ROOT" --codebase "$PROJECT" --max-modules "$MAX_MODULES"
16
+ env: { WIKI_ROOT: "{{ inputs.wiki_root }}", PROJECT: "{{ inputs.project }}", MAX_MODULES: "{{ inputs.max_modules }}" }
17
+ # The teamwiki may be in this checkout: under .teamai/ in self mode, or an --output directory.
18
+ writes: ["{{ inputs.wiki_root }}"]
19
+ output:
20
+ components: [{ slug: string, responsibilities: string, facts: string, call_chains: string, deps: string }]
21
+ architecture: { needed: boolean, modules: string, edges: string, interfaces: string }
22
+ - id: components
23
+ needs: [plan]
24
+ for_each: { items: steps.plan.outputs.components, max_parallel: "{{ inputs.concurrency }}" }
25
+ # A component the tool could not write a doc for is named and left for the next run; the others go on.
26
+ continue_on_failure: true
27
+ workflow:
28
+ outputs: { failure: steps.ask.failure.code }
29
+ steps:
30
+ - id: ask
31
+ answer_file: component.md
32
+ output: { text: string }
33
+ timeout: 600s
34
+ # A worktree of its own lets the components' answers run beside each other.
35
+ workspace: new
36
+ continue_on_failure: true
37
+ - id: write
38
+ needs: [ask]
39
+ if: steps.ask.failure.code != 'tool_unconfigured'
40
+ command: teamai codebase deep-enrich-write --wiki-root "$WIKI_ROOT" --codebase "$PROJECT" --component "$SLUG" --text "$TEXT" --failure "$WHY"
41
+ env:
42
+ WIKI_ROOT: "{{ inputs.wiki_root }}"
43
+ PROJECT: "{{ inputs.project }}"
44
+ SLUG: "{{ item.slug }}"
45
+ TEXT: "{{ steps.ask.outputs.text }}"
46
+ WHY: "{{ steps.ask.failure.message }}"
47
+ writes: ["{{ inputs.wiki_root }}"]
48
+ - id: components-tool
49
+ needs: [components]
50
+ # A tool the member names that cannot run fails the run, rather than skipping every doc.
51
+ if: any(steps.components.results, .outputs.failure == 'tool_unconfigured')
52
+ end: unconfigured-tool
53
+ - id: architecture
54
+ needs: [plan, components]
55
+ if: steps.plan.outputs.architecture.needed && (steps.components.outcome == 'success' || steps.components.outcome == 'failed')
56
+ answer_file: architecture.md
57
+ output: { text: string }
58
+ timeout: 600s
59
+ # In an item of teamai-import-from-repo, a worktree of its own lets it run beside the other items' answers.
60
+ workspace: new
61
+ continue_on_failure: true
62
+ - id: architecture-tool
63
+ needs: [architecture]
64
+ if: steps.architecture.failure.code == 'tool_unconfigured'
65
+ end: unconfigured-tool
66
+ - id: architecture-write
67
+ needs: [architecture]
68
+ if: steps.architecture.outcome == 'success' || (steps.architecture.outcome == 'failed' && steps.architecture.failure.code != 'tool_unconfigured')
69
+ command: teamai codebase deep-enrich-write --wiki-root "$WIKI_ROOT" --codebase "$PROJECT" --architecture --text "$TEXT" --failure "$WHY"
70
+ env:
71
+ WIKI_ROOT: "{{ inputs.wiki_root }}"
72
+ PROJECT: "{{ inputs.project }}"
73
+ TEXT: "{{ steps.architecture.outputs.text }}"
74
+ WHY: "{{ steps.architecture.failure.message }}"
75
+ writes: ["{{ inputs.wiki_root }}"]
76
+ - id: graph
77
+ needs: [components, architecture-write]
78
+ if: steps.components.outcome == 'success' || steps.components.outcome == 'failed'
79
+ command: teamai codebase deep-enrich-graph --wiki-root "$WIKI_ROOT" --codebase "$PROJECT" --max-modules "$MAX_MODULES"
80
+ env: { WIKI_ROOT: "{{ inputs.wiki_root }}", PROJECT: "{{ inputs.project }}", MAX_MODULES: "{{ inputs.max_modules }}" }
81
+ writes: ["{{ inputs.wiki_root }}"]
82
+ output: { scenarios: { needed: boolean, architecture: string, call_chains: string, modules: string } }
83
+ - id: scenarios
84
+ needs: [graph]
85
+ if: steps.graph.outputs.scenarios.needed
86
+ answer_file: scenarios.md
87
+ output: { text: string }
88
+ timeout: 600s
89
+ # In an item of teamai-import-from-repo, a worktree of its own lets it run beside the other items' answers.
90
+ workspace: new
91
+ continue_on_failure: true
92
+ - id: scenarios-tool
93
+ needs: [scenarios]
94
+ if: steps.scenarios.failure.code == 'tool_unconfigured'
95
+ end: unconfigured-tool
96
+ - id: finish
97
+ needs: [graph, scenarios]
98
+ if: steps.graph.outcome == 'success' && steps.scenarios.failure.code != 'tool_unconfigured'
99
+ command: teamai codebase deep-enrich-finish --wiki-root "$WIKI_ROOT" --codebase "$PROJECT" --max-modules "$MAX_MODULES" --scenarios "$TEXT" --scenarios-failure "$WHY"
100
+ env:
101
+ WIKI_ROOT: "{{ inputs.wiki_root }}"
102
+ PROJECT: "{{ inputs.project }}"
103
+ MAX_MODULES: "{{ inputs.max_modules }}"
104
+ TEXT: "{{ steps.scenarios.outputs.text }}"
105
+ WHY: "{{ steps.scenarios.failure.message }}"
106
+ writes: ["{{ inputs.wiki_root }}"]
107
+ output: { text: string, exit_code: number, complete: boolean, missing_components: [string], missing_architecture: boolean }
108
+ - id: publish
109
+ needs: [finish]
110
+ if: inputs.publish && steps.finish.outcome == 'success'
111
+ command: teamai codebase deep-enrich-publish --wiki-root "$WIKI_ROOT" --codebase "$PROJECT"
112
+ env: { WIKI_ROOT: "{{ inputs.wiki_root }}", PROJECT: "{{ inputs.project }}" }
113
+ writes: ["{{ inputs.wiki_root }}"]
114
+ outputs:
115
+ text: steps.finish.outputs.text
116
+ exit_code: steps.finish.outputs.exit_code
117
+ complete: steps.finish.outputs.complete
118
+ missing_components: steps.finish.outputs.missing_components
119
+ missing_architecture: steps.finish.outputs.missing_architecture
@@ -0,0 +1,30 @@
1
+ <context>
2
+ 项目: {{ inputs.project }}
3
+ 模块清单:
4
+ {{ steps.plan.outputs.architecture.modules }}
5
+
6
+ 模块间依赖:
7
+ {{ steps.plan.outputs.architecture.edges }}
8
+
9
+ 接口统计:
10
+ {{ steps.plan.outputs.architecture.interfaces }}
11
+ </context>
12
+
13
+ 为上述项目生成一份技术架构总览文档。必须包含:
14
+
15
+ ## 项目概述
16
+ (一段话描述项目的核心定位和能力)
17
+
18
+ ## 架构图
19
+ (ASCII 分层架构图,标注各模块和调用方向)
20
+
21
+ ## 组件关系矩阵
22
+ (表格:组件A→组件B + 关系类型 + 通信方式)
23
+
24
+ ## 核心链路
25
+ (2-3条最重要的请求处理链路,从入口到存储的完整路径)
26
+
27
+ ## 技术栈
28
+ (表格:维度/技术/说明)
29
+
30
+ 直接输出 Markdown,不要任何前言或解释。
@@ -0,0 +1,30 @@
1
+ <context>
2
+ 项目: {{ inputs.project }}
3
+ 模块: {{ item.slug }}
4
+ 职责: {{ item.responsibilities }}
5
+
6
+ 核心组件(来自代码提取):
7
+ {{ item.facts }}
8
+
9
+ 调用链:
10
+ {{ item.call_chains }}
11
+
12
+ 模块依赖:
13
+ {{ item.deps }}
14
+ </context>
15
+
16
+ 为上述代码模块生成一份组件设计文档。必须包含以下章节:
17
+
18
+ ## 🤖 AI 快速理解要点
19
+ (表格:核心职责/架构层级/上游组件/下游组件/代码入口/核心机制/数据流向/技术栈,每项不超过20字)
20
+
21
+ ## 架构设计
22
+ (ASCII 架构图 + 核心子模块说明)
23
+
24
+ ## 接口设计
25
+ (对外接口表:接口名/方法/路径/说明)
26
+
27
+ ## 核心流程
28
+ (主要请求处理流程,步骤式描述)
29
+
30
+ 直接输出 Markdown,不要任何前言或解释。
@@ -0,0 +1 @@
1
+ concurrency: 5
@@ -0,0 +1,32 @@
1
+ 你是一个高级架构师。基于以下项目信息,为 Top-5 核心业务场景生成 mermaid sequenceDiagram。
2
+
3
+ 项目:{{ inputs.project }}
4
+
5
+ 架构文档摘要(前2000字):
6
+ {{ steps.graph.outputs.scenarios.architecture }}
7
+
8
+ 调用链数据:
9
+ {{ steps.graph.outputs.scenarios.call_chains }}
10
+
11
+ 模块列表:
12
+ {{ steps.graph.outputs.scenarios.modules }}
13
+
14
+ 要求:
15
+ 1. 识别项目中真实存在的核心业务场景(最多 5 个,如果项目较小则按实际数量输出,不要虚构)
16
+ 2. 每个场景生成一个 mermaid sequenceDiagram
17
+ 3. 每个图后附 2-3 句文字说明关键决策点
18
+ 4. 参与者使用实际模块名/组件名
19
+ 5. 如果可识别的真实场景少于 3 个,只输出实际存在的场景
20
+
21
+ 输出格式:
22
+ # 核心业务场景序列图
23
+ <!-- search-anchor: 流程, 场景, 序列图, sequence, 业务流, 完整流程 -->
24
+
25
+ ## 场景 1: <名称>
26
+ ```mermaid
27
+ sequenceDiagram
28
+ ...
29
+ ```
30
+ <说明>
31
+
32
+ ## 场景 2: ...
@@ -0,0 +1,98 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-codebase-enrich
3
+ description: Ask the AI tool what each module of a freshly extracted codebase does and which business domain the codebase belongs to, and write _manifest.json and _domains.json beside its evidence.
4
+ invoke: deny
5
+ private: true
6
+ # wiki_root is the teamwiki the codebase was just extracted into, whose .indices/ caches hold its facts; project is its directory under evidence/code/.
7
+ inputs: { wiki_root: string, project: string }
8
+ ends: { unconfigured-tool: failed }
9
+ defaults:
10
+ requires: { host: true }
11
+ steps:
12
+ - id: plan
13
+ command: teamai codebase enrich-plan --wiki-root "$WIKI_ROOT" --codebase "$PROJECT"
14
+ env: { WIKI_ROOT: "{{ inputs.wiki_root }}", PROJECT: "{{ inputs.project }}" }
15
+ output:
16
+ modules: [{ name: string, files: string, components: string, interfaces: string }]
17
+ interfaces: string
18
+ - id: modules
19
+ needs: [plan]
20
+ for_each: { items: steps.plan.outputs.modules, max_parallel: 3 }
21
+ # A module the tool could not answer about keeps the manifest the extract wrote; the summary says so.
22
+ continue_on_failure: true
23
+ workflow:
24
+ outputs: { text: steps.ask.outputs.text, failure: steps.ask.failure.code }
25
+ steps:
26
+ - id: ask
27
+ answer: |-
28
+ <context>
29
+ 模块名: {{ item.name }}
30
+ 文件列表: {{ item.files }}
31
+ 组件 (top 10): {{ item.components }}
32
+ 接口: {{ item.interfaces }}
33
+ </context>
34
+
35
+ 分析上述代码模块,输出严格 JSON,不要任何解释文字:
36
+ {"domain": "业务域名称(如计费/调度/存储/网关/测试)", "responsibilities": ["职责1", "职责2", "职责3"], "layer": "entry|orchestration|service|data", "summary": "一句话描述该模块的核心功能"}
37
+ output: { text: string }
38
+ timeout: 600s
39
+ # A worktree of its own lets the modules' answers run beside each other.
40
+ workspace: new
41
+ continue_on_failure: true
42
+ - id: modules-tool
43
+ needs: [modules]
44
+ # A tool the member names that cannot run fails the run, rather than keeping the manifest the extract wrote.
45
+ if: any(steps.modules.results, .outputs.failure == 'tool_unconfigured')
46
+ end: unconfigured-tool
47
+ - id: summary
48
+ needs: [modules]
49
+ if: (steps.modules.outcome == 'success' || steps.modules.outcome == 'failed') && !any(steps.modules.results, .outputs.failure == 'tool_unconfigured')
50
+ command: teamai codebase enrich-summary --codebase "$PROJECT" --results "$RESULTS"
51
+ env: { PROJECT: "{{ inputs.project }}", RESULTS: "{{ steps.modules.results }}" }
52
+ output: { count: number, project: string, modules: string }
53
+ - id: domain
54
+ needs: [plan, summary]
55
+ if: steps.summary.outputs.count > 0
56
+ answer: |-
57
+ <context>
58
+ 项目名: {{ steps.summary.outputs.project }}
59
+ 模块分析:
60
+ {{ steps.summary.outputs.modules }}
61
+
62
+ 接口清单: {{ steps.plan.outputs.interfaces }}
63
+ </context>
64
+
65
+ 这是一个代码仓库的分析结果。请判断该仓库整体属于哪个业务域,并给出:
66
+ 1. domain: 该仓库的核心业务域名称(如 API网关/计费引擎/流程编排/推理服务/配置管理/部署工具/测试框架/数据管理/网关代理 等)
67
+ 2. description: 一句话描述该仓库的核心职责(不超过30字)
68
+ 3. keywords: 5-10个路由关键词(用于AI检索时路由到该仓库)
69
+
70
+ 输出严格 JSON,不要任何解释文字:
71
+ {"domain": "域名", "description": "一句话描述", "keywords": ["关键词1", "关键词2"]}
72
+ output: { text: string }
73
+ timeout: 600s
74
+ # In an item of teamai-import-from-repo, a worktree of its own lets it run beside the other items' answers.
75
+ workspace: new
76
+ # The manifest is written without a domain when the tool could not name one.
77
+ continue_on_failure: true
78
+ - id: domain-tool
79
+ needs: [domain]
80
+ if: steps.domain.failure.code == 'tool_unconfigured'
81
+ end: unconfigured-tool
82
+ - id: write
83
+ needs: [modules, summary, domain]
84
+ # With no module answered it writes nothing and says modules 0, so the run always has its outputs.
85
+ if: steps.summary.outcome == 'success' && steps.domain.failure.code != 'tool_unconfigured'
86
+ command: teamai codebase enrich-write --wiki-root "$WIKI_ROOT" --codebase "$PROJECT" --results "$RESULTS" --domain "$TEXT" --domain-failure "$WHY"
87
+ env:
88
+ WIKI_ROOT: "{{ inputs.wiki_root }}"
89
+ PROJECT: "{{ inputs.project }}"
90
+ RESULTS: "{{ steps.modules.results }}"
91
+ TEXT: "{{ steps.domain.outputs.text }}"
92
+ WHY: "{{ steps.domain.failure.message }}"
93
+ # The teamwiki may be in this checkout: under .teamai/ in self mode, or an --output directory.
94
+ writes: ["{{ inputs.wiki_root }}"]
95
+ output: { modules: number, domain: string }
96
+ outputs:
97
+ modules: steps.write.outputs.modules
98
+ domain: steps.write.outputs.domain
@@ -0,0 +1,116 @@
1
+ # teamai-draft-learning-updates
2
+
3
+ English | [中文](README.zh-CN.md)
4
+
5
+ Drafts an update of each doc, rule and skill the team recalls often but rarely adopts. The AI tool rewrites the entry with the learnings members adopted instead, and teamai writes the draft beside it as `<entry>.draft.md` for a person to review.
6
+
7
+ | Started by | |
8
+ |---|---|
9
+ | `teamai recall maintenance --update-quality` | `--dry-run` lists the entries and starts no run |
10
+ | An agent session | Never by name: `invoke: deny`. The command runs it from an agent session too |
11
+
12
+ ## Which entries it drafts
13
+
14
+ ```mermaid
15
+ flowchart TD
16
+ entry([A doc, rule or skill]) --> recalled{Recalled at least min_recalled times?}
17
+ recalled -- no --> out([Not drafted])
18
+ recalled -- yes --> upvoted{Upvoted at most max_upvoted times?}
19
+ upvoted -- no --> out
20
+ upvoted -- yes --> users{Recalled by at least min_users members?}
21
+ users -- no --> out
22
+ users -- yes --> stale([Drafted])
23
+ classDef good fill:#2f8f4f,stroke:#1f6b39,color:#fff;
24
+ classDef skip fill:#6b6b6b,stroke:#4a4a4a,color:#fff;
25
+ class stale good;
26
+ class out skip;
27
+ ```
28
+
29
+ The counts add every member's votes. `--update-quality --dry-run`, the `stale` step and the dashboard's maintenance view list the same entries, from the same `params.yaml`.
30
+
31
+ ## How teamai's version runs
32
+
33
+ ```mermaid
34
+ flowchart TD
35
+ stale[List the entries to draft] --> each
36
+ subgraph each [For each entry. One that fails leaves the others]
37
+ context["Read the entry, and up to max_related learnings members adopted on its topic"] --> ask["Ask the AI tool to rewrite the entry"]
38
+ ask --> write["Write it beside the entry as entry.draft.md"]
39
+ end
40
+ each --> report(["Say each entry it could not draft: text, exit_code"])
41
+ classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
42
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
43
+ class ask prompt;
44
+ class report out;
45
+ ```
46
+
47
+ Purple marks a prompt the AI tool answers. `WORKFLOW.yaml` holds the steps.
48
+
49
+ ## Files
50
+
51
+ | File | What it is |
52
+ |---|---|
53
+ | `WORKFLOW.yaml` | The steps, and the `output:` each step declares |
54
+ | `params.yaml` | Which entries it drafts, and how many adopted learnings each prompt shows |
55
+
56
+ ## Inputs
57
+
58
+ | Input | Type | Meaning |
59
+ |---|---|---|
60
+ | `knowledge_root` | `string` | The checkout holding the entries, the team repo or a project's `.teamai/`. The drafts are written in it |
61
+
62
+ ## Outputs
63
+
64
+ | Output | Meaning |
65
+ |---|---|
66
+ | `text` | Each entry it could not draft, and what to do with the drafts |
67
+ | `exit_code` | `1` when an entry could not be drafted. The other entries still get theirs |
68
+
69
+ ## Parameters
70
+
71
+ | Key | Range | What it sets |
72
+ |---|---|---|
73
+ | `min_recalled` | 1-1000 | The recalls an entry needs, from every member together |
74
+ | `max_upvoted` | 0-1000 | The most upvotes it may have, from every member together |
75
+ | `min_users` | 1-1000 | The members who must have recalled it |
76
+ | `max_related` | 0-20 | How many adopted learnings the prompt shows. `0` shows none |
77
+
78
+ ## Replace it
79
+
80
+ Put only the files you change in `workflows/teamai-draft-learning-updates/` at the root of the team repo. Every other file, `WORKFLOW.yaml` included, stays teamai's and keeps getting teamai's updates. A small team that wants an entry one member keeps recalling drafted too:
81
+
82
+ ```yaml
83
+ # workflows/teamai-draft-learning-updates/params.yaml
84
+ min_users: 1 # the other keys keep teamai's values
85
+ ```
86
+
87
+ Push the folder. After the next `teamai pull`, the listing, the steps and the dashboard all use it. A key you leave out of `params.yaml` keeps teamai's value from its `params.yaml`.
88
+
89
+ A `WORKFLOW.yaml` of your own in the folder replaces the steps, and `params.yaml` still decides which entries the `stale` step lists. A `workflows/teamai-draft-learning-updates.yaml` file replaces the folder whole, so teamai's parameters apply.
90
+
91
+ | Keep | Why |
92
+ |---|---|
93
+ | The inputs and outputs above | `teamai recall maintenance --update-quality` passes that input and reads those outputs |
94
+
95
+ ## What pull refuses
96
+
97
+ | A team folder that | Pull |
98
+ |---|---|
99
+ | Sets a value out of range, 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 |
100
+
101
+ `teamai review --branch` fails such a folder before you merge it.
102
+
103
+ ## Requires
104
+
105
+ | Needs | Without it |
106
+ |---|---|
107
+ | An AI tool | The entry is not drafted, and the others go on. The command exits 1 |
108
+
109
+ ## Settings that change it
110
+
111
+ | Setting | Team `teamai.yaml` | Member config | Environment | Effect |
112
+ |---|---|---|---|---|
113
+ | AI tool | | `workflows.tools.default`, then `ai.tool` | `TEAMAI_AI_TOOL`, before both | Picks the tool that rewrites the entries |
114
+ | Driver | `workflows.driver` | `workflows.driver` | | Picks where the command starts the run. Unset means this machine |
115
+
116
+ 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,116 @@
1
+ # teamai-draft-learning-updates
2
+
3
+ [English](README.md) | 中文
4
+
5
+ 为团队经常召回却很少采用的每个 doc、rule 和 skill 起草更新。AI 工具参考成员实际采用的经验改写条目,teamai 把草稿写在条目旁边,命名为 `<entry>.draft.md`,供成员审阅。
6
+
7
+ | 启动方式 | |
8
+ |---|---|
9
+ | `teamai recall maintenance --update-quality` | `--dry-run` 只列出条目,不启动运行 |
10
+ | agent 会话 | 从不按名称启动:`invoke: deny`。该命令在 agent 会话中也能运行它 |
11
+
12
+ ## 哪些条目会被起草
13
+
14
+ ```mermaid
15
+ flowchart TD
16
+ entry(["一个 doc、rule 或 skill"]) --> recalled{"召回次数达到 min_recalled?"}
17
+ recalled -- 否 --> out(["不起草"])
18
+ recalled -- 是 --> upvoted{"赞同数不超过 max_upvoted?"}
19
+ upvoted -- 否 --> out
20
+ upvoted -- 是 --> users{"召回过它的成员数达到 min_users?"}
21
+ users -- 否 --> out
22
+ users -- 是 --> stale(["起草"])
23
+ classDef good fill:#2f8f4f,stroke:#1f6b39,color:#fff;
24
+ classDef skip fill:#6b6b6b,stroke:#4a4a4a,color:#fff;
25
+ class stale good;
26
+ class out skip;
27
+ ```
28
+
29
+ 计数把所有成员的投票加在一起。`--update-quality --dry-run`、`stale` 步骤和 dashboard 的维护视图列出的是同一批条目,读的都是同一个 `params.yaml`。
30
+
31
+ ## teamai 的版本如何运行
32
+
33
+ ```mermaid
34
+ flowchart TD
35
+ stale["列出要起草的条目"] --> each
36
+ subgraph each ["逐个条目处理。一个失败不影响其他条目"]
37
+ context["读取条目,以及成员在同一主题上采用过的最多 max_related 条经验"] --> ask["请 AI 工具改写条目"]
38
+ ask --> write["写在条目旁边,命名为 entry.draft.md"]
39
+ end
40
+ each --> report(["说明哪些条目没能起草:text、exit_code"])
41
+ classDef prompt fill:#6a4f8f,stroke:#513b6d,color:#fff;
42
+ classDef out fill:#2f8f4f,stroke:#1f6b39,color:#fff;
43
+ class ask prompt;
44
+ class report out;
45
+ ```
46
+
47
+ 紫色表示由 AI 工具回答的提示词。`WORKFLOW.yaml` 保存这些步骤。
48
+
49
+ ## 文件
50
+
51
+ | 文件 | 是什么 |
52
+ |---|---|
53
+ | `WORKFLOW.yaml` | 步骤,以及每个步骤声明的 `output:` |
54
+ | `params.yaml` | 起草哪些条目,以及每个提示词展示多少条已采用的经验 |
55
+
56
+ ## 输入
57
+
58
+ | 输入 | 类型 | 含义 |
59
+ |---|---|---|
60
+ | `knowledge_root` | `string` | 存放这些条目的 checkout,即团队仓库或项目的 `.teamai/`。草稿写在其中 |
61
+
62
+ ## 输出
63
+
64
+ | 输出 | 含义 |
65
+ |---|---|
66
+ | `text` | 没能起草的每个条目,以及如何处理草稿 |
67
+ | `exit_code` | 有条目没能起草时为 `1`。其他条目仍会得到草稿 |
68
+
69
+ ## 参数
70
+
71
+ | 键 | 范围 | 设置什么 |
72
+ |---|---|---|
73
+ | `min_recalled` | 1-1000 | 所有成员加起来至少要召回多少次 |
74
+ | `max_upvoted` | 0-1000 | 所有成员加起来最多能有多少个赞同 |
75
+ | `min_users` | 1-1000 | 至少要多少位成员召回过它 |
76
+ | `max_related` | 0-20 | 提示词展示多少条已采用的经验。`0` 表示不展示 |
77
+
78
+ ## 替换它
79
+
80
+ 在团队仓库根目录的 `workflows/teamai-draft-learning-updates/` 里只放你要改的文件。其他文件(包括 `WORKFLOW.yaml`)仍用 teamai 的,并继续获得 teamai 的更新。小团队希望某位成员反复召回的条目也被起草:
81
+
82
+ ```yaml
83
+ # workflows/teamai-draft-learning-updates/params.yaml
84
+ min_users: 1 # the other keys keep teamai's values
85
+ ```
86
+
87
+ 推送这个文件夹。下一次 `teamai pull` 之后,列表、步骤和 dashboard 都用它。`params.yaml` 里没写的键,沿用 teamai 的 `params.yaml` 里的值。
88
+
89
+ 文件夹里放你自己的 `WORKFLOW.yaml` 会替换步骤,`params.yaml` 仍决定 `stale` 步骤列出哪些条目。`workflows/teamai-draft-learning-updates.yaml` 单个文件会整体替换这个文件夹,此时用 teamai 的参数。
90
+
91
+ | 保留 | 原因 |
92
+ |---|---|
93
+ | 上面的输入和输出 | `teamai recall maintenance --update-quality` 会传这个输入、读这些输出 |
94
+
95
+ ## pull 拒绝什么
96
+
97
+ | 团队文件夹 | pull 的处理 |
98
+ |---|---|
99
+ | 设置了超出范围的值,或上表没有列出的键 | 指出文件和字段。pull 上一次接受的版本继续生效,还没接受过时用 teamai 的 |
100
+
101
+ `teamai review --branch` 会在合并前让这样的文件夹不通过。
102
+
103
+ ## 依赖
104
+
105
+ | 需要 | 没有时 |
106
+ |---|---|
107
+ | AI 工具 | 该条目不会被起草,其他条目继续。命令以 1 退出 |
108
+
109
+ ## 影响它的设置
110
+
111
+ | 设置 | 团队 `teamai.yaml` | 成员配置 | 环境变量 | 作用 |
112
+ |---|---|---|---|---|
113
+ | AI 工具 | | `workflows.tools.default`,其次是 `ai.tool` | `TEAMAI_AI_TOOL`,优先于两者 | 选出改写条目的工具 |
114
+ | 驱动 | `workflows.driver` | `workflows.driver` | | 选出命令在哪里启动运行。未设置表示本机 |
115
+
116
+ 成员配置在工作区里是 `~/.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,61 @@
1
+ schemaVersion: v1alpha1
2
+ name: teamai-draft-learning-updates
3
+ description: Draft an update of each doc, rule and skill the team recalls often but rarely adopts, written beside it as <entry>.draft.md for a person to review. teamai recall maintenance --update-quality starts it.
4
+ invoke: deny
5
+ private: true
6
+ # knowledge_root is the checkout holding the entries, the team repo or a project's .teamai/; the drafts land under it.
7
+ inputs: { knowledge_root: string }
8
+ defaults:
9
+ requires: { host: true }
10
+ steps:
11
+ - id: stale
12
+ command: teamai recall maintenance stale
13
+ output:
14
+ entries: [{ doc_id: string, path: string, type: string, recalled_count: number, upvoted_count: number, user_count: number }]
15
+ - id: draft
16
+ needs: [stale]
17
+ for_each: steps.stale.outputs.entries
18
+ # One entry that cannot be drafted leaves the others; report names it, and the command exits 1.
19
+ continue_on_failure: true
20
+ workflow:
21
+ steps:
22
+ - id: context
23
+ command: teamai recall maintenance draft-context --path "$ENTRY" --doc-id "$DOC_ID"
24
+ env: { ENTRY: "{{ item.path }}", DOC_ID: "{{ item.doc_id }}" }
25
+ output: { content: string, related: string }
26
+ - id: ask
27
+ needs: [context]
28
+ answer: |-
29
+ You are a technical writer updating a team knowledge base entry.
30
+
31
+ The following {{ item.type }} entry has been recalled {{ item.recalled_count }} times by {{ item.user_count }} team members but was adopted only {{ item.upvoted_count }} time(s). This indicates the content is relevant to common queries but not actionable enough to be directly useful.
32
+
33
+ Current content:
34
+ ---
35
+ {{ steps.context.outputs.content }}
36
+ ---
37
+ {{ steps.context.outputs.related }}
38
+
39
+ Please rewrite this entry to be more actionable and directly useful. Keep the same topic but:
40
+ 1. Add concrete examples or commands where applicable
41
+ 2. Remove outdated or vague information
42
+ 3. Incorporate relevant insights from the adopted learnings above
43
+ 4. Keep the same YAML frontmatter format (update the date field to today)
44
+ 5. Be concise — aim for the same or shorter length
45
+
46
+ Output ONLY the updated markdown file content (including frontmatter).
47
+ output: { text: string }
48
+ timeout: 600s
49
+ - id: write
50
+ needs: [ask]
51
+ command: teamai recall maintenance write-draft --path "$ENTRY" --draft "$DRAFT"
52
+ env: { ENTRY: "{{ item.path }}", DRAFT: "{{ steps.ask.outputs.text }}" }
53
+ writes: ["{{ inputs.knowledge_root }}"]
54
+ output: { draft: string }
55
+ - id: report
56
+ needs: [draft]
57
+ if: steps.draft.outcome == 'success' || steps.draft.outcome == 'failed'
58
+ command: teamai recall maintenance draft-report --results "$RESULTS"
59
+ env: { RESULTS: "{{ steps.draft.results }}" }
60
+ output: { text: string, exit_code: number }
61
+ outputs: { text: steps.report.outputs.text, exit_code: steps.report.outputs.exit_code }
@@ -0,0 +1,4 @@
1
+ min_recalled: 5
2
+ max_upvoted: 1
3
+ min_users: 2
4
+ max_related: 5