wogiflow 1.5.7 → 1.5.8

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.
@@ -115,6 +115,6 @@
115
115
  ]
116
116
  },
117
117
  "_wogiFlowManaged": true,
118
- "_wogiFlowVersion": "1.5.7",
118
+ "_wogiFlowVersion": "1.5.8",
119
119
  "_comment": "Shared WogiFlow hook configuration. Committed to repo for team use. User-specific overrides go in settings.local.json."
120
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wogiflow",
3
- "version": "1.5.7",
3
+ "version": "1.5.8",
4
4
  "description": "AI-powered development workflow management system with multi-model support",
5
5
  "main": "lib/index.js",
6
6
  "bin": {
@@ -303,7 +303,7 @@ function copyScriptsFromPackage() {
303
303
  * Without this, `npx flow bridge sync` fails because .workflow/bridges/ doesn't exist.
304
304
  */
305
305
  function copyWorkflowManagedDirs() {
306
- const managedDirs = ['bridges', 'templates', 'agents'];
306
+ const managedDirs = ['bridges', 'templates', 'agents', 'lib'];
307
307
 
308
308
  for (const subdir of managedDirs) {
309
309
  const src = path.join(PACKAGE_ROOT, '.workflow', subdir);
@@ -318,7 +318,10 @@ function copyWorkflowManagedDirs() {
318
318
  /**
319
319
  * Regenerate CLAUDE.md from templates (for npm update scenario)
320
320
  * Only runs when config.json exists (project already initialized).
321
- * Uses the bridge's synchronous generateRulesFile() to avoid async in postinstall.
321
+ *
322
+ * Uses execFileSync to run the bridge in an isolated child process.
323
+ * This avoids fragile require() chains from the postinstall npm context
324
+ * where module resolution can fail silently (base-bridge → flow-utils → lib/).
322
325
  */
323
326
  function regenerateClaudeMd() {
324
327
  // Only regenerate if project is already initialized (has config.json)
@@ -326,30 +329,47 @@ function regenerateClaudeMd() {
326
329
  return;
327
330
  }
328
331
 
329
- try {
330
- // Load the bridge module from the project's .workflow/bridges/
331
- const bridgesPath = path.join(PROJECT_ROOT, '.workflow', 'bridges');
332
- if (!fs.existsSync(path.join(bridgesPath, 'index.js'))) {
333
- if (process.env.DEBUG) {
334
- console.error('[postinstall] Bridge module not found, skipping CLAUDE.md regen');
335
- }
336
- return;
337
- }
338
-
339
- const { getBridge } = require(bridgesPath);
340
- const bridge = getBridge({ projectDir: PROJECT_ROOT });
341
-
342
- // generateRulesFile() is synchronous — safe to call from postinstall
343
- // force: true ensures templates always win over stale CLAUDE.md
344
- bridge.generateRulesFile({ force: true });
345
-
332
+ // Check that bridges exist (just copied by copyWorkflowManagedDirs)
333
+ const bridgesIndex = path.join(PROJECT_ROOT, '.workflow', 'bridges', 'index.js');
334
+ if (!fs.existsSync(bridgesIndex)) {
346
335
  if (process.env.DEBUG) {
347
- console.error('[postinstall] Regenerated CLAUDE.md from templates');
336
+ console.error('[postinstall] Bridge module not found, skipping CLAUDE.md regen');
348
337
  }
338
+ return;
339
+ }
340
+
341
+ try {
342
+ const { execFileSync } = require('child_process');
343
+
344
+ // Run bridge generation in an isolated child process.
345
+ // cwd=PROJECT_ROOT ensures all relative paths resolve correctly:
346
+ // .workflow/bridges/ → base-bridge → ../../scripts/flow-utils → ../.workflow/lib/
347
+ const script = [
348
+ 'try {',
349
+ ' const { getBridge } = require("./.workflow/bridges");',
350
+ ` const bridge = getBridge({ projectDir: ${JSON.stringify(PROJECT_ROOT)} });`,
351
+ ' bridge.generateRulesFile({ force: true });',
352
+ ' process.exit(0);',
353
+ '} catch (err) {',
354
+ ' process.stderr.write(err.message);',
355
+ ' process.exit(1);',
356
+ '}'
357
+ ].join('\n');
358
+
359
+ execFileSync(process.execPath, ['-e', script], {
360
+ cwd: PROJECT_ROOT,
361
+ timeout: 15000,
362
+ stdio: ['pipe', 'pipe', 'pipe']
363
+ });
364
+
365
+ process.stderr.write('\x1b[36mWogiFlow:\x1b[0m Updated CLAUDE.md from latest templates.\n');
349
366
  } catch (err) {
350
367
  // Non-fatal — CLAUDE.md regeneration failure shouldn't break npm install
368
+ // But DO tell the user so they can regenerate manually
369
+ process.stderr.write('\x1b[33mWogiFlow:\x1b[0m Could not auto-update CLAUDE.md. Run: npx flow bridge sync\n');
351
370
  if (process.env.DEBUG) {
352
- console.error(`[postinstall] CLAUDE.md regen failed: ${err.message}`);
371
+ const stderr = err.stderr ? err.stderr.toString().trim() : err.message;
372
+ console.error(`[postinstall] CLAUDE.md regen failed: ${stderr}`);
353
373
  }
354
374
  }
355
375
  }
@@ -421,9 +441,9 @@ function main() {
421
441
  }
422
442
 
423
443
  try {
424
- // Already initialized - short message
444
+ // Already initialized - confirm update applied
425
445
  if (isAlreadyInitialized()) {
426
- output.write('\x1b[36mWogiFlow:\x1b[0m Already initialized. Run \x1b[33mnpx flow status\x1b[0m to see project state.\n');
446
+ output.write('\x1b[36mWogiFlow:\x1b[0m Updated scripts, hooks, and commands to latest version.\n');
427
447
  return;
428
448
  }
429
449