@brainervirus/workit-claude-code 8.0.0 → 8.0.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.
package/dist/workit.js CHANGED
@@ -65,7 +65,7 @@ var package_default;
65
65
  var init_package = __esm(() => {
66
66
  package_default = {
67
67
  name: "@brainervirus/workit-cli",
68
- version: "8.0.0",
68
+ version: "8.0.1",
69
69
  private: false,
70
70
  description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
71
71
  keywords: [
@@ -103,9 +103,9 @@ var init_package = __esm(() => {
103
103
  },
104
104
  dependencies: {
105
105
  "@babel/parser": "7.29.9",
106
- "@brainervirus/workit-core": "^8.0.0",
107
- "@brainervirus/workit-cursor": "^8.0.0",
108
- "@brainervirus/workit-opencode": "^8.0.0",
106
+ "@brainervirus/workit-core": "^8.0.1",
107
+ "@brainervirus/workit-cursor": "^8.0.1",
108
+ "@brainervirus/workit-opencode": "^8.0.1",
109
109
  "@inkjs/ui": "2.0.0",
110
110
  ink: "7.1.1",
111
111
  react: "19.2.8"
@@ -165,7 +165,7 @@ var init_output = __esm(() => {
165
165
  };
166
166
  });
167
167
 
168
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/check-config.ts
168
+ // packages/workit-core/src/check-config.ts
169
169
  import { spawnSync } from "node:child_process";
170
170
  import fs from "node:fs";
171
171
  import path from "node:path";
@@ -7974,7 +7974,7 @@ var init_zod = __esm(() => {
7974
7974
  init_external();
7975
7975
  });
7976
7976
 
7977
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/task-contract.ts
7977
+ // packages/workit-core/src/core/task-contract.ts
7978
7978
  import { createHash, randomUUID } from "node:crypto";
7979
7979
  function parseOperation(family, input) {
7980
7980
  if (typeof input === "object" && input !== null && "schemaVersion" in input && input.schemaVersion !== SCHEMA_VERSION)
@@ -8812,7 +8812,7 @@ var init_task_contract = __esm(() => {
8812
8812
  compiledOperationSchemas = Object.fromEntries(OPERATION_FAMILIES.map((family) => [family, compile(operationSchemas[family])]));
8813
8813
  });
8814
8814
 
8815
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/operation-input.ts
8815
+ // packages/workit-core/src/core/operation-input.ts
8816
8816
  function normalizeOperationInput(family, input, host) {
8817
8817
  if (!isObject2(input))
8818
8818
  return input;
@@ -9149,7 +9149,7 @@ var init_operation_input = __esm(() => {
9149
9149
  ]);
9150
9150
  });
9151
9151
 
9152
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/policy/judgment.ts
9152
+ // packages/workit-core/src/core/policy/judgment.ts
9153
9153
  function normalizeJudgment(raw, previous) {
9154
9154
  const input = isObject3(raw) ? raw : {};
9155
9155
  const legacy = Object.keys(input).some((key) => LEGACY_KEYS.has(key));
@@ -9914,7 +9914,7 @@ var init_file_lock = __esm(() => {
9914
9914
  init_file_lock_sync();
9915
9915
  });
9916
9916
 
9917
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/package-root.ts
9917
+ // packages/workit-core/src/core/package-root.ts
9918
9918
  import { existsSync } from "node:fs";
9919
9919
  import path4 from "node:path";
9920
9920
  import { fileURLToPath } from "node:url";
@@ -9933,7 +9933,7 @@ var packageRoot = () => {
9933
9933
  };
9934
9934
  var init_package_root = () => {};
9935
9935
 
9936
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/store/paths.ts
9936
+ // packages/workit-core/src/store/paths.ts
9937
9937
  import { spawnSync as spawnSync2 } from "node:child_process";
9938
9938
  import { createHash as createHash2 } from "node:crypto";
9939
9939
  import fs5 from "node:fs";
@@ -10209,7 +10209,7 @@ var init_paths = __esm(() => {
10209
10209
  ];
10210
10210
  });
10211
10211
 
10212
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/store-lock.ts
10212
+ // packages/workit-core/src/core/store-lock.ts
10213
10213
  import { spawnSync as spawnSync3 } from "node:child_process";
10214
10214
  import fs6 from "node:fs";
10215
10215
  import { hostname } from "node:os";
@@ -10401,7 +10401,7 @@ var init_store_lock = __esm(() => {
10401
10401
  FOREIGN_LOCK_TTL_MS = 10 * 60000;
10402
10402
  });
10403
10403
 
10404
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/store/event-log.ts
10404
+ // packages/workit-core/src/store/event-log.ts
10405
10405
  import { randomUUID as randomUUID2 } from "node:crypto";
10406
10406
  import fs7 from "node:fs";
10407
10407
  import path7 from "node:path";
@@ -10556,7 +10556,7 @@ var init_event_log = __esm(() => {
10556
10556
  TRANSIENT_WINDOWS_CODES = new Set(["EPERM", "EACCES", "EBUSY"]);
10557
10557
  });
10558
10558
 
10559
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/store/patch.ts
10559
+ // packages/workit-core/src/store/patch.ts
10560
10560
  function diff(before, after, path = []) {
10561
10561
  if (equal(before, after))
10562
10562
  return [];
@@ -10662,7 +10662,7 @@ var isPlainObject2 = (value) => typeof value === "object" && value !== null && !
10662
10662
  return false;
10663
10663
  });
10664
10664
 
10665
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/store/reduce.ts
10665
+ // packages/workit-core/src/store/reduce.ts
10666
10666
  import { createHash as createHash3 } from "node:crypto";
10667
10667
  function reduce(state, event, blobs) {
10668
10668
  const data = event.data;
@@ -10788,7 +10788,7 @@ var init_reduce = __esm(() => {
10788
10788
  ]);
10789
10789
  });
10790
10790
 
10791
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/store/notes.ts
10791
+ // packages/workit-core/src/store/notes.ts
10792
10792
  var SLOT, reportMigration = (report) => {
10793
10793
  try {
10794
10794
  const reporter = globalThis[SLOT];
@@ -10800,7 +10800,7 @@ var init_notes = __esm(() => {
10800
10800
  SLOT = Symbol.for("workit.migrationReporter");
10801
10801
  });
10802
10802
 
10803
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/task-store.ts
10803
+ // packages/workit-core/src/core/task-store.ts
10804
10804
  import { createHash as createHash4, randomUUID as randomUUID3 } from "node:crypto";
10805
10805
  import * as fs8 from "node:fs";
10806
10806
  import path8 from "node:path";
@@ -12427,13 +12427,13 @@ var init_task_store = __esm(() => {
12427
12427
  heldInProcess = new Map;
12428
12428
  });
12429
12429
 
12430
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/workers.ts
12430
+ // packages/workit-core/src/core/workers.ts
12431
12431
  var UNCERTAIN_WORKER_STATES, isUncertainWorker = (state) => UNCERTAIN_WORKER_STATES.includes(state), workerBlocksTransition = (transition, state) => transition === "pause" ? false : isUncertainWorker(state);
12432
12432
  var init_workers = __esm(() => {
12433
12433
  UNCERTAIN_WORKER_STATES = ["dispatching", "running", "cancelling", "unknown"];
12434
12434
  });
12435
12435
 
12436
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/git/rev.ts
12436
+ // packages/workit-core/src/git/rev.ts
12437
12437
  import { spawnSync as spawnSync4 } from "node:child_process";
12438
12438
  import { createHash as createHash5 } from "node:crypto";
12439
12439
  import fs9 from "node:fs";
@@ -12964,7 +12964,7 @@ var init_rev = __esm(() => {
12964
12964
  };
12965
12965
  });
12966
12966
 
12967
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/ledger.ts
12967
+ // packages/workit-core/src/ledger.ts
12968
12968
  import { spawnSync as spawnSync5 } from "node:child_process";
12969
12969
  import { createHash as createHash6, randomBytes as randomBytes2 } from "node:crypto";
12970
12970
  import fs10 from "node:fs";
@@ -13267,7 +13267,7 @@ function authorSessions(cwd, rows, branch, range = { base: null, head: null }) {
13267
13267
  sessions.add(session);
13268
13268
  return sessions;
13269
13269
  }
13270
- function effectiveOf(rows, authors) {
13270
+ function effectiveOf(rows, authors, sameCode) {
13271
13271
  let effective = null;
13272
13272
  for (const row of rows) {
13273
13273
  if (!effective) {
@@ -13278,7 +13278,7 @@ function effectiveOf(rows, authors) {
13278
13278
  const effIndependent = independenceReasons(effective, authors).length === 0;
13279
13279
  if (effIndependent && !rowIndependent)
13280
13280
  continue;
13281
- if (effIndependent && FAILING.has(String(effective.result)) && row.actor.session === effective.actor.session)
13281
+ if (effIndependent && FAILING.has(String(effective.result)) && row.actor.session === effective.actor.session && sameCode(effective, row))
13282
13282
  continue;
13283
13283
  effective = row;
13284
13284
  }
@@ -13309,16 +13309,22 @@ function checkVerdicts(cwd, branch, rows) {
13309
13309
  const head = branchHead(cwd, branch);
13310
13310
  const fallbackBase = defaultBase(cwd);
13311
13311
  const keyCache = new Map;
13312
- const keyFor = (base) => {
13313
- if (!base || !head)
13312
+ const keysAt = (base, at) => {
13313
+ if (!base || !at)
13314
13314
  return { patchId: null, diffHash: null };
13315
- let key = keyCache.get(base);
13315
+ const cacheKey = `${base}\x00${at}`;
13316
+ let key = keyCache.get(cacheKey);
13316
13317
  if (!key) {
13317
- key = { patchId: patchId(cwd, base, head), diffHash: diffHash(cwd, base, head) };
13318
- keyCache.set(base, key);
13318
+ key = { patchId: patchId(cwd, base, at), diffHash: diffHash(cwd, base, at) };
13319
+ keyCache.set(cacheKey, key);
13319
13320
  }
13320
13321
  return key;
13321
13322
  };
13323
+ const keyFor = (base) => keysAt(base, head);
13324
+ const sameCode = (failed, row) => verdictBasis(failed, {
13325
+ head: row.head,
13326
+ ...keysAt(failed.base ?? fallbackBase, row.head)
13327
+ }) !== "stale" || restackCarries(rows, branch, failed.head, row.head);
13322
13328
  const authors = authorSessions(cwd, rows, branch, { base: fallbackBase, head });
13323
13329
  const byKind = new Map;
13324
13330
  for (const row of rows)
@@ -13328,7 +13334,7 @@ function checkVerdicts(cwd, branch, rows) {
13328
13334
  }
13329
13335
  const verdicts = [];
13330
13336
  for (const [kind, list] of byKind) {
13331
- const row = effectiveOf(list, authors);
13337
+ const row = effectiveOf(list, authors, sameCode);
13332
13338
  if (!row)
13333
13339
  continue;
13334
13340
  let basis = verdictBasis(row, { head, ...keyFor(row.base ?? fallbackBase) });
@@ -13354,11 +13360,11 @@ function checkVerdicts(cwd, branch, rows) {
13354
13360
  verdicts.sort((a, b) => a.verdict.seq - b.verdict.seq);
13355
13361
  const newestCurrent = verdicts.findLast((entry) => entry.current) ?? verdicts.at(-1) ?? null;
13356
13362
  const failing = verdicts.find((entry) => entry.current && entry.independent && FAILING.has(String(entry.verdict.result)));
13357
- const newestAccepted = verdicts.findLast((entry) => entry.accepted) ?? null;
13363
+ const newestAccepted = verdicts.findLast((entry) => entry.accepted && STRONG_RESULTS.has(String(entry.verdict.result))) ?? null;
13358
13364
  const accepted = newestAccepted && !failing ? { accepted: true, verdict: newestAccepted.verdict, reasons: [] } : {
13359
13365
  accepted: false,
13360
13366
  verdict: failing?.verdict ?? null,
13361
- reasons: failing ? ["failing_verdict"] : newestCurrent?.reasons ?? ["no_verdict"]
13367
+ reasons: failing ? ["failing_verdict"] : !newestCurrent ? ["no_verdict"] : newestCurrent.reasons.length ? newestCurrent.reasons : ["type_check_only"]
13362
13368
  };
13363
13369
  const selfEntry = failing ? undefined : verdicts.findLast((entry) => entry.current && !entry.independent && STRONG_RESULTS.has(String(entry.verdict.result)));
13364
13370
  return {
@@ -13587,6 +13593,9 @@ function summarizeRow(row) {
13587
13593
  case "pr.merged":
13588
13594
  summary = `#${row.pr ?? "?"} ${text("method")} at ${(row.head ?? "?").slice(0, 12)}${text("mergeSha") ? ` -> ${text("mergeSha").slice(0, 12)}` : ""}`;
13589
13595
  break;
13596
+ case "merge.unverified":
13597
+ summary = `#${row.pr ?? "?"} unverified merge requested at ${(row.head ?? "?").slice(0, 12)} (reason: ${text("reason")})`;
13598
+ break;
13590
13599
  case "delivery.verified":
13591
13600
  summary = `${text("expect")} delivered at ${(row.head ?? "?").slice(0, 12)}`;
13592
13601
  break;
@@ -13911,10 +13920,10 @@ var init_ledger = __esm(() => {
13911
13920
  return false;
13912
13921
  }
13913
13922
  };
13914
- OBSERVED_ONLY = new Set(["check", ...PR_ROW_TYPES]);
13923
+ OBSERVED_ONLY = new Set(["check", "merge.unverified", ...PR_ROW_TYPES]);
13915
13924
  });
13916
13925
 
13917
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/policy/derive.ts
13926
+ // packages/workit-core/src/core/policy/derive.ts
13918
13927
  import { existsSync as existsSync3 } from "node:fs";
13919
13928
  import path11 from "node:path";
13920
13929
  function deriveRequirements(judgment, scope, constraints, verification = "self") {
@@ -14102,7 +14111,7 @@ var init_derive = __esm(() => {
14102
14111
  };
14103
14112
  });
14104
14113
 
14105
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/task-evaluation.ts
14114
+ // packages/workit-core/src/core/task-evaluation.ts
14106
14115
  import { createHash as createHash7 } from "node:crypto";
14107
14116
  import * as fs11 from "node:fs";
14108
14117
  import { spawnSync as spawnSync6 } from "node:child_process";
@@ -14750,7 +14759,7 @@ var init_task_evaluation = __esm(() => {
14750
14759
  scopeCovers2 = scopeCovers;
14751
14760
  });
14752
14761
 
14753
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/methods.ts
14762
+ // packages/workit-core/src/core/methods.ts
14754
14763
  function selectMethods(policy, capabilities) {
14755
14764
  return Object.entries(METHODS).flatMap(([id, definition]) => {
14756
14765
  const requirements = policy.requirements.filter((requirement) => methodMatches(definition, requirement));
@@ -14797,7 +14806,7 @@ var init_methods = __esm(() => {
14797
14806
  };
14798
14807
  });
14799
14808
 
14800
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/task-context.ts
14809
+ // packages/workit-core/src/core/task-context.ts
14801
14810
  function reconcileResume(view, observations = []) {
14802
14811
  if (observations.length > 0)
14803
14812
  return failure2("permission_denied", "worker observations require native host verification");
@@ -14910,7 +14919,7 @@ var init_task_context = __esm(() => {
14910
14919
  privateKey = /-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?-----END [^-]*PRIVATE KEY-----/gi;
14911
14920
  });
14912
14921
 
14913
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/commit-flavors.ts
14922
+ // packages/workit-core/src/core/commit-flavors.ts
14914
14923
  var CONVENTIONAL_RE, TICKET_RE, GITMOJI_RE, matchCommitFlavor = (message, flavor, pattern) => {
14915
14924
  const subject = message.split(`
14916
14925
  `, 1)[0] ?? "";
@@ -14961,10 +14970,10 @@ var init_commit_flavors = __esm(() => {
14961
14970
  DETECTABLE = ["conventional", "gitmoji", "ticket-prefix"];
14962
14971
  });
14963
14972
 
14964
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/git.ts
14973
+ // packages/workit-core/src/core/git.ts
14965
14974
  var init_git = () => {};
14966
14975
 
14967
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/boundary.ts
14976
+ // packages/workit-core/src/core/boundary.ts
14968
14977
  var EVENT, errorDetail = (err) => {
14969
14978
  if (err instanceof Error) {
14970
14979
  return { error_name: err.name, error: err.message };
@@ -14987,7 +14996,7 @@ var init_boundary = __esm(() => {
14987
14996
  };
14988
14997
  });
14989
14998
 
14990
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/config.ts
14999
+ // packages/workit-core/src/core/config.ts
14991
15000
  import {
14992
15001
  copyFileSync as copyFileSync2,
14993
15002
  cpSync as cpSync2,
@@ -15156,7 +15165,7 @@ var init_config = __esm(() => {
15156
15165
  ];
15157
15166
  });
15158
15167
 
15159
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/workspaces.ts
15168
+ // packages/workit-core/src/core/workspaces.ts
15160
15169
  import { createHash as createHash8 } from "node:crypto";
15161
15170
  import { readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
15162
15171
  import path14 from "node:path";
@@ -15592,7 +15601,7 @@ var init_workspaces = __esm(() => {
15592
15601
  }).passthrough();
15593
15602
  });
15594
15603
 
15595
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/release-tracks.ts
15604
+ // packages/workit-core/src/core/release-tracks.ts
15596
15605
  import { createHash as createHash9 } from "node:crypto";
15597
15606
  import { spawnSync as spawnSync7 } from "node:child_process";
15598
15607
  import { readFileSync as readFileSync5 } from "node:fs";
@@ -16054,7 +16063,7 @@ var init_release_tracks = __esm(() => {
16054
16063
  memo3 = new Map;
16055
16064
  });
16056
16065
 
16057
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/vcs-config.ts
16066
+ // packages/workit-core/src/core/vcs-config.ts
16058
16067
  import fs12 from "node:fs";
16059
16068
  import path15 from "node:path";
16060
16069
  import { spawnSync as spawnSync8 } from "node:child_process";
@@ -16182,7 +16191,7 @@ var init_vcs_config = __esm(() => {
16182
16191
  init_release_tracks();
16183
16192
  });
16184
16193
 
16185
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/branch.ts
16194
+ // packages/workit-core/src/core/branch.ts
16186
16195
  import { execFileSync } from "node:child_process";
16187
16196
  import { createHash as createHash10 } from "node:crypto";
16188
16197
  import path16 from "node:path";
@@ -16355,12 +16364,12 @@ var init_branch = __esm(() => {
16355
16364
  init_release_tracks();
16356
16365
  });
16357
16366
 
16358
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/route-intent.ts
16367
+ // packages/workit-core/src/core/route-intent.ts
16359
16368
  var init_route_intent = __esm(() => {
16360
16369
  init_branch();
16361
16370
  });
16362
16371
 
16363
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/runtime-identity.ts
16372
+ // packages/workit-core/src/core/runtime-identity.ts
16364
16373
  import { createHash as createHash11 } from "node:crypto";
16365
16374
  import { readFileSync as readFileSync6 } from "node:fs";
16366
16375
  var sha256Hex = (bytes) => createHash11("sha256").update(bytes).digest("hex"), bundleHashOfFile = (file) => {
@@ -16385,7 +16394,7 @@ var init_runtime_identity = __esm(() => {
16385
16394
  ];
16386
16395
  });
16387
16396
 
16388
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/policy-resolver.ts
16397
+ // packages/workit-core/src/core/policy-resolver.ts
16389
16398
  function resolvePolicy(input) {
16390
16399
  const ids = input.constraints.map((constraint) => constraint.id);
16391
16400
  if (new Set(ids).size !== ids.length)
@@ -16445,7 +16454,7 @@ var init_policy_resolver = __esm(() => {
16445
16454
  init_derive();
16446
16455
  });
16447
16456
 
16448
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/safe-write.ts
16457
+ // packages/workit-core/src/core/safe-write.ts
16449
16458
  import { randomUUID as randomUUID4 } from "node:crypto";
16450
16459
  import {
16451
16460
  closeSync as closeSync2,
@@ -16523,7 +16532,7 @@ function writeFileAtomic(file, content, mode) {
16523
16532
  }
16524
16533
  var init_safe_write = () => {};
16525
16534
 
16526
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/autonomy.ts
16535
+ // packages/workit-core/src/autonomy.ts
16527
16536
  import { copyFileSync as copyFileSync3, existsSync as existsSync6 } from "node:fs";
16528
16537
  import os3 from "node:os";
16529
16538
  import path18 from "node:path";
@@ -16656,7 +16665,7 @@ function requireGrant(cwd, kind, options = {}) {
16656
16665
  allowed: true,
16657
16666
  kind,
16658
16667
  source: configured ? autonomy.source : "default",
16659
- requireVerdict: kind === "merge" && value !== true,
16668
+ allowUnverified: kind === "merge" && value === true,
16660
16669
  workspace
16661
16670
  };
16662
16671
  }
@@ -16804,7 +16813,7 @@ var init_autonomy = __esm(() => {
16804
16813
  DEFAULT_ENDPOINTS = ["commit", "pr", "green", "merged"];
16805
16814
  });
16806
16815
 
16807
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/task-engine.ts
16816
+ // packages/workit-core/src/core/task-engine.ts
16808
16817
  import { realpathSync as realpathSync4 } from "node:fs";
16809
16818
 
16810
16819
  class WorkitCore {
@@ -18386,13 +18395,13 @@ var init_task_engine = __esm(() => {
18386
18395
  retryPause = new Int32Array(new SharedArrayBuffer(4));
18387
18396
  });
18388
18397
 
18389
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/repo-context.ts
18398
+ // packages/workit-core/src/core/repo-context.ts
18390
18399
  var init_repo_context = __esm(() => {
18391
18400
  init_vcs_config();
18392
18401
  init_core3();
18393
18402
  });
18394
18403
 
18395
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/pr-body.ts
18404
+ // packages/workit-core/src/forge/pr-body.ts
18396
18405
  function parseGhIssue(value) {
18397
18406
  const m = /issues\/(\d+)/.exec(value);
18398
18407
  return m ? m[1] : String(value).trim().replace(/^#/, "");
@@ -18453,7 +18462,7 @@ var init_pr_body = __esm(() => {
18453
18462
  init_vcs_config();
18454
18463
  });
18455
18464
 
18456
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/pr-create.ts
18465
+ // packages/workit-core/src/core/pr-create.ts
18457
18466
  import path19 from "node:path";
18458
18467
  import { spawnSync as spawnSync9 } from "node:child_process";
18459
18468
  import { pathToFileURL } from "node:url";
@@ -18496,13 +18505,13 @@ var init_pr_create = __esm(() => {
18496
18505
  init_pr_body();
18497
18506
  });
18498
18507
 
18499
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/tracker-issues.ts
18508
+ // packages/workit-core/src/core/tracker-issues.ts
18500
18509
  var init_tracker_issues = __esm(() => {
18501
18510
  init_pr_create();
18502
18511
  init_vcs_config();
18503
18512
  });
18504
18513
 
18505
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/templates.ts
18514
+ // packages/workit-core/src/core/templates.ts
18506
18515
  var repoRoot;
18507
18516
  var init_templates = __esm(() => {
18508
18517
  init_config();
@@ -18510,7 +18519,7 @@ var init_templates = __esm(() => {
18510
18519
  repoRoot = assetRoot();
18511
18520
  });
18512
18521
 
18513
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/scripts.ts
18522
+ // packages/workit-core/src/core/scripts.ts
18514
18523
  var PLUGIN_ROOT, ASSET_ROOT, resolveWorkspaceRoot = (explicit) => explicit || process.cwd();
18515
18524
  var init_scripts = __esm(() => {
18516
18525
  init_package_root();
@@ -18518,7 +18527,7 @@ var init_scripts = __esm(() => {
18518
18527
  ASSET_ROOT = assetRoot();
18519
18528
  });
18520
18529
 
18521
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/youtrack.ts
18530
+ // packages/workit-core/src/core/youtrack.ts
18522
18531
  import fs13 from "node:fs";
18523
18532
  import path20 from "node:path";
18524
18533
  function readYouTrackConfig(required) {
@@ -18990,7 +18999,7 @@ var init_youtrack = __esm(() => {
18990
18999
  };
18991
19000
  });
18992
19001
 
18993
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/context-read.ts
19002
+ // packages/workit-core/src/core/context-read.ts
18994
19003
  var contextReadSchema;
18995
19004
  var init_context_read = __esm(() => {
18996
19005
  init_zod();
@@ -19021,7 +19030,7 @@ var init_context_read = __esm(() => {
19021
19030
  }).strict();
19022
19031
  });
19023
19032
 
19024
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core.ts
19033
+ // packages/workit-core/src/core.ts
19025
19034
  import { existsSync as existsSync7, realpathSync as realpathSync5 } from "node:fs";
19026
19035
  import path21 from "node:path";
19027
19036
  function resolveInside(root, candidate) {
@@ -19123,20 +19132,30 @@ async function parseTaskArgs(argv, deps) {
19123
19132
  const judge = [];
19124
19133
  const seen = new Set;
19125
19134
  for (let i = 2;i < argv.length; i += 1) {
19126
- const token = argv[i];
19135
+ if (argv[i] === "--") {
19136
+ const extra = argv.slice(i + 1);
19137
+ if (extra.length)
19138
+ return parseUsage(`${family} ${actionName} takes no positional arguments (got: ${extra.join(" ")})`, json);
19139
+ break;
19140
+ }
19141
+ const eq = argv[i].startsWith("--") ? argv[i].indexOf("=") : -1;
19142
+ const token = eq > 0 ? argv[i].slice(0, eq) : argv[i];
19143
+ const inline = eq > 0 ? argv[i].slice(eq + 1) : undefined;
19127
19144
  if (family === "policy" && (token === "--judge" || token === "--ref")) {
19128
19145
  if (token === "--ref") {
19129
- const value = argv[++i];
19146
+ const value = inline ?? argv[++i];
19130
19147
  if (value === undefined || !value.trim())
19131
19148
  return parseUsage("--ref requires a value", json);
19132
19149
  judge.push(`ref=${value}`);
19133
19150
  continue;
19134
19151
  }
19152
+ if (inline !== undefined)
19153
+ judge.push(inline);
19135
19154
  while (argv[i + 1] !== undefined && !argv[i + 1].startsWith("--"))
19136
19155
  judge.push(argv[++i]);
19137
19156
  continue;
19138
19157
  }
19139
- if (token === "--json" || token === "--confirm") {
19158
+ if ((token === "--json" || token === "--confirm") && inline === undefined) {
19140
19159
  if (seen.has(token))
19141
19160
  return parseUsage(`duplicate argument: ${token}`, json);
19142
19161
  seen.add(token);
@@ -19145,8 +19164,8 @@ async function parseTaskArgs(argv, deps) {
19145
19164
  continue;
19146
19165
  }
19147
19166
  if (!["--payload", "--task", "--revision", "--workspace-revision", "--view", "--actor"].includes(token))
19148
- return parseUsage(`unknown argument: ${token}`, json);
19149
- const value = argv[++i];
19167
+ return parseUsage(`unknown argument: ${argv[i]}`, json);
19168
+ const value = inline ?? argv[++i];
19150
19169
  if (value === undefined || value.trim() === "" && token !== "--workspace-revision")
19151
19170
  return parseUsage(`${token} requires a value`, json);
19152
19171
  if (seen.has(token))
@@ -19205,6 +19224,12 @@ async function parseHandoffArgs(argv, deps) {
19205
19224
  const seen = new Set;
19206
19225
  for (let i = 0;i < argv.length; i += 1) {
19207
19226
  const token = argv[i];
19227
+ if (token === "--") {
19228
+ const extra = argv.slice(i + 1);
19229
+ if (extra.length)
19230
+ return parseUsage(`handoff takes no positional arguments (got: ${extra.join(" ")})`, json);
19231
+ break;
19232
+ }
19208
19233
  if (token === "--json") {
19209
19234
  if (seen.has(token))
19210
19235
  return parseUsage(`duplicate argument: ${token}`, json);
@@ -19212,14 +19237,18 @@ async function parseHandoffArgs(argv, deps) {
19212
19237
  json = true;
19213
19238
  continue;
19214
19239
  }
19215
- if (token !== "--task")
19240
+ const inline = token.startsWith("--task=") ? token.slice("--task=".length) : undefined;
19241
+ if (token !== "--task" && inline === undefined)
19216
19242
  return parseUsage(`unknown argument: ${token}`, json);
19217
- if (taskId !== undefined || argv[i + 1] === undefined || argv[i + 1].trim() === "")
19243
+ const value = inline ?? argv[i + 1];
19244
+ if (taskId !== undefined || value === undefined || value.trim() === "")
19218
19245
  return parseUsage("--task requires one non-empty value", json);
19219
- if (seen.has(token))
19220
- return parseUsage(`duplicate argument: ${token}`, json);
19221
- seen.add(token);
19222
- taskId = argv[++i];
19246
+ if (seen.has("--task"))
19247
+ return parseUsage("duplicate argument: --task", json);
19248
+ seen.add("--task");
19249
+ taskId = value;
19250
+ if (inline === undefined)
19251
+ i += 1;
19223
19252
  }
19224
19253
  if (!taskId)
19225
19254
  return parseUsage("handoff requires --task <id>", json);
@@ -19406,13 +19435,14 @@ var init_task = __esm(() => {
19406
19435
 
19407
19436
  // packages/workit-cli/src/verbs/task.ts
19408
19437
  function isImplicitTaskForm(argv) {
19409
- const [action, first] = argv;
19438
+ const [action, ...rest] = argv;
19410
19439
  if (!action)
19411
19440
  return false;
19412
19441
  if (IMPLICIT2.has(action))
19413
19442
  return true;
19443
+ const first = rest.find((arg) => arg !== "--json");
19414
19444
  if (action === "start")
19415
- return first !== undefined && !first.startsWith("--");
19445
+ return first !== undefined && (first === "--" || !first.startsWith("--"));
19416
19446
  if (action === "close")
19417
19447
  return !argv.includes("--task") && !argv.includes("--payload");
19418
19448
  return false;
@@ -19421,6 +19451,10 @@ function parse4(argv) {
19421
19451
  const flags = { positionals: [], values: new Map, switches: new Set };
19422
19452
  for (let index = 0;index < argv.length; index += 1) {
19423
19453
  const arg = argv[index];
19454
+ if (arg === "--") {
19455
+ flags.positionals.push(...argv.slice(index + 1));
19456
+ break;
19457
+ }
19424
19458
  const [flag, inline] = arg.startsWith("--") && arg.includes("=") ? arg.split(/=(.*)/su) : [arg];
19425
19459
  if (SWITCHES.has(flag)) {
19426
19460
  flags.switches.add(flag);
@@ -34280,7 +34314,7 @@ function getSgrPrefix(code) {
34280
34314
  if (code.startsWith("›")) {
34281
34315
  return "›";
34282
34316
  }
34283
- return `${ESCAPE}${ANSI_CSI2}`;
34317
+ return `${ESCAPE2}${ANSI_CSI2}`;
34284
34318
  }
34285
34319
  function createSgrCode(prefix, values) {
34286
34320
  return `${prefix}${values.join(";")}${ANSI_SGR_TERMINATOR2}`;
@@ -34289,7 +34323,7 @@ function getSgrFragments(code) {
34289
34323
  const fragments = [];
34290
34324
  const sgrPrefix = getSgrPrefix(code);
34291
34325
  let parameterString;
34292
- if (code.startsWith(`${ESCAPE}${ANSI_CSI2}`)) {
34326
+ if (code.startsWith(`${ESCAPE2}${ANSI_CSI2}`)) {
34293
34327
  parameterString = code.slice(2, -1);
34294
34328
  } else if (code.startsWith("›")) {
34295
34329
  parameterString = code.slice(1, -1);
@@ -34450,7 +34484,7 @@ function parseHyperlinkCode(string, index) {
34450
34484
  endIndex: sequenceIndex + 1
34451
34485
  };
34452
34486
  }
34453
- if (character === ESCAPE && string[sequenceIndex + 1] === ANSI_OSC_TERMINATOR) {
34487
+ if (character === ESCAPE2 && string[sequenceIndex + 1] === ANSI_OSC_TERMINATOR) {
34454
34488
  const code = string.slice(index, sequenceIndex + 2);
34455
34489
  const action = sequenceIndex === uriStart + 1 ? "close" : "open";
34456
34490
  return {
@@ -34533,7 +34567,7 @@ function parseControlStringCode(string, index) {
34533
34567
  if (supportsBellTerminator && string[sequenceIndex] === ANSI_BELL) {
34534
34568
  return createControlParseResult(string.slice(index, sequenceIndex + 1), sequenceIndex + 1);
34535
34569
  }
34536
- if (string[sequenceIndex] === ESCAPE && string[sequenceIndex + 1] === ANSI_OSC_TERMINATOR) {
34570
+ if (string[sequenceIndex] === ESCAPE2 && string[sequenceIndex + 1] === ANSI_OSC_TERMINATOR) {
34537
34571
  return createControlParseResult(string.slice(index, sequenceIndex + 2), sequenceIndex + 2);
34538
34572
  }
34539
34573
  if (string[sequenceIndex] === C1_STRING_TERMINATOR) {
@@ -34758,7 +34792,7 @@ function tokenizeAnsi(string, { endCharacter = Number.POSITIVE_INFINITY } = {})
34758
34792
  }
34759
34793
  return tokens;
34760
34794
  }
34761
- var ESCAPE_CODE_POINT = 27, C1_DCS_CODE_POINT = 144, C1_SOS_CODE_POINT = 152, C1_CSI_CODE_POINT = 155, C1_ST_CODE_POINT = 156, C1_OSC_CODE_POINT = 157, C1_PM_CODE_POINT = 158, C1_APC_CODE_POINT = 159, ESCAPES2, ESCAPE = "\x1B", ANSI_BELL = "\x07", ANSI_CSI2 = "[", ANSI_OSC2 = "]", ANSI_DCS = "P", ANSI_SOS = "X", ANSI_PM = "^", ANSI_APC = "_", ANSI_SGR_TERMINATOR2 = "m", ANSI_OSC_TERMINATOR = "\\", ANSI_STRING_TERMINATOR, C1_OSC = "", C1_STRING_TERMINATOR = "œ", ANSI_HYPERLINK_ESC_PREFIX, ANSI_HYPERLINK_C1_PREFIX, ANSI_HYPERLINK_ESC_CLOSE, ANSI_HYPERLINK_C1_CLOSE, CODE_POINT_0, CODE_POINT_9, CODE_POINT_SEMICOLON, CODE_POINT_COLON, CODE_POINT_CSI_PARAMETER_START, CODE_POINT_CSI_PARAMETER_END, CODE_POINT_CSI_INTERMEDIATE_START, CODE_POINT_CSI_INTERMEDIATE_END, CODE_POINT_CSI_FINAL_START, CODE_POINT_CSI_FINAL_END, REGIONAL_INDICATOR_SYMBOL_LETTER_A = 127462, REGIONAL_INDICATOR_SYMBOL_LETTER_Z = 127487, SGR_RESET_CODE = 0, SGR_EXTENDED_FOREGROUND_CODE = 38, SGR_DEFAULT_FOREGROUND_CODE = 39, SGR_EXTENDED_BACKGROUND_CODE = 48, SGR_DEFAULT_BACKGROUND_CODE = 49, SGR_COLOR_TYPE_ANSI_256 = 5, SGR_COLOR_TYPE_TRUECOLOR = 2, SGR_ANSI_256_FRAGMENT_LENGTH = 3, SGR_TRUECOLOR_FRAGMENT_LENGTH = 5, SGR_ANSI_256_LAST_PARAMETER_OFFSET = 2, SGR_TRUECOLOR_LAST_PARAMETER_OFFSET = 4, VARIATION_SELECTOR_16_CODE_POINT = 65039, COMBINING_ENCLOSING_KEYCAP_CODE_POINT = 8419, EMOJI_PRESENTATION_GRAPHEME_REGEX, GRAPHEME_SEGMENTER, endCodeNumbers;
34795
+ var ESCAPE_CODE_POINT = 27, C1_DCS_CODE_POINT = 144, C1_SOS_CODE_POINT = 152, C1_CSI_CODE_POINT = 155, C1_ST_CODE_POINT = 156, C1_OSC_CODE_POINT = 157, C1_PM_CODE_POINT = 158, C1_APC_CODE_POINT = 159, ESCAPES2, ESCAPE2 = "\x1B", ANSI_BELL = "\x07", ANSI_CSI2 = "[", ANSI_OSC2 = "]", ANSI_DCS = "P", ANSI_SOS = "X", ANSI_PM = "^", ANSI_APC = "_", ANSI_SGR_TERMINATOR2 = "m", ANSI_OSC_TERMINATOR = "\\", ANSI_STRING_TERMINATOR, C1_OSC = "", C1_STRING_TERMINATOR = "œ", ANSI_HYPERLINK_ESC_PREFIX, ANSI_HYPERLINK_C1_PREFIX, ANSI_HYPERLINK_ESC_CLOSE, ANSI_HYPERLINK_C1_CLOSE, CODE_POINT_0, CODE_POINT_9, CODE_POINT_SEMICOLON, CODE_POINT_COLON, CODE_POINT_CSI_PARAMETER_START, CODE_POINT_CSI_PARAMETER_END, CODE_POINT_CSI_INTERMEDIATE_START, CODE_POINT_CSI_INTERMEDIATE_END, CODE_POINT_CSI_FINAL_START, CODE_POINT_CSI_FINAL_END, REGIONAL_INDICATOR_SYMBOL_LETTER_A = 127462, REGIONAL_INDICATOR_SYMBOL_LETTER_Z = 127487, SGR_RESET_CODE = 0, SGR_EXTENDED_FOREGROUND_CODE = 38, SGR_DEFAULT_FOREGROUND_CODE = 39, SGR_EXTENDED_BACKGROUND_CODE = 48, SGR_DEFAULT_BACKGROUND_CODE = 49, SGR_COLOR_TYPE_ANSI_256 = 5, SGR_COLOR_TYPE_TRUECOLOR = 2, SGR_ANSI_256_FRAGMENT_LENGTH = 3, SGR_TRUECOLOR_FRAGMENT_LENGTH = 5, SGR_ANSI_256_LAST_PARAMETER_OFFSET = 2, SGR_TRUECOLOR_LAST_PARAMETER_OFFSET = 4, VARIATION_SELECTOR_16_CODE_POINT = 65039, COMBINING_ENCLOSING_KEYCAP_CODE_POINT = 8419, EMOJI_PRESENTATION_GRAPHEME_REGEX, GRAPHEME_SEGMENTER, endCodeNumbers;
34762
34796
  var init_tokenize_ansi = __esm(() => {
34763
34797
  init_ansi_styles();
34764
34798
  init_is_fullwidth_code_point();
@@ -34772,8 +34806,8 @@ var init_tokenize_ansi = __esm(() => {
34772
34806
  C1_PM_CODE_POINT,
34773
34807
  C1_APC_CODE_POINT
34774
34808
  ]);
34775
- ANSI_STRING_TERMINATOR = `${ESCAPE}${ANSI_OSC_TERMINATOR}`;
34776
- ANSI_HYPERLINK_ESC_PREFIX = `${ESCAPE}${ANSI_OSC2}8;`;
34809
+ ANSI_STRING_TERMINATOR = `${ESCAPE2}${ANSI_OSC_TERMINATOR}`;
34810
+ ANSI_HYPERLINK_ESC_PREFIX = `${ESCAPE2}${ANSI_OSC2}8;`;
34777
34811
  ANSI_HYPERLINK_C1_PREFIX = `${C1_OSC}8;`;
34778
34812
  ANSI_HYPERLINK_ESC_CLOSE = `${ANSI_HYPERLINK_ESC_PREFIX};`;
34779
34813
  ANSI_HYPERLINK_C1_CLOSE = `${ANSI_HYPERLINK_C1_PREFIX};`;
@@ -62177,7 +62211,7 @@ var init_build3 = __esm(async () => {
62177
62211
  init_types();
62178
62212
  });
62179
62213
 
62180
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/gitignore.ts
62214
+ // packages/workit-core/src/core/gitignore.ts
62181
62215
  var GITIGNORE_ENTRIES;
62182
62216
  var init_gitignore = __esm(() => {
62183
62217
  GITIGNORE_ENTRIES = [
@@ -62198,7 +62232,7 @@ var init_gitignore = __esm(() => {
62198
62232
  ];
62199
62233
  });
62200
62234
 
62201
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/changelog.ts
62235
+ // packages/workit-core/src/core/changelog.ts
62202
62236
  import fs16 from "node:fs";
62203
62237
  import path23 from "node:path";
62204
62238
  import { createHash as createHash12 } from "node:crypto";
@@ -62527,7 +62561,7 @@ var init_changelog = __esm(() => {
62527
62561
  HEADING_RE = /^###\s+/;
62528
62562
  });
62529
62563
 
62530
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/hygiene.ts
62564
+ // packages/workit-core/src/core/hygiene.ts
62531
62565
  import { existsSync as existsSync9, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
62532
62566
  import path24 from "node:path";
62533
62567
  var repoRoot2, templatesDir = () => path24.join(repoRoot2, "templates", "hygiene"), packageJson = (root) => {
@@ -62732,7 +62766,7 @@ var init_registration = __esm(() => {
62732
62766
  CURSOR_HOOK_RUN_COMMAND = `npx -y --prefer-online --min-release-age=0 --package=${CURSOR_RUNTIME_PACKAGE} workit-cursor-hook`;
62733
62767
  });
62734
62768
 
62735
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/support-matrix.ts
62769
+ // packages/workit-core/src/core/support-matrix.ts
62736
62770
  var SUPPORT_MATRIX;
62737
62771
  var init_support_matrix = __esm(() => {
62738
62772
  SUPPORT_MATRIX = {
@@ -63176,7 +63210,7 @@ var init_host_install = __esm(() => {
63176
63210
  CLAUDE_SCOPES = new Set(["user", "project", "local"]);
63177
63211
  });
63178
63212
 
63179
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/skill-manifests.ts
63213
+ // packages/workit-core/src/core/skill-manifests.ts
63180
63214
  import { cpSync as cpSync3, existsSync as existsSync12, readFileSync as readFileSync12, readdirSync as readdirSync5, statSync as statSync3, writeFileSync as writeFileSync5 } from "node:fs";
63181
63215
  import path28 from "node:path";
63182
63216
  var WORKIT_METHOD_SKILLS, skillManifestNames = (root) => existsSync12(root) ? readdirSync5(root).filter((name) => existsSync12(path28.join(root, name, "SKILL.md"))).toSorted() : [], validateSkillManifests = (root, expected, label) => {
@@ -65439,7 +65473,7 @@ var init_setup = __esm(() => {
65439
65473
  SETUP_OVERRIDES = [...YT_OVERRIDES, ...VCS_OVERRIDES];
65440
65474
  });
65441
65475
 
65442
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/branch-policy.ts
65476
+ // packages/workit-core/src/core/branch-policy.ts
65443
65477
  import { spawnSync as spawnSync12 } from "node:child_process";
65444
65478
  var PREFIXES, detectBranchPolicy = (workspaceRoot) => {
65445
65479
  const branchExists = (name) => {
@@ -65502,7 +65536,7 @@ var init_branch_policy = __esm(() => {
65502
65536
  };
65503
65537
  });
65504
65538
 
65505
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/workspace-branch-policy.ts
65539
+ // packages/workit-core/src/core/workspace-branch-policy.ts
65506
65540
  import { mkdirSync as mkdirSync6, readFileSync as readFileSync15, renameSync as renameSync4, rmSync as rmSync4, writeFileSync as writeFileSync8 } from "node:fs";
65507
65541
  import path31 from "node:path";
65508
65542
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
@@ -68980,7 +69014,7 @@ var init_steps = __esm(async () => {
68980
69014
  ];
68981
69015
  });
68982
69016
 
68983
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/logger.ts
69017
+ // packages/workit-core/src/core/logger.ts
68984
69018
  import { appendFileSync, mkdirSync as mkdirSync7, readdirSync as readdirSync7, unlinkSync as unlinkSync3 } from "node:fs";
68985
69019
  import os11 from "node:os";
68986
69020
  import path34 from "node:path";
@@ -69988,7 +70022,7 @@ var init_launch = __esm(() => {
69988
70022
  init_upgrade();
69989
70023
  });
69990
70024
 
69991
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/knowledge.ts
70025
+ // packages/workit-core/src/knowledge.ts
69992
70026
  import { spawnSync as spawnSync14 } from "node:child_process";
69993
70027
  import fs17 from "node:fs";
69994
70028
  import path36 from "node:path";
@@ -70385,7 +70419,7 @@ var init_doctor2 = __esm(() => {
70385
70419
  init_task();
70386
70420
  });
70387
70421
 
70388
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/redact.ts
70422
+ // packages/workit-core/src/forge/redact.ts
70389
70423
  function redactText(value) {
70390
70424
  let out = stripAnsi2(value).replace(PRIVATE_KEY, "[REDACTED PRIVATE KEY]");
70391
70425
  out = out.replace(WEBHOOK, `$1/${R}`);
@@ -70488,7 +70522,7 @@ var init_redact = __esm(() => {
70488
70522
  NOT_FIRST_ERROR = /^\s*(?:\(pass\)|\(skip\)|\(todo\)|✓|✔|ok\b|PASS\b)|^\s*\d+ fail\b|##\[error\]Process completed|^\s*0 (?:errors?|fail)/u;
70489
70523
  });
70490
70524
 
70491
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/checks.ts
70525
+ // packages/workit-core/src/checks.ts
70492
70526
  import { spawn, spawnSync as spawnSync15 } from "node:child_process";
70493
70527
  import { createHash as createHash14 } from "node:crypto";
70494
70528
  import fs18 from "node:fs";
@@ -71015,18 +71049,14 @@ async function change(verb, argv, io, deps) {
71015
71049
  ]);
71016
71050
  }
71017
71051
  async function runGrant(argv, io, deps = defaultDeps) {
71018
- const [sub, ...rest] = argv;
71052
+ const end = argv.indexOf("--");
71053
+ const [sub, ...rest] = end < 0 ? argv : [...argv.slice(0, end), ...argv.slice(end + 1)];
71019
71054
  if (sub === "show")
71020
71055
  return show(rest, io);
71021
- if (sub === undefined || sub.startsWith("--") && sub !== "--help")
71056
+ if (sub === undefined || sub.startsWith("--"))
71022
71057
  return show(argv, io);
71023
71058
  if (sub === "set" || sub === "unset")
71024
71059
  return change(sub, rest, io, deps);
71025
- if (sub === "--help" || sub === "-h") {
71026
- io.stdout(`usage: ${USAGE2}
71027
- `);
71028
- return 0;
71029
- }
71030
71060
  return usage2(io, `unknown subcommand "${sub}"`);
71031
71061
  }
71032
71062
  var USAGE2 = "workit grant show [<workspace>] [--all] | grant set <workspace> <kind>=<true|false|verified>… [defaultEndpoint=commit|pr|green|merged] [verification=self|independent] | grant unset <workspace> <kind>… (kinds: push, pr, merge, release, rerun, defaultEndpoint, verification)", AGENT_ENV, agentMarker = (env) => AGENT_ENV.find((name) => env[name]) ?? Object.keys(env).find((name) => name.startsWith("CODEX_") && env[name]), defaultDeps, parseValue = (raw) => raw === "true" || raw === "yes" || raw === "on" ? true : raw === "false" || raw === "no" || raw === "off" ? false : raw === "verified" ? "verified" : null, STOPS_AT, endpointLabel = (view) => view.effectiveEndpoint === view.defaultEndpoint ? view.defaultEndpoint : `${view.defaultEndpoint} (effective: ${view.effectiveEndpoint}${view.endpointReason ? `, ${view.endpointReason}` : ""})`, describe2 = (grants, configured, endpoint, verification) => [
@@ -71390,10 +71420,10 @@ var init_check = __esm(() => {
71390
71420
  FINGERPRINT_VARS = ["CI", "NODE_ENV", "npm_config_script_shell", "NODE_OPTIONS", "SHELL"];
71391
71421
  });
71392
71422
 
71393
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/types.ts
71423
+ // packages/workit-core/src/forge/types.ts
71394
71424
  var success2 = (data) => ({ ok: true, data }), failure3 = (code, error, unblock) => ({ ok: false, code, error, ...unblock ? { unblock } : {} });
71395
71425
 
71396
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/git/ops.ts
71426
+ // packages/workit-core/src/git/ops.ts
71397
71427
  import { spawnSync as spawnSync16 } from "node:child_process";
71398
71428
  function dirtEntries(cwd) {
71399
71429
  const run = git5(cwd, ["status", "--porcelain=v1", "-z", "--untracked-files=all"]);
@@ -71773,7 +71803,7 @@ var init_ops = __esm(() => {
71773
71803
  SHA = /^[0-9a-f]{40,64}$/u;
71774
71804
  });
71775
71805
 
71776
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/reruns.ts
71806
+ // packages/workit-core/src/forge/reruns.ts
71777
71807
  import fs19 from "node:fs";
71778
71808
  import path39 from "node:path";
71779
71809
  function rerunLogPath(cwd) {
@@ -71864,7 +71894,7 @@ var init_reruns = __esm(() => {
71864
71894
  init_rev();
71865
71895
  });
71866
71896
 
71867
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/report.ts
71897
+ // packages/workit-core/src/forge/report.ts
71868
71898
  function gatingChecks(status) {
71869
71899
  const required = status.checks.filter((check) => check.required === true);
71870
71900
  const protectionNamesChecks = (status.requiredContexts?.length ?? 0) > 0;
@@ -72218,7 +72248,7 @@ var init_report = __esm(() => {
72218
72248
  GITHUB_MERGEABLE = new Set(["clean", "unstable", "has_hooks"]);
72219
72249
  });
72220
72250
 
72221
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/pr-ops.ts
72251
+ // packages/workit-core/src/forge/pr-ops.ts
72222
72252
  import { spawnSync as spawnSync17 } from "node:child_process";
72223
72253
  function fillFromCommits(cwd, resolved, base) {
72224
72254
  const tracking = `refs/remotes/${resolved.baseRemote}/${base}`;
@@ -72339,13 +72369,19 @@ async function createPullRequest(cwd, resolved, input, sleep) {
72339
72369
  head: sha,
72340
72370
  created,
72341
72371
  draft: input.draft,
72342
- recorded: row.ok ? { id: String(row.value.id) } : { error: row.error }
72372
+ recorded: row.ok ? { id: String(row.value.id) } : { error: row.error },
72373
+ next: createNext(cwd)
72343
72374
  });
72344
72375
  }
72345
72376
  async function mergePullRequest(cwd, resolved, input, sleep) {
72346
72377
  const grant = requireGrant(cwd, "merge");
72347
72378
  if (!grant.allowed)
72348
72379
  return refuse(grant.error, grant.unblock, { reason: "grant_required" });
72380
+ const bypass = input.unverified ?? null;
72381
+ if (bypass && !bypass.reason.trim())
72382
+ return failure3("invalid_input", "--unverified needs --reason <why the user asked for it>");
72383
+ if (bypass && !grant.allowUnverified)
72384
+ return refuse(`unverified_refused: workspace ${grant.workspace ? `"${grant.workspace}"` : "(none)"} grants merge: "verified", which never merges without an accepted independent verdict`, "a non-author session verifies the head (workit-review), then merge without --unverified", { reason: "unverified_refused" });
72349
72385
  const number = selectPr(cwd, resolved, { pr: input.pr });
72350
72386
  if (!number.ok)
72351
72387
  return number;
@@ -72379,27 +72415,40 @@ async function mergePullRequest(cwd, resolved, input, sleep) {
72379
72415
  if (reason)
72380
72416
  return refuse(`protected_branch: --delete-branch would delete ${branch}, which ${reason}; workit never deletes it`, `workit pr merge${input.pr ? ` --pr ${doc.number}` : ""} --method ${input.method} # without --delete-branch`, { reason: "protected_branch" });
72381
72417
  }
72418
+ const ledger = readLedger(cwd);
72419
+ if (!ledger.ok)
72420
+ return ledger;
72421
+ const check = checkVerdicts(cwd, branch, ledger.value.rows);
72422
+ const summary = { head: check.head, accepted: check.accepted, authors: check.authors };
72423
+ const covered = check.head === head && check.accepted.accepted;
72382
72424
  let verdict = {
72383
- required: grant.requireVerdict,
72384
- accepted: false,
72385
- verdictId: null
72425
+ required: true,
72426
+ accepted: covered,
72427
+ verdictId: covered && typeof check.accepted.verdict?.id === "string" ? check.accepted.verdict.id : null
72386
72428
  };
72387
- if (grant.requireVerdict) {
72388
- const ledger = readLedger(cwd);
72389
- if (!ledger.ok)
72390
- return ledger;
72391
- const check = checkVerdicts(cwd, branch, ledger.value.rows);
72392
- const summary = { head: check.head, accepted: check.accepted, authors: check.authors };
72393
- if (check.head !== head)
72394
- return refuse(`head_mismatch: the verdict check reads ${branch} at ${check.head?.slice(0, 12) ?? "(missing)"} but ${label} is at ${head.slice(0, 12)}`, `git fetch && git switch ${branch} && git merge --ff-only @{u} # then re-verify that head`, { reason: "head_mismatch", verdict: summary });
72395
- if (!check.accepted.accepted)
72396
- return refuse(`NEEDS_VERDICT: ${label} has no accepted independent verdict for ${head.slice(0, 12)} (${check.accepted.reasons.join(", ")})`, `an independent session verifies the head and runs: workit ledger verdict verified --how "<what was exercised>" --branch ${branch}`, { reason: "needs_verdict", verdict: summary });
72397
- verdict = {
72398
- required: true,
72399
- accepted: true,
72400
- verdictId: typeof check.accepted.verdict?.id === "string" ? check.accepted.verdict.id : null
72401
- };
72402
- }
72429
+ let unverified = null;
72430
+ if (!covered && bypass && check.accepted.reasons.includes("failing_verdict"))
72431
+ return refuse(`failed_verdict: ${label} has a current independent failed verdict${typeof check.accepted.verdict?.id === "string" ? ` (${check.accepted.verdict.id})` : ""}; --unverified never merges over a rejection`, "a new independent verdict on the head supersedes it", { reason: "failed_verdict", verdict: summary });
72432
+ if (!covered && bypass) {
72433
+ const reason = bypass.reason.trim();
72434
+ const recorded = appendObserved(cwd, {
72435
+ type: "merge.unverified",
72436
+ actor: input.actor,
72437
+ branch,
72438
+ head,
72439
+ pr: doc.number,
72440
+ base: doc.base,
72441
+ reason,
72442
+ grant: grant.source
72443
+ });
72444
+ if (!recorded.ok)
72445
+ return failure3("failed", `unverified_unrecorded: the --unverified bypass could not be recorded (${recorded.error}); nothing was merged`);
72446
+ verdict = { required: false, accepted: false, verdictId: null };
72447
+ unverified = { reason, recorded: String(recorded.value.id) };
72448
+ } else if (check.head !== head)
72449
+ return refuse(`head_mismatch: the verdict check reads ${branch} at ${check.head?.slice(0, 12) ?? "(missing)"} but ${label} is at ${head.slice(0, 12)}`, `git fetch && git switch ${branch} && git merge --ff-only @{u} # then re-verify that head`, { reason: "head_mismatch", verdict: summary });
72450
+ else if (!covered)
72451
+ return refuse(`NEEDS_VERDICT: ${label} has no accepted independent verdict for ${head.slice(0, 12)} (${check.accepted.reasons.join(", ")})`, `an independent session verifies the head and runs: workit ledger verdict verified --how "<what was exercised>" --branch ${branch}${grant.allowUnverified ? `; or, only if the user asks to merge unverified: workit pr merge --unverified --reason "<why>"` : ""}`, { reason: "needs_verdict", verdict: summary });
72403
72452
  const merged = resolved.forge.merge(doc.number, { sha: head, method: input.method });
72404
72453
  if (!merged.ok)
72405
72454
  return merged;
@@ -72437,6 +72486,7 @@ async function mergePullRequest(cwd, resolved, input, sleep) {
72437
72486
  mergeSha: merged.data.mergeSha,
72438
72487
  method: input.method,
72439
72488
  verdictId: verdict.verdictId,
72489
+ ...unverified ? { unverified: unverified.recorded } : {},
72440
72490
  grant: grant.source
72441
72491
  });
72442
72492
  return {
@@ -72450,6 +72500,7 @@ async function mergePullRequest(cwd, resolved, input, sleep) {
72450
72500
  method: input.method,
72451
72501
  mergeSha: merged.data.mergeSha,
72452
72502
  verdict,
72503
+ unverified,
72453
72504
  grant: { source: grant.source },
72454
72505
  deletedBranch,
72455
72506
  recorded: row.ok ? { id: String(row.value.id) } : { error: row.error },
@@ -72458,7 +72509,10 @@ async function mergePullRequest(cwd, resolved, input, sleep) {
72458
72509
  }
72459
72510
  };
72460
72511
  }
72461
- var VERIFY_DELAYS_MS, noun = (resolved) => resolved.forge.kind === "github" ? "pull request" : "merge request", grantBlocked = (decision) => failure3("blocked", decision.error, decision.unblock), mergeBackFor = (cwd, base) => {
72512
+ var VERIFY_DELAYS_MS, noun = (resolved) => resolved.forge.kind === "github" ? "pull request" : "merge request", grantBlocked = (decision) => failure3("blocked", decision.error, decision.unblock), AFTER_REVIEW, createNext = (cwd) => {
72513
+ const endpoint = resolveAutonomy(cwd).effectiveEndpoint;
72514
+ return `a non-author verifies the head (workit-review); the endpoint is ${endpoint}, so ${AFTER_REVIEW[endpoint]}`;
72515
+ }, mergeBackFor = (cwd, base) => {
72462
72516
  try {
72463
72517
  const owners = workspaceReleaseTracks(cwd).tracks.filter((track) => track.productionBranch === base);
72464
72518
  if (owners.length !== 1)
@@ -72487,6 +72541,12 @@ var init_pr_ops = __esm(() => {
72487
72541
  init_ledger();
72488
72542
  init_report();
72489
72543
  VERIFY_DELAYS_MS = [1000, 2000, 4000];
72544
+ AFTER_REVIEW = {
72545
+ commit: "stop here; review comes when the user asks",
72546
+ pr: "stop here; review comes when the user asks",
72547
+ green: "babysit it to merge-ready, never merging",
72548
+ merged: "babysit it, then land it after verification"
72549
+ };
72490
72550
  NEXT_HINTS = {
72491
72551
  RESOLVE_CONFLICTS: "rebase onto the base, resolve, then workit git push --force-with-lease",
72492
72552
  REBASE: "rebase onto the base, then workit git push --force-with-lease",
@@ -72501,7 +72561,7 @@ var init_pr_ops = __esm(() => {
72501
72561
  };
72502
72562
  });
72503
72563
 
72504
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/exec.ts
72564
+ // packages/workit-core/src/forge/exec.ts
72505
72565
  import { spawnSync as spawnSync18 } from "node:child_process";
72506
72566
  import fs20 from "node:fs";
72507
72567
  import path40 from "node:path";
@@ -72619,7 +72679,7 @@ var init_exec = __esm(() => {
72619
72679
  MAX_BUFFER2 = 64 * 1024 * 1024;
72620
72680
  });
72621
72681
 
72622
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/github.ts
72682
+ // packages/workit-core/src/forge/github.ts
72623
72683
  function checkFromContext(node) {
72624
72684
  const required = node.isRequired ?? null;
72625
72685
  if (node.__typename === "StatusContext") {
@@ -72918,7 +72978,7 @@ var init_github = __esm(() => {
72918
72978
  ]);
72919
72979
  });
72920
72980
 
72921
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/gitlab.ts
72981
+ // packages/workit-core/src/forge/gitlab.ts
72922
72982
  function checkFromBridge(bridge, pipelineId, scope) {
72923
72983
  const status = bridge.downstream_pipeline?.status ?? bridge.status;
72924
72984
  const allow = bridge.allow_failure === true;
@@ -73206,7 +73266,7 @@ var init_gitlab = __esm(() => {
73206
73266
  UNSETTLED = new Set(["checking", "unchecked", "preparing", "approvals_syncing"]);
73207
73267
  });
73208
73268
 
73209
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/resolve.ts
73269
+ // packages/workit-core/src/forge/resolve.ts
73210
73270
  import fs21 from "node:fs";
73211
73271
  function resolveForge(cwd, options = {}) {
73212
73272
  let workspace;
@@ -73326,7 +73386,7 @@ var init_resolve = __esm(() => {
73326
73386
  init_gitlab();
73327
73387
  });
73328
73388
 
73329
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/duration.ts
73389
+ // packages/workit-core/src/duration.ts
73330
73390
  function parseDuration2(value) {
73331
73391
  const text = value.trim().toLowerCase();
73332
73392
  if (/^\d+(?:\.\d+)?$/u.test(text))
@@ -73358,6 +73418,10 @@ function parseFlags(argv, spec) {
73358
73418
  const parsed = { values: {}, booleans: new Set, lists: {}, positionals: [] };
73359
73419
  for (let index = 0;index < argv.length; index += 1) {
73360
73420
  const arg = argv[index];
73421
+ if (arg === "--") {
73422
+ parsed.positionals.push(...argv.slice(index + 1));
73423
+ break;
73424
+ }
73361
73425
  if (arg === "--json")
73362
73426
  continue;
73363
73427
  if (!arg.startsWith("--")) {
@@ -74074,7 +74138,7 @@ var init_git2 = __esm(() => {
74074
74138
  init_forge_common();
74075
74139
  });
74076
74140
 
74077
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/forge/verify.ts
74141
+ // packages/workit-core/src/forge/verify.ts
74078
74142
  import { spawnSync as spawnSync19 } from "node:child_process";
74079
74143
  function finish(cwd, report, actor) {
74080
74144
  const delivered = report.observations.length > 0 && report.observations.every((entry) => entry.ok);
@@ -74394,7 +74458,7 @@ var init_verify_delivery = __esm(() => {
74394
74458
  };
74395
74459
  });
74396
74460
 
74397
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/stack.ts
74461
+ // packages/workit-core/src/stack.ts
74398
74462
  import { spawnSync as spawnSync20 } from "node:child_process";
74399
74463
  import { createHash as createHash15, randomBytes as randomBytes3 } from "node:crypto";
74400
74464
  import fs22 from "node:fs";
@@ -74969,7 +75033,7 @@ function repoMismatch(ctx, stack) {
74969
75033
  return stackFail("blocked", `repo_mismatch: stack ${stack.name} was planned on ${stack.forge ?? "?"} ${stack.repo ?? "?"}, but this checkout resolves to ${kind} ${repo}`, `workit stack plan --name ${stack.name} <branch…> # re-plan it here, or run from the right checkout`, { planned: { forge: stack.forge, repo: stack.repo }, resolved: { forge: kind, repo } });
74970
75034
  return null;
74971
75035
  }
74972
- function qualify(ctx, stack, entry, doc, verdict, grant, binding = null) {
75036
+ function qualify(ctx, stack, entry, doc, verdict, grant, binding = null, bypass = false) {
74973
75037
  const label = entry.pr ? noun2(ctx.resolved, entry.pr) : entry.branch;
74974
75038
  const stop = (reason, detail, unblock, ready = false) => ({
74975
75039
  ok: false,
@@ -74988,9 +75052,11 @@ function qualify(ctx, stack, entry, doc, verdict, grant, binding = null) {
74988
75052
  return stop("base_not_trunk", `${label} targets ${doc.base}, not ${stack.trunk}`, "workit stack sync");
74989
75053
  if (doc.next !== "READY")
74990
75054
  return stop("not_ready", `${label} is ${doc.next}${doc.blockers.length ? ` (${doc.blockers.join(", ")})` : ""}`, doc.next === "WAITING_CI" ? `workit ci wait --pr ${entry.pr}` : `workit pr status --pr ${entry.pr}`);
74991
- const requireVerdict = grant.allowed ? grant.requireVerdict : true;
74992
- if (requireVerdict && !verdict.accepted)
74993
- return stop(verdict.reasons.includes("no_verdict") ? "no_verdict" : "needs_verdict", `${label} has no accepted independent verdict for ${doc.head.sha.slice(0, 12)} (${verdict.reasons.join(", ") || "none"})`, `an independent session verifies ${entry.branch} and runs: workit ledger verdict verified --how "<what was exercised>" --branch ${entry.branch}`);
75055
+ const allowUnverified = grant.allowed && grant.allowUnverified;
75056
+ if (bypass && allowUnverified && verdict.reasons.includes("failing_verdict"))
75057
+ return stop("failed_verdict", `${label} has a current independent failed verdict for ${doc.head.sha.slice(0, 12)}; --unverified never lands over a rejection`, "a new independent verdict on the head supersedes it");
75058
+ if (!(bypass && allowUnverified) && !verdict.accepted)
75059
+ return stop(verdict.reasons.includes("no_verdict") ? "no_verdict" : "needs_verdict", `${label} has no accepted independent verdict for ${doc.head.sha.slice(0, 12)} (${verdict.reasons.join(", ") || "none"})`, `an independent session verifies ${entry.branch} and runs: workit ledger verdict verified --how "<what was exercised>" --branch ${entry.branch}${allowUnverified ? `; or, only if the user asks to land unverified: workit stack land --unverified --reason "<why>"` : ""}`);
74994
75060
  if (!grant.allowed)
74995
75061
  return stop("grant_required", `${label} is verified and ready, but ${grant.error}`, grant.unblock, true);
74996
75062
  return { ok: true };
@@ -75408,6 +75474,14 @@ async function landStack(ctx, stack, options) {
75408
75474
  const mismatch = repoMismatch(ctx, stack);
75409
75475
  if (mismatch)
75410
75476
  return failWith(mismatch);
75477
+ const bypass = options.unverified ?? null;
75478
+ if (bypass) {
75479
+ const grant = requireGrant(ctx.cwd, "merge");
75480
+ if (!grant.allowed)
75481
+ return failWith(stackFail("blocked", grant.error, grant.unblock, { reason: "grant_required" }));
75482
+ if (!grant.allowUnverified)
75483
+ return failWith(stackFail("blocked", `unverified_refused: workspace ${grant.workspace ? `"${grant.workspace}"` : "(none)"} grants merge: "verified", which never lands without an accepted independent verdict`, "a non-author session verifies each head (workit-review), then land without --unverified", { reason: "unverified_refused" }));
75484
+ }
75411
75485
  if (!options.dryRun) {
75412
75486
  const synced = syncStack(ctx.cwd, ctx, stack, { publish: true, dryRun: false, limit: 1 }, ctx.actor);
75413
75487
  if (!synced.ok)
@@ -75453,7 +75527,7 @@ async function landStack(ctx, stack, options) {
75453
75527
  const grant = requireGrant(ctx.cwd, "merge");
75454
75528
  const verdict = verdictOf(ctx.cwd, entry.branch, ledgerRows());
75455
75529
  const effective = options.dryRun && simulated.size > 0 && doc ? { ...doc, base: stack.trunk } : doc;
75456
- const q = qualify(ctx, stack, entry, effective, verdict, grant, doc ? prBinding(ctx, entry, doc) : null);
75530
+ const q = qualify(ctx, stack, entry, effective, verdict, grant, doc ? prBinding(ctx, entry, doc) : null, bypass !== null);
75457
75531
  if (!q.ok) {
75458
75532
  outcome.stoppedAt = {
75459
75533
  pr: entry.pr,
@@ -75476,7 +75550,8 @@ async function landStack(ctx, stack, options) {
75476
75550
  method: options.method,
75477
75551
  deleteBranch: false,
75478
75552
  actor: ctx.actor,
75479
- expect: { base: stack.trunk, branch: entry.branch }
75553
+ expect: { base: stack.trunk, branch: entry.branch },
75554
+ ...bypass && !verdict.accepted ? { unverified: bypass } : {}
75480
75555
  }, ctx.sleep);
75481
75556
  if (!merged.ok) {
75482
75557
  if (merged.code === "blocked" && "refusal" in merged && merged.refusal) {
@@ -75492,7 +75567,12 @@ async function landStack(ctx, stack, options) {
75492
75567
  }
75493
75568
  return failWith(stackFail(merged.code, merged.error, merged.unblock));
75494
75569
  }
75495
- outcome.landed.push({ pr, branch: entry.branch, mergeSha: merged.data.mergeSha });
75570
+ outcome.landed.push({
75571
+ pr,
75572
+ branch: entry.branch,
75573
+ mergeSha: merged.data.mergeSha,
75574
+ unverified: merged.data.unverified?.recorded ?? null
75575
+ });
75496
75576
  entry.merged = { pr, mergeSha: merged.data.mergeSha, at: new Date().toISOString() };
75497
75577
  const written = writeStack(ctx.cwd, stack);
75498
75578
  if (!written.ok)
@@ -75810,7 +75890,7 @@ var init_stack2 = __esm(() => {
75810
75890
  METHODS3 = new Set(["squash", "merge", "rebase"]);
75811
75891
  });
75812
75892
 
75813
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/fanout.ts
75893
+ // packages/workit-core/src/fanout.ts
75814
75894
  import { spawnSync as spawnSync21 } from "node:child_process";
75815
75895
  import { createHash as createHash16 } from "node:crypto";
75816
75896
  import fs23 from "node:fs";
@@ -76621,7 +76701,7 @@ var init_fanout = __esm(() => {
76621
76701
  ID = /^[a-z0-9][a-z0-9._-]{0,63}$/u;
76622
76702
  });
76623
76703
 
76624
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/fanout-worktree.ts
76704
+ // packages/workit-core/src/fanout-worktree.ts
76625
76705
  import { randomBytes as randomBytes4 } from "node:crypto";
76626
76706
  import fs24 from "node:fs";
76627
76707
  import path44 from "node:path";
@@ -76997,7 +77077,7 @@ var init_fanout_worktree = __esm(() => {
76997
77077
  };
76998
77078
  });
76999
77079
 
77000
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/fanout-brief.ts
77080
+ // packages/workit-core/src/fanout-brief.ts
77001
77081
  import { createHash as createHash17 } from "node:crypto";
77002
77082
  function workerSession(lead, slice, attempt) {
77003
77083
  const tail = attempt === null ? "" : `+try${attempt}`;
@@ -77103,7 +77183,7 @@ var init_fanout_brief = __esm(() => {
77103
77183
  ];
77104
77184
  });
77105
77185
 
77106
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/fanout-landed.ts
77186
+ // packages/workit-core/src/fanout-landed.ts
77107
77187
  import { spawnSync as spawnSync22 } from "node:child_process";
77108
77188
  function forgeBreaker(resolved) {
77109
77189
  if (!resolved)
@@ -77308,7 +77388,7 @@ var init_fanout_landed = __esm(() => {
77308
77388
  init_fanout();
77309
77389
  });
77310
77390
 
77311
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/fanout-check.ts
77391
+ // packages/workit-core/src/fanout-check.ts
77312
77392
  function mergeConflicts(cwd, a, b) {
77313
77393
  const run = gitRun4(cwd, [
77314
77394
  "merge-tree",
@@ -77566,7 +77646,7 @@ var init_fanout_check = __esm(() => {
77566
77646
  init_fanout_landed();
77567
77647
  });
77568
77648
 
77569
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/fanout-status.ts
77649
+ // packages/workit-core/src/fanout-status.ts
77570
77650
  function timeboxMs(text) {
77571
77651
  if (!text || /^\s*\d+(?:\.\d+)?\s*$/u.test(text))
77572
77652
  return null;
@@ -94768,6 +94848,10 @@ function parse7(argv) {
94768
94848
  };
94769
94849
  for (let index = 0;index < argv.length; index += 1) {
94770
94850
  const raw = argv[index];
94851
+ if (raw === "--") {
94852
+ options.paths.push(...argv.slice(index + 1));
94853
+ break;
94854
+ }
94771
94855
  const [flag, inline] = raw.startsWith("--") && raw.includes("=") ? [raw.slice(0, raw.indexOf("=")), raw.slice(raw.indexOf("=") + 1)] : [raw, undefined];
94772
94856
  if (flag === "--json")
94773
94857
  continue;
@@ -94985,7 +95069,7 @@ var init_knowledge2 = __esm(() => {
94985
95069
  init_output();
94986
95070
  });
94987
95071
 
94988
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/youtrack-tools.ts
95072
+ // packages/workit-core/src/core/youtrack-tools.ts
94989
95073
  async function logTimeUpdate(input, operation = defaultOperations) {
94990
95074
  try {
94991
95075
  const value = await operation.logTime(input);
@@ -95034,7 +95118,7 @@ var init_youtrack_tools = __esm(() => {
95034
95118
  };
95035
95119
  });
95036
95120
 
95037
- // packages/workit-cli/node_modules/@brainervirus/workit-core/src/core/youtrack-writes.ts
95121
+ // packages/workit-core/src/core/youtrack-writes.ts
95038
95122
  async function markerPresent(issueId, marker, where) {
95039
95123
  const creds = youTrackToken();
95040
95124
  if ("error" in creds)
@@ -95339,7 +95423,7 @@ async function resumeBrief(argv, io) {
95339
95423
  return emit(io, ok({ ...data, recorded }), human2);
95340
95424
  }
95341
95425
  async function run21(argv, io) {
95342
- if (!argv.includes("--task"))
95426
+ if (!argv.some((arg) => arg === "--task" || arg.startsWith("--task=")))
95343
95427
  return resumeBrief(argv, io);
95344
95428
  await Promise.resolve().then(() => init_task());
95345
95429
  return runTaskCommand(["handoff", ...argv]);
@@ -95352,9 +95436,99 @@ var init_handoff = __esm(() => {
95352
95436
 
95353
95437
  // packages/workit-cli/src/main.ts
95354
95438
  init_package();
95355
- init_output();
95356
95439
  import path52 from "node:path";
95357
95440
 
95441
+ // packages/workit-cli/src/help.ts
95442
+ var HELP_FLAGS = new Set(["--help", "-h"]);
95443
+ var ESCAPE = "A value that starts with - goes as --flag=value (or after a bare --).";
95444
+ var options = (args) => {
95445
+ const end = args.indexOf("--");
95446
+ return end < 0 ? args : args.slice(0, end);
95447
+ };
95448
+ var wantsHelp = (args) => options(args).some((arg) => HELP_FLAGS.has(arg));
95449
+ var firstWord = (args) => options(args).find((arg) => !arg.startsWith("-"));
95450
+ var valueFlags = (lines) => {
95451
+ const out = new Map;
95452
+ const group = /(?<![\w-])(--?[a-zA-Z][\w-]*(?:\|--?[a-zA-Z][\w-]*)*) (?=[<"a-z0-9])/gu;
95453
+ for (const line of lines)
95454
+ for (const match of line.matchAll(group)) {
95455
+ const names = match[1].split("|");
95456
+ const long = names.find((name) => name.startsWith("--")) ?? names[0];
95457
+ for (const name of names)
95458
+ out.set(name, long);
95459
+ }
95460
+ return out;
95461
+ };
95462
+ function helpAsValue(args, lines) {
95463
+ const before = options(args);
95464
+ const takes = valueFlags(lines);
95465
+ for (let index = 1;index < before.length; index += 1) {
95466
+ const flag = before[index];
95467
+ const long = takes.get(before[index - 1]);
95468
+ if (HELP_FLAGS.has(flag) && long)
95469
+ return `\`${flag}\` looks like the value of ${before[index - 1]}; use ${long}=${flag} or put it after --`;
95470
+ }
95471
+ return null;
95472
+ }
95473
+ function takesPositionals(lines) {
95474
+ const flag = /(?<![\w-])--?[a-zA-Z][\w-]*(?:\|--?[a-zA-Z][\w-]*)*(?:[ =](?!-)(?:<[^>]*>|"[^"]*"|[\w.,@/|=-]+)…?)?/gu;
95475
+ return lines.some((line) => /<|"|\w…|\s…/u.test(line.replace(flag, "")));
95476
+ }
95477
+ var usageLines = (entry) => entry.subcommands?.length ? entry.subcommands.map((sub) => sub.usage) : [entry.usage];
95478
+ var examplesFor = (entry, sub) => (entry.examples ?? []).filter((example) => sub ? new RegExp(`^workit ${entry.name} ${sub.name}(?![\\w-])`, "u").test(example) : true);
95479
+ var exampleBlock = (examples) => examples.length ? ["", "examples:", ...examples.map((line) => ` ${line}`)] : [];
95480
+ function verbHelp(entry) {
95481
+ const subs = entry.subcommands ?? [];
95482
+ const usages = usageLines(entry);
95483
+ const examples = examplesFor(entry);
95484
+ const text = [
95485
+ ...subs.length ? [
95486
+ `workit ${entry.name}: ${entry.summary}`,
95487
+ "",
95488
+ ...subs.flatMap((sub) => [`usage: ${sub.usage}`, ` ${sub.summary}`])
95489
+ ] : [`usage: ${entry.usage}`, "", entry.summary],
95490
+ ...exampleBlock(examples),
95491
+ "",
95492
+ ...subs.length ? [`More: workit help ${entry.name} <${subs.map((sub) => sub.name).join("|")}>`] : [],
95493
+ ESCAPE
95494
+ ].join(`
95495
+ `);
95496
+ return {
95497
+ name: entry.name,
95498
+ group: entry.group,
95499
+ usage: usages[0],
95500
+ usages,
95501
+ summary: entry.summary,
95502
+ examples,
95503
+ text
95504
+ };
95505
+ }
95506
+ function subcommandHelp(entry, sub) {
95507
+ const examples = examplesFor(entry, sub);
95508
+ return {
95509
+ name: entry.name,
95510
+ group: entry.group,
95511
+ subcommand: sub.name,
95512
+ usage: sub.usage,
95513
+ usages: [sub.usage],
95514
+ summary: sub.summary,
95515
+ examples,
95516
+ text: [
95517
+ `usage: ${sub.usage}`,
95518
+ "",
95519
+ sub.summary,
95520
+ ...exampleBlock(examples),
95521
+ "",
95522
+ ...sub.aliases?.length ? [`aliases: ${sub.aliases.join(", ")}`] : [],
95523
+ ESCAPE
95524
+ ].join(`
95525
+ `)
95526
+ };
95527
+ }
95528
+
95529
+ // packages/workit-cli/src/main.ts
95530
+ init_output();
95531
+
95358
95532
  // packages/workit-cli/src/verbs/registry.ts
95359
95533
  var TASK_FAMILY_NAMES = [
95360
95534
  "task",
@@ -95365,13 +95539,97 @@ var TASK_FAMILY_NAMES = [
95365
95539
  "worker",
95366
95540
  "state"
95367
95541
  ];
95368
- var family = (name) => ({
95542
+ var FAMILY_OPTIONS = "[--task <id>] [--payload <JSON|@file|->] [--revision <r>] [--workspace-revision <r|null>] [--view <v>] [--actor <a>] [--confirm]";
95543
+ var FAMILY_ACTIONS = {
95544
+ task: {
95545
+ list: "List the workspace's tasks",
95546
+ inspect: "Show one task's full state",
95547
+ revise: "Change a task's intent or scope",
95548
+ progress: "Record progress on a task",
95549
+ pause: "Pause a task",
95550
+ resume: "Resume a paused task",
95551
+ start: "Start a task from a full payload",
95552
+ close: "Close a task by id"
95553
+ },
95554
+ policy: {
95555
+ assess: "Judge the branch's work and record the derived checks, verdicts and gates",
95556
+ preview: "Show what a judgment would derive, without recording it",
95557
+ explain: "Explain the policy in force"
95558
+ },
95559
+ evidence: { record: "Record evidence against a task's requirements" },
95560
+ finding: { record: "Record a finding", resolve: "Resolve a finding" },
95561
+ decision: { record: "Record a task decision", revoke: "Revoke a task decision" },
95562
+ worker: {
95563
+ assign: "Assign a worker to a task",
95564
+ report: "Report a worker's result",
95565
+ cancel: "Cancel a worker assignment"
95566
+ },
95567
+ state: { export: "Export a task's state (v1)", import: "Import an exported task state" }
95568
+ };
95569
+ var POLICY_JUDGE = "--judge risk=trivial|normal|high behavior=yes|no product-choice=yes|no plan=yes|no [--ref <path>]…";
95570
+ var TASK_IMPLICIT = [
95571
+ {
95572
+ name: "status",
95573
+ usage: "workit task status [--all]",
95574
+ summary: "The current branch's task, or every task with --all"
95575
+ },
95576
+ {
95577
+ name: "start",
95578
+ usage: `workit task start "<objective>" | task start ${FAMILY_OPTIONS}`,
95579
+ summary: "Start tracking the current branch's task (idempotent per branch)"
95580
+ },
95581
+ {
95582
+ name: "note",
95583
+ usage: 'workit task note [--next "<t>"] [--objective "<t>"] [--] "<text>"',
95584
+ summary: "Add a progress note to the current branch's task (creates it if needed)"
95585
+ },
95586
+ {
95587
+ name: "close",
95588
+ usage: `workit task close [--outcome verified|limited|stopped] [--summary "<t>"] [--confirm] | task close ${FAMILY_OPTIONS}`,
95589
+ summary: "Close the current branch's task, or a task by id"
95590
+ },
95591
+ {
95592
+ name: "adopt",
95593
+ usage: "workit task adopt <id>",
95594
+ summary: "Bind a migrated or other task to the current branch"
95595
+ }
95596
+ ];
95597
+ var familySubcommands = (name) => {
95598
+ const implicit = name === "task" ? TASK_IMPLICIT : [];
95599
+ const grammar = Object.entries(FAMILY_ACTIONS[name]).filter(([action]) => !implicit.some((entry) => entry.name === action)).map(([action, summary]) => ({
95600
+ name: action,
95601
+ usage: name === "policy" && action !== "explain" ? `workit policy ${action} ${POLICY_JUDGE} ${FAMILY_OPTIONS}` : `workit ${name} ${action} ${FAMILY_OPTIONS}`,
95602
+ summary
95603
+ }));
95604
+ return [...implicit, ...grammar];
95605
+ };
95606
+ var family = (name) => withSubcommands({
95369
95607
  name,
95370
95608
  group: "task",
95371
- usage: name === "task" ? 'workit task status [--all] | task start "<objective>" | task note "<text>" [--next "<t>"] | task close [--outcome verified|limited|stopped] | task adopt <id> | task <action> --payload <JSON>' : name === "policy" ? "workit policy assess|preview --judge risk=trivial|normal|high behavior=yes|no product-choice=yes|no plan=yes|no [--ref <path>] | policy explain" : `workit ${name} <action> [options]`,
95372
95609
  summary: name === "task" ? "The current branch's task (created by its first note, check or recording; no ids needed), or the task family" : name === "policy" ? "Judge the branch's work; Workit derives its checks, verdicts, decision and plan gates" : `Inspect and control a Workit task (${name} family)`,
95610
+ subcommands: familySubcommands(name),
95611
+ ...name === "task" ? {
95612
+ examples: [
95613
+ 'workit task note "parser done; wiring the router" --next "add the router test"',
95614
+ "workit task close --outcome verified"
95615
+ ]
95616
+ } : name === "policy" ? {
95617
+ examples: [
95618
+ "workit policy assess --judge risk=normal behavior=yes product-choice=no plan=no"
95619
+ ]
95620
+ } : {},
95373
95621
  load: async () => (await Promise.resolve().then(() => (init_family(), exports_family))).familyVerb(name)
95374
95622
  });
95623
+ function withSubcommands(entry, options = {}) {
95624
+ const names = entry.subcommands.map((sub) => sub.name).join("|");
95625
+ return {
95626
+ ...entry,
95627
+ usage: `workit ${entry.name} ${options.optional ? `[${names}]` : names} [options]`,
95628
+ ...options.optional ? { optionalSubcommand: true } : {}
95629
+ };
95630
+ }
95631
+ var VERIFY_OPTIONS = "[--expect pushed|pr|merged|released] [--pr <n> | --branch <b>] [--sha <sha>] [--tag <t>] [--package <name[@version]>]";
95632
+ var LEDGER_ACTOR = "[--branch <b> | --pr <n>] [--supersedes <id>] [--session <id> | --as <role>]";
95375
95633
  var VERBS = [
95376
95634
  {
95377
95635
  name: "init",
@@ -95383,28 +95641,28 @@ var VERBS = [
95383
95641
  {
95384
95642
  name: "upgrade",
95385
95643
  group: "setup",
95386
- usage: "workit upgrade [--hosts=a,b|none] [--cli] [--preview | --apply --confirm] [--json]",
95644
+ usage: "workit upgrade [--hosts=a,b|none] [--cli] [--preview | --apply --confirm]",
95387
95645
  summary: "Preview upgrades (--apply --confirm to apply)",
95388
95646
  load: () => Promise.resolve().then(() => (init_upgrade2(), exports_upgrade))
95389
95647
  },
95390
95648
  {
95391
95649
  name: "launch",
95392
95650
  group: "setup",
95393
- usage: "workit launch <host> [--auto-upgrade] [-- args]",
95651
+ usage: "workit launch <host> [--auto-upgrade] [-- <host args…>]",
95394
95652
  summary: "Upgrade before host startup, then start the host",
95395
95653
  load: () => Promise.resolve().then(() => (init_launch(), exports_launch))
95396
95654
  },
95397
95655
  {
95398
95656
  name: "doctor",
95399
95657
  group: "setup",
95400
- usage: "workit doctor [--json] [--fix-lock [--force [--yes]]]",
95658
+ usage: "workit doctor [--fix-lock [--force [--yes]]]",
95401
95659
  summary: "Verify the offline installation health (--fix-lock clears a stale workit store lock)",
95402
95660
  load: () => Promise.resolve().then(() => (init_doctor2(), exports_doctor))
95403
95661
  },
95404
95662
  {
95405
95663
  name: "gc",
95406
95664
  group: "setup",
95407
- usage: "workit gc [--dry-run] [--prune-recovery --yes] [--json]",
95665
+ usage: "workit gc [--dry-run] [--prune-recovery --yes]",
95408
95666
  summary: "Compact long task event logs, drop unreferenced blobs and old check logs; report (or prune) 2.x recovery copies",
95409
95667
  load: () => Promise.resolve().then(() => (init_gc(), exports_gc))
95410
95668
  },
@@ -95415,108 +95673,312 @@ var VERBS = [
95415
95673
  summary: "Remove workit host registrations interactively (~/.config/workit is kept)",
95416
95674
  load: () => Promise.resolve().then(() => (init_uninstall2(), exports_uninstall))
95417
95675
  },
95418
- {
95676
+ withSubcommands({
95419
95677
  name: "grant",
95420
95678
  group: "setup",
95421
- usage: "workit grant show [<workspace>] [--all] | grant set <workspace> <kind>=<true|false|verified>… | grant unset <workspace> <kind>…",
95422
95679
  summary: "Show or change a workspace's autonomy grants (push, pr, merge, release, rerun) and default endpoint; raising needs the user at a terminal",
95680
+ subcommands: [
95681
+ {
95682
+ name: "show",
95683
+ usage: "workit grant show [<workspace>] [--all]",
95684
+ summary: "Show the grants of the current (or named) workspace, or of every workspace"
95685
+ },
95686
+ {
95687
+ name: "set",
95688
+ usage: "workit grant set <workspace> <kind>=<true|false|verified>… [defaultEndpoint=commit|pr|green|merged] [verification=self|independent]",
95689
+ summary: "Change grants (kinds: push, pr, merge, release, rerun); raising one asks the user to confirm at a terminal"
95690
+ },
95691
+ {
95692
+ name: "unset",
95693
+ usage: "workit grant unset <workspace> <kind>…",
95694
+ summary: "Remove grants, falling back to the defaults"
95695
+ }
95696
+ ],
95697
+ examples: ["workit grant show", "workit grant set my-repo push=true pr=true"],
95423
95698
  load: () => Promise.resolve().then(() => (init_grant(), exports_grant))
95424
- },
95699
+ }, { optional: true }),
95425
95700
  ...TASK_FAMILY_NAMES.map(family),
95426
95701
  {
95427
95702
  name: "check",
95428
95703
  group: "delivery",
95429
- usage: "workit check <name> | workit check [--name <n>] [--shell] [--timeout <s>] [--task <id>] -- <cmd…>",
95704
+ usage: "workit check <name> [--task <id>] [--base <ref>] | workit check [--name <n>] [--shell] [--timeout <s>] [--task <id>] [--base <ref>] -- <cmd…>",
95430
95705
  summary: "Run a configured or ad-hoc check and record CLI-observed evidence (exit = the command's)",
95706
+ examples: ["workit check test", "workit check --name unit -- bun test test/unit"],
95431
95707
  load: () => Promise.resolve().then(() => (init_check(), exports_check))
95432
95708
  },
95433
- {
95709
+ withSubcommands({
95434
95710
  name: "pr",
95435
95711
  group: "delivery",
95436
- usage: "workit pr status [--pr <n>] | pr create [--base <b> | --track <t>] (--title <t> | --fill) [--draft] | pr merge [--pr <n>] [--method squash|merge|rebase] [--delete-branch] [--unverified --reason <why>]",
95437
95712
  summary: "PR/MR state with failing log tails and next action; open a SHA-verified PR; merge only when READY, verified and granted",
95713
+ subcommands: [
95714
+ {
95715
+ name: "status",
95716
+ usage: "workit pr status [--pr <n> | --branch <b>] [--log-lines 60]",
95717
+ summary: "PR/MR state, failing check log tails and the next action"
95718
+ },
95719
+ {
95720
+ name: "create",
95721
+ usage: "workit pr create [--base <b> | --track <t>] (--title <t> [--body <text> | --body-file <f>] | --fill) [--draft]",
95722
+ summary: "Open a PR/MR for the pushed branch, verified against the local HEAD"
95723
+ },
95724
+ {
95725
+ name: "merge",
95726
+ usage: "workit pr merge [--pr <n>] [--method squash|merge|rebase] [--delete-branch] [--unverified --reason <why>]",
95727
+ summary: "Merge when READY, verified by a non-author and granted"
95728
+ }
95729
+ ],
95730
+ examples: [
95731
+ 'workit pr create --title "fix(cli): answer help flags first" --body-file pr.md',
95732
+ "workit pr merge --method squash --delete-branch"
95733
+ ],
95438
95734
  load: () => Promise.resolve().then(() => (init_pr(), exports_pr))
95439
- },
95440
- {
95735
+ }),
95736
+ withSubcommands({
95441
95737
  name: "ci",
95442
95738
  group: "delivery",
95443
- usage: "workit ci wait [--pr <n>] [--head <sha>] [--timeout 20m] | ci rerun [--failed | --check <name>…] --reason flake|infra [--force]",
95444
95739
  summary: "Wait for CI on the PR head (exit 0/1/3/4), or rerun failed jobs once per head",
95740
+ subcommands: [
95741
+ {
95742
+ name: "wait",
95743
+ usage: "workit ci wait [--pr <n> | --branch <b>] [--head <sha>] [--timeout 20m] [--interval 30s]",
95744
+ summary: "Wait for CI on the PR head; exit 0 green, 1 red, 3 blocked, 4 still pending"
95745
+ },
95746
+ {
95747
+ name: "rerun",
95748
+ usage: "workit ci rerun [--pr <n> | --branch <b>] [--check <name>… | --failed] --reason flake|infra [--force]",
95749
+ summary: "Rerun failed jobs once per head, with a recorded reason"
95750
+ }
95751
+ ],
95752
+ examples: ["workit ci wait --timeout 30m", "workit ci rerun --failed --reason flake"],
95445
95753
  load: () => Promise.resolve().then(() => (init_ci(), exports_ci))
95446
- },
95447
- {
95754
+ }),
95755
+ withSubcommands({
95448
95756
  name: "git",
95449
95757
  group: "delivery",
95450
- usage: "workit git branch <name> [--base <b>] [--track <t>] | git commit -m <msg> [--all | -- <paths…>] | git push [--set-upstream] [--force-with-lease]",
95451
95758
  summary: "Policy-checked branch and commit (Workit-Session trailer); push with a lease and a verified remote tip",
95759
+ subcommands: [
95760
+ {
95761
+ name: "branch",
95762
+ usage: "workit git branch <name> | git branch --kind feature|bugfix|hotfix --slug <s> [--base <b>] [--track <t>] [--carry]",
95763
+ summary: "Create and switch to a branch from the trunk or a release track"
95764
+ },
95765
+ {
95766
+ name: "commit",
95767
+ usage: "workit git commit -m|--message <msg>… [-a|--all | [--] <paths…>]",
95768
+ summary: "Commit with a linted Conventional Commit message and the session trailer"
95769
+ },
95770
+ {
95771
+ name: "push",
95772
+ usage: "workit git push [-u|--set-upstream] [--force-with-lease [--expect <sha>] [--overwrite-unintegrated]]",
95773
+ summary: "Push the current branch and verify the remote tip (never a blind --force)"
95774
+ }
95775
+ ],
95776
+ examples: [
95777
+ "workit git branch --kind feature --slug help-everywhere",
95778
+ 'workit git commit -m "fix(cli): answer help flags first" --all',
95779
+ "workit git push --set-upstream"
95780
+ ],
95452
95781
  load: () => Promise.resolve().then(() => (init_git2(), exports_git))
95453
- },
95454
- {
95782
+ }),
95783
+ withSubcommands({
95455
95784
  name: "verify-delivery",
95456
95785
  group: "delivery",
95457
- usage: "workit verify-delivery [push|pr|merge|release] [--pr <n> | --branch <b>] [--sha <s>] [--tag <t>] [--package <p>]",
95458
95786
  summary: "Observe that a push, PR head, merge or release really landed on the remote (exit 1 when not)",
95787
+ subcommands: [
95788
+ ["push", "pushed", "the branch's remote tip is the local HEAD"],
95789
+ ["pr", null, "the PR head is the local HEAD"],
95790
+ ["merge", "merged", "the PR merged into its base"],
95791
+ ["release", "released", "the release tag and package exist"]
95792
+ ].map(([name, alias, what]) => ({
95793
+ name,
95794
+ ...alias ? { aliases: [alias] } : {},
95795
+ usage: `workit verify-delivery ${name} ${VERIFY_OPTIONS}`,
95796
+ summary: `Observe that ${what}`
95797
+ })),
95798
+ examples: ["workit verify-delivery push", "workit verify-delivery merge --pr 42"],
95459
95799
  load: () => Promise.resolve().then(() => (init_verify_delivery(), exports_verify_delivery))
95460
- },
95461
- {
95800
+ }, { optional: true }),
95801
+ withSubcommands({
95462
95802
  name: "stack",
95463
95803
  group: "delivery",
95464
- usage: "workit stack plan [<bottom> … <top>] | status | sync [--local] | land [--dry-run] [--max <n>] [--unverified --reason <why>] [--json]",
95465
95804
  summary: "Plan, restack (lease push + retarget) and land a base-branch stack of PRs, root first",
95805
+ subcommands: [
95806
+ {
95807
+ name: "plan",
95808
+ usage: "workit stack plan [--name <n>] [--trunk <b> | --track <t>] [<bottom> … <top>]",
95809
+ summary: "Record the stack's branches, bottom first"
95810
+ },
95811
+ {
95812
+ name: "status",
95813
+ usage: "workit stack status [--name <n>]",
95814
+ summary: "Each stacked PR's base, head, CI and verdict"
95815
+ },
95816
+ {
95817
+ name: "sync",
95818
+ usage: "workit stack sync [--name <n>] [--local] [--dry-run] [--force <branch>]…",
95819
+ summary: "Restack onto the moved bases, lease-push and retarget the PRs"
95820
+ },
95821
+ {
95822
+ name: "land",
95823
+ usage: "workit stack land [--name <n>] [--dry-run] [--max <n>] [--method squash|merge|rebase] [--unverified --reason <why>] [--timeout 20m] [--interval 30s]",
95824
+ summary: "Merge the stack root first, restacking the rest as each lands"
95825
+ }
95826
+ ],
95827
+ examples: ["workit stack plan feature/a feature/b feature/c", "workit stack land --dry-run"],
95466
95828
  load: () => Promise.resolve().then(() => (init_stack2(), exports_stack))
95467
- },
95468
- {
95829
+ }),
95830
+ withSubcommands({
95469
95831
  name: "fanout",
95470
95832
  group: "delivery",
95471
- usage: "workit fanout plan <plan.json> [--name <n>] [--trunk <b> | --track <t>] [--take-lead] | fanout brief <slice> [--mode new|resume] [--attempt <n>] | fanout check [<slice>…] [--name <n>] [--base <ref>] [--offline] | fanout status [--name <n>] [--stuck-after 30m] [--offline] | fanout worktree create|release <slice> [--force] [--json]",
95472
95833
  summary: "Register parallel slices (complete briefs, disjoint scopes, shared-file owners), render each worker's brief with the standing orders, watch them (STUCK, PR, CI, verdict, landed, landing order), make and release slice worktrees, and gate fan-in: out-of-scope edits, trunk and sibling merge conflicts",
95834
+ subcommands: [
95835
+ {
95836
+ name: "plan",
95837
+ usage: "workit fanout plan <plan.json> [--name <n>] [--trunk <b> | --track <t>] [--take-lead]",
95838
+ summary: "Register the slices of a plan file"
95839
+ },
95840
+ {
95841
+ name: "brief",
95842
+ usage: "workit fanout brief <slice> [--mode new|resume] [--attempt <n>] [--name <n>]",
95843
+ summary: "Render one worker's brief with the standing orders"
95844
+ },
95845
+ {
95846
+ name: "check",
95847
+ usage: "workit fanout check [<slice>…] [--name <n>] [--base <ref>] [--offline]",
95848
+ summary: "Gate fan-in: out-of-scope edits, trunk and sibling merge conflicts"
95849
+ },
95850
+ {
95851
+ name: "status",
95852
+ usage: "workit fanout status [--name <n>] [--stuck-after 30m] [--offline]",
95853
+ summary: "Each slice's state: STUCK, PR, CI, verdict, landed, landing order"
95854
+ },
95855
+ {
95856
+ name: "worktree",
95857
+ usage: "workit fanout worktree create|release <slice> [--name <n>] [--force]",
95858
+ summary: "Make or release a slice's worktree (--force applies to release only)"
95859
+ }
95860
+ ],
95861
+ examples: [
95862
+ "workit fanout plan plan.json --take-lead",
95863
+ "workit fanout status --stuck-after 20m"
95864
+ ],
95473
95865
  load: () => Promise.resolve().then(() => (init_fanout2(), exports_fanout))
95474
- },
95475
- {
95866
+ }),
95867
+ withSubcommands({
95476
95868
  name: "ledger",
95477
95869
  group: "delivery",
95478
- usage: "workit ledger decision|ruling|verdict|standing|list|check ...",
95479
95870
  summary: "Record and query decisions, rulings, SHA-keyed verdicts (patch-id carry-over across rebases) and a fanout's standing orders",
95871
+ subcommands: [
95872
+ {
95873
+ name: "decision",
95874
+ usage: `workit ledger decision "<what>" --why "<why>" [--ref <path|url>]… ${LEDGER_ACTOR}`,
95875
+ summary: "Record a decision and why"
95876
+ },
95877
+ {
95878
+ name: "ruling",
95879
+ usage: `workit ledger ruling "<what>" --why "<why>" --cost-if-wrong "<cost>" [--ref <path|url>]… ${LEDGER_ACTOR}`,
95880
+ summary: "Record a ruling on an open choice, with the cost of being wrong"
95881
+ },
95882
+ {
95883
+ name: "verdict",
95884
+ usage: `workit ledger verdict <result> --how "<method/evidence>" [--kind unit|live|perf|review] [--base <ref>] [--surface ui|cli|api] [--evidence <ref>]… [--self] ${LEDGER_ACTOR} | ledger verdict [<branch>]`,
95885
+ summary: "Record a SHA-keyed verdict on the branch head (result: verified, tests-verified, type-check-only, blocked, failed), or show the current verdicts"
95886
+ },
95887
+ {
95888
+ name: "list",
95889
+ aliases: ["show"],
95890
+ usage: "workit ledger list|show [--branch <b>] [--pr <n>] [--type <t>] [--last <n>]",
95891
+ summary: "List ledger rows, newest last"
95892
+ },
95893
+ {
95894
+ name: "check",
95895
+ usage: "workit ledger check [--pr <n> | --branch <b>]",
95896
+ summary: "Whether the branch head carries an accepted non-author verdict"
95897
+ },
95898
+ {
95899
+ name: "standing",
95900
+ usage: `workit ledger standing add "<order>" | standing list | standing clear [<id>] [--fanout <name>] [--supersedes <id>] [--session <id> | --as <role>]`,
95901
+ summary: "The lead's standing orders for a fanout's workers"
95902
+ },
95903
+ {
95904
+ name: "add",
95905
+ usage: 'workit ledger add decision|ruling|verdict "<what>" …',
95906
+ summary: "Same as the bare decision, ruling and verdict forms"
95907
+ }
95908
+ ],
95909
+ examples: [
95910
+ 'workit ledger decision "keep the registry as the help source" --why "one place to update"',
95911
+ 'workit ledger verdict verified --how "ran the CLI against a scratch repo" --kind live --as verifier'
95912
+ ],
95480
95913
  load: () => Promise.resolve().then(() => (init_ledger2(), exports_ledger))
95481
- },
95914
+ }),
95482
95915
  {
95483
95916
  name: "test-audit",
95484
95917
  group: "delivery",
95485
- usage: "workit test-audit [paths…] [--diff [base]] [--rule <ids>] [--min-severity <level>] [--fail-on <level>] [--mutate [--test-cmd <cmd {files}>] [--max-mutants <n>] [--budget <s>]] [--json]",
95918
+ usage: "workit test-audit [paths…] [--diff [<base>]] [--rule <ids>] [--min-severity <level>] [--fail-on <level>] [--mutate [--test-cmd <cmd {files}>] [--max-mutants <n>] [--budget <s>] [--timeout <s>]]",
95486
95919
  summary: "Flag tautological and low-value tests with a suggested independent oracle; --mutate checks changed lines with diff-scoped mutation",
95487
95920
  load: () => Promise.resolve().then(() => (init_test_audit(), exports_test_audit))
95488
95921
  },
95489
- {
95922
+ withSubcommands({
95490
95923
  name: "knowledge",
95491
95924
  group: "delivery",
95492
- usage: "workit knowledge lint [--json]",
95493
95925
  summary: "Lint agent knowledge files: AGENTS.md byte budget, broken local links, scaffold-only files, duplicated rules (exit 1 on findings)",
95926
+ subcommands: [
95927
+ {
95928
+ name: "lint",
95929
+ usage: "workit knowledge lint",
95930
+ summary: "Lint AGENTS.md and the knowledge files it links"
95931
+ }
95932
+ ],
95494
95933
  load: () => Promise.resolve().then(() => (init_knowledge2(), exports_knowledge))
95495
- },
95496
- {
95934
+ }),
95935
+ withSubcommands({
95497
95936
  name: "youtrack",
95498
95937
  group: "delivery",
95499
- usage: "workit youtrack note <ISSUE> (--markdown <t> | --file <p>) [--minutes <n>] | youtrack time|meeting <ISSUE> --minutes <n> [--text <t>] [--date auto|YYYY-MM-DD]",
95500
95938
  summary: "Post a YouTrack comment or log work time (host permission, no grant)",
95939
+ subcommands: [
95940
+ {
95941
+ name: "note",
95942
+ usage: "workit youtrack note <ISSUE> (--markdown <t> | --file <p>) [--minutes <n>] [--date auto|YYYY-MM-DD]",
95943
+ summary: "Post a comment, optionally logging time"
95944
+ },
95945
+ {
95946
+ name: "time",
95947
+ usage: "workit youtrack time <ISSUE> --minutes <n> [--text <t>] [--date auto|YYYY-MM-DD]",
95948
+ summary: "Log work time"
95949
+ },
95950
+ {
95951
+ name: "meeting",
95952
+ usage: "workit youtrack meeting <ISSUE> --minutes <n> --text <t> [--date auto|YYYY-MM-DD]",
95953
+ summary: "Log meeting time"
95954
+ }
95955
+ ],
95501
95956
  load: () => Promise.resolve().then(() => (init_youtrack2(), exports_youtrack))
95502
- },
95503
- {
95957
+ }),
95958
+ withSubcommands({
95504
95959
  name: "changelog",
95505
95960
  group: "delivery",
95506
- usage: "workit changelog apply (--entries <JSON|@file|-> | --normalize-only) [--path CHANGELOG.md] [--preview]",
95507
95961
  summary: "Add entries under the Unreleased section of the changelog",
95962
+ subcommands: [
95963
+ {
95964
+ name: "apply",
95965
+ usage: "workit changelog apply (--entries <JSON|@file|-> | --normalize-only) [--path CHANGELOG.md] [--preview]",
95966
+ summary: "Add entries (or only normalize the file)"
95967
+ }
95968
+ ],
95508
95969
  load: () => Promise.resolve().then(() => (init_changelog2(), exports_changelog))
95509
- },
95970
+ }),
95510
95971
  {
95511
95972
  name: "handoff",
95512
95973
  group: "delivery",
95513
- usage: "workit handoff [--note <t>] [--next <t>] [--record] | workit handoff --task <id>",
95974
+ usage: "workit handoff [--note <t>] [--next <t>] [--record] [--last <n>] | workit handoff --task <id>",
95514
95975
  summary: "Print a resume brief (branch, HEAD, dirty state, verdict, rulings, next command); --task exports v1 task state",
95515
95976
  load: () => Promise.resolve().then(() => (init_handoff(), exports_handoff))
95516
95977
  }
95517
95978
  ];
95518
95979
  var BY_NAME = new Map(VERBS.map((entry) => [entry.name, entry]));
95519
95980
  var findVerb = (name) => BY_NAME.get(name);
95981
+ var findSubcommand = (entry, name) => entry.subcommands?.find((sub) => sub.name === name || sub.aliases?.includes(name));
95520
95982
 
95521
95983
  // packages/workit-cli/src/main.ts
95522
95984
  var GROUP_TITLES = {
@@ -95548,20 +96010,17 @@ ${sections.join(`
95548
96010
  `)}
95549
96011
 
95550
96012
  Global flags:
95551
- --json Machine-readable output: {"ok","code","data","error"?,"unblock"?}
95552
- --cwd <dir> Run as if started in <dir>
95553
- --version Print the CLI version
95554
- help <cmd> Show usage for one command
96013
+ --json Machine-readable output: {"ok","code","data","error"?,"unblock"?}
96014
+ --cwd <dir> Run as if started in <dir>
96015
+ --version Print the CLI version
96016
+ -h, --help Show usage for the command and subcommand before it (runs nothing)
96017
+ help <cmd> [<sub>] The same, as a command
95555
96018
 
95556
96019
  Exit codes: 0 ok · 1 failed · 2 usage · 3 blocked · 4 busy/pending · 5 unavailable
95557
96020
 
95558
96021
  Run \`npx @brainervirus/workit-cli init\` to configure platforms, YouTrack, VCS and project hygiene.
95559
96022
  `;
95560
96023
  }
95561
- var verbHelp = (entry) => `usage: ${entry.usage}
95562
-
95563
- ${entry.summary}${entry.planned ? ` (coming in ${entry.planned})` : ""}
95564
- `;
95565
96024
  function parseGlobals(argv) {
95566
96025
  const rest = [];
95567
96026
  let json = false;
@@ -95607,18 +96066,38 @@ async function main(argv, overrides = {}, options = {}) {
95607
96066
  return emit(io, ok({ version: package_default.version }), (data) => data.version);
95608
96067
  }
95609
96068
  if (command === undefined || command === "help" || command === "--help" || command === "-h") {
95610
- const topic = command === "help" ? args.find((arg) => !arg.startsWith("-")) : undefined;
96069
+ const [topic, sub] = command === "help" ? words2(args) : [];
95611
96070
  if (topic) {
95612
96071
  const entry = findVerb(topic);
95613
96072
  if (!entry)
95614
96073
  return unknown2(io, topic);
95615
- return emit(io, ok(describe3(entry)), () => verbHelp(entry));
96074
+ if (sub === undefined)
96075
+ return help(io, verbHelp(entry));
96076
+ const found = findSubcommand(entry, sub);
96077
+ if (!found)
96078
+ return emit(io, fail("invalid_input", `unknown ${topic} subcommand "${sub}"`, {
96079
+ unblock: `workit help ${topic}`
96080
+ }));
96081
+ return help(io, subcommandHelp(entry, found));
95616
96082
  }
95617
96083
  return emit(io, ok({ version: package_default.version, verbs: listed().map(describe3) }), () => helpText());
95618
96084
  }
95619
96085
  const entry = findVerb(command);
95620
96086
  if (!entry)
95621
96087
  return unknown2(io, command);
96088
+ if (wantsHelp(verbArgs)) {
96089
+ const word = firstWord(verbArgs);
96090
+ const sub = word === undefined ? undefined : findSubcommand(entry, word);
96091
+ const asValue = helpAsValue(verbArgs, sub ? [sub.usage] : usageLines(entry));
96092
+ if (asValue)
96093
+ return emit(io, fail("invalid_input", asValue, {
96094
+ unblock: `workit help ${entry.name}${sub ? ` ${sub.name}` : ""}`
96095
+ }));
96096
+ return help(io, sub ? subcommandHelp(entry, sub) : verbHelp(entry));
96097
+ }
96098
+ const ended = endOfOptions(io, entry, args);
96099
+ if (typeof ended === "number")
96100
+ return ended;
95622
96101
  if (parsed.cwd !== null) {
95623
96102
  try {
95624
96103
  process.chdir(io.cwd);
@@ -95636,8 +96115,8 @@ async function main(argv, overrides = {}, options = {}) {
95636
96115
  `);
95637
96116
  const verb = await entry.load();
95638
96117
  if (!io.json)
95639
- return verb.run(args, io);
95640
- return runJsonPure(io, command, (pure) => verb.run(args, pure));
96118
+ return verb.run(ended, io);
96119
+ return runJsonPure(io, command, (pure) => verb.run(ended, pure));
95641
96120
  }
95642
96121
  var CODE_FOR_EXIT = {
95643
96122
  1: "failed",
@@ -95700,10 +96179,32 @@ var withJsonFlag = (args) => {
95700
96179
  return end < 0 ? [...args, "--json"] : [...args.slice(0, end), "--json", ...args.slice(end)];
95701
96180
  };
95702
96181
  var listed = () => VERBS.filter((entry) => !entry.planned);
96182
+ function endOfOptions(io, entry, args) {
96183
+ const end = args.indexOf("--");
96184
+ if (end < 0)
96185
+ return args;
96186
+ const word = firstWord(args);
96187
+ const sub = word === undefined ? undefined : findSubcommand(entry, word);
96188
+ const unblock = `workit help ${entry.name}${sub ? ` ${sub.name}` : ""}`;
96189
+ if (entry.subcommands?.length && !sub) {
96190
+ if (entry.optionalSubcommand || word !== undefined)
96191
+ return args;
96192
+ return emit(io, fail("invalid_input", `missing ${entry.name} subcommand`, { unblock }));
96193
+ }
96194
+ if (takesPositionals(sub ? [sub.usage] : [entry.usage]))
96195
+ return args;
96196
+ const extra = args.slice(end + 1);
96197
+ if (extra.length)
96198
+ return emit(io, fail("invalid_input", `${entry.name}${sub ? ` ${sub.name}` : ""} takes no positional arguments (got: ${extra.join(" ")})`, { unblock }));
96199
+ return args.slice(0, end);
96200
+ }
96201
+ var words2 = (args) => args.filter((arg) => !arg.startsWith("-"));
96202
+ var help = (io, doc) => emit(io, ok(doc), (data) => data.text);
95703
96203
  var describe3 = (entry) => ({
95704
96204
  name: entry.name,
95705
96205
  group: entry.group,
95706
96206
  usage: entry.usage,
96207
+ usages: usageLines(entry),
95707
96208
  summary: entry.summary,
95708
96209
  ...entry.planned ? { planned: entry.planned } : {}
95709
96210
  });