@cccarv82/freya 2.16.0 → 2.17.1

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.
@@ -90,12 +90,10 @@ async function autoUpdate(workspaceDir) {
90
90
  return { updated: false, version: installedVersion };
91
91
  }
92
92
 
93
- // Workspace doesn't look like a Freya workspace (no scripts/ dir)
94
- const scriptsDir = path.join(workspaceDir, 'scripts');
93
+ // If workspace dir doesn't exist at all, skip (will be handled by auto-init in cmdWeb)
95
94
  try {
96
- fs.accessSync(scriptsDir);
95
+ fs.accessSync(workspaceDir);
97
96
  } catch {
98
- // Not a workspace, skip
99
97
  return { updated: false, version: installedVersion };
100
98
  }
101
99
 
package/cli/init.js CHANGED
@@ -64,9 +64,9 @@ function copyDirRecursive(srcDir, destDir, force, summary, options = {}) {
64
64
  continue;
65
65
  }
66
66
 
67
- // Always force-update scripts (app code, not user data)
68
- const isScriptsDir = ent.name === 'scripts';
69
- copyDirRecursive(src, dest, force || isScriptsDir, summary, options);
67
+ // Always force-update app code directories (scripts, .agent) — not user data
68
+ const isAppCode = ent.name === 'scripts' || ent.name === '.agent';
69
+ copyDirRecursive(src, dest, force || isAppCode, summary, options);
70
70
  continue;
71
71
  }
72
72
 
@@ -85,8 +85,7 @@ function ensurePackageJson(targetDir, force, summary) {
85
85
  const scriptsToEnsure = {
86
86
  health: 'node scripts/validate-data.js && node scripts/validate-structure.js',
87
87
  migrate: 'node scripts/migrate-data.js',
88
- report: 'node scripts/generate-weekly-report.js',
89
- 'sm-weekly': 'node scripts/generate-sm-weekly-report.js',
88
+ 'sm-weekly': 'node scripts/generate-sm-weekly-report.js',
90
89
  daily: 'node scripts/generate-daily-summary.js',
91
90
  status: 'node scripts/generate-executive-report.js',
92
91
  blockers: 'node scripts/generate-blockers-report.js'
package/cli/web-ui.js CHANGED
@@ -1283,83 +1283,6 @@
1283
1283
  }
1284
1284
  }
1285
1285
 
1286
- async function refreshIncidents() {
1287
- try {
1288
- const r = await api('/api/incidents', { dir: dirOrDefault() });
1289
- const el = $('incidentsBox');
1290
- if (el) {
1291
- const md = r.markdown || '';
1292
- if (!md) { el.innerHTML = '<div class="help">Nenhum incidente registrado.</div>'; return; }
1293
- const lines = md.split(/\n/);
1294
- const cards = [];
1295
- let current = null;
1296
- for (const line of lines) {
1297
- if (line.startsWith('- **')) {
1298
- if (current) cards.push(current);
1299
- current = { title: line.replace('- **', '').replace('**', '').trim(), body: [] };
1300
- } else if (current && line.trim().startsWith('- ')) {
1301
- current.body.push(line.trim().replace(/^- /, ''));
1302
- }
1303
- }
1304
- if (current) cards.push(current);
1305
- el.innerHTML = '';
1306
- if (!cards.length) { el.innerHTML = renderMarkdown(md); return; }
1307
- for (let idx = 0; idx < cards.length; idx++) {
1308
- const c = cards[idx];
1309
- const card = document.createElement('div');
1310
- card.className = 'reportCard';
1311
- const dateLine = c.body.find((b) => b.toLowerCase().includes('data'));
1312
- const impactLine = c.body.find((b) => b.toLowerCase().includes('descricao') || b.toLowerCase().includes('impacto'));
1313
- const statusLine = c.body.find((b) => /^status\s*:/i.test(b));
1314
- const statusRaw = statusLine ? statusLine.split(':').slice(1).join(':').trim().toLowerCase() : '';
1315
- let statusKey = '';
1316
- if (['open', 'aberto', 'aberta'].includes(statusRaw)) statusKey = 'open';
1317
- else if (['mitigating', 'mitigando', 'mitigacao', 'mitigação'].includes(statusRaw)) statusKey = 'mitigating';
1318
- else if (['resolved', 'resolvido', 'resolvida', 'closed', 'fechado', 'fechada'].includes(statusRaw)) statusKey = 'resolved';
1319
-
1320
- card.innerHTML = '<div class="reportTitle">' + escapeHtml(c.title) + '</div>'
1321
- + (dateLine ? ('<div class="reportMeta">' + escapeHtml(dateLine) + '</div>') : '')
1322
- + (impactLine ? ('<div class="help" style="margin-top:4px">' + escapeHtml(impactLine) + '</div>') : '')
1323
- + c.body.filter((b) => b !== dateLine && b !== impactLine && b !== statusLine).map((b) => '<div class="help" style="margin-top:4px">' + escapeHtml(b) + '</div>').join('');
1324
-
1325
- if (statusKey) {
1326
- const actions = document.createElement('div');
1327
- actions.className = 'reportActions';
1328
- actions.style.display = 'flex';
1329
- actions.style.gap = '8px';
1330
- actions.style.marginTop = '8px';
1331
- actions.style.flexWrap = 'wrap';
1332
-
1333
- const label = statusKey === 'open' ? 'aberto' : (statusKey === 'mitigating' ? 'mitigando' : 'resolvido');
1334
- const pillClass = statusKey === 'resolved' ? 'ok' : (statusKey === 'mitigating' ? 'info' : 'warn');
1335
- const pill = document.createElement('span');
1336
- pill.className = 'pill ' + pillClass;
1337
- pill.textContent = label;
1338
- actions.appendChild(pill);
1339
-
1340
- if (statusKey !== 'resolved') {
1341
- const btn = document.createElement('button');
1342
- btn.className = 'btn small';
1343
- btn.type = 'button';
1344
- btn.textContent = 'Marcar resolvido';
1345
- btn.onclick = async () => {
1346
- await api('/api/incidents/resolve', { dir: dirOrDefault(), title: c.title, index: idx });
1347
- await refreshIncidents();
1348
- };
1349
- actions.appendChild(btn);
1350
- }
1351
-
1352
- card.appendChild(actions);
1353
- }
1354
-
1355
- el.appendChild(card);
1356
- }
1357
- }
1358
- } catch {
1359
- const el = $('incidentsBox');
1360
- if (el) el.textContent = 'Falha ao carregar incidentes.';
1361
- }
1362
- }
1363
1286
 
1364
1287
  function setHeatmapSort(sort) {
1365
1288
  state.heatmapSort = sort;
@@ -1900,7 +1823,7 @@
1900
1823
  if (!el) return;
1901
1824
  const anomalies = (r && r.anomalies) ? r.anomalies : {};
1902
1825
  const tasksMissing = anomalies.tasksMissingProject || { count: 0, samples: [] };
1903
- const statusMissing = anomalies.statusMissingHistory || { count: 0, samples: [] };
1826
+ const statusMissing = anomalies.projectsMissingHistory || anomalies.statusMissingHistory || { count: 0, samples: [] };
1904
1827
 
1905
1828
  const rows = [];
1906
1829
  const pushRow = (label, data) => {
@@ -2686,7 +2609,6 @@
2686
2609
  window.refreshProjects = refreshProjects;
2687
2610
  window.refreshTimeline = refreshTimeline;
2688
2611
  window.refreshGraph = refreshGraph;
2689
- window.refreshIncidents = refreshIncidents;
2690
2612
  window.refreshHeatmap = refreshHeatmap;
2691
2613
  window.setHeatmapSort = setHeatmapSort;
2692
2614
  window.setTimelineKind = setTimelineKind;