@saulwade/swl-ses 2.6.0 → 2.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/CLAUDE.md +197 -197
- package/README.md +600 -600
- package/agentes/_intent-spec.md +73 -73
- package/agentes/_propose-step.md +90 -90
- package/agentes/accesibilidad-wcag-swl.md +690 -690
- package/agentes/arquitecto-swl.md +267 -267
- package/agentes/auto-evolucion-swl.md +932 -932
- package/agentes/backend-csharp-swl.md +420 -420
- package/agentes/backend-go-swl.md +390 -390
- package/agentes/backend-java-swl.md +281 -281
- package/agentes/backend-rust-swl.md +364 -364
- package/agentes/backend-workers-swl.md +482 -482
- package/agentes/cloud-infra-swl.md +509 -509
- package/agentes/consolidador-swl.md +541 -541
- package/agentes/depurador-swl.md +352 -352
- package/agentes/devops-ci-swl.md +400 -400
- package/agentes/disenador-ui-swl.md +569 -569
- package/agentes/documentador-swl.md +345 -345
- package/agentes/frontend-angular-swl.md +621 -621
- package/agentes/frontend-css-swl.md +716 -716
- package/agentes/frontend-react-swl.md +692 -692
- package/agentes/frontend-swl.md +496 -496
- package/agentes/frontend-tailwind-swl.md +826 -826
- package/agentes/investigador-swl.md +432 -432
- package/agentes/investigador-ux-swl.md +505 -505
- package/agentes/migrador-swl.md +442 -442
- package/agentes/mobile-android-swl.md +511 -511
- package/agentes/mobile-cross-swl.md +541 -541
- package/agentes/mobile-ios-swl.md +502 -502
- package/agentes/mobile-testing-swl.md +302 -302
- package/agentes/nemesis-auditor-swl.md +285 -285
- package/agentes/observabilidad-swl.md +438 -438
- package/agentes/pagos-swl.md +310 -310
- package/agentes/perfilador-usuario-swl.md +321 -321
- package/agentes/planificador-swl.md +399 -399
- package/agentes/producto-prd-swl.md +589 -589
- package/agentes/red-team-swl.md +218 -218
- package/agentes/release-manager-swl.md +590 -590
- package/agentes/rendimiento-swl.md +713 -713
- package/agentes/revisor-angular-swl.md +278 -278
- package/agentes/revisor-csharp-swl.md +264 -264
- package/agentes/revisor-go-swl.md +259 -259
- package/agentes/revisor-java-swl.md +257 -257
- package/agentes/revisor-kotlin-swl.md +273 -273
- package/agentes/revisor-nextjs-swl.md +281 -281
- package/agentes/revisor-php-swl.md +271 -271
- package/agentes/revisor-react-swl.md +278 -278
- package/agentes/revisor-rust-swl.md +346 -346
- package/agentes/revisor-seguridad-swl.md +399 -399
- package/agentes/revisor-swift-swl.md +268 -268
- package/agentes/revisor-typescript-swl.md +346 -346
- package/agentes/tdd-qa-swl.md +393 -393
- package/comandos/swl/actualizar.md +174 -174
- package/comandos/swl/adoptar-proyecto.md +265 -265
- package/comandos/swl/aprender.md +836 -836
- package/comandos/swl/aprobar-plan.md +146 -146
- package/comandos/swl/auditar-deps.md +134 -134
- package/comandos/swl/autoresearch.md +264 -264
- package/comandos/swl/ayuda.md +224 -224
- package/comandos/swl/brainstorm.md +51 -51
- package/comandos/swl/briefing.md +119 -119
- package/comandos/swl/checkpoint.md +325 -325
- package/comandos/swl/claudemd.md +234 -234
- package/comandos/swl/compactar.md +310 -310
- package/comandos/swl/configurar-ci.md +235 -235
- package/comandos/swl/contexto.md +110 -110
- package/comandos/swl/contribuir.md +233 -233
- package/comandos/swl/crear-skill.md +292 -292
- package/comandos/swl/cron.md +194 -194
- package/comandos/swl/discutir-fase.md +169 -169
- package/comandos/swl/ejecutar-fase.md +233 -233
- package/comandos/swl/evaluar-skill.md +520 -520
- package/comandos/swl/evolucion-continua.md +73 -73
- package/comandos/swl/evolucionar.md +267 -267
- package/comandos/swl/exportar-vault.md +583 -583
- package/comandos/swl/fix.md +118 -118
- package/comandos/swl/gateway.md +158 -158
- package/comandos/swl/inbox.md +116 -116
- package/comandos/swl/instalar.md +220 -220
- package/comandos/swl/instintos.md +86 -86
- package/comandos/swl/mapear-codebase.md +312 -312
- package/comandos/swl/mcp-status.md +175 -175
- package/comandos/swl/modelo.md +100 -100
- package/comandos/swl/nemesis.md +433 -433
- package/comandos/swl/notificaciones.md +299 -299
- package/comandos/swl/nuevo-proyecto.md +251 -251
- package/comandos/swl/planear-fase.md +263 -263
- package/comandos/swl/plugins.md +256 -256
- package/comandos/swl/predecir.md +169 -169
- package/comandos/swl/reflect-skills.md +125 -125
- package/comandos/swl/release.md +450 -450
- package/comandos/swl/revisar-impacto.md +201 -201
- package/comandos/swl/revisar.md +330 -330
- package/comandos/swl/seguridad.md +189 -189
- package/comandos/swl/sesiones.md +200 -200
- package/comandos/swl/skill-search.md +113 -113
- package/comandos/swl/status.md +345 -345
- package/comandos/swl/verificar.md +817 -817
- package/comandos/swl/wiki.md +620 -620
- package/gateway/cron/jobs.example.json +12 -12
- package/habilidades/auto-evolucion-protocolo/SKILL.md +294 -294
- package/habilidades/backend-async-postgres-testing/SKILL.md +2 -1
- package/habilidades/changelog-generator/SKILL.md +174 -174
- package/habilidades/compactacion-contexto/SKILL.md +2 -1
- package/habilidades/contenedores-docker/SKILL.md +4 -2
- package/habilidades/doubt-driven-review/SKILL.md +207 -207
- package/habilidades/drift-detection/SKILL.md +1 -1
- package/habilidades/ejecutar-task-iterativo/SKILL.md +278 -278
- package/habilidades/extractor-de-aprendizajes/SKILL.md +8 -2
- package/habilidades/git-worktrees-paralelo/SKILL.md +19 -1
- package/habilidades/harness-claude-code/SKILL.md +314 -314
- package/habilidades/instalar-sistema/SKILL.md +227 -227
- package/habilidades/planear-fase/SKILL.md +358 -358
- package/habilidades/prevencion-sobreingenieria/recursos/soluciones-nativas.md +166 -166
- package/habilidades/prevencion-sobreingenieria/recursos/variables-residuales-post-refactor.md +85 -85
- package/habilidades/proceso-ingenieria-requerimientos/SKILL.md +147 -147
- package/habilidades/release-semver/SKILL.md +2 -2
- package/habilidades/tdd-workflow/SKILL.md +749 -749
- package/hooks/agente-lifecycle.js +1 -1
- package/hooks/audit-trail.js +1 -1
- package/hooks/auto-consolidacion.js +1 -1
- package/hooks/captura-acciones-post.js +1 -1
- package/hooks/captura-acciones-session.js +1 -1
- package/hooks/captura-feedback-usuario.js +1 -1
- package/hooks/contexto-iteracion.js +1 -1
- package/hooks/contexto-subagente.js +68 -68
- package/hooks/degradacion-instintos.js +1 -1
- package/hooks/grafo-contexto.js +1 -1
- package/hooks/guardrail-modelo.js +1 -1
- package/hooks/inbox-aviso.js +1 -1
- package/hooks/inyeccion-contexto.js +1 -1
- package/hooks/lib/agent-matcher.js +1 -1
- package/hooks/lib/agent-routing.js +1 -1
- package/hooks/lib/captura-acciones.js +1 -1
- package/hooks/lib/etapa-metricas.js +1 -1
- package/hooks/lib/evolution-tracker.js +1 -1
- package/hooks/lib/gateway-notify.js +193 -193
- package/hooks/lib/mcp-health.js +1 -1
- package/hooks/lib/notificacion-formato.js +58 -0
- package/hooks/lib/nudge-tracker.js +1 -1
- package/hooks/lib/otlp-exporter.js +1 -1
- package/hooks/lib/propose-step.js +1 -1
- package/hooks/lib/raiz-proyecto.js +127 -102
- package/hooks/lib/run-log.js +1 -1
- package/hooks/lib/singleton-guard.js +20 -13
- package/hooks/lib/telegram-cliente.js +11 -3
- package/hooks/notificacion-telegram.js +13 -3
- package/hooks/preservar-estado-pre-compact.js +1 -1
- package/hooks/registro-turnos.js +1 -1
- package/hooks/resumen-sesion.js +1 -1
- package/hooks/risk-scoring.js +1 -1
- package/hooks/session-briefing.js +1 -1
- package/hooks/spec-gate.js +1 -1
- package/hooks/sugerir-regenerar-inventario.js +1 -1
- package/hooks/tdd-gate.js +1 -1
- package/hooks/telemetria-agentes.js +1 -1
- package/hooks/telemetria-skill-routing.js +1 -1
- package/hooks/tracking-costos.js +1 -1
- package/hooks/validar-formato-post-subagente.js +1 -1
- package/hooks/validar-intent-spec.js +1 -1
- package/hooks/validar-planning-paths.js +1 -1
- package/llms.txt +29 -29
- package/manifiestos/canonical-hashes.json +5588 -5257
- package/manifiestos/hooks-config.json +469 -469
- package/manifiestos/invariantes-criticos.json +30 -30
- package/manifiestos/modulos.json +1429 -1428
- package/manifiestos/skills-lock.json +1275 -1275
- package/package.json +94 -94
- package/plugin.json +369 -369
- package/scripts/auditar-clases-conocidas.js +134 -134
- package/scripts/bootstrap-instintos.js +85 -14
- package/scripts/canario-hooks.js +166 -166
- package/scripts/cli/autonomia.js +23 -23
- package/scripts/cli/benchmark-memoria.js +37 -37
- package/scripts/cli/ciclo-autonomo.js +73 -73
- package/scripts/cli/ciclo-fase-b.js +102 -102
- package/scripts/cli/guardrail-metrics.js +39 -39
- package/scripts/cli/memoria-search.js +69 -69
- package/scripts/cli/nudge-accionar.js +39 -39
- package/scripts/cli/run-eval.js +38 -38
- package/scripts/doctor.js +26 -3
- package/scripts/evidencia-valor.js +101 -101
- package/scripts/field-report.js +16 -16
- package/scripts/instalador.js +13 -0
- package/scripts/lib/activar-hooks-proyecto.js +116 -116
- package/scripts/lib/ciclo-autonomo/candidatos.js +174 -174
- package/scripts/lib/ciclo-autonomo/config.js +165 -165
- package/scripts/lib/ciclo-autonomo/drenador-feedback.js +174 -174
- package/scripts/lib/ciclo-autonomo/fallback.js +77 -77
- package/scripts/lib/ciclo-autonomo/guard-convivencia.js +139 -139
- package/scripts/lib/ciclo-autonomo/higiene-nudges.js +112 -112
- package/scripts/lib/ciclo-autonomo/index.js +301 -301
- package/scripts/lib/ciclo-autonomo/lock.js +124 -124
- package/scripts/lib/ciclo-autonomo/presupuesto.js +122 -122
- package/scripts/lib/ciclo-autonomo/puente-degradacion.js +240 -240
- package/scripts/lib/ciclo-autonomo/runner-fase-b.js +248 -248
- package/scripts/lib/ciclo-autonomo/writer-instintos.js +190 -190
- package/scripts/lib/ciclo-autonomo/yaml-instintos.js +535 -535
- package/scripts/lib/evidencia-valor.js +228 -228
- package/scripts/lib/expandir-targets.js +71 -71
- package/scripts/lib/limpiar-basura-global.js +161 -0
- package/scripts/lib/toml-merge.js +204 -204
- package/scripts/mcp-server/auth.js +105 -105
- package/scripts/mcp-server/cache.js +106 -106
- package/scripts/tui/pantallas/install-wizard.js +403 -403
- package/instintos/.backups/perfil-usuario.yaml.2026-07-10-165128.bak +0 -53
- package/instintos/.backups/proyecto.yaml.2026-07-10-165128.bak +0 -372
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* evidencia-valor.js — CLI `swl-ses valor`: panel de evidencia de valor del
|
|
6
|
-
* harness en el proyecto downstream actual.
|
|
7
|
-
*
|
|
8
|
-
* Uso:
|
|
9
|
-
* swl-ses valor # panel legible (ventana 30 días)
|
|
10
|
-
* swl-ses valor --dias 90 # ventana distinta
|
|
11
|
-
* swl-ses valor --json # salida JSON para tooling
|
|
12
|
-
*
|
|
13
|
-
* Reglas duras del panel (docs/evidencia-valor.md):
|
|
14
|
-
* - Cada métrica declara su PROCEDENCIA (git / GitHub / hook-event) y su
|
|
15
|
-
* CARÁCTER (evidencia | proxy | contexto). Nunca scores autodeclarados.
|
|
16
|
-
* - Todo se lee LOCAL. El repo madre no lee estos datos.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const { panelEvidencia } = require('./lib/evidencia-valor.js');
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Contrato del CLI (bin/swl-ses.js): exportar UNA función(opciones) sin
|
|
23
|
-
* efectos al require. Violarlo = "modulo is not a function" tras imprimir
|
|
24
|
-
* el panel (caso real: SIGM, 2026-07-09).
|
|
25
|
-
*/
|
|
26
|
-
function valor(opciones = {}) {
|
|
27
|
-
const json = !!opciones.json;
|
|
28
|
-
const ventanaDias = parseInt(opciones.dias, 10) || 30;
|
|
29
|
-
|
|
30
|
-
const p = panelEvidencia(process.cwd(), { ventanaDias });
|
|
31
|
-
|
|
32
|
-
if (json) {
|
|
33
|
-
console.log(JSON.stringify(p, null, 2));
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
console.log(`Evidencia de valor — ventana ${p.ventanaDias} días (${p.generado})`);
|
|
38
|
-
console.log(` ${p.frontera}`);
|
|
39
|
-
console.log('');
|
|
40
|
-
|
|
41
|
-
const i = p.intercepciones;
|
|
42
|
-
console.log('1. Intercepciones de gates [evidencia · hook-event]');
|
|
43
|
-
if (!i.disponible) {
|
|
44
|
-
console.log(` no disponible — ${i.razon}`);
|
|
45
|
-
} else {
|
|
46
|
-
console.log(` intervenciones: ${i.intervenciones} de ${i.totalEventos} eventos`);
|
|
47
|
-
const tipos = Object.entries(i.porTipo).sort((a, b) => b[1] - a[1]).slice(0, 6);
|
|
48
|
-
for (const [t, n] of tipos) console.log(` - ${t}: ${n}`);
|
|
49
|
-
}
|
|
50
|
-
console.log('');
|
|
51
|
-
|
|
52
|
-
const d = p.defectos;
|
|
53
|
-
console.log('2. Presión de defectos [proxy · git log]');
|
|
54
|
-
if (!d.disponible) {
|
|
55
|
-
console.log(` no disponible — ${d.razon}`);
|
|
56
|
-
} else {
|
|
57
|
-
console.log(` commits: ${d.commits} | fix: ${d.fixes} | feat: ${d.feats} | ratio fix/feat: ${d.ratioFixFeat ?? 'n/a'}`);
|
|
58
|
-
if (d.escapes.disponible) {
|
|
59
|
-
console.log(` escapes: ${d.escapes.fixesTrasUltimaVerificacion} fix tras la última verificación (${d.escapes.ultimaVerificacion}) — ${d.escapes.nota}`);
|
|
60
|
-
} else {
|
|
61
|
-
console.log(` escapes: no disponible — ${d.escapes.razon}`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
console.log('');
|
|
65
|
-
|
|
66
|
-
const dc = p.doraCi;
|
|
67
|
-
console.log('3. DORA-lite + CI [evidencia de tendencia · git + GitHub]');
|
|
68
|
-
if (!dc.disponible) {
|
|
69
|
-
console.log(` no disponible — ${dc.razon}`);
|
|
70
|
-
} else {
|
|
71
|
-
const dora = dc.dora;
|
|
72
|
-
const nd = m => `n/d (${(m && m.razon) || 'sin datos'})`;
|
|
73
|
-
const df = dora.deploymentFrequency;
|
|
74
|
-
console.log(` deployment frequency: ${df && df.disponible !== false && df.valor != null ? `${df.valor} deploys/semana [${df.clasificacion}]` : nd(df)}`);
|
|
75
|
-
const lt = dora.leadTime;
|
|
76
|
-
console.log(` lead time: ${lt && lt.disponible !== false && lt.p50Horas != null ? `p50 ${(+lt.p50Horas).toFixed(1)}h / p95 ${(+lt.p95Horas).toFixed(1)}h [${lt.clasificacion}]` : nd(lt)}`);
|
|
77
|
-
const cfr = dora.changeFailureRate;
|
|
78
|
-
console.log(` change failure rate: ${cfr && cfr.disponible !== false && cfr.valor != null ? `${cfr.valor}% [${cfr.clasificacion || ''}]` : nd(cfr)}`);
|
|
79
|
-
const mt = dora.mttr;
|
|
80
|
-
console.log(` mttr: ${mt && mt.disponible !== false && mt.mttrHoras != null ? `${mt.mttrHoras}h` : nd(mt)}`);
|
|
81
|
-
console.log(' (correlación con la adopción del flujo — no causalidad)');
|
|
82
|
-
}
|
|
83
|
-
console.log('');
|
|
84
|
-
|
|
85
|
-
const u = p.uso;
|
|
86
|
-
console.log('4. Uso del sistema [contexto · telemetría]');
|
|
87
|
-
if (!u.disponible) {
|
|
88
|
-
console.log(` no disponible — ${u.razon}`);
|
|
89
|
-
} else {
|
|
90
|
-
console.log(` invocaciones de skills: ${u.invocaciones} | top: ${u.top5.join(', ')}`);
|
|
91
|
-
}
|
|
92
|
-
console.log('');
|
|
93
|
-
console.log('Compartir agregados con el autor (opt-in): swl-ses field-report — ver docs/evidencia-valor.md');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
module.exports = valor;
|
|
97
|
-
|
|
98
|
-
if (require.main === module) {
|
|
99
|
-
const { parsearOpciones } = require('./lib/parsear-opciones.js');
|
|
100
|
-
valor(parsearOpciones(process.argv.slice(2)));
|
|
101
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* evidencia-valor.js — CLI `swl-ses valor`: panel de evidencia de valor del
|
|
6
|
+
* harness en el proyecto downstream actual.
|
|
7
|
+
*
|
|
8
|
+
* Uso:
|
|
9
|
+
* swl-ses valor # panel legible (ventana 30 días)
|
|
10
|
+
* swl-ses valor --dias 90 # ventana distinta
|
|
11
|
+
* swl-ses valor --json # salida JSON para tooling
|
|
12
|
+
*
|
|
13
|
+
* Reglas duras del panel (docs/evidencia-valor.md):
|
|
14
|
+
* - Cada métrica declara su PROCEDENCIA (git / GitHub / hook-event) y su
|
|
15
|
+
* CARÁCTER (evidencia | proxy | contexto). Nunca scores autodeclarados.
|
|
16
|
+
* - Todo se lee LOCAL. El repo madre no lee estos datos.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const { panelEvidencia } = require('./lib/evidencia-valor.js');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Contrato del CLI (bin/swl-ses.js): exportar UNA función(opciones) sin
|
|
23
|
+
* efectos al require. Violarlo = "modulo is not a function" tras imprimir
|
|
24
|
+
* el panel (caso real: SIGM, 2026-07-09).
|
|
25
|
+
*/
|
|
26
|
+
function valor(opciones = {}) {
|
|
27
|
+
const json = !!opciones.json;
|
|
28
|
+
const ventanaDias = parseInt(opciones.dias, 10) || 30;
|
|
29
|
+
|
|
30
|
+
const p = panelEvidencia(process.cwd(), { ventanaDias });
|
|
31
|
+
|
|
32
|
+
if (json) {
|
|
33
|
+
console.log(JSON.stringify(p, null, 2));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
console.log(`Evidencia de valor — ventana ${p.ventanaDias} días (${p.generado})`);
|
|
38
|
+
console.log(` ${p.frontera}`);
|
|
39
|
+
console.log('');
|
|
40
|
+
|
|
41
|
+
const i = p.intercepciones;
|
|
42
|
+
console.log('1. Intercepciones de gates [evidencia · hook-event]');
|
|
43
|
+
if (!i.disponible) {
|
|
44
|
+
console.log(` no disponible — ${i.razon}`);
|
|
45
|
+
} else {
|
|
46
|
+
console.log(` intervenciones: ${i.intervenciones} de ${i.totalEventos} eventos`);
|
|
47
|
+
const tipos = Object.entries(i.porTipo).sort((a, b) => b[1] - a[1]).slice(0, 6);
|
|
48
|
+
for (const [t, n] of tipos) console.log(` - ${t}: ${n}`);
|
|
49
|
+
}
|
|
50
|
+
console.log('');
|
|
51
|
+
|
|
52
|
+
const d = p.defectos;
|
|
53
|
+
console.log('2. Presión de defectos [proxy · git log]');
|
|
54
|
+
if (!d.disponible) {
|
|
55
|
+
console.log(` no disponible — ${d.razon}`);
|
|
56
|
+
} else {
|
|
57
|
+
console.log(` commits: ${d.commits} | fix: ${d.fixes} | feat: ${d.feats} | ratio fix/feat: ${d.ratioFixFeat ?? 'n/a'}`);
|
|
58
|
+
if (d.escapes.disponible) {
|
|
59
|
+
console.log(` escapes: ${d.escapes.fixesTrasUltimaVerificacion} fix tras la última verificación (${d.escapes.ultimaVerificacion}) — ${d.escapes.nota}`);
|
|
60
|
+
} else {
|
|
61
|
+
console.log(` escapes: no disponible — ${d.escapes.razon}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
console.log('');
|
|
65
|
+
|
|
66
|
+
const dc = p.doraCi;
|
|
67
|
+
console.log('3. DORA-lite + CI [evidencia de tendencia · git + GitHub]');
|
|
68
|
+
if (!dc.disponible) {
|
|
69
|
+
console.log(` no disponible — ${dc.razon}`);
|
|
70
|
+
} else {
|
|
71
|
+
const dora = dc.dora;
|
|
72
|
+
const nd = m => `n/d (${(m && m.razon) || 'sin datos'})`;
|
|
73
|
+
const df = dora.deploymentFrequency;
|
|
74
|
+
console.log(` deployment frequency: ${df && df.disponible !== false && df.valor != null ? `${df.valor} deploys/semana [${df.clasificacion}]` : nd(df)}`);
|
|
75
|
+
const lt = dora.leadTime;
|
|
76
|
+
console.log(` lead time: ${lt && lt.disponible !== false && lt.p50Horas != null ? `p50 ${(+lt.p50Horas).toFixed(1)}h / p95 ${(+lt.p95Horas).toFixed(1)}h [${lt.clasificacion}]` : nd(lt)}`);
|
|
77
|
+
const cfr = dora.changeFailureRate;
|
|
78
|
+
console.log(` change failure rate: ${cfr && cfr.disponible !== false && cfr.valor != null ? `${cfr.valor}% [${cfr.clasificacion || ''}]` : nd(cfr)}`);
|
|
79
|
+
const mt = dora.mttr;
|
|
80
|
+
console.log(` mttr: ${mt && mt.disponible !== false && mt.mttrHoras != null ? `${mt.mttrHoras}h` : nd(mt)}`);
|
|
81
|
+
console.log(' (correlación con la adopción del flujo — no causalidad)');
|
|
82
|
+
}
|
|
83
|
+
console.log('');
|
|
84
|
+
|
|
85
|
+
const u = p.uso;
|
|
86
|
+
console.log('4. Uso del sistema [contexto · telemetría]');
|
|
87
|
+
if (!u.disponible) {
|
|
88
|
+
console.log(` no disponible — ${u.razon}`);
|
|
89
|
+
} else {
|
|
90
|
+
console.log(` invocaciones de skills: ${u.invocaciones} | top: ${u.top5.join(', ')}`);
|
|
91
|
+
}
|
|
92
|
+
console.log('');
|
|
93
|
+
console.log('Compartir agregados con el autor (opt-in): swl-ses field-report — ver docs/evidencia-valor.md');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = valor;
|
|
97
|
+
|
|
98
|
+
if (require.main === module) {
|
|
99
|
+
const { parsearOpciones } = require('./lib/parsear-opciones.js');
|
|
100
|
+
valor(parsearOpciones(process.argv.slice(2)));
|
|
101
|
+
}
|
package/scripts/field-report.js
CHANGED
|
@@ -196,20 +196,20 @@ function generarReporte() {
|
|
|
196
196
|
console.log(`\n> Generado por \`node scripts/field-report.js\``);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
function fieldReport(opciones = {}) {
|
|
200
|
-
DAYS = parseInt(opciones.days || opciones.dias, 10) || 0;
|
|
201
|
-
PROJECT = opciones.project || null;
|
|
202
|
-
OUTPUT = opciones.output || 'md';
|
|
203
|
-
generarReporte();
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
module.exports = fieldReport;
|
|
207
|
-
|
|
208
|
-
if (require.main === module) {
|
|
209
|
-
const args = process.argv.slice(2).reduce((acc, arg) => {
|
|
210
|
-
const [k, v] = arg.replace(/^--/, '').split('=');
|
|
211
|
-
acc[k] = v || true;
|
|
212
|
-
return acc;
|
|
213
|
-
}, {});
|
|
214
|
-
fieldReport(args);
|
|
199
|
+
function fieldReport(opciones = {}) {
|
|
200
|
+
DAYS = parseInt(opciones.days || opciones.dias, 10) || 0;
|
|
201
|
+
PROJECT = opciones.project || null;
|
|
202
|
+
OUTPUT = opciones.output || 'md';
|
|
203
|
+
generarReporte();
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
module.exports = fieldReport;
|
|
207
|
+
|
|
208
|
+
if (require.main === module) {
|
|
209
|
+
const args = process.argv.slice(2).reduce((acc, arg) => {
|
|
210
|
+
const [k, v] = arg.replace(/^--/, '').split('=');
|
|
211
|
+
acc[k] = v || true;
|
|
212
|
+
return acc;
|
|
213
|
+
}, {});
|
|
214
|
+
fieldReport(args);
|
|
215
215
|
}
|
package/scripts/instalador.js
CHANGED
|
@@ -41,6 +41,7 @@ const { canonicalHash } = require('./lib/canonical-hash');
|
|
|
41
41
|
const { auditarEscritura } = require('./lib/audit-evolved');
|
|
42
42
|
const { detectarStack, filtrarReglasPorStack } = require('./lib/detectar-stack');
|
|
43
43
|
const { actualizarGitignore, entradasParaRuntime, limpiarTracked, leerManifest, escribirManifest } = require('./lib/gitignore-manifest');
|
|
44
|
+
const { limpiarBasuraGlobal } = require('./lib/limpiar-basura-global');
|
|
44
45
|
|
|
45
46
|
const RAIZ_PKG = path.resolve(__dirname, '..');
|
|
46
47
|
const VERSION = require('../package.json').version;
|
|
@@ -352,6 +353,18 @@ async function install(opciones) {
|
|
|
352
353
|
}
|
|
353
354
|
}
|
|
354
355
|
|
|
356
|
+
// Scope global: purgar directorios basura sembrados en el HOME por versiones
|
|
357
|
+
// previas: ~/.planning/ scaffold (doctor confundía el HOME con un proyecto por
|
|
358
|
+
// ~/_userland) y ~/_userland/ vacío. Conservador: solo el .planning con la
|
|
359
|
+
// huella del scaffold y el _userland sin plugins reales, nunca contenido del
|
|
360
|
+
// usuario. Ver scripts/lib/limpiar-basura-global.js.
|
|
361
|
+
if (esGlobal) {
|
|
362
|
+
const basura = limpiarBasuraGlobal();
|
|
363
|
+
if (basura.eliminados.length > 0) {
|
|
364
|
+
console.log(`\n[global] Basura purgada del HOME: ${basura.eliminados.join(', ')}.`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
355
368
|
// 4. Detectar _userland/
|
|
356
369
|
const userlandAgentes = path.join(process.cwd(), '_userland', 'agentes');
|
|
357
370
|
const userlandHabilidades = path.join(process.cwd(), '_userland', 'habilidades');
|
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* activar-hooks-proyecto.js — Camino "solo hooks" (DT-HOOKS-SOLO-PROYECTO).
|
|
5
|
-
*
|
|
6
|
-
* Registra en el `.claude/settings.json` del PROYECTO los hooks del scope
|
|
7
|
-
* GLOBAL ya instalado, sin copiar ningún componente. Cierra el dilema del
|
|
8
|
-
* install local: los hooks solo funcionan registrados a nivel proyecto
|
|
9
|
-
* (ADR-0009), pero el install local completo duplica agentes/comandos en la
|
|
10
|
-
* UI de Claude Code (lee ambos scopes). Con este camino:
|
|
11
|
-
*
|
|
12
|
-
* - Los comandos del settings apuntan con ruta ABSOLUTA al hooks/ global
|
|
13
|
-
* (esGlobal: true en registrarHooks) → cero archivos copiados.
|
|
14
|
-
* - `swl-ses update` del global refresca los hooks de TODOS los proyectos
|
|
15
|
-
* activados así, gratis (apuntan a los mismos archivos).
|
|
16
|
-
* - Hooks externos (no-SWL) del settings del proyecto se preservan
|
|
17
|
-
* (garantía de registrarHooks).
|
|
18
|
-
*
|
|
19
|
-
* Uso: `swl-ses install --target claude --solo-hooks` (en la raíz del
|
|
20
|
-
* proyecto). Requiere instalación global previa del runtime.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const fs = require('fs');
|
|
24
|
-
const path = require('path');
|
|
25
|
-
|
|
26
|
-
const RUNTIMES_SOPORTADOS = new Set(['claude', 'openclaude']);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {object} opciones
|
|
30
|
-
* @param {string} [opciones.target='claude'] Runtime (claude|openclaude — formato de settings de Claude Code)
|
|
31
|
-
* @param {string} [opciones.dirProyecto=cwd] Raíz del proyecto destino
|
|
32
|
-
* @param {string} [opciones.hooksDirGlobal] Override del hooks/ global (tests)
|
|
33
|
-
* @param {object} [opciones.deps] Inyección para tests: { registrarHooks, registrarOptimizaciones, cargarHooksConfig, scopesReales, obtenerRuntime }
|
|
34
|
-
* @returns {{ok: boolean, error?: string, settingsPath?: string, hooksDirGlobal?: string, registrados?: number, preservados?: number}}
|
|
35
|
-
*/
|
|
36
|
-
function activarHooksProyecto(opciones = {}) {
|
|
37
|
-
const target = opciones.target || 'claude';
|
|
38
|
-
if (!RUNTIMES_SOPORTADOS.has(target)) {
|
|
39
|
-
return { ok: false, error: `--solo-hooks soporta por ahora targets con settings formato Claude Code (claude, openclaude); recibido: "${target}".` };
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const deps = opciones.deps || {};
|
|
43
|
-
const hs = require('./hooks-settings');
|
|
44
|
-
const registrarHooks = deps.registrarHooks || hs.registrarHooks;
|
|
45
|
-
const registrarOptimizaciones = deps.registrarOptimizaciones || hs.registrarOptimizaciones;
|
|
46
|
-
const cargarHooksConfig = deps.cargarHooksConfig || hs.cargarHooksConfig;
|
|
47
|
-
|
|
48
|
-
// 1. Localizar el hooks/ del scope GLOBAL del runtime.
|
|
49
|
-
let hooksDirGlobal = opciones.hooksDirGlobal;
|
|
50
|
-
if (!hooksDirGlobal) {
|
|
51
|
-
try {
|
|
52
|
-
const dr = require('./detectar-runtime');
|
|
53
|
-
const obtenerRuntime = deps.obtenerRuntime || dr.obtenerRuntime;
|
|
54
|
-
const scopesReales = deps.scopesReales || dr.scopesReales;
|
|
55
|
-
const runtime = obtenerRuntime(target);
|
|
56
|
-
const global = scopesReales(runtime).find(s => s.esGlobal);
|
|
57
|
-
if (!global) return { ok: false, error: `No se pudo resolver el scope global del runtime "${target}".` };
|
|
58
|
-
hooksDirGlobal = path.join(global.dir, 'hooks');
|
|
59
|
-
} catch (err) {
|
|
60
|
-
return { ok: false, error: `No se pudo detectar el runtime "${target}": ${err.message}` };
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (!fs.existsSync(hooksDirGlobal)) {
|
|
64
|
-
return { ok: false, error: `No hay instalación global con hooks en ${hooksDirGlobal}. Instala primero el global: npx -y @saulwade/swl-ses@latest install --target ${target} --global --perfil completo` };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// 2. Hooks disponibles = archivos del global ∩ hooks-config del paquete.
|
|
68
|
-
const hooksConfig = cargarHooksConfig();
|
|
69
|
-
const hookFiles = fs.readdirSync(hooksDirGlobal)
|
|
70
|
-
.filter(f => f.endsWith('.js') && hooksConfig[f]);
|
|
71
|
-
if (hookFiles.length === 0) {
|
|
72
|
-
return { ok: false, error: `El hooks/ global (${hooksDirGlobal}) no contiene hooks reconocidos por hooks-config.json — instalación global corrupta o muy antigua; corre update primero.` };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// 3. Registrar en el settings.json del PROYECTO, apuntando al global.
|
|
76
|
-
const dirProyecto = opciones.dirProyecto || process.cwd();
|
|
77
|
-
const dirClaude = path.join(dirProyecto, '.claude');
|
|
78
|
-
fs.mkdirSync(dirClaude, { recursive: true });
|
|
79
|
-
const settingsPath = path.join(dirClaude, 'settings.json');
|
|
80
|
-
|
|
81
|
-
const r = registrarHooks({
|
|
82
|
-
settingsPath,
|
|
83
|
-
hooksDir: hooksDirGlobal,
|
|
84
|
-
esGlobal: true, // semántica: comandos con ruta ABSOLUTA al hooksDir (que es el global)
|
|
85
|
-
hookFiles,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
let optimizaciones = 0;
|
|
89
|
-
try {
|
|
90
|
-
const opt = registrarOptimizaciones(settingsPath);
|
|
91
|
-
optimizaciones = (opt && opt.registradas) || 0;
|
|
92
|
-
} catch { /* opcional — no bloquea la activación */ }
|
|
93
|
-
|
|
94
|
-
// 4. Sembrar el .gitignore del proyecto: encender la telemetría hace que
|
|
95
|
-
// los hooks ESCRIBAN (.planning/METRICAS.md, audit*.jsonl, evolution/...)
|
|
96
|
-
// — sin la sección swl-ses esos archivos runtime aparecen como cambios
|
|
97
|
-
// pendientes en el editor del usuario (caso real sistema-verificacion-oic,
|
|
98
|
-
// 2026-07-10: 19 archivos sin trackear tras activar hooks).
|
|
99
|
-
let gitignorePath = null;
|
|
100
|
-
try {
|
|
101
|
-
const { actualizarGitignore } = deps.gitignoreManifest || require('./gitignore-manifest');
|
|
102
|
-
gitignorePath = actualizarGitignore(dirProyecto);
|
|
103
|
-
} catch { /* no bloquea la activación — se reporta null */ }
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
ok: true,
|
|
107
|
-
settingsPath,
|
|
108
|
-
hooksDirGlobal,
|
|
109
|
-
registrados: r.registrados,
|
|
110
|
-
preservados: r.preservados,
|
|
111
|
-
optimizaciones,
|
|
112
|
-
gitignorePath,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
module.exports = { activarHooksProyecto, RUNTIMES_SOPORTADOS };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* activar-hooks-proyecto.js — Camino "solo hooks" (DT-HOOKS-SOLO-PROYECTO).
|
|
5
|
+
*
|
|
6
|
+
* Registra en el `.claude/settings.json` del PROYECTO los hooks del scope
|
|
7
|
+
* GLOBAL ya instalado, sin copiar ningún componente. Cierra el dilema del
|
|
8
|
+
* install local: los hooks solo funcionan registrados a nivel proyecto
|
|
9
|
+
* (ADR-0009), pero el install local completo duplica agentes/comandos en la
|
|
10
|
+
* UI de Claude Code (lee ambos scopes). Con este camino:
|
|
11
|
+
*
|
|
12
|
+
* - Los comandos del settings apuntan con ruta ABSOLUTA al hooks/ global
|
|
13
|
+
* (esGlobal: true en registrarHooks) → cero archivos copiados.
|
|
14
|
+
* - `swl-ses update` del global refresca los hooks de TODOS los proyectos
|
|
15
|
+
* activados así, gratis (apuntan a los mismos archivos).
|
|
16
|
+
* - Hooks externos (no-SWL) del settings del proyecto se preservan
|
|
17
|
+
* (garantía de registrarHooks).
|
|
18
|
+
*
|
|
19
|
+
* Uso: `swl-ses install --target claude --solo-hooks` (en la raíz del
|
|
20
|
+
* proyecto). Requiere instalación global previa del runtime.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const fs = require('fs');
|
|
24
|
+
const path = require('path');
|
|
25
|
+
|
|
26
|
+
const RUNTIMES_SOPORTADOS = new Set(['claude', 'openclaude']);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {object} opciones
|
|
30
|
+
* @param {string} [opciones.target='claude'] Runtime (claude|openclaude — formato de settings de Claude Code)
|
|
31
|
+
* @param {string} [opciones.dirProyecto=cwd] Raíz del proyecto destino
|
|
32
|
+
* @param {string} [opciones.hooksDirGlobal] Override del hooks/ global (tests)
|
|
33
|
+
* @param {object} [opciones.deps] Inyección para tests: { registrarHooks, registrarOptimizaciones, cargarHooksConfig, scopesReales, obtenerRuntime }
|
|
34
|
+
* @returns {{ok: boolean, error?: string, settingsPath?: string, hooksDirGlobal?: string, registrados?: number, preservados?: number}}
|
|
35
|
+
*/
|
|
36
|
+
function activarHooksProyecto(opciones = {}) {
|
|
37
|
+
const target = opciones.target || 'claude';
|
|
38
|
+
if (!RUNTIMES_SOPORTADOS.has(target)) {
|
|
39
|
+
return { ok: false, error: `--solo-hooks soporta por ahora targets con settings formato Claude Code (claude, openclaude); recibido: "${target}".` };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const deps = opciones.deps || {};
|
|
43
|
+
const hs = require('./hooks-settings');
|
|
44
|
+
const registrarHooks = deps.registrarHooks || hs.registrarHooks;
|
|
45
|
+
const registrarOptimizaciones = deps.registrarOptimizaciones || hs.registrarOptimizaciones;
|
|
46
|
+
const cargarHooksConfig = deps.cargarHooksConfig || hs.cargarHooksConfig;
|
|
47
|
+
|
|
48
|
+
// 1. Localizar el hooks/ del scope GLOBAL del runtime.
|
|
49
|
+
let hooksDirGlobal = opciones.hooksDirGlobal;
|
|
50
|
+
if (!hooksDirGlobal) {
|
|
51
|
+
try {
|
|
52
|
+
const dr = require('./detectar-runtime');
|
|
53
|
+
const obtenerRuntime = deps.obtenerRuntime || dr.obtenerRuntime;
|
|
54
|
+
const scopesReales = deps.scopesReales || dr.scopesReales;
|
|
55
|
+
const runtime = obtenerRuntime(target);
|
|
56
|
+
const global = scopesReales(runtime).find(s => s.esGlobal);
|
|
57
|
+
if (!global) return { ok: false, error: `No se pudo resolver el scope global del runtime "${target}".` };
|
|
58
|
+
hooksDirGlobal = path.join(global.dir, 'hooks');
|
|
59
|
+
} catch (err) {
|
|
60
|
+
return { ok: false, error: `No se pudo detectar el runtime "${target}": ${err.message}` };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!fs.existsSync(hooksDirGlobal)) {
|
|
64
|
+
return { ok: false, error: `No hay instalación global con hooks en ${hooksDirGlobal}. Instala primero el global: npx -y @saulwade/swl-ses@latest install --target ${target} --global --perfil completo` };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 2. Hooks disponibles = archivos del global ∩ hooks-config del paquete.
|
|
68
|
+
const hooksConfig = cargarHooksConfig();
|
|
69
|
+
const hookFiles = fs.readdirSync(hooksDirGlobal)
|
|
70
|
+
.filter(f => f.endsWith('.js') && hooksConfig[f]);
|
|
71
|
+
if (hookFiles.length === 0) {
|
|
72
|
+
return { ok: false, error: `El hooks/ global (${hooksDirGlobal}) no contiene hooks reconocidos por hooks-config.json — instalación global corrupta o muy antigua; corre update primero.` };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 3. Registrar en el settings.json del PROYECTO, apuntando al global.
|
|
76
|
+
const dirProyecto = opciones.dirProyecto || process.cwd();
|
|
77
|
+
const dirClaude = path.join(dirProyecto, '.claude');
|
|
78
|
+
fs.mkdirSync(dirClaude, { recursive: true });
|
|
79
|
+
const settingsPath = path.join(dirClaude, 'settings.json');
|
|
80
|
+
|
|
81
|
+
const r = registrarHooks({
|
|
82
|
+
settingsPath,
|
|
83
|
+
hooksDir: hooksDirGlobal,
|
|
84
|
+
esGlobal: true, // semántica: comandos con ruta ABSOLUTA al hooksDir (que es el global)
|
|
85
|
+
hookFiles,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
let optimizaciones = 0;
|
|
89
|
+
try {
|
|
90
|
+
const opt = registrarOptimizaciones(settingsPath);
|
|
91
|
+
optimizaciones = (opt && opt.registradas) || 0;
|
|
92
|
+
} catch { /* opcional — no bloquea la activación */ }
|
|
93
|
+
|
|
94
|
+
// 4. Sembrar el .gitignore del proyecto: encender la telemetría hace que
|
|
95
|
+
// los hooks ESCRIBAN (.planning/METRICAS.md, audit*.jsonl, evolution/...)
|
|
96
|
+
// — sin la sección swl-ses esos archivos runtime aparecen como cambios
|
|
97
|
+
// pendientes en el editor del usuario (caso real sistema-verificacion-oic,
|
|
98
|
+
// 2026-07-10: 19 archivos sin trackear tras activar hooks).
|
|
99
|
+
let gitignorePath = null;
|
|
100
|
+
try {
|
|
101
|
+
const { actualizarGitignore } = deps.gitignoreManifest || require('./gitignore-manifest');
|
|
102
|
+
gitignorePath = actualizarGitignore(dirProyecto);
|
|
103
|
+
} catch { /* no bloquea la activación — se reporta null */ }
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
ok: true,
|
|
107
|
+
settingsPath,
|
|
108
|
+
hooksDirGlobal,
|
|
109
|
+
registrados: r.registrados,
|
|
110
|
+
preservados: r.preservados,
|
|
111
|
+
optimizaciones,
|
|
112
|
+
gitignorePath,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module.exports = { activarHooksProyecto, RUNTIMES_SOPORTADOS };
|