terminal-smart-cli 0.97.48 → 0.97.49

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/bin/ts.js +15 -6
  2. package/package.json +1 -1
package/bin/ts.js CHANGED
@@ -2535,6 +2535,7 @@ async function verificarCmd(args) {
2535
2535
 
2536
2536
  // 1) arquivo de critérios (JSON: array ou {criteria:[...]}) OU 2) critérios inline via flags
2537
2537
  let criteria = [];
2538
+ if (rawArgs.includes('--qualidade') || rawArgs.includes('--quality')) criteria.push({ type:'project_text_quality', label:en ? 'text files preserve UTF-8' : 'textos e HTML preservam UTF-8' });
2538
2539
  const file = (args || []).find(a => !a.startsWith('-') && /\.json$/i.test(a));
2539
2540
  if (file) {
2540
2541
  try { const j = JSON.parse(_fs.readFileSync(file, 'utf8')); criteria = Array.isArray(j) ? j : (j.criteria || []); }
@@ -2547,12 +2548,7 @@ async function verificarCmd(args) {
2547
2548
  const url = _val(['--url']); if (url) criteria.push({ type: 'http', url, status: Number(_val(['--status'])) || 200, ...(cont != null && !arq ? { contains: cont } : {}) });
2548
2549
  const porta = _val(['--porta', '--port']); if (porta) criteria.push({ type: 'port', port: Number(porta) });
2549
2550
  }
2550
- if (!criteria.length) {
2551
- console.log(ui.infoLine(en
2552
- ? 'usage: ts verificar criterios.json OR ts verificar --cmd "npm test" --url http://localhost:3000/health --status 200 --porta 3000 --existe dist/app.js'
2553
- : 'uso: ts verificar criterios.json OU ts verificar --cmd "npm test" --url http://localhost:3000/health --status 200 --porta 3000 --existe dist/app.js'));
2554
- return;
2555
- }
2551
+ if (!criteria.length) criteria=verify.deriveFromStack(cwd);
2556
2552
 
2557
2553
  if (!JSON_OUT) console.log('\n' + C.dim(en ? 'proving completion — ' : 'provando conclusão — ') + criteria.length + (en ? ' criterion(s)…' : ' critério(s)…'));
2558
2554
  // remoteExec: liga o verificador ldd remoto à conexão SSH ativa (binário PW mora na VPS).
@@ -3069,6 +3065,17 @@ async function cloudCmd(args) {
3069
3065
  const sub = String(args[0] || 'status').toLowerCase();
3070
3066
  const rest = args.slice(1).filter(a => !a.startsWith('-'));
3071
3067
  const call = (path, opts = {}) => api('/api/cloud/' + path, { token, ...opts });
3068
+ const mutatesWebText = cmd => /(?:>|>>|\btee\b|\bsed\b|\bperl\b|\bcp\b|\bmv\b|\bbase64\b)[\s\S]{0,500}(?:\.html?|\.css|\.jsx?|\.tsx?|\.json|\.md|\/workspace)/i.test(String(cmd || ''))
3069
+ || /(?:\.html?|\.css|\.jsx?|\.tsx?|\.json|\.md|\/workspace)[\s\S]{0,500}(?:>|>>|\btee\b|\bsed\b|\bperl\b|\bcp\b|\bmv\b|\bbase64\b)/i.test(String(cmd || ''));
3070
+ const verifyCloudText = async cmd => {
3071
+ if (!mutatesWebText(cmd)) return true;
3072
+ const check=await call('exec',{method:'POST',body:{confirmed:true,cmd:'cd /workspace && ts verificar --qualidade --json'},timeoutMs:120000});
3073
+ if (check.ok) return true;
3074
+ const evidence=String(check.out || check.error || '').replace(/\s+/g,' ').slice(0,500);
3075
+ console.log(ui.errLine((en ? 'Cloud quality gate failed: ' : 'Gate de qualidade da Cloud Box falhou: ') + evidence));
3076
+ process.exitCode=1;
3077
+ return false;
3078
+ };
3072
3079
  const cloudSlug = require('../lib/cloud-slug');
3073
3080
  const chooseSlug = async (provided) => {
3074
3081
  let value = String(provided || '').trim();
@@ -3154,12 +3161,14 @@ async function cloudCmd(args) {
3154
3161
  if (process.stdout.isTTY) {
3155
3162
  try {
3156
3163
  await sse('/api/cloud/exec-stream', { token, body: { confirmed: true, cmd, timeoutMs: 300000 }, timeoutMs: 310000, onEvent: (e) => { if (e.chunk) process.stdout.write(e.chunk); } });
3164
+ await verifyCloudText(cmd);
3157
3165
  return;
3158
3166
  } catch (e) { if (e.code === 'auth') { console.log(ui.errLine(T.need_login)); return; } }
3159
3167
  }
3160
3168
  const r = await call('exec', { method: 'POST', body: { confirmed: true, cmd }, timeoutMs: 300000 });
3161
3169
  if (r.out) process.stdout.write(r.out);
3162
3170
  if (!r.ok && r.error) console.log(ui.errLine(r.error));
3171
+ if (r.ok) await verifyCloudText(cmd);
3163
3172
  return;
3164
3173
  }
3165
3174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-smart-cli",
3
- "version": "0.97.48",
3
+ "version": "0.97.49",
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"