@pcoliveira90/pdd 0.2.3 → 0.2.5
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/package.json +1 -1
- package/src/cli/index.js +18 -1
- package/src/core/template-registry.js +138 -19
package/package.json
CHANGED
package/src/cli/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { dirname, join } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
1
4
|
import { runValidation } from '../core/validator.js';
|
|
2
5
|
import { openPullRequest } from '../core/pr-manager.js';
|
|
3
6
|
import { generatePatchArtifacts } from '../core/patch-generator.js';
|
|
@@ -6,6 +9,14 @@ import { runDoctor } from './doctor-command.js';
|
|
|
6
9
|
import { runStatus } from './status-command.js';
|
|
7
10
|
import { runResilientFixWorkflow } from '../core/fix-runner.js';
|
|
8
11
|
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
|
|
14
|
+
function readCliVersion() {
|
|
15
|
+
const pkgPath = join(__dirname, '../../package.json');
|
|
16
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
17
|
+
return pkg.version;
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
function parseFixArgs(argv) {
|
|
10
21
|
const issue = argv
|
|
11
22
|
.filter(arg => !arg.startsWith('--') && arg !== 'fix')
|
|
@@ -24,6 +35,11 @@ export async function runCli(argv = process.argv.slice(2)) {
|
|
|
24
35
|
const command = argv[0];
|
|
25
36
|
const cwd = process.cwd();
|
|
26
37
|
|
|
38
|
+
if (command === '--version' || command === '-v' || command === '-V' || command === 'version') {
|
|
39
|
+
console.log(readCliVersion());
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
if (command === 'init') {
|
|
28
44
|
await runInit(argv);
|
|
29
45
|
return;
|
|
@@ -90,7 +106,7 @@ export async function runCli(argv = process.argv.slice(2)) {
|
|
|
90
106
|
}
|
|
91
107
|
|
|
92
108
|
if (command === 'help' || !command) {
|
|
93
|
-
console.log(
|
|
109
|
+
console.log(`PDD CLI ${readCliVersion()}`);
|
|
94
110
|
console.log('');
|
|
95
111
|
console.log('Commands:');
|
|
96
112
|
console.log(' pdd init <project-name>');
|
|
@@ -98,6 +114,7 @@ export async function runCli(argv = process.argv.slice(2)) {
|
|
|
98
114
|
console.log(' pdd doctor [--fix]');
|
|
99
115
|
console.log(' pdd status');
|
|
100
116
|
console.log(' pdd fix "description" [--open-pr] [--dry-run] [--no-validate]');
|
|
117
|
+
console.log(' pdd version (or: pdd --version, pdd -v)');
|
|
101
118
|
console.log('');
|
|
102
119
|
console.log('Examples:');
|
|
103
120
|
console.log(' pdd doctor --fix');
|
|
@@ -160,36 +160,155 @@ Execute Patch-Driven Development workflow.
|
|
|
160
160
|
`
|
|
161
161
|
},
|
|
162
162
|
cursor: {
|
|
163
|
-
'.cursor/pdd.
|
|
163
|
+
'.cursor/rules/pdd.mdc': `---
|
|
164
|
+
description: PDD — Patch-Driven Development context for this repo (like Spec Kit project rules)
|
|
165
|
+
alwaysApply: true
|
|
166
|
+
---
|
|
164
167
|
|
|
165
|
-
|
|
168
|
+
# Patch-Driven Development
|
|
166
169
|
|
|
167
|
-
|
|
170
|
+
This repo uses **PDD**: safe changes in existing systems. The agent should:
|
|
168
171
|
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
+
- Read \`.pdd/constitution.md\` before substantive edits.
|
|
173
|
+
- Prefer **minimal safe deltas**; avoid drive-by refactors.
|
|
174
|
+
- Use templates under \`.pdd/templates/\` when producing specs or reports (\`delta-spec\`, \`patch-plan\`, \`verification-report\`).
|
|
175
|
+
- Follow playbooks under \`.pdd/commands/\` when the user invokes a PDD slash command.
|
|
172
176
|
|
|
173
|
-
|
|
177
|
+
Slash commands live in \`.cursor/commands/\` (type \`/\` in Chat/Agent). They mirror the PDD playbooks.
|
|
178
|
+
`,
|
|
179
|
+
'.cursor/commands/pdd.md': `---
|
|
180
|
+
description: "PDD — main workflow (Patch-Driven Development)"
|
|
181
|
+
argument-hint: "[issue or goal]"
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
# PDD — main workflow
|
|
185
|
+
|
|
186
|
+
You are running **Patch-Driven Development** in this repository.
|
|
187
|
+
|
|
188
|
+
## Ground rules
|
|
189
|
+
|
|
190
|
+
- Obey \`.pdd/constitution.md\`.
|
|
191
|
+
- Evidence before edits: locate behavior in code/tests before changing.
|
|
192
|
+
- Smallest change that solves the problem; match local patterns.
|
|
193
|
+
|
|
194
|
+
## User request
|
|
195
|
+
|
|
196
|
+
$ARGUMENTS
|
|
197
|
+
|
|
198
|
+
(If empty, ask what issue or goal to work on.)
|
|
199
|
+
|
|
200
|
+
## What to do
|
|
201
|
+
|
|
202
|
+
1. Classify: bugfix vs feature vs exploration-only (**recon**).
|
|
203
|
+
2. Name impacted files and risks.
|
|
204
|
+
3. Propose a minimal plan, then implement or outline next steps.
|
|
205
|
+
4. Say how to verify (tests, manual steps).
|
|
206
|
+
|
|
207
|
+
## Output
|
|
208
|
+
|
|
209
|
+
- Files touched or to touch
|
|
210
|
+
- Risks and what you did not change on purpose
|
|
211
|
+
`,
|
|
212
|
+
'.cursor/commands/pdd-recon.md': `---
|
|
213
|
+
description: "PDD — recon (explore before editing)"
|
|
214
|
+
argument-hint: "[area or question]"
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
# PDD — recon
|
|
218
|
+
|
|
219
|
+
**Exploration only** unless the user asks to edit.
|
|
220
|
+
|
|
221
|
+
## Goal
|
|
222
|
+
|
|
223
|
+
Map the relevant part of the system before any change. Align with \`.pdd/commands/pdd-recon.md\`.
|
|
224
|
+
|
|
225
|
+
## User focus
|
|
226
|
+
|
|
227
|
+
$ARGUMENTS
|
|
228
|
+
|
|
229
|
+
## Deliver
|
|
230
|
+
|
|
231
|
+
- Short map: entry points, key modules, data flow if useful
|
|
232
|
+
- List of files worth reading next
|
|
233
|
+
- Risks and unknowns
|
|
234
|
+
- No production edits unless the user explicitly asked to fix something
|
|
235
|
+
`,
|
|
236
|
+
'.cursor/commands/pdd-fix.md': `---
|
|
237
|
+
description: "PDD — fix (minimal bugfix)"
|
|
238
|
+
argument-hint: "[bug description]"
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
# PDD — fix
|
|
174
242
|
|
|
175
|
-
|
|
176
|
-
2. **Delta** — describe the minimal change (align with \`delta-spec\` / \`patch-plan\` ideas).
|
|
177
|
-
3. **Implement** — smallest diff that fixes the issue; match existing patterns.
|
|
178
|
-
4. **Verify** — how to confirm behavior; note regressions avoided or checked.
|
|
179
|
-
5. **Artifacts** — if the project uses \`changes/\` or PR notes, keep them consistent.
|
|
243
|
+
Fix a **bug** with a minimal safe delta. Align with \`.pdd/commands/pdd-fix.md\`.
|
|
180
244
|
|
|
181
|
-
## Issue
|
|
245
|
+
## Issue
|
|
182
246
|
|
|
183
|
-
|
|
247
|
+
$ARGUMENTS
|
|
248
|
+
|
|
249
|
+
## Steps
|
|
250
|
+
|
|
251
|
+
1. Reproduce or infer current vs expected behavior (code/tests).
|
|
252
|
+
2. Confirm root cause (not only symptoms).
|
|
253
|
+
3. Apply the smallest fix; avoid scope creep.
|
|
254
|
+
4. State how to verify (tests or manual).
|
|
255
|
+
|
|
256
|
+
## Output
|
|
257
|
+
|
|
258
|
+
- Root cause (brief)
|
|
259
|
+
- Files changed
|
|
260
|
+
- Verification steps
|
|
261
|
+
`,
|
|
262
|
+
'.cursor/commands/pdd-feature.md': `---
|
|
263
|
+
description: "PDD — feature (safe extension)"
|
|
264
|
+
argument-hint: "[feature request]"
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
# PDD — feature
|
|
268
|
+
|
|
269
|
+
Add behavior **safely** in an existing system. Align with \`.pdd/commands/pdd-feature.md\`.
|
|
270
|
+
|
|
271
|
+
## Request
|
|
272
|
+
|
|
273
|
+
$ARGUMENTS
|
|
274
|
+
|
|
275
|
+
## Steps
|
|
276
|
+
|
|
277
|
+
1. Understand current behavior and extension points.
|
|
278
|
+
2. Define the smallest extension (APIs, files).
|
|
279
|
+
3. Implement without breaking existing callers.
|
|
280
|
+
4. Verification and rollback idea.
|
|
281
|
+
|
|
282
|
+
## Output
|
|
283
|
+
|
|
284
|
+
- Design note (what you extended and why)
|
|
285
|
+
- Files changed
|
|
286
|
+
- Tests or checks to run
|
|
287
|
+
`,
|
|
288
|
+
'.cursor/commands/pdd-verify.md': `---
|
|
289
|
+
description: "PDD — verify (validation checklist)"
|
|
290
|
+
argument-hint: "[scope or PR]"
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
# PDD — verify
|
|
294
|
+
|
|
295
|
+
Validate a change or the current state. Align with \`.pdd/commands/pdd-verify.md\`.
|
|
296
|
+
|
|
297
|
+
## Scope
|
|
298
|
+
|
|
299
|
+
$ARGUMENTS
|
|
300
|
+
|
|
301
|
+
## Checklist
|
|
184
302
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
303
|
+
- Tests run (which)
|
|
304
|
+
- Regressions considered
|
|
305
|
+
- Manual checks if needed
|
|
306
|
+
- Residual risks
|
|
188
307
|
|
|
189
308
|
## Output
|
|
190
309
|
|
|
191
|
-
-
|
|
192
|
-
-
|
|
310
|
+
- Pass/fail summary
|
|
311
|
+
- What you would still verify before merge
|
|
193
312
|
`
|
|
194
313
|
},
|
|
195
314
|
copilot: {
|