@brainervirus/workit-cli 1.0.4 → 1.0.5

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/index.js +94 -5
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -51968,6 +51968,7 @@ var resolve = (options) => {
51968
51968
  cwd,
51969
51969
  dev,
51970
51970
  opencodeConfig: options.opencodeConfig ?? path11.join(home, ".config", "opencode", "opencode.json"),
51971
+ opencodePackageCacheDir: options.opencodePackageCacheDir ?? path11.join(home, ".cache", "opencode", "packages", "@brainervirus", "workit-opencode@latest"),
51971
51972
  cursorSettings: options.cursorSettings ?? path11.join(home, ".cursor", "settings.json"),
51972
51973
  cursorMcp: options.cursorMcp ?? path11.join(home, ".cursor", "mcp.json"),
51973
51974
  cursorPluginDir: options.cursorPluginDir ?? path11.join(home, ".cursor", "plugins", "local", "workit"),
@@ -52454,7 +52455,11 @@ var pluginMcpSelectors = (res) => {
52454
52455
  return null;
52455
52456
  return args.map(String).filter((a) => a.startsWith("--package="));
52456
52457
  };
52457
- var registryLatestVersion = (res) => {
52458
+ var isFloatingOpenCodeNpmPin = (entry) => {
52459
+ const s = entry.trim();
52460
+ return s === OPENCODE_NPM_PIN || s === `${OPENCODE_NPM_PIN}@latest`;
52461
+ };
52462
+ var registryLatestVersion = (res, pkgName = CURSOR_RUNTIME_PACKAGE) => {
52458
52463
  const seam = res.env.WORKIT_DOCTOR_STALE_REGISTRY_VERSION;
52459
52464
  if (typeof seam === "string" && seam) {
52460
52465
  return /^\d+(?:\.\d+){1,2}$/.test(seam) ? seam : null;
@@ -52463,7 +52468,7 @@ var registryLatestVersion = (res) => {
52463
52468
  if (!cmd)
52464
52469
  return null;
52465
52470
  try {
52466
- const r = spawnSync2(cmd, ["view", CURSOR_RUNTIME_PACKAGE, "version"], {
52471
+ const r = spawnSync2(cmd, ["view", pkgName, "version"], {
52467
52472
  encoding: "utf8",
52468
52473
  timeout: 20000,
52469
52474
  env: res.env
@@ -52478,12 +52483,84 @@ var installedPluginVersion = (res) => {
52478
52483
  const pkg = readJson(path11.join(res.cursorPluginDir, "package.json"));
52479
52484
  return typeof pkg?.version === "string" && pkg.version ? pkg.version : null;
52480
52485
  };
52486
+ var installedOpenCodeCacheVersion = (res) => {
52487
+ const pkg = readJson(path11.join(res.opencodePackageCacheDir, "node_modules", "@brainervirus", "workit-opencode", "package.json"));
52488
+ return typeof pkg?.version === "string" && pkg.version ? pkg.version : null;
52489
+ };
52490
+ var checkOpenCodePackageCache = (res) => {
52491
+ if (!existsSync9(res.opencodeConfig)) {
52492
+ return {
52493
+ id: "stale_install",
52494
+ status: "pass",
52495
+ detail: "no opencode config — package cache not inspected"
52496
+ };
52497
+ }
52498
+ const entries = pluginEntries(readJson(res.opencodeConfig));
52499
+ if (entries.length === 0) {
52500
+ return {
52501
+ id: "stale_install",
52502
+ status: "pass",
52503
+ detail: "no workit opencode pin — package cache not inspected"
52504
+ };
52505
+ }
52506
+ const pin = entries[0];
52507
+ if (pin.startsWith("file:") || pin.startsWith("git+file:")) {
52508
+ return {
52509
+ id: "stale_install",
52510
+ status: "pass",
52511
+ detail: "opencode checkout pin — package cache not used for npm resolution"
52512
+ };
52513
+ }
52514
+ if (!isFloatingOpenCodeNpmPin(pin)) {
52515
+ return {
52516
+ id: "stale_install",
52517
+ status: "pass",
52518
+ detail: `opencode pin ${pin} is an exact version — not compared to registry latest`
52519
+ };
52520
+ }
52521
+ const installed = installedOpenCodeCacheVersion(res);
52522
+ if (installed === null) {
52523
+ return {
52524
+ id: "stale_install",
52525
+ status: "pass",
52526
+ detail: "opencode @latest package cache empty — OpenCode will resolve on next launch"
52527
+ };
52528
+ }
52529
+ const expected = registryLatestVersion(res, OPENCODE_NPM_PIN);
52530
+ if (expected === null) {
52531
+ return {
52532
+ id: "registry_unreachable",
52533
+ status: "warn",
52534
+ registryProbed: true,
52535
+ detail: "registry_unreachable: cannot compare OpenCode @latest cache against published workit-opencode",
52536
+ fix: `Retry when npm is reachable, or remove ${res.opencodePackageCacheDir} and restart OpenCode to re-resolve`
52537
+ };
52538
+ }
52539
+ if (!semverAtLeast(installed, expected)) {
52540
+ return {
52541
+ id: "stale_install",
52542
+ status: "fail",
52543
+ registryProbed: true,
52544
+ detail: `stale_install: OpenCode @latest cache has workit-opencode ${installed} behind published ${expected}`,
52545
+ fix: `Remove ${res.opencodePackageCacheDir} and restart OpenCode — it re-resolves @latest on the next launch`
52546
+ };
52547
+ }
52548
+ return {
52549
+ id: "stale_install",
52550
+ status: "pass",
52551
+ registryProbed: true,
52552
+ detail: `OpenCode @latest cache workit-opencode ${installed} matches published ${expected}`
52553
+ };
52554
+ };
52481
52555
  var checkStaleInstall = (res) => {
52556
+ if (res.host === "opencode") {
52557
+ return checkOpenCodePackageCache(res);
52558
+ }
52482
52559
  if (res.host !== "cursor" && res.host !== "cli") {
52483
52560
  return {
52484
52561
  id: "stale_install",
52485
52562
  status: "pass",
52486
- detail: "cursor plugin not inspected on the opencode host"
52563
+ detail: "cursor plugin not inspected on this host"
52487
52564
  };
52488
52565
  }
52489
52566
  if (existsSync9(res.cursorPluginDir) && lstatSync(res.cursorPluginDir).isSymbolicLink()) {
@@ -52565,18 +52642,30 @@ var checkStaleInstall = (res) => {
52565
52642
  fix: "Re-run install-cursor-plugin.sh — it refreshes the plugin directory with the current build"
52566
52643
  };
52567
52644
  }
52568
- return {
52645
+ const cursorOk = {
52569
52646
  id: "stale_install",
52570
52647
  status: "pass",
52571
52648
  registryProbed: true,
52572
52649
  detail: `installed local-dist workit-cursor ${installed} matches the published runtime ${expected}`
52573
52650
  };
52651
+ if (res.host === "cli") {
52652
+ const oc = checkOpenCodePackageCache(res);
52653
+ if (oc.status !== "pass")
52654
+ return oc;
52655
+ }
52656
+ return cursorOk;
52574
52657
  }
52575
- return {
52658
+ const cursorOk = {
52576
52659
  id: "stale_install",
52577
52660
  status: "pass",
52578
52661
  detail: installed === null ? "installed workit-cursor selectors are canonical" : `installed workit-cursor ${installed} is metadata on the canonical @latest install (fresh at launch)`
52579
52662
  };
52663
+ if (res.host === "cli") {
52664
+ const oc = checkOpenCodePackageCache(res);
52665
+ if (oc.status !== "pass")
52666
+ return oc;
52667
+ }
52668
+ return cursorOk;
52580
52669
  };
52581
52670
  var checkDuplicateRegistration = (res) => {
52582
52671
  const problems = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-cli",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "description": "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
6
6
  "keywords": [
@@ -37,9 +37,9 @@
37
37
  "typecheck": "tsc --noEmit"
38
38
  },
39
39
  "dependencies": {
40
- "@brainervirus/workit-core": "^1.0.4",
41
- "@brainervirus/workit-cursor": "^1.0.4",
42
- "@brainervirus/workit-opencode": "^1.0.4",
40
+ "@brainervirus/workit-core": "^1.0.5",
41
+ "@brainervirus/workit-cursor": "^1.0.5",
42
+ "@brainervirus/workit-opencode": "^1.0.5",
43
43
  "@inkjs/ui": "2.0.0",
44
44
  "ink": "7.1.1",
45
45
  "react": "19.2.8"