@openprd/cli 0.1.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/.openprd/README.md +82 -0
- package/.openprd/benchmarks/evidence/milvus-io-ai-code-review-gets-better-when-models-debate-claude-vs-gemini-vs-code.md +14 -0
- package/.openprd/benchmarks/evidence/nolanlawson-com-using-ai-to-write-better-code-more-slowly.md +14 -0
- package/.openprd/benchmarks/index.md +37 -0
- package/.openprd/benchmarks/sources.yaml +56 -0
- package/.openprd/config.yaml +50 -0
- package/.openprd/discovery/config.json +21 -0
- package/.openprd/engagements/active/flows.md +30 -0
- package/.openprd/engagements/active/handoff.md +9 -0
- package/.openprd/engagements/active/intake.md +15 -0
- package/.openprd/engagements/active/prd.md +161 -0
- package/.openprd/engagements/active/review.html +61 -0
- package/.openprd/engagements/active/roles.md +21 -0
- package/.openprd/engagements/work-units/wu-20260524015648-6d33ded7.json +23 -0
- package/.openprd/exports/.gitkeep +0 -0
- package/.openprd/knowledge/index.json +7 -0
- package/.openprd/quality/config.json +229 -0
- package/.openprd/reviews/v0001.html +1256 -0
- package/.openprd/schema/diagram-architecture.schema.yaml +49 -0
- package/.openprd/schema/diagram-product-flow.schema.yaml +52 -0
- package/.openprd/schema/prd.schema.yaml +121 -0
- package/.openprd/sessions/.gitkeep +0 -0
- package/.openprd/standards/config.json +88 -0
- package/.openprd/standards/file-manual-template.md +28 -0
- package/.openprd/standards/folder-readme-template.md +28 -0
- package/.openprd/state/.gitkeep +0 -0
- package/.openprd/state/changes.json +12 -0
- package/.openprd/state/current.json +169 -0
- package/.openprd/state/version-index.json +15 -0
- package/.openprd/state/versions/.gitkeep +0 -0
- package/.openprd/state/versions/v0001.json +121 -0
- package/.openprd/state/versions/v0001.md +161 -0
- package/.openprd/templates/agent/intake.md +6 -0
- package/.openprd/templates/agent/prd.md +21 -0
- package/.openprd/templates/b2b/intake.md +6 -0
- package/.openprd/templates/b2b/prd.md +24 -0
- package/.openprd/templates/base/intake.md +18 -0
- package/.openprd/templates/base/prd.md +67 -0
- package/.openprd/templates/company/README.md +10 -0
- package/.openprd/templates/consumer/intake.md +6 -0
- package/.openprd/templates/consumer/prd.md +19 -0
- package/.openprd/templates/diagram/architecture.contract.json +53 -0
- package/.openprd/templates/diagram/product-flow.contract.json +76 -0
- package/.openprd/templates/industry/README.md +16 -0
- package/.openprd/templates/manifest.yaml +27 -0
- package/.openprd/templates/project/README.md +14 -0
- package/.openprd/templates/session/README.md +14 -0
- package/AGENTS.md +44 -0
- package/CONTRIBUTING.md +30 -0
- package/LICENSE +21 -0
- package/README.md +727 -0
- package/README_CN.md +583 -0
- package/SECURITY.md +23 -0
- package/bin/openprd.js +5 -0
- package/docs/assets/openprd-capability-overview-en.png +0 -0
- package/docs/assets/openprd-capability-overview-zh.png +0 -0
- package/docs/assets/openprd-learning-html.png +0 -0
- package/docs/assets/openprd-quality-html.png +0 -0
- package/docs/assets/openprd-review-html.png +0 -0
- package/docs/assets/openprd-scenario-overview.png +0 -0
- package/docs/assets/openprd-scenario-overview.svg +114 -0
- package/docs/assets/openprd-self-evolving-mechanisms-en.png +0 -0
- package/docs/assets/openprd-self-evolving-mechanisms-zh.png +0 -0
- package/docs/assets/openprd-visual-compare-case-study-en.png +0 -0
- package/docs/assets/openprd-visual-compare-case-study-zh.png +0 -0
- package/package.json +59 -0
- package/scripts/openprd-dev-check.mjs +5 -0
- package/scripts/openprd-review-presentation.mjs +82 -0
- package/skills/openprd-benchmark-router/SKILL.md +92 -0
- package/skills/openprd-benchmark-router/agents/openai.yaml +4 -0
- package/skills/openprd-benchmark-router/references/benchmark-sources.md +74 -0
- package/skills/openprd-benchmark-router/references/evaluation-lenses.md +66 -0
- package/skills/openprd-benchmark-router/references/source-policy.md +35 -0
- package/skills/openprd-diagram-review/SKILL.md +91 -0
- package/skills/openprd-diagram-review/agents/openai.yaml +4 -0
- package/skills/openprd-diagram-review/examples/architecture-zh.md +8 -0
- package/skills/openprd-diagram-review/examples/product-flow-zh.md +7 -0
- package/skills/openprd-diagram-review/references/cocoon-patterns.md +17 -0
- package/skills/openprd-diagram-review/references/diagram-contracts.md +126 -0
- package/skills/openprd-diagram-review/references/review-checklist.md +10 -0
- package/skills/openprd-discovery-loop/SKILL.md +196 -0
- package/skills/openprd-discovery-loop/agents/openai.yaml +3 -0
- package/skills/openprd-harness/SKILL.md +179 -0
- package/skills/openprd-harness/agents/openai.yaml +4 -0
- package/skills/openprd-harness/examples/full-workflow-zh.md +9 -0
- package/skills/openprd-harness/references/command-map.md +71 -0
- package/skills/openprd-harness/references/examples.md +26 -0
- package/skills/openprd-harness/references/usage-guide.md +335 -0
- package/skills/openprd-harness/references/workflow-gates.md +51 -0
- package/skills/openprd-learning-review/SKILL.md +75 -0
- package/skills/openprd-learning-review/agents/openai.yaml +4 -0
- package/skills/openprd-learning-review/references/content-contract.md +125 -0
- package/skills/openprd-learning-review/references/ebook-reader.md +46 -0
- package/skills/openprd-learning-review/references/evidence-manifest.md +55 -0
- package/skills/openprd-learning-review/references/genre-library.md +43 -0
- package/skills/openprd-learning-review/references/prompt-engineering.md +71 -0
- package/skills/openprd-learning-review/references/quality-rubric.md +28 -0
- package/skills/openprd-learning-review/references/retrieval-worked-example.md +40 -0
- package/skills/openprd-learning-review/references/style-packs/xianxia-cultivation.prompt.md +67 -0
- package/skills/openprd-quality/SKILL.md +101 -0
- package/skills/openprd-requirement-intake/SKILL.md +76 -0
- package/skills/openprd-requirement-intake/agents/openai.yaml +4 -0
- package/skills/openprd-requirement-intake/references/prd-template-lenses.md +105 -0
- package/skills/openprd-requirement-intake/references/routing-rubric.md +64 -0
- package/skills/openprd-router/SKILL.md +40 -0
- package/skills/openprd-shared/SKILL.md +142 -0
- package/skills/openprd-shared/agents/openai.yaml +4 -0
- package/skills/openprd-shared/references/language-and-review.md +50 -0
- package/skills/openprd-shared/references/operating-rules.md +65 -0
- package/skills/openprd-shared/references/skill-architecture.md +70 -0
- package/skills/openprd-standards/SKILL.md +79 -0
- package/skills/openprd-standards/agents/openai.yaml +4 -0
- package/src/agent-integration.js +1717 -0
- package/src/benchmark.js +873 -0
- package/src/cli/args.js +460 -0
- package/src/cli/print.js +1423 -0
- package/src/codex-hook-runner-template.mjs +2422 -0
- package/src/dev-standards.js +372 -0
- package/src/diagram-core.js +1047 -0
- package/src/diagram-workspace.js +262 -0
- package/src/discovery.js +709 -0
- package/src/fleet.js +531 -0
- package/src/fs-utils.js +83 -0
- package/src/growth.js +545 -0
- package/src/html-artifacts.js +3803 -0
- package/src/knowledge.js +668 -0
- package/src/language-policy.js +142 -0
- package/src/learning-review.js +1655 -0
- package/src/loop.js +1290 -0
- package/src/openprd.js +1136 -0
- package/src/openspec/change-lifecycle.js +359 -0
- package/src/openspec/change-validate.js +248 -0
- package/src/openspec/constants.js +12 -0
- package/src/openspec/execute.js +300 -0
- package/src/openspec/generate.js +692 -0
- package/src/openspec/paths.js +111 -0
- package/src/openspec/tasks.js +352 -0
- package/src/prd-core.js +656 -0
- package/src/quality-html-artifact.js +1414 -0
- package/src/quality-learning.js +658 -0
- package/src/quality.js +1262 -0
- package/src/review-presentation.js +240 -0
- package/src/run-harness.js +1470 -0
- package/src/self-update.js +329 -0
- package/src/session-binding.js +140 -0
- package/src/source-inventory.js +224 -0
- package/src/standards.js +914 -0
- package/src/time.js +33 -0
- package/src/visual-compare.js +216 -0
- package/src/work-unit-migration.js +232 -0
- package/src/work-unit.js +88 -0
- package/src/workspace-core.js +1706 -0
- package/src/workspace-registry.js +162 -0
- package/src/workspace-workflow.js +1797 -0
package/src/cli/args.js
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
function parseCommandArgs(argv) {
|
|
2
|
+
const args = [...argv];
|
|
3
|
+
const flags = { json: false, force: false, open: false, append: false, init: false, check: false, review: false, reject: false, resume: false, advance: false, verify: false, next: false, generate: false, validate: false, apply: false, archive: false, activate: false, close: false, keep: false, write: false, dryRun: false, fleet: false, updateOpenprd: false, backfillWorkUnits: false, syncRegistry: false, setupMissing: false, doctor: false, context: false, recordHook: false, plan: false, prompt: false, loopRun: false, finish: false, commit: false, html: false, template: false, failOnViolation: false, mark: null, type: 'architecture', mode: 'auto', input: null, field: null, value: null, jsonFile: null, artifactMarkdown: null, contentJson: null, presentation: null, source: null, reference: null, actual: null, out: null, format: null, quality: null, maxPanelWidth: null, referenceLabel: null, actualLabel: null, classifyExternal: null, maxIterations: null, maxDepth: null, include: null, exclude: null, report: null, item: null, id: null, status: null, claim: null, notes: null, confidence: null, change: null, tools: 'all', hookProfile: null, templatePack: null, target: 'openprd', targetRoot: null, path: null, productType: null, title: null, owner: null, problem: null, whyNow: null, evidence: null, from: null, to: null, version: null, digest: null, workUnit: null, event: null, risk: null, outcome: null, preview: null, learn: null, genre: null, style: null, topic: null, enable: false, disable: false, agent: 'codex', agentCommand: null, message: null };
|
|
4
|
+
const positionals = [];
|
|
5
|
+
|
|
6
|
+
while (args.length > 0) {
|
|
7
|
+
const arg = args.shift();
|
|
8
|
+
if (arg === '--json') {
|
|
9
|
+
flags.json = true;
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
if (arg === '--force') {
|
|
13
|
+
flags.force = true;
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (arg === '--open') {
|
|
17
|
+
flags.open = true;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (arg === '--enable') {
|
|
21
|
+
flags.enable = true;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
if (arg === '--disable') {
|
|
25
|
+
flags.disable = true;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (arg === '--append') {
|
|
29
|
+
flags.append = true;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (arg === '--init') {
|
|
33
|
+
flags.init = true;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (arg === '--check') {
|
|
37
|
+
flags.check = true;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (arg === '--review') {
|
|
41
|
+
flags.review = true;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (arg === '--reject') {
|
|
45
|
+
flags.reject = true;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (arg === '--resume') {
|
|
49
|
+
flags.resume = true;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (arg === '--advance') {
|
|
53
|
+
flags.advance = true;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (arg === '--verify') {
|
|
57
|
+
flags.verify = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (arg === '--generate') {
|
|
61
|
+
flags.generate = true;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (arg === '--validate') {
|
|
65
|
+
flags.validate = true;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (arg === '--apply') {
|
|
69
|
+
flags.apply = true;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (arg === '--archive') {
|
|
73
|
+
flags.archive = true;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (arg === '--activate') {
|
|
77
|
+
flags.activate = true;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (arg === '--close') {
|
|
81
|
+
flags.close = true;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (arg === '--keep') {
|
|
85
|
+
flags.keep = true;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (arg === '--dry-run') {
|
|
89
|
+
flags.dryRun = true;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (arg === '--fleet') {
|
|
93
|
+
flags.fleet = true;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
if (arg === '--write') {
|
|
97
|
+
flags.write = true;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (arg === '--fail-on-violation') {
|
|
101
|
+
flags.failOnViolation = true;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (arg === '--plan') {
|
|
105
|
+
flags.plan = true;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (arg === '--prompt') {
|
|
109
|
+
flags.prompt = true;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (arg === '--run') {
|
|
113
|
+
flags.loopRun = true;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (arg === '--finish') {
|
|
117
|
+
flags.finish = true;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (arg === '--commit') {
|
|
121
|
+
flags.commit = true;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (arg === '--html') {
|
|
125
|
+
flags.html = true;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (arg === '--template') {
|
|
129
|
+
flags.template = true;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (arg === '--update-openprd') {
|
|
133
|
+
flags.updateOpenprd = true;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (arg === '--backfill-work-units') {
|
|
137
|
+
flags.backfillWorkUnits = true;
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (arg === '--sync-registry') {
|
|
141
|
+
flags.syncRegistry = true;
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (arg === '--setup-missing') {
|
|
145
|
+
flags.setupMissing = true;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (arg === '--doctor') {
|
|
149
|
+
flags.doctor = true;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (arg === '--context') {
|
|
153
|
+
flags.context = true;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (arg === '--record-hook') {
|
|
157
|
+
flags.recordHook = true;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (arg === '--next') {
|
|
161
|
+
flags.next = true;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (arg === '--mark') {
|
|
165
|
+
flags.mark = args.shift() ?? null;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
if (arg === '--template-pack' || arg === '-t') {
|
|
169
|
+
flags.templatePack = args.shift() ?? null;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (arg === '--tools') {
|
|
173
|
+
flags.tools = args.shift() ?? 'all';
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (arg === '--hook-profile') {
|
|
177
|
+
flags.hookProfile = args.shift() ?? null;
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (arg === '--agent') {
|
|
181
|
+
flags.agent = args.shift() ?? 'codex';
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
if (arg === '--agent-command') {
|
|
185
|
+
flags.agentCommand = args.shift() ?? null;
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (arg === '--product-type' || arg === '-P') {
|
|
189
|
+
flags.productType = args.shift() ?? null;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (arg === '--type') {
|
|
193
|
+
flags.type = args.shift() ?? 'architecture';
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (arg === '--mode') {
|
|
197
|
+
flags.mode = args.shift() ?? 'auto';
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (arg === '--input') {
|
|
201
|
+
flags.input = args.shift() ?? null;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (arg === '--field') {
|
|
205
|
+
flags.field = args.shift() ?? null;
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (arg === '--value') {
|
|
209
|
+
flags.value = args.shift() ?? null;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (arg === '--json-file') {
|
|
213
|
+
flags.jsonFile = args.shift() ?? null;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (arg === '--artifact-markdown') {
|
|
217
|
+
flags.artifactMarkdown = args.shift() ?? null;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (arg === '--content-json') {
|
|
221
|
+
flags.contentJson = args.shift() ?? null;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (arg === '--presentation') {
|
|
225
|
+
flags.presentation = args.shift() ?? null;
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
if (arg === '--source') {
|
|
229
|
+
flags.source = args.shift() ?? null;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (arg === '--reference') {
|
|
233
|
+
flags.reference = args.shift() ?? null;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (arg === '--actual') {
|
|
237
|
+
flags.actual = args.shift() ?? null;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (arg === '--out') {
|
|
241
|
+
flags.out = args.shift() ?? null;
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (arg === '--format') {
|
|
245
|
+
flags.format = args.shift() ?? null;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (arg === '--quality') {
|
|
249
|
+
flags.quality = args.shift() ?? null;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (arg === '--max-panel-width') {
|
|
253
|
+
flags.maxPanelWidth = args.shift() ?? null;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (arg === '--reference-label') {
|
|
257
|
+
flags.referenceLabel = args.shift() ?? null;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (arg === '--actual-label') {
|
|
261
|
+
flags.actualLabel = args.shift() ?? null;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (arg === '--classify-external') {
|
|
265
|
+
flags.classifyExternal = args.shift() ?? '';
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (arg === '--max-iterations') {
|
|
269
|
+
flags.maxIterations = args.shift() ?? null;
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
if (arg === '--max-depth') {
|
|
273
|
+
flags.maxDepth = args.shift() ?? null;
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
if (arg === '--include') {
|
|
277
|
+
flags.include = args.shift() ?? null;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (arg === '--exclude') {
|
|
281
|
+
flags.exclude = args.shift() ?? null;
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
if (arg === '--report') {
|
|
285
|
+
flags.report = args[0] && !args[0].startsWith('-') ? args.shift() : true;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (arg === '--item') {
|
|
289
|
+
flags.item = args.shift() ?? null;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (arg === '--id') {
|
|
293
|
+
flags.id = args.shift() ?? null;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (arg === '--status') {
|
|
297
|
+
flags.status = args.shift() ?? null;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (arg === '--claim') {
|
|
301
|
+
flags.claim = args.shift() ?? null;
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if (arg === '--notes') {
|
|
305
|
+
flags.notes = args.shift() ?? null;
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
if (arg === '--confidence') {
|
|
309
|
+
flags.confidence = args.shift() ?? null;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
if (arg === '--change') {
|
|
313
|
+
flags.change = args.shift() ?? null;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
if (arg === '--title') {
|
|
317
|
+
flags.title = args.shift() ?? null;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (arg === '--genre') {
|
|
321
|
+
flags.genre = args.shift() ?? null;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (arg === '--style' || arg === '--substyle') {
|
|
325
|
+
flags.style = args.shift() ?? null;
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
if (arg === '--topic') {
|
|
329
|
+
flags.topic = args.shift() ?? null;
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
if (arg === '--owner') {
|
|
333
|
+
flags.owner = args.shift() ?? null;
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (arg === '--problem') {
|
|
337
|
+
flags.problem = args.shift() ?? null;
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
if (arg === '--why-now') {
|
|
341
|
+
flags.whyNow = args.shift() ?? null;
|
|
342
|
+
continue;
|
|
343
|
+
}
|
|
344
|
+
if (arg === '--evidence') {
|
|
345
|
+
flags.evidence = args.shift() ?? null;
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
if (arg === '--event') {
|
|
349
|
+
flags.event = args.shift() ?? null;
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
if (arg === '--risk') {
|
|
353
|
+
flags.risk = args.shift() ?? null;
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
if (arg === '--outcome') {
|
|
357
|
+
flags.outcome = args.shift() ?? null;
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (arg === '--preview') {
|
|
361
|
+
flags.preview = args.shift() ?? null;
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (arg === '--message') {
|
|
365
|
+
flags.message = args.shift() ?? null;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
if (arg === '--learn') {
|
|
369
|
+
flags.learn = args[0] && !args[0].startsWith('-') ? args.shift() : true;
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (arg === '--from') {
|
|
373
|
+
flags.from = args.shift() ?? null;
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
if (arg === '--to') {
|
|
377
|
+
flags.to = args.shift() ?? null;
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
if (arg === '--version') {
|
|
381
|
+
flags.version = args.shift() ?? null;
|
|
382
|
+
continue;
|
|
383
|
+
}
|
|
384
|
+
if (arg === '--digest') {
|
|
385
|
+
flags.digest = args.shift() ?? null;
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (arg === '--work-unit' || arg === '--work-unit-id') {
|
|
389
|
+
flags.workUnit = args.shift() ?? null;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if (arg === '--target') {
|
|
393
|
+
flags.target = args.shift() ?? 'openprd';
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
if (arg === '--target-root') {
|
|
397
|
+
flags.targetRoot = args.shift() ?? null;
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
if (arg === '--path' || arg === '-p') {
|
|
401
|
+
flags.path = args.shift() ?? null;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (arg.startsWith('-')) {
|
|
405
|
+
positionals.push(arg);
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
positionals.push(arg);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
return { flags, positionals };
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function usage() {
|
|
415
|
+
return [
|
|
416
|
+
'OpenPrd CLI',
|
|
417
|
+
'',
|
|
418
|
+
'Usage:',
|
|
419
|
+
' openprd init [path] [--template-pack <base|consumer|b2b|agent>] [--tools <all|codex,claude,cursor>] [--hook-profile <lite|guarded|full>] [--force]',
|
|
420
|
+
' openprd setup [path] [--tools <all|codex,claude,cursor>] [--hook-profile <lite|guarded|full>] [--force] [--json]',
|
|
421
|
+
' openprd update [path] [--tools <all|codex,claude,cursor>] [--hook-profile <lite|guarded|full>] [--force] [--json]',
|
|
422
|
+
' openprd self-update [--dry-run] [--json]',
|
|
423
|
+
' openprd upgrade [path] [--fleet] [--dry-run] [--tools <all|codex,claude,cursor>] [--hook-profile <lite|guarded|full>] [--max-depth <n>] [--include <csv>] [--exclude <csv>] [--report <file>] [--force] [--json]',
|
|
424
|
+
' openprd doctor [path] [--tools <all|codex,claude,cursor>] [--hook-profile <lite|guarded|full>] [--json]',
|
|
425
|
+
' openprd fleet <root> [--dry-run|--doctor|--update-openprd|--backfill-work-units|--sync-registry|--setup-missing] [--hook-profile <lite|guarded|full>] [--max-depth <n>] [--include <csv>] [--exclude <csv>] [--report <file>] [--json]',
|
|
426
|
+
' openprd run [path] [--context|--verify|--record-hook --event <name> --risk <level> --outcome <text> --preview <text>] [--message <text>] [--json]',
|
|
427
|
+
' openprd loop [path] [--init|--plan|--next|--prompt|--run|--verify|--finish] [--change <id>] [--item <task-id-or-handle>] [--agent <codex|claude>] [--agent-command <cmd>] [--commit] [--dry-run] [--message <text>] [--json]',
|
|
428
|
+
' openprd classify [path] <consumer|b2b|agent>',
|
|
429
|
+
' openprd clarify [path] [--mode <auto|inline|inline-with-checklist>] [--json]',
|
|
430
|
+
' openprd capture [path] (--field <section.path> --value <text|json> | --json-file <answers.json> | --artifact-markdown <artifact.md>) [--source <user-confirmed|project-derived|agent-inferred|agent-normalized>] [--append] [--json]',
|
|
431
|
+
' openprd interview [path] [--product-type <consumer|b2b|agent>]',
|
|
432
|
+
' openprd playground [path] [--open] [--json]',
|
|
433
|
+
' openprd learn [path] [--topic <text>] [--genre <internet-product|scientific|fairy-tale|web-novel|xianxia>] [--style <substyle>] [--source <workspace|docs|loop|all>] [--content-json <file>] [--open] [--enable|--disable] [--json]',
|
|
434
|
+
' openprd quality [path] [--init|--verify|--report --html|--learn [--review] --from <report-id-or-json-or-diagnostics-or-turn-state>] [--force] [--json]',
|
|
435
|
+
' openprd visual-compare [path] --reference <effect-image> --actual <screenshot-image> [--out <file.jpg>] [--format <jpg|png|webp>] [--quality <1..100>] [--max-panel-width <px>] [--json]',
|
|
436
|
+
' openprd dev-check [path] <file...> [--json]',
|
|
437
|
+
' openprd grow [path] [--review|--apply --id <candidate-id>|--reject --id <candidate-id>|--init|--check] [--notes <text>] [--json]',
|
|
438
|
+
' openprd benchmark <add|list|approve|verify> [target-or-id] [path-for-list-or-verify] [--path <project>] [--notes <text>] [--id <benchmark-id>] [--json]',
|
|
439
|
+
' openprd synthesize [path] [--title <text>] [--owner <text>] [--problem <text>] [--why-now <text>] [--work-unit <id>] [--target-root <path>] [--open] [--json]',
|
|
440
|
+
' openprd review [path] [--open] [--mark <pending-confirmation|confirmed|needs-revision>] [--version <id>] [--digest <sha256>] [--work-unit <id>] [--notes <text>] [--json]',
|
|
441
|
+
' openprd review-presentation [path] [--template] [--version <id>] [--presentation <json>] [--write] [--fail-on-violation] [--json]',
|
|
442
|
+
' openprd diagram [path] [--type <architecture|product-flow>] [--input <contract.json>] [--mark <pending-confirmation|confirmed|needs-revision>] [--open] [--json]',
|
|
443
|
+
' openprd diff [path] [--from <version>] [--to <version>]',
|
|
444
|
+
' openprd history [path]',
|
|
445
|
+
' openprd validate [path] [--json]',
|
|
446
|
+
' openprd status [path] [--json]',
|
|
447
|
+
' openprd freeze [path] [--json]',
|
|
448
|
+
' openprd handoff [path] [--target openprd] [--json]',
|
|
449
|
+
' openprd standards [path] [--init|--classify-external <path>] [--check|--verify] [--force] [--json]',
|
|
450
|
+
' openprd change [path] (--generate|--validate|--apply|--archive|--activate|--close) [--change <id>] [--force] [--keep] [--json]',
|
|
451
|
+
' openprd changes [path] [--json]',
|
|
452
|
+
' openprd specs [path] [--json]',
|
|
453
|
+
' openprd tasks [path] [--next] [--advance] [--verify] [--item <task-id>] [--change <id>] [--evidence <path>] [--notes <text>] [--json]',
|
|
454
|
+
' openprd discovery [path] [--mode <auto|brownfield|reference|requirement>] [--reference <path>] [--max-iterations <n>] [--resume] [--advance] [--verify] [--item <id>] [--status <covered|blocked|pending>] [--claim <text>] [--evidence <path>] [--notes <text>] [--confidence <0..1>] [--json]',
|
|
455
|
+
'',
|
|
456
|
+
].join('\n');
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
export { parseCommandArgs, usage };
|