refacil-sdd-ai 4.2.4 → 4.4.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/README.md +239 -214
- package/agents/auditor.md +189 -184
- package/agents/debugger.md +201 -204
- package/agents/implementer.md +150 -149
- package/agents/investigator.md +80 -89
- package/agents/proposer.md +219 -124
- package/agents/tester.md +140 -144
- package/agents/validator.md +153 -145
- package/bin/cli.js +158 -116
- package/lib/bus/askFulfillment.js +17 -17
- package/lib/bus/broker.js +599 -599
- package/lib/bus/ui/app.js +318 -318
- package/lib/commands/sdd.js +447 -0
- package/lib/hooks.js +236 -236
- package/lib/installer.js +58 -2
- package/lib/methodology-migration-pending.js +101 -136
- package/package.json +4 -6
- package/skills/apply/SKILL.md +139 -120
- package/skills/archive/SKILL.md +105 -107
- package/skills/ask/SKILL.md +78 -78
- package/skills/attend/SKILL.md +70 -70
- package/skills/bug/SKILL.md +121 -128
- package/skills/explore/SKILL.md +73 -63
- package/skills/guide/SKILL.md +79 -79
- package/skills/inbox/SKILL.md +43 -43
- package/skills/join/SKILL.md +82 -82
- package/skills/prereqs/BUS-CROSS-REPO.md +55 -55
- package/skills/prereqs/METHODOLOGY-CONTRACT.md +122 -115
- package/skills/prereqs/SKILL.md +30 -37
- package/skills/propose/SKILL.md +103 -102
- package/skills/reply/SKILL.md +44 -44
- package/skills/review/SKILL.md +163 -126
- package/skills/review/checklist-back.md +92 -92
- package/skills/review/checklist-front.md +72 -72
- package/skills/review/checklist.md +114 -114
- package/skills/say/SKILL.md +38 -38
- package/skills/setup/SKILL.md +85 -141
- package/skills/setup/troubleshooting.md +38 -35
- package/skills/test/SKILL.md +104 -94
- package/skills/test/testing-patterns.md +63 -63
- package/skills/up-code/SKILL.md +108 -108
- package/skills/update/SKILL.md +109 -132
- package/skills/verify/SKILL.md +159 -132
- package/templates/compact-guidance.md +45 -45
- package/templates/methodology-guide.md +46 -42
- package/config/openspec-config.yaml +0 -8
- package/skills/prereqs/OPENSPEC-DELTAS.md +0 -51
|
@@ -1,136 +1,101 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Motor compartido con `refacil-sdd-ai migration-pending`, hooks `check-update` / `notify-update`
|
|
8
|
-
* y la skill `refacil:update`. Si ninguna condicion aplica, no hace falta migrar metodologia.
|
|
9
|
-
*/
|
|
10
|
-
const
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
]);
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
'apply.md',
|
|
20
|
-
'archive.md',
|
|
21
|
-
'explore.md',
|
|
22
|
-
'propose.md',
|
|
23
|
-
'verify.md',
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
for (const
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* @returns {{ pending: boolean, reasons: string[] }}
|
|
103
|
-
*/
|
|
104
|
-
function methodologyMigrationPending(root) {
|
|
105
|
-
const reasons = [];
|
|
106
|
-
|
|
107
|
-
const agentsMd = path.join(root, 'AGENTS.md');
|
|
108
|
-
const agentsDir = path.join(root, '.agents');
|
|
109
|
-
if (fs.existsSync(agentsMd) && !fs.existsSync(agentsDir)) {
|
|
110
|
-
reasons.push('AGENTS.md existe sin carpeta .agents/');
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const claudeMd = path.join(root, 'CLAUDE.md');
|
|
114
|
-
if (legacyIndexDoc(claudeMd)) {
|
|
115
|
-
reasons.push('CLAUDE.md requiere normalización (índice mínimo → AGENTS.md)');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const cursorRules = path.join(root, '.cursorrules');
|
|
119
|
-
if (legacyIndexDoc(cursorRules)) {
|
|
120
|
-
reasons.push('.cursorrules requiere normalización (índice mínimo → AGENTS.md)');
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const extraSkills = collectExtraOpenspecSkills(root);
|
|
124
|
-
if (extraSkills.length) {
|
|
125
|
-
reasons.push(`skills OpenSpec sobrantes: ${extraSkills.join(', ')}`);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
const extraOpsx = [...collectExtraOpsxClaude(root), ...collectExtraOpsxCursor(root)];
|
|
129
|
-
if (extraOpsx.length) {
|
|
130
|
-
reasons.push(`commands opsx sobrantes: ${extraOpsx.join(', ')}`);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return { pending: reasons.length > 0, reasons };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
module.exports = { methodologyMigrationPending };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Motor compartido con `refacil-sdd-ai migration-pending`, hooks `check-update` / `notify-update`
|
|
8
|
+
* y la skill `refacil:update`. Si ninguna condicion aplica, no hace falta migrar metodologia.
|
|
9
|
+
*/
|
|
10
|
+
const REQUIRED_OPSX_CLAUDE = new Set([
|
|
11
|
+
'apply.md',
|
|
12
|
+
'archive.md',
|
|
13
|
+
'explore.md',
|
|
14
|
+
'propose.md',
|
|
15
|
+
'verify.md',
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
const REQUIRED_OPSX_CURSOR = new Set([
|
|
19
|
+
'opsx-apply.md',
|
|
20
|
+
'opsx-archive.md',
|
|
21
|
+
'opsx-explore.md',
|
|
22
|
+
'opsx-propose.md',
|
|
23
|
+
'opsx-verify.md',
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
function legacyIndexDoc(filePath) {
|
|
27
|
+
if (!fs.existsSync(filePath)) return false;
|
|
28
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
29
|
+
const lines = content.split(/\r?\n/).length;
|
|
30
|
+
const pointsToAgents = /AGENTS\.md/i.test(content);
|
|
31
|
+
return lines > 5 || !pointsToAgents;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function collectExtraOpsxClaude(root) {
|
|
35
|
+
const dir = path.join(root, '.claude', 'commands', 'opsx');
|
|
36
|
+
if (!fs.existsSync(dir)) return [];
|
|
37
|
+
let names;
|
|
38
|
+
try {
|
|
39
|
+
names = fs.readdirSync(dir);
|
|
40
|
+
} catch (_) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const extra = [];
|
|
44
|
+
for (const name of names) {
|
|
45
|
+
if (!name.endsWith('.md')) continue;
|
|
46
|
+
if (REQUIRED_OPSX_CLAUDE.has(name)) continue;
|
|
47
|
+
extra.push(path.join('.claude/commands/opsx', name));
|
|
48
|
+
}
|
|
49
|
+
return extra;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function collectExtraOpsxCursor(root) {
|
|
53
|
+
const dir = path.join(root, '.cursor', 'commands');
|
|
54
|
+
if (!fs.existsSync(dir)) return [];
|
|
55
|
+
let names;
|
|
56
|
+
try {
|
|
57
|
+
names = fs.readdirSync(dir);
|
|
58
|
+
} catch (_) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
const extra = [];
|
|
62
|
+
for (const name of names) {
|
|
63
|
+
if (!name.startsWith('opsx-') || !name.endsWith('.md')) continue;
|
|
64
|
+
if (REQUIRED_OPSX_CURSOR.has(name)) continue;
|
|
65
|
+
extra.push(path.join('.cursor/commands', name));
|
|
66
|
+
}
|
|
67
|
+
return extra;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} root - raíz del repo
|
|
72
|
+
* @returns {{ pending: boolean, reasons: string[] }}
|
|
73
|
+
*/
|
|
74
|
+
function methodologyMigrationPending(root) {
|
|
75
|
+
const reasons = [];
|
|
76
|
+
|
|
77
|
+
const agentsMd = path.join(root, 'AGENTS.md');
|
|
78
|
+
const agentsDir = path.join(root, '.agents');
|
|
79
|
+
if (fs.existsSync(agentsMd) && !fs.existsSync(agentsDir)) {
|
|
80
|
+
reasons.push('AGENTS.md existe sin carpeta .agents/');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const claudeMd = path.join(root, 'CLAUDE.md');
|
|
84
|
+
if (legacyIndexDoc(claudeMd)) {
|
|
85
|
+
reasons.push('CLAUDE.md requiere normalización (índice mínimo → AGENTS.md)');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const cursorRules = path.join(root, '.cursorrules');
|
|
89
|
+
if (legacyIndexDoc(cursorRules)) {
|
|
90
|
+
reasons.push('.cursorrules requiere normalización (índice mínimo → AGENTS.md)');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const extraOpsx = [...collectExtraOpsxClaude(root), ...collectExtraOpsxCursor(root)];
|
|
94
|
+
if (extraOpsx.length) {
|
|
95
|
+
reasons.push(`commands opsx sobrantes: ${extraOpsx.join(', ')}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return { pending: reasons.length > 0, reasons };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
module.exports = { methodologyMigrationPending };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "refacil-sdd-ai",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "SDD-AI: Specification-Driven Development with AI —
|
|
3
|
+
"version": "4.4.0",
|
|
4
|
+
"description": "SDD-AI: Specification-Driven Development with AI — development methodology using AI with Claude Code and Cursor",
|
|
5
5
|
"bin": {
|
|
6
6
|
"refacil-sdd-ai": "./bin/cli.js"
|
|
7
7
|
},
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"skills/",
|
|
12
12
|
"agents/",
|
|
13
13
|
"templates/",
|
|
14
|
-
"config/",
|
|
15
14
|
"README.md",
|
|
16
15
|
"refacil-bus-diagrams.md"
|
|
17
16
|
],
|
|
@@ -19,7 +18,6 @@
|
|
|
19
18
|
"ai",
|
|
20
19
|
"development",
|
|
21
20
|
"methodology",
|
|
22
|
-
"openspec",
|
|
23
21
|
"claude-code",
|
|
24
22
|
"cursor",
|
|
25
23
|
"sdd",
|
|
@@ -34,10 +32,10 @@
|
|
|
34
32
|
"url": ""
|
|
35
33
|
},
|
|
36
34
|
"engines": {
|
|
37
|
-
"node": ">=20.
|
|
35
|
+
"node": ">=20.0.0"
|
|
38
36
|
},
|
|
39
37
|
"scripts": {
|
|
40
|
-
"test": "node --test test/hooks.test.js test/installer.test.js test/ignore-files.test.js test/methodology-migration-pending.test.js"
|
|
38
|
+
"test": "node --test test/hooks.test.js test/installer.test.js test/ignore-files.test.js test/methodology-migration-pending.test.js test/sdd.test.js test/refactor-integrar-openspec-nativo.test.js test/refactor-rutas-refacil-sdd.test.js test/refactor-agents-english.test.js test/remove-openspec-legacy.test.js"
|
|
41
39
|
},
|
|
42
40
|
"dependencies": {
|
|
43
41
|
"ws": "^8.18.0"
|
package/skills/apply/SKILL.md
CHANGED
|
@@ -1,120 +1,139 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: refacil:apply
|
|
3
|
-
description:
|
|
4
|
-
user-invocable: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# refacil:apply — Entrypoint
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
1
|
+
---
|
|
2
|
+
name: refacil:apply
|
|
3
|
+
description: Implement the tasks of a proposed change — verifies artifacts and working branch, builds a structured briefing, and delegates to the refacil-implementer sub-agent to execute the implementation in isolated context
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# refacil:apply — Implementation Entrypoint
|
|
8
|
+
|
|
9
|
+
This skill is a **wrapper** that verifies the critical preconditions (SDD artifacts and working branch), builds a **structured briefing** with the key context already extracted, and delegates the implementation to the `refacil-implementer` sub-agent. The briefing prevents the sub-agent from rediscovering from scratch — it starts implementing, not exploring.
|
|
10
|
+
|
|
11
|
+
**Prerequisites**: `sdd` profile from `refacil-prereqs/SKILL.md` + rules from `METHODOLOGY-CONTRACT.md`.
|
|
12
|
+
|
|
13
|
+
## Flow
|
|
14
|
+
|
|
15
|
+
### Step 0: Verify SDD artifacts exist (blocking)
|
|
16
|
+
|
|
17
|
+
Run `refacil-sdd-ai sdd list --json` to get the active changes.
|
|
18
|
+
|
|
19
|
+
- **If there are no active changes**: inform to run `/refacil:propose` and **stop**.
|
|
20
|
+
- **If there is a single active change**: use that `changeName`.
|
|
21
|
+
- **If there are multiple active changes**: list the names and ask which one to implement. Do not invoke the sub-agent with ambiguous scope.
|
|
22
|
+
|
|
23
|
+
With the selected `changeName`, run `refacil-sdd-ai sdd status <changeName> --json` and parse the JSON:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"name": "...",
|
|
28
|
+
"artifacts": { "proposal": bool, "design": bool, "tasks": bool, "specs": bool },
|
|
29
|
+
"tasks": { "total": N, "done": N, "pending": N },
|
|
30
|
+
"reviewPassed": bool,
|
|
31
|
+
"ready": { "forApply": bool, "forArchive": bool }
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Validations:
|
|
36
|
+
- If `artifacts.proposal` is `false` or `artifacts.tasks` is `false` or `artifacts.specs` is `false`:
|
|
37
|
+
```
|
|
38
|
+
The change at refacil-sdd/changes/[name]/ is incomplete.
|
|
39
|
+
Missing: [list of artifacts with false]
|
|
40
|
+
Run: /refacil:propose to complete the artifacts before implementing.
|
|
41
|
+
```
|
|
42
|
+
**Stop.**
|
|
43
|
+
- If `ready.forApply` is `false` for the same reason: same message above.
|
|
44
|
+
|
|
45
|
+
Note: `specs` is `true` if `specs.md` exists in the root **OR** at least one `.md` under the change's `specs/` folder.
|
|
46
|
+
|
|
47
|
+
**IMPORTANT**: This command NEVER generates SDD artifacts. If they do not exist, the user must use `/refacil:propose`.
|
|
48
|
+
|
|
49
|
+
### Step 1: Validate working branch (blocking — before delegating)
|
|
50
|
+
|
|
51
|
+
Run `git branch --show-current` to get the current branch.
|
|
52
|
+
|
|
53
|
+
Apply the **Protected branch policy and branch creation** defined in `refacil-prereqs/METHODOLOGY-CONTRACT.md`.
|
|
54
|
+
|
|
55
|
+
- **If the current branch is protected**: execute the full branch creation protocol **before continuing**. Do not delegate to the sub-agent until on a working branch.
|
|
56
|
+
- For `refacil:apply`, the suggested branch prefix is `feature/`.
|
|
57
|
+
- If the current branch is already a working branch (`feature/*`, `fix/*`, `hotfix/*`, `refactor/*`, etc.), continue without interruption.
|
|
58
|
+
- If the user does not approve the branch creation/change, **stop**. Do not continue with implementation.
|
|
59
|
+
|
|
60
|
+
### Step 1.5: Build structured briefing (reduces sub-agent tool calls)
|
|
61
|
+
|
|
62
|
+
Before invoking the sub-agent, extract the key context by reading the artifacts. This prevents the sub-agent from rediscovering them from scratch.
|
|
63
|
+
|
|
64
|
+
1. **Objective** — read the first section of `refacil-sdd/changes/<changeName>/proposal.md`. Extract the objective in 1-2 sentences.
|
|
65
|
+
2. **File scope** — read `refacil-sdd/changes/<changeName>/design.md`. Extract:
|
|
66
|
+
- List of files to **create** (full paths)
|
|
67
|
+
- List of files to **modify** (full paths)
|
|
68
|
+
3. **Tasks** — read `refacil-sdd/changes/<changeName>/tasks.md`. Extract the full numbered list.
|
|
69
|
+
4. **Test command** — read `refacil-prereqs/METHODOLOGY-CONTRACT.md` §3. Extract the exact command.
|
|
70
|
+
5. **Architecture context** — read `.agents/stack.md` if it exists; if not, `.agents/architecture.md`; if neither exists, read only the first 60 lines of `AGENTS.md`. **Do not read the entire `.agents/` folder**.
|
|
71
|
+
|
|
72
|
+
Build the BRIEFING block that you will include literally in the delegation prompt:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
BRIEFING:
|
|
76
|
+
changeName: <name>
|
|
77
|
+
objective: <objective in 1-2 sentences from the proposal>
|
|
78
|
+
scope:
|
|
79
|
+
create: [path/new-file-1.ts, path/new-file-2.ts, ...]
|
|
80
|
+
modify: [path/existing-1.ts, path/existing-2.ts, ...]
|
|
81
|
+
doNotTouch: [refacil-sdd/, .claude/, .cursor/, AGENTS.md, package-lock.json]
|
|
82
|
+
tasks:
|
|
83
|
+
1. <task 1>
|
|
84
|
+
2. <task 2>
|
|
85
|
+
...
|
|
86
|
+
testCommand: <exact command>
|
|
87
|
+
architectureContext: |
|
|
88
|
+
<extract from stack.md or first lines of AGENTS.md>
|
|
89
|
+
specsNote: <"specs.md" | "specs/**/*.md" | "both — report contradictions in issues">
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Step 2: Delegate to the refacil-implementer sub-agent
|
|
93
|
+
|
|
94
|
+
Invoke the `refacil-implementer` sub-agent passing it the BRIEFING from the previous step plus:
|
|
95
|
+
- `changeName` (redundant with the briefing, but the guardrail needs it)
|
|
96
|
+
- If the user requested detailed mode, indicate it. Default: concise.
|
|
97
|
+
|
|
98
|
+
The sub-agent will use the briefing as the primary guide and will only read the files in `scope.modify` to understand existing interfaces — it will not re-read the already-extracted artifacts.
|
|
99
|
+
|
|
100
|
+
Returns ONE single message with the report + JSON block fenced as ` ```refacil-apply-result `.
|
|
101
|
+
|
|
102
|
+
### Step 2.5: Write memory.yaml (CA-16 — cross-skill state)
|
|
103
|
+
|
|
104
|
+
After parsing the `refacil-apply-result` block:
|
|
105
|
+
- Extract `touchedFiles` from the result (list of files actually created/modified by the implementer).
|
|
106
|
+
- Write or update `refacil-sdd/changes/<changeName>/memory.yaml` preserving any existing fields:
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
lastStep: apply
|
|
110
|
+
touchedFiles:
|
|
111
|
+
- path/file-1.ts
|
|
112
|
+
- path/file-2.ts
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If the file already exists, merge: update `lastStep` and `touchedFiles`; do not remove fields set by other steps (e.g. `commandsRun` from test).
|
|
116
|
+
|
|
117
|
+
If `result` is `"FAILED"`, skip the write and wait for user instructions.
|
|
118
|
+
|
|
119
|
+
### Step 3: Present result and next step
|
|
120
|
+
|
|
121
|
+
Show the user the **report** (everything before the `refacil-apply-result` block). Do not show the JSON block — it is internal metadata.
|
|
122
|
+
|
|
123
|
+
After the report add:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
The next step is to generate/adjust unit tests.
|
|
127
|
+
Do you want me to continue with /refacil:test?
|
|
128
|
+
(The flow then continues with /refacil:verify)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
If the sub-agent returned `result: "PARTIAL"` or `"FAILED"`, present the `issues` to the user and ask for instructions before continuing.
|
|
132
|
+
|
|
133
|
+
## Rules
|
|
134
|
+
|
|
135
|
+
- NEVER generate SDD artifacts from this command — that is exclusively `/refacil:propose`'s responsibility.
|
|
136
|
+
- Meet the preconditions of Step 0 (complete artifacts) and Step 1 (valid working branch) **before delegating**.
|
|
137
|
+
- **Always build the briefing (Step 1.5) before delegating** — it is the key piece that reduces the sub-agent cost.
|
|
138
|
+
- **Always delegate implementation to the sub-agent**. Do not replicate implementation logic or SDD artifact-apply logic here.
|
|
139
|
+
- **Flow continuity**: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 3, immediately invoke the **Skill tool** with `skill: "refacil:test"`. Do not describe it in text or wait for the user to type `/refacil:test`. (See `METHODOLOGY-CONTRACT.md §5`.)
|