@pcoliveira90/pdd 0.2.6 → 0.3.1
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 +20 -20
- package/README.en.md +75 -60
- package/README.md +75 -26
- package/README.pt-BR.md +75 -12
- package/bin/pdd-ai.js +24 -23
- package/bin/pdd-pro.js +7 -7
- package/bin/pdd.js +8 -27
- package/package.json +43 -42
- package/src/ai/analyze-change.js +41 -41
- package/src/ai/engine.js +34 -34
- package/src/ai/run-fix-analysis.js +187 -174
- package/src/cli/doctor-command.js +140 -101
- package/src/cli/doctor-fix.js +51 -51
- package/src/cli/index.js +164 -130
- package/src/cli/init-command.js +270 -270
- package/src/cli/status-command.js +33 -33
- package/src/core/fix-runner.js +134 -135
- package/src/core/ide-detector.js +94 -94
- package/src/core/patch-generator.js +125 -126
- package/src/core/pr-manager.js +21 -21
- package/src/core/project-review-agent.js +301 -301
- package/src/core/remediation-advisor.js +91 -91
- package/src/core/state-manager.js +71 -71
- package/src/core/template-registry.js +446 -320
- package/src/core/template-upgrade.js +68 -68
- package/src/core/validator.js +38 -38
- package/src/core/worktree-guard.js +54 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Paula Oliveira
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Paula Oliveira
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.en.md
CHANGED
|
@@ -1,60 +1,75 @@
|
|
|
1
|
-
# PDD
|
|
2
|
-
|
|
3
|
-
](https://www.npmjs.com/package/@pcoliveira90/pdd)
|
|
4
|
+
[](https://github.com/pcoliveira90/pdd/actions/workflows/cli-self-validation.yml)
|
|
5
|
+
[](https://github.com/pcoliveira90/pdd/blob/main/LICENSE)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
|
|
8
|
+
> Safe changes in real systems.
|
|
9
|
+
|
|
10
|
+
PDD is a CLI-first framework for bugfix and feature work in existing codebases.
|
|
11
|
+
It standardizes how teams investigate, plan, validate, and document changes.
|
|
12
|
+
|
|
13
|
+
Language versions: [Default README](README.md) | [Português (Brasil)](README.pt-BR.md)
|
|
14
|
+
|
|
15
|
+
## Why PDD
|
|
16
|
+
|
|
17
|
+
- Worktree-first execution for safer parallel development
|
|
18
|
+
- Structured change artifacts (`delta-spec`, `patch-plan`, `verification-report`)
|
|
19
|
+
- Consistent workflow for Cursor, Claude Code, and GitHub Copilot
|
|
20
|
+
- Built-in quality gates (`doctor`, validation, baseline CI checks)
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 1) Create a linked worktree (recommended and enforced for mutating flows)
|
|
26
|
+
git worktree add ../pdd-worktrees/my-change -b feature/my-change
|
|
27
|
+
|
|
28
|
+
# 2) Initialize PDD in the repository
|
|
29
|
+
pdd init --here
|
|
30
|
+
|
|
31
|
+
# 3) Run a fix workflow
|
|
32
|
+
pdd fix "login not saving incomeStatus"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Core Commands
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pdd init --here
|
|
39
|
+
pdd doctor
|
|
40
|
+
pdd status
|
|
41
|
+
pdd fix "bug description" [--dry-run] [--no-validate] [--open-pr]
|
|
42
|
+
pdd version
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
AI analysis command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pdd-ai --provider=openai --task=analysis "bug description"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Workflow Summary
|
|
52
|
+
|
|
53
|
+
1. Understand current behavior and root cause
|
|
54
|
+
2. Generate change artifacts under `changes/<change-id>/`
|
|
55
|
+
3. Validate tests/lint/build
|
|
56
|
+
4. Prepare PR artifacts and review in IDE
|
|
57
|
+
|
|
58
|
+
## IDE Alignment
|
|
59
|
+
|
|
60
|
+
PDD keeps equivalent intents across tools:
|
|
61
|
+
|
|
62
|
+
- Cursor: `.cursor/commands/pdd-*.md`
|
|
63
|
+
- Claude Code: `.claude/commands/pdd-*.md`
|
|
64
|
+
- GitHub Copilot: `.github/prompts/pdd-*.prompt.md`
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
- `docs/getting-started.md`
|
|
69
|
+
- `docs/installation-and-setup.md`
|
|
70
|
+
- `docs/fix-workflow.md`
|
|
71
|
+
- `docs/manifesto.md`
|
|
72
|
+
|
|
73
|
+
## Goal
|
|
74
|
+
|
|
75
|
+
Reliable execution engine for safe software changes.
|
package/README.md
CHANGED
|
@@ -1,26 +1,75 @@
|
|
|
1
|
-
# PDD
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
# PDD - Patch-Driven Development
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@pcoliveira90/pdd)
|
|
4
|
+
[](https://github.com/pcoliveira90/pdd/actions/workflows/cli-self-validation.yml)
|
|
5
|
+
[](https://github.com/pcoliveira90/pdd/blob/main/LICENSE)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
|
|
8
|
+
> Safe changes in real systems.
|
|
9
|
+
|
|
10
|
+
PDD is a CLI-first framework for bugfix and feature work in existing codebases.
|
|
11
|
+
It standardizes how teams investigate, plan, validate, and document changes.
|
|
12
|
+
|
|
13
|
+
Language versions: [English](README.en.md) | [Português (Brasil)](README.pt-BR.md)
|
|
14
|
+
|
|
15
|
+
## Why PDD
|
|
16
|
+
|
|
17
|
+
- Worktree-first execution for safer parallel development
|
|
18
|
+
- Structured change artifacts (`delta-spec`, `patch-plan`, `verification-report`)
|
|
19
|
+
- Consistent workflow for Cursor, Claude Code, and GitHub Copilot
|
|
20
|
+
- Built-in quality gates (`doctor`, validation, baseline CI checks)
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 1) Create a linked worktree (recommended and enforced for mutating flows)
|
|
26
|
+
git worktree add ../pdd-worktrees/my-change -b feature/my-change
|
|
27
|
+
|
|
28
|
+
# 2) Initialize PDD in the repository
|
|
29
|
+
pdd init --here
|
|
30
|
+
|
|
31
|
+
# 3) Run a fix workflow
|
|
32
|
+
pdd fix "login not saving incomeStatus"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Core Commands
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pdd init --here
|
|
39
|
+
pdd doctor
|
|
40
|
+
pdd status
|
|
41
|
+
pdd fix "bug description" [--dry-run] [--no-validate] [--open-pr]
|
|
42
|
+
pdd version
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
AI analysis command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pdd-ai --provider=openai --task=analysis "bug description"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Workflow Summary
|
|
52
|
+
|
|
53
|
+
1. Understand current behavior and root cause
|
|
54
|
+
2. Generate change artifacts under `changes/<change-id>/`
|
|
55
|
+
3. Validate tests/lint/build
|
|
56
|
+
4. Prepare PR artifacts and review in IDE
|
|
57
|
+
|
|
58
|
+
## IDE Alignment
|
|
59
|
+
|
|
60
|
+
PDD keeps equivalent intents across tools:
|
|
61
|
+
|
|
62
|
+
- Cursor: `.cursor/commands/pdd-*.md`
|
|
63
|
+
- Claude Code: `.claude/commands/pdd-*.md`
|
|
64
|
+
- GitHub Copilot: `.github/prompts/pdd-*.prompt.md`
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
- `docs/getting-started.md`
|
|
69
|
+
- `docs/installation-and-setup.md`
|
|
70
|
+
- `docs/fix-workflow.md`
|
|
71
|
+
- `docs/manifesto.md`
|
|
72
|
+
|
|
73
|
+
## Goal
|
|
74
|
+
|
|
75
|
+
Reliable execution engine for safe software changes.
|
package/README.pt-BR.md
CHANGED
|
@@ -1,12 +1,75 @@
|
|
|
1
|
-
# PDD
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
# PDD - Patch-Driven Development
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@pcoliveira90/pdd)
|
|
4
|
+
[](https://github.com/pcoliveira90/pdd/actions/workflows/cli-self-validation.yml)
|
|
5
|
+
[](https://github.com/pcoliveira90/pdd/blob/main/LICENSE)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
|
|
8
|
+
> Entregue mudancas seguras em sistemas reais.
|
|
9
|
+
|
|
10
|
+
PDD e um framework orientado a CLI para bugfix e evolucao de features em sistemas existentes.
|
|
11
|
+
Ele padroniza como o time investiga, planeja, valida e documenta mudancas.
|
|
12
|
+
|
|
13
|
+
Versoes por idioma: [README padrao](README.md) | [English](README.en.md)
|
|
14
|
+
|
|
15
|
+
## Por que usar PDD
|
|
16
|
+
|
|
17
|
+
- Execucao worktree-first para desenvolvimento paralelo mais seguro
|
|
18
|
+
- Artefatos estruturados de mudanca (`delta-spec`, `patch-plan`, `verification-report`)
|
|
19
|
+
- Fluxo consistente para Cursor, Claude Code e GitHub Copilot
|
|
20
|
+
- Quality gates nativos (`doctor`, validacao e checagens de CI)
|
|
21
|
+
|
|
22
|
+
## Inicio rapido
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 1) Crie uma worktree vinculada (recomendado e exigido para fluxos mutaveis)
|
|
26
|
+
git worktree add ../pdd-worktrees/minha-mudanca -b feature/minha-mudanca
|
|
27
|
+
|
|
28
|
+
# 2) Inicialize o PDD no repositorio
|
|
29
|
+
pdd init --here
|
|
30
|
+
|
|
31
|
+
# 3) Rode um fluxo de correcao
|
|
32
|
+
pdd fix "login nao salva incomeStatus"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Comandos principais
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pdd init --here
|
|
39
|
+
pdd doctor
|
|
40
|
+
pdd status
|
|
41
|
+
pdd fix "descricao do bug" [--dry-run] [--no-validate] [--open-pr]
|
|
42
|
+
pdd version
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Comando de analise por IA:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pdd-ai --provider=openai --task=analysis "descricao do bug"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Resumo do fluxo
|
|
52
|
+
|
|
53
|
+
1. Entender comportamento atual e causa raiz
|
|
54
|
+
2. Gerar artefatos em `changes/<change-id>/`
|
|
55
|
+
3. Validar testes/lint/build
|
|
56
|
+
4. Preparar artefatos de PR e revisar na IDE
|
|
57
|
+
|
|
58
|
+
## Alinhamento entre IDEs
|
|
59
|
+
|
|
60
|
+
O PDD mantem intencoes equivalentes entre ferramentas:
|
|
61
|
+
|
|
62
|
+
- Cursor: `.cursor/commands/pdd-*.md`
|
|
63
|
+
- Claude Code: `.claude/commands/pdd-*.md`
|
|
64
|
+
- GitHub Copilot: `.github/prompts/pdd-*.prompt.md`
|
|
65
|
+
|
|
66
|
+
## Documentacao
|
|
67
|
+
|
|
68
|
+
- `docs/getting-started.md`
|
|
69
|
+
- `docs/installation-and-setup.md`
|
|
70
|
+
- `docs/fix-workflow.md`
|
|
71
|
+
- `docs/manifesto.md`
|
|
72
|
+
|
|
73
|
+
## Objetivo
|
|
74
|
+
|
|
75
|
+
Motor de execucao confiavel para mudancas seguras em software real.
|
package/bin/pdd-ai.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { runAiFixAnalysis } from '../src/ai/run-fix-analysis.js';
|
|
4
|
-
|
|
5
|
-
async function main() {
|
|
6
|
-
try {
|
|
7
|
-
const result = await runAiFixAnalysis(process.argv.slice(2));
|
|
8
|
-
|
|
9
|
-
console.log('\n🤖 PDD AI Analysis');
|
|
10
|
-
console.log('----------------------');
|
|
11
|
-
console.log(`Provider: ${result.provider}`);
|
|
12
|
-
console.log(`
|
|
13
|
-
console.log(`
|
|
14
|
-
console.log(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { runAiFixAnalysis } from '../src/ai/run-fix-analysis.js';
|
|
4
|
+
|
|
5
|
+
async function main() {
|
|
6
|
+
try {
|
|
7
|
+
const result = await runAiFixAnalysis(process.argv.slice(2));
|
|
8
|
+
|
|
9
|
+
console.log('\n🤖 PDD AI Analysis');
|
|
10
|
+
console.log('----------------------');
|
|
11
|
+
console.log(`Provider: ${result.provider}`);
|
|
12
|
+
console.log(`Task: ${result.task}`);
|
|
13
|
+
console.log(`Model: ${result.model}`);
|
|
14
|
+
console.log(`Issue: ${result.issue}`);
|
|
15
|
+
console.log('\nResult:\n');
|
|
16
|
+
|
|
17
|
+
console.log(JSON.stringify(result.result, null, 2));
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.error('❌ Error:', err.message);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main();
|
package/bin/pdd-pro.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { runCli } from '../src/cli/index.js';
|
|
4
|
-
|
|
5
|
-
runCli().catch(err => {
|
|
6
|
-
console.error(err);
|
|
7
|
-
process.exitCode = 1;
|
|
8
|
-
});
|
|
2
|
+
|
|
3
|
+
import { runCli } from '../src/cli/index.js';
|
|
4
|
+
|
|
5
|
+
runCli().catch(err => {
|
|
6
|
+
console.error(err);
|
|
7
|
+
process.exitCode = 1;
|
|
8
|
+
});
|
package/bin/pdd.js
CHANGED
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const targetDir = process.cwd();
|
|
10
|
-
const pddDir = path.join(targetDir, '.pdd');
|
|
11
|
-
|
|
12
|
-
if (fs.existsSync(pddDir)) {
|
|
13
|
-
console.log('PDD already initialized.');
|
|
14
|
-
process.exit(0);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
fs.mkdirSync(pddDir, { recursive: true });
|
|
18
|
-
fs.mkdirSync(path.join(pddDir, 'templates'));
|
|
19
|
-
fs.mkdirSync(path.join(pddDir, 'commands'));
|
|
20
|
-
fs.mkdirSync(path.join(pddDir, 'memory'));
|
|
21
|
-
|
|
22
|
-
fs.writeFileSync(path.join(pddDir, 'README.md'), 'PDD initialized');
|
|
23
|
-
|
|
24
|
-
console.log('✅ PDD initialized successfully.');
|
|
25
|
-
} else {
|
|
26
|
-
console.log('Usage: pdd init');
|
|
27
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { runCli } from '../src/cli/index.js';
|
|
4
|
+
|
|
5
|
+
runCli(process.argv.slice(2)).catch(err => {
|
|
6
|
+
console.error(err);
|
|
7
|
+
process.exitCode = 1;
|
|
8
|
+
});
|
package/package.json
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pcoliveira90/pdd",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Patch-Driven Development CLI — safe, resilient and guided code changes",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"pdd": "bin/pdd-pro.js"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@pcoliveira90/pdd",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Patch-Driven Development CLI — safe, resilient and guided code changes",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"pdd": "bin/pdd-pro.js",
|
|
8
|
+
"pdd-ai": "bin/pdd-ai.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin",
|
|
12
|
+
"src"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"start": "node bin/pdd-pro.js",
|
|
16
|
+
"dev": "node bin/pdd-pro.js",
|
|
17
|
+
"test": "node --test",
|
|
18
|
+
"lint": "node ./scripts/lint-js.mjs",
|
|
19
|
+
"prepublishOnly": "npm pack"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"cli",
|
|
26
|
+
"developer-tools",
|
|
27
|
+
"patch",
|
|
28
|
+
"refactoring",
|
|
29
|
+
"ai-workflow",
|
|
30
|
+
"engineering",
|
|
31
|
+
"pdd"
|
|
32
|
+
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/pcoliveira90/pdd.git"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/pcoliveira90/pdd/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/pcoliveira90/pdd#readme",
|
|
41
|
+
"author": "Paula Oliveira",
|
|
42
|
+
"license": "MIT"
|
|
43
|
+
}
|
package/src/ai/analyze-change.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
function readIfExists(filePath) {
|
|
5
|
-
if (!fs.existsSync(filePath)) return null;
|
|
6
|
-
return fs.readFileSync(filePath, 'utf-8');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function buildAiAnalysisContext(baseDir = process.cwd()) {
|
|
10
|
-
const context = {
|
|
11
|
-
constitution: readIfExists(path.join(baseDir, '.pdd', 'constitution.md')),
|
|
12
|
-
deltaSpec: readIfExists(path.join(baseDir, '.pdd', 'templates', 'delta-spec.md')),
|
|
13
|
-
patchPlan: readIfExists(path.join(baseDir, '.pdd', 'templates', 'patch-plan.md')),
|
|
14
|
-
verification: readIfExists(path.join(baseDir, '.pdd', 'templates', 'verification-report.md'))
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return context;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function buildBugfixPrompt({ issue, baseDir = process.cwd() }) {
|
|
21
|
-
const context = buildAiAnalysisContext(baseDir);
|
|
22
|
-
|
|
23
|
-
return [
|
|
24
|
-
'You are a senior engineer working in an existing system.',
|
|
25
|
-
'Follow Patch-Driven Development principles.',
|
|
26
|
-
'Focus on root cause, minimal safe delta, and regression awareness.',
|
|
27
|
-
'',
|
|
28
|
-
'Issue:',
|
|
29
|
-
issue,
|
|
30
|
-
'',
|
|
31
|
-
'Available context:',
|
|
32
|
-
JSON.stringify(context, null, 2),
|
|
33
|
-
'',
|
|
34
|
-
'Return:',
|
|
35
|
-
'- root cause hypothesis',
|
|
36
|
-
'- impacted areas',
|
|
37
|
-
'- minimal safe delta',
|
|
38
|
-
'- regression risks',
|
|
39
|
-
'- validation plan'
|
|
40
|
-
].join('\n');
|
|
41
|
-
}
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
function readIfExists(filePath) {
|
|
5
|
+
if (!fs.existsSync(filePath)) return null;
|
|
6
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function buildAiAnalysisContext(baseDir = process.cwd()) {
|
|
10
|
+
const context = {
|
|
11
|
+
constitution: readIfExists(path.join(baseDir, '.pdd', 'constitution.md')),
|
|
12
|
+
deltaSpec: readIfExists(path.join(baseDir, '.pdd', 'templates', 'delta-spec.md')),
|
|
13
|
+
patchPlan: readIfExists(path.join(baseDir, '.pdd', 'templates', 'patch-plan.md')),
|
|
14
|
+
verification: readIfExists(path.join(baseDir, '.pdd', 'templates', 'verification-report.md'))
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function buildBugfixPrompt({ issue, baseDir = process.cwd() }) {
|
|
21
|
+
const context = buildAiAnalysisContext(baseDir);
|
|
22
|
+
|
|
23
|
+
return [
|
|
24
|
+
'You are a senior engineer working in an existing system.',
|
|
25
|
+
'Follow Patch-Driven Development principles.',
|
|
26
|
+
'Focus on root cause, minimal safe delta, and regression awareness.',
|
|
27
|
+
'',
|
|
28
|
+
'Issue:',
|
|
29
|
+
issue,
|
|
30
|
+
'',
|
|
31
|
+
'Available context:',
|
|
32
|
+
JSON.stringify(context, null, 2),
|
|
33
|
+
'',
|
|
34
|
+
'Return:',
|
|
35
|
+
'- root cause hypothesis',
|
|
36
|
+
'- impacted areas',
|
|
37
|
+
'- minimal safe delta',
|
|
38
|
+
'- regression risks',
|
|
39
|
+
'- validation plan'
|
|
40
|
+
].join('\n');
|
|
41
|
+
}
|