@fitlab-ai/agent-infra 0.9.3 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/README.md +3 -1
  2. package/README.zh-CN.md +3 -1
  3. package/bin/cli.ts +12 -0
  4. package/dist/bin/cli.js +14 -0
  5. package/dist/bin/internal-cli.js +144 -123
  6. package/dist/lib/agent-clients/adapter.js +94 -4
  7. package/dist/lib/{sandbox/credentials.js → agent-clients/adapters/claude-code-credentials.js} +4 -14
  8. package/dist/lib/agent-clients/adapters/claude-code-refresh.js +85 -0
  9. package/dist/lib/agent-clients/adapters/claude-code-sandbox.js +247 -0
  10. package/dist/lib/agent-clients/adapters/claude-code.js +17 -3
  11. package/dist/lib/agent-clients/adapters/codex-lifecycle/app-server.js +382 -0
  12. package/dist/lib/agent-clients/adapters/codex-lifecycle/evidence.js +163 -0
  13. package/dist/lib/agent-clients/adapters/codex-lifecycle/store.js +211 -0
  14. package/dist/lib/agent-clients/adapters/codex.js +2 -2
  15. package/dist/lib/agent-clients/adapters/opencode-sandbox.js +108 -0
  16. package/dist/lib/agent-clients/adapters/opencode.js +15 -3
  17. package/dist/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
  18. package/dist/lib/agent-clients/registry.js +9 -1
  19. package/dist/lib/git/worktree-identity.js +64 -0
  20. package/dist/lib/internal/codex-lifecycle.js +202 -0
  21. package/dist/lib/internal/sandbox-control.js +24 -0
  22. package/dist/lib/internal/task-activity.js +45 -13
  23. package/dist/lib/internal/task-create.js +48 -0
  24. package/dist/lib/internal/task-ledger.js +12 -3
  25. package/dist/lib/internal/task-lifecycle.js +19 -1
  26. package/dist/lib/internal/task-orchestration.js +170 -27
  27. package/dist/lib/platform/github-client.js +19 -2
  28. package/dist/lib/platform/pr-checks.js +1 -1
  29. package/dist/lib/platform/pull-requests.js +47 -1
  30. package/dist/lib/platform/releases.js +13 -5
  31. package/dist/lib/process-data/index.js +239 -0
  32. package/dist/lib/process-data/normalize.js +198 -0
  33. package/dist/lib/process-data/privacy.js +33 -0
  34. package/dist/lib/process-data/reconcile.js +95 -0
  35. package/dist/lib/process-data/repair.js +58 -0
  36. package/dist/lib/process-data/sources.js +345 -0
  37. package/dist/lib/process-data/store.js +282 -0
  38. package/dist/lib/process-data/types.js +2 -0
  39. package/dist/lib/run/index.js +4 -3
  40. package/dist/lib/run/tui.js +7 -8
  41. package/dist/lib/sandbox/agent-client-reconciler.js +26 -2
  42. package/dist/lib/sandbox/capture.js +7 -2
  43. package/dist/lib/sandbox/commands/create.js +110 -228
  44. package/dist/lib/sandbox/commands/enter.js +15 -47
  45. package/dist/lib/sandbox/commands/list-running.js +16 -6
  46. package/dist/lib/sandbox/commands/ls.js +10 -6
  47. package/dist/lib/sandbox/commands/rebuild.js +4 -3
  48. package/dist/lib/sandbox/commands/refresh.js +4 -84
  49. package/dist/lib/sandbox/commands/rm.js +24 -3
  50. package/dist/lib/sandbox/commands/show.js +12 -3
  51. package/dist/lib/sandbox/commands/start.js +7 -4
  52. package/dist/lib/sandbox/config.js +2 -0
  53. package/dist/lib/sandbox/constants.js +6 -0
  54. package/dist/lib/sandbox/control/client.js +58 -0
  55. package/dist/lib/sandbox/control/protocol.js +54 -0
  56. package/dist/lib/sandbox/control/server.js +144 -0
  57. package/dist/lib/sandbox/dockerfile.js +36 -13
  58. package/dist/lib/sandbox/mounts.js +17 -4
  59. package/dist/lib/sandbox/recovery.js +128 -5
  60. package/dist/lib/sandbox/redaction.js +12 -0
  61. package/dist/lib/sandbox/runtimes/base.dockerfile +24 -74
  62. package/dist/lib/sandbox/workspace-identity.js +95 -0
  63. package/dist/lib/sandbox/workspace-view.js +109 -0
  64. package/dist/lib/task/activity-intent.js +257 -51
  65. package/dist/lib/task/activity-log.js +32 -5
  66. package/dist/lib/task/commit-finalization.js +278 -0
  67. package/dist/lib/task/commit-intent.js +165 -0
  68. package/dist/lib/task/create-service.js +137 -0
  69. package/dist/lib/task/create.js +333 -0
  70. package/dist/lib/task/decision-intents.js +31 -17
  71. package/dist/lib/task/delegation-receipts.js +2 -2
  72. package/dist/lib/task/implementation-inputs.js +54 -7
  73. package/dist/lib/task/ledger-intents.js +35 -1
  74. package/dist/lib/task/orchestration.js +505 -34
  75. package/dist/lib/task/resolve-ref.js +41 -1
  76. package/dist/lib/task/review-fingerprint.js +4 -0
  77. package/dist/lib/task/workspace-snapshot.js +78 -3
  78. package/lib/agent-clients/adapter.ts +130 -6
  79. package/lib/{sandbox/credentials.ts → agent-clients/adapters/claude-code-credentials.ts} +3 -18
  80. package/lib/agent-clients/adapters/claude-code-refresh.ts +128 -0
  81. package/lib/agent-clients/adapters/claude-code-sandbox.ts +295 -0
  82. package/lib/agent-clients/adapters/claude-code.ts +21 -3
  83. package/lib/agent-clients/adapters/codex-lifecycle/app-server.ts +442 -0
  84. package/lib/agent-clients/adapters/codex-lifecycle/evidence.ts +307 -0
  85. package/lib/agent-clients/adapters/codex-lifecycle/store.ts +250 -0
  86. package/lib/agent-clients/adapters/codex.ts +2 -2
  87. package/lib/agent-clients/adapters/opencode-sandbox.ts +136 -0
  88. package/lib/agent-clients/adapters/opencode.ts +18 -3
  89. package/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
  90. package/lib/agent-clients/registry.ts +9 -1
  91. package/lib/git/worktree-identity.ts +86 -0
  92. package/lib/internal/codex-lifecycle.ts +204 -0
  93. package/lib/internal/sandbox-control.ts +24 -0
  94. package/lib/internal/task-activity.ts +50 -14
  95. package/lib/internal/task-create.ts +49 -0
  96. package/lib/internal/task-ledger.ts +12 -3
  97. package/lib/internal/task-lifecycle.ts +22 -1
  98. package/lib/internal/task-orchestration.ts +117 -21
  99. package/lib/platform/github-client.ts +20 -2
  100. package/lib/platform/pr-checks.ts +1 -1
  101. package/lib/platform/pull-requests.ts +49 -1
  102. package/lib/platform/releases.ts +16 -4
  103. package/lib/process-data/index.ts +224 -0
  104. package/lib/process-data/normalize.ts +202 -0
  105. package/lib/process-data/privacy.ts +41 -0
  106. package/lib/process-data/reconcile.ts +110 -0
  107. package/lib/process-data/repair.ts +64 -0
  108. package/lib/process-data/sources.ts +354 -0
  109. package/lib/process-data/store.ts +315 -0
  110. package/lib/process-data/types.ts +135 -0
  111. package/lib/run/index.ts +5 -3
  112. package/lib/run/tui.ts +11 -8
  113. package/lib/sandbox/agent-client-reconciler.ts +44 -2
  114. package/lib/sandbox/capture.ts +9 -2
  115. package/lib/sandbox/commands/create.ts +127 -260
  116. package/lib/sandbox/commands/enter.ts +13 -59
  117. package/lib/sandbox/commands/list-running.ts +23 -6
  118. package/lib/sandbox/commands/ls.ts +22 -6
  119. package/lib/sandbox/commands/rebuild.ts +4 -3
  120. package/lib/sandbox/commands/refresh.ts +4 -126
  121. package/lib/sandbox/commands/rm.ts +24 -3
  122. package/lib/sandbox/commands/show.ts +29 -3
  123. package/lib/sandbox/commands/start.ts +6 -4
  124. package/lib/sandbox/config.ts +4 -0
  125. package/lib/sandbox/constants.ts +8 -0
  126. package/lib/sandbox/control/client.ts +79 -0
  127. package/lib/sandbox/control/protocol.ts +110 -0
  128. package/lib/sandbox/control/server.ts +155 -0
  129. package/lib/sandbox/dockerfile.ts +66 -13
  130. package/lib/sandbox/mounts.ts +24 -4
  131. package/lib/sandbox/recovery.ts +163 -6
  132. package/lib/sandbox/redaction.ts +14 -0
  133. package/lib/sandbox/runtimes/base.dockerfile +24 -74
  134. package/lib/sandbox/tool-types.ts +16 -0
  135. package/lib/sandbox/workspace-identity.ts +123 -0
  136. package/lib/sandbox/workspace-view.ts +150 -0
  137. package/lib/task/activity-intent.ts +350 -61
  138. package/lib/task/activity-log.ts +46 -7
  139. package/lib/task/commit-finalization.ts +376 -0
  140. package/lib/task/commit-intent.ts +230 -0
  141. package/lib/task/create-service.ts +171 -0
  142. package/lib/task/create.ts +372 -0
  143. package/lib/task/decision-intents.ts +32 -12
  144. package/lib/task/delegation-receipts.ts +2 -2
  145. package/lib/task/implementation-inputs.ts +62 -8
  146. package/lib/task/ledger-intents.ts +43 -3
  147. package/lib/task/orchestration.ts +673 -41
  148. package/lib/task/resolve-ref.ts +46 -1
  149. package/lib/task/review-fingerprint.ts +9 -0
  150. package/lib/task/workspace-snapshot.ts +98 -4
  151. package/package.json +7 -7
  152. package/templates/.agents/hooks/lifecycle-delegation.js +47 -3
  153. package/templates/.agents/rules/README.en.md +1 -1
  154. package/templates/.agents/rules/README.zh-CN.md +1 -1
  155. package/templates/.agents/rules/human-decision-context.en.md +11 -2
  156. package/templates/.agents/rules/human-decision-context.zh-CN.md +11 -2
  157. package/templates/.agents/rules/pr-checks-commands.en.md +1 -1
  158. package/templates/.agents/rules/pr-checks-commands.github.en.md +1 -1
  159. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +2 -2
  160. package/templates/.agents/rules/pr-checks-commands.zh-CN.md +1 -1
  161. package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
  162. package/templates/.agents/rules/task-management.en.md +3 -0
  163. package/templates/.agents/rules/task-management.zh-CN.md +3 -0
  164. package/templates/.agents/skills/code-task/SKILL.en.md +1 -1
  165. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +1 -1
  166. package/templates/.agents/skills/commit/SKILL.en.md +21 -17
  167. package/templates/.agents/skills/commit/SKILL.zh-CN.md +28 -16
  168. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +50 -0
  169. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +56 -0
  170. package/templates/.agents/skills/commit/reference/task-status-update.en.md +4 -4
  171. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +4 -4
  172. package/templates/.agents/skills/complete-task/SKILL.en.md +1 -1
  173. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +1 -1
  174. package/templates/.agents/skills/create-pr/SKILL.en.md +4 -4
  175. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +4 -4
  176. package/templates/.agents/skills/create-task/SKILL.en.md +26 -43
  177. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +26 -43
  178. package/templates/.agents/skills/create-task/reference/context-capture.en.md +34 -0
  179. package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +34 -0
  180. package/templates/.agents/skills/review-code/SKILL.en.md +2 -2
  181. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +2 -2
  182. package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
  183. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
  184. package/templates/.agents/skills/review-pr/SKILL.en.md +36 -8
  185. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +36 -8
  186. package/templates/.agents/skills/review-pr/reference/report-template.en.md +1 -1
  187. package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +1 -1
  188. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +67 -50
  189. package/templates/.agents/skills/watch-pr/SKILL.en.md +4 -4
  190. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +4 -4
  191. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +2 -2
  192. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +2 -2
  193. package/templates/.agents/templates/task.en.md +1 -1
  194. package/templates/.agents/templates/task.zh-CN.md +1 -1
  195. package/templates/.claude/commands/watch-pr.en.md +1 -1
  196. package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
  197. package/templates/.claude/rules/tool-preferences.en.md +20 -0
  198. package/templates/.claude/rules/tool-preferences.zh-CN.md +20 -0
  199. package/templates/.codex/hooks.json +50 -0
  200. package/templates/.opencode/commands/watch-pr.en.md +1 -1
  201. package/templates/.opencode/commands/watch-pr.zh-CN.md +1 -1
  202. package/templates/.gemini/commands/_project_/review-pr.en.toml +0 -10
  203. package/templates/.gemini/commands/_project_/review-pr.zh-CN.toml +0 -10
@@ -124,12 +124,19 @@ const AGENT_CLIENT_MANIFEST = [
124
124
  ],
125
125
  "managed": [
126
126
  ".claude/commands/",
127
- ".claude/agents/"
127
+ ".claude/agents/",
128
+ ".claude/rules/"
128
129
  ],
129
130
  "merged": [
130
131
  ".claude/settings.json"
131
132
  ],
132
- "ejected": []
133
+ "ejected": [],
134
+ "customCommand": {
135
+ "target": ".claude/commands/${skillName}.md",
136
+ "frontmatter": {},
137
+ "includeUsage": true,
138
+ "inheritDisableModelInvocation": true
139
+ }
133
140
  },
134
141
  {
135
142
  "id": "codex",
@@ -165,7 +172,15 @@ const AGENT_CLIENT_MANIFEST = [
165
172
  ".opencode/commands/"
166
173
  ],
167
174
  "merged": [],
168
- "ejected": []
175
+ "ejected": [],
176
+ "customCommand": {
177
+ "target": ".opencode/commands/${skillName}.md",
178
+ "frontmatter": {
179
+ "agent": "general",
180
+ "subtask": false
181
+ },
182
+ "argumentsToken": "$ARGUMENTS"
183
+ }
169
184
  }
170
185
  ];
171
186
  const CUSTOM_TUI_CONTRACT = {
@@ -565,15 +580,12 @@ function detectCustomSkills(projectRoot, templateSkillNames) {
565
580
  .sort((left, right) => left.dirName.localeCompare(right.dirName));
566
581
  }
567
582
 
568
- function isCustomProtected(targetPath, customSkills, customTUICommandTargets) {
583
+ function isCustomProtected(targetPath, customSkills, customCommandTargets) {
569
584
  const normalized = norm(targetPath);
570
585
 
571
586
  return customSkills.some(({ dirName }) => (
572
- normalized.startsWith(`.agents/skills/${dirName}/`) ||
573
- normalized === `.claude/commands/${dirName}.md` ||
574
- normalized === `.opencode/commands/${dirName}.md` ||
575
- customTUICommandTargets.has(normalized)
576
- ));
587
+ normalized.startsWith(`.agents/skills/${dirName}/`)
588
+ )) || customCommandTargets.has(normalized);
577
589
  }
578
590
 
579
591
  function recordCustomTUISkipped(report, entry) {
@@ -780,43 +792,37 @@ function formatYamlMetadata(key, value) {
780
792
  return [`${key}: |-`, ...value.split('\n').map((line) => ` ${line}`)];
781
793
  }
782
794
 
783
- function generateClaudeCommand(skill, lang) {
784
- const isZhCN = lang === 'zh-CN';
785
- const lines = ['---', ...formatYamlMetadata('description', skill.description)];
786
-
787
- if (skill.args) {
788
- lines.push(`usage: ${JSON.stringify(`/${skill.dirName} ${skill.args}`)}`);
789
- }
790
-
791
- if (skill.disableModelInvocation) {
792
- lines.push('disable-model-invocation: true');
793
- }
794
-
795
- lines.push('---', '');
796
- lines.push(
797
- isZhCN
798
- ? `读取并执行 \`.agents/skills/${skill.dirName}/SKILL.md\` 中的 ${skill.dirName} 技能。`
799
- : `Read and execute the ${skill.dirName} skill from \`.agents/skills/${skill.dirName}/SKILL.md\`.`
800
- );
801
- lines.push('');
802
- lines.push(isZhCN ? '严格按照技能中定义的所有步骤执行。' : 'Follow all steps defined in the skill exactly.');
803
-
804
- return `${lines.join('\n')}\n`;
795
+ function formatYamlScalarMetadata(key, value) {
796
+ if (typeof value === 'boolean') return [`${key}: ${String(value)}`];
797
+ if (/^[A-Za-z0-9_-]+$/.test(value)) return [`${key}: ${value}`];
798
+ return formatYamlMetadata(key, value);
805
799
  }
806
800
 
807
- function generateOpenCodeCommand(skill, lang) {
801
+ function generateAgentClientCommand(skill, lang, descriptor) {
808
802
  const isZhCN = lang === 'zh-CN';
809
803
  const lines = [
810
804
  '---',
811
805
  ...formatYamlMetadata('description', skill.description),
812
- 'agent: general',
813
- 'subtask: false',
814
- '---',
815
- ''
806
+ ...Object.entries(descriptor.frontmatter).flatMap(([key, value]) =>
807
+ formatYamlScalarMetadata(key, value)
808
+ )
816
809
  ];
817
810
 
818
- if (skill.args) {
819
- lines.push(isZhCN ? '参数:$ARGUMENTS' : 'Arguments: $ARGUMENTS');
811
+ if (descriptor.includeUsage && skill.args) {
812
+ lines.push(`usage: ${JSON.stringify(`${descriptor.invocation} ${skill.args}`)}`);
813
+ }
814
+ if (descriptor.inheritDisableModelInvocation && skill.disableModelInvocation) {
815
+ lines.push('disable-model-invocation: true');
816
+ }
817
+
818
+ lines.push('---', '');
819
+
820
+ if (skill.args && descriptor.argumentsToken) {
821
+ lines.push(
822
+ isZhCN
823
+ ? `参数:${descriptor.argumentsToken}`
824
+ : `Arguments: ${descriptor.argumentsToken}`
825
+ );
820
826
  lines.push('');
821
827
  }
822
828
 
@@ -1029,6 +1035,15 @@ function buildCustomTUICommandTargets(projectRoot, customSkills, customTUIs, tem
1029
1035
  return targets;
1030
1036
  }
1031
1037
 
1038
+ function buildBuiltinCustomCommandTargets(customSkills, enabledTUIs) {
1039
+ return new Set(AGENT_CLIENT_MANIFEST.flatMap((adapter) => {
1040
+ if (!enabledTUIs.has(adapter.id) || !adapter.customCommand) return [];
1041
+ return customSkills.map((skill) =>
1042
+ adapter.customCommand.target.replaceAll('${skillName}', skill.dirName)
1043
+ );
1044
+ }));
1045
+ }
1046
+
1032
1047
  function learnAndGenerateCommands(projectRoot, customSkills, tool, templateSkillNames, report) {
1033
1048
  const ref = findCustomTUIReference(projectRoot, tool, templateSkillNames, report, true);
1034
1049
  if (!ref) return;
@@ -1060,17 +1075,15 @@ function generateCustomCommands(
1060
1075
  managedWriter
1061
1076
  ) {
1062
1077
  for (const skill of customSkills) {
1063
- if (enabledTUIs.has('claude-code')) {
1064
- managedWriter(
1065
- `.claude/commands/${skill.dirName}.md`,
1066
- generateClaudeCommand(skill, lang),
1067
- report.custom.commands
1068
- );
1069
- }
1070
- if (enabledTUIs.has('opencode')) {
1078
+ for (const adapter of AGENT_CLIENT_MANIFEST) {
1079
+ if (!enabledTUIs.has(adapter.id) || !adapter.customCommand) continue;
1080
+ const descriptor = {
1081
+ ...adapter.customCommand,
1082
+ invocation: adapter.invocation.replaceAll('${skillName}', skill.dirName)
1083
+ };
1071
1084
  managedWriter(
1072
- `.opencode/commands/${skill.dirName}.md`,
1073
- generateOpenCodeCommand(skill, lang),
1085
+ adapter.customCommand.target.replaceAll('${skillName}', skill.dirName),
1086
+ generateAgentClientCommand(skill, lang, descriptor),
1074
1087
  report.custom.commands
1075
1088
  );
1076
1089
  }
@@ -1333,6 +1346,10 @@ function syncTemplates(projectRoot, templateRootOverride) {
1333
1346
  customTUIs,
1334
1347
  templateSkillNames
1335
1348
  );
1349
+ const customCommandTargets = new Set([
1350
+ ...buildBuiltinCustomCommandTargets(protectedCustomSkills, enabledTUIs),
1351
+ ...customTUICommandTargets
1352
+ ]);
1336
1353
 
1337
1354
  for (const category of ['managed', 'merged', 'ejected']) {
1338
1355
  const before = currentRegistry[category];
@@ -1545,7 +1562,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
1545
1562
  const protectedByEjection = ejected.some((pattern) =>
1546
1563
  assetMatches(pattern, target) || globMatch(pattern, target)
1547
1564
  );
1548
- const protectedByCustom = customTUICommandTargets.has(target);
1565
+ const protectedByCustom = customCommandTargets.has(target);
1549
1566
 
1550
1567
  if (protectedByEjection || protectedByCustom || (sourceRoot && sourceRoot !== templateRoot)) {
1551
1568
  report.managed.protected.push({
@@ -1674,7 +1691,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
1674
1691
  for (const projFile of projFiles) {
1675
1692
  if (expectedTargets.has(projFile)) continue;
1676
1693
  if (projFile === configPathRel) continue;
1677
- if (isCustomProtected(projFile, protectedCustomSkills, customTUICommandTargets)) continue;
1694
+ if (isCustomProtected(projFile, protectedCustomSkills, customCommandTargets)) continue;
1678
1695
  if (matchesAny(projFile, merged) || matchesAny(projFile, ejected)) continue;
1679
1696
  if (assetPlan.enabledManaged.includes(entry)) {
1680
1697
  const baseline = trustedBaseline(managedBaselines[projFile]);
@@ -1,17 +1,17 @@
1
1
  ---
2
2
  name: watch-pr
3
3
  description: >
4
- Watch PR readiness and self-heal required-check failures or merge conflicts.
4
+ Watch PR readiness and self-heal any check failure or merge conflict.
5
5
  Use when a PR must be monitored until checks pass and it is explicitly mergeable.
6
6
  ---
7
7
 
8
8
  # Watch Pull Request
9
9
 
10
- After `create-pr`, continuously watch required checks and mergeability for the same PR head. Only passed checks plus explicit mergeability may reach success; check failures use the existing repair path, conflicts use constrained rebase healing, and unknown or unsafe states fail closed.
10
+ After `create-pr`, continuously watch all checks and mergeability for the same PR head. Only all passed checks plus explicit mergeability may reach success; check failures use the existing repair path, conflicts use constrained rebase healing, and unknown or unsafe states fail closed.
11
11
 
12
12
  ## Behavior Boundaries / Key Rules
13
13
 
14
- - Only self-heal the current PR's required checks and text merge conflicts; do not add approval or repository-rule readiness dimensions.
14
+ - Only self-heal the current PR's full check set and text merge conflicts; do not add approval or repository-rule readiness dimensions.
15
15
  - Self-heal publishes through Git workflow intents, but **affected tests must pass first**; the attempt cap and code-layer authorization remain unchanged.
16
16
  - The help exit is "produce-then-stop": end this round, output the blocker explanation, and wait for the user to trigger the next step — **never** ask mid-flow.
17
17
  - Bare numbers / `NN` / `TASK-id` arguments are always resolved as task short ids (see `.agents/rules/task-short-id.md`); a PR number is passed only via `--pr <number>` / a PR URL / omission (current branch), never reusing the bare-number syntax.
@@ -104,7 +104,7 @@ Keep the gate output in your reply as the verification evidence. Without current
104
104
  > Before rendering next steps, read `.agents/rules/next-step-output.md`, invoke the shared helper only for the selected scenario, and insert its stdout at `{next-step-commands}`.
105
105
 
106
106
  Output per scenario:
107
- - `ready` + task-anchored: state that required checks passed and the current head is explicitly mergeable, then render exactly one exit based on whether this run created repair commits (`{task-ref}` becomes the short id):
107
+ - `ready` + task-anchored: state that all checks passed and the current head is explicitly mergeable, then render exactly one exit based on whether this run created repair commits (`{task-ref}` becomes the short id):
108
108
 
109
109
  `repairCommits.length == 0`:
110
110
 
@@ -1,17 +1,17 @@
1
1
  ---
2
2
  name: watch-pr
3
3
  description: >
4
- 监控 PR readiness,并在 required checks 失败或合并冲突时自愈。
4
+ 监控 PR readiness,并在任一 check 失败或合并冲突时自愈。
5
5
  当需要持续监控 PR 直到门禁通过且明确可合入时使用。
6
6
  ---
7
7
 
8
8
  # 监控 Pull Request
9
9
 
10
- 在 `create-pr` 之后持续监控同一 PR head 的 required checks 与 mergeability。只有 checks 通过且平台明确可合入才进入成功出口;check 失败走既有修复,合并冲突走受限 rebase 自愈,未知或无法安全闭环时 fail-closed。
10
+ 在 `create-pr` 之后持续监控同一 PR head 的全部 checks 与 mergeability。只有全部 checks 通过且平台明确可合入才进入成功出口;check 失败走既有修复,合并冲突走受限 rebase 自愈,未知或无法安全闭环时 fail-closed。
11
11
 
12
12
  ## 行为边界 / 关键规则
13
13
 
14
- - 仅监控 + 自愈当前 PR 的 required checks 与文本合并冲突;不扩展到审批或其他仓库规则。
14
+ - 仅监控 + 自愈当前 PR 的全部 checks 与文本合并冲突;不扩展到审批或其他仓库规则。
15
15
  - 自愈通过 Git workflow intent 发布修复,但**发布前必须本地跑通相关测试**;修复上限与代码层分类授权不变。
16
16
  - 求助出口是「产出后停止」语义:停止本轮、输出阻塞说明、等待用户主动触发,**不**中途提问。
17
17
  - 裸数字 / `NN` / `TASK-id` 入参一律按任务短号解析(见 `.agents/rules/task-short-id.md`);PR 号只走 `--pr <number>` / PR URL / 省略(当前分支),不复用裸数字语法。
@@ -104,7 +104,7 @@ agent-infra-internal task-verify {task-id} watch-pr.completed --format text
104
104
  > 渲染下一步前先读取 `.agents/rules/next-step-output.md`,仅为已选场景调用统一 helper,并将 stdout 填入 `{next-step-commands}`。
105
105
 
106
106
  按场景输出:
107
- - `ready` + 任务锚定:说明 required checks 已通过且当前 head 明确可合入,并只按本轮是否产生修复 commit 渲染一个出口(`{task-ref}` 替换为短号):
107
+ - `ready` + 任务锚定:说明全部 checks 已通过且当前 head 明确可合入,并只按本轮是否产生修复 commit 渲染一个出口(`{task-ref}` 替换为短号):
108
108
 
109
109
  `repairCommits.length == 0`:
110
110
 
@@ -6,8 +6,8 @@ Platform-agnostic decision logic for `watch-pr` steps 2/3/4. The concrete platfo
6
6
 
7
7
  After the watch command, route by structured `readiness.state`:
8
8
 
9
- - `ready`: required checks passed and the same head is explicitly mergeable → SKILL step 7.
10
- - `checks-failed`: a required check failed or was cancelled → CI healing in SKILL step 3.
9
+ - `ready`: all checks passed and the same head is explicitly mergeable → SKILL step 7.
10
+ - `checks-failed`: a check failed or was cancelled → CI healing in SKILL step 3.
11
11
  - `conflicting`: the platform explicitly reports a head/base conflict → rebase healing in SKILL step 3.
12
12
  - `pending|timed-out|cancelled`: no reliable success fact exists → SKILL step 4.
13
13
 
@@ -6,8 +6,8 @@
6
6
 
7
7
  按 `.agents/rules/pr-checks-commands.md` 的监控命令执行后,依其退出码归为三类:
8
8
 
9
- - `ready`:同一 head 的 required checks 通过且平台明确可合入 → SKILL 步骤 7。
10
- - `checks-failed`:至少一个 required check 失败或取消 → SKILL 步骤 3 的 CI 自愈。
9
+ - `ready`:同一 head 的全部 checks 通过且平台明确可合入 → SKILL 步骤 7。
10
+ - `checks-failed`:至少一个 check 失败或取消 → SKILL 步骤 3 的 CI 自愈。
11
11
  - `conflicting`:平台明确当前 head 与 base 冲突 → SKILL 步骤 3 的 rebase 自愈。
12
12
  - `pending|timed-out|cancelled`:mergeability/checks 未形成可靠成功事实 → SKILL 步骤 4。
13
13
 
@@ -80,7 +80,7 @@ pr_status: pending # PR status: pending (default) | created (PR crea
80
80
 
81
81
  ## Human Rulings
82
82
 
83
- <!-- Use ai decide <task-ref> <ordinal|ledger-id> [--needs-implementation true|false] <decision> for needs-human-decision rulings; code-stage rulings must explicitly declare whether implementation is required. -->
83
+ <!-- Use ai decide <task-ref> <ordinal|ledger-id> [--needs-implementation true|false] <decision> for needs-human-decision rulings; upstream AI predeclares implementation intent for new code decisions, while the explicit option remains for legacy tasks or consistency checks. -->
84
84
 
85
85
  ## Implementation Inputs
86
86
 
@@ -80,7 +80,7 @@ pr_status: pending # PR 状态:pending(默认)| created(已
80
80
 
81
81
  ## 人工裁决
82
82
 
83
- <!-- 使用 ai decide <task-ref> <序号|账本ID> [--needs-implementation true|false] <裁决内容> 写入 needs-human-decision 裁定;code 阶段必须显式声明是否需要实现。 -->
83
+ <!-- 使用 ai decide <task-ref> <序号|账本ID> [--needs-implementation true|false] <裁决内容> 写入 needs-human-decision 裁定;新建 code 裁决的实现意图由上游 AI 预先声明,显式参数仅用于历史任务兼容或一致性复核。 -->
84
84
 
85
85
  ## 实现输入
86
86
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Watch a PR's required checks and self-heal on failure"
2
+ description: "Watch all checks on a PR and self-heal on failure"
3
3
  usage: "/watch-pr [task-ref | --task <ref> | --pr <number>]"
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "监控 PR 的 required checks 并在失败时自愈"
2
+ description: "监控 PR 的全部 checks 并在失败时自愈"
3
3
  usage: "/watch-pr [task-ref | --task <ref> | --pr <number>]"
4
4
  ---
5
5
 
@@ -0,0 +1,20 @@
1
+ # Claude Code - Tool Preferences
2
+
3
+ ## Preferred tools
4
+
5
+ | Operation | Prefer | Avoid |
6
+ |-----------|--------|-------|
7
+ | Find files | `Glob` | `find`, `ls` |
8
+ | Search content | `Grep` | `grep`, `rg` |
9
+ | Read files | `Read` | `cat`, `head`, `tail` |
10
+ | Edit files | `Edit` | `sed`, `awk` |
11
+ | Create files | `Write` | `echo >`, `cat <<EOF` |
12
+
13
+ Use **Bash only** for Git operations, builds/tests, and system information.
14
+
15
+ ## Slash Commands
16
+
17
+ Commands are discovered automatically from `.claude/commands/`. Type `/` at the prompt to view the complete list and descriptions.
18
+
19
+ A typical task workflow is:
20
+ `/create-task` -> `/analyze-task` -> `/plan-task` -> `/code-task` -> `/review-code` -> `/complete-task`
@@ -0,0 +1,20 @@
1
+ # Claude Code - 工具偏好
2
+
3
+ ## 工具使用偏好
4
+
5
+ | 操作 | 推荐 | 不推荐 |
6
+ |------|------|--------|
7
+ | 文件搜索 | `Glob` | `find`、`ls` |
8
+ | 内容搜索 | `Grep` | `grep`、`rg` |
9
+ | 读取文件 | `Read` | `cat`、`head`、`tail` |
10
+ | 编辑文件 | `Edit` | `sed`、`awk` |
11
+ | 创建文件 | `Write` | `echo >`、`cat <<EOF` |
12
+
13
+ **Bash 仅用于**:Git 操作、构建/测试、系统信息查询
14
+
15
+ ## Slash Commands
16
+
17
+ 可用命令从 `.claude/commands/` 自动发现。在提示符中输入 `/` 查看完整列表和描述。
18
+
19
+ 任务工作流的典型顺序:
20
+ `/create-task` -> `/analyze-task` -> `/plan-task` -> `/code-task` -> `/review-code` -> `/complete-task`
@@ -11,6 +11,56 @@
11
11
  "statusMessage": "Checking template version before git commit"
12
12
  }
13
13
  ]
14
+ },
15
+ {
16
+ "matcher": "^collaborationspawn_agent$",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event pre-tool",
21
+ "timeout": 5,
22
+ "statusMessage": "Recording Codex lifecycle spawn evidence"
23
+ }
24
+ ]
25
+ }
26
+ ],
27
+ "PostToolUse": [
28
+ {
29
+ "matcher": "^collaborationspawn_agent$",
30
+ "hooks": [
31
+ {
32
+ "type": "command",
33
+ "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event post-tool",
34
+ "timeout": 5,
35
+ "statusMessage": "Recording Codex lifecycle tool completion"
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ "SubagentStart": [
41
+ {
42
+ "matcher": "^agent-infra-lifecycle-(executor|reviewer)$",
43
+ "hooks": [
44
+ {
45
+ "type": "command",
46
+ "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-start",
47
+ "timeout": 5,
48
+ "statusMessage": "Recording Codex child identity"
49
+ }
50
+ ]
51
+ }
52
+ ],
53
+ "SubagentStop": [
54
+ {
55
+ "matcher": "^agent-infra-lifecycle-(executor|reviewer)$",
56
+ "hooks": [
57
+ {
58
+ "type": "command",
59
+ "command": "node \"$(git rev-parse --show-toplevel)/.agents/hooks/lifecycle-delegation.js\" --client codex --event subagent-stop",
60
+ "timeout": 5,
61
+ "statusMessage": "Recording Codex child stop evidence"
62
+ }
63
+ ]
14
64
  }
15
65
  ]
16
66
  }
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "Watch a PR's required checks and self-heal on failure"
2
+ description: "Watch all checks on a PR and self-heal on failure"
3
3
  agent: general
4
4
  subtask: false
5
5
  ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: "监控 PR 的 required checks 并在失败时自愈"
2
+ description: "监控 PR 的全部 checks 并在失败时自愈"
3
3
  agent: general
4
4
  subtask: false
5
5
  ---
@@ -1,10 +0,0 @@
1
- description = "Review a pull request by evidence grade and publish a formal review"
2
- prompt = """
3
- Review pull request {{args}}.
4
-
5
- The PR number may be given with `--pr <number>`, via a PR URL, or by reverse lookup from the current branch when omitted.
6
-
7
- Read and execute the review-pr skill from `.agents/skills/review-pr/SKILL.md`.
8
-
9
- Follow all steps defined in the skill exactly.
10
- """
@@ -1,10 +0,0 @@
1
- description = "按证据分级审查 PR 并发布正式 Review"
2
- prompt = """
3
- 审查 PR {{args}}。
4
-
5
- PR 编号可通过 `--pr <number>` 指定,或使用 PR URL;省略时按当前分支反查。
6
-
7
- 读取并执行 `.agents/skills/review-pr/SKILL.md` 中的 review-pr 技能。
8
-
9
- 严格按照技能中定义的所有步骤执行。
10
- """