spec-driven-agility 0.1.0 → 0.2.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 +4 -0
- package/package.json +1 -1
- package/src/animation.js +122 -0
- package/src/cli.js +3 -0
package/README.md
CHANGED
|
@@ -53,11 +53,15 @@ Re-sincroniza comandos y skills. No toca `Backlog/` ni `specs/`.
|
|
|
53
53
|
sda <comando> [ruta]
|
|
54
54
|
|
|
55
55
|
init [ruta] Instala todo en el proyecto (por defecto, el directorio actual).
|
|
56
|
+
Muestra la intro animada; usa --no-animation para omitirla.
|
|
56
57
|
update [ruta] Re-sincroniza comandos y skills.
|
|
57
58
|
version Muestra la versión.
|
|
58
59
|
help Muestra la ayuda.
|
|
59
60
|
```
|
|
60
61
|
|
|
62
|
+
`sda init` dibuja una pequeña **planta que crece** y espera ENTER antes de instalar. En CI o
|
|
63
|
+
scripts se omite sola; también puedes forzarlo con `sda init --no-animation`.
|
|
64
|
+
|
|
61
65
|
## Filosofía
|
|
62
66
|
|
|
63
67
|
- La fuente de verdad es un **Backlog de Sprint** con historias modificables y descartables.
|
package/package.json
CHANGED
package/src/animation.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import readline from 'node:readline';
|
|
2
|
+
|
|
3
|
+
// Planta que crece en una maceta. Todas las frames tienen la misma altura
|
|
4
|
+
// para poder redibujarse en el sitio sin que el cursor derive.
|
|
5
|
+
const FRAMES = [
|
|
6
|
+
[
|
|
7
|
+
' ',
|
|
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
|
+
const ESC = {
|
|
63
|
+
hide: '\x1b[?25l',
|
|
64
|
+
show: '\x1b[?25h',
|
|
65
|
+
up: (n) => `\x1b[${n}A`,
|
|
66
|
+
clear: '\x1b[2K',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const HEIGHT = FRAMES[0].length;
|
|
70
|
+
|
|
71
|
+
function sleep(ms) {
|
|
72
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function canAnimate(stream) {
|
|
76
|
+
if (!stream || !stream.isTTY) return false;
|
|
77
|
+
if (process.env.CI) return false;
|
|
78
|
+
if (process.env.TERM === 'dumb') return false;
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function animate(stream, frameDelay = 110) {
|
|
83
|
+
stream.write(ESC.hide);
|
|
84
|
+
stream.write(`${FRAMES[0].join('\n')}\n`);
|
|
85
|
+
|
|
86
|
+
for (let frame = 1; frame < FRAMES.length; frame += 1) {
|
|
87
|
+
await sleep(frameDelay);
|
|
88
|
+
stream.write(ESC.up(HEIGHT));
|
|
89
|
+
for (let line = 0; line < HEIGHT; line += 1) {
|
|
90
|
+
stream.write(`\r${ESC.clear}${FRAMES[frame][line]}\n`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
stream.write(ESC.show);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function waitForEnter() {
|
|
98
|
+
return new Promise((resolve) => {
|
|
99
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
100
|
+
rl.question('\n Presiona ENTER para continuar... ', () => {
|
|
101
|
+
rl.close();
|
|
102
|
+
resolve();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Reproduce la intro animada de la planta y espera ENTER.
|
|
109
|
+
* Se omite sola en CI, salidas no interactivas o con `--no-animation`.
|
|
110
|
+
*/
|
|
111
|
+
export async function playIntro({ enabled = true, stream = process.stdout, waitEnter = true } = {}) {
|
|
112
|
+
if (!enabled || !canAnimate(stream)) return false;
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
await animate(stream);
|
|
116
|
+
if (waitEnter && process.stdin.isTTY) await waitForEnter();
|
|
117
|
+
return true;
|
|
118
|
+
} catch {
|
|
119
|
+
stream.write(ESC.show);
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
package/src/cli.js
CHANGED
|
@@ -2,6 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { PACKAGE_ROOT } from './templates.js';
|
|
4
4
|
import { runInit, runUpdate } from './installer.js';
|
|
5
|
+
import { playIntro } from './animation.js';
|
|
5
6
|
|
|
6
7
|
function readVersion() {
|
|
7
8
|
const pkg = JSON.parse(fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf8'));
|
|
@@ -18,6 +19,7 @@ Uso:
|
|
|
18
19
|
Comandos:
|
|
19
20
|
init [ruta] Instala los comandos /sda-*, las skills y las carpetas
|
|
20
21
|
Backlog/ y specs/. Por defecto usa el directorio actual.
|
|
22
|
+
Usa --no-animation para omitir la intro animada.
|
|
21
23
|
update [ruta] Re-sincroniza comandos y skills. No toca config ni datos.
|
|
22
24
|
version Muestra la versión instalada.
|
|
23
25
|
help Muestra esta ayuda.
|
|
@@ -47,6 +49,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
47
49
|
console.log(readVersion());
|
|
48
50
|
return;
|
|
49
51
|
case 'init':
|
|
52
|
+
await playIntro({ enabled: !rest.includes('--no-animation') });
|
|
50
53
|
runInit(target);
|
|
51
54
|
return;
|
|
52
55
|
case 'update':
|