terminal-smart-cli 0.97.27 → 0.97.29

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/lib/meta.js +27 -1
  2. package/package.json +1 -1
package/lib/meta.js CHANGED
@@ -51,13 +51,17 @@ function artifactForMetaItem(item, st, dir = '') {
51
51
  const criteria = Array.isArray(st && st.criteria) ? st.criteria : [];
52
52
  const namedCriterion = criteria.find(c => c && c.path && d.includes(path.basename(String(c.path)).toLowerCase()));
53
53
  if (namedCriterion) return String(namedCriterion.path);
54
+ const splitWebProject = dir && fs.existsSync(path.join(dir, 'index.html')) && fs.existsSync(path.join(dir, 'src', 'game.js'));
55
+ // In an existing browser game, UI/HUD requests are implementation work.
56
+ // The generic UI-spec fallback below is only for greenfield design projects.
57
+ if (splitWebProject && /\bhud\b|interface/.test(d) && fs.existsSync(path.join(dir, 'styles.css'))) return 'styles.css';
54
58
  if (/controller.*8 dire|8 dire.*controller/.test(d)) return 'src/player_controller.gd';
55
59
  if (/combate b[aá]sico|sistema de combate/.test(d)) return 'src/combat_system.gd';
56
60
  if (/interface|\bui\b|\bhud\b/.test(d)) return 'docs/UI_SPEC.md';
57
61
  if (/80-100 monstros|lista.*monstros/.test(d)) return 'data/monsters.json';
58
62
  if (/economia|zeny|vending/.test(d)) return 'docs/ECONOMY.md';
59
63
  if (/prioriza|\bmvp\b.*alpha|roadmap/.test(d)) return 'docs/ROADMAP.md';
60
- const splitWeb = dir && fs.existsSync(path.join(dir, 'index.html')) && fs.existsSync(path.join(dir, 'src', 'game.js'));
64
+ const splitWeb = splitWebProject;
61
65
  if (splitWeb) {
62
66
  if (/test|npm test|contrato|navegador/.test(d)) {
63
67
  if (fs.existsSync(path.join(dir, 'test', 'integration.test.js'))) return 'test/integration.test.js';
@@ -1163,6 +1167,16 @@ async function _checkCriteria(st, dir) {
1163
1167
  }
1164
1168
  }
1165
1169
 
1170
+ // Fast fail-closed gate used after every implementation round. File/content
1171
+ // criteria may belong to later checklist items, but command criteria (tests,
1172
+ // lint, typecheck) describe repository health and must stay green throughout.
1173
+ async function _checkRoundCommandCriteria(st, dir) {
1174
+ const criteria = (st.criteria || []).filter(c => c && c.type === 'command');
1175
+ if (!criteria.length) return { allOk: true, passed: 0, total: 0, results: [] };
1176
+ try { return await require('./verify').runAll(criteria, { cwd: dir }); }
1177
+ catch (e) { return { allOk: false, passed: 0, total: criteria.length, results: [], error: String(e && e.message || e) }; }
1178
+ }
1179
+
1166
1180
  async function run(goal, opts = {}) {
1167
1181
  const { token, lang = 'pt', yes = false, autoAll = false, budget = 400, maxRounds = 20, dir = process.cwd(), model = null, thinker = null, maxMinutes = 0, designer = null, design = 'auto', runGate = true, eye = null, visualLadder = true, prove = false } = opts;
1168
1182
  const onChecklist = opts.onChecklist || (() => {});
@@ -1689,6 +1703,18 @@ async function run(goal, opts = {}) {
1689
1703
  return st;
1690
1704
  }
1691
1705
 
1706
+ const roundCommandProof = await _checkRoundCommandCriteria(st, dir);
1707
+ if (!roundCommandProof.allOk) {
1708
+ item.attempts = Math.max(0, (item.attempts || 1) - 1);
1709
+ st.status = 'paused'; st.pause_reason = 'verification_failed';
1710
+ st.rounds.push({ item: item.desc, id: item.id,
1711
+ result: `Prova determinística falhou: ${roundCommandProof.passed}/${roundCommandProof.total} comandos passaram. O item permanece aberto para correção.`,
1712
+ credits: out.credits || 0, steps: out.steps || 0, at: new Date().toISOString() });
1713
+ save(st, dir);
1714
+ onAlert({ type: 'verification', text: `Os testes/comandos obrigatórios falharam (${roundCommandProof.passed}/${roundCommandProof.total}). Não marquei o item como concluído; a próxima janela deve corrigir a regressão.` });
1715
+ return st;
1716
+ }
1717
+
1692
1718
  // ── BLOQUEIO HUMANO: o agente pediu uma ação externa que só o usuário faz ──
1693
1719
  // A missão PAUSA (gasto zero enquanto espera) e chama o usuário. Retoma com "ts meta".
1694
1720
  if (out.needHuman) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terminal-smart-cli",
3
- "version": "0.97.27",
3
+ "version": "0.97.29",
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"