compound-workflow 1.6.5 → 1.6.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/README.md
CHANGED
|
@@ -42,6 +42,8 @@ If your package manager didn’t run postinstall, run once:
|
|
|
42
42
|
npx compound-workflow install
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
Restart Cursor after install; enable third-party plugins in Settings if skills/commands don't appear.
|
|
46
|
+
|
|
45
47
|
**4. After updating the package**
|
|
46
48
|
|
|
47
49
|
To get the latest commands and wiring (e.g. after `npm update compound-workflow` or a new release), run install again so your project’s `opencode.json` is refreshed:
|
package/package.json
CHANGED
package/scripts/install-cli.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import fs from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
|
+
import os from "node:os";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
10
11
|
import { spawnSync } from "node:child_process";
|
|
11
12
|
|
|
@@ -15,25 +16,30 @@ function usage(exitCode = 0) {
|
|
|
15
16
|
const msg = `
|
|
16
17
|
Usage:
|
|
17
18
|
(automatic) npm install compound-workflow # runs install via postinstall; no npx needed
|
|
18
|
-
(manual) npx compound-workflow install [--root <projectDir>] [--dry-run] [--no-config]
|
|
19
|
+
(manual) npx compound-workflow install [--root <projectDir>] [--dry-run] [--no-config] [--no-register-cursor] [--register-cursor]
|
|
19
20
|
|
|
20
21
|
Install writes opencode.json (from package), merges AGENTS.md, creates standard
|
|
21
22
|
docs/todos directories, and prompts for Repo Config Block (unless --no-config).
|
|
23
|
+
When Cursor is detected (~/.cursor), registers the plugin so skills/commands appear.
|
|
22
24
|
|
|
23
|
-
--root <dir>
|
|
24
|
-
--dry-run
|
|
25
|
-
--no-config
|
|
25
|
+
--root <dir> Project directory (default: cwd)
|
|
26
|
+
--dry-run Print planned changes only
|
|
27
|
+
--no-config Skip Repo Config Block reminder
|
|
28
|
+
--no-register-cursor Do not register plugin with Cursor (skip apply to ~/.claude/)
|
|
29
|
+
--register-cursor Force registration with Cursor even if ~/.cursor not found
|
|
26
30
|
`;
|
|
27
31
|
(exitCode === 0 ? console.log : console.error)(msg.trimStart());
|
|
28
32
|
process.exit(exitCode);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
function parseArgs(argv) {
|
|
32
|
-
const out = { root: process.cwd(), dryRun: false, noConfig: false };
|
|
36
|
+
const out = { root: process.cwd(), dryRun: false, noConfig: false, noRegisterCursor: false, registerCursor: false };
|
|
33
37
|
for (let i = 2; i < argv.length; i++) {
|
|
34
38
|
const arg = argv[i];
|
|
35
39
|
if (arg === "--dry-run") out.dryRun = true;
|
|
36
40
|
else if (arg === "--no-config") out.noConfig = true;
|
|
41
|
+
else if (arg === "--no-register-cursor") out.noRegisterCursor = true;
|
|
42
|
+
else if (arg === "--register-cursor") out.registerCursor = true;
|
|
37
43
|
else if (arg === "--root") {
|
|
38
44
|
const value = argv[i + 1];
|
|
39
45
|
if (!value) usage(1);
|
|
@@ -331,15 +337,80 @@ function writePluginManifests(targetRoot, dryRun, isSelfInstall) {
|
|
|
331
337
|
const cursorDir = path.join(targetRoot, ".cursor-plugin");
|
|
332
338
|
const claudeDir = path.join(targetRoot, ".claude-plugin");
|
|
333
339
|
|
|
340
|
+
const installPathAbs = realpathSafe(targetRoot);
|
|
341
|
+
const registrationDescriptor = {
|
|
342
|
+
pluginId: "compound-workflow@local",
|
|
343
|
+
scope: "user",
|
|
344
|
+
installPath: installPathAbs,
|
|
345
|
+
};
|
|
346
|
+
|
|
334
347
|
if (dryRun) {
|
|
335
|
-
console.log("[dry-run] Would write .cursor-plugin/plugin.json
|
|
348
|
+
console.log("[dry-run] Would write .cursor-plugin/plugin.json, .claude-plugin/plugin.json, .cursor-plugin/registration.json");
|
|
336
349
|
return;
|
|
337
350
|
}
|
|
338
351
|
fs.mkdirSync(cursorDir, { recursive: true });
|
|
339
352
|
fs.mkdirSync(claudeDir, { recursive: true });
|
|
340
353
|
fs.writeFileSync(path.join(cursorDir, "plugin.json"), JSON.stringify(cursorOut, null, 2) + "\n", "utf8");
|
|
341
354
|
fs.writeFileSync(path.join(claudeDir, "plugin.json"), JSON.stringify(claudeOut, null, 2) + "\n", "utf8");
|
|
342
|
-
|
|
355
|
+
fs.writeFileSync(path.join(cursorDir, "registration.json"), JSON.stringify(registrationDescriptor, null, 2) + "\n", "utf8");
|
|
356
|
+
console.log("Wrote: .cursor-plugin/plugin.json, .claude-plugin/plugin.json, .cursor-plugin/registration.json");
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function cursorDetected() {
|
|
360
|
+
return fs.existsSync(path.join(os.homedir(), ".cursor"));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function applyCursorRegistration(targetRoot, dryRun, noRegisterCursor, forceRegister) {
|
|
364
|
+
if (dryRun) return;
|
|
365
|
+
if (noRegisterCursor && !forceRegister) return;
|
|
366
|
+
const shouldApply = forceRegister || (cursorDetected() && !noRegisterCursor);
|
|
367
|
+
if (!shouldApply) {
|
|
368
|
+
console.log("[cursor] Cursor not detected; skipped plugin registration. Use --register-cursor to force.");
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const registrationPath = path.join(targetRoot, ".cursor-plugin", "registration.json");
|
|
373
|
+
if (!fs.existsSync(registrationPath)) return;
|
|
374
|
+
let descriptor;
|
|
375
|
+
try {
|
|
376
|
+
descriptor = readJsonMaybe(registrationPath);
|
|
377
|
+
} catch {
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (!descriptor?.pluginId || !descriptor?.installPath) return;
|
|
381
|
+
|
|
382
|
+
const claudePluginsDir = path.join(os.homedir(), ".claude", "plugins");
|
|
383
|
+
const installedPath = path.join(claudePluginsDir, "installed_plugins.json");
|
|
384
|
+
const settingsPath = path.join(os.homedir(), ".claude", "settings.json");
|
|
385
|
+
|
|
386
|
+
let installed = {};
|
|
387
|
+
if (fs.existsSync(installedPath)) {
|
|
388
|
+
try {
|
|
389
|
+
installed = readJsonMaybe(installedPath) ?? {};
|
|
390
|
+
} catch {
|
|
391
|
+
installed = {};
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
const plugins = ensureObject(installed.plugins);
|
|
395
|
+
plugins[descriptor.pluginId] = [{ scope: descriptor.scope || "user", installPath: descriptor.installPath }];
|
|
396
|
+
installed.plugins = plugins;
|
|
397
|
+
|
|
398
|
+
let settings = {};
|
|
399
|
+
if (fs.existsSync(settingsPath)) {
|
|
400
|
+
try {
|
|
401
|
+
settings = readJsonMaybe(settingsPath) ?? {};
|
|
402
|
+
} catch {
|
|
403
|
+
settings = {};
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
settings.enabledPlugins = ensureObject(settings.enabledPlugins);
|
|
407
|
+
settings.enabledPlugins[descriptor.pluginId] = true;
|
|
408
|
+
|
|
409
|
+
fs.mkdirSync(claudePluginsDir, { recursive: true });
|
|
410
|
+
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
411
|
+
fs.writeFileSync(installedPath, JSON.stringify(installed, null, 2) + "\n", "utf8");
|
|
412
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf8");
|
|
413
|
+
console.log("Registered compound-workflow with Cursor. Restart Cursor; enable 'Include third-party Plugins, Skills, and other configs' in Settings if needed.");
|
|
343
414
|
}
|
|
344
415
|
|
|
345
416
|
function reportOpenCodeIntegration(targetRoot, dryRun) {
|
|
@@ -406,6 +477,7 @@ function main() {
|
|
|
406
477
|
|
|
407
478
|
writeOpenCodeJson(targetRoot, args.dryRun, isSelfInstall);
|
|
408
479
|
writePluginManifests(targetRoot, args.dryRun, isSelfInstall);
|
|
480
|
+
applyCursorRegistration(targetRoot, args.dryRun, args.noRegisterCursor, args.registerCursor);
|
|
409
481
|
reportOpenCodeIntegration(targetRoot, args.dryRun);
|
|
410
482
|
writeAgentsMd(targetRoot, args.dryRun);
|
|
411
483
|
ensureDirs(targetRoot, args.dryRun);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: install
|
|
3
3
|
invocation: install
|
|
4
4
|
description: Install compound-workflow in this project (native mode): writes opencode.json, merges AGENTS.md, and creates docs/todo dirs.
|
|
5
|
-
argument-hint: "[--dry-run] [--root <path>] [--no-config]"
|
|
5
|
+
argument-hint: "[--dry-run] [--root <path>] [--no-config] [--no-register-cursor] [--register-cursor]"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# /install
|
|
@@ -32,9 +32,15 @@ npx compound-workflow install --no-config
|
|
|
32
32
|
- `--dry-run`: Print planned changes only; no writes.
|
|
33
33
|
- `--root <path>`: Target project directory (default: current directory).
|
|
34
34
|
- `--no-config`: Skip Repo Config Block reminder; still writes opencode.json, AGENTS.md, and dirs.
|
|
35
|
+
- `--no-register-cursor`: Do not register the plugin with Cursor (skip writing to ~/.claude/).
|
|
36
|
+
- `--register-cursor`: Force registration with Cursor even if Cursor is not detected in the default location.
|
|
35
37
|
|
|
36
38
|
After running, suggest `opencode debug config` in the project to verify OpenCode resolution.
|
|
37
39
|
|
|
40
|
+
## Cursor
|
|
41
|
+
|
|
42
|
+
One command installs and registers the plugin with Cursor when Cursor is detected (`~/.cursor` exists). Restart Cursor after install; if skills or commands do not appear, enable "Include third-party Plugins, Skills, and other configs" in Cursor Settings > Features. Use `--no-register-cursor` to skip registration (e.g. in CI).
|
|
43
|
+
|
|
38
44
|
## What Install does
|
|
39
45
|
|
|
40
46
|
1. Ensures `compound-workflow` is installed in the project.
|