compound-workflow 1.6.12 → 1.6.13

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compound-workflow",
3
- "version": "1.6.12",
3
+ "version": "1.6.13",
4
4
  "description": "Clarify -> plan -> execute -> verify -> capture workflow: commands, skills, and agents for Claude Code",
5
5
  "author": {
6
6
  "name": "Compound Workflow"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compound-workflow",
3
- "version": "1.6.12",
3
+ "version": "1.6.13",
4
4
  "description": "Clarify -> plan -> execute -> verify -> capture workflow for Cursor",
5
5
  "author": {
6
6
  "name": "Compound Workflow"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compound-workflow",
3
- "version": "1.6.12",
3
+ "version": "1.6.13",
4
4
  "description": "Clarify → plan → execute → verify → capture. One Install action for Cursor, Claude, and OpenCode.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -351,15 +351,23 @@ function writePluginManifests(targetRoot, dryRun, isSelfInstall) {
351
351
  const cursorDir = path.join(targetRoot, ".cursor-plugin");
352
352
  const claudeDir = path.join(targetRoot, ".claude-plugin");
353
353
 
354
+ const installPathAbs = realpathSafe(targetRoot);
355
+ const registrationDescriptor = {
356
+ pluginId: "compound-workflow@local",
357
+ scope: "user",
358
+ installPath: installPathAbs,
359
+ };
360
+
354
361
  if (dryRun) {
355
- console.log("[dry-run] Would write .cursor-plugin/plugin.json, .claude-plugin/plugin.json");
362
+ console.log("[dry-run] Would write .cursor-plugin/plugin.json, .claude-plugin/plugin.json, .cursor-plugin/registration.json");
356
363
  return;
357
364
  }
358
365
  fs.mkdirSync(cursorDir, { recursive: true });
359
366
  fs.mkdirSync(claudeDir, { recursive: true });
360
367
  fs.writeFileSync(path.join(cursorDir, "plugin.json"), JSON.stringify(cursorOut, null, 2) + "\n", "utf8");
361
368
  fs.writeFileSync(path.join(claudeDir, "plugin.json"), JSON.stringify(claudeOut, null, 2) + "\n", "utf8");
362
- console.log("Wrote: .cursor-plugin/plugin.json, .claude-plugin/plugin.json");
369
+ fs.writeFileSync(path.join(cursorDir, "registration.json"), JSON.stringify(registrationDescriptor, null, 2) + "\n", "utf8");
370
+ console.log("Wrote: .cursor-plugin/plugin.json, .claude-plugin/plugin.json, .cursor-plugin/registration.json");
363
371
  }
364
372
 
365
373
  /**
@@ -446,17 +454,57 @@ function cursorDetected() {
446
454
  }
447
455
 
448
456
  function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegister, isSelfInstall) {
457
+ const claudePluginsDir = path.join(os.homedir(), ".claude", "plugins");
458
+ const installedPath = path.join(claudePluginsDir, "installed_plugins.json");
449
459
  const settingsPath = path.join(os.homedir(), ".claude", "settings.json");
450
460
 
451
- const LEGACY_PLUGIN_ID = "compound-workflow@local";
452
- const pluginId = "compound-workflow@compound-workflow";
461
+ const pluginVersion = (() => {
462
+ try {
463
+ const pkgPath = path.join(PACKAGE_ROOT, "package.json");
464
+ return JSON.parse(fs.readFileSync(pkgPath, "utf8")).version || "0.0.0";
465
+ } catch {
466
+ return "0.0.0";
467
+ }
468
+ })();
469
+
470
+ const targetRootReal = realpathSafe(isSelfInstall ? PACKAGE_ROOT : targetRoot);
471
+ const pluginId = "compound-workflow@local";
472
+ const scope = isSelfInstall ? "user" : "project";
453
473
 
454
- // Marketplace source path:
455
- // - Self-install (dev): absolute path to package root
456
- // - Consumer projects: relative path from project root to package
457
- const marketplacePath = isSelfInstall
458
- ? realpathSafe(PACKAGE_ROOT)
459
- : "./node_modules/compound-workflow";
474
+ let installed = {};
475
+ if (fs.existsSync(installedPath)) {
476
+ try {
477
+ installed = readJsonMaybe(installedPath) ?? {};
478
+ } catch {
479
+ installed = {};
480
+ }
481
+ }
482
+ const plugins = ensureObject(installed.plugins);
483
+ const existingEntries = Array.isArray(plugins[pluginId]) ? plugins[pluginId] : [];
484
+ const cleanedEntries = scope === "project"
485
+ ? existingEntries.filter((e) => e.scope !== "user")
486
+ : existingEntries;
487
+ const pruned = cleanedEntries.filter((e) => {
488
+ const manifest = path.join(e.installPath || "", ".claude-plugin", "plugin.json");
489
+ return fs.existsSync(manifest);
490
+ });
491
+ const matchIndex = pruned.findIndex((e) =>
492
+ scope === "user" ? e.scope === "user" : e.scope === "project" && e.projectPath === targetRootReal
493
+ );
494
+ const existingEntry = matchIndex >= 0 ? pruned[matchIndex] : {};
495
+ const now = new Date().toISOString();
496
+ const newEntry = {
497
+ scope,
498
+ ...(scope === "project" ? { projectPath: targetRootReal } : {}),
499
+ installPath: targetRootReal,
500
+ version: pluginVersion,
501
+ installedAt: existingEntry.installedAt || now,
502
+ lastUpdated: now,
503
+ };
504
+ plugins[pluginId] = matchIndex >= 0
505
+ ? pruned.map((e, i) => (i === matchIndex ? newEntry : e))
506
+ : [...pruned, newEntry];
507
+ installed.plugins = plugins;
460
508
 
461
509
  let settings = {};
462
510
  if (fs.existsSync(settingsPath)) {
@@ -466,50 +514,32 @@ function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegi
466
514
  settings = {};
467
515
  }
468
516
  }
469
- // Clean up legacy @local entry and register with correct plugin ID
470
517
  settings.enabledPlugins = ensureObject(settings.enabledPlugins);
471
- delete settings.enabledPlugins[LEGACY_PLUGIN_ID];
472
518
  settings.enabledPlugins[pluginId] = true;
473
519
 
474
520
  if (dryRun) {
475
- console.log("[dry-run] Would register Claude plugin via extraKnownMarketplaces with id:", pluginId);
521
+ console.log("[dry-run] Would register Claude plugin:", JSON.stringify(newEntry, null, 2));
476
522
  return;
477
523
  }
478
524
 
525
+ fs.mkdirSync(claudePluginsDir, { recursive: true });
479
526
  fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
527
+ fs.writeFileSync(installedPath, JSON.stringify(installed, null, 2) + "\n", "utf8");
480
528
  fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
481
529
 
482
- // Project-level settings: register local marketplace and enable plugin
483
530
  if (!isSelfInstall) {
484
531
  const projectSettingsPath = path.join(targetRoot, ".claude", "settings.json");
485
532
  let projectSettings = {};
486
533
  if (fs.existsSync(projectSettingsPath)) {
487
534
  try { projectSettings = readJsonMaybe(projectSettingsPath) ?? {}; } catch { projectSettings = {}; }
488
535
  }
489
- // Clean up legacy @local entry
490
536
  projectSettings.enabledPlugins = ensureObject(projectSettings.enabledPlugins);
491
- delete projectSettings.enabledPlugins[LEGACY_PLUGIN_ID];
492
537
  projectSettings.enabledPlugins[pluginId] = true;
493
- // Register the package as a local marketplace so Claude Code resolves compound-workflow@compound-workflow
494
- projectSettings.extraKnownMarketplaces = ensureObject(projectSettings.extraKnownMarketplaces);
495
- projectSettings.extraKnownMarketplaces["compound-workflow"] = {
496
- source: {
497
- source: "local",
498
- path: marketplacePath,
499
- },
500
- };
538
+ if (projectSettings.extraKnownMarketplaces?.["compound-workflow"]) {
539
+ delete projectSettings.extraKnownMarketplaces["compound-workflow"];
540
+ }
501
541
  fs.mkdirSync(path.join(targetRoot, ".claude"), { recursive: true });
502
542
  fs.writeFileSync(projectSettingsPath, JSON.stringify(projectSettings, null, 2) + "\n", "utf8");
503
- } else {
504
- // Self-install: register marketplace at user level with absolute path
505
- settings.extraKnownMarketplaces = ensureObject(settings.extraKnownMarketplaces);
506
- settings.extraKnownMarketplaces["compound-workflow"] = {
507
- source: {
508
- source: "local",
509
- path: marketplacePath,
510
- },
511
- };
512
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
513
543
  }
514
544
 
515
545
  console.log("Registered compound-workflow with Claude Code. Restart Claude Code; enable 'Include third-party Plugins, Skills, and other configs' in Settings if needed.");
@@ -520,9 +550,8 @@ function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegi
520
550
  console.log("[cursor] Cursor not detected; skipped Cursor plugin registration. Use --register-cursor to force.");
521
551
  return;
522
552
  }
523
-
524
- const cursorPluginPath = path.join(targetRoot, ".cursor-plugin", "plugin.json");
525
- if (!fs.existsSync(cursorPluginPath)) return;
553
+ const registrationPath = path.join(targetRoot, ".cursor-plugin", "registration.json");
554
+ if (!fs.existsSync(registrationPath)) return;
526
555
  console.log("Registered compound-workflow with Cursor. Restart Cursor; enable 'Include third-party Plugins, Skills, and other configs' in Settings if needed.");
527
556
  }
528
557