compound-workflow 1.6.8 → 1.6.10
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/package.json
CHANGED
package/scripts/install-cli.mjs
CHANGED
|
@@ -448,18 +448,26 @@ function cursorDetected() {
|
|
|
448
448
|
return fs.existsSync(path.join(os.homedir(), ".cursor"));
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
-
function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegister) {
|
|
452
|
-
if (dryRun) return;
|
|
453
|
-
|
|
451
|
+
function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegister, isSelfInstall) {
|
|
454
452
|
const claudePluginsDir = path.join(os.homedir(), ".claude", "plugins");
|
|
455
453
|
const installedPath = path.join(claudePluginsDir, "installed_plugins.json");
|
|
456
454
|
const settingsPath = path.join(os.homedir(), ".claude", "settings.json");
|
|
457
455
|
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
456
|
+
const pluginVersion = (() => {
|
|
457
|
+
try {
|
|
458
|
+
const pkgPath = path.join(PACKAGE_ROOT, "package.json");
|
|
459
|
+
return JSON.parse(fs.readFileSync(pkgPath, "utf8")).version || "0.0.0";
|
|
460
|
+
} catch {
|
|
461
|
+
return "0.0.0";
|
|
462
|
+
}
|
|
463
|
+
})();
|
|
464
|
+
|
|
465
|
+
// For self-install (dev), use the package root with user scope.
|
|
466
|
+
// For consumer projects, use the project root with project scope so each
|
|
467
|
+
// project gets its own entry and installs don't overwrite each other.
|
|
468
|
+
const targetRootReal = realpathSafe(isSelfInstall ? PACKAGE_ROOT : targetRoot);
|
|
469
|
+
const pluginId = "compound-workflow@local";
|
|
470
|
+
const scope = isSelfInstall ? "user" : "project";
|
|
463
471
|
|
|
464
472
|
let installed = {};
|
|
465
473
|
if (fs.existsSync(installedPath)) {
|
|
@@ -470,7 +478,38 @@ function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegi
|
|
|
470
478
|
}
|
|
471
479
|
}
|
|
472
480
|
const plugins = ensureObject(installed.plugins);
|
|
473
|
-
plugins[
|
|
481
|
+
const existingEntries = Array.isArray(plugins[pluginId]) ? plugins[pluginId] : [];
|
|
482
|
+
|
|
483
|
+
// Remove legacy scope:"user" entries when switching to project-scope
|
|
484
|
+
const cleanedEntries = scope === "project"
|
|
485
|
+
? existingEntries.filter((e) => e.scope !== "user")
|
|
486
|
+
: existingEntries;
|
|
487
|
+
|
|
488
|
+
// Prune stale entries whose installPath no longer has a plugin manifest on disk
|
|
489
|
+
const pruned = cleanedEntries.filter((e) => {
|
|
490
|
+
const manifest = path.join(e.installPath || "", ".claude-plugin", "plugin.json");
|
|
491
|
+
return fs.existsSync(manifest);
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
// Find existing entry for this project (or user-scope entry for self-install)
|
|
495
|
+
const matchIndex = pruned.findIndex((e) =>
|
|
496
|
+
scope === "user" ? e.scope === "user" : e.scope === "project" && e.projectPath === targetRootReal
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
const existingEntry = matchIndex >= 0 ? pruned[matchIndex] : {};
|
|
500
|
+
const now = new Date().toISOString();
|
|
501
|
+
const newEntry = {
|
|
502
|
+
scope,
|
|
503
|
+
...(scope === "project" ? { projectPath: targetRootReal } : {}),
|
|
504
|
+
installPath: targetRootReal,
|
|
505
|
+
version: pluginVersion,
|
|
506
|
+
installedAt: existingEntry.installedAt || now,
|
|
507
|
+
lastUpdated: now,
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
plugins[pluginId] = matchIndex >= 0
|
|
511
|
+
? pruned.map((e, i) => (i === matchIndex ? newEntry : e))
|
|
512
|
+
: [...pruned, newEntry];
|
|
474
513
|
installed.plugins = plugins;
|
|
475
514
|
|
|
476
515
|
let settings = {};
|
|
@@ -481,13 +520,33 @@ function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegi
|
|
|
481
520
|
settings = {};
|
|
482
521
|
}
|
|
483
522
|
}
|
|
523
|
+
// User-level settings (backward compat)
|
|
484
524
|
settings.enabledPlugins = ensureObject(settings.enabledPlugins);
|
|
485
|
-
settings.enabledPlugins[
|
|
525
|
+
settings.enabledPlugins[pluginId] = true;
|
|
526
|
+
|
|
527
|
+
if (dryRun) {
|
|
528
|
+
console.log("[dry-run] Would register Claude plugin:", JSON.stringify(newEntry, null, 2));
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
486
531
|
|
|
487
532
|
fs.mkdirSync(claudePluginsDir, { recursive: true });
|
|
488
533
|
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
489
534
|
fs.writeFileSync(installedPath, JSON.stringify(installed, null, 2) + "\n", "utf8");
|
|
490
535
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
536
|
+
|
|
537
|
+
// Project-level settings required for scope:"project" to activate
|
|
538
|
+
if (!isSelfInstall) {
|
|
539
|
+
const projectSettingsPath = path.join(targetRoot, ".claude", "settings.json");
|
|
540
|
+
let projectSettings = {};
|
|
541
|
+
if (fs.existsSync(projectSettingsPath)) {
|
|
542
|
+
try { projectSettings = readJsonMaybe(projectSettingsPath) ?? {}; } catch { projectSettings = {}; }
|
|
543
|
+
}
|
|
544
|
+
projectSettings.enabledPlugins = ensureObject(projectSettings.enabledPlugins);
|
|
545
|
+
projectSettings.enabledPlugins[pluginId] = true;
|
|
546
|
+
fs.mkdirSync(path.join(targetRoot, ".claude"), { recursive: true });
|
|
547
|
+
fs.writeFileSync(projectSettingsPath, JSON.stringify(projectSettings, null, 2) + "\n", "utf8");
|
|
548
|
+
}
|
|
549
|
+
|
|
491
550
|
console.log("Registered compound-workflow with Claude Code. Restart Claude Code; enable 'Include third-party Plugins, Skills, and other configs' in Settings if needed.");
|
|
492
551
|
|
|
493
552
|
if (noRegisterCursor && !forceRegister) return;
|
|
@@ -567,7 +626,7 @@ function main() {
|
|
|
567
626
|
writeOpenCodeJson(targetRoot, args.dryRun, isSelfInstall);
|
|
568
627
|
writePluginManifests(targetRoot, args.dryRun, isSelfInstall);
|
|
569
628
|
syncCursorSkills(targetRoot, args.dryRun, isSelfInstall);
|
|
570
|
-
applyCursorRegistration(targetRoot, args.dryRun, args.noRegisterCursor, args.registerCursor);
|
|
629
|
+
applyCursorRegistration(targetRoot, args.dryRun, args.noRegisterCursor, args.registerCursor, isSelfInstall);
|
|
571
630
|
reportOpenCodeIntegration(targetRoot, args.dryRun);
|
|
572
631
|
writeAgentsMd(targetRoot, args.dryRun);
|
|
573
632
|
ensureDirs(targetRoot, args.dryRun);
|