@brainervirus/workit-cli 0.8.12 → 0.9.2

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 +51 -40
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -46431,16 +46431,16 @@ import path21 from "node:path";
46431
46431
  // packages/workit-core/src/core/flow-state.ts
46432
46432
  import {
46433
46433
  closeSync,
46434
- existsSync as existsSync14,
46434
+ existsSync as existsSync15,
46435
46435
  fstatSync,
46436
46436
  fsyncSync,
46437
46437
  mkdirSync as mkdirSync8,
46438
46438
  openSync,
46439
- readdirSync as readdirSync5,
46439
+ readdirSync as readdirSync6,
46440
46440
  readFileSync as readFileSync13,
46441
- renameSync as renameSync2,
46442
- rmSync as rmSync2,
46443
- statSync as statSync7,
46441
+ renameSync as renameSync3,
46442
+ rmSync as rmSync3,
46443
+ statSync as statSync8,
46444
46444
  unlinkSync as unlinkSync3,
46445
46445
  writeFileSync as writeFileSync8
46446
46446
  } from "node:fs";
@@ -47038,14 +47038,25 @@ function sddAppendAdvisory({
47038
47038
 
47039
47039
  // packages/workit-core/src/core/verify-project.ts
47040
47040
  import { spawnSync as spawnSync4 } from "node:child_process";
47041
- import { existsSync as existsSync13, readFileSync as readFileSync12, statSync as statSync6 } from "node:fs";
47041
+ import { existsSync as existsSync14, readFileSync as readFileSync12, statSync as statSync7 } from "node:fs";
47042
47042
  import path17 from "node:path";
47043
47043
 
47044
47044
  // packages/workit-core/src/core/repo-context.ts
47045
47045
  import { spawnSync as spawnSync3 } from "node:child_process";
47046
47046
 
47047
47047
  // packages/workit-core/src/core/branch.ts
47048
- import { readFileSync as readFileSync11, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "node:fs";
47048
+ import {
47049
+ copyFileSync as copyFileSync3,
47050
+ cpSync as cpSync3,
47051
+ existsSync as existsSync13,
47052
+ mkdirSync as mkdirSync7,
47053
+ readFileSync as readFileSync11,
47054
+ readdirSync as readdirSync5,
47055
+ renameSync as renameSync2,
47056
+ rmSync as rmSync2,
47057
+ statSync as statSync6,
47058
+ writeFileSync as writeFileSync7
47059
+ } from "node:fs";
47049
47060
  import path16 from "node:path";
47050
47061
 
47051
47062
  // packages/workit-core/src/core/git.ts
@@ -47239,9 +47250,9 @@ var commandOnPath2 = (name) => {
47239
47250
  for (const candidateName of names) {
47240
47251
  const candidate = path17.join(dir, candidateName);
47241
47252
  try {
47242
- statSync6(candidate);
47253
+ statSync7(candidate);
47243
47254
  if (process.platform !== "win32") {
47244
- const mode = statSync6(candidate).mode & 73;
47255
+ const mode = statSync7(candidate).mode & 73;
47245
47256
  if (mode === 0)
47246
47257
  continue;
47247
47258
  }
@@ -47253,7 +47264,7 @@ var commandOnPath2 = (name) => {
47253
47264
  };
47254
47265
  var hasScript = (cwd2, name) => {
47255
47266
  const pkgPath = path17.join(cwd2, "package.json");
47256
- if (!existsSync13(pkgPath))
47267
+ if (!existsSync14(pkgPath))
47257
47268
  return false;
47258
47269
  try {
47259
47270
  const pkg = JSON.parse(readFileSync12(pkgPath, "utf8"));
@@ -47263,10 +47274,10 @@ var hasScript = (cwd2, name) => {
47263
47274
  }
47264
47275
  };
47265
47276
  var packageRunner = (cwd2) => {
47266
- if (existsSync13(path17.join(cwd2, "pnpm-lock.yaml")))
47277
+ if (existsSync14(path17.join(cwd2, "pnpm-lock.yaml")))
47267
47278
  return "pnpm";
47268
47279
  const pkgPath = path17.join(cwd2, "package.json");
47269
- if (existsSync13(pkgPath)) {
47280
+ if (existsSync14(pkgPath)) {
47270
47281
  try {
47271
47282
  const pkg = JSON.parse(readFileSync12(pkgPath, "utf8"));
47272
47283
  if (typeof pkg.packageManager === "string" && pkg.packageManager.startsWith("pnpm")) {
@@ -47274,7 +47285,7 @@ var packageRunner = (cwd2) => {
47274
47285
  }
47275
47286
  } catch {}
47276
47287
  }
47277
- if (existsSync13(path17.join(cwd2, "yarn.lock")))
47288
+ if (existsSync14(path17.join(cwd2, "yarn.lock")))
47278
47289
  return "yarn";
47279
47290
  return "npm";
47280
47291
  };
@@ -47335,7 +47346,7 @@ root: ${cwd2}
47335
47346
  lines.push(`dry_run: ${String(dryRun)}
47336
47347
  `);
47337
47348
  const pkgPath = path17.join(cwd2, "package.json");
47338
- if (existsSync13(pkgPath)) {
47349
+ if (existsSync14(pkgPath)) {
47339
47350
  const runner = packageRunner(cwd2);
47340
47351
  for (const script of ["lint", "format:check", "test", "build"]) {
47341
47352
  if (hasScript(cwd2, script)) {
@@ -47350,7 +47361,7 @@ root: ${cwd2}
47350
47361
  } else {
47351
47362
  skipCheck("javascript", "package.json not found");
47352
47363
  }
47353
- const cargoManifest = existsSync13(path17.join(cwd2, "Cargo.toml")) ? "Cargo.toml" : existsSync13(path17.join(cwd2, "src-tauri/Cargo.toml")) ? "src-tauri/Cargo.toml" : "";
47364
+ const cargoManifest = existsSync14(path17.join(cwd2, "Cargo.toml")) ? "Cargo.toml" : existsSync14(path17.join(cwd2, "src-tauri/Cargo.toml")) ? "src-tauri/Cargo.toml" : "";
47354
47365
  if (cargoManifest) {
47355
47366
  runCheck("cargo fmt", "cargo", ["fmt", "--manifest-path", cargoManifest, "--", "--check"]);
47356
47367
  runCheck("cargo clippy", "cargo", [
@@ -47366,7 +47377,7 @@ root: ${cwd2}
47366
47377
  } else {
47367
47378
  skipCheck("rust", "Cargo.toml not found");
47368
47379
  }
47369
- if (existsSync13(path17.join(cwd2, "pyproject.toml")) || existsSync13(path17.join(cwd2, "pytest.ini")) || existsSync13(path17.join(cwd2, "tests"))) {
47380
+ if (existsSync14(path17.join(cwd2, "pyproject.toml")) || existsSync14(path17.join(cwd2, "pytest.ini")) || existsSync14(path17.join(cwd2, "tests"))) {
47370
47381
  if (commandOnPath2("pytest"))
47371
47382
  runCheck("pytest", "pytest", []);
47372
47383
  else
@@ -47388,7 +47399,7 @@ root: ${cwd2}
47388
47399
  lines.push(`status: skipped (dry run)
47389
47400
  `);
47390
47401
  skipped += 1;
47391
- } else if (existsSync13(changelogPath)) {
47402
+ } else if (existsSync14(changelogPath)) {
47392
47403
  if (/## \[Unreleased\]/i.test(readFileSync12(changelogPath, "utf8"))) {
47393
47404
  lines.push(`status: pass
47394
47405
  `);
@@ -47588,7 +47599,7 @@ var validateState = (parsed, slug) => {
47588
47599
  var readFlowStrict = (root, slug) => {
47589
47600
  const file = flowPath(root, slug);
47590
47601
  const rel = path18.posix.join("docs", slug, "sdd", "flow.json");
47591
- if (!existsSync14(file)) {
47602
+ if (!existsSync15(file)) {
47592
47603
  return err2("flow_not_activated", `flow not activated for ${slug} — run workit_flow_status first`);
47593
47604
  }
47594
47605
  let text;
@@ -47625,15 +47636,15 @@ var writeFlowFileAtomic = (file, state) => {
47625
47636
  fsyncSync(fd);
47626
47637
  closeSync(fd);
47627
47638
  fd = null;
47628
- renameSync2(tmp, file);
47639
+ renameSync3(tmp, file);
47629
47640
  } finally {
47630
47641
  try {
47631
47642
  if (fd !== null)
47632
47643
  closeSync(fd);
47633
47644
  } catch {}
47634
47645
  try {
47635
- if (existsSync14(tmp))
47636
- rmSync2(tmp, { force: true });
47646
+ if (existsSync15(tmp))
47647
+ rmSync3(tmp, { force: true });
47637
47648
  } catch {}
47638
47649
  }
47639
47650
  };
@@ -47641,14 +47652,14 @@ var MAX_WRITE_ATTEMPTS = 5;
47641
47652
  var STALE_LOCK_MS = 1000;
47642
47653
  var lockMtimeMs = (lock) => {
47643
47654
  try {
47644
- return statSync7(lock).mtimeMs;
47655
+ return statSync8(lock).mtimeMs;
47645
47656
  } catch {
47646
47657
  return null;
47647
47658
  }
47648
47659
  };
47649
47660
  var lockOwnedBy = (fd, lock) => {
47650
47661
  try {
47651
- return fstatSync(fd).ino === statSync7(lock).ino;
47662
+ return fstatSync(fd).ino === statSync8(lock).ino;
47652
47663
  } catch {
47653
47664
  return false;
47654
47665
  }
@@ -47664,7 +47675,7 @@ var writeFlowStateIfCurrent = (root, expected, next) => {
47664
47675
  const tmp = uniqueTempPath(file);
47665
47676
  let fd = null;
47666
47677
  try {
47667
- const currentText = existsSync14(file) ? readFileSync13(file, "utf8") : null;
47678
+ const currentText = existsSync15(file) ? readFileSync13(file, "utf8") : null;
47668
47679
  if (currentText !== expectedText)
47669
47680
  return { ok: false, conflict: true };
47670
47681
  mkdirSync8(path18.dirname(file), { recursive: true });
@@ -47673,10 +47684,10 @@ var writeFlowStateIfCurrent = (root, expected, next) => {
47673
47684
  fsyncSync(fd);
47674
47685
  closeSync(fd);
47675
47686
  fd = null;
47676
- const reRead = existsSync14(file) ? readFileSync13(file, "utf8") : null;
47687
+ const reRead = existsSync15(file) ? readFileSync13(file, "utf8") : null;
47677
47688
  if (reRead !== expectedText)
47678
47689
  return { ok: false, conflict: true };
47679
- renameSync2(tmp, file);
47690
+ renameSync3(tmp, file);
47680
47691
  return { ok: true };
47681
47692
  } catch (error) {
47682
47693
  return { ok: false, io_error: error instanceof Error ? error.message : String(error) };
@@ -47686,8 +47697,8 @@ var writeFlowStateIfCurrent = (root, expected, next) => {
47686
47697
  closeSync(fd);
47687
47698
  } catch {}
47688
47699
  try {
47689
- if (existsSync14(tmp))
47690
- rmSync2(tmp, { force: true });
47700
+ if (existsSync15(tmp))
47701
+ rmSync3(tmp, { force: true });
47691
47702
  } catch {}
47692
47703
  }
47693
47704
  };
@@ -47784,11 +47795,11 @@ var normalizeCompatibility = (root, slug, parsed, state) => {
47784
47795
  };
47785
47796
  var withFlowLock = (file, fn) => {
47786
47797
  const lock = `${file}.lock`;
47787
- if (!existsSync14(path18.dirname(file)))
47798
+ if (!existsSync15(path18.dirname(file)))
47788
47799
  return { locked: true, value: fn() };
47789
47800
  try {
47790
- if (existsSync14(`${lock}.stale`))
47791
- rmSync2(`${lock}.stale`, { force: true });
47801
+ if (existsSync15(`${lock}.stale`))
47802
+ rmSync3(`${lock}.stale`, { force: true });
47792
47803
  } catch {}
47793
47804
  const wait = new Int32Array(new SharedArrayBuffer(4));
47794
47805
  let fd = null;
@@ -47807,7 +47818,7 @@ var withFlowLock = (file, fn) => {
47807
47818
  const mtime = lockMtimeMs(lock);
47808
47819
  if (mtime !== null && Date.now() - mtime > STALE_LOCK_MS) {
47809
47820
  try {
47810
- renameSync2(lock, `${lock}.stale`);
47821
+ renameSync3(lock, `${lock}.stale`);
47811
47822
  unlinkSync3(`${lock}.stale`);
47812
47823
  } catch {}
47813
47824
  try {
@@ -47843,7 +47854,7 @@ var withFlowLock = (file, fn) => {
47843
47854
  } finally {
47844
47855
  try {
47845
47856
  if (fd !== null && lockOwnedBy(fd, lock))
47846
- rmSync2(lock, { force: true });
47857
+ rmSync3(lock, { force: true });
47847
47858
  } catch {}
47848
47859
  try {
47849
47860
  if (fd !== null)
@@ -48444,12 +48455,12 @@ var COORDINATOR_SHELL_DENIED_TEXT = "Coordinator shell commands are restricted w
48444
48455
  import path20 from "node:path";
48445
48456
 
48446
48457
  // packages/workit-core/src/core/handoff-context.ts
48447
- import { existsSync as existsSync15, readFileSync as readFileSync14, readdirSync as readdirSync6, statSync as statSync8 } from "node:fs";
48458
+ import { existsSync as existsSync16, readFileSync as readFileSync14, readdirSync as readdirSync7, statSync as statSync9 } from "node:fs";
48448
48459
  import path19 from "node:path";
48449
48460
  var DOC_RE = /docs\/([A-Za-z0-9][A-Za-z0-9._-]*)\/(spec|plan)\.md/g;
48450
48461
  var listMd = (dir) => {
48451
48462
  try {
48452
- return readdirSync6(dir).filter((f) => f.endsWith(".md")).sort();
48463
+ return readdirSync7(dir).filter((f) => f.endsWith(".md")).sort();
48453
48464
  } catch {
48454
48465
  return [];
48455
48466
  }
@@ -48465,7 +48476,7 @@ var resolveFromMessagePaths = (root, message) => {
48465
48476
  const slug = slugs[0];
48466
48477
  const plan = `docs/${slug}/plan.md`;
48467
48478
  const spec = `docs/${slug}/spec.md`;
48468
- if (!existsSync15(path19.join(root, plan)) || !existsSync15(path19.join(root, spec))) {
48479
+ if (!existsSync16(path19.join(root, plan)) || !existsSync16(path19.join(root, spec))) {
48469
48480
  return { error: `docs/${slug}/ must contain both plan.md and spec.md` };
48470
48481
  }
48471
48482
  return { spec, plan, source: "message_paths" };
@@ -48475,7 +48486,7 @@ var resolveActivePair = (root) => {
48475
48486
  let best = null;
48476
48487
  let entries = [];
48477
48488
  try {
48478
- entries = readdirSync6(docsDir);
48489
+ entries = readdirSync7(docsDir);
48479
48490
  } catch {
48480
48491
  return { error: "no pair" };
48481
48492
  }
@@ -48484,9 +48495,9 @@ var resolveActivePair = (root) => {
48484
48495
  continue;
48485
48496
  const plan = path19.join("docs", slug, "plan.md");
48486
48497
  const spec = path19.join("docs", slug, "spec.md");
48487
- if (!existsSync15(path19.join(root, plan)) || !existsSync15(path19.join(root, spec)))
48498
+ if (!existsSync16(path19.join(root, plan)) || !existsSync16(path19.join(root, spec)))
48488
48499
  continue;
48489
- const score = Math.max(statSync8(path19.join(root, spec)).mtimeMs, statSync8(path19.join(root, plan)).mtimeMs);
48500
+ const score = Math.max(statSync9(path19.join(root, spec)).mtimeMs, statSync9(path19.join(root, plan)).mtimeMs);
48490
48501
  if (best === null || score > best.score || score === best.score && slug < best.spec.split("/")[1]) {
48491
48502
  best = { score, spec, plan, source: "active_pair" };
48492
48503
  }
@@ -48505,7 +48516,7 @@ var resolveWorkflowPaths = (root, message) => {
48505
48516
  if (!("error" in active))
48506
48517
  return active;
48507
48518
  const docsDir = path19.join(root, "docs");
48508
- if (!existsSync15(docsDir) || listMd(docsDir).length === 0) {
48519
+ if (!existsSync16(docsDir) || listMd(docsDir).length === 0) {
48509
48520
  return { error: "no docs/<slug>/ features found under docs/" };
48510
48521
  }
48511
48522
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-cli",
3
- "version": "0.8.12",
3
+ "version": "0.9.2",
4
4
  "private": false,
5
5
  "description": "Workit interactive setup wizard (Ink TUI)",
6
6
  "keywords": [
@@ -34,9 +34,9 @@
34
34
  "typecheck": "tsc --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@brainervirus/workit-core": "^0.8.12",
38
- "@brainervirus/workit-cursor": "^0.8.12",
39
- "@brainervirus/workit-opencode": "^0.8.12",
37
+ "@brainervirus/workit-core": "^0.9.2",
38
+ "@brainervirus/workit-cursor": "^0.9.2",
39
+ "@brainervirus/workit-opencode": "^0.9.2",
40
40
  "@inkjs/ui": "2.0.0",
41
41
  "ink": "7.1.1",
42
42
  "react": "19.2.8"