@cccarv82/freya 1.0.10 → 1.0.11

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/cli/web.js CHANGED
@@ -185,8 +185,9 @@ async function pickDirectoryNative() {
185
185
  return null;
186
186
  }
187
187
 
188
- function html() {
188
+ function html(defaultDir) {
189
189
  // Aesthetic: “clean workstation” — light-first UI inspired by modern productivity apps.
190
+ const safeDefault = String(defaultDir || './freya').replace(/\\/g, '\\\\').replace(/"/g, '\\"');
190
191
  return `<!doctype html>
191
192
  <html>
192
193
  <head>
@@ -632,13 +633,6 @@ function html() {
632
633
  <div class="help">Dica: se você já tem uma workspace antiga, use <b>Update</b>. Por padrão, <b>data/</b> e <b>logs/</b> não são sobrescritos.</div>
633
634
  </div>
634
635
 
635
- <div class="sideBlock">
636
- <h3>Publish</h3>
637
- <button class="btn sideBtn" onclick="publish('discord')">Publish → Discord</button>
638
- <button class="btn sideBtn" onclick="publish('teams')">Publish → Teams</button>
639
- <div class="help">Configure os webhooks no painel principal. O publish envia o último relatório gerado.</div>
640
- </div>
641
-
642
636
  <div class="sideBlock">
643
637
  <h3>Atalhos</h3>
644
638
  <div class="help"><span class="k">--dev</span> cria dados de exemplo para testar rápido.</div>
@@ -695,13 +689,6 @@ function html() {
695
689
 
696
690
  <div style="height:12px"></div>
697
691
 
698
- <div class="stack">
699
- <button class="btn primary" onclick="doInit()">Init</button>
700
- <button class="btn" onclick="doUpdate()">Update</button>
701
- <button class="btn" onclick="doHealth()">Health</button>
702
- <button class="btn" onclick="doMigrate()">Migrate</button>
703
- </div>
704
-
705
692
  <div style="height:16px"></div>
706
693
 
707
694
  <label>Discord webhook URL</label>
@@ -743,6 +730,7 @@ function html() {
743
730
  </div>
744
731
 
745
732
  <script>
733
+ window.__FREYA_DEFAULT_DIR = "${safeDefault}";
746
734
  const $ = (id) => document.getElementById(id);
747
735
  const state = { lastReportPath: null, lastText: '' };
748
736
 
@@ -798,10 +786,12 @@ function html() {
798
786
  }
799
787
 
800
788
  function loadLocal() {
801
- $('dir').value = localStorage.getItem('freya.dir') || './freya';
789
+ $('dir').value = (window.__FREYA_DEFAULT_DIR && window.__FREYA_DEFAULT_DIR !== '__FREYA_DEFAULT_DIR__') ? window.__FREYA_DEFAULT_DIR : (localStorage.getItem('freya.dir') || './freya');
802
790
  $('discord').value = localStorage.getItem('freya.discord') || '';
803
791
  $('teams').value = localStorage.getItem('freya.teams') || '';
804
792
  $('sidePath').textContent = $('dir').value || './freya';
793
+ // Always persist the current run's default dir to avoid stale values
794
+ localStorage.setItem('freya.dir', $('dir').value || './freya');
805
795
  }
806
796
 
807
797
  async function api(p, body) {
@@ -1119,7 +1109,7 @@ async function cmdWeb({ port, dir, open, dev }) {
1119
1109
  if (!req.url) return safeJson(res, 404, { error: 'Not found' });
1120
1110
 
1121
1111
  if (req.method === 'GET' && req.url === '/') {
1122
- const body = html();
1112
+ const body = html(dir || './freya');
1123
1113
  res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store' });
1124
1114
  res.end(body);
1125
1115
  return;
@@ -1178,7 +1168,7 @@ async function cmdWeb({ port, dir, open, dev }) {
1178
1168
  blockers: 'blockers-',
1179
1169
  'sm-weekly': 'sm-weekly-',
1180
1170
  status: 'executive-',
1181
- daily: null
1171
+ daily: 'daily-'
1182
1172
  };
1183
1173
  const prefix = prefixMap[script] || null;
1184
1174
  const reportPath = prefix ? newestFile(reportsDir, prefix) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Personal AI Assistant with local-first persistence",
5
5
  "scripts": {
6
6
  "health": "node scripts/validate-data.js",
@@ -6,6 +6,7 @@ const { safeReadJson, quarantineCorruptedFile } = require('./lib/fs-utils');
6
6
 
7
7
  const TASK_LOG_PATH = path.join(__dirname, '../data/tasks/task-log.json');
8
8
  const BLOCKERS_LOG_PATH = path.join(__dirname, '../data/blockers/blocker-log.json');
9
+ const REPORT_DIR = path.join(__dirname, '../docs/reports');
9
10
 
10
11
  // --- Helper Logic ---
11
12
  const now = new Date();
@@ -88,6 +89,16 @@ function generateDailySummary() {
88
89
 
89
90
  console.log(summary);
90
91
 
92
+ // Write report file for UI (optional, but helps preview/history)
93
+ try {
94
+ fs.mkdirSync(REPORT_DIR, { recursive: true });
95
+ const date = new Date().toISOString().slice(0, 10);
96
+ const outPath = path.join(REPORT_DIR, `daily-${date}.md`);
97
+ fs.writeFileSync(outPath, `# Daily Summary — ${date}\n\n${summary}\n`, 'utf8');
98
+ } catch (e) {
99
+ // non-fatal
100
+ }
101
+
91
102
  } catch (err) {
92
103
  console.error("Error generating daily:", err.message);
93
104
  }
@@ -218,7 +218,7 @@ function generateReport(period) {
218
218
 
219
219
  // Save
220
220
  ensureDir(OUTPUT_DIR);
221
- const filename = `report-${period}-${dateStr}.md`;
221
+ const filename = `executive-${period}-${dateStr}.md`;
222
222
  const outputPath = path.join(OUTPUT_DIR, filename);
223
223
  fs.writeFileSync(outputPath, md, 'utf8');
224
224