@brainervirus/workit-cli 8.40.0 → 8.40.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/index.js +99 -41
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -9317,7 +9317,7 @@ var package_default;
9317
9317
  var init_package = __esm(() => {
9318
9318
  package_default = {
9319
9319
  name: "@brainervirus/workit-cli",
9320
- version: "8.40.0",
9320
+ version: "8.40.1",
9321
9321
  private: false,
9322
9322
  description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
9323
9323
  keywords: [
@@ -9355,13 +9355,13 @@ var init_package = __esm(() => {
9355
9355
  },
9356
9356
  dependencies: {
9357
9357
  "@babel/parser": "7.29.9",
9358
- "@brainervirus/workit-cursor": "^8.40.0",
9358
+ "@brainervirus/workit-cursor": "^8.40.1",
9359
9359
  "@inkjs/ui": "2.0.0",
9360
9360
  ink: "7.1.1",
9361
9361
  react: "19.2.8"
9362
9362
  },
9363
9363
  devDependencies: {
9364
- "@brainervirus/workit-core": "^8.40.0"
9364
+ "@brainervirus/workit-core": "^8.40.1"
9365
9365
  },
9366
9366
  engines: {
9367
9367
  node: ">=24"
@@ -21793,13 +21793,51 @@ function emit(io, envelope, human) {
21793
21793
  }
21794
21794
  return exitCodeFor(envelope.code);
21795
21795
  }
21796
+ async function withFailureLine(io, command, run, outcome) {
21797
+ let wrote = false;
21798
+ let reason = null;
21799
+ const code = await run({
21800
+ ...io,
21801
+ stdout: (text) => {
21802
+ wrote ||= text.length > 0;
21803
+ io.stdout(text);
21804
+ },
21805
+ stderr: (text) => {
21806
+ wrote ||= text.length > 0;
21807
+ reason ??= /^workit: ([a-z][a-z_]*):/u.exec(text)?.[1] ?? null;
21808
+ io.stderr(text);
21809
+ }
21810
+ });
21811
+ if (code === 0)
21812
+ return code;
21813
+ if (outcome)
21814
+ io.stderr(`workit: error: ${outcome} (${reason ?? EXIT_NAMES[code] ?? "failed"}, exit ${code})
21815
+ `);
21816
+ else if (!wrote)
21817
+ io.stderr(`workit: error: ${command} failed (exit ${code})
21818
+ `);
21819
+ return code;
21820
+ }
21796
21821
  var EXIT, EXIT_BY_CODE, exitCodeFor = (code) => EXIT_BY_CODE[code], ok2 = (data) => ({ ok: true, code: "ok", data }), fail2 = (code, error, extra = {}) => ({
21797
21822
  ok: false,
21798
21823
  code,
21799
21824
  data: extra.data ?? {},
21800
21825
  error,
21801
21826
  ...extra.unblock ? { unblock: extra.unblock } : {}
21802
- });
21827
+ }), EXIT_NAMES, flushStreams = async (streams = [process.stdout, process.stderr], timeoutMs = 2000) => {
21828
+ await Promise.all(streams.map((stream) => new Promise((resolve) => {
21829
+ const timer = setTimeout(resolve, timeoutMs);
21830
+ const done = () => {
21831
+ clearTimeout(timer);
21832
+ resolve();
21833
+ };
21834
+ try {
21835
+ stream.write("", done);
21836
+ } catch {
21837
+ done();
21838
+ }
21839
+ })));
21840
+ };
21803
21841
  var init_output = __esm(() => {
21804
21842
  EXIT = {
21805
21843
  ok: 0,
@@ -21820,6 +21858,13 @@ var init_output = __esm(() => {
21820
21858
  pending: EXIT.busy,
21821
21859
  unavailable: EXIT.unavailable
21822
21860
  };
21861
+ EXIT_NAMES = {
21862
+ 1: "failed",
21863
+ 2: "invalid_input",
21864
+ 3: "blocked",
21865
+ 4: "busy",
21866
+ 5: "unavailable"
21867
+ };
21823
21868
  });
21824
21869
 
21825
21870
  // packages/workit-cli/src/verbs/task.ts
@@ -81597,7 +81642,7 @@ async function mergePullRequest(cwd, resolved, input, sleep) {
81597
81642
  return {
81598
81643
  ok: false,
81599
81644
  code: "failed",
81600
- error: `merge_unverified: the forge accepted the merge of ${label} but still reports it ${state}${"id" in recorded ? `; recorded as pr.merged ${recorded.id} (verified: false)` : `; the pr.merged row could not be written (${recorded.error})`}`,
81645
+ error: `merge_unverified: the forge accepted the merge of ${label} but still reports it ${state}${state === "open" ? ", so it is not merged yet (a merge queue or auto-merge may hold it)" : ""}${"id" in recorded ? `; recorded as pr.merged ${recorded.id} (verified: false)` : `; the pr.merged row could not be written (${recorded.error})`}`,
81601
81646
  unblock: `workit verify-delivery merged --pr ${doc.number}`,
81602
81647
  recorded
81603
81648
  };
@@ -108755,43 +108800,54 @@ async function main(argv, overrides = {}, options = {}) {
108755
108800
  const entry = findVerb(command);
108756
108801
  if (!entry)
108757
108802
  return unknown2(io, command);
108758
- if (wantsHelp(verbArgs)) {
108759
- const word = firstWord(verbArgs);
108760
- const sub = word === undefined ? undefined : findSubcommand(entry, word);
108761
- const asValue = helpAsValue(verbArgs, sub ? [sub.usage] : usageLines(entry));
108762
- if (asValue)
108763
- return emit(io, fail2("invalid_input", asValue, {
108764
- unblock: `workit help ${entry.name}${sub ? ` ${sub.name}` : ""}`
108765
- }));
108766
- return help(io, sub ? subcommandHelp(entry, sub) : verbHelp(entry));
108767
- }
108768
- const ended = endOfOptions(io, entry, args);
108769
- if (typeof ended === "number")
108770
- return ended;
108771
- const checked = checkFlags(entry, ended);
108772
- if ("error" in checked)
108773
- return emit(io, fail2("invalid_input", checked.error, { unblock: checked.unblock }));
108774
- if (parsed.cwd !== null) {
108775
- try {
108776
- process.chdir(io.cwd);
108777
- } catch {
108778
- return emit(io, fail2("invalid_input", `--cwd: cannot enter ${io.cwd}`));
108779
- }
108780
- if (process.env.WORKFLOW_WORKSPACE_ROOT !== undefined) {
108781
- process.env.WORKFLOW_WORKSPACE_ROOT = io.cwd;
108782
- io.env = process.env;
108803
+ const route = async (routed) => {
108804
+ if (wantsHelp(verbArgs)) {
108805
+ const word = firstWord(verbArgs);
108806
+ const sub = word === undefined ? undefined : findSubcommand(entry, word);
108807
+ const asValue = helpAsValue(verbArgs, sub ? [sub.usage] : usageLines(entry));
108808
+ if (asValue)
108809
+ return emit(routed, fail2("invalid_input", asValue, {
108810
+ unblock: `workit help ${entry.name}${sub ? ` ${sub.name}` : ""}`
108811
+ }));
108812
+ return help(routed, sub ? subcommandHelp(entry, sub) : verbHelp(entry));
108813
+ }
108814
+ const ended = endOfOptions(routed, entry, args);
108815
+ if (typeof ended === "number")
108816
+ return ended;
108817
+ const checked = checkFlags(entry, ended);
108818
+ if ("error" in checked)
108819
+ return emit(routed, fail2("invalid_input", checked.error, { unblock: checked.unblock }));
108820
+ if (parsed.cwd !== null) {
108821
+ try {
108822
+ process.chdir(routed.cwd);
108823
+ } catch {
108824
+ return emit(routed, fail2("invalid_input", `--cwd: cannot enter ${routed.cwd}`));
108825
+ }
108826
+ if (process.env.WORKFLOW_WORKSPACE_ROOT !== undefined) {
108827
+ process.env.WORKFLOW_WORKSPACE_ROOT = routed.cwd;
108828
+ routed.env = process.env;
108829
+ }
108783
108830
  }
108784
- }
108785
- if (options.diagnostics)
108786
- (await Promise.resolve().then(() => (init_diagnostics(), exports_diagnostics))).installDiagnostics(command);
108787
- globalThis[Symbol.for("workit.migrationReporter")] = (report) => io.stderr(`workit: migrated ${report.tasks} task${report.tasks === 1 ? "" : "s"} from ${report.from} to ${report.to} (backup: ${report.backup})
108831
+ if (options.diagnostics)
108832
+ (await Promise.resolve().then(() => (init_diagnostics(), exports_diagnostics))).installDiagnostics(command);
108833
+ globalThis[Symbol.for("workit.migrationReporter")] = (report) => routed.stderr(`workit: migrated ${report.tasks} task${report.tasks === 1 ? "" : "s"} from ${report.from} to ${report.to} (backup: ${report.backup})
108788
108834
  `);
108789
- const verb = await entry.load();
108790
- const runVerb = (target) => guarded(target, () => verb.run(checked.args, target));
108791
- if (!io.json)
108792
- return runVerb(io);
108793
- return runJsonPure(io, command, runVerb);
108794
- }
108835
+ const verb = await entry.load();
108836
+ const runVerb = (target) => guarded(target, () => verb.run(checked.args, target));
108837
+ return routed.json ? runJsonPure(routed, command, runVerb) : runVerb(routed);
108838
+ };
108839
+ if (io.json)
108840
+ return route(io);
108841
+ const verbWord = firstWord(verbArgs);
108842
+ const outcome = verbWord ? OUTCOMES2[`${entry.name} ${verbWord}`] : undefined;
108843
+ return withFailureLine(io, command, route, outcome);
108844
+ }
108845
+ var OUTCOMES2 = {
108846
+ "pr merge": "PR not merged",
108847
+ "pr create": "PR not created",
108848
+ "stack land": "stack not landed",
108849
+ "git push": "not pushed"
108850
+ };
108795
108851
  async function guarded(io, run) {
108796
108852
  try {
108797
108853
  return await run();
@@ -108895,7 +108951,9 @@ var describe4 = (entry) => ({
108895
108951
  });
108896
108952
  var unknown2 = (io, command) => emit(io, fail2("invalid_input", `unknown command "${command}"`, { unblock: commandUnblock(command) }));
108897
108953
  if (__require.main == __require.module) {
108898
- process.exit(await main(process.argv.slice(2), {}, { diagnostics: true }));
108954
+ const code = await main(process.argv.slice(2), {}, { diagnostics: true });
108955
+ await flushStreams();
108956
+ process.exit(code);
108899
108957
  }
108900
108958
  export {
108901
108959
  main,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-cli",
3
- "version": "8.40.0",
3
+ "version": "8.40.1",
4
4
  "private": false,
5
5
  "description": "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
6
6
  "keywords": [
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@babel/parser": "7.29.9",
41
- "@brainervirus/workit-cursor": "^8.40.0",
41
+ "@brainervirus/workit-cursor": "^8.40.1",
42
42
  "@inkjs/ui": "2.0.0",
43
43
  "ink": "7.1.1",
44
44
  "react": "19.2.8"
45
45
  },
46
46
  "devDependencies": {
47
- "@brainervirus/workit-core": "^8.40.0"
47
+ "@brainervirus/workit-core": "^8.40.1"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=24"