@saulwade/swl-ses 1.3.1 → 1.3.3

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.
Files changed (34) hide show
  1. package/CLAUDE.md +199 -199
  2. package/README.md +1 -1
  3. package/bin/swl-ses.js +77 -5
  4. package/comandos/swl/aprender.md +1 -1
  5. package/comandos/swl/claudemd.md +141 -136
  6. package/comandos/swl/configurar-ci.md +227 -227
  7. package/comandos/swl/evolucion-estado.md +1 -1
  8. package/comandos/swl/evolucionar.md +3 -3
  9. package/comandos/swl/inbox.md +1 -1
  10. package/comandos/swl/reflect-skills.md +1 -1
  11. package/comandos/swl/salud.md +7 -7
  12. package/comandos/swl/skill-search.md +4 -4
  13. package/manifiestos/perfiles.json +2 -1
  14. package/manifiestos/skills-lock.json +1093 -1093
  15. package/package.json +87 -87
  16. package/plugin.json +343 -343
  17. package/scripts/auditar-claudemd.js +297 -297
  18. package/scripts/bootstrap-instintos.js +1 -1
  19. package/scripts/cli/audit-agents-gaps.js +36 -0
  20. package/scripts/cli/audit-claudemd.js +43 -0
  21. package/scripts/cli/audit-coverage-frameworks.js +39 -0
  22. package/scripts/cli/bootstrap-instincts.js +38 -0
  23. package/scripts/cli/configure-branch-protection.js +42 -0
  24. package/scripts/cli/generate-skills-lock.js +31 -0
  25. package/scripts/cli/inbox-tmux-inject.js +49 -0
  26. package/scripts/cli/reflect-skills.js +40 -0
  27. package/scripts/cli/run-skill-evals.js +47 -0
  28. package/scripts/cli/skill-discovery.js +38 -0
  29. package/scripts/cli/verify-evolution.js +36 -0
  30. package/scripts/generar-skills-lock.js +190 -190
  31. package/scripts/inbox-tmux-inject.js +6 -0
  32. package/scripts/lib/autostart-windows.js +51 -28
  33. package/scripts/lib/skill-discovery.js +11 -3
  34. package/scripts/verificar-evolucion.js +1 -1
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para el subcomando `swl-ses audit-claudemd`.
5
+ *
6
+ * Por qué existe este wrapper:
7
+ * `scripts/auditar-claudemd.js` está diseñado como CLI standalone que lee
8
+ * `process.argv`. El dispatcher de `bin/swl-ses.js`, en cambio, espera un
9
+ * módulo que exporta una función única `fn(opciones)` con las flags ya
10
+ * parseadas. Este wrapper traduce entre ambos contratos.
11
+ *
12
+ * Mapeo de opciones del bin → flags del script:
13
+ * --json → '--json'
14
+ * --strict → '--strict'
15
+ * _args[0] → primer argumento posicional (ruta opcional al CLAUDE.md)
16
+ *
17
+ * Salida: el script standalone hace `process.exit(0|1)` por sí mismo, así que
18
+ * este wrapper no necesita retornar nada — main() se encarga.
19
+ */
20
+
21
+ const { main } = require('../auditar-claudemd.js');
22
+
23
+ function auditClaudemd(opciones) {
24
+ const args = [];
25
+ if (opciones && opciones.json) args.push('--json');
26
+ if (opciones && opciones.strict) args.push('--strict');
27
+ if (opciones && Array.isArray(opciones._args) && opciones._args[0]) {
28
+ args.push(opciones._args[0]);
29
+ }
30
+
31
+ // El script lee process.argv.slice(2). Sustituir argv durante la ejecución.
32
+ const argvOriginal = process.argv;
33
+ process.argv = ['node', 'auditar-claudemd.js', ...args];
34
+ try {
35
+ main();
36
+ } finally {
37
+ // main() típicamente llama process.exit; este finally es defensivo por
38
+ // si en el futuro main() deja de salir explícitamente.
39
+ process.argv = argvOriginal;
40
+ }
41
+ }
42
+
43
+ module.exports = auditClaudemd;
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses audit-coverage-frameworks`.
5
+ *
6
+ * Audita la cobertura de frameworks de seguridad (NIST CSF, NIST AI RMF,
7
+ * MITRE ATT&CK, ATLAS, D3FEND) en los skills SWL del dominio seguridad.
8
+ * El script standalone NO exporta main, ejecuta en top-level. Wrapper
9
+ * hace require() directo con argv manipulado.
10
+ *
11
+ * Flags soportadas:
12
+ * --resumen → output resumen compacto
13
+ * --framework=<id> → analizar solo un framework específico
14
+ * --save → persiste el resultado en archivo
15
+ */
16
+
17
+ const path = require('path');
18
+
19
+ function auditCoverageFrameworks(opciones) {
20
+ const args = [];
21
+ if (opciones && opciones.resumen) args.push('--resumen');
22
+ if (opciones && opciones.framework) args.push(`--framework=${opciones.framework}`);
23
+ if (opciones && opciones.save) args.push('--save');
24
+ if (opciones && Array.isArray(opciones._args)) {
25
+ args.push(...opciones._args);
26
+ }
27
+
28
+ const argvOriginal = process.argv;
29
+ process.argv = ['node', 'auditar-cobertura-frameworks.js', ...args];
30
+ try {
31
+ const ruta = path.resolve(__dirname, '..', 'auditar-cobertura-frameworks.js');
32
+ delete require.cache[ruta];
33
+ require(ruta);
34
+ } finally {
35
+ process.argv = argvOriginal;
36
+ }
37
+ }
38
+
39
+ module.exports = auditCoverageFrameworks;
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses bootstrap-instincts`.
5
+ *
6
+ * Pobla `instintos/proyecto.yaml` desde `APRENDIZAJES.md` del proyecto actual.
7
+ * Adapta opciones del bin al main() de `scripts/bootstrap-instintos.js`.
8
+ *
9
+ * Flags soportadas (las que el script standalone acepta):
10
+ * --write → '--write' (persiste en instintos/proyecto.yaml; default es dry-run)
11
+ * --dry-run → '--dry-run' (explícito, redundante con default)
12
+ * --force → '--force' (sobreescribe instintos existentes)
13
+ * --json → '--json' (output JSON estructurado)
14
+ */
15
+
16
+ const { main } = require('../bootstrap-instintos.js');
17
+
18
+ function bootstrapInstincts(opciones) {
19
+ const args = [];
20
+ if (opciones && opciones.write) args.push('--write');
21
+ // Defensa contra parser inconsistente: aceptar ambas formas.
22
+ if (opciones && (opciones['dry-run'] || opciones.dry_run)) args.push('--dry-run');
23
+ if (opciones && opciones.force) args.push('--force');
24
+ if (opciones && opciones.json) args.push('--json');
25
+ if (opciones && Array.isArray(opciones._args)) {
26
+ args.push(...opciones._args);
27
+ }
28
+
29
+ const argvOriginal = process.argv;
30
+ process.argv = ['node', 'bootstrap-instintos.js', ...args];
31
+ try {
32
+ main();
33
+ } finally {
34
+ process.argv = argvOriginal;
35
+ }
36
+ }
37
+
38
+ module.exports = bootstrapInstincts;
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses configure-branch-protection`.
5
+ *
6
+ * El script standalone `scripts/configurar-branch-protection.js` ejecuta su
7
+ * lógica en top-level (no tiene main() exportable). Para reusarlo, este
8
+ * wrapper manipula `process.argv` y hace `require()` directo — al cargarse
9
+ * el módulo, su código top-level se ejecuta con los argumentos correctos.
10
+ *
11
+ * Flags soportadas:
12
+ * --dry-run → '--dry-run' (no aplica cambios, solo muestra)
13
+ * _args[0+] → argumentos posicionales (repo, branch)
14
+ *
15
+ * Importante: el `require()` no se cachea entre invocaciones distintas del
16
+ * CLI porque cada llamada desde shell es un proceso Node fresco. Dentro del
17
+ * mismo proceso, solo se invoca una vez por design del CLI dispatcher.
18
+ */
19
+
20
+ const path = require('path');
21
+
22
+ function configureBranchProtection(opciones) {
23
+ const args = [];
24
+ // Defensa contra parser inconsistente: aceptar ambas formas.
25
+ if (opciones && (opciones['dry-run'] || opciones.dry_run)) args.push('--dry-run');
26
+ if (opciones && Array.isArray(opciones._args)) {
27
+ args.push(...opciones._args);
28
+ }
29
+
30
+ const argvOriginal = process.argv;
31
+ process.argv = ['node', 'configurar-branch-protection.js', ...args];
32
+ try {
33
+ // Limpiar caché para garantizar re-ejecución si el módulo ya fue cargado.
34
+ const ruta = path.resolve(__dirname, '..', 'configurar-branch-protection.js');
35
+ delete require.cache[ruta];
36
+ require(ruta);
37
+ } finally {
38
+ process.argv = argvOriginal;
39
+ }
40
+ }
41
+
42
+ module.exports = configureBranchProtection;
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses generate-skills-lock`.
5
+ *
6
+ * Regenera `manifiestos/skills-lock.json` con el SHA256 de cada SKILL.md.
7
+ * El lock permite detectar drift silencioso de skills entre releases.
8
+ *
9
+ * Flags soportadas:
10
+ * --check → no escribe, compara contra el lock actual y exit 1 si difiere
11
+ */
12
+
13
+ const { main } = require('../generar-skills-lock.js');
14
+
15
+ function generateSkillsLock(opciones) {
16
+ const args = [];
17
+ if (opciones && opciones.check) args.push('--check');
18
+ if (opciones && Array.isArray(opciones._args)) {
19
+ args.push(...opciones._args);
20
+ }
21
+
22
+ const argvOriginal = process.argv;
23
+ process.argv = ['node', 'generar-skills-lock.js', ...args];
24
+ try {
25
+ main();
26
+ } finally {
27
+ process.argv = argvOriginal;
28
+ }
29
+ }
30
+
31
+ module.exports = generateSkillsLock;
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses inbox-tmux-inject`.
5
+ *
6
+ * Servicio opt-in Linux/macOS que poll-ea `.planning/inbox/` y reinyecta
7
+ * comandos a una sesión tmux activa de Claude Code. NO funcional en
8
+ * Windows nativo (requiere tmux).
9
+ *
10
+ * El script standalone tiene un guard `if (require.main === module) main();`
11
+ * que NO se cumple cuando require()d desde el bin dispatcher. Por eso este
12
+ * wrapper invoca `main()` exportado explícitamente en vez de hacer require()
13
+ * directo del script.
14
+ *
15
+ * Flags soportadas:
16
+ * --session=<nombre> → sesión tmux destino (default 'claude')
17
+ * --poll=<segundos> → intervalo de polling (default 3)
18
+ * --dry-run → no inyecta, solo reporta
19
+ */
20
+
21
+ const { main } = require('../inbox-tmux-inject.js');
22
+
23
+ function inboxTmuxInject(opciones) {
24
+ const args = [];
25
+
26
+ // El parser del bin acepta dashes y underscores (ambas formas).
27
+ if (opciones && opciones.session) {
28
+ args.push('--session', String(opciones.session));
29
+ }
30
+ if (opciones && opciones.poll !== undefined) {
31
+ args.push('--poll', String(opciones.poll));
32
+ }
33
+ if (opciones && (opciones['dry-run'] || opciones.dry_run)) {
34
+ args.push('--dry-run');
35
+ }
36
+ if (opciones && Array.isArray(opciones._args)) {
37
+ args.push(...opciones._args);
38
+ }
39
+
40
+ const argvOriginal = process.argv;
41
+ process.argv = ['node', 'inbox-tmux-inject.js', ...args];
42
+ try {
43
+ main();
44
+ } finally {
45
+ process.argv = argvOriginal;
46
+ }
47
+ }
48
+
49
+ module.exports = inboxTmuxInject;
@@ -0,0 +1,40 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses reflect-skills`.
5
+ *
6
+ * `scripts/reflect-skills.js` exporta `main` y funciones puras
7
+ * (extraerPrompts, clusterizarPrompts, etc.). Este wrapper adapta el
8
+ * contrato del bin dispatcher al main() que lee process.argv.
9
+ *
10
+ * Flags soportadas:
11
+ * --ventana=<N> → ventana de días a analizar (default 30)
12
+ * --umbral=<N> → umbral mínimo de prompts por cluster (default 3)
13
+ * --json → output JSON estructurado
14
+ * --proyecto → analizar solo proyecto actual
15
+ * --globales → analizar solo skills globales
16
+ */
17
+
18
+ const { main } = require('../reflect-skills.js');
19
+
20
+ function reflectSkills(opciones) {
21
+ const args = [];
22
+ if (opciones && opciones.ventana !== undefined) args.push(`--ventana=${opciones.ventana}`);
23
+ if (opciones && opciones.umbral !== undefined) args.push(`--umbral=${opciones.umbral}`);
24
+ if (opciones && opciones.json) args.push('--json');
25
+ if (opciones && opciones.proyecto) args.push('--proyecto');
26
+ if (opciones && opciones.globales) args.push('--globales');
27
+ if (opciones && Array.isArray(opciones._args)) {
28
+ args.push(...opciones._args);
29
+ }
30
+
31
+ const argvOriginal = process.argv;
32
+ process.argv = ['node', 'reflect-skills.js', ...args];
33
+ try {
34
+ main();
35
+ } finally {
36
+ process.argv = argvOriginal;
37
+ }
38
+ }
39
+
40
+ module.exports = reflectSkills;
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses run-skill-evals`.
5
+ *
6
+ * El script standalone `scripts/run-skill-evals.js` ejecuta su lógica en
7
+ * top-level. Wrapper hace `require()` directo con `process.argv` manipulado.
8
+ *
9
+ * Flags y argumentos soportados:
10
+ * primer posicional → nombre del skill
11
+ * --list → listar evals del skill
12
+ * --json → output JSON
13
+ * --record-baseline → registrar score baseline
14
+ * --record-after → registrar score post-cambio
15
+ * --score=<N> → score numérico (acompaña --record-*)
16
+ * --hypothesis=<texto> → hipótesis de la mutación
17
+ * --invariantes-ok → marcar invariantes como OK
18
+ */
19
+
20
+ const path = require('path');
21
+
22
+ function runSkillEvals(opciones) {
23
+ const args = [];
24
+
25
+ if (opciones && Array.isArray(opciones._args)) {
26
+ args.push(...opciones._args);
27
+ }
28
+ if (opciones && opciones.list) args.push('--list');
29
+ if (opciones && opciones.json) args.push('--json');
30
+ if (opciones && opciones['record-baseline']) args.push('--record-baseline');
31
+ if (opciones && opciones['record-after']) args.push('--record-after');
32
+ if (opciones && opciones.score !== undefined) args.push(`--score=${opciones.score}`);
33
+ if (opciones && opciones.hypothesis) args.push(`--hypothesis=${opciones.hypothesis}`);
34
+ if (opciones && opciones['invariantes-ok']) args.push('--invariantes-ok');
35
+
36
+ const argvOriginal = process.argv;
37
+ process.argv = ['node', 'run-skill-evals.js', ...args];
38
+ try {
39
+ const ruta = path.resolve(__dirname, '..', 'run-skill-evals.js');
40
+ delete require.cache[ruta];
41
+ require(ruta);
42
+ } finally {
43
+ process.argv = argvOriginal;
44
+ }
45
+ }
46
+
47
+ module.exports = runSkillEvals;
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses skill-discovery`.
5
+ *
6
+ * Descubre y busca skills SWL por nombre, descripción o palabras clave.
7
+ * El script vive en `scripts/lib/skill-discovery.js` (no en `scripts/`).
8
+ *
9
+ * El script standalone tiene un guard `if (require.main === module) main();`
10
+ * que NO se cumple cuando require()d desde el bin dispatcher. Por eso este
11
+ * wrapper invoca `main()` exportado explícitamente en vez de hacer require()
12
+ * directo del script.
13
+ *
14
+ * Argumentos y flags:
15
+ * primer posicional → query de búsqueda (opcional; sin query lista todos)
16
+ * --rebuild → fuerza reconstrucción del índice (ignora caché)
17
+ */
18
+
19
+ const { main } = require('../lib/skill-discovery.js');
20
+
21
+ function skillDiscovery(opciones) {
22
+ const args = [];
23
+
24
+ if (opciones && Array.isArray(opciones._args)) {
25
+ args.push(...opciones._args);
26
+ }
27
+ if (opciones && opciones.rebuild) args.push('--rebuild');
28
+
29
+ const argvOriginal = process.argv;
30
+ process.argv = ['node', 'skill-discovery.js', ...args];
31
+ try {
32
+ main();
33
+ } finally {
34
+ process.argv = argvOriginal;
35
+ }
36
+ }
37
+
38
+ module.exports = skillDiscovery;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Wrapper CLI para `swl-ses verify-evolution`.
5
+ *
6
+ * Adapta el contrato del bin (recibe objeto opciones con flags ya parseadas)
7
+ * al main() de `scripts/verificar-evolucion.js` que lee process.argv.
8
+ *
9
+ * Mapeo de opciones del bin → flags del script:
10
+ * --changed → '--changed'
11
+ * --since=<rev> → '--since=<rev>'
12
+ * --json → '--json'
13
+ * _args[0+] → archivos posicionales (paths a verificar)
14
+ */
15
+
16
+ const { main } = require('../verificar-evolucion.js');
17
+
18
+ function verifyEvolution(opciones) {
19
+ const args = [];
20
+ if (opciones && opciones.changed) args.push('--changed');
21
+ if (opciones && opciones.since) args.push(`--since=${opciones.since}`);
22
+ if (opciones && opciones.json) args.push('--json');
23
+ if (opciones && Array.isArray(opciones._args)) {
24
+ args.push(...opciones._args);
25
+ }
26
+
27
+ const argvOriginal = process.argv;
28
+ process.argv = ['node', 'verificar-evolucion.js', ...args];
29
+ try {
30
+ main();
31
+ } finally {
32
+ process.argv = argvOriginal;
33
+ }
34
+ }
35
+
36
+ module.exports = verifyEvolution;