specatlas 0.1.39 → 0.1.40
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/dist/bin.js +116 -13
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -36916,6 +36916,64 @@ function seccion(tema, titulo, detalle) {
|
|
|
36916
36916
|
const cabeza = pinta(tema, ["negrita"], titulo);
|
|
36917
36917
|
return detalle ? `${cabeza} ${pinta(tema, "gris", detalle)}` : cabeza;
|
|
36918
36918
|
}
|
|
36919
|
+
var MARCA = [
|
|
36920
|
+
[20, 184, 166],
|
|
36921
|
+
[37, 99, 235],
|
|
36922
|
+
[124, 58, 237]
|
|
36923
|
+
];
|
|
36924
|
+
function soportaDegradado(env = process.env) {
|
|
36925
|
+
const colorterm = env["COLORTERM"] ?? "";
|
|
36926
|
+
return colorterm.includes("truecolor") || colorterm.includes("24bit") || env["TERM_PROGRAM"] === "vscode" || Boolean(env["WT_SESSION"]);
|
|
36927
|
+
}
|
|
36928
|
+
function pintaRGB(tema, [r, g, b], texto) {
|
|
36929
|
+
if (!tema.color || texto === "") return texto;
|
|
36930
|
+
return `\x1B[38;2;${r};${g};${b}m${texto}\x1B[39m`;
|
|
36931
|
+
}
|
|
36932
|
+
function mezcla(a, b, t) {
|
|
36933
|
+
return [Math.round(a[0] + (b[0] - a[0]) * t), Math.round(a[1] + (b[1] - a[1]) * t), Math.round(a[2] + (b[2] - a[2]) * t)];
|
|
36934
|
+
}
|
|
36935
|
+
function degradado(tema, texto, paradas = MARCA, env = process.env) {
|
|
36936
|
+
if (!tema.color) return texto;
|
|
36937
|
+
if (!soportaDegradado(env)) return pinta(tema, "cian", texto);
|
|
36938
|
+
const visibles = [...texto];
|
|
36939
|
+
const ultimo = Math.max(1, visibles.length - 1);
|
|
36940
|
+
return visibles.map((caracter, indice) => {
|
|
36941
|
+
if (caracter.trim() === "") return caracter;
|
|
36942
|
+
const posicion = indice / ultimo * (paradas.length - 1);
|
|
36943
|
+
const tramo = Math.min(paradas.length - 2, Math.floor(posicion));
|
|
36944
|
+
return pintaRGB(tema, mezcla(paradas[tramo], paradas[tramo + 1], posicion - tramo), caracter);
|
|
36945
|
+
}).join("");
|
|
36946
|
+
}
|
|
36947
|
+
var LETRAS = {
|
|
36948
|
+
S: ["\u2588\u2588\u2588\u2588\u2588", "\u2588 ", "\u2588\u2588\u2588\u2588\u2588", " \u2588", "\u2588\u2588\u2588\u2588\u2588"],
|
|
36949
|
+
P: ["\u2588\u2588\u2588\u2588\u2588", "\u2588 \u2588", "\u2588\u2588\u2588\u2588\u2588", "\u2588 ", "\u2588 "],
|
|
36950
|
+
E: ["\u2588\u2588\u2588\u2588\u2588", "\u2588 ", "\u2588\u2588\u2588\u2588 ", "\u2588 ", "\u2588\u2588\u2588\u2588\u2588"],
|
|
36951
|
+
C: ["\u2588\u2588\u2588\u2588\u2588", "\u2588 ", "\u2588 ", "\u2588 ", "\u2588\u2588\u2588\u2588\u2588"],
|
|
36952
|
+
A: ["\u2588\u2588\u2588\u2588\u2588", "\u2588 \u2588", "\u2588\u2588\u2588\u2588\u2588", "\u2588 \u2588", "\u2588 \u2588"],
|
|
36953
|
+
T: ["\u2588\u2588\u2588\u2588\u2588", " \u2588 ", " \u2588 ", " \u2588 ", " \u2588 "],
|
|
36954
|
+
L: ["\u2588 ", "\u2588 ", "\u2588 ", "\u2588 ", "\u2588\u2588\u2588\u2588\u2588"]
|
|
36955
|
+
};
|
|
36956
|
+
var ALTO_LETRERO = 5;
|
|
36957
|
+
var NOMBRE = "SPECATLAS";
|
|
36958
|
+
var ANCHO_LETRERO = NOMBRE.length * 6 - 1;
|
|
36959
|
+
function letrero(tema) {
|
|
36960
|
+
if (!tema.unicode || tema.ancho < ANCHO_LETRERO + 4) return void 0;
|
|
36961
|
+
const letras = [...NOMBRE].map((letra) => LETRAS[letra]);
|
|
36962
|
+
if (letras.some((letra) => letra === void 0)) return void 0;
|
|
36963
|
+
return Array.from({ length: ALTO_LETRERO }, (_, fila) => letras.map((letra) => letra[fila]).join(" "));
|
|
36964
|
+
}
|
|
36965
|
+
function banner(tema, version, lema = "el proceso se verifica, no se conf\xEDa") {
|
|
36966
|
+
const pie = pinta(tema, "gris", `${version} ${simbolos(tema).separador} ${lema}`);
|
|
36967
|
+
const letras = letrero(tema);
|
|
36968
|
+
if (!letras) return ["", ` ${degradado(tema, "SpecAtlas")}`, ` ${pie}`, ""];
|
|
36969
|
+
return ["", ...letras.map((fila) => ` ${degradado(tema, fila)}`), ` ${pie}`, ""];
|
|
36970
|
+
}
|
|
36971
|
+
function truncar(texto, maximo) {
|
|
36972
|
+
if (maximo <= 1 || anchoVisible(texto) <= maximo) return texto;
|
|
36973
|
+
const corte = texto.slice(0, maximo - 1);
|
|
36974
|
+
const espacio = corte.lastIndexOf(" ");
|
|
36975
|
+
return `${(espacio > maximo * 0.6 ? corte.slice(0, espacio) : corte).trimEnd()}\u2026`;
|
|
36976
|
+
}
|
|
36919
36977
|
|
|
36920
36978
|
// src/version.ts
|
|
36921
36979
|
import { readFileSync } from "fs";
|
|
@@ -38278,27 +38336,72 @@ async function runHash(ctx) {
|
|
|
38278
38336
|
}
|
|
38279
38337
|
|
|
38280
38338
|
// src/commands/help.ts
|
|
38339
|
+
var GRUPOS = [
|
|
38340
|
+
{ titulo: "Empezar", detalle: "poner el flujo en marcha", comandos: ["init", "adopt", "new"] },
|
|
38341
|
+
{ titulo: "El ciclo", detalle: "de lo acordado a la evidencia", comandos: ["approve", "amend", "verify", "review", "archive", "pause", "resume"] },
|
|
38342
|
+
{ titulo: "Saber d\xF3nde est\xE1s", detalle: "qu\xE9 toca y c\xF3mo va", comandos: ["status", "next", "watch", "metrics", "impact", "explain"] },
|
|
38343
|
+
{ titulo: "Comprobar", detalle: "que encaja y que funciona", comandos: ["validate", "trace", "waves", "analyze", "ci", "doctor", "drift", "packs", "contracts", "clarify"] },
|
|
38344
|
+
{ titulo: "Compartir", detalle: "lo que otros van a leer", comandos: ["present", "docs", "mockup", "issue"] },
|
|
38345
|
+
{ titulo: "El proyecto", detalle: "configuraci\xF3n y herramientas", comandos: ["adapters", "profile", "link", "upgrade", "self-update", "hash", "run", "mcp", "version", "help"] }
|
|
38346
|
+
];
|
|
38347
|
+
var TONOS = ["verde", "cian", "azul", "amarillo", "morado", "gris"];
|
|
38348
|
+
function detalleDeComando(tema, nombre) {
|
|
38349
|
+
const spec = CATALOG.find((item) => item.name === nombre);
|
|
38350
|
+
if (!spec) return [];
|
|
38351
|
+
const s = simbolos(tema);
|
|
38352
|
+
return [
|
|
38353
|
+
"",
|
|
38354
|
+
` ${pinta(tema, ["negrita"], `satlas ${spec.name}`)} ${pinta(tema, "gris", spec.description)}`,
|
|
38355
|
+
"",
|
|
38356
|
+
` ${pinta(tema, "cian", s.flecha)} ${pinta(tema, "cian", spec.usage ?? `satlas ${spec.name}`)}`,
|
|
38357
|
+
...spec.flags.length > 0 ? ["", ` ${pinta(tema, "gris", "opciones:")} ${spec.flags.map((flag3) => pinta(tema, "gris", `--${flag3}`)).join(pinta(tema, "gris", " \xB7 "))}`] : [],
|
|
38358
|
+
""
|
|
38359
|
+
];
|
|
38360
|
+
}
|
|
38281
38361
|
async function runHelp(ctx, commandName) {
|
|
38282
38362
|
const language = ctx.language;
|
|
38283
|
-
const
|
|
38284
|
-
|
|
38285
|
-
lines.push("");
|
|
38363
|
+
const tema = detectarTema();
|
|
38364
|
+
const s = simbolos(tema);
|
|
38286
38365
|
if (commandName) {
|
|
38287
|
-
const spec = CATALOG.find((
|
|
38366
|
+
const spec = CATALOG.find((item) => item.name === commandName);
|
|
38288
38367
|
if (!spec) {
|
|
38289
|
-
return {
|
|
38368
|
+
return {
|
|
38369
|
+
exitCode: 2,
|
|
38370
|
+
diagnostics: [{ code: "ATLAS-CLI-001", severity: "error", message: `${msg("cli.unknownCommand", language)}: ${commandName}`, suggestion: "Ejecuta `satlas help` para ver los comandos por grupo" }]
|
|
38371
|
+
};
|
|
38290
38372
|
}
|
|
38291
|
-
|
|
38292
|
-
lines.push(` ${spec.usage ?? `satlas ${spec.name}`}`);
|
|
38293
|
-
return { exitCode: 0, diagnostics: [], text: lines };
|
|
38373
|
+
return { exitCode: 0, diagnostics: [], text: detalleDeComando(tema, commandName) };
|
|
38294
38374
|
}
|
|
38295
|
-
lines
|
|
38375
|
+
const lines = banner(tema, cliVersion());
|
|
38376
|
+
lines.push(filaAlineada([{ texto: ` ${pinta(tema, "gris", "uso")}`, ancho: 8 }, { texto: pinta(tema, "negrita", "satlas <comando> [opciones]") }]));
|
|
38377
|
+
lines.push(filaAlineada([{ texto: ` ${pinta(tema, "gris", "ayuda")}`, ancho: 8 }, { texto: pinta(tema, "gris", "satlas help <comando> \xB7 todos aceptan --json") }]));
|
|
38296
38378
|
lines.push("");
|
|
38297
|
-
|
|
38298
|
-
|
|
38379
|
+
lines.push(` ${pinta(tema, "cian", s.flecha)} ${pinta(tema, ["cian", "negrita"], "satlas next")} ${pinta(tema, "gris", "qu\xE9 toca hacer ahora mismo en este proyecto")}`);
|
|
38380
|
+
lines.push("");
|
|
38381
|
+
const ancho = Math.max(...CATALOG.map((spec) => spec.name.length)) + 2;
|
|
38382
|
+
const anchoDescripcion = Math.max(24, tema.ancho - ancho - 8);
|
|
38383
|
+
GRUPOS.forEach((grupo, indice) => {
|
|
38384
|
+
const disponibles = grupo.comandos.filter((nombre) => CATALOG.some((spec) => spec.name === nombre));
|
|
38385
|
+
if (disponibles.length === 0) return;
|
|
38386
|
+
lines.push(` ${pinta(tema, [TONOS[indice % TONOS.length], "negrita"], grupo.titulo.toUpperCase())} ${pinta(tema, "gris", grupo.detalle)}`);
|
|
38387
|
+
for (const nombre of disponibles) {
|
|
38388
|
+
const spec = CATALOG.find((item) => item.name === nombre);
|
|
38389
|
+
lines.push(filaAlineada([{ texto: ` ${pinta(tema, "negrita", spec.name)}`, ancho: ancho + 4 }, { texto: pinta(tema, "gris", truncar(spec.description, anchoDescripcion)) }]));
|
|
38390
|
+
}
|
|
38391
|
+
lines.push("");
|
|
38392
|
+
});
|
|
38393
|
+
const agrupados = new Set(GRUPOS.flatMap((grupo) => grupo.comandos));
|
|
38394
|
+
const sueltos = CATALOG.filter((spec) => !agrupados.has(spec.name));
|
|
38395
|
+
if (sueltos.length > 0) {
|
|
38396
|
+
lines.push(` ${pinta(tema, ["gris", "negrita"], "OTROS")}`);
|
|
38397
|
+
for (const spec of sueltos) {
|
|
38398
|
+
lines.push(filaAlineada([{ texto: ` ${pinta(tema, "negrita", spec.name)}`, ancho: ancho + 4 }, { texto: pinta(tema, "gris", truncar(spec.description, anchoDescripcion)) }]));
|
|
38399
|
+
}
|
|
38400
|
+
lines.push("");
|
|
38299
38401
|
}
|
|
38402
|
+
lines.push(` ${pinta(tema, "gris", `salida: 0 ${s.separador} 1 hallazgos ${s.separador} 2 uso ${s.separador} 3 E/S`)}`);
|
|
38403
|
+
lines.push(` ${pinta(tema, "gris", "documentaci\xF3n: ")}${degradado(tema, "github.com/AlonsoAM/specatlas")}`);
|
|
38300
38404
|
lines.push("");
|
|
38301
|
-
lines.push("Documentaci\xF3n: ARQUITECTURA.md y PROPUESTA.md en el repositorio.");
|
|
38302
38405
|
return { exitCode: 0, diagnostics: [], text: lines };
|
|
38303
38406
|
}
|
|
38304
38407
|
|
|
@@ -40256,7 +40359,7 @@ var HANDLERS2 = {
|
|
|
40256
40359
|
archive: runArchive,
|
|
40257
40360
|
"self-update": runSelfUpdate,
|
|
40258
40361
|
version: async () => ({ exitCode: 0, data: { version: cliVersion() }, diagnostics: [], text: [`specatlas ${cliVersion()}`] }),
|
|
40259
|
-
help: (ctx) => runHelp(ctx)
|
|
40362
|
+
help: (ctx) => runHelp(ctx, ctx.positionals[0])
|
|
40260
40363
|
};
|
|
40261
40364
|
var COMMANDS = Object.fromEntries(
|
|
40262
40365
|
CATALOG.map((spec) => [spec.name, { description: spec.description, flags: spec.flags, handler: HANDLERS2[spec.name] }])
|