@shahmarasy/prodo 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/LICENSE +21 -0
- package/README.md +157 -0
- package/bin/prodo.cjs +6 -0
- package/dist/agent-command-installer.d.ts +4 -0
- package/dist/agent-command-installer.js +158 -0
- package/dist/agents.d.ts +15 -0
- package/dist/agents.js +47 -0
- package/dist/artifact-registry.d.ts +11 -0
- package/dist/artifact-registry.js +49 -0
- package/dist/artifacts.d.ts +9 -0
- package/dist/artifacts.js +514 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +305 -0
- package/dist/consistency.d.ts +8 -0
- package/dist/consistency.js +268 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +64 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +123 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.js +10 -0
- package/dist/hook-executor.d.ts +1 -0
- package/dist/hook-executor.js +175 -0
- package/dist/init-tui.d.ts +21 -0
- package/dist/init-tui.js +161 -0
- package/dist/init.d.ts +10 -0
- package/dist/init.js +307 -0
- package/dist/markdown.d.ts +11 -0
- package/dist/markdown.js +66 -0
- package/dist/normalize.d.ts +7 -0
- package/dist/normalize.js +73 -0
- package/dist/normalized-brief.d.ts +39 -0
- package/dist/normalized-brief.js +170 -0
- package/dist/output-index.d.ts +13 -0
- package/dist/output-index.js +55 -0
- package/dist/paths.d.ts +16 -0
- package/dist/paths.js +76 -0
- package/dist/preset-loader.d.ts +4 -0
- package/dist/preset-loader.js +210 -0
- package/dist/project-config.d.ts +14 -0
- package/dist/project-config.js +69 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +12 -0
- package/dist/providers/mock-provider.d.ts +7 -0
- package/dist/providers/mock-provider.js +168 -0
- package/dist/providers/openai-provider.d.ts +11 -0
- package/dist/providers/openai-provider.js +69 -0
- package/dist/registry.d.ts +13 -0
- package/dist/registry.js +115 -0
- package/dist/settings.d.ts +6 -0
- package/dist/settings.js +34 -0
- package/dist/template-resolver.d.ts +11 -0
- package/dist/template-resolver.js +28 -0
- package/dist/templates.d.ts +33 -0
- package/dist/templates.js +428 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.js +5 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +53 -0
- package/dist/validate.d.ts +9 -0
- package/dist/validate.js +226 -0
- package/dist/validator.d.ts +5 -0
- package/dist/validator.js +80 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +30 -0
- package/dist/workflow-commands.d.ts +7 -0
- package/dist/workflow-commands.js +28 -0
- package/package.json +45 -0
- package/presets/fintech/preset.json +1 -0
- package/presets/fintech/prompts/prd.md +3 -0
- package/presets/marketplace/preset.json +1 -0
- package/presets/marketplace/prompts/prd.md +3 -0
- package/presets/saas/preset.json +1 -0
- package/presets/saas/prompts/prd.md +3 -0
- package/src/agent-command-installer.ts +174 -0
- package/src/agents.ts +56 -0
- package/src/artifact-registry.ts +69 -0
- package/src/artifacts.ts +606 -0
- package/src/cli.ts +322 -0
- package/src/consistency.ts +303 -0
- package/src/constants.ts +72 -0
- package/src/doctor.ts +137 -0
- package/src/errors.ts +7 -0
- package/src/hook-executor.ts +196 -0
- package/src/init-tui.ts +193 -0
- package/src/init.ts +375 -0
- package/src/markdown.ts +73 -0
- package/src/normalize.ts +89 -0
- package/src/normalized-brief.ts +206 -0
- package/src/output-index.ts +59 -0
- package/src/paths.ts +72 -0
- package/src/preset-loader.ts +237 -0
- package/src/project-config.ts +78 -0
- package/src/providers/index.ts +12 -0
- package/src/providers/mock-provider.ts +188 -0
- package/src/providers/openai-provider.ts +87 -0
- package/src/registry.ts +119 -0
- package/src/settings.ts +34 -0
- package/src/template-resolver.ts +33 -0
- package/src/templates.ts +440 -0
- package/src/types.ts +46 -0
- package/src/utils.ts +50 -0
- package/src/validate.ts +246 -0
- package/src/validator.ts +96 -0
- package/src/version.ts +24 -0
- package/src/workflow-commands.ts +31 -0
- package/templates/artifacts/prd.md +219 -0
- package/templates/artifacts/stories.md +49 -0
- package/templates/artifacts/techspec.md +42 -0
- package/templates/artifacts/wireframe.html +260 -0
- package/templates/artifacts/wireframe.md +22 -0
- package/templates/artifacts/workflow.md +22 -0
- package/templates/artifacts/workflow.mmd +6 -0
- package/templates/commands/prodo-normalize.md +24 -0
- package/templates/commands/prodo-prd.md +24 -0
- package/templates/commands/prodo-stories.md +24 -0
- package/templates/commands/prodo-techspec.md +24 -0
- package/templates/commands/prodo-validate.md +24 -0
- package/templates/commands/prodo-wireframe.md +24 -0
- package/templates/commands/prodo-workflow.md +24 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HOOKS_TEMPLATE = exports.NORMALIZE_PROMPT_TEMPLATE = exports.NORMALIZED_BRIEF_TEMPLATE = exports.START_BRIEF_TEMPLATE = void 0;
|
|
4
|
+
exports.schemaTemplate = schemaTemplate;
|
|
5
|
+
exports.promptTemplate = promptTemplate;
|
|
6
|
+
exports.artifactTemplateTemplate = artifactTemplateTemplate;
|
|
7
|
+
exports.commandTemplate = commandTemplate;
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
const BASE_SCHEMA = {
|
|
10
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
11
|
+
type: "object",
|
|
12
|
+
required: ["frontmatter", "body"],
|
|
13
|
+
properties: {
|
|
14
|
+
frontmatter: {
|
|
15
|
+
type: "object",
|
|
16
|
+
required: ["artifact_type", "version", "source_brief", "generated_at", "status"],
|
|
17
|
+
properties: {
|
|
18
|
+
artifact_type: { type: "string" },
|
|
19
|
+
version: { type: "string", minLength: 1 },
|
|
20
|
+
source_brief: { type: "string", minLength: 1 },
|
|
21
|
+
generated_at: { type: "string", format: "date-time" },
|
|
22
|
+
status: { type: "string", enum: ["draft", "reviewed", "approved"] },
|
|
23
|
+
title: { type: "string" },
|
|
24
|
+
upstream_artifacts: {
|
|
25
|
+
type: "array",
|
|
26
|
+
items: { type: "string" }
|
|
27
|
+
},
|
|
28
|
+
contract_coverage: {
|
|
29
|
+
type: "object",
|
|
30
|
+
required: ["goals", "core_features", "constraints"],
|
|
31
|
+
properties: {
|
|
32
|
+
goals: { type: "array", items: { type: "string", pattern: "^G[0-9]+$" } },
|
|
33
|
+
core_features: { type: "array", items: { type: "string", pattern: "^F[0-9]+$" } },
|
|
34
|
+
constraints: { type: "array", items: { type: "string", pattern: "^C[0-9]+$" } }
|
|
35
|
+
},
|
|
36
|
+
additionalProperties: false
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
additionalProperties: true
|
|
40
|
+
},
|
|
41
|
+
body: {
|
|
42
|
+
type: "string",
|
|
43
|
+
minLength: 40
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
additionalProperties: false
|
|
47
|
+
};
|
|
48
|
+
function schemaTemplate(artifactType) {
|
|
49
|
+
return {
|
|
50
|
+
...BASE_SCHEMA,
|
|
51
|
+
properties: {
|
|
52
|
+
...BASE_SCHEMA.properties,
|
|
53
|
+
frontmatter: {
|
|
54
|
+
...BASE_SCHEMA.properties.frontmatter,
|
|
55
|
+
properties: {
|
|
56
|
+
...BASE_SCHEMA.properties.frontmatter
|
|
57
|
+
.properties,
|
|
58
|
+
artifact_type: { const: artifactType }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
x_required_headings: (0, constants_1.defaultRequiredHeadings)(artifactType)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function promptTemplate(artifactType, lang = "en") {
|
|
66
|
+
const tr = lang.toLowerCase().startsWith("tr");
|
|
67
|
+
if (artifactType === "workflow") {
|
|
68
|
+
return `You are Prodo's artifact generator for WORKFLOW.
|
|
69
|
+
|
|
70
|
+
Goal:
|
|
71
|
+
- Produce paired workflow outputs for the same flow.
|
|
72
|
+
|
|
73
|
+
Output contract (STRICT):
|
|
74
|
+
- Return Markdown explanation first (no frontmatter), following required headings exactly.
|
|
75
|
+
- Include actionable flow details and contract tags like [F1].
|
|
76
|
+
- Then append a mandatory Mermaid block for the same flow:
|
|
77
|
+
\`\`\`mermaid
|
|
78
|
+
flowchart TD
|
|
79
|
+
A --> B
|
|
80
|
+
\`\`\`
|
|
81
|
+
- Do not return prose-only markdown without Mermaid.
|
|
82
|
+
|
|
83
|
+
Input immutability:
|
|
84
|
+
- Input files are read-only.
|
|
85
|
+
- Do not modify, rewrite, summarize, or optimize \`brief.md\`.
|
|
86
|
+
|
|
87
|
+
Language contract:
|
|
88
|
+
- Output text in requested language from inputContext.outputLanguage.
|
|
89
|
+
- If outputLanguage is "tr", every sentence and heading MUST be Turkish.
|
|
90
|
+
- Never mix Turkish and English in the same artifact.
|
|
91
|
+
|
|
92
|
+
Quality bar:
|
|
93
|
+
- Main flow must be implementation-ready.
|
|
94
|
+
- Edge cases and postconditions must be explicit.`;
|
|
95
|
+
}
|
|
96
|
+
if (artifactType === "wireframe") {
|
|
97
|
+
return `You are Prodo's artifact generator for WIREFRAME.
|
|
98
|
+
|
|
99
|
+
Goal:
|
|
100
|
+
- Produce a human-readable wireframe explanation in Markdown.
|
|
101
|
+
|
|
102
|
+
Output contract (STRICT):
|
|
103
|
+
- Return Markdown body only (no frontmatter).
|
|
104
|
+
- Include all required headings exactly as provided.
|
|
105
|
+
- Describe one concrete screen at a time with actionable details.
|
|
106
|
+
- HTML wireframe is generated by Prodo as a companion .html file; do not output raw HTML as primary markdown body.
|
|
107
|
+
|
|
108
|
+
Input immutability:
|
|
109
|
+
- Input files are read-only.
|
|
110
|
+
- Do not modify, rewrite, summarize, or optimize \`brief.md\`.
|
|
111
|
+
|
|
112
|
+
Language contract:
|
|
113
|
+
- Output text in requested language from inputContext.outputLanguage.
|
|
114
|
+
- If outputLanguage is "tr", every sentence and heading MUST be Turkish.
|
|
115
|
+
- Never mix Turkish and English in the same artifact.
|
|
116
|
+
|
|
117
|
+
Quality bar:
|
|
118
|
+
- Keep sections concise but specific.
|
|
119
|
+
- Ensure actions/states/messages are testable and implementation-relevant.`;
|
|
120
|
+
}
|
|
121
|
+
return `You are Prodo's artifact generator for ${artifactType.toUpperCase()}.
|
|
122
|
+
|
|
123
|
+
Goal:
|
|
124
|
+
- Produce a decision-ready product artifact from normalized brief and upstream artifacts.
|
|
125
|
+
|
|
126
|
+
Output contract:
|
|
127
|
+
- Return only Markdown body (NO YAML frontmatter).
|
|
128
|
+
- Keep all required section headings exactly as provided.
|
|
129
|
+
- When referencing brief contracts, use explicit tags like [G1], [F2], [C1].
|
|
130
|
+
- Use concrete statements, avoid placeholders like "TBD" unless unavoidable.
|
|
131
|
+
- Reference upstream constraints and tradeoffs explicitly.
|
|
132
|
+
|
|
133
|
+
Input immutability:
|
|
134
|
+
- Input files are read-only.
|
|
135
|
+
- Do not modify, rewrite, summarize, or optimize \`brief.md\`.
|
|
136
|
+
|
|
137
|
+
Language contract:
|
|
138
|
+
- Output text in requested language from inputContext.outputLanguage.
|
|
139
|
+
- If outputLanguage is "tr", every sentence and heading MUST be Turkish.
|
|
140
|
+
- Never mix Turkish and English in the same artifact.
|
|
141
|
+
- Do not translate or change required headings unless outputLanguage is "tr" and Turkish headings are provided.
|
|
142
|
+
|
|
143
|
+
Quality bar:
|
|
144
|
+
- Every section must contain actionable content.
|
|
145
|
+
- Include assumptions and risks where relevant.
|
|
146
|
+
- Keep content concise but implementation-ready.
|
|
147
|
+
|
|
148
|
+
Required headings:
|
|
149
|
+
${(0, constants_1.defaultRequiredHeadings)(artifactType).map((heading) => `- ${heading}`).join("\n")}
|
|
150
|
+
|
|
151
|
+
When data is missing:
|
|
152
|
+
${tr ? "- varsayim yaparken Turkce yaz\n- varsayimi ilgili bolumde acikca belirt" : "- infer a sensible default\n- state the assumption clearly in the relevant section"}`;
|
|
153
|
+
}
|
|
154
|
+
function artifactTemplateTemplate(artifactType, lang = "en") {
|
|
155
|
+
const tr = lang.toLowerCase().startsWith("tr");
|
|
156
|
+
const base = [`# ${artifactType.toUpperCase()} Template`, ""];
|
|
157
|
+
if (artifactType === "prd") {
|
|
158
|
+
return [
|
|
159
|
+
...base,
|
|
160
|
+
"## Problem",
|
|
161
|
+
"- User pain and why now",
|
|
162
|
+
"- Existing workaround and gap",
|
|
163
|
+
"",
|
|
164
|
+
"## Goals",
|
|
165
|
+
"- Business goals (measurable)",
|
|
166
|
+
"- User outcomes",
|
|
167
|
+
"",
|
|
168
|
+
"## Scope",
|
|
169
|
+
"- In scope",
|
|
170
|
+
"- Out of scope",
|
|
171
|
+
"",
|
|
172
|
+
"## Requirements",
|
|
173
|
+
"- Functional requirements",
|
|
174
|
+
"- Non-functional requirements",
|
|
175
|
+
"- Compliance/security requirements",
|
|
176
|
+
"",
|
|
177
|
+
"## Risks",
|
|
178
|
+
"- Top risks and mitigations",
|
|
179
|
+
"",
|
|
180
|
+
"## Assumptions",
|
|
181
|
+
"- Key assumptions"
|
|
182
|
+
].join("\n");
|
|
183
|
+
}
|
|
184
|
+
if (artifactType === "workflow") {
|
|
185
|
+
return [
|
|
186
|
+
"flowchart TD",
|
|
187
|
+
` A[${tr ? "Baslangic" : "Start"}] --> B[[F1] ${tr ? "Kullanici islemi" : "User action"}]`,
|
|
188
|
+
` B --> C[${tr ? "Sistem islemi" : "System process"}]`,
|
|
189
|
+
` C --> D[${tr ? "Basari" : "Success"}]`,
|
|
190
|
+
` C --> E[${tr ? "Hata" : "Error"}]`
|
|
191
|
+
].join("\n");
|
|
192
|
+
}
|
|
193
|
+
if (artifactType === "wireframe") {
|
|
194
|
+
return `<!doctype html>
|
|
195
|
+
<html lang="${tr ? "tr" : "en"}">
|
|
196
|
+
<head>
|
|
197
|
+
<meta charset="utf-8" />
|
|
198
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
199
|
+
<title>${tr ? "Wireframe Ekrani" : "Wireframe Screen"}</title>
|
|
200
|
+
</head>
|
|
201
|
+
<body>
|
|
202
|
+
<header>
|
|
203
|
+
<h1>${tr ? "Ekran Basligi" : "Screen Title"}</h1>
|
|
204
|
+
<nav>
|
|
205
|
+
<button type="button">${tr ? "Geri" : "Back"}</button>
|
|
206
|
+
<button type="button">${tr ? "Devam" : "Next"}</button>
|
|
207
|
+
</nav>
|
|
208
|
+
</header>
|
|
209
|
+
<main>
|
|
210
|
+
<section>
|
|
211
|
+
<h2>${tr ? "Birincil Icerik" : "Primary Content"}</h2>
|
|
212
|
+
<ul>
|
|
213
|
+
<li>${tr ? "Durum ozeti" : "Status summary"}</li>
|
|
214
|
+
<li>${tr ? "Aksiyon alani" : "Action area"}</li>
|
|
215
|
+
</ul>
|
|
216
|
+
</section>
|
|
217
|
+
<section>
|
|
218
|
+
<h2>${tr ? "Form" : "Form"}</h2>
|
|
219
|
+
<form>
|
|
220
|
+
<label>${tr ? "Alan" : "Field"} <input type="text" /></label>
|
|
221
|
+
<button type="submit">${tr ? "Kaydet" : "Save"}</button>
|
|
222
|
+
</form>
|
|
223
|
+
</section>
|
|
224
|
+
</main>
|
|
225
|
+
</body>
|
|
226
|
+
</html>`;
|
|
227
|
+
}
|
|
228
|
+
if (artifactType === "stories") {
|
|
229
|
+
return [
|
|
230
|
+
...base,
|
|
231
|
+
"## User Stories",
|
|
232
|
+
"- As a <user>, I want <goal>, so that <benefit>",
|
|
233
|
+
"",
|
|
234
|
+
"## Acceptance Criteria",
|
|
235
|
+
"- Given / When / Then criteria",
|
|
236
|
+
"- Negative and edge scenarios",
|
|
237
|
+
"",
|
|
238
|
+
"## Traceability",
|
|
239
|
+
"- Map each story to PRD requirement"
|
|
240
|
+
].join("\n");
|
|
241
|
+
}
|
|
242
|
+
if (artifactType === "techspec") {
|
|
243
|
+
return [
|
|
244
|
+
...base,
|
|
245
|
+
"## Architecture",
|
|
246
|
+
"- High-level components and boundaries",
|
|
247
|
+
"",
|
|
248
|
+
"## Data Model",
|
|
249
|
+
"- Entities, fields, relations",
|
|
250
|
+
"",
|
|
251
|
+
"## APIs",
|
|
252
|
+
"- Endpoints/interfaces and contracts",
|
|
253
|
+
"",
|
|
254
|
+
"## Risks",
|
|
255
|
+
"- Technical risks and mitigation",
|
|
256
|
+
"",
|
|
257
|
+
"## Observability",
|
|
258
|
+
"- Logs, metrics, alerts"
|
|
259
|
+
].join("\n");
|
|
260
|
+
}
|
|
261
|
+
const fallbackTemplate = [
|
|
262
|
+
...base,
|
|
263
|
+
tr ? "## Ozet" : "## Summary",
|
|
264
|
+
tr ? "- Ana amac ve beklenen cikti" : "- Core intent and outcomes",
|
|
265
|
+
"",
|
|
266
|
+
tr ? "## Detaylar" : "## Details",
|
|
267
|
+
tr ? "- Kararlar, varsayimlar ve riskler" : "- Key decisions, assumptions, and risks",
|
|
268
|
+
"",
|
|
269
|
+
tr ? "## Izlenebilirlik" : "## Traceability",
|
|
270
|
+
tr ? "- Kararlari kontrat etiketleri ile eslestir" : "- Link decisions to contract tags"
|
|
271
|
+
].join("\n");
|
|
272
|
+
return fallbackTemplate;
|
|
273
|
+
}
|
|
274
|
+
exports.START_BRIEF_TEMPLATE = `# Product Brief
|
|
275
|
+
|
|
276
|
+
## Product Name
|
|
277
|
+
Example Product
|
|
278
|
+
|
|
279
|
+
## Problem
|
|
280
|
+
Describe the user problem.
|
|
281
|
+
|
|
282
|
+
## Audience
|
|
283
|
+
Who this product is for.
|
|
284
|
+
|
|
285
|
+
## Core Features
|
|
286
|
+
- Feature A
|
|
287
|
+
- Feature B
|
|
288
|
+
|
|
289
|
+
## Goals
|
|
290
|
+
- Goal 1
|
|
291
|
+
- Goal 2
|
|
292
|
+
|
|
293
|
+
## Constraints
|
|
294
|
+
- Budget or timeline constraints
|
|
295
|
+
- Compliance or technical constraints
|
|
296
|
+
`;
|
|
297
|
+
exports.NORMALIZED_BRIEF_TEMPLATE = {
|
|
298
|
+
schema_version: "1.0",
|
|
299
|
+
product_name: "Example Product",
|
|
300
|
+
problem: "Describe the user problem clearly.",
|
|
301
|
+
audience: ["Primary users"],
|
|
302
|
+
goals: ["Goal 1", "Goal 2"],
|
|
303
|
+
core_features: ["Feature A", "Feature B"],
|
|
304
|
+
constraints: ["Constraint 1"],
|
|
305
|
+
assumptions: ["Assumption 1"],
|
|
306
|
+
contracts: {
|
|
307
|
+
goals: [
|
|
308
|
+
{ id: "G1", text: "Goal 1" },
|
|
309
|
+
{ id: "G2", text: "Goal 2" }
|
|
310
|
+
],
|
|
311
|
+
core_features: [
|
|
312
|
+
{ id: "F1", text: "Feature A" },
|
|
313
|
+
{ id: "F2", text: "Feature B" }
|
|
314
|
+
],
|
|
315
|
+
constraints: [{ id: "C1", text: "Constraint 1" }]
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
exports.NORMALIZE_PROMPT_TEMPLATE = `Normalize start-brief content into JSON.
|
|
319
|
+
|
|
320
|
+
Return JSON object with keys:
|
|
321
|
+
- schema_version (string)
|
|
322
|
+
- product_name (string)
|
|
323
|
+
- problem (string)
|
|
324
|
+
- audience (string[])
|
|
325
|
+
- goals (string[])
|
|
326
|
+
- core_features (string[])
|
|
327
|
+
- constraints (string[])
|
|
328
|
+
- assumptions (string[])
|
|
329
|
+
- contracts.goals[] ({id,text})
|
|
330
|
+
- contracts.core_features[] ({id,text})
|
|
331
|
+
- contracts.constraints[] ({id,text})
|
|
332
|
+
- confidence.product_name (0..1)
|
|
333
|
+
- confidence.problem (0..1)
|
|
334
|
+
- confidence.audience (0..1)
|
|
335
|
+
- confidence.goals (0..1)
|
|
336
|
+
- confidence.core_features (0..1)
|
|
337
|
+
|
|
338
|
+
Rules:
|
|
339
|
+
- do NOT invent missing critical content
|
|
340
|
+
- keep wording concise and concrete
|
|
341
|
+
- if critical field is missing, return empty and low confidence (<0.7)
|
|
342
|
+
- assign deterministic IDs: goals => G1..Gn, features => F1..Fn, constraints => C1..Cn
|
|
343
|
+
- input files are read-only; never modify, summarize, or rewrite \`brief.md\` in-place
|
|
344
|
+
- write normalized output as a new JSON object only`;
|
|
345
|
+
function commandTemplate(command) {
|
|
346
|
+
return `---
|
|
347
|
+
description: ${command.description}
|
|
348
|
+
handoffs:
|
|
349
|
+
- label: Continue Workflow
|
|
350
|
+
agent: prodo-next
|
|
351
|
+
prompt: Continue with the next Prodo command in sequence.
|
|
352
|
+
send: true
|
|
353
|
+
run:
|
|
354
|
+
action: ${command.cliSubcommand}
|
|
355
|
+
mode: internal-runtime
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## User Input
|
|
359
|
+
|
|
360
|
+
\`\`\`text
|
|
361
|
+
$ARGUMENTS
|
|
362
|
+
\`\`\`
|
|
363
|
+
|
|
364
|
+
Execution policy:
|
|
365
|
+
- Execute-first, diagnose-second.
|
|
366
|
+
- Perform only minimal prerequisite checks before execution.
|
|
367
|
+
- Do not inspect hooks or internals unless command execution fails.
|
|
368
|
+
- Input files are read-only; never modify or rewrite \`brief.md\`.
|
|
369
|
+
|
|
370
|
+
## Execution
|
|
371
|
+
|
|
372
|
+
1. Minimal prerequisites only:
|
|
373
|
+
- Confirm project is initialized (\`.prodo/\` exists).
|
|
374
|
+
- Confirm required input files for \`${command.cliSubcommand}\` exist.
|
|
375
|
+
- Confirm output location is writable.
|
|
376
|
+
|
|
377
|
+
2. Execute immediately:
|
|
378
|
+
- Execute the \`${command.cliSubcommand}\` process through Prodo internal runtime.
|
|
379
|
+
- Keep narration short and action-oriented.
|
|
380
|
+
|
|
381
|
+
3. Verify result:
|
|
382
|
+
- Confirm expected output file(s) were created/updated.
|
|
383
|
+
- Confirm command success state (exit code or validation status).
|
|
384
|
+
|
|
385
|
+
4. Diagnose only on failure:
|
|
386
|
+
- Inspect \`.prodo/hooks.yml\` only after execution failure.
|
|
387
|
+
- Explain root cause and next fix steps briefly.
|
|
388
|
+
|
|
389
|
+
## Handoff
|
|
390
|
+
|
|
391
|
+
Suggest the next slash command explicitly (for example: \`/prodo-prd\`, \`/prodo-workflow\`).`;
|
|
392
|
+
}
|
|
393
|
+
exports.HOOKS_TEMPLATE = `# Hook item fields:
|
|
394
|
+
# - command: string (required)
|
|
395
|
+
# - optional: boolean (default false)
|
|
396
|
+
# - enabled: boolean (default true)
|
|
397
|
+
# - condition: shell command; run hook only if condition exits 0
|
|
398
|
+
# - timeout_ms: per-attempt timeout in milliseconds (default 30000)
|
|
399
|
+
# - retry: extra retry count after first attempt (default 0)
|
|
400
|
+
# - retry_delay_ms: delay between retries (default 500)
|
|
401
|
+
#
|
|
402
|
+
# Example:
|
|
403
|
+
# hooks:
|
|
404
|
+
# before_prd:
|
|
405
|
+
# - command: "node -e \\"console.log('lint ok')\\""
|
|
406
|
+
# optional: false
|
|
407
|
+
# enabled: true
|
|
408
|
+
# condition: "node -e \\"process.exit(0)\\""
|
|
409
|
+
# timeout_ms: 15000
|
|
410
|
+
# retry: 1
|
|
411
|
+
# retry_delay_ms: 300
|
|
412
|
+
|
|
413
|
+
hooks:
|
|
414
|
+
before_normalize: []
|
|
415
|
+
after_normalize: []
|
|
416
|
+
before_prd: []
|
|
417
|
+
after_prd: []
|
|
418
|
+
before_workflow: []
|
|
419
|
+
after_workflow: []
|
|
420
|
+
before_wireframe: []
|
|
421
|
+
after_wireframe: []
|
|
422
|
+
before_stories: []
|
|
423
|
+
after_stories: []
|
|
424
|
+
before_techspec: []
|
|
425
|
+
after_techspec: []
|
|
426
|
+
before_validate: []
|
|
427
|
+
after_validate: []
|
|
428
|
+
`;
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const CORE_ARTIFACT_TYPES: readonly ["prd", "workflow", "wireframe", "stories", "techspec"];
|
|
2
|
+
export declare const ARTIFACT_TYPES: readonly ["prd", "workflow", "wireframe", "stories", "techspec"];
|
|
3
|
+
export type CoreArtifactType = (typeof CORE_ARTIFACT_TYPES)[number];
|
|
4
|
+
export type ArtifactType = CoreArtifactType | string;
|
|
5
|
+
export type ArtifactDoc = {
|
|
6
|
+
frontmatter: Record<string, unknown>;
|
|
7
|
+
body: string;
|
|
8
|
+
};
|
|
9
|
+
export type ContractCoverage = {
|
|
10
|
+
goals: string[];
|
|
11
|
+
core_features: string[];
|
|
12
|
+
constraints: string[];
|
|
13
|
+
};
|
|
14
|
+
export type ValidationIssue = {
|
|
15
|
+
level: "error" | "warning";
|
|
16
|
+
code: string;
|
|
17
|
+
check?: "schema" | "tag_coverage" | "semantic_consistency" | "contract_relevance";
|
|
18
|
+
artifactType?: ArtifactType;
|
|
19
|
+
file?: string;
|
|
20
|
+
field?: string;
|
|
21
|
+
message: string;
|
|
22
|
+
suggestion?: string;
|
|
23
|
+
};
|
|
24
|
+
export type GenerateResult = {
|
|
25
|
+
body: string;
|
|
26
|
+
frontmatter?: Record<string, unknown>;
|
|
27
|
+
};
|
|
28
|
+
export type ProviderSchemaHint = {
|
|
29
|
+
artifactType: ArtifactType | "normalize" | "semantic_consistency" | "contract_relevance";
|
|
30
|
+
requiredHeadings: string[];
|
|
31
|
+
requiredContracts: Array<keyof ContractCoverage>;
|
|
32
|
+
};
|
|
33
|
+
export type LLMProvider = {
|
|
34
|
+
generate: (prompt: string, inputContext: Record<string, unknown>, schemaHint: ProviderSchemaHint) => Promise<GenerateResult>;
|
|
35
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ARTIFACT_TYPES = exports.CORE_ARTIFACT_TYPES = void 0;
|
|
4
|
+
exports.CORE_ARTIFACT_TYPES = ["prd", "workflow", "wireframe", "stories", "techspec"];
|
|
5
|
+
exports.ARTIFACT_TYPES = exports.CORE_ARTIFACT_TYPES;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function ensureDir(dirPath: string): Promise<void>;
|
|
2
|
+
export declare function fileExists(filePath: string): Promise<boolean>;
|
|
3
|
+
export declare function readJsonFile<T>(filePath: string): Promise<T>;
|
|
4
|
+
export declare function timestampSlug(date?: Date): string;
|
|
5
|
+
export declare function listFilesSortedByMtime(dirPath: string): Promise<string[]>;
|
|
6
|
+
export declare function isPathInside(parentDir: string, candidatePath: string): boolean;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ensureDir = ensureDir;
|
|
7
|
+
exports.fileExists = fileExists;
|
|
8
|
+
exports.readJsonFile = readJsonFile;
|
|
9
|
+
exports.timestampSlug = timestampSlug;
|
|
10
|
+
exports.listFilesSortedByMtime = listFilesSortedByMtime;
|
|
11
|
+
exports.isPathInside = isPathInside;
|
|
12
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
async function ensureDir(dirPath) {
|
|
15
|
+
await promises_1.default.mkdir(dirPath, { recursive: true });
|
|
16
|
+
}
|
|
17
|
+
async function fileExists(filePath) {
|
|
18
|
+
try {
|
|
19
|
+
await promises_1.default.access(filePath);
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function readJsonFile(filePath) {
|
|
27
|
+
const raw = await promises_1.default.readFile(filePath, "utf8");
|
|
28
|
+
return JSON.parse(raw);
|
|
29
|
+
}
|
|
30
|
+
function timestampSlug(date = new Date()) {
|
|
31
|
+
return date.toISOString().replace(/[:.]/g, "-");
|
|
32
|
+
}
|
|
33
|
+
async function listFilesSortedByMtime(dirPath) {
|
|
34
|
+
const exists = await fileExists(dirPath);
|
|
35
|
+
if (!exists)
|
|
36
|
+
return [];
|
|
37
|
+
const entries = await promises_1.default.readdir(dirPath);
|
|
38
|
+
const withStats = await Promise.all(entries.map(async (name) => {
|
|
39
|
+
const fullPath = node_path_1.default.join(dirPath, name);
|
|
40
|
+
const stat = await promises_1.default.stat(fullPath);
|
|
41
|
+
return { fullPath, mtimeMs: stat.mtimeMs, isFile: stat.isFile() };
|
|
42
|
+
}));
|
|
43
|
+
return withStats
|
|
44
|
+
.filter((entry) => entry.isFile)
|
|
45
|
+
.sort((a, b) => b.mtimeMs - a.mtimeMs)
|
|
46
|
+
.map((entry) => entry.fullPath);
|
|
47
|
+
}
|
|
48
|
+
function isPathInside(parentDir, candidatePath) {
|
|
49
|
+
const parent = node_path_1.default.resolve(parentDir);
|
|
50
|
+
const child = node_path_1.default.resolve(candidatePath);
|
|
51
|
+
const relative = node_path_1.default.relative(parent, child);
|
|
52
|
+
return relative === "" || (!relative.startsWith("..") && !node_path_1.default.isAbsolute(relative));
|
|
53
|
+
}
|