paseo-req-kit 0.0.0-stage → 1.8.0-beta.3

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 (144) hide show
  1. package/CHANGELOG.md +283 -0
  2. package/LICENSE +21 -0
  3. package/README.md +146 -2
  4. package/SCOPE.md +11 -0
  5. package/bin/locate.mjs +46 -0
  6. package/bin/req-doctor.mjs +21 -0
  7. package/bin/req.mjs +179 -0
  8. package/bin/start-pipeline +21 -0
  9. package/bin/start-pipeline.mjs +22 -0
  10. package/config.example.json +132 -0
  11. package/contracts/README.md +18 -0
  12. package/contracts/feature-files.md +117 -0
  13. package/contracts/notifier-event.md +72 -0
  14. package/contracts/result-file.md +21 -0
  15. package/contracts/spec.md +36 -0
  16. package/contracts/state.md +49 -0
  17. package/contracts/verify.md +41 -0
  18. package/docs/adr/0001-step-agents-under-origin-chat.md +15 -0
  19. package/docs/adr/0002-no-directory-switch-in-chat.md +15 -0
  20. package/docs/adr/0003-script-engine-not-hub.md +15 -0
  21. package/docs/adr/0004-result-files.md +15 -0
  22. package/docs/adr/0005-no-default-branch-local-commits-only.md +15 -0
  23. package/docs/adr/0006-skill-install-targets.md +15 -0
  24. package/docs/adr/0007-own-interview-skill.md +15 -0
  25. package/docs/adr/0008-entries-do-not-call-entries.md +15 -0
  26. package/docs/adr/0009-versioned-install-layout.md +15 -0
  27. package/docs/adr/0010-generated-feature-overview.md +15 -0
  28. package/docs/adr/0011-resume-after-completion.md +15 -0
  29. package/docs/adr/0012-review-panel.md +18 -0
  30. package/docs/adr/0013-no-release-tooling.md +15 -0
  31. package/docs/adr/0014-notifier-slot.md +19 -0
  32. package/docs/adr/0015-incremental-continue.md +17 -0
  33. package/docs/adr/0016-upgrade-from-tags.md +19 -0
  34. package/docs/adr/0017-use-paseo-capabilities.md +18 -0
  35. package/docs/adr/0018-own-worktree-option.md +21 -0
  36. package/docs/adr/0019-parallel-orchestration.md +21 -0
  37. package/docs/adr/0020-scheduling-through-the-chat.md +21 -0
  38. package/docs/adr/0021-npm-version-manager.md +19 -0
  39. package/docs/adr/0022-develop-and-verify-phases.md +32 -0
  40. package/docs/adr/0023-types-gate-slices.md +54 -0
  41. package/docs/adr/0024-confirm-early-review-axes.md +27 -0
  42. package/docs/adr/0025-joint-requirements.md +27 -0
  43. package/docs/adr/README.md +29 -0
  44. package/docs/guide//344/275/277/347/224/250/350/200/205/346/214/207/345/215/227.md +96 -0
  45. package/docs/guide//345/256/211/350/243/205/344/270/216/345/215/207/347/272/247.md +348 -0
  46. package/docs/guide//347/273/264/346/212/244/350/200/205/346/214/207/345/215/227.md +85 -0
  47. package/docs/guide//351/241/271/347/233/256/345/256/232/345/210/266/344/270/216/350/277/220/350/241/214/350/247/204/345/210/231.md +356 -0
  48. package/engine/prompts/00-shared-context.md +104 -0
  49. package/engine/prompts/02-spec-review.md +46 -0
  50. package/engine/prompts/03-design.md +73 -0
  51. package/engine/prompts/03a-design-proposal.md +30 -0
  52. package/engine/prompts/04-design-review.md +73 -0
  53. package/engine/prompts/04b-design-revise.md +41 -0
  54. package/engine/prompts/05-implement.md +72 -0
  55. package/engine/prompts/06-code-review.md +70 -0
  56. package/engine/prompts/07-review-fix.md +41 -0
  57. package/engine/prompts/07b-handoff.md +45 -0
  58. package/engine/prompts/08-service-start.md +59 -0
  59. package/engine/prompts/09-verify.md +90 -0
  60. package/engine/prompts/10-defect-fix.md +41 -0
  61. package/engine/prompts/10b-reverify.md +43 -0
  62. package/engine/prompts/11-report.md +112 -0
  63. package/engine/prompts/browser-verify.md +13 -0
  64. package/engine/prompts/incremental.md +22 -0
  65. package/engine/prompts/joint.md +55 -0
  66. package/engine/prompts/panel-member.md +38 -0
  67. package/engine/prompts/paseo-services.md +9 -0
  68. package/engine/prompts/related-repos.md +7 -0
  69. package/engine/prompts/review-axis-spec.md +10 -0
  70. package/engine/prompts/review-axis-standards.md +11 -0
  71. package/engine/prompts/types/assessment.md +41 -0
  72. package/engine/prompts/types/defect.md +55 -0
  73. package/engine/prompts/types/refactor.md +39 -0
  74. package/engine/prompts/verify-deployed.md +14 -0
  75. package/engine/src/activity.ts +87 -0
  76. package/engine/src/cli-args.ts +217 -0
  77. package/engine/src/config.ts +619 -0
  78. package/engine/src/configure.ts +237 -0
  79. package/engine/src/control.ts +246 -0
  80. package/engine/src/daemon-check.ts +104 -0
  81. package/engine/src/daemon-version.ts +66 -0
  82. package/engine/src/digest.ts +142 -0
  83. package/engine/src/doctor.ts +462 -0
  84. package/engine/src/eval.ts +324 -0
  85. package/engine/src/features.ts +270 -0
  86. package/engine/src/gate.ts +157 -0
  87. package/engine/src/git.ts +30 -0
  88. package/engine/src/joint.ts +173 -0
  89. package/engine/src/launch.ts +405 -0
  90. package/engine/src/lessons.ts +72 -0
  91. package/engine/src/locations.ts +55 -0
  92. package/engine/src/main.ts +346 -0
  93. package/engine/src/messages.ts +394 -0
  94. package/engine/src/notifiers.ts +76 -0
  95. package/engine/src/notify-test.ts +101 -0
  96. package/engine/src/paseo-json.ts +73 -0
  97. package/engine/src/paseo-profiles.ts +133 -0
  98. package/engine/src/paseo-runtime.ts +437 -0
  99. package/engine/src/paths.ts +10 -0
  100. package/engine/src/pipeline.ts +1840 -0
  101. package/engine/src/playbooks.ts +46 -0
  102. package/engine/src/preflight.ts +337 -0
  103. package/engine/src/prompts.ts +72 -0
  104. package/engine/src/queue.ts +61 -0
  105. package/engine/src/runtime-loader.ts +14 -0
  106. package/engine/src/runtime.ts +155 -0
  107. package/engine/src/schedule-time.ts +51 -0
  108. package/engine/src/smoke-test.ts +202 -0
  109. package/engine/src/spec-review.ts +100 -0
  110. package/engine/src/state.ts +333 -0
  111. package/engine/src/steps.ts +266 -0
  112. package/engine/src/usage.ts +67 -0
  113. package/engine/src/worktree.ts +72 -0
  114. package/install.mjs +928 -0
  115. package/notifiers/im-template.mjs +60 -0
  116. package/package.json +67 -4
  117. package/principles/INDEX.md +11 -0
  118. package/skills/acceptance-criteria/SKILL.md +61 -0
  119. package/skills/principle-delete-before-add/SKILL.md +33 -0
  120. package/skills/principle-dont-block-on-humans/SKILL.md +35 -0
  121. package/skills/principle-fix-root-cause/SKILL.md +33 -0
  122. package/skills/principle-prove-it-works/SKILL.md +33 -0
  123. package/skills/principle-report-honestly/SKILL.md +33 -0
  124. package/skills/principle-speak-to-reader/SKILL.md +33 -0
  125. package/skills/principle-this-requirement-only/SKILL.md +33 -0
  126. package/skills/req/SKILL.md +101 -0
  127. package/skills/req/playbooks/accept.md +65 -0
  128. package/skills/req/playbooks/change.md +51 -0
  129. package/skills/req/playbooks/incident.md +55 -0
  130. package/skills/req/playbooks/new.md +94 -0
  131. package/skills/req/playbooks/small.md +48 -0
  132. package/skills/req/playbooks/status.md +41 -0
  133. package/skills/req/playbooks/takeover.md +51 -0
  134. package/skills/req/playbooks/verify.md +57 -0
  135. package/skills/req-doctor/SKILL.md +36 -0
  136. package/skills/req-retro/SKILL.md +81 -0
  137. package/skills/req-setup/SKILL.md +118 -0
  138. package/skills/req-setup/templates/paseo/copy-local-files.mjs +32 -0
  139. package/skills/req-setup/templates/paseo/with-port.mjs +36 -0
  140. package/skills/requirement-interview/SKILL.md +97 -0
  141. package/skills/requirement-kickoff/SKILL.md +17 -0
  142. package/skills/result-report/SKILL.md +34 -0
  143. package/skills/spec-writing/SKILL.md +55 -0
  144. package/skills/spec-writing/spec-template.md +109 -0
@@ -0,0 +1,217 @@
1
+ import path from "node:path";
2
+ import { parseArgs } from "node:util";
3
+ import { type DefectHandling, PHASE_MODES, type PhaseMode, type ProfileName, type VerifyEnvironment } from "./config.js";
4
+ import { LAUNCHER } from "./locations.js";
5
+ import type { LaunchArgs } from "./preflight.js";
6
+
7
+ export { LAUNCHER };
8
+
9
+ export const USAGE = `用法:
10
+ start-pipeline --feature <功能目录> [--profile quick|standard] [--resume | --restart]
11
+ start-pipeline [--feature <功能目录>] --status 查看进度(不写 --feature 时:工作区里只有一个需求运行过就看它)
12
+ start-pipeline --feature <功能目录> --stop 停止(之后可用 --resume 继续)
13
+ start-pipeline --list 列出这个项目所有工作区中的需求
14
+ start-pipeline --feature <功能目录> --spec-review 确认前请另一个模型独立审阅需求说明草稿(后台进行,结果发回对话)
15
+ start-pipeline --feature <功能目录> --worktree 为这个需求新建 Paseo worktree 工作区并在那里开发(对话目录不变)
16
+ start-pipeline --feature <功能目录> --at 22:00 预约在指定时间开始(也可以写"明天 8:30""2026-10-14 08:30""+2h")
17
+ start-pipeline --feature <功能目录> --phases gated 分阶段:研发完成后停下等待测试验证(continuous | gated | develop-only)
18
+ start-pipeline --feature <功能目录> --phase verify 开始测试验证阶段(研发阶段完成后;可以加 --at 预约)
19
+ start-pipeline --feature <功能目录> --approve 需求方确认了方案(方案确认点),继续开发
20
+
21
+ 其他选项:[--repo <仓库目录>] [--origin-agent <agent ID>] [--config <配置文件>]
22
+
23
+ --feature 功能目录,相对于仓库目录,例如 docs/features/20261012-sms-login;
24
+ 也可以只写目录名(20261012-sms-login)或其中能唯一确定的一部分(sms-login)
25
+ --repo 仓库目录。在 Paseo 的聊天中运行时默认为该聊天的工作目录,否则为当前目录
26
+ --origin-agent 发起对话的 agent ID。在 Paseo 的聊天中运行时默认为该聊天(PASEO_AGENT_ID),
27
+ 流水线会把进展和结果发回这个对话;在聊天之外运行且不传时,只写日志。
28
+ --profile 档位:quick(快速,小改动)或 standard(标准)。不传时读取 spec 中的"档位",
29
+ 再不行用配置中的 defaultProfile
30
+ --resume 从上次中断处继续
31
+ --restart 丢弃上次的结果,完全从零开始(不参考上次的方案和代码)
32
+ --phases 执行方式:continuous(连续,默认)、gated(分阶段)、develop-only(只做研发)。
33
+ 不传时读取 spec 中的"执行方式",再不行用配置中的 phases.mode
34
+ --phase verify 开始测试验证阶段(等同于 --resume;研发完成、待测试验证时单独的 --resume 效果相同)
35
+ --verify-at 分阶段时,研发完成后在这个时间自动开始测试验证(写法同 --at)
36
+ --verify-env 测试验证的环境:local(本地启动服务)或 deployed(已部署的测试环境,需要 test-env.md)
37
+ --defects 测试验证发现缺陷时:fix(当场修复并复验)、handback(退回研发阶段修复)、report(只记录)
38
+ --approve 方案确认点:需求方看过 preview.md 并确认,继续开发(等同于 --resume 加上确认)
39
+ --config 配置文件,默认为 ~/.req-kit/config.json(可用环境变量 REQ_KIT_HOME 改变目录)`;
40
+
41
+ export function parseLaunchArgs(argv: string[]): LaunchArgs {
42
+ const { values } = parseArgs({
43
+ args: argv,
44
+ options: {
45
+ feature: { type: "string" },
46
+ repo: { type: "string" },
47
+ "origin-agent": { type: "string" },
48
+ resume: { type: "boolean", default: false },
49
+ restart: { type: "boolean", default: false },
50
+ config: { type: "string" },
51
+ profile: { type: "string" },
52
+ status: { type: "boolean", default: false },
53
+ stop: { type: "boolean", default: false },
54
+ list: { type: "boolean", default: false },
55
+ "spec-review": { type: "boolean", default: false },
56
+ worktree: { type: "boolean", default: false },
57
+ "source-repo": { type: "string" },
58
+ "workspace-id": { type: "string" },
59
+ at: { type: "string" },
60
+ phases: { type: "string" },
61
+ phase: { type: "string" },
62
+ "verify-at": { type: "string" },
63
+ "verify-env": { type: "string" },
64
+ defects: { type: "string" },
65
+ approve: { type: "boolean", default: false },
66
+ help: { type: "boolean", default: false },
67
+ },
68
+ strict: true,
69
+ });
70
+ if (values.help) {
71
+ console.log(USAGE);
72
+ process.exit(0);
73
+ }
74
+ if (!values.feature && !values.list && !values.status) {
75
+ throw new Error(`缺少 --feature\n\n${USAGE}`);
76
+ }
77
+ const profile = values.profile?.trim().toLowerCase();
78
+ if (profile !== undefined && profile !== "quick" && profile !== "standard") {
79
+ throw new Error(`--profile 只能是 quick 或 standard,收到 "${values.profile}"`);
80
+ }
81
+ if ([values.status, values.stop, values.resume, values.restart, values["spec-review"]].filter(Boolean).length > 1) {
82
+ throw new Error("--status、--stop、--resume、--restart、--spec-review 一次只能用一个");
83
+ }
84
+ if (values.at && (values.status || values.stop || values["spec-review"] || values.resume)) {
85
+ throw new Error("--at 只用于启动(预约开始时间)");
86
+ }
87
+ if (values.worktree && (values.status || values.stop || values["spec-review"] || values.resume)) {
88
+ throw new Error("--worktree 只用于第一次启动(或 --restart)");
89
+ }
90
+ const phases = values.phases?.trim().toLowerCase();
91
+ if (phases !== undefined && !PHASE_MODES.includes(phases as PhaseMode)) {
92
+ throw new Error(`--phases 只能是 ${PHASE_MODES.join("、")},收到 "${values.phases}"`);
93
+ }
94
+ const phase = values.phase?.trim().toLowerCase();
95
+ if (phase !== undefined && phase !== "verify") throw new Error(`--phase 只能是 verify,收到 "${values.phase}"`);
96
+ if (phase && (values.status || values.stop || values["spec-review"] || values.restart || values.worktree)) {
97
+ throw new Error("--phase verify 只用于开始(或继续)测试验证阶段");
98
+ }
99
+ const verifyEnv = values["verify-env"]?.trim().toLowerCase();
100
+ if (verifyEnv !== undefined && verifyEnv !== "local" && verifyEnv !== "deployed") {
101
+ throw new Error(`--verify-env 只能是 local 或 deployed,收到 "${values["verify-env"]}"`);
102
+ }
103
+ const defects = values.defects?.trim().toLowerCase();
104
+ if (defects !== undefined && !["fix", "handback", "report"].includes(defects)) {
105
+ throw new Error(`--defects 只能是 fix、handback 或 report,收到 "${values.defects}"`);
106
+ }
107
+ if (values.approve && (values.status || values.stop || values["spec-review"] || values.restart || values.worktree || phase || values.at)) {
108
+ throw new Error("--approve 只用于确认等待中的方案并继续开发");
109
+ }
110
+ // In a Paseo chat, the chat itself is the origin unless told otherwise.
111
+ const origin = (values["origin-agent"] ?? process.env.PASEO_AGENT_ID)?.trim();
112
+ return {
113
+ // In a Paseo chat, the chat's working directory is the repository.
114
+ repo: path.resolve(values.repo ?? process.env.PASEO_AGENT_CWD ?? process.cwd()),
115
+ featureDir: values.feature ?? "",
116
+ originAgentId: origin ? origin : null,
117
+ resume: (values.resume ?? false) || phase === "verify" || (values.approve ?? false),
118
+ restart: values.restart ?? false,
119
+ configPath: values.config ? path.resolve(values.config) : null,
120
+ profile: (profile as ProfileName | undefined) ?? null,
121
+ status: values.status ?? false,
122
+ stop: values.stop ?? false,
123
+ list: values.list ?? false,
124
+ specReview: values["spec-review"] ?? false,
125
+ worktree: values.worktree ?? false,
126
+ sourceRepo: values["source-repo"] ? path.resolve(values["source-repo"]) : null,
127
+ workspaceId: values["workspace-id"] ?? null,
128
+ at: values.at ?? null,
129
+ phases: (phases as PhaseMode | undefined) ?? null,
130
+ phase: phase === "verify" ? "verify" : null,
131
+ verifyAt: values["verify-at"] ?? null,
132
+ verifyEnv: (verifyEnv as VerifyEnvironment | undefined) ?? null,
133
+ defects: (defects as DefectHandling | undefined) ?? null,
134
+ approve: values.approve ?? false,
135
+ };
136
+ }
137
+
138
+ /** Double quotes work in bash, PowerShell and cmd alike; backslash paths are always quoted for bash. */
139
+ function quote(value: string): string {
140
+ return /^[\w@%+=:,./-]+$/.test(value) ? value : `"${value.replace(/"/g, '\\"')}"`;
141
+ }
142
+
143
+ /**
144
+ * The command a chat agent runs to continue this pipeline. The origin chat is not
145
+ * named: run from a chat, that chat becomes the origin; run elsewhere, the previous
146
+ * origin is kept.
147
+ */
148
+ /** The command a chat agent runs to see progress (same shape as resumeCommand). */
149
+ export function statusCommand(args: { repo: string; featureDir: string; configPath: string | null }): string {
150
+ return resumeCommand(args).replace(/ --resume$/, " --status");
151
+ }
152
+
153
+ /** The full start command, for a start scheduled for later (--at). */
154
+ export function startCommand(args: {
155
+ repo: string;
156
+ featureDir: string;
157
+ configPath: string | null;
158
+ profile: string | null;
159
+ worktree: boolean;
160
+ phases?: string | null;
161
+ verifyAt?: string | null;
162
+ }): string {
163
+ const parts = ["node", LAUNCHER, "--repo", args.repo, "--feature", args.featureDir];
164
+ if (args.configPath) parts.push("--config", args.configPath);
165
+ if (args.profile) parts.push("--profile", args.profile);
166
+ if (args.worktree) parts.push("--worktree");
167
+ if (args.phases) parts.push("--phases", args.phases);
168
+ if (args.verifyAt) parts.push("--verify-at", args.verifyAt);
169
+ return parts.map(quote).join(" ");
170
+ }
171
+
172
+ /** The command that confirms a design waiting at the confirmation point. */
173
+ export function approveCommand(args: { repo: string; featureDir: string; configPath: string | null }): string {
174
+ return resumeCommand(args).replace(/ --resume$/, " --approve");
175
+ }
176
+
177
+ /** The command that starts the verify phase once development is done. */
178
+ export function verifyCommand(args: {
179
+ repo: string;
180
+ featureDir: string;
181
+ configPath: string | null;
182
+ verifyEnv?: string | null;
183
+ defects?: string | null;
184
+ }): string {
185
+ const extra = [args.verifyEnv ? ` --verify-env ${args.verifyEnv}` : "", args.defects ? ` --defects ${args.defects}` : ""].join("");
186
+ return `${resumeCommand(args)} --phase verify${extra}`;
187
+ }
188
+
189
+ export function resumeCommand(args: { repo: string; featureDir: string; configPath: string | null }): string {
190
+ const parts = ["node", LAUNCHER, "--repo", args.repo, "--feature", args.featureDir];
191
+ if (args.configPath) parts.push("--config", args.configPath);
192
+ parts.push("--resume");
193
+ return parts.map(quote).join(" ");
194
+ }
195
+
196
+ /**
197
+ * Arguments for the pipeline process, rebuilt from what the launcher resolved (short
198
+ * feature names, a requirement's own worktree), so both processes see the same thing.
199
+ */
200
+ export function launchArgv(args: LaunchArgs): string[] {
201
+ const out = ["--repo", args.repo, "--feature", args.featureDir];
202
+ if (args.originAgentId) out.push("--origin-agent", args.originAgentId);
203
+ if (args.configPath) out.push("--config", args.configPath);
204
+ if (args.profile) out.push("--profile", args.profile);
205
+ if (args.resume) out.push("--resume");
206
+ if (args.restart) out.push("--restart");
207
+ if (args.sourceRepo) out.push("--source-repo", args.sourceRepo);
208
+ if (args.workspaceId) out.push("--workspace-id", args.workspaceId);
209
+ if (args.specReview) out.push("--spec-review");
210
+ if (args.phases) out.push("--phases", args.phases);
211
+ if (args.phase) out.push("--phase", args.phase);
212
+ if (args.verifyAt) out.push("--verify-at", args.verifyAt);
213
+ if (args.verifyEnv) out.push("--verify-env", args.verifyEnv);
214
+ if (args.defects) out.push("--defects", args.defects);
215
+ if (args.approve) out.push("--approve");
216
+ return out;
217
+ }