spec-driven-agility 0.5.1 → 0.6.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/README.md +8 -3
- package/package.json +1 -1
- package/src/animation.js +220 -61
- package/src/cli.js +1 -1
- package/src/installer.js +15 -3
- package/templates/skills/sda-build/SKILL.md +1 -1
- package/templates/skills/sda-end/SKILL.md +7 -7
- package/templates/skills/sda-explore/SKILL.md +1 -1
- package/templates/skills/sda-spec/SKILL.md +3 -3
- package/templates/skills/sda-sprint/SKILL.md +4 -4
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Esto crea:
|
|
|
23
23
|
```
|
|
24
24
|
.opencode/commands/sda-*.md ← 5 comandos: /sda-sprint, /sda-explore, /sda-spec, /sda-build, /sda-end
|
|
25
25
|
.opencode/skills/sda-*/SKILL.md ← 5 skills con las reglas y plantillas
|
|
26
|
-
|
|
26
|
+
backlog/ ← backlog de sprints (se llena con /sda-sprint)
|
|
27
27
|
specs/ ← historia de specs viva (la mantiene /sda-end)
|
|
28
28
|
```
|
|
29
29
|
|
|
@@ -35,7 +35,10 @@ Después ejecuta `/sda-sprint` en opencode: ahí se define (o se hereda de un sp
|
|
|
35
35
|
sda update
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Re-sincroniza comandos y skills. No toca `
|
|
38
|
+
Re-sincroniza comandos y skills. No toca `backlog/` ni `specs/`.
|
|
39
|
+
|
|
40
|
+
> Si vienes de la 0.5.x o anterior, renombra tu carpeta `Backlog/` a `backlog/` una vez:
|
|
41
|
+
> `git mv Backlog backlog` (en Windows/macOS, si git no lo detecta, usa `git mv Backlog tmp && git mv tmp backlog`).
|
|
39
42
|
|
|
40
43
|
## Comandos
|
|
41
44
|
|
|
@@ -61,7 +64,9 @@ help Muestra la ayuda.
|
|
|
61
64
|
|
|
62
65
|
`sda init` muestra una **planta pixel-art en verdes oscuros** hecha con bloques de mosaico
|
|
63
66
|
(`█▓▒░`); el patrón de sombra se desplaza suavemente en bucle, **sin apagarse**, hasta que presionas
|
|
64
|
-
ENTER.
|
|
67
|
+
ENTER. La intro es responsiva: si la terminal no alcanza el ancho para la planta, muestra solo el
|
|
68
|
+
texto de bienvenida y los comandos; si es demasiado pequeña, se omite y la instalación continúa
|
|
69
|
+
directamente. En CI o scripts se omite sola; también puedes forzarlo con `sda init --no-animation`.
|
|
65
70
|
|
|
66
71
|
## Filosofía
|
|
67
72
|
|
package/package.json
CHANGED
package/src/animation.js
CHANGED
|
@@ -11,35 +11,49 @@ const H = 15;
|
|
|
11
11
|
function buildLevels() {
|
|
12
12
|
const filled = Array.from({ length: H }, () => Array(W).fill(false));
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// Elipse con rotación para hojas naturales y no simétricas.
|
|
15
|
+
const ell = (cx, cy, rx, ry, on, angle = 0) => {
|
|
16
|
+
const cos = Math.cos(angle);
|
|
17
|
+
const sin = Math.sin(angle);
|
|
15
18
|
for (let y = 0; y < H; y += 1) {
|
|
16
19
|
for (let x = 0; x < W; x += 1) {
|
|
17
|
-
const dx =
|
|
18
|
-
const dy =
|
|
19
|
-
|
|
20
|
+
const dx = x - cx;
|
|
21
|
+
const dy = y - cy;
|
|
22
|
+
const u = dx * cos + dy * sin;
|
|
23
|
+
const v = -dx * sin + dy * cos;
|
|
24
|
+
if ((u / rx) ** 2 + (v / ry) ** 2 <= 1) filled[y][x] = on;
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
};
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
const dot = (cx, cy, r) => {
|
|
30
|
+
for (let y = Math.floor(cy - r); y <= Math.ceil(cy + r); y += 1) {
|
|
31
|
+
for (let x = Math.floor(cx - r); x <= Math.ceil(cx + r); x += 1) {
|
|
32
|
+
if (x < 0 || x >= W || y < 0 || y >= H) continue;
|
|
33
|
+
if ((x - cx) ** 2 + (y - cy) ** 2 <= r * r) filled[y][x] = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
27
37
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
const stroke = (x0, y0, x1, y1, r) => {
|
|
39
|
+
const steps = 60;
|
|
40
|
+
for (let i = 0; i <= steps; i += 1) {
|
|
41
|
+
const t = i / steps;
|
|
42
|
+
dot(x0 + (x1 - x0) * t, y0 + (y1 - y0) * t, r);
|
|
33
43
|
}
|
|
34
|
-
}
|
|
44
|
+
};
|
|
35
45
|
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
// Hojas distintas: la derecha es más alta, pequeña e inclinada hacia arriba;
|
|
47
|
+
// la izquierda queda más abajo, más grande y caída hacia fuera.
|
|
48
|
+
ell(20.4, 4, 5.9, 3.4, true, 0.2);
|
|
49
|
+
ell(5.9, 8.4, 6.4, 3.7, true, -0.22);
|
|
50
|
+
|
|
51
|
+
// Tallo largo, ligeramente inclinado, y peciolo de la hoja izquierda.
|
|
52
|
+
stroke(13.4, 12.2, 14.6, 4.8, 1);
|
|
53
|
+
stroke(11.7, 9.4, 13.9, 9.4, 0.55);
|
|
40
54
|
|
|
41
55
|
// Montículo.
|
|
42
|
-
ell(13.5, 17, 12,
|
|
56
|
+
ell(13.5, 17, 12.2, 4.8, true);
|
|
43
57
|
|
|
44
58
|
const isFilled = (x, y) => x >= 0 && x < W && y >= 0 && y < H && filled[y][x];
|
|
45
59
|
const isEdge = (x, y) =>
|
|
@@ -67,7 +81,9 @@ const RESET = '\x1b[0m';
|
|
|
67
81
|
const HIDE = '\x1b[?25l';
|
|
68
82
|
const SHOW = '\x1b[?25h';
|
|
69
83
|
const CLEAR = '\x1b[2K';
|
|
70
|
-
const BLOCK_HEIGHT = H
|
|
84
|
+
const BLOCK_HEIGHT = H; // alto del bloque en modo frames (pruebas)
|
|
85
|
+
const ENTER_ALT = '\x1b[?1049h';
|
|
86
|
+
const LEAVE_ALT = '\x1b[?1049l';
|
|
71
87
|
|
|
72
88
|
// Verdes oscuros: cuerpo siempre visible (40/34), borde más oscuro (28/22).
|
|
73
89
|
const COLOR = {
|
|
@@ -76,17 +92,63 @@ const COLOR = {
|
|
|
76
92
|
'▓': '\x1b[38;5;34m',
|
|
77
93
|
'█': '\x1b[38;5;40m',
|
|
78
94
|
};
|
|
79
|
-
const PROMPT_COLOR = '\x1b[38;5;28m';
|
|
80
|
-
const PROMPT = ' Press ENTER to continue... ';
|
|
81
95
|
|
|
82
|
-
//
|
|
96
|
+
// Paleta del panel, alineada a la derecha de la planta.
|
|
97
|
+
const TITLE_COLOR = '\x1b[1m\x1b[97m';
|
|
98
|
+
const BODY_COLOR = '\x1b[38;5;252m';
|
|
99
|
+
const MUTED_COLOR = '\x1b[38;5;244m';
|
|
100
|
+
const CMD_COLOR = '\x1b[38;5;40m';
|
|
101
|
+
const PROMPT_COLOR = '\x1b[3m\x1b[97m';
|
|
102
|
+
|
|
83
103
|
const PANEL_GAP = ' ';
|
|
104
|
+
const COMMAND_COLUMN = 15;
|
|
105
|
+
|
|
106
|
+
function commandRow(command, description) {
|
|
107
|
+
return [
|
|
108
|
+
{ text: command, color: CMD_COLOR },
|
|
109
|
+
{ text: ' '.repeat(Math.max(2, COMMAND_COLUMN - command.length)), color: '' },
|
|
110
|
+
{ text: description, color: MUTED_COLOR },
|
|
111
|
+
];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Cada fila del panel corresponde a una fila de la planta.
|
|
84
115
|
const PANEL = {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
116
|
+
0: [{ text: 'Welcome to Spec-Driven Agility', color: TITLE_COLOR }],
|
|
117
|
+
1: [{ text: 'A lightweight spec-driven framework', color: MUTED_COLOR }],
|
|
118
|
+
3: [{ text: 'This setup will configure:', color: BODY_COLOR }],
|
|
119
|
+
4: [{ text: ' • Agent Skills for AI tools', color: MUTED_COLOR }],
|
|
120
|
+
5: [{ text: ' • Workflow commands for /sda-*', color: MUTED_COLOR }],
|
|
121
|
+
7: [{ text: 'Quick start after setup:', color: BODY_COLOR }],
|
|
122
|
+
8: commandRow('/sda-sprint', 'Plan the sprint backlog'),
|
|
123
|
+
9: commandRow('/sda-explore', 'Explore the approach'),
|
|
124
|
+
10: commandRow('/sda-spec', 'Write spec, design & tasks'),
|
|
125
|
+
11: commandRow('/sda-build', 'Implement with e2e TDD'),
|
|
126
|
+
12: commandRow('/sda-end', 'Validate and sync specs'),
|
|
127
|
+
14: [{ text: 'Press Enter to continue...', color: PROMPT_COLOR }],
|
|
88
128
|
};
|
|
89
129
|
|
|
130
|
+
// Layouts responsivos: full (planta + panel), compact (solo texto) o skip.
|
|
131
|
+
const PANEL_WIDTH = Math.max(
|
|
132
|
+
...Object.values(PANEL).map((row) => row.reduce((width, part) => width + part.text.length, 0)),
|
|
133
|
+
);
|
|
134
|
+
const COMPACT_ROWS = Object.keys(PANEL)
|
|
135
|
+
.map(Number)
|
|
136
|
+
.sort((a, b) => a - b);
|
|
137
|
+
|
|
138
|
+
const FULL_MIN_COLUMNS = W + PANEL_GAP.length + PANEL_WIDTH + 1;
|
|
139
|
+
const FULL_MIN_ROWS = H;
|
|
140
|
+
const COMPACT_MIN_COLUMNS = PANEL_WIDTH + 1;
|
|
141
|
+
const COMPACT_MIN_ROWS = COMPACT_ROWS.length + 1;
|
|
142
|
+
|
|
143
|
+
function detectLayout(stream) {
|
|
144
|
+
const columns = stream && stream.columns;
|
|
145
|
+
const rows = stream && stream.rows;
|
|
146
|
+
if (!columns || !rows) return 'skip';
|
|
147
|
+
if (columns >= FULL_MIN_COLUMNS && rows >= FULL_MIN_ROWS) return 'full';
|
|
148
|
+
if (columns >= COMPACT_MIN_COLUMNS && rows >= COMPACT_MIN_ROWS) return 'compact';
|
|
149
|
+
return 'skip';
|
|
150
|
+
}
|
|
151
|
+
|
|
90
152
|
function sleep(ms) {
|
|
91
153
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
92
154
|
}
|
|
@@ -98,6 +160,16 @@ function canAnimate(stream) {
|
|
|
98
160
|
return true;
|
|
99
161
|
}
|
|
100
162
|
|
|
163
|
+
function formatPanelRow(y) {
|
|
164
|
+
const row = PANEL[y];
|
|
165
|
+
if (!row) return '';
|
|
166
|
+
let out = '';
|
|
167
|
+
for (const part of row) {
|
|
168
|
+
out += part.color ? `${part.color}${part.text}${RESET}` : part.text;
|
|
169
|
+
}
|
|
170
|
+
return out;
|
|
171
|
+
}
|
|
172
|
+
|
|
101
173
|
function lineFor(y, phase) {
|
|
102
174
|
let out = '';
|
|
103
175
|
for (let x = 0; x < W; x += 1) {
|
|
@@ -113,19 +185,25 @@ function lineFor(y, phase) {
|
|
|
113
185
|
out += COLOR[ch] + ch + RESET;
|
|
114
186
|
}
|
|
115
187
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
out += `${PANEL_GAP}${panel.color}${panel.text}${RESET}`;
|
|
188
|
+
if (PANEL[y]) {
|
|
189
|
+
out += `${PANEL_GAP}${formatPanelRow(y)}`;
|
|
119
190
|
}
|
|
120
191
|
|
|
121
192
|
return out;
|
|
122
193
|
}
|
|
123
194
|
|
|
124
|
-
|
|
195
|
+
// Modo full: posicionamiento absoluto dentro del buffer alternativo.
|
|
196
|
+
function drawFrameAbsolute(stream, phase) {
|
|
197
|
+
for (let y = 0; y < H; y += 1) {
|
|
198
|
+
stream.write(`\x1b[${y + 1};1H${CLEAR}${lineFor(y, phase)}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Modo frames (pruebas): salida secuencial reutilizando el borrado por cursor.
|
|
203
|
+
function drawFrameSequential(stream, phase) {
|
|
125
204
|
for (let y = 0; y < H; y += 1) {
|
|
126
205
|
stream.write(`\r${CLEAR}${lineFor(y, phase)}\n`);
|
|
127
206
|
}
|
|
128
|
-
stream.write(`\r${CLEAR}${PROMPT_COLOR}${PROMPT}${RESET}\n`);
|
|
129
207
|
}
|
|
130
208
|
|
|
131
209
|
function erase(stream) {
|
|
@@ -136,38 +214,49 @@ function erase(stream) {
|
|
|
136
214
|
stream.write(`\x1b[${BLOCK_HEIGHT}A`);
|
|
137
215
|
}
|
|
138
216
|
|
|
139
|
-
async function drawLoop(
|
|
217
|
+
async function drawLoop(
|
|
218
|
+
stream,
|
|
219
|
+
{ frames, delay = 110, stopWhen, render, cursorUp = false, checkLayout = false } = {},
|
|
220
|
+
) {
|
|
140
221
|
let first = true;
|
|
141
222
|
let frame = 0;
|
|
142
223
|
|
|
143
224
|
while (true) {
|
|
144
225
|
if (stopWhen && stopWhen()) break;
|
|
145
226
|
if (frames !== undefined && frame >= frames) break;
|
|
227
|
+
if (checkLayout && detectLayout(stream) !== 'full') return { aborted: true };
|
|
146
228
|
|
|
147
|
-
if (!first) stream.write(`\x1b[${BLOCK_HEIGHT}A`);
|
|
229
|
+
if (!first && cursorUp) stream.write(`\x1b[${BLOCK_HEIGHT}A`);
|
|
148
230
|
// La sombra se desplaza cada 3 frames: movimiento lento y continuo.
|
|
149
231
|
const phase = Math.floor(frame / 3) % 2;
|
|
150
|
-
|
|
232
|
+
render(stream, phase);
|
|
151
233
|
first = false;
|
|
152
234
|
frame += 1;
|
|
153
235
|
await sleep(delay);
|
|
154
236
|
}
|
|
237
|
+
|
|
238
|
+
return { aborted: false };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function restoreTerminalOnAbort(stream, cleanup, fromAltScreen = false) {
|
|
242
|
+
cleanup();
|
|
243
|
+
stream.write(`${fromAltScreen ? LEAVE_ALT : ''}${SHOW}`);
|
|
244
|
+
process.exit(130);
|
|
155
245
|
}
|
|
156
246
|
|
|
157
|
-
|
|
247
|
+
// Modo compact: texto estático y espera de ENTER.
|
|
248
|
+
function waitForKey(stdin, stream) {
|
|
158
249
|
return new Promise((resolve) => {
|
|
250
|
+
const cleanup = () => {
|
|
251
|
+
stdin.setRawMode(false);
|
|
252
|
+
stdin.pause();
|
|
253
|
+
stdin.removeListener('data', onData);
|
|
254
|
+
};
|
|
255
|
+
|
|
159
256
|
const onData = (key) => {
|
|
160
|
-
if (key === '\u0003')
|
|
161
|
-
stdin.setRawMode(false);
|
|
162
|
-
stdin.pause();
|
|
163
|
-
stdin.removeListener('data', onData);
|
|
164
|
-
process.stdout.write(SHOW);
|
|
165
|
-
process.exit(130);
|
|
166
|
-
}
|
|
257
|
+
if (key === '\u0003') restoreTerminalOnAbort(stream, cleanup);
|
|
167
258
|
if (key === '\r' || key === '\n') {
|
|
168
|
-
|
|
169
|
-
stdin.pause();
|
|
170
|
-
stdin.removeListener('data', onData);
|
|
259
|
+
cleanup();
|
|
171
260
|
resolve();
|
|
172
261
|
}
|
|
173
262
|
};
|
|
@@ -179,9 +268,59 @@ function waitForKey(stdin) {
|
|
|
179
268
|
});
|
|
180
269
|
}
|
|
181
270
|
|
|
271
|
+
// Modo full: espera ENTER, Ctrl+C o un resize que ya no permita el layout full.
|
|
272
|
+
function waitForExit(stdin, stream) {
|
|
273
|
+
return new Promise((resolve) => {
|
|
274
|
+
let poll;
|
|
275
|
+
|
|
276
|
+
const cleanup = () => {
|
|
277
|
+
clearInterval(poll);
|
|
278
|
+
stdin.setRawMode(false);
|
|
279
|
+
stdin.pause();
|
|
280
|
+
stdin.removeListener('data', onData);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const onData = (key) => {
|
|
284
|
+
if (key === '\u0003') restoreTerminalOnAbort(stream, cleanup, true);
|
|
285
|
+
if (key === '\r' || key === '\n') {
|
|
286
|
+
cleanup();
|
|
287
|
+
resolve('enter');
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
poll = setInterval(() => {
|
|
292
|
+
if (detectLayout(stream) !== 'full') {
|
|
293
|
+
cleanup();
|
|
294
|
+
resolve('resize');
|
|
295
|
+
}
|
|
296
|
+
}, 250);
|
|
297
|
+
|
|
298
|
+
stdin.setRawMode(true);
|
|
299
|
+
stdin.resume();
|
|
300
|
+
stdin.setEncoding('utf8');
|
|
301
|
+
stdin.on('data', onData);
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
async function runCompact(stream, stdin) {
|
|
306
|
+
for (const y of COMPACT_ROWS) {
|
|
307
|
+
stream.write(`${formatPanelRow(y)}\n`);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (stdin.isTTY) {
|
|
311
|
+
await waitForKey(stdin, stream);
|
|
312
|
+
} else {
|
|
313
|
+
await sleep(1500);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
|
|
182
319
|
/**
|
|
183
320
|
* Intro animada: planta pixel-art con sombra en movimiento hasta ENTER.
|
|
184
|
-
*
|
|
321
|
+
* Responsiva: sin ancho suficiente muestra solo el texto; si es demasiado
|
|
322
|
+
* pequeña se omite y la instalación continúa directamente. También se omite
|
|
323
|
+
* en CI, salidas no interactivas o con `--no-animation`.
|
|
185
324
|
*/
|
|
186
325
|
export async function playIntro({
|
|
187
326
|
enabled = true,
|
|
@@ -191,32 +330,52 @@ export async function playIntro({
|
|
|
191
330
|
} = {}) {
|
|
192
331
|
if (!enabled || !canAnimate(stream)) return false;
|
|
193
332
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
333
|
+
if (frames !== undefined) {
|
|
334
|
+
stream.write(HIDE);
|
|
335
|
+
try {
|
|
336
|
+
await drawLoop(stream, {
|
|
337
|
+
frames,
|
|
338
|
+
delay: 80,
|
|
339
|
+
render: drawFrameSequential,
|
|
340
|
+
cursorUp: true,
|
|
341
|
+
});
|
|
199
342
|
erase(stream);
|
|
200
343
|
stream.write(SHOW);
|
|
201
344
|
return true;
|
|
345
|
+
} catch {
|
|
346
|
+
stream.write(SHOW);
|
|
347
|
+
return false;
|
|
202
348
|
}
|
|
349
|
+
}
|
|
203
350
|
|
|
351
|
+
const layout = detectLayout(stream);
|
|
352
|
+
if (layout === 'skip') return false;
|
|
353
|
+
if (layout === 'compact') return runCompact(stream, stdin);
|
|
354
|
+
|
|
355
|
+
stream.write(`${ENTER_ALT}${HIDE}\x1b[2J`);
|
|
356
|
+
|
|
357
|
+
try {
|
|
204
358
|
let stop = false;
|
|
205
|
-
const loop = drawLoop(stream, {
|
|
359
|
+
const loop = drawLoop(stream, {
|
|
360
|
+
stopWhen: () => stop,
|
|
361
|
+
render: drawFrameAbsolute,
|
|
362
|
+
checkLayout: true,
|
|
363
|
+
});
|
|
206
364
|
|
|
207
|
-
|
|
208
|
-
await
|
|
209
|
-
|
|
210
|
-
await sleep(2000);
|
|
211
|
-
}
|
|
365
|
+
const outcome = stdin.isTTY
|
|
366
|
+
? await waitForExit(stdin, stream)
|
|
367
|
+
: await sleep(2000).then(() => 'timeout');
|
|
212
368
|
|
|
213
369
|
stop = true;
|
|
214
|
-
await loop;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return true;
|
|
370
|
+
const { aborted } = await loop;
|
|
371
|
+
stream.write(LEAVE_ALT + SHOW);
|
|
372
|
+
|
|
373
|
+
if (!aborted && outcome !== 'resize') return true;
|
|
374
|
+
|
|
375
|
+
if (detectLayout(stream) === 'compact') return runCompact(stream, stdin);
|
|
376
|
+
return false;
|
|
218
377
|
} catch {
|
|
219
|
-
stream.write(SHOW);
|
|
378
|
+
stream.write(LEAVE_ALT + SHOW);
|
|
220
379
|
return false;
|
|
221
380
|
}
|
|
222
381
|
}
|
package/src/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ Uso:
|
|
|
18
18
|
|
|
19
19
|
Comandos:
|
|
20
20
|
init [ruta] Instala los comandos /sda-*, las skills y las carpetas
|
|
21
|
-
|
|
21
|
+
backlog/ y specs/. Por defecto usa el directorio actual.
|
|
22
22
|
Usa --no-animation para omitir la intro animada.
|
|
23
23
|
update [ruta] Re-sincroniza comandos y skills. No toca config ni datos.
|
|
24
24
|
version Muestra la versión instalada.
|
package/src/installer.js
CHANGED
|
@@ -52,7 +52,7 @@ function installSkills(targetDir) {
|
|
|
52
52
|
|
|
53
53
|
function scaffoldDirs(targetDir) {
|
|
54
54
|
const created = [];
|
|
55
|
-
for (const name of ['
|
|
55
|
+
for (const name of ['backlog', 'specs']) {
|
|
56
56
|
const dir = path.join(targetDir, name);
|
|
57
57
|
if (fs.existsSync(dir)) continue;
|
|
58
58
|
ensureDir(dir);
|
|
@@ -62,6 +62,12 @@ function scaffoldDirs(targetDir) {
|
|
|
62
62
|
return created;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
function hasLegacyBacklogDir(targetDir) {
|
|
66
|
+
if (!fs.existsSync(targetDir)) return false;
|
|
67
|
+
const entries = fs.readdirSync(targetDir);
|
|
68
|
+
return entries.includes('Backlog') && !entries.includes('backlog');
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
function printHeader(targetDir) {
|
|
66
72
|
console.log('');
|
|
67
73
|
console.log(' Spec-Driven Agility (SDA)');
|
|
@@ -75,14 +81,20 @@ export function runInit(targetDir) {
|
|
|
75
81
|
const commands = installCommands(targetDir);
|
|
76
82
|
const skills = installSkills(targetDir);
|
|
77
83
|
const dirs = scaffoldDirs(targetDir);
|
|
84
|
+
const legacyBacklog = hasLegacyBacklogDir(targetDir);
|
|
78
85
|
|
|
79
86
|
console.log(` ✔ ${commands} comandos en .opencode/commands/`);
|
|
80
87
|
console.log(` ✔ ${skills} skills en .opencode/skills/`);
|
|
81
88
|
console.log(
|
|
82
89
|
dirs.length
|
|
83
90
|
? ` ✔ carpetas: ${dirs.join(', ')}`
|
|
84
|
-
: ' •
|
|
91
|
+
: ' • backlog/ y specs/ ya existían',
|
|
85
92
|
);
|
|
93
|
+
if (legacyBacklog) {
|
|
94
|
+
console.log(
|
|
95
|
+
' ! Detecté Backlog/ de una versión anterior: renómbrala a backlog/ para que los skills la encuentren.',
|
|
96
|
+
);
|
|
97
|
+
}
|
|
86
98
|
console.log('');
|
|
87
99
|
console.log(' Siguiente paso: en opencode, ejecuta /sda-sprint.');
|
|
88
100
|
console.log(' (El framework e2e lo defines o heredas ahí.)');
|
|
@@ -97,6 +109,6 @@ export function runUpdate(targetDir) {
|
|
|
97
109
|
|
|
98
110
|
console.log(` ✔ ${commands} comandos re-sincronizados`);
|
|
99
111
|
console.log(` ✔ ${skills} skills re-sincronizadas`);
|
|
100
|
-
console.log(' •
|
|
112
|
+
console.log(' • backlog/ y specs/ no se tocaron');
|
|
101
113
|
console.log('');
|
|
102
114
|
}
|
|
@@ -11,7 +11,7 @@ Pasos grandes: **una HU = sus escenarios e2e en verde = una entrega**. No se par
|
|
|
11
11
|
|
|
12
12
|
## 1. Revisión
|
|
13
13
|
|
|
14
|
-
- Lee los artefactos de la HU: `
|
|
14
|
+
- Lee los artefactos de la HU: `backlog/<sprint>/HU_NN/{spec,design,tasks}.md`. Son el insumo
|
|
15
15
|
esperado; si no están, pídemelos.
|
|
16
16
|
- Lee el `## Framework e2e` del `Plan.md`: framework, comando y directorio de tests. Si no está,
|
|
17
17
|
avísame y lo decidimos antes de escribir tests.
|
|
@@ -12,11 +12,11 @@ ni código para "hacer pasar": si algo falla, lo reportas y te detienes.
|
|
|
12
12
|
|
|
13
13
|
## 0. Identifica la HU
|
|
14
14
|
|
|
15
|
-
- Localiza `
|
|
15
|
+
- Localiza `backlog/<sprint>/HU_NN/` y su `Plan.md`. Lee `spec.md`, `design.md`, `tasks.md` y el
|
|
16
16
|
`Plan.md` completos.
|
|
17
17
|
- Si el contexto no alcanza, deduce la candidata desde el diff de git y **confírmala conmigo antes
|
|
18
18
|
de tocar nada**.
|
|
19
|
-
- Si el plan vive en `
|
|
19
|
+
- Si el plan vive en `backlog/archive/<sprint>/`, ya estaba completo: no lo desarchives; repórtalo y
|
|
20
20
|
confirma.
|
|
21
21
|
|
|
22
22
|
## 1. Recorre lo implementado
|
|
@@ -108,17 +108,17 @@ archivos/funciones/tests. No reescribas el resto de la HU.
|
|
|
108
108
|
Solo cuando **acabas de marcar la última HU pendiente** del Backlog:
|
|
109
109
|
|
|
110
110
|
- Detente y pregunta (herramienta de preguntas): ¿archivo el sprint en
|
|
111
|
-
`
|
|
111
|
+
`backlog/archive/<sprint>/`? Opciones: archivar o dejarlo en `backlog/<sprint>/`. Nunca archives
|
|
112
112
|
sin confirmación.
|
|
113
113
|
- **No** → no muevas nada; déjalo dicho.
|
|
114
114
|
- **Sí**:
|
|
115
|
-
- Crea `
|
|
116
|
-
- Mueve la carpeta completa `
|
|
115
|
+
- Crea `backlog/archive/` si no existe.
|
|
116
|
+
- Mueve la carpeta completa `backlog/<sprint>/` → `backlog/archive/<sprint>/` (movimiento del
|
|
117
117
|
sistema, no `git mv`; no stagees ni commitees).
|
|
118
118
|
- Si el destino existe, detente y pregunta (no sobrescribas ni fusiones).
|
|
119
119
|
- Verifica rutas y deja constancia.
|
|
120
120
|
- Si queda alguna HU sin marcar, **no preguntes ni archives**: el plan sigue en
|
|
121
|
-
`
|
|
121
|
+
`backlog/<sprint>/`.
|
|
122
122
|
|
|
123
123
|
## 7. Cierra
|
|
124
124
|
|
|
@@ -126,7 +126,7 @@ Mensaje breve y cálido:
|
|
|
126
126
|
|
|
127
127
|
- ✅ `HU_NN` validada, spec sincronizada en `specs/<capability>/spec.md` y HU marcada.
|
|
128
128
|
- Dos o tres datos: qué quedó funcionando, verificaciones en verde, qué falta a mano.
|
|
129
|
-
- Si archivaste, di la ruta nueva. Si no, que el plan sigue en `
|
|
129
|
+
- Si archivaste, di la ruta nueva. Si no, que el plan sigue en `backlog/<sprint>/`.
|
|
130
130
|
- Sugerencia de commit, sin commitear.
|
|
131
131
|
|
|
132
132
|
No cierres con pregunta (la única permitida es la del paso 6).
|
|
@@ -21,7 +21,7 @@ enfoques.
|
|
|
21
21
|
## Lo que SIEMPRE reviso antes de opinar
|
|
22
22
|
|
|
23
23
|
1. **Framework e2e** — lo leo del `## Framework e2e` del `Plan.md` del sprint actual. Si no está,
|
|
24
|
-
busco el bloque en otros `
|
|
24
|
+
busco el bloque en otros `backlog/**/Plan.md` (activos y `archive/`) y lo heredo; si no existe
|
|
25
25
|
ninguno, te aviso y lo decidimos antes de avanzar (nunca exploro sin framework de tests). Lo
|
|
26
26
|
escribo en el `Plan.md` actual si faltaba.
|
|
27
27
|
2. **Historia de specs viva** — la capability que toca la HU. Busco `specs/<capability>/spec.md`;
|
|
@@ -11,7 +11,7 @@ escenarios e2e de `spec.md` son el **contrato de test** que `/sda-build` está o
|
|
|
11
11
|
|
|
12
12
|
## Entrada
|
|
13
13
|
|
|
14
|
-
- La HU del `
|
|
14
|
+
- La HU del `backlog/<sprint>/Plan.md` (ruta o bloque pegado).
|
|
15
15
|
- El enfoque acordado en `/sda-explore`.
|
|
16
16
|
- El `## Framework e2e` del `Plan.md` y la spec viva `specs/<capability>/spec.md` de la capability
|
|
17
17
|
que toca.
|
|
@@ -48,7 +48,7 @@ escenarios e2e de `spec.md` son el **contrato de test** que `/sda-build` está o
|
|
|
48
48
|
|
|
49
49
|
## Ubicación
|
|
50
50
|
|
|
51
|
-
`
|
|
51
|
+
`backlog/<sprint>/HU_NN/` con `spec.md`, `design.md` y `tasks.md`. Numeración según el `## Backlog`
|
|
52
52
|
del plan: `HU1` → `HU_01`. Si no se puede saber, usa el siguiente número libre. Si la carpeta ya
|
|
53
53
|
existe, pregunta antes de sobrescribir.
|
|
54
54
|
|
|
@@ -57,7 +57,7 @@ existe, pregunta antes de sobrescribir.
|
|
|
57
57
|
```markdown
|
|
58
58
|
# HU_NN — <título corto>
|
|
59
59
|
|
|
60
|
-
**Plan:** `
|
|
60
|
+
**Plan:** `backlog/<sprint>/Plan.md` · HU_NN
|
|
61
61
|
**Estado:** 🔲 Planificado
|
|
62
62
|
**Capability:** <ruta de specs, ej. `exports`>
|
|
63
63
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sda-sprint
|
|
3
|
-
description: Crea o actualiza el
|
|
3
|
+
description: Crea o actualiza el backlog de un sprint como historias de usuario verticales. Define o hereda el framework e2e (obligatorio) y lo guarda en el Plan.md. Sin criterios de aceptación ni implementación; eso es /sda-spec.
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -20,7 +20,7 @@ Antes de armar el backlog, garantiza que el framework de tests e2e esté definid
|
|
|
20
20
|
contrato de cada HU y no se trabaja sin él.
|
|
21
21
|
|
|
22
22
|
1. **Busca una decisión previa** con un `grep` acotado de `## Framework e2e` en los
|
|
23
|
-
`
|
|
23
|
+
`backlog/**/Plan.md` (sprints activos y `backlog/archive/`). Lee solo ese bloque; no leas los
|
|
24
24
|
planes enteros.
|
|
25
25
|
2. **Si existe**, hereda la más reciente: escribe ese mismo bloque en el nuevo `Plan.md`. No
|
|
26
26
|
preguntes nada.
|
|
@@ -86,8 +86,8 @@ Agrega `Requiere: #N` solo cuando una historia no tiene sentido sin otra.
|
|
|
86
86
|
|
|
87
87
|
Al terminar, ofrece guardar el plan acordado. No lo guardes sin mi OK.
|
|
88
88
|
|
|
89
|
-
- Carpeta: `
|
|
90
|
-
- Si `
|
|
89
|
+
- Carpeta: `backlog/<nombre-descriptivo>/Plan.md` (kebab-case en español, 2–4 palabras, sin acentos).
|
|
90
|
+
- Si `backlog/` no existe, créala con esa grafía.
|
|
91
91
|
- Si la carpeta ya existe, pregunta si actualizo su `Plan.md` o uso otro nombre. Nunca sobrescribas
|
|
92
92
|
sin preguntar.
|
|
93
93
|
- Formato de `Plan.md`:
|