terminal-smart-cli 0.97.16 → 0.97.18
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/lib/meta.js +20 -7
- package/package.json +1 -1
package/lib/meta.js
CHANGED
|
@@ -45,18 +45,20 @@ function toolsForMetaItem(item, goal) {
|
|
|
45
45
|
|
|
46
46
|
// Connect each checklist item to a concrete artifact. Planner criteria have
|
|
47
47
|
// priority; deterministic fallbacks cover later items that exceed the criteria cap.
|
|
48
|
-
function artifactForMetaItem(item, st) {
|
|
49
|
-
const list = Array.isArray(st && st.checklist) ? st.checklist : [];
|
|
50
|
-
const index = Math.max(0, list.indexOf(item));
|
|
51
|
-
const criterion = Array.isArray(st && st.criteria) ? st.criteria[index] : null;
|
|
52
|
-
if (criterion && ['file_exists', 'file_contains'].includes(criterion.type) && criterion.path) return String(criterion.path);
|
|
48
|
+
function artifactForMetaItem(item, st, dir = '') {
|
|
53
49
|
const d = String(item && item.desc || '').toLowerCase();
|
|
50
|
+
const criteria = Array.isArray(st && st.criteria) ? st.criteria : [];
|
|
51
|
+
const namedCriterion = criteria.find(c => c && c.path && d.includes(path.basename(String(c.path)).toLowerCase()));
|
|
52
|
+
if (namedCriterion) return String(namedCriterion.path);
|
|
54
53
|
if (/controller.*8 dire|8 dire.*controller/.test(d)) return 'src/player_controller.gd';
|
|
55
54
|
if (/combate b[aá]sico|sistema de combate/.test(d)) return 'src/combat_system.gd';
|
|
56
55
|
if (/interface|\bui\b|\bhud\b/.test(d)) return 'docs/UI_SPEC.md';
|
|
57
56
|
if (/80-100 monstros|lista.*monstros/.test(d)) return 'data/monsters.json';
|
|
58
57
|
if (/economia|zeny|vending/.test(d)) return 'docs/ECONOMY.md';
|
|
59
58
|
if (/prioriza|\bmvp\b.*alpha|roadmap/.test(d)) return 'docs/ROADMAP.md';
|
|
59
|
+
// Em projeto web de arquivo único, itens funcionais/visuais alteram o app real.
|
|
60
|
+
// Critérios globais não correspondem por posição aos itens do checklist.
|
|
61
|
+
if (dir && fs.existsSync(path.join(dir, 'index.html')) && !/readme|instru[çc][õo]es|documenta[çc][ãa]o/.test(d)) return 'index.html';
|
|
60
62
|
return `artifacts/${String(item && item.id || 'item').replace(/[^a-z0-9_-]/gi, '_')}.md`;
|
|
61
63
|
}
|
|
62
64
|
|
|
@@ -119,6 +121,12 @@ function directArtifactPlan(item) {
|
|
|
119
121
|
};
|
|
120
122
|
return null;
|
|
121
123
|
}
|
|
124
|
+
|
|
125
|
+
function canGenerateDirectArtifact(item, target) {
|
|
126
|
+
if (!item || !item.directArtifact) return false;
|
|
127
|
+
if (directArtifactPlan(item)) return true;
|
|
128
|
+
return !target || !fs.existsSync(target);
|
|
129
|
+
}
|
|
122
130
|
const WEB_CANVAS_MOVE_MIN = 0.02; // check de MOVIMENTO do canvas web (jogo/cena 3D): diferença MÍNIMA
|
|
123
131
|
// entre 2 quadros pra a cena contar como VIVA. Abaixo disso = parada/congelada (T-pose, mixer parado,
|
|
124
132
|
// loop sem avançar o tempo). SÓ se aplica a canvas de JOGO/3D — dashboard/gráfico pode ficar estático.
|
|
@@ -1366,7 +1374,7 @@ async function run(goal, opts = {}) {
|
|
|
1366
1374
|
}
|
|
1367
1375
|
|
|
1368
1376
|
const item = pend[0];
|
|
1369
|
-
const expectedArtifact = artifactForMetaItem(item, st);
|
|
1377
|
+
const expectedArtifact = artifactForMetaItem(item, st, dir);
|
|
1370
1378
|
// A process can be interrupted after a read-only round but before the
|
|
1371
1379
|
// no-artifact branch persists `directArtifact`. Recover that evidence on
|
|
1372
1380
|
// resume instead of repeating the same exploratory attempt.
|
|
@@ -1391,6 +1399,11 @@ async function run(goal, opts = {}) {
|
|
|
1391
1399
|
// Some providers can generate a large document but refuse to place that
|
|
1392
1400
|
// content inside tool-call arguments. After a proven zero-tool response,
|
|
1393
1401
|
// generate content-only, validate it and let the confined harness persist it.
|
|
1402
|
+
if (item.directArtifact && !canGenerateDirectArtifact(item, expectedOnDisk)) {
|
|
1403
|
+
item.directArtifact = false;
|
|
1404
|
+
delete item.directModel;
|
|
1405
|
+
save(st, dir);
|
|
1406
|
+
}
|
|
1394
1407
|
if (item.directArtifact) {
|
|
1395
1408
|
const directModel = item.directModel || 'glm-5.2';
|
|
1396
1409
|
const plan = directArtifactPlan(item);
|
|
@@ -1760,4 +1773,4 @@ function trailSummary(st, lang) {
|
|
|
1760
1773
|
};
|
|
1761
1774
|
}
|
|
1762
1775
|
|
|
1763
|
-
module.exports = { webRunGate, run, load, notify, stateFile, detectBuild, ensureToolchain, runBuild, escalate, designPhase, archPhase, looksVisual, looksComplex, runApp, visualGate, ensureEmulator, _projKind, _llmVision, toolsForMetaItem, artifactForMetaItem, normalizeMetaArtifact, persistMetaArtifact, directArtifactPlan, verificationLabel, _checkCriteria, trailSummary };
|
|
1776
|
+
module.exports = { webRunGate, run, load, notify, stateFile, detectBuild, ensureToolchain, runBuild, escalate, designPhase, archPhase, looksVisual, looksComplex, runApp, visualGate, ensureEmulator, _projKind, _llmVision, toolsForMetaItem, artifactForMetaItem, normalizeMetaArtifact, persistMetaArtifact, directArtifactPlan, canGenerateDirectArtifact, verificationLabel, _checkCriteria, trailSummary };
|