@cccarv82/freya 2.7.0 → 2.8.2

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.
@@ -4,7 +4,12 @@ const path = require('path');
4
4
  const { safeReadJson, quarantineCorruptedFile } = require('./lib/fs-utils');
5
5
  const SCHEMA = require('./lib/schema');
6
6
 
7
- const DATA_DIR = path.join(__dirname, '../data');
7
+ // BUG-30: use FREYA_WORKSPACE_DIR so the web server uses the correct workspace
8
+ const WORKSPACE_DIR = process.env.FREYA_WORKSPACE_DIR
9
+ ? path.resolve(process.env.FREYA_WORKSPACE_DIR)
10
+ : path.join(__dirname, '..'); // fallback: scripts/ is one level below workspace root
11
+
12
+ const DATA_DIR = path.join(WORKSPACE_DIR, 'data');
8
13
 
9
14
  // --- Validation Helpers ---
10
15
 
@@ -140,10 +145,10 @@ function walk(dir, fileList = []) {
140
145
  }
141
146
 
142
147
  function validateData() {
143
- console.log('🔍 Starting validation...');
148
+ console.log('Starting validation...');
144
149
  try {
145
150
  if (!fs.existsSync(DATA_DIR)) {
146
- console.error('Data directory not found:', DATA_DIR);
151
+ console.error('Data directory not found:', DATA_DIR);
147
152
  process.exit(1);
148
153
  }
149
154
 
@@ -158,9 +163,9 @@ function validateData() {
158
163
  if (!result.ok) {
159
164
  if (result.error.type === 'parse') {
160
165
  quarantineCorruptedFile(file, result.error.message);
161
- console.warn(`⚠️ [${relativePath}] JSON parse failed; quarantined to _corrupted.`);
166
+ console.warn(`[${relativePath}] JSON parse failed; quarantined to _corrupted.`);
162
167
  } else {
163
- console.error(`❌ [${relativePath}] Read failed: ${result.error.message}`);
168
+ console.error(`[${relativePath}] Read failed: ${result.error.message}`);
164
169
  }
165
170
  errorCount++;
166
171
  return;
@@ -173,29 +178,32 @@ function validateData() {
173
178
  // Route validation based on filename/path
174
179
  if (file.endsWith('career-log.json')) {
175
180
  fileErrors = validateCareerLog(json, relativePath);
176
- } else if (file.endsWith('task-log.json') || file.endsWith('status.json') || file.endsWith('blocker-log.json')) {
177
- // Obsoleted by SQLite, ignore
181
+ } else if (file.endsWith('task-log.json') || file.endsWith('blocker-log.json')) {
182
+ // BUG-06: These are legacy JSON files superseded by SQLite storage.
183
+ // They are no longer the source of truth; validation is skipped to avoid
184
+ // false positives on empty/stub files left behind after migration.
185
+ console.log(`[${relativePath}] Legacy file (superseded by SQLite). Skipping schema validation.`);
178
186
  } else {
179
187
  // Optional: warn about unknown files, or ignore
180
- // console.warn(`⚠️ [${relativePath}] Unknown JSON file type. Skipping schema validation.`);
188
+ // console.warn(`[${relativePath}] Unknown JSON file type. Skipping schema validation.`);
181
189
  }
182
190
 
183
191
  if (fileErrors.length > 0) {
184
- console.error(`❌ [${relativePath}] Validation failed:`);
192
+ console.error(`[${relativePath}] Validation failed:`);
185
193
  fileErrors.forEach(e => console.error(` - ${e}`));
186
194
  errorCount++;
187
195
  }
188
196
  });
189
197
 
190
198
  if (errorCount === 0) {
191
- console.log('All systems operational');
199
+ console.log('All systems operational');
192
200
  } else {
193
- console.error(`❌ Validation completed with errors in ${errorCount} file(s).`);
201
+ console.error(`Validation completed with errors in ${errorCount} file(s).`);
194
202
  process.exit(1);
195
203
  }
196
204
 
197
205
  } catch (err) {
198
- console.error('Fatal error:', err);
206
+ console.error('Fatal error:', err);
199
207
  process.exit(1);
200
208
  }
201
209
  }