@brainervirus/workit-opencode 0.8.0 → 0.8.1

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.
Files changed (2) hide show
  1. package/dist/plugin.js +30 -1
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -1106,6 +1106,13 @@ function isWorkitPlugin(value) {
1106
1106
  const pkgPath = s.includes("/packages/workit-opencode/") || s.includes("/packages/workit-cursor/") || s.includes("/node_modules/@brainervirus/workit-opencode/") || s.includes("/node_modules/@brainervirus/workit-cursor/");
1107
1107
  return named(s, "workflow-toolkit") || named(s, "workflow-toolkit-opencode") || named(s, "local/workflow-toolkit") || named(s, "workit") || named(s, "local/workit") || named(s, "@brainervirus/workit-opencode") || named(s, "@brainervirus/workit-cursor") || url && pkgPath || s.startsWith("git+file://") && s.includes("workflow-toolkit");
1108
1108
  }
1109
+ var CURSOR_RUNTIME_PACKAGE = "@brainervirus/workit-cursor@0.8.0";
1110
+ function cursorHooksEntry(_packageDir) {
1111
+ return {
1112
+ command: `npx -y --package=${CURSOR_RUNTIME_PACKAGE} workit-cursor-session-start`,
1113
+ args: []
1114
+ };
1115
+ }
1109
1116
 
1110
1117
  // packages/workit-core/src/core/doctor.ts
1111
1118
  import { spawnSync as spawnSync2 } from "node:child_process";
@@ -1475,7 +1482,7 @@ var registeredCursorLauncher = (res) => {
1475
1482
  if (executable === "npx" || executable === "npx.exe" || executable === "npx.cmd") {
1476
1483
  if (args[0] !== "-y")
1477
1484
  return "invalid";
1478
- if (args[1] !== "--package=@brainervirus/workit-cursor@latest")
1485
+ if (args[1] !== `--package=${CURSOR_RUNTIME_PACKAGE}`)
1479
1486
  return "invalid";
1480
1487
  if (args[2] !== "workit-cursor-mcp")
1481
1488
  return "invalid";
@@ -1489,6 +1496,22 @@ var registeredCursorLauncher = (res) => {
1489
1496
  entry: path10.isAbsolute(args[0]) ? args[0] : path10.resolve(path10.dirname(res.cursorMcp), args[0])
1490
1497
  };
1491
1498
  };
1499
+ var canonicalCursorHook = cursorHooksEntry("").command;
1500
+ var registeredCursorHook = (res) => {
1501
+ const hooksFile = path10.join(res.cursorPluginDir, "hooks", "hooks-cursor.json");
1502
+ if (!existsSync7(hooksFile))
1503
+ return "invalid";
1504
+ const config = readJson(hooksFile);
1505
+ if (!config)
1506
+ return "invalid";
1507
+ const sessionStart = config.hooks?.sessionStart;
1508
+ if (!Array.isArray(sessionStart) || sessionStart.length !== 1)
1509
+ return "invalid";
1510
+ const entry = sessionStart[0];
1511
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry))
1512
+ return "invalid";
1513
+ return typeof entry.command === "string" ? entry.command : "invalid";
1514
+ };
1492
1515
  var checkLauncher = (res) => {
1493
1516
  const dev = res.dev;
1494
1517
  const hosts = hostsFor(res.host);
@@ -1501,6 +1524,12 @@ var checkLauncher = (res) => {
1501
1524
  } else if (registered && registered.kind === "node" && !validNodeEntry(registered.entry, registered.runtime, res.env)) {
1502
1525
  missing.push(`cursor: registered ${registered.entry}`);
1503
1526
  }
1527
+ const hook = registeredCursorHook(res);
1528
+ if (hook === "invalid") {
1529
+ missing.push(`cursor: canonical session-start hook in ${path10.join(res.cursorPluginDir, "hooks", "hooks-cursor.json")}`);
1530
+ } else if (hook !== null && hook !== canonicalCursorHook) {
1531
+ missing.push(`cursor: canonical session-start hook in ${path10.join(res.cursorPluginDir, "hooks", "hooks-cursor.json")} (registered ${hook})`);
1532
+ }
1504
1533
  }
1505
1534
  if (dev) {
1506
1535
  missing.push(...hosts.filter((h) => h !== "cursor").flatMap((h) => launcherSlotsFor(h, dev).filter((slot) => !slot.some((p) => existsSync7(p))).map((slot) => `${h}: ${slot.join(" or ")}`)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-opencode",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin (thin wrapper over @brainervirus/workit-core)",
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  "typecheck": "tsc --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@brainervirus/workit-core": "^0.8.0"
37
+ "@brainervirus/workit-core": "^0.8.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@opencode-ai/plugin": "1.17.7"