@saulwade/swl-ses 2.2.3 → 2.2.4

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 (45) hide show
  1. package/CLAUDE.md +3 -3
  2. package/README.md +1 -1
  3. package/agentes/arquitecto-swl.md +1 -1
  4. package/agentes/auto-evolucion-swl.md +908 -908
  5. package/agentes/backend-csharp-swl.md +1 -1
  6. package/agentes/backend-go-swl.md +1 -1
  7. package/agentes/backend-java-swl.md +1 -1
  8. package/agentes/backend-rust-swl.md +1 -1
  9. package/agentes/evals/orquestador-swl.evals.json +1 -1
  10. package/agentes/implementador-swl.md +2 -2
  11. package/agentes/llm-apps-swl.md +1 -1
  12. package/agentes/orquestador-swl.md +7 -7
  13. package/agentes/pagos-swl.md +1 -1
  14. package/agentes/perfilador-usuario-swl.md +321 -321
  15. package/agentes/planificador-swl.md +1 -1
  16. package/agentes/producto-prd-swl.md +1 -1
  17. package/agentes/revisor-seguridad-swl.md +1 -1
  18. package/agentes/sre-swl.md +1 -1
  19. package/comandos/swl/release.md +15 -0
  20. package/comandos/swl/verificar.md +817 -817
  21. package/habilidades/compactacion-contexto/SKILL.md +3 -3
  22. package/habilidades/context-builder/SKILL.md +4 -4
  23. package/habilidades/control-profundidad/SKILL.md +5 -5
  24. package/habilidades/guardrail-semantico/SKILL.md +1 -1
  25. package/habilidades/harness-claude-code/SKILL.md +305 -305
  26. package/habilidades/meta-skills-estandar/recursos/skills-as-agents.md +1 -1
  27. package/habilidades/prompt-engineering/SKILL.md +5 -5
  28. package/habilidades/release-semver/SKILL.md +4 -1
  29. package/habilidades/workflow-claude-code/SKILL.md +6 -6
  30. package/hooks/lib/context-builder.js +2 -2
  31. package/hooks/lib/model-router.js +1 -1
  32. package/hooks/lib/token-estimator.js +2 -0
  33. package/hooks/linea-estado.js +7 -5
  34. package/llms.txt +1 -1
  35. package/manifiestos/canonical-hashes.json +1637 -1310
  36. package/manifiestos/skills-lock.json +1282 -1282
  37. package/package.json +93 -93
  38. package/plugin.json +371 -371
  39. package/reglas/git-coauthor.md +100 -100
  40. package/reglas/pruebas.md +15 -0
  41. package/schemas/agent-frontmatter.schema.json +294 -294
  42. package/scripts/lib/claude-sessions.js +1 -0
  43. package/scripts/lib/tool-cost-analyzer.js +1 -0
  44. package/scripts/publicar.js +34 -85
  45. package/scripts/vendor/claude-usage/__pycache__/scanner.cpython-314.pyc +0 -0
@@ -16,7 +16,6 @@ const { execFileSync, spawnSync } = require('child_process');
16
16
  const fs = require('fs');
17
17
  const path = require('path');
18
18
  const os = require('os');
19
- const readline = require('readline');
20
19
 
21
20
  const {
22
21
  NOMBRE_GITHUB_MIRROR: GITHUB_NAME,
@@ -131,84 +130,35 @@ function esErrorOTP(stderr) {
131
130
  }
132
131
 
133
132
  /**
134
- * Solicita una OTP al usuario via stdin (readline síncrono).
135
- * Retorna la OTP normalizada (string de 6 dígitos) o null si:
136
- * - stdin no es TTY (CI, pipe) no se puede pedir interactivamente
137
- * - el usuario cancela con Ctrl+C / línea vacía
138
- * - el formato no es válido (no 6 dígitos)
139
- *
140
- * El caller debe manejar el caso null como "fallback a guía manual".
141
- */
142
- function solicitarOTPInteractiva() {
143
- if (!process.stdin.isTTY) {
144
- process.stderr.write('[publicar] stdin no es TTY: no se puede pedir OTP interactivamente.\n');
145
- process.stderr.write('[publicar] Configurar NPM_CONFIG_OTP=<otp> antes de invocar este script.\n');
146
- return null;
147
- }
148
-
149
- const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
150
- // questionSync vía promesa NO funciona aquí — el script es síncrono.
151
- // Usamos un truco: readline es async-only, así que dejamos al usuario
152
- // el manejo bloqueante leyendo línea por línea con readSync vía read-int.
153
- // Pero readline no expone modo síncrono. Alternativa: leer de stdin con
154
- // fd 0 + readSync. En Windows con TTY funciona; en Linux idem.
155
- try {
156
- process.stderr.write('\nNPM requiere OTP (2FA). Ingresa el código de 6 dígitos de tu autenticador: ');
157
- const otp = leerLineaStdinSync().trim();
158
- rl.close();
159
- if (!/^\d{6}$/.test(otp)) {
160
- process.stderr.write(`\n[publicar] OTP inválida: se esperan 6 dígitos, se recibió: "${otp.slice(0, 20)}"\n`);
161
- return null;
162
- }
163
- return otp;
164
- } catch (err) {
165
- rl.close();
166
- process.stderr.write(`\n[publicar] error leyendo OTP: ${String(err.message).slice(0, 120)}\n`);
167
- return null;
168
- }
169
- }
170
-
171
- /**
172
- * Lectura síncrona de una línea de stdin. Necesario porque readline solo
173
- * expone API asíncrona, pero todo el flujo de publicar.js es síncrono.
174
- * Lee byte por byte hasta encontrar newline o EOF.
133
+ * Ejecuta npm con stdio HEREDADO (interactivo): npm escribe directo a la
134
+ * terminal y lee de stdin, de modo que su flujo de 2FA NATIVO funciona —
135
+ * prompt de OTP TOTP O auth web/passkey ("abrir URL y seleccionar la llave"),
136
+ * según el método 2FA de la cuenta. Retorna el exit status sin lanzar.
137
+ * (A1: soporte passkey/WebAuthn, no solo TOTP.)
175
138
  */
176
- function leerLineaStdinSync() {
177
- const BUFFER_SIZE = 256;
178
- const buf = Buffer.alloc(BUFFER_SIZE);
179
- let line = '';
180
- while (true) {
181
- let bytesRead;
182
- try {
183
- bytesRead = fs.readSync(0, buf, 0, BUFFER_SIZE, null);
184
- } catch (err) {
185
- // EAGAIN en stdin no-bloqueante: poco común en TTY, pero defensivo.
186
- if (err.code === 'EAGAIN') continue;
187
- throw err;
188
- }
189
- if (bytesRead === 0) break; // EOF
190
- const chunk = buf.slice(0, bytesRead).toString('utf-8');
191
- const nlIdx = chunk.indexOf('\n');
192
- if (nlIdx >= 0) {
193
- line += chunk.slice(0, nlIdx);
194
- break;
195
- }
196
- line += chunk;
139
+ function npmExecInherit(args, opts = {}) {
140
+ const merged = { cwd: ROOT, timeout: 600_000, env: process.env, ...opts, stdio: 'inherit' };
141
+ let res;
142
+ if (NPM_CLI_JS) {
143
+ res = spawnSync(process.execPath, [NPM_CLI_JS, ...args], merged);
144
+ } else {
145
+ const bin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
146
+ res = spawnSync(bin, args, merged);
197
147
  }
198
- return line.replace(/\r$/, ''); // Windows envía \r\n
148
+ return res.status;
199
149
  }
200
150
 
201
151
  /**
202
152
  * Ejecuta un `npm publish` con soporte automático de OTP (2FA).
203
153
  *
204
154
  * Flujo:
205
- * 1. Si NPM_CONFIG_OTP está definida en el entorno, se usa directamente
206
- * (npm la lee automáticamente no hay que pasarla como flag).
207
- * 2. Si el publish falla con EOTP/one-time password, se intenta solicitar
208
- * la OTP interactivamente y reintentar con --ignore-scripts (los
209
- * scripts pre-publish ya pasaron en el primer intento).
210
- * 3. Si no se puede obtener OTP (no TTY o usuario cancela), reporta el
211
- * error y retorna false.
155
+ * 1. Si NPM_CONFIG_OTP está definida en el entorno (o hay token Automation),
156
+ * se usa directamente y el intento 1 publica sin interacción.
157
+ * 2. Si el publish falla con EOTP/one-time password y stdin es TTY, se
158
+ * reintenta con stdio HEREDADO para que npm conduzca su 2FA NATIVO —
159
+ * OTP TOTP O passkey/WebAuthn (navegador), según la cuenta — con
160
+ * --ignore-scripts (los pre-publish ya pasaron en el intento 1).
161
+ * 3. Si stdin no es TTY (CI sin OTP), reporta el error y retorna false.
212
162
  *
213
163
  * Retorna: { ok: boolean, stderr: string }
214
164
  *
@@ -226,24 +176,23 @@ function ejecutarPublishConOTP(args, opts = {}) {
226
176
  return { ok: false, stderr: intento1.stderr };
227
177
  }
228
178
 
229
- // Es EOTP. Intentar solicitar OTP interactivamente.
179
+ // Es EOTP — 2FA requerida. npm soporta varios métodos: OTP TOTP (6 dígitos)
180
+ // O passkey/WebAuthn vía navegador ("abrir URL y seleccionar la llave").
181
+ // Forzar un prompt de TOTP rompe a los usuarios con passkey (A1). En su lugar
182
+ // se reintenta con stdio HEREDADO para que npm conduzca su 2FA NATIVO —
183
+ // funcione cual sea el método configurado en la cuenta.
230
184
  process.stderr.write('\n[publicar] npm rechazó el publish con EOTP (2FA requerida).\n');
231
- const otp = solicitarOTPInteractiva();
232
- if (!otp) {
233
- process.stderr.write('[publicar] No se obtuvo OTP. Aborta. Reintentar con:\n');
234
- process.stderr.write(` NPM_CONFIG_OTP=<otp> node scripts/publicar.js ${process.argv.slice(2).join(' ')}\n`);
185
+ if (!process.stdin.isTTY) {
186
+ process.stderr.write('[publicar] stdin no es TTY: no se puede completar 2FA interactivo.\n');
187
+ process.stderr.write('[publicar] Opciones: exportar NPM_CONFIG_OTP=<otp>, o usar un token Automation (omite 2FA).\n');
235
188
  return { ok: false, stderr: intento1.stderr };
236
189
  }
237
-
238
- // Reintento con OTP via env + --ignore-scripts (los pre-publish ya pasaron).
239
- process.stderr.write('\n[publicar] Reintentando publish con OTP recibida...\n');
240
- const envConOTP = { ...(opts.env || process.env), NPM_CONFIG_OTP: otp };
190
+ // Reintento interactivo: --ignore-scripts porque los pre-publish ya pasaron en
191
+ // el intento 1 (el prepack limpió el árbol; no se re-ejecuta test:release).
192
+ process.stderr.write('\n[publicar] Reintentando con el 2FA interactivo nativo de npm (OTP o passkey)...\n');
241
193
  const argsConIgnore = args.includes('--ignore-scripts') ? args : [...args, '--ignore-scripts'];
242
- const intento2 = npmSpawnCaptureStderr(argsConIgnore, { ...opts, env: envConOTP });
243
- if (intento2.status === 0) {
244
- return { ok: true, stderr: intento2.stderr };
245
- }
246
- return { ok: false, stderr: intento2.stderr };
194
+ const status = npmExecInherit(argsConIgnore, opts);
195
+ return { ok: status === 0, stderr: status === 0 ? '' : 'fallo en reintento interactivo de 2FA' };
247
196
  }
248
197
 
249
198
  function leerPkg() {