@cccarv82/freya 2.5.4 → 2.5.6

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 (3) hide show
  1. package/cli/web-ui.js +80 -13
  2. package/cli/web.js +27 -37
  3. package/package.json +1 -1
package/cli/web-ui.js CHANGED
@@ -1905,11 +1905,13 @@
1905
1905
  }
1906
1906
  }
1907
1907
 
1908
+ state.slugRules = []; // Store the active project rules
1909
+
1908
1910
  async function reloadSlugRules() {
1909
1911
  try {
1910
1912
  const r = await api('/api/project-slug-map/get', { dir: dirOrDefault() });
1911
- const el = $('slugRules');
1912
- if (el) el.value = JSON.stringify(r.map || { rules: [] }, null, 2);
1913
+ state.slugRules = (r.map && Array.isArray(r.map.rules)) ? r.map.rules : [];
1914
+ renderSlugRules();
1913
1915
  setPill('ok', 'rules loaded');
1914
1916
  setTimeout(() => setPill('ok', 'pronto'), 800);
1915
1917
  } catch (e) {
@@ -1918,18 +1920,82 @@
1918
1920
  }
1919
1921
  }
1920
1922
 
1923
+ function renderSlugRules() {
1924
+ const container = $('slugListContainer');
1925
+ if (!container) return;
1926
+
1927
+ if (state.slugRules.length === 0) {
1928
+ container.innerHTML = '<div class="help" style="margin-bottom: 10px;">Nenhuma regra cadastrada no momento.</div>';
1929
+ return;
1930
+ }
1931
+
1932
+ let html = '<div style="display:flex; flex-direction:column; gap:8px; margin-bottom: 16px;">';
1933
+ state.slugRules.forEach((rule, index) => {
1934
+ html += `
1935
+ <div style="display:flex; align-items:center; justify-content:space-between; background: var(--bg2); padding: 10px 14px; border-radius: 6px; border: 1px solid var(--border);">
1936
+ <div style="display:flex; gap: 12px; align-items:center; flex-wrap: wrap;">
1937
+ <span style="font-size: 13px;"><span style="color:var(--text-muted); font-size:12px;">Se o texto contiver a palavra:</span> <b style="color: var(--primary);">${escapeHtml(rule.contains)}</b></span>
1938
+ <span style="color:var(--text-muted)">→</span>
1939
+ <span style="font-size: 13px;"><span style="color:var(--text-muted); font-size:12px;">Atribuir ao projeto:</span> <code class="md-inline">${escapeHtml(rule.slug)}</code></span>
1940
+ </div>
1941
+ <button class="btn small" type="button" onclick="window.removeSlugRule(${index})" title="Remover regra">Excluir</button>
1942
+ </div>
1943
+ `;
1944
+ });
1945
+ html += '</div>';
1946
+ container.innerHTML = html;
1947
+ }
1948
+
1949
+ function addSlugRule() {
1950
+ const kw = $('newSlugKeyword');
1951
+ const tg = $('newSlugTarget');
1952
+ if (!kw || !tg) return;
1953
+ const contains = kw.value.trim().toLowerCase();
1954
+ const slug = tg.value.trim().toLowerCase();
1955
+
1956
+ if (!contains || !slug) {
1957
+ setPill('err', 'Preencha ambos os campos');
1958
+ setTimeout(() => setPill('ok', 'pronto'), 1500);
1959
+ return;
1960
+ }
1961
+
1962
+ // Check for duplicates
1963
+ if (state.slugRules.some(r => r.contains === contains)) {
1964
+ setPill('err', 'Palavra-chave já existe');
1965
+ setTimeout(() => setPill('ok', 'pronto'), 1500);
1966
+ return;
1967
+ }
1968
+
1969
+ state.slugRules.push({ contains, slug });
1970
+ kw.value = '';
1971
+ tg.value = '';
1972
+ renderSlugRules();
1973
+
1974
+ // Auto-save when adding
1975
+ saveSlugRules();
1976
+ }
1977
+
1978
+ function removeSlugRule(index) {
1979
+ if (index >= 0 && index < state.slugRules.length) {
1980
+ state.slugRules.splice(index, 1);
1981
+ renderSlugRules();
1982
+ // Auto-save when removing
1983
+ saveSlugRules();
1984
+ }
1985
+ }
1986
+
1921
1987
  async function saveSlugRules() {
1922
1988
  try {
1923
- const el = $('slugRules');
1924
- if (!el) return;
1925
- const raw = String(el.value || '').trim();
1926
- if (!raw) throw new Error('Rules JSON is empty');
1927
- let map;
1928
- try { map = JSON.parse(raw); } catch (e) { throw new Error('Invalid JSON: ' + (e.message || e)); }
1929
-
1930
1989
  setPill('run', 'saving rules…');
1990
+ const map = { rules: state.slugRules };
1931
1991
  const r = await api('/api/project-slug-map/save', { dir: dirOrDefault(), map });
1932
- if (el) el.value = JSON.stringify(r.map || map, null, 2);
1992
+
1993
+ // Update state with confirmed save
1994
+ if (r.map && Array.isArray(r.map.rules)) {
1995
+ state.slugRules = r.map.rules;
1996
+ renderSlugRules();
1997
+ }
1998
+
1933
1999
  setPill('ok', 'rules saved');
1934
2000
  setTimeout(() => setPill('ok', 'pronto'), 800);
1935
2001
  } catch (e) {
@@ -2046,7 +2112,7 @@
2046
2112
  setPill('run', 'applying…');
2047
2113
  await applyPlan();
2048
2114
  const a = state.lastApplied || {};
2049
- setPill('ok', `applied (${a.tasks || 0}t, ${a.blockers || 0}b)`);
2115
+ setPill('ok', `applied(${a.tasks || 0}t, ${a.blockers || 0}b)`);
2050
2116
  if (state.autoRunReports) {
2051
2117
  await runSuggestedReports();
2052
2118
  }
@@ -2082,7 +2148,7 @@
2082
2148
  let out = '## Ran suggested reports\n\n';
2083
2149
  for (const name of uniq) {
2084
2150
  const r = await api('/api/report', { dir: dirOrDefault(), script: name === 'status' ? 'status' : name });
2085
- out += `### ${name}\n` + (r.reportPath ? `- file: ${r.reportPath}\n` : '') + '\n';
2151
+ out += `### ${name} \n` + (r.reportPath ? ` - file: ${r.reportPath} \n` : '') + '\n';
2086
2152
  }
2087
2153
 
2088
2154
  setOut(out);
@@ -2233,11 +2299,12 @@
2233
2299
  window.pickDir = pickDir;
2234
2300
  window.runReport = runReport;
2235
2301
  window.publish = publish;
2236
- window.saveSettings = saveSettings;
2237
2302
  window.refreshReports = refreshReports;
2238
2303
  window.refreshToday = refreshToday;
2239
2304
  window.reloadSlugRules = reloadSlugRules;
2240
2305
  window.saveSlugRules = saveSlugRules;
2306
+ window.addSlugRule = addSlugRule;
2307
+ window.removeSlugRule = removeSlugRule;
2241
2308
  window.exportObsidian = exportObsidian;
2242
2309
  window.rebuildIndex = rebuildIndex;
2243
2310
  window.renderReportsList = renderReportsList;
package/cli/web.js CHANGED
@@ -1016,9 +1016,7 @@ function buildDocsHtml(safeDefault, appVersion) {
1016
1016
  <button class="railBtn" id="railGraph" type="button" title="Grafo">
1017
1017
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
1018
1018
  </button>
1019
- <button class="railBtn active" id="railDocs" type="button" title="Documentação">
1020
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
1021
- </button>
1019
+
1022
1020
  </div>
1023
1021
  <div class="railBottom">
1024
1022
  <button id="railSettings" class="railBtn" title="Configurações" onclick="if (document.body.dataset.page !== 'settings') window.location.href='/settings';">
@@ -1157,9 +1155,7 @@ function buildHtml(safeDefault, appVersion) {
1157
1155
  <button class="railBtn" id="railGraph" type="button" title="Grafo">
1158
1156
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
1159
1157
  </button>
1160
- <button class="railBtn" id="railDocs" type="button" title="Documentação">
1161
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
1162
- </button>
1158
+
1163
1159
  </div>
1164
1160
  <div class="railBottom">\n <button id="railSettings" class="railBtn" title="Configurações" onclick="if (document.body.dataset.page !== \'settings\') window.location.href=\'/settings\';"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg></button>
1165
1161
 
@@ -1361,9 +1357,7 @@ function buildReportsHtml(safeDefault, appVersion) {
1361
1357
  <button class="railBtn" id="railGraph" type="button" title="Grafo">
1362
1358
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
1363
1359
  </button>
1364
- <button class="railBtn" id="railDocs" type="button" title="Documentação">
1365
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
1366
- </button>
1360
+
1367
1361
  </div>
1368
1362
  <div class="railBottom">\n <button id="railSettings" class="railBtn" title="Configurações">\n <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>\n </button>
1369
1363
 
@@ -1461,9 +1455,7 @@ function buildProjectsHtml(safeDefault, appVersion) {
1461
1455
  <button class="railBtn" id="railGraph" type="button" title="Grafo">
1462
1456
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
1463
1457
  </button>
1464
- <button class="railBtn" id="railDocs" type="button" title="Documentação">
1465
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
1466
- </button>
1458
+
1467
1459
  </div>
1468
1460
  <div class="railBottom">\n <button id="railSettings" class="railBtn" title="Configurações" onclick="if (document.body.dataset.page !== 'settings') window.location.href='/settings';"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg></button>\n
1469
1461
  </div>
@@ -1556,9 +1548,7 @@ function buildTimelineHtml(safeDefault, appVersion) {
1556
1548
  <button class=\"railBtn\" id=\"railGraph\" type=\"button\" title=\"Grafo\">
1557
1549
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
1558
1550
  </button>
1559
- <button class="railBtn" id="railDocs" type="button" title="Documentação">
1560
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
1561
- </button>
1551
+
1562
1552
  </div>
1563
1553
  <div class=\"railBottom\">
1564
1554
  <div class=\"railStatus\" id=\"railStatus\" title=\"status\"></div>
@@ -1667,9 +1657,7 @@ function buildGraphHtml(safeDefault, appVersion) {
1667
1657
  <button class="railBtn active" id="railGraph" type="button" title="Grafo">
1668
1658
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
1669
1659
  </button>
1670
- <button class="railBtn" id="railDocs" type="button" title="Documentação">
1671
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
1672
- </button>
1660
+
1673
1661
  </div>
1674
1662
  <div class="railBottom">\n <button id="railSettings" class="railBtn" title="Configurações" onclick="if (document.body.dataset.page !== 'settings') window.location.href='/settings';"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg></button>\n
1675
1663
  </div>
@@ -1760,9 +1748,7 @@ function buildCompanionHtml(safeDefault, appVersion) {
1760
1748
  <button class="railBtn" id="railGraph" type="button" title="Grafo">
1761
1749
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
1762
1750
  </button>
1763
- <button class="railBtn" id="railDocs" type="button" title="Documentação">
1764
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
1765
- </button>
1751
+
1766
1752
  </div>
1767
1753
  <div class="railBottom">\n <button id="railSettings" class="railBtn" title="Configurações" onclick="if (document.body.dataset.page !== 'settings') window.location.href='/settings';"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg></button>\n
1768
1754
  </div>
@@ -3936,9 +3922,7 @@ function buildSettingsHtml(safeDefault, appVersion) {
3936
3922
  <button class="railBtn" id="railGraph" type="button" title="Grafo">
3937
3923
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"></circle><circle cx="6" cy="12" r="3"></circle><circle cx="18" cy="19" r="3"></circle><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"></line><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"></line></svg>
3938
3924
  </button>
3939
- <button class="railBtn" id="railDocs" type="button" title="Documentação">
3940
- <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path><path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path></svg>
3941
- </button>
3925
+
3942
3926
  </div>
3943
3927
  <div class="railBottom">
3944
3928
  <button id="railSettings" class="railBtn active" title="Configurações">
@@ -4000,25 +3984,31 @@ function buildSettingsHtml(safeDefault, appVersion) {
4000
3984
 
4001
3985
  <div class="devGrid" style="grid-template-columns: 1fr;">
4002
3986
  <div class="panel">
4003
- <div class="panelHead"><b>Mapeamento Inteligente de Projetos (Slugs)</b></div>
3987
+ <div class="panelHead" style="display:flex; justify-content:space-between; align-items:center;">
3988
+ <b>Mapeamento Inteligente de Projetos (Slugs)</b>
3989
+ <span class="chip" style="font-weight:normal; font-size:11px;">Rules</span>
3990
+ </div>
4004
3991
  <div class="panelBody">
4005
3992
  <p style="margin-top: 0; color: #666; font-size: 13px;">
4006
- A FREYA tenta adivinhar automaticamente a qual projeto uma tarefa pertence.
4007
- Se você quiser **garantir** que uma palavra sempre caia em um projeto específico, adicione uma regra abaixo.
3993
+ A FREYA tenta adivinhar automaticamente a qual projeto uma tarefa pertence com base no LLM.
3994
+ Se você quiser <b>garantir</b> que uma palavra sempre caia em um projeto específico, adicione uma regra abaixo.
4008
3995
  </p>
4009
3996
 
4010
- <div style="background: var(--surface); padding: 12px; border-radius: 6px; font-size: 12px; font-family: monospace; color: #888; margin-bottom: 16px;">
4011
- <b>Exemplo de uso:</b><br>
4012
- Se o cliente é a "Vale" e o projeto é "Trato", e você quer que qualquer frase com a palavra "trato" para "vale/trato":<br>
4013
- <code>{ "contains": "trato", "slug": "vale/trato" }</code>
3997
+ <div class="slug-adder" style="display: flex; gap: 8px; margin-bottom: 24px; align-items: flex-end; background: var(--bg2); padding: 12px; border-radius: 8px; border: 1px solid var(--border);">
3998
+ <div style="flex: 1;">
3999
+ <label style="font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: block;">Palavra-chave (ex: fideliza)</label>
4000
+ <input type="text" id="newSlugKeyword" placeholder="Palavra a buscar..." style="width: 100%;" />
4001
+ </div>
4002
+ <div style="flex: 1;">
4003
+ <label style="font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: block;">Projeto Alvo (ex: vivo/fidelizacao)</label>
4004
+ <input type="text" id="newSlugTarget" placeholder="Slug do projeto..." style="width: 100%;" />
4005
+ </div>
4006
+ <button class="btn primary" type="button" onclick="window.addSlugRule()" style="height: 36px;">Adicionar Regra</button>
4014
4007
  </div>
4015
4008
 
4016
- <label>Regras de Inferência (Formato JSON)</label>
4017
- <textarea id="slugRules" rows="12" style="font-family: monospace; font-size: 13px;" placeholder='{\n "rules": [\n {\n "contains": "palavra-chave",\n "slug": "cliente/projeto"\n }\n ]\n}'></textarea>
4018
-
4019
- <div class="stack" style="margin-top:20px; flex-direction: row; justify-content: flex-end;">
4020
- <button class="btn" type="button" onclick="window.reloadSlugRules()">Restaurar</button>
4021
- <button class="btn primary" type="button" onclick="window.saveSlugRules()">Salvar Regras</button>
4009
+ <h3 style="font-size: 14px; margin-top: 24px; margin-bottom: 12px;">Regras Ativas</h3>
4010
+ <div id="slugListContainer">
4011
+ <div class="help">Carregando regras...</div>
4022
4012
  </div>
4023
4013
  </div>
4024
4014
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "2.5.4",
3
+ "version": "2.5.6",
4
4
  "description": "Personal AI Assistant with local-first persistence",
5
5
  "scripts": {
6
6
  "health": "node scripts/validate-data.js && node scripts/validate-structure.js",