@cccarv82/freya 3.7.4 → 3.7.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.
package/cli/web.js CHANGED
@@ -970,8 +970,21 @@ function run(cmd, args, cwd, extraEnv, stdinData) {
970
970
  const env = extraEnv ? { ...process.env, ...extraEnv } : process.env;
971
971
 
972
972
  try {
973
- // Use shell: true on all platforms — ensures .cmd/.bat shims (npm globals) are found on Windows
974
- child = spawn(cmd, args, { cwd, shell: true, env, windowsHide: true });
973
+ if (process.platform === 'win32') {
974
+ // Use PowerShell fnm/nvm set PATH only in PowerShell profile,
975
+ // so cmd.exe (shell:true) can't find npm global .cmd shims like copilot.
976
+ // Do NOT use -NoProfile: the profile is what loads fnm/nvm PATH entries.
977
+ const escapedArgs = args.map(a => {
978
+ const escaped = String(a).replace(/'/g, "''");
979
+ return `'${escaped}'`;
980
+ });
981
+ const psCommand = `& '${cmd}' ${escapedArgs.join(' ')}`;
982
+ child = spawn('powershell.exe', [
983
+ '-NoLogo', '-Command', psCommand
984
+ ], { cwd, env, windowsHide: true });
985
+ } else {
986
+ child = spawn(cmd, args, { cwd, shell: true, env });
987
+ }
975
988
  } catch (e) {
976
989
  return resolve({ code: 1, stdout: '', stderr: e.message || String(e) });
977
990
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "3.7.4",
3
+ "version": "3.7.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",
@@ -21,7 +21,7 @@
21
21
  const fs = require('fs');
22
22
  const path = require('path');
23
23
  const crypto = require('crypto');
24
- const { spawn } = require('child_process');
24
+ const { spawn, execSync } = require('child_process');
25
25
  const os = require('os');
26
26
 
27
27
  // Parse args
@@ -58,10 +58,19 @@ function run(cmd, args, cwd, extraEnv) {
58
58
  const env = extraEnv ? { ...process.env, ...extraEnv } : process.env;
59
59
  try {
60
60
  if (process.platform === 'win32') {
61
- const comspec = process.env.ComSpec || 'cmd.exe';
62
- child = spawn(comspec, ['/d', '/s', '/c', cmd, ...args], { cwd, shell: false, env });
61
+ // Use PowerShell fnm/nvm set PATH only in PS profile,
62
+ // cmd.exe cannot find npm global .cmd shims like copilot.
63
+ // Do NOT use -NoProfile: profile is what loads fnm PATH entries.
64
+ const escapedArgs = args.map(a => {
65
+ const escaped = String(a).replace(/'/g, "''");
66
+ return `'${escaped}'`;
67
+ });
68
+ const psCommand = `& '${cmd}' ${escapedArgs.join(' ')}`;
69
+ child = spawn('powershell.exe', [
70
+ '-NoLogo', '-Command', psCommand
71
+ ], { cwd, env, windowsHide: true });
63
72
  } else {
64
- child = spawn(cmd, args, { cwd, shell: false, env });
73
+ child = spawn(cmd, args, { cwd, shell: true, env });
65
74
  }
66
75
  } catch (e) {
67
76
  return resolve({ code: 1, stdout: '', stderr: e.message || String(e) });
@@ -189,28 +198,35 @@ async function main() {
189
198
  // Step 3: Extract tasks/blockers from each daily log via planner
190
199
  console.log('── Step 3: Extracting tasks & blockers via planner ──');
191
200
 
192
- // Detect copilot command: try user override, then 'copilot', then 'gh copilot'
201
+ // Detect copilot command (now uses PowerShell on Windows, so fnm PATH works)
193
202
  let cmd = process.env.COPILOT_CMD || '';
203
+ let useGhCopilot = false;
194
204
  if (!cmd) {
195
- // Quick test: try 'copilot --version'
205
+ console.log(' ℹ Detecting copilot CLI...');
196
206
  const testCopilot = await run('copilot', ['--version'], workspaceDir);
197
207
  if (testCopilot.code === 0) {
198
208
  cmd = 'copilot';
209
+ console.log(` ✓ Found: ${(testCopilot.stdout || '').trim().split(/\r?\n/)[0]}`);
199
210
  } else {
200
- // Try 'gh copilot' via 'gh'
201
211
  const testGh = await run('gh', ['copilot', '--version'], workspaceDir);
202
212
  if (testGh.code === 0) {
203
213
  cmd = 'gh';
204
- console.log(' ℹ Using "gh copilot" as planner command');
214
+ useGhCopilot = true;
215
+ console.log(' ✓ Using gh copilot');
205
216
  } else {
206
- cmd = 'copilot'; // default, will fail with clear error
207
- console.log(' ⚠ Could not detect copilot CLI. Set COPILOT_CMD env var if needed.');
208
- console.log(` copilot test: code=${testCopilot.code} stderr=${(testCopilot.stderr || '').slice(0, 200)}`);
209
- console.log(` gh copilot test: code=${testGh.code} stderr=${(testGh.stderr || '').slice(0, 200)}`);
217
+ console.log(' Could not find copilot CLI.');
218
+ console.log(` copilot stderr: ${(testCopilot.stderr || '').slice(0, 200)}`);
219
+ console.log(` gh stderr: ${(testGh.stderr || '').slice(0, 200)}`);
220
+ console.log(' Skipping task/blocker extraction.');
221
+ dl.db.save();
222
+ console.log('\n✅ Retroactive ingestion complete (embeddings only)!');
223
+ return;
210
224
  }
211
225
  }
226
+ } else {
227
+ console.log(` ℹ Using COPILOT_CMD: ${cmd}`);
228
+ useGhCopilot = cmd.toLowerCase().includes('gh') && !cmd.toLowerCase().includes('copilot');
212
229
  }
213
- const useGhCopilot = cmd === 'gh';
214
230
  const agentEnv = { FREYA_WORKSPACE_DIR: workspaceDir };
215
231
  const slugMap = readProjectSlugMap(workspaceDir);
216
232
  const validTaskCats = new Set(['DO_NOW', 'SCHEDULE', 'DELEGATE', 'IGNORE']);