terminal-smart-cli 0.97.59 → 0.97.62

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/bin/ts.js CHANGED
@@ -3071,8 +3071,9 @@ async function siteCmd(args) {
3071
3071
  const prompt = rest.join(' ').trim();
3072
3072
  const editing = ['editar', 'edit', 'alterar', 'update'].includes(sub);
3073
3073
  if (!slug || !prompt) return console.log(ui.errLine(`uso: ts site ${editing ? 'editar' : 'criar'} <nome> "<descreva ${editing ? 'a alteração' : 'o site'} em linguagem natural>"`));
3074
+ if (!FLAGS.has('--confirmar')) return console.log(ui.errLine(`Publicação não executada. Revise o pedido e repita com --confirmar: ts site ${editing ? 'editar' : 'criar'} <nome> "<descrição>" --confirmar`));
3074
3075
  console.log(C.dim(editing ? 'carregando, alterando e republicando o site…' : 'criando e publicando o site…'));
3075
- const r = await api('/api/sites/generate', { token, method: 'POST', body: { slug, prompt }, timeoutMs: 240000 });
3076
+ const r = await api('/api/sites/generate', { token, method: 'POST', body: { slug, prompt, confirmed: true }, timeoutMs: 240000 });
3076
3077
  if (!r.ok) return console.log(ui.errLine(r.error || r.message || 'não foi possível criar o site'));
3077
3078
  if (JSON_OUT) return console.log(JSON.stringify(r));
3078
3079
  console.log('\n' + ui.box([
package/lib/agent.js CHANGED
@@ -204,7 +204,7 @@ function modelCallCap(personalSubscription = false, complexTask = false) {
204
204
  function explicitExclusiveFileTargets(task, cwd) {
205
205
  const text = String(task || '');
206
206
  const targets = [];
207
- const pattern = /\b(?:somente|apenas)\s+(?:o\s+arquivo\s+)?["'`]?([^\s,"'`]+\.[a-z0-9]{1,12})["'`]?/gi;
207
+ const pattern = /\b(?:somente|apenas)\s+(?:o\s+arquivo\s+)?(?:existente\s+)?["'`]?([^\s,"'`]+\.[a-z0-9]{1,12})["'`]?/gi;
208
208
  for (const match of text.matchAll(pattern)) {
209
209
  const raw = String(match[1] || '').replace(/[.;:!?]+$/, '');
210
210
  if (raw) targets.push(path.resolve(cwd, raw));
@@ -841,11 +841,17 @@ function normalizeFileToolInput(name, input, { cwd = process.cwd(), exclusiveTar
841
841
  const alias = out.caminho || out.path || out.arquivo || out.file || out.filename;
842
842
  if (alias && String(alias).trim() && String(alias).trim() !== '.') {
843
843
  out.caminho = alias;
844
- return out;
845
- }
846
- if (exclusiveTargets.length === 1) {
844
+ } else if (exclusiveTargets.length === 1) {
847
845
  out.caminho = path.relative(cwd, exclusiveTargets[0]) || exclusiveTargets[0];
848
846
  }
847
+ if (name === 'escrever_arquivo' && !Object.prototype.hasOwnProperty.call(out, 'conteudo')) {
848
+ const contentAlias = out.content ?? out.contents ?? out.text ?? out.body;
849
+ if (contentAlias !== undefined) out.conteudo = contentAlias;
850
+ }
851
+ if (name === 'editar_arquivo') {
852
+ if (!Object.prototype.hasOwnProperty.call(out, 'buscar')) out.buscar = out.search ?? out.find ?? out.oldText;
853
+ if (!Object.prototype.hasOwnProperty.call(out, 'substituir')) out.substituir = out.replace ?? out.replacement ?? out.newText;
854
+ }
849
855
  return out;
850
856
  }
851
857
  function mutationBatchConflicts(toolCalls, cwd) {
package/lib/tools.js CHANGED
@@ -802,6 +802,9 @@ async function execute(name, input, opts = {}) {
802
802
  if (!input.caminho || !String(input.caminho).trim() || String(input.caminho).trim() === '.') {
803
803
  return { erro: 'Informe o caminho completo do ARQUIVO em caminho (ex.: docs/relatorio.md). O diretório de trabalho sozinho não é um arquivo.' };
804
804
  }
805
+ if (!Object.prototype.hasOwnProperty.call(input, 'conteudo')) {
806
+ return { erro: 'Informe o conteúdo do arquivo em conteudo. A escrita foi recusada para não apagar o arquivo com conteúdo ausente.' };
807
+ }
805
808
  let p = _abs(input.caminho, baseDir);
806
809
  { const g = _guardTsHome(p); if (g) return { erro: g }; }
807
810
  // Confinamento (missões): modelos fracos inventam pastas absolutas
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-smart-cli",
3
- "version": "0.97.59",
3
+ "version": "0.97.62",
4
4
  "description": "Terminal Smart no seu terminal — pergunte, analise logs por pipe e orquestre agentes de IA. Comando: ts",
5
5
  "bin": {
6
6
  "ts": "bin/ts.js"