@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.
- package/.codex-plugin/plugin.json +36 -0
- package/README.md +53 -25
- package/README.zh.md +23 -23
- package/assets/agents/dev-lifecycle.md +208 -68
- package/assets/agents/team/architect.md +22 -7
- package/assets/agents/team/developer.md +13 -6
- package/assets/agents/team/goal-verify.md +4 -1
- package/assets/agents/team/researcher.md +59 -0
- package/assets/agents/team/reviewer.md +34 -18
- package/assets/commands/setup.md +1 -1
- package/assets/prompts/bootstrap.md +10 -9
- package/assets/prompts/stage-contract.md +25 -25
- package/assets/skills/flow-code/SKILL.md +23 -25
- package/assets/skills/flow-design/SKILL.md +94 -26
- package/assets/skills/flow-release/SKILL.md +41 -17
- package/assets/skills/flow-requirements/SKILL.md +19 -13
- package/assets/skills/flow-research/SKILL.md +77 -0
- package/assets/skills/flow-review/SKILL.md +55 -25
- package/assets/skills/flow-setup/SKILL.md +27 -24
- package/assets/skills/flow-tasks/SKILL.md +178 -35
- package/assets/skills/flow-tdd/SKILL.md +68 -40
- package/codex-skills/agent-architect/SKILL.md +79 -0
- package/codex-skills/agent-dev-lifecycle/SKILL.md +309 -0
- package/codex-skills/agent-developer/SKILL.md +51 -0
- package/codex-skills/agent-goal-verify/SKILL.md +45 -0
- package/codex-skills/agent-researcher/SKILL.md +32 -0
- package/codex-skills/agent-reviewer/SKILL.md +109 -0
- package/codex-skills/flow-code/SKILL.md +71 -0
- package/codex-skills/flow-design/SKILL.md +146 -0
- package/codex-skills/flow-release/SKILL.md +90 -0
- package/codex-skills/flow-requirements/SKILL.md +90 -0
- package/codex-skills/flow-research/SKILL.md +77 -0
- package/codex-skills/flow-review/SKILL.md +110 -0
- package/codex-skills/flow-setup/SKILL.md +75 -0
- package/codex-skills/flow-tasks/SKILL.md +220 -0
- package/codex-skills/flow-tdd/SKILL.md +235 -0
- package/dist/hooks/session-start.d.ts +1 -0
- package/dist/hooks/session-start.js +72 -0
- package/dist/hooks/session-start.js.map +1 -0
- package/dist/kernel/session-index.d.ts +8 -25
- package/dist/kernel/session-index.js +5 -55
- package/dist/kernel/session-index.js.map +1 -1
- package/dist/plugin/bootstrap.d.ts +0 -1
- package/dist/plugin/bootstrap.js +0 -3
- package/dist/plugin/bootstrap.js.map +1 -1
- package/dist/plugin/goal-store.d.ts +71 -0
- package/dist/plugin/goal-store.js +54 -0
- package/dist/plugin/goal-store.js.map +1 -0
- package/dist/plugin/goal.d.ts +47 -13
- package/dist/plugin/goal.js +228 -128
- package/dist/plugin/goal.js.map +1 -1
- package/dist/plugin/prompt-lint.js +3 -11
- package/dist/plugin/prompt-lint.js.map +1 -1
- package/dist/plugin/prompts.d.ts +0 -1
- package/dist/plugin/prompts.js +0 -4
- package/dist/plugin/prompts.js.map +1 -1
- package/dist/plugin/server.d.ts +3 -5
- package/dist/plugin/server.js +247 -155
- package/dist/plugin/server.js.map +1 -1
- package/dist/plugin/skills.d.ts +7 -1
- package/dist/plugin/skills.js +75 -12
- package/dist/plugin/skills.js.map +1 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plugin.js +1 -4
- package/dist/plugin.js.map +1 -1
- package/dist/util/gh.d.ts +0 -11
- package/dist/util/gh.js +0 -14
- package/dist/util/gh.js.map +1 -1
- package/dist/util/paths.d.ts +0 -14
- package/dist/util/paths.js +0 -69
- package/dist/util/paths.js.map +1 -1
- package/hooks/hooks.json +17 -0
- package/package.json +12 -4
- package/assets/prompts/ADR-FORMAT.md +0 -45
- package/assets/prompts/PRD-FORMAT.md +0 -17
- package/assets/templates/gitignore +0 -5
- package/dist/kernel/caller.d.ts +0 -48
- package/dist/kernel/caller.js +0 -88
- package/dist/kernel/caller.js.map +0 -1
- package/dist/kernel/flow.d.ts +0 -175
- package/dist/kernel/flow.js +0 -467
- package/dist/kernel/flow.js.map +0 -1
- package/dist/kernel/legacy.d.ts +0 -19
- package/dist/kernel/legacy.js +0 -34
- package/dist/kernel/legacy.js.map +0 -1
- package/dist/kernel/records.d.ts +0 -103
- package/dist/kernel/records.js +0 -240
- package/dist/kernel/records.js.map +0 -1
- package/dist/kernel/release.d.ts +0 -106
- package/dist/kernel/release.js +0 -241
- package/dist/kernel/release.js.map +0 -1
- package/dist/kernel/review.d.ts +0 -34
- package/dist/kernel/review.js +0 -82
- package/dist/kernel/review.js.map +0 -1
- package/dist/kernel/setup.d.ts +0 -95
- package/dist/kernel/setup.js +0 -401
- package/dist/kernel/setup.js.map +0 -1
- package/dist/kernel/slug.d.ts +0 -23
- package/dist/kernel/slug.js +0 -67
- package/dist/kernel/slug.js.map +0 -1
- package/dist/kernel/task.d.ts +0 -213
- package/dist/kernel/task.js +0 -873
- package/dist/kernel/task.js.map +0 -1
- package/dist/kernel/tdd/adapter.d.ts +0 -49
- package/dist/kernel/tdd/adapter.js +0 -294
- package/dist/kernel/tdd/adapter.js.map +0 -1
- package/dist/kernel/tdd/digest.d.ts +0 -18
- package/dist/kernel/tdd/digest.js +0 -303
- package/dist/kernel/tdd/digest.js.map +0 -1
- package/dist/kernel/tdd/evaluator.d.ts +0 -38
- package/dist/kernel/tdd/evaluator.js +0 -185
- package/dist/kernel/tdd/evaluator.js.map +0 -1
- package/dist/kernel/tdd/evidence.d.ts +0 -42
- package/dist/kernel/tdd/evidence.js +0 -48
- package/dist/kernel/tdd/evidence.js.map +0 -1
- package/dist/kernel/tdd/state.d.ts +0 -79
- package/dist/kernel/tdd/state.js +0 -363
- package/dist/kernel/tdd/state.js.map +0 -1
- package/dist/kernel/types.d.ts +0 -180
- package/dist/kernel/types.js +0 -2
- package/dist/kernel/types.js.map +0 -1
- package/dist/kernel/worktree.d.ts +0 -45
- package/dist/kernel/worktree.js +0 -156
- package/dist/kernel/worktree.js.map +0 -1
- package/dist/plugin/flow-control.d.ts +0 -91
- package/dist/plugin/flow-control.js +0 -287
- package/dist/plugin/flow-control.js.map +0 -1
- package/dist/plugin/release-control.d.ts +0 -39
- package/dist/plugin/release-control.js +0 -343
- package/dist/plugin/release-control.js.map +0 -1
- package/dist/plugin/setup-control.d.ts +0 -59
- package/dist/plugin/setup-control.js +0 -111
- package/dist/plugin/setup-control.js.map +0 -1
- package/dist/plugin/task-control.d.ts +0 -90
- package/dist/plugin/task-control.js +0 -208
- package/dist/plugin/task-control.js.map +0 -1
- package/dist/plugin/tdd-checkpoint.d.ts +0 -128
- package/dist/plugin/tdd-checkpoint.js +0 -664
- package/dist/plugin/tdd-checkpoint.js.map +0 -1
- package/dist/util/shell.d.ts +0 -1
- package/dist/util/shell.js +0 -4
- package/dist/util/shell.js.map +0 -1
package/dist/kernel/task.d.ts
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { type ProjectProfile } from "./profile.js";
|
|
2
|
-
import { type WorkspaceBaseline } from "./tdd/evidence.js";
|
|
3
|
-
import type { AcceptanceCriterion, TaskRecordRef, TddEvidence, TddPolicy } from "./types.js";
|
|
4
|
-
/** Task Record 状态标签前缀:cabbage:task:<status> */
|
|
5
|
-
export declare const TASK_STATUS_LABEL_PREFIX = "cabbage:task:";
|
|
6
|
-
/** Task 状态标签取值 */
|
|
7
|
-
export type TaskStatus = "running" | "reviewing" | "merged" | "cancelled";
|
|
8
|
-
/** 默认最大并行 Task 数(PRD R7,Profile 可覆盖但内核按此判定) */
|
|
9
|
-
export declare const MAX_PARALLEL_TASKS = 5;
|
|
10
|
-
/** 内核内置风险 pattern(spec §12 #12:migrations/auth/permissions/release workflow/密钥/公共 API),与 Profile riskPatterns 合并 */
|
|
11
|
-
export declare const BUILTIN_RISK_PATTERNS: string[];
|
|
12
|
-
export type CmdResult = {
|
|
13
|
-
stdout: string;
|
|
14
|
-
stderr: string;
|
|
15
|
-
};
|
|
16
|
-
export type CmdFn = (args: string) => Promise<CmdResult>;
|
|
17
|
-
export declare function setTaskGhExecutor(fn: CmdFn | null): void;
|
|
18
|
-
export declare function setTaskGitExecutor(fn: CmdFn | null): void;
|
|
19
|
-
export declare function taskGh(args: string, timeout?: number): Promise<CmdResult>;
|
|
20
|
-
export declare function taskGit(args: string): Promise<CmdResult>;
|
|
21
|
-
/**
|
|
22
|
-
* 新建 Task Record 的 body:acceptance criteria + 依赖 + 状态 checklist + Closes 约定。
|
|
23
|
-
* criteria 渲染为 `- [ ] <id>: <description> [<verification>]`,可被 parseCriteriaFromBody 还原。
|
|
24
|
-
*/
|
|
25
|
-
export declare function buildTaskBody(slug: string, criteria: AcceptanceCriterion[], dependencies: Array<number | string>): string;
|
|
26
|
-
/** TDD 跨批协议:Task Record body 内 TDD 上下文块 marker(tdd_checkpoint 工具解析;spec §2.3/§4) */
|
|
27
|
-
export declare const TASK_TDD_TAG = "<!-- cabbage-task-tdd -->";
|
|
28
|
-
/** 构造 TDD 上下文块 JSON(policy + criteria + worktreeDir),供 tdd_checkpoint resolveTaskContext 解析 */
|
|
29
|
-
export declare function buildTaskTddBlock(policy: TddPolicy, criteria: AcceptanceCriterion[], worktreePath: string): string;
|
|
30
|
-
/** 解析 create-task 传入的 acceptance_criteria JSON(字符串数组 → AcceptanceCriterion[]);非法返回 null */
|
|
31
|
-
export declare function parseAcceptanceCriteria(json: string): AcceptanceCriterion[] | null;
|
|
32
|
-
/** 从 Task Record body 还原 acceptance criteria(buildTaskBody 的逆操作) */
|
|
33
|
-
export declare function parseCriteriaFromBody(body: string): AcceptanceCriterion[];
|
|
34
|
-
/** 从 Task Record body 的 Dependencies 区块解析依赖:`- #12` → 编号;`- @slug` → slug(门禁时解析) */
|
|
35
|
-
export declare function parseDependenciesFromBody(body: string): Array<number | string>;
|
|
36
|
-
/**
|
|
37
|
-
* 解析 create-task 的 depends_on 参数:支持 Issue 编号("12" / "#12")与
|
|
38
|
-
* task_id(slug,如 "user-auth")混合,以逗号分隔。非法项忽略。
|
|
39
|
-
* 返回 string 表示 slug(需在门禁时解析成编号)。
|
|
40
|
-
*/
|
|
41
|
-
export declare function parseDependenciesArg(raw: string | undefined): Array<number | string>;
|
|
42
|
-
/** 从 Project Profile 冻结 TDD policy:enforcement 固定 runtime(PRD R6 行为变更强制 Runtime TDD) */
|
|
43
|
-
export declare function freezeTddPolicy(profile: ProjectProfile): TddPolicy;
|
|
44
|
-
/** 轻量 glob 匹配(支持 **、*、?),风险 pattern 匹配专用 */
|
|
45
|
-
export declare function matchRiskPattern(filePath: string, pattern: string): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* 风险双层判定:模型初判 + 内核按实际 diff 升级,只升不降(PRD R8 / spec §12 #12)。
|
|
48
|
-
* modelRisk 为 high → high;否则 diff 命中任一 risk pattern → high;否则 low。
|
|
49
|
-
*/
|
|
50
|
-
export declare function escalateRisk(modelRisk: "low" | "high", changedFiles: string[], riskPatterns: string[]): "low" | "high";
|
|
51
|
-
export interface ParsedEvidenceBlock {
|
|
52
|
-
stage: string;
|
|
53
|
-
fields: Record<string, string>;
|
|
54
|
-
}
|
|
55
|
-
/** 解析受控 evidence comment 为结构化 blocks;无 marker 或畸形返回 null */
|
|
56
|
-
export declare function parseEvidenceComment(body: string): ParsedEvidenceBlock[] | null;
|
|
57
|
-
/** 把受控 comment 还原为 TddEvidence(供 evaluateTddCompliance 判定);无 marker 返回 null */
|
|
58
|
-
export declare function evidenceCommentToTddEvidence(comment: {
|
|
59
|
-
id: number;
|
|
60
|
-
body: string;
|
|
61
|
-
revision: number;
|
|
62
|
-
}): TddEvidence | null;
|
|
63
|
-
export interface TaskRuntimeState {
|
|
64
|
-
slug: string;
|
|
65
|
-
parentIssueNumber: number;
|
|
66
|
-
issueNumber: number;
|
|
67
|
-
branch: string;
|
|
68
|
-
worktreePath: string;
|
|
69
|
-
policy: TddPolicy;
|
|
70
|
-
baseline: WorkspaceBaseline;
|
|
71
|
-
startedAt: string;
|
|
72
|
-
}
|
|
73
|
-
export declare function taskStatePath(projectDir: string, slug: string): string;
|
|
74
|
-
export declare function writeTaskState(projectDir: string, state: TaskRuntimeState): Promise<void>;
|
|
75
|
-
export declare function readTaskState(projectDir: string, slug: string): Promise<TaskRuntimeState | null>;
|
|
76
|
-
export declare function setTaskStatusLabel(issueNumber: number, status: TaskStatus): Promise<{
|
|
77
|
-
ok: boolean;
|
|
78
|
-
error?: string;
|
|
79
|
-
}>;
|
|
80
|
-
export interface CreateTaskInput {
|
|
81
|
-
projectDir: string;
|
|
82
|
-
parentIssueNumber: number;
|
|
83
|
-
title: string;
|
|
84
|
-
acceptanceCriteriaJson?: string;
|
|
85
|
-
/** 依赖:Issue 编号或 task_id(slug),create-task 的 depends_on 原样传递 */
|
|
86
|
-
dependencies?: Array<number | string>;
|
|
87
|
-
}
|
|
88
|
-
export type CreateTaskResult = {
|
|
89
|
-
ok: true;
|
|
90
|
-
ref: TaskRecordRef;
|
|
91
|
-
} | {
|
|
92
|
-
ok: false;
|
|
93
|
-
code: string;
|
|
94
|
-
message: string;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* create-task(spec §2.3):validateTitle → slug → 未完成同名冲突检查(branch/worktree 已存在)→
|
|
98
|
-
* createTaskRecord(Sub Issue,body 含 acceptance criteria、依赖、Closes 约定)关联 Parent。
|
|
99
|
-
*/
|
|
100
|
-
export declare function createTask(input: CreateTaskInput): Promise<CreateTaskResult>;
|
|
101
|
-
export type StartTaskResult = {
|
|
102
|
-
ok: true;
|
|
103
|
-
issueNumber: number;
|
|
104
|
-
branch: string;
|
|
105
|
-
worktreePath: string;
|
|
106
|
-
policy: TddPolicy;
|
|
107
|
-
baseline: WorkspaceBaseline;
|
|
108
|
-
} | {
|
|
109
|
-
ok: false;
|
|
110
|
-
code: string;
|
|
111
|
-
message: string;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* start-task(spec §2.3):前置门禁(Planning Baseline 已合并、依赖 Task 已 merged、并行数 <5)→
|
|
115
|
-
* worktree-start → captureWorkspaceBaseline → freezeTddPolicy → 写 Task Record 状态。
|
|
116
|
-
*/
|
|
117
|
-
export declare function startTask(projectDir: string, parentIssueNumber: number, taskId: string): Promise<StartTaskResult>;
|
|
118
|
-
export type SubmitTaskResult = {
|
|
119
|
-
ok: true;
|
|
120
|
-
prNumber: number;
|
|
121
|
-
evidenceRevision: number;
|
|
122
|
-
warning?: string;
|
|
123
|
-
} | {
|
|
124
|
-
ok: false;
|
|
125
|
-
code: string;
|
|
126
|
-
message: string;
|
|
127
|
-
missing?: string[];
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* submit-task(spec §4.4):TDD 硬门禁——evidence 不完整(无 comment、regression 未 pass、
|
|
131
|
-
* compliance 未 pass)→ 拒绝创建 PR;通过后 push 分支 → gh pr create(body 引用 Task Record +
|
|
132
|
-
* evidence comment 链接,含 Closes 约定)→ 标记 reviewing。
|
|
133
|
-
*/
|
|
134
|
-
export declare function submitTask(projectDir: string, parentIssueNumber: number, taskId: string): Promise<SubmitTaskResult>;
|
|
135
|
-
export type SubmitReviewResult = {
|
|
136
|
-
ok: true;
|
|
137
|
-
prNumber: number;
|
|
138
|
-
verdict: "approve" | "request-changes";
|
|
139
|
-
} | {
|
|
140
|
-
ok: false;
|
|
141
|
-
code: string;
|
|
142
|
-
message: string;
|
|
143
|
-
};
|
|
144
|
-
/** submit-review(spec §2.3):primary 提交 reviewer 双轴审查结果(reviewer 本身只读) */
|
|
145
|
-
export declare function submitReview(prNumber: number, verdict: "approve" | "request-changes", comment?: string): Promise<SubmitReviewResult>;
|
|
146
|
-
export type MergeTaskResult = {
|
|
147
|
-
ok: true;
|
|
148
|
-
prNumber: number;
|
|
149
|
-
risk: "low" | "high";
|
|
150
|
-
warning?: string;
|
|
151
|
-
} | {
|
|
152
|
-
ok: false;
|
|
153
|
-
code: string;
|
|
154
|
-
message: string;
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* merge-task(spec §2.3 + PRD R8):CI checks 通过 + 分支保护 + 风险双层判定(只升不降)+
|
|
158
|
-
* 高风险需非作者人类 approval → mergeTaskPR(--match-head-commit)→ 关闭 Sub Issue →
|
|
159
|
-
* worktree 干净销毁。
|
|
160
|
-
*/
|
|
161
|
-
export declare function mergeTask(projectDir: string, parentIssueNumber: number, taskId: string, modelRisk: "low" | "high"): Promise<MergeTaskResult>;
|
|
162
|
-
/** 将原始 statusCheckRollup 映射为 {name, state}(纯函数,供测试直接验证 jq 语义) */
|
|
163
|
-
export declare function mapCheckRollup(raw: unknown[]): Array<{
|
|
164
|
-
name: string;
|
|
165
|
-
state: string;
|
|
166
|
-
}>;
|
|
167
|
-
export type TaskLifecycleResult = {
|
|
168
|
-
ok: true;
|
|
169
|
-
issueNumber: number;
|
|
170
|
-
} | {
|
|
171
|
-
ok: false;
|
|
172
|
-
code: string;
|
|
173
|
-
message: string;
|
|
174
|
-
};
|
|
175
|
-
export type DestroyTaskWorktreeResult = {
|
|
176
|
-
ok: true;
|
|
177
|
-
reason: string;
|
|
178
|
-
} | {
|
|
179
|
-
ok: false;
|
|
180
|
-
code: string;
|
|
181
|
-
message: string;
|
|
182
|
-
};
|
|
183
|
-
export interface TaskStatusReport {
|
|
184
|
-
task: {
|
|
185
|
-
issueNumber: number;
|
|
186
|
-
slug: string;
|
|
187
|
-
state: string;
|
|
188
|
-
labels: string[];
|
|
189
|
-
};
|
|
190
|
-
pullRequests: Array<{
|
|
191
|
-
number: number;
|
|
192
|
-
state: string;
|
|
193
|
-
headRefName: string;
|
|
194
|
-
checks: Array<{
|
|
195
|
-
name: string;
|
|
196
|
-
state: string;
|
|
197
|
-
}>;
|
|
198
|
-
}>;
|
|
199
|
-
}
|
|
200
|
-
export type TaskStatusResult = {
|
|
201
|
-
ok: true;
|
|
202
|
-
report: TaskStatusReport;
|
|
203
|
-
} | {
|
|
204
|
-
ok: false;
|
|
205
|
-
code: string;
|
|
206
|
-
message: string;
|
|
207
|
-
};
|
|
208
|
-
/** cancel-task:受控取消(user_confirmed)→ 关闭 Sub Issue + 状态标签 cancelled */
|
|
209
|
-
export declare function cancelTask(_projectDir: string, parentIssueNumber: number, taskId: string, userConfirmed: boolean): Promise<TaskLifecycleResult>;
|
|
210
|
-
/** destroy-worktree:preflight 销毁(§3.3),需 user_confirmed(除非 PR 已合并且干净) */
|
|
211
|
-
export declare function destroyTaskWorktree(projectDir: string, parentIssueNumber: number, taskId: string, userConfirmed: boolean): Promise<DestroyTaskWorktreeResult>;
|
|
212
|
-
/** status-task:读 Task Record + PR + checks 汇总 */
|
|
213
|
-
export declare function readTaskStatus(_projectDir: string, parentIssueNumber: number, taskId: string): Promise<TaskStatusResult>;
|