sabia 2.0.1 → 2.0.2

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 (2) hide show
  1. package/package.json +1 -1
  2. package/sabia.mjs +7 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sabia",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Instala, atualiza e desinstala o Sabiá e os toolkits dele no Kiro e no opencode, com um inventário em ~/.sabia/, e explica a rota dos fluxos (sabia rota).",
5
5
  "type": "module",
6
6
  "bin": {
package/sabia.mjs CHANGED
@@ -362,7 +362,6 @@ function mostrarDiferencas(dif) {
362
362
  }
363
363
 
364
364
  export async function instalar(opcoes = {}) {
365
- ctx.log(BANNER + "\n");
366
365
  const inv = lerInventario();
367
366
  const novo = baixarFramework(opcoes);
368
367
  fs.rmSync(sabia("framework"), { recursive: true, force: true });
@@ -664,7 +663,10 @@ export function listarToolkits(opcoes = {}) {
664
663
  l[0] = `↳ ${l[0]}`;
665
664
  linhas.splice(i < 0 ? linhas.length : i + 1, 0, l);
666
665
  }
667
- ctx.log(colunas([["TOOLKIT", "AUTOR", "NO ÍNDICE", "INSTALADO", "NESTE PROJETO", "DESCRIÇÃO"], ...linhas]));
666
+ // no terminal, a descrição é cortada na largura da tela; em pipe ou arquivo, sai inteira
667
+ const largura = process.stdout.columns;
668
+ const corta = (s) => { const c = [...s]; return !largura || c.length <= largura ? s : c.slice(0, largura - 1).join("") + "…"; };
669
+ ctx.log(colunas([["TOOLKIT", "AUTOR", "NO ÍNDICE", "INSTALADO", "NESTE PROJETO", "DESCRIÇÃO"], ...linhas]).split("\n").map(corta).join("\n"));
668
670
  return linhas;
669
671
  }
670
672
 
@@ -883,9 +885,7 @@ export function rotaMapa(opcoes = {}) {
883
885
 
884
886
  // ---------- linha de comando ----------
885
887
 
886
- const AJUDA = `${BANNER}
887
-
888
- sabia ${VERSAO} — instala o Sabiá e os toolkits no Kiro e no opencode
888
+ const AJUDA = `sabia ${VERSAO} — instala o Sabiá e os toolkits no Kiro e no opencode
889
889
 
890
890
  sabia instalar [--alvo kiro,opencode] [--versao X] [--fonte <pasta|url-git>[@ref]]
891
891
  sabia atualizar [--versao X] [--fonte <pasta|url-git>[@ref]]
@@ -929,6 +929,8 @@ export async function main(argv = process.argv.slice(2)) {
929
929
  const antes = ctx.perguntar;
930
930
  ctx.perguntar = async (texto, padrao) => (/alterado à mão/.test(texto) ? antes(texto, padrao) : /\[s\/N\]/.test(texto) ? "s" : padrao);
931
931
  }
932
+ // o banner em todo comando, só no terminal: em pipe ou arquivo (o Mermaid do rota) a saída fica limpa
933
+ if (process.stdout.isTTY) ctx.log(BANNER + "\n");
932
934
  try {
933
935
  if (cmd === "instalar") await instalar(opcoes);
934
936
  else if (cmd === "atualizar") await atualizar(opcoes);