@devcxl/opencode-cabbage 1.1.0 → 1.3.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 (142) hide show
  1. package/.codex-plugin/plugin.json +36 -0
  2. package/README.md +53 -25
  3. package/README.zh.md +23 -23
  4. package/assets/agents/dev-lifecycle.md +208 -68
  5. package/assets/agents/team/architect.md +22 -7
  6. package/assets/agents/team/developer.md +13 -6
  7. package/assets/agents/team/goal-verify.md +4 -1
  8. package/assets/agents/team/researcher.md +59 -0
  9. package/assets/agents/team/reviewer.md +34 -18
  10. package/assets/commands/setup.md +1 -1
  11. package/assets/prompts/bootstrap.md +10 -9
  12. package/assets/prompts/stage-contract.md +25 -25
  13. package/assets/skills/flow-code/SKILL.md +23 -25
  14. package/assets/skills/flow-design/SKILL.md +94 -26
  15. package/assets/skills/flow-release/SKILL.md +41 -17
  16. package/assets/skills/flow-requirements/SKILL.md +19 -13
  17. package/assets/skills/flow-research/SKILL.md +77 -0
  18. package/assets/skills/flow-review/SKILL.md +55 -25
  19. package/assets/skills/flow-setup/SKILL.md +27 -24
  20. package/assets/skills/flow-tasks/SKILL.md +178 -35
  21. package/assets/skills/flow-tdd/SKILL.md +68 -40
  22. package/codex-skills/agent-architect/SKILL.md +79 -0
  23. package/codex-skills/agent-dev-lifecycle/SKILL.md +309 -0
  24. package/codex-skills/agent-developer/SKILL.md +51 -0
  25. package/codex-skills/agent-goal-verify/SKILL.md +45 -0
  26. package/codex-skills/agent-researcher/SKILL.md +32 -0
  27. package/codex-skills/agent-reviewer/SKILL.md +109 -0
  28. package/codex-skills/flow-code/SKILL.md +71 -0
  29. package/codex-skills/flow-design/SKILL.md +146 -0
  30. package/codex-skills/flow-release/SKILL.md +90 -0
  31. package/codex-skills/flow-requirements/SKILL.md +90 -0
  32. package/codex-skills/flow-research/SKILL.md +77 -0
  33. package/codex-skills/flow-review/SKILL.md +110 -0
  34. package/codex-skills/flow-setup/SKILL.md +75 -0
  35. package/codex-skills/flow-tasks/SKILL.md +220 -0
  36. package/codex-skills/flow-tdd/SKILL.md +235 -0
  37. package/dist/hooks/session-start.d.ts +1 -0
  38. package/dist/hooks/session-start.js +72 -0
  39. package/dist/hooks/session-start.js.map +1 -0
  40. package/dist/kernel/session-index.d.ts +8 -25
  41. package/dist/kernel/session-index.js +5 -55
  42. package/dist/kernel/session-index.js.map +1 -1
  43. package/dist/plugin/bootstrap.d.ts +0 -1
  44. package/dist/plugin/bootstrap.js +0 -3
  45. package/dist/plugin/bootstrap.js.map +1 -1
  46. package/dist/plugin/goal-store.d.ts +71 -0
  47. package/dist/plugin/goal-store.js +54 -0
  48. package/dist/plugin/goal-store.js.map +1 -0
  49. package/dist/plugin/goal.d.ts +47 -13
  50. package/dist/plugin/goal.js +228 -128
  51. package/dist/plugin/goal.js.map +1 -1
  52. package/dist/plugin/prompt-lint.js +3 -11
  53. package/dist/plugin/prompt-lint.js.map +1 -1
  54. package/dist/plugin/prompts.d.ts +0 -1
  55. package/dist/plugin/prompts.js +0 -4
  56. package/dist/plugin/prompts.js.map +1 -1
  57. package/dist/plugin/server.d.ts +3 -5
  58. package/dist/plugin/server.js +247 -155
  59. package/dist/plugin/server.js.map +1 -1
  60. package/dist/plugin/skills.d.ts +7 -1
  61. package/dist/plugin/skills.js +75 -12
  62. package/dist/plugin/skills.js.map +1 -1
  63. package/dist/plugin.d.ts +0 -1
  64. package/dist/plugin.js +1 -4
  65. package/dist/plugin.js.map +1 -1
  66. package/dist/util/gh.d.ts +0 -11
  67. package/dist/util/gh.js +0 -14
  68. package/dist/util/gh.js.map +1 -1
  69. package/dist/util/paths.d.ts +0 -14
  70. package/dist/util/paths.js +0 -69
  71. package/dist/util/paths.js.map +1 -1
  72. package/hooks/hooks.json +17 -0
  73. package/package.json +12 -4
  74. package/assets/prompts/ADR-FORMAT.md +0 -45
  75. package/assets/prompts/PRD-FORMAT.md +0 -17
  76. package/assets/templates/gitignore +0 -5
  77. package/dist/kernel/caller.d.ts +0 -48
  78. package/dist/kernel/caller.js +0 -88
  79. package/dist/kernel/caller.js.map +0 -1
  80. package/dist/kernel/flow.d.ts +0 -175
  81. package/dist/kernel/flow.js +0 -467
  82. package/dist/kernel/flow.js.map +0 -1
  83. package/dist/kernel/legacy.d.ts +0 -19
  84. package/dist/kernel/legacy.js +0 -34
  85. package/dist/kernel/legacy.js.map +0 -1
  86. package/dist/kernel/records.d.ts +0 -103
  87. package/dist/kernel/records.js +0 -240
  88. package/dist/kernel/records.js.map +0 -1
  89. package/dist/kernel/release.d.ts +0 -106
  90. package/dist/kernel/release.js +0 -241
  91. package/dist/kernel/release.js.map +0 -1
  92. package/dist/kernel/review.d.ts +0 -34
  93. package/dist/kernel/review.js +0 -82
  94. package/dist/kernel/review.js.map +0 -1
  95. package/dist/kernel/setup.d.ts +0 -95
  96. package/dist/kernel/setup.js +0 -401
  97. package/dist/kernel/setup.js.map +0 -1
  98. package/dist/kernel/slug.d.ts +0 -23
  99. package/dist/kernel/slug.js +0 -67
  100. package/dist/kernel/slug.js.map +0 -1
  101. package/dist/kernel/task.d.ts +0 -213
  102. package/dist/kernel/task.js +0 -873
  103. package/dist/kernel/task.js.map +0 -1
  104. package/dist/kernel/tdd/adapter.d.ts +0 -49
  105. package/dist/kernel/tdd/adapter.js +0 -294
  106. package/dist/kernel/tdd/adapter.js.map +0 -1
  107. package/dist/kernel/tdd/digest.d.ts +0 -18
  108. package/dist/kernel/tdd/digest.js +0 -303
  109. package/dist/kernel/tdd/digest.js.map +0 -1
  110. package/dist/kernel/tdd/evaluator.d.ts +0 -38
  111. package/dist/kernel/tdd/evaluator.js +0 -185
  112. package/dist/kernel/tdd/evaluator.js.map +0 -1
  113. package/dist/kernel/tdd/evidence.d.ts +0 -42
  114. package/dist/kernel/tdd/evidence.js +0 -48
  115. package/dist/kernel/tdd/evidence.js.map +0 -1
  116. package/dist/kernel/tdd/state.d.ts +0 -79
  117. package/dist/kernel/tdd/state.js +0 -363
  118. package/dist/kernel/tdd/state.js.map +0 -1
  119. package/dist/kernel/types.d.ts +0 -180
  120. package/dist/kernel/types.js +0 -2
  121. package/dist/kernel/types.js.map +0 -1
  122. package/dist/kernel/worktree.d.ts +0 -45
  123. package/dist/kernel/worktree.js +0 -156
  124. package/dist/kernel/worktree.js.map +0 -1
  125. package/dist/plugin/flow-control.d.ts +0 -91
  126. package/dist/plugin/flow-control.js +0 -287
  127. package/dist/plugin/flow-control.js.map +0 -1
  128. package/dist/plugin/release-control.d.ts +0 -39
  129. package/dist/plugin/release-control.js +0 -343
  130. package/dist/plugin/release-control.js.map +0 -1
  131. package/dist/plugin/setup-control.d.ts +0 -59
  132. package/dist/plugin/setup-control.js +0 -111
  133. package/dist/plugin/setup-control.js.map +0 -1
  134. package/dist/plugin/task-control.d.ts +0 -90
  135. package/dist/plugin/task-control.js +0 -208
  136. package/dist/plugin/task-control.js.map +0 -1
  137. package/dist/plugin/tdd-checkpoint.d.ts +0 -128
  138. package/dist/plugin/tdd-checkpoint.js +0 -664
  139. package/dist/plugin/tdd-checkpoint.js.map +0 -1
  140. package/dist/util/shell.d.ts +0 -1
  141. package/dist/util/shell.js +0 -4
  142. package/dist/util/shell.js.map +0 -1
@@ -1,208 +0,0 @@
1
- /**
2
- * task_control 工具(spec §2.3):Task Record + worktree + PR + merge(核心)。
3
- * 八 op:create-task / start-task / submit-task / submit-review /
4
- * merge-task / cancel-task / destroy-worktree / status-task。
5
- * caller:primary 全量;developer 不允许调用 task_control(无门禁绕过面)。
6
- * server.ts 接线由后续批次统一处理(本批不注册,避免文件冲突)。
7
- */
8
- import { tool } from "@opencode-ai/plugin/tool";
9
- import { resolveProjectDir } from "../util/paths.js";
10
- import { requireToolCaller, CALLER_NOT_AUTHORIZED } from "../kernel/caller.js";
11
- import { createTask, startTask, submitTask, submitReview, mergeTask, cancelTask, destroyTaskWorktree, readTaskStatus, parseDependenciesArg, } from "../kernel/task.js";
12
- /**
13
- * task_control 工具工厂(spec §2.3)。
14
- * caller 门禁:primary 全量;developer 拒绝(无门禁绕过面)。
15
- */
16
- export function createTaskControlTool(deps) {
17
- return tool({
18
- description: `Control the Task Record lifecycle (a Task = one GitHub Sub Issue under a Flow Parent Issue).
19
-
20
- Operations:
21
- - create-task: Validate the functional title, derive the slug, and create a Sub Issue (body contains acceptance criteria, dependencies, and the Closes convention) linked to the parent.
22
- - start-task: Gate checks (Planning Baseline merged, dependencies merged, parallel < 5), then worktree-start, capture the clean workspace baseline, freeze the TDD policy, and mark the task running.
23
- - submit-task: TDD hard gate — reject PR creation when evidence is incomplete (no comment / regression not pass / compliance fail). On pass: push the branch, create the PR (body references the Task Record + evidence comment link, Closes convention), and mark reviewing.
24
- - submit-review: primary submits the reviewer's dual-axis result via gh pr review --approve/--request-changes (the reviewer itself is read-only).
25
- - merge-task: Merge gates (CI checks pass + branch protection + dual-layer risk escalation, only up not down; high risk needs a non-author human approval) → merge PR (--match-head-commit) → close the Sub Issue → cleanly destroy the worktree.
26
- - cancel-task / destroy-worktree: controlled cancellation / preflight destruction, both require user_confirmed (unless the PR is merged and clean).
27
- - status-task: Aggregate the Task Record, PR, and checks into one report.
28
-
29
- Caller: primary only (developer has no task_control access).`,
30
- args: {
31
- op: tool.schema
32
- .enum(["create-task", "start-task", "submit-task", "submit-review", "merge-task", "cancel-task", "destroy-worktree", "status-task"])
33
- .describe("Task control operation"),
34
- title: tool.schema.string().optional().describe("Functional title (kebab-case slug) for create-task"),
35
- parent_issue_number: tool.schema.number().optional().describe("Parent GitHub Issue number of the Flow Record"),
36
- task_id: tool.schema.string().optional().describe("Task slug (kernel-derived)"),
37
- acceptance_criteria: tool.schema.string().optional().describe("JSON array of acceptance criteria for create-task"),
38
- depends_on: tool.schema.string().optional().describe("Comma-separated dependency issue numbers for create-task"),
39
- pr_number: tool.schema.number().optional().describe("PR number (submit-review/status)"),
40
- risk: tool.schema.enum(["low", "high"]).optional().describe("Model-assessed risk for merge-task (kernel may escalate, never downgrade)"),
41
- verdict: tool.schema.enum(["approve", "request-changes"]).optional().describe("Review verdict for submit-review"),
42
- comment: tool.schema.string().optional().describe("Review comment for submit-review request-changes"),
43
- user_confirmed: tool.schema.boolean().optional().describe("User confirmation (required for cancel-task/destroy-worktree)"),
44
- },
45
- async execute(args, ctx) {
46
- const op = args.op;
47
- // caller 门禁(矩阵单一来源,§2.2):task_control 仅 primary(developer 拒绝)
48
- const denied = await requireToolCaller(ctx, "task_control", op, deps.sessionClient);
49
- if (denied)
50
- return errorResponse(CALLER_NOT_AUTHORIZED, denied);
51
- // 会话级项目目录优先(workspace root 异常会话下插件级 projectDir 可能是 `/`)
52
- const runtimeDeps = { ...deps, projectDir: resolveProjectDir(ctx.directory, deps.projectDir) };
53
- try {
54
- switch (op) {
55
- case "create-task":
56
- return handleCreateTask(runtimeDeps, args);
57
- case "start-task":
58
- return handleStartTask(runtimeDeps, args);
59
- case "submit-task":
60
- return handleSubmitTask(runtimeDeps, args);
61
- case "submit-review":
62
- return handleSubmitReview(args);
63
- case "merge-task":
64
- return handleMergeTask(runtimeDeps, args);
65
- case "cancel-task":
66
- return handleCancelTask(runtimeDeps, args);
67
- case "destroy-worktree":
68
- return handleDestroyWorktree(runtimeDeps, args);
69
- case "status-task":
70
- return handleStatusTask(runtimeDeps, args);
71
- default:
72
- return errorResponse("UNKNOWN_OP", `Unknown op: "${op}"`);
73
- }
74
- }
75
- catch (err) {
76
- return errorResponse("INTERNAL_ERROR", String(err));
77
- }
78
- },
79
- });
80
- }
81
- /** 独立注册辅助:把 task_control 挂到工具注册表(后续接线批次使用) */
82
- export function registerTaskControl(registry, deps) {
83
- registry.task_control = createTaskControlTool(deps);
84
- }
85
- // ─── op handlers ───
86
- async function handleCreateTask(deps, args) {
87
- const parent = Number(args.parent_issue_number);
88
- const title = args.title ?? "";
89
- if (!Number.isInteger(parent) || parent <= 0) {
90
- return errorResponse("POLICY_INVALID", "parent_issue_number is required");
91
- }
92
- if (title.trim() === "") {
93
- return errorResponse("POLICY_INVALID", "title is required for create-task");
94
- }
95
- const result = await createTask({
96
- projectDir: deps.projectDir,
97
- parentIssueNumber: parent,
98
- title,
99
- acceptanceCriteriaJson: args.acceptance_criteria,
100
- dependencies: parseDependenciesArg(args.depends_on),
101
- });
102
- if (!result.ok) {
103
- return errorResponse(result.code, result.message);
104
- }
105
- return okResponse({ task: result.ref });
106
- }
107
- async function handleStartTask(deps, args) {
108
- const req = requireTaskRef(args);
109
- if (typeof req === "string")
110
- return req;
111
- const result = await startTask(deps.projectDir, req.parent, req.taskId);
112
- if (!result.ok) {
113
- return errorResponse(result.code, result.message);
114
- }
115
- return okResponse({ issueNumber: result.issueNumber, branch: result.branch, worktreePath: result.worktreePath, policy: result.policy, baseline: result.baseline });
116
- }
117
- async function handleSubmitTask(deps, args) {
118
- const req = requireTaskRef(args);
119
- if (typeof req === "string")
120
- return req;
121
- const result = await submitTask(deps.projectDir, req.parent, req.taskId);
122
- if (!result.ok) {
123
- return errorResponse(result.code, result.message, result.missing);
124
- }
125
- return okResponse({
126
- prNumber: result.prNumber,
127
- evidenceRevision: result.evidenceRevision,
128
- ...(result.warning ? { warning: result.warning } : {}),
129
- });
130
- }
131
- async function handleSubmitReview(args) {
132
- const pr = Number(args.pr_number);
133
- const verdict = args.verdict;
134
- if (!Number.isInteger(pr) || pr <= 0) {
135
- return errorResponse("POLICY_INVALID", "pr_number is required");
136
- }
137
- if (verdict !== "approve" && verdict !== "request-changes") {
138
- return errorResponse("POLICY_INVALID", "verdict is required: approve|request-changes");
139
- }
140
- const result = await submitReview(pr, verdict, args.comment);
141
- if (!result.ok) {
142
- return errorResponse(result.code, result.message);
143
- }
144
- return okResponse({ prNumber: result.prNumber, verdict: result.verdict });
145
- }
146
- async function handleMergeTask(deps, args) {
147
- const req = requireTaskRef(args);
148
- if (typeof req === "string")
149
- return req;
150
- const risk = args.risk === "high" ? "high" : "low";
151
- const result = await mergeTask(deps.projectDir, req.parent, req.taskId, risk);
152
- if (!result.ok) {
153
- return errorResponse(result.code, result.message);
154
- }
155
- return okResponse({ prNumber: result.prNumber, risk: result.risk, ...(result.warning ? { warning: result.warning } : {}) });
156
- }
157
- async function handleCancelTask(deps, args) {
158
- const req = requireTaskRef(args);
159
- if (typeof req === "string")
160
- return req;
161
- const result = await cancelTask(deps.projectDir, req.parent, req.taskId, args.user_confirmed === true);
162
- if (!result.ok) {
163
- return errorResponse(result.code, result.message);
164
- }
165
- return okResponse({ issueNumber: result.issueNumber });
166
- }
167
- async function handleDestroyWorktree(deps, args) {
168
- const req = requireTaskRef(args);
169
- if (typeof req === "string")
170
- return req;
171
- const result = await destroyTaskWorktree(deps.projectDir, req.parent, req.taskId, args.user_confirmed === true);
172
- if (!result.ok) {
173
- return errorResponse(result.code, result.message);
174
- }
175
- return okResponse({ reason: result.reason });
176
- }
177
- async function handleStatusTask(deps, args) {
178
- const req = requireTaskRef(args);
179
- if (typeof req === "string")
180
- return req;
181
- const result = await readTaskStatus(deps.projectDir, req.parent, req.taskId);
182
- if (!result.ok) {
183
- return errorResponse(result.code, result.message);
184
- }
185
- return okResponse({ report: result.report });
186
- }
187
- // ─── helpers ───
188
- /** 提取 parent_issue_number + task_id;缺失返回错误响应字符串 */
189
- function requireTaskRef(args) {
190
- const parent = Number(args.parent_issue_number);
191
- const taskId = args.task_id ?? "";
192
- if (!Number.isInteger(parent) || parent <= 0) {
193
- return errorResponse("POLICY_INVALID", "parent_issue_number is required");
194
- }
195
- if (taskId.trim() === "") {
196
- return errorResponse("POLICY_INVALID", "task_id is required");
197
- }
198
- return { parent, taskId };
199
- }
200
- function okResponse(overrides = {}) {
201
- const resp = { ok: true, ...overrides };
202
- return JSON.stringify(resp, null, 2);
203
- }
204
- function errorResponse(code, message, missing) {
205
- const resp = { ok: false, error: { code, message }, ...(missing ? { missing } : {}) };
206
- return JSON.stringify(resp, null, 2);
207
- }
208
- //# sourceMappingURL=task-control.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-control.js","sourceRoot":"","sources":["../../src/plugin/task-control.ts"],"names":[],"mapp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AO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IAC1G,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;AACtC,CAAC"}
@@ -1,128 +0,0 @@
1
- import type { CallerSessionClient } from "../kernel/caller.js";
2
- import type { TddEvidence, TddPolicy, AcceptanceCriterion } from "../kernel/types.js";
3
- export type TddCheckpointOp = "cycle-start" | "red" | "green" | "final-regression" | "final-verification" | "abandon-cycle" | "status" | "not-applicable" | "exempt-request";
4
- export interface TddCheckpointDeps {
5
- projectDir: string;
6
- sessionClient: CallerSessionClient;
7
- }
8
- /** 从 Task Record 解析出的工具执行上下文 */
9
- export interface TddTaskContext {
10
- /** Task Record(Sub Issue)编号 */
11
- issueNumber: number;
12
- policy: TddPolicy;
13
- criteria: AcceptanceCriterion[];
14
- /** 绝对路径(基于 projectDir 解析) */
15
- worktreeDir: string;
16
- }
17
- export interface TddCheckpointToolResponse {
18
- ok: boolean;
19
- cycle?: {
20
- cycleId: string;
21
- criterionId: string;
22
- status: string;
23
- };
24
- evidence?: {
25
- revision: number;
26
- status: string;
27
- cycles: number;
28
- regression: string;
29
- verification: string;
30
- warnings: string[];
31
- };
32
- error?: {
33
- code: string;
34
- message: string;
35
- };
36
- }
37
- type GhFn = (args: string) => Promise<{
38
- stdout: string;
39
- stderr: string;
40
- }>;
41
- export declare function setTddCheckpointGhExecutor(fn: GhFn | null): void;
42
- /** Task Record body 中承载 TDD policy/criteria/worktree 的 JSON 区块 marker */
43
- export declare const TASK_TDD_TAG = "<!-- cabbage-task-tdd -->";
44
- export interface TaskTddBlock {
45
- policy: TddPolicy;
46
- criteria: AcceptanceCriterion[];
47
- worktreeDir: string;
48
- }
49
- /** 从 Task Record body 解析 TDD 区块(纯函数);无 marker 或畸形返回 null */
50
- export declare function parseTaskTddBlock(body: string): TaskTddBlock | null;
51
- /**
52
- * 解析 Task Record 上下文:按 title 定位 Sub Issue → 读 body → 解析 TDD 区块。
53
- * 由批 9(task_control 写 Task Record)遵循此区块格式;批 15 接线时可替换为正式解析。
54
- */
55
- export declare function resolveTaskContext(parentIssueNumber: number, taskId: string, projectDir: string): Promise<TddTaskContext>;
56
- /** evidence comment 内状态 JSON 块 marker;解析时取最后一个(最新) */
57
- export declare const TDD_STATE_TAG = "<!-- cabbage-tdd-state -->";
58
- export declare function serializeState(evidence: TddEvidence): string;
59
- /** 从 marker 区间内容解析最新状态;无状态块或畸形返回 null */
60
- export declare function parseStateFromContent(content: string): TddEvidence | null;
61
- /** 变更文件是否全部命中文档 pattern;空变更集也视为不通过(无变更不应豁免) */
62
- export declare function isDocumentationOnly(changedFiles: string[], patterns: string[]): boolean;
63
- /** 剔除构建产物类变更(git status 列出但不应参与豁免判定的文件) */
64
- export declare function filterGeneratedChanges(changedFiles: string[]): string[];
65
- /** 解析 git status --porcelain 输出为变更文件路径(重命名取新路径,跳过冲突条目) */
66
- export declare function parsePorcelainChanges(raw: string): string[];
67
- type GitFn = (args: string[], cwd: string) => string;
68
- export declare function setTddCheckpointGitExecutor(fn: GitFn | null): void;
69
- /** 列出 worktree 相对 HEAD 的变更文件(已跟踪修改/删除 + 未跟踪新增);git 失败返回空 */
70
- export declare function listWorktreeChanges(worktreeDir: string): string[];
71
- export declare function createTddCheckpointTool(deps: TddCheckpointDeps): {
72
- description: string;
73
- args: {
74
- op: import("zod").ZodEnum<{
75
- status: "status";
76
- "not-applicable": "not-applicable";
77
- red: "red";
78
- green: "green";
79
- "final-regression": "final-regression";
80
- "final-verification": "final-verification";
81
- "cycle-start": "cycle-start";
82
- "abandon-cycle": "abandon-cycle";
83
- "exempt-request": "exempt-request";
84
- }>;
85
- parent_issue_number: import("zod").ZodOptional<import("zod").ZodNumber>;
86
- task_id: import("zod").ZodOptional<import("zod").ZodString>;
87
- cycle_id: import("zod").ZodOptional<import("zod").ZodString>;
88
- criterion_id: import("zod").ZodOptional<import("zod").ZodString>;
89
- test_paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
90
- test_selector: import("zod").ZodOptional<import("zod").ZodString>;
91
- reason: import("zod").ZodOptional<import("zod").ZodString>;
92
- user_confirmed: import("zod").ZodOptional<import("zod").ZodBoolean>;
93
- };
94
- execute(args: {
95
- op: "status" | "not-applicable" | "red" | "green" | "final-regression" | "final-verification" | "cycle-start" | "abandon-cycle" | "exempt-request";
96
- parent_issue_number?: number | undefined;
97
- task_id?: string | undefined;
98
- cycle_id?: string | undefined;
99
- criterion_id?: string | undefined;
100
- test_paths?: string[] | undefined;
101
- test_selector?: string | undefined;
102
- reason?: string | undefined;
103
- user_confirmed?: boolean | undefined;
104
- }, context: import("@opencode-ai/plugin/tool").ToolContext): Promise<import("@opencode-ai/plugin/tool").ToolResult>;
105
- };
106
- /** 独立注册辅助:把 tdd_checkpoint 挂到工具注册表(后续接线批次使用) */
107
- export declare function registerTddCheckpoint(registry: Record<string, unknown>, deps: TddCheckpointDeps): void;
108
- export interface TddSubmitGateInput {
109
- /** Task Record(Sub Issue)编号 */
110
- issueNumber: number;
111
- policy: TddPolicy;
112
- criteria: AcceptanceCriterion[];
113
- }
114
- export type TddSubmitGateResult = {
115
- ok: true;
116
- status: string;
117
- warnings: string[];
118
- } | {
119
- ok: false;
120
- code: string;
121
- message: string;
122
- };
123
- /**
124
- * TDD 硬门禁:evidence 必须由 kernel 亲自写入(受控 comment 存在且状态可解析),
125
- * 再经 evaluateTddCompliance 判定;runtime 下不完整 → 拒绝。
126
- */
127
- export declare function checkTddSubmitGate(input: TddSubmitGateInput): Promise<TddSubmitGateResult>;
128
- export {};