@tablation/crew 0.137.9 → 0.137.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +167 -76
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -6539,6 +6539,15 @@ function repoContractRefusedItem(repo, detail, nowIso = (/* @__PURE__ */ new Dat
6539
6539
  message: `${repo}: its repo contract is refused and the repository is skipped \u2014 ${detail}. Resumes automatically once the file is valid on its base; \`crew doctor\` names the problem`
6540
6540
  };
6541
6541
  }
6542
+ var repoPlatformUnreleasableKey = (repo) => `repo_platform_unreleasable:${repo}`;
6543
+ function repoPlatformUnreleasableItem(repo, detail, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
6544
+ return {
6545
+ kind: "repo_platform_unreleasable",
6546
+ key: repoPlatformUnreleasableKey(repo),
6547
+ since: nowIso,
6548
+ message: `${detail}. Resumes automatically once a ship that satisfies the platform serves the route or a verified branch changes it`
6549
+ };
6550
+ }
6542
6551
  var agentLogRefusedKey = (route2) => `agent_log_refused:${route2}`;
6543
6552
  function agentLogRefusedItem(route2, role, status2, nowIso = (/* @__PURE__ */ new Date()).toISOString()) {
6544
6553
  return {
@@ -15120,7 +15129,7 @@ function doctorSelftestLines(stored, toolchains) {
15120
15129
  }
15121
15130
 
15122
15131
  // src/cli.ts
15123
- import { resolve as resolve7, dirname as dirname36, join as join58, basename as basename16 } from "path";
15132
+ import { resolve as resolve7, dirname as dirname36, join as join59, basename as basename16 } from "path";
15124
15133
  import { fileURLToPath as fileURLToPath2 } from "url";
15125
15134
  import { hostname as hostname5, homedir as homedir11, userInfo as userInfo2 } from "os";
15126
15135
  import { spawnSync as spawnSync13 } from "child_process";
@@ -18784,8 +18793,36 @@ Ship ${shipName2} found: ${problem}. The release refuses to squash a ref nobody
18784
18793
  }
18785
18794
  var localRefSkipReported = (ticket, problem, events) => events.some((e) => e.record_id === ticket.id && e.event_type === "local_ref_skip" && (e.message ?? "").includes(problem));
18786
18795
 
18796
+ // src/platform-gate.ts
18797
+ import { join as join41 } from "path";
18798
+ function platformAdmitters(dir, baseRef, ship, tickets, locate) {
18799
+ const out = [];
18800
+ for (const t of tickets) {
18801
+ const branch = locate(t);
18802
+ if (!branch) continue;
18803
+ const changed2 = gitOk(dir, ["diff", "--name-only", `${baseRef}...${branch}`, "--", ...REPO_CONFIG_FILENAMES]);
18804
+ const file = changed2?.split("\n").find((f) => f.trim() !== "");
18805
+ if (!file) continue;
18806
+ const text2 = gitOk(dir, ["show", `${branch}:${file}`]);
18807
+ if (text2 === null) continue;
18808
+ try {
18809
+ const { platform: platform2 } = parseRepoConfig(text2, join41(dir, file));
18810
+ if (satisfies(ship, platform2)) out.push({ issueId: t.issue_id, branch, platform: platform2 });
18811
+ } catch (e) {
18812
+ if (e instanceof RepoConfigError) continue;
18813
+ throw e;
18814
+ }
18815
+ }
18816
+ return out;
18817
+ }
18818
+ function platformStuckNote(repo, required, ship, issueIds) {
18819
+ const who2 = eligibleShips(required).join(", ");
18820
+ const stuck = issueIds.length ? `${issueIds.join(", ")} verified but cannot be released by this ${ship} ship` : `this ${ship} ship cannot release it`;
18821
+ return `${repo}: its contract requires ${required}, so ${stuck}; only a ${who2} ship can (and no verified branch changes platform to admit this one)`;
18822
+ }
18823
+
18787
18824
  // src/connect-wizard.ts
18788
- import { delimiter, dirname as dirname22, join as join41 } from "path";
18825
+ import { delimiter, dirname as dirname22, join as join42 } from "path";
18789
18826
  import { accessSync as accessSync3, constants as constants3, existsSync as existsSync39, mkdirSync as mkdirSync27, writeFileSync as writeFileSync30 } from "fs";
18790
18827
  import { stringify as stringify3 } from "yaml";
18791
18828
  var HOST_PASSENGERS_DOCS_URL = "https://crew.tablation.dev/host-passengers";
@@ -18808,7 +18845,7 @@ function defaultIsExecutable(p) {
18808
18845
  function findOnPath2(name, pathEnv, isExecutable = defaultIsExecutable) {
18809
18846
  for (const dir of pathEnv.split(delimiter)) {
18810
18847
  if (!dir) continue;
18811
- const candidate = join41(dir, name);
18848
+ const candidate = join42(dir, name);
18812
18849
  if (isExecutable(candidate)) return candidate;
18813
18850
  }
18814
18851
  return void 0;
@@ -18905,7 +18942,7 @@ Wrote ${o.configPath}.
18905
18942
  // src/connect-json.ts
18906
18943
  import { accessSync as accessSync4, constants as constants4 } from "fs";
18907
18944
  import { homedir as homedir10 } from "os";
18908
- import { dirname as dirname23, join as join42 } from "path";
18945
+ import { dirname as dirname23, join as join43 } from "path";
18909
18946
  import { delimiter as delimiter2 } from "path";
18910
18947
  var CHOICE_EXIT_CODE = 3;
18911
18948
  function createEmitter(json2, write) {
@@ -18944,12 +18981,12 @@ function agentBinSearchDirs(home, pathEnv, extraPath) {
18944
18981
  const dirs = [
18945
18982
  ...pathEnv.split(delimiter2),
18946
18983
  ...(extraPath ?? "").split(delimiter2),
18947
- join42(home, ".local/bin"),
18948
- join42(home, ".claude/local"),
18984
+ join43(home, ".local/bin"),
18985
+ join43(home, ".claude/local"),
18949
18986
  "/opt/homebrew/bin",
18950
18987
  "/usr/local/bin",
18951
- join42(home, ".npm-global/bin"),
18952
- join42(home, ".volta/bin")
18988
+ join43(home, ".npm-global/bin"),
18989
+ join43(home, ".volta/bin")
18953
18990
  ];
18954
18991
  return [...new Set(dirs.filter(Boolean))];
18955
18992
  }
@@ -19071,7 +19108,7 @@ async function collectDiagnostics(d) {
19071
19108
 
19072
19109
  // src/release-run.ts
19073
19110
  import { readFileSync as readFileSync38, writeFileSync as writeFileSync31, existsSync as existsSync40, copyFileSync, mkdirSync as mkdirSync28, mkdtempSync as mkdtempSync3, rmSync as rmSync19 } from "fs";
19074
- import { dirname as dirname24, join as join43 } from "path";
19111
+ import { dirname as dirname24, join as join44 } from "path";
19075
19112
  import { tmpdir as tmpdir6, hostname as hostname4 } from "os";
19076
19113
 
19077
19114
  // src/release.ts
@@ -19853,7 +19890,7 @@ async function bump(o, size) {
19853
19890
  }
19854
19891
  return printed;
19855
19892
  }
19856
- const files = o.repo.release.versionFiles.map((f) => join43(o.cwd, f));
19893
+ const files = o.repo.release.versionFiles.map((f) => join44(o.cwd, f));
19857
19894
  const first = files[0];
19858
19895
  if (!existsAt(first, existsSync40)) {
19859
19896
  o.emit.error(`no ${o.repo.release.versionFiles[0]} to read a version from`);
@@ -19891,7 +19928,7 @@ async function bump(o, size) {
19891
19928
  function writeChangelog(o, version, entries) {
19892
19929
  const file = o.repo.release.changelog;
19893
19930
  if (!file || entries.length === 0) return;
19894
- const path = join43(o.cwd, file);
19931
+ const path = join44(o.cwd, file);
19895
19932
  const section = renderChangelogSection(version, (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), entries);
19896
19933
  if (o.dryRun) {
19897
19934
  o.emit.emit(`would prepend ${entries.length} entr(ies) to ${file}`);
@@ -19991,8 +20028,8 @@ function closeReleaseCheckout(cwd, root, dir, branch, run4 = gitOk) {
19991
20028
  function openReleaseCheckout(o) {
19992
20029
  const { remote, base } = o.repo.branch;
19993
20030
  const branch = `crew/release-${Date.now()}`;
19994
- const root = mkdtempSync3(join43(tmpdir6(), "crew-release-"));
19995
- const dir = join43(root, "checkout");
20031
+ const root = mkdtempSync3(join44(tmpdir6(), "crew-release-"));
20032
+ const dir = join44(root, "checkout");
19996
20033
  o.emit.emit(`release checkout: ${dir}`, { step: "release" });
19997
20034
  const close = () => closeReleaseCheckout(o.cwd, root, dir, branch);
19998
20035
  try {
@@ -20002,10 +20039,10 @@ function openReleaseCheckout(o) {
20002
20039
  throw e;
20003
20040
  }
20004
20041
  for (const f of o.repo.worktrees.copy) {
20005
- const src = join43(o.cwd, f);
20042
+ const src = join44(o.cwd, f);
20006
20043
  if (!existsSync40(src)) continue;
20007
- mkdirSync28(dirname24(join43(dir, f)), { recursive: true });
20008
- copyFileSync(src, join43(dir, f));
20044
+ mkdirSync28(dirname24(join44(dir, f)), { recursive: true });
20045
+ copyFileSync(src, join44(dir, f));
20009
20046
  }
20010
20047
  return { dir, branch, close };
20011
20048
  }
@@ -20735,7 +20772,7 @@ import { existsSync as existsSync47, readFileSync as readFileSync44 } from "fs";
20735
20772
 
20736
20773
  // src/daemon.ts
20737
20774
  import { existsSync as existsSync46, mkdirSync as mkdirSync34, readFileSync as readFileSync43, readdirSync as readdirSync14, rmSync as rmSync21, statSync as statSync13, writeFileSync as writeFileSync35 } from "fs";
20738
- import { join as join48 } from "path";
20775
+ import { join as join49 } from "path";
20739
20776
  import { randomBytes } from "crypto";
20740
20777
 
20741
20778
  // src/fleet.ts
@@ -20826,11 +20863,11 @@ function nextRoles(decision, ran) {
20826
20863
 
20827
20864
  // src/noop-runs.ts
20828
20865
  import { existsSync as existsSync41, mkdirSync as mkdirSync29, readFileSync as readFileSync39, renameSync as renameSync5, writeFileSync as writeFileSync32 } from "fs";
20829
- import { join as join44 } from "path";
20866
+ import { join as join45 } from "path";
20830
20867
  var NOOP_DELAYS_MS = [5, 15, 60].map((m) => m * 6e4);
20831
20868
  var DEFAULT_NOOP_REPEATS = 3;
20832
20869
  var NOOP_BOUNCED_MARKER = calloutHeader("WARNING", "Runs Changed Nothing");
20833
- var noopRunsPath = (stateDir) => join44(stateDir, "noop-runs.json");
20870
+ var noopRunsPath = (stateDir) => join45(stateDir, "noop-runs.json");
20834
20871
  var noopRunsKey = (issueId) => `noop_runs:${issueId}`;
20835
20872
  function readNoopRuns(stateDir) {
20836
20873
  try {
@@ -21202,11 +21239,11 @@ function explainRefusal(readable, unreadable) {
21202
21239
  // src/ssh-keys.ts
21203
21240
  import { execFileSync as execFileSync13 } from "child_process";
21204
21241
  import { existsSync as existsSync44, mkdirSync as mkdirSync32, readFileSync as readFileSync41, chmodSync as chmodSync3 } from "fs";
21205
- import { dirname as dirname27, join as join45 } from "path";
21242
+ import { dirname as dirname27, join as join46 } from "path";
21206
21243
  var SshKeyError = class extends Error {
21207
21244
  };
21208
21245
  function shipSshKeyPathFor(stateDir) {
21209
- return join45(stateDir, "ssh", "id_ed25519");
21246
+ return join46(stateDir, "ssh", "id_ed25519");
21210
21247
  }
21211
21248
  function ensureShipSshKeypair(stateDir) {
21212
21249
  const privateKeyPath = shipSshKeyPathFor(stateDir);
@@ -21250,7 +21287,7 @@ function sshKeygenAvailable() {
21250
21287
  // src/periscope-idle.ts
21251
21288
  import { execFileSync as execFileSync14 } from "child_process";
21252
21289
  import { statSync as statSync12 } from "fs";
21253
- import { join as join46 } from "path";
21290
+ import { join as join47 } from "path";
21254
21291
  var MAX_SCANNED_FILES = 2e4;
21255
21292
  function newestWorktreeMtime(root) {
21256
21293
  const a = newestTrackedMtime(root);
@@ -21275,7 +21312,7 @@ function newestTrackedMtime(root) {
21275
21312
  if (!rel) continue;
21276
21313
  if (++scanned > MAX_SCANNED_FILES) break;
21277
21314
  try {
21278
- const m = statSync12(join46(root, rel)).mtimeMs;
21315
+ const m = statSync12(join47(root, rel)).mtimeMs;
21279
21316
  if (newest === null || m > newest) newest = m;
21280
21317
  } catch {
21281
21318
  }
@@ -21350,7 +21387,7 @@ async function runPeriscopeIdlePass(d) {
21350
21387
 
21351
21388
  // src/periscope-cmd.ts
21352
21389
  import { existsSync as existsSync45, mkdirSync as mkdirSync33, readFileSync as readFileSync42, rmSync as rmSync20, writeFileSync as writeFileSync34 } from "fs";
21353
- import { join as join47 } from "path";
21390
+ import { join as join48 } from "path";
21354
21391
  var PeriscopeError = class extends Error {
21355
21392
  };
21356
21393
  var LivePeriscopeError = class extends PeriscopeError {
@@ -21360,8 +21397,8 @@ var LivePeriscopeError = class extends PeriscopeError {
21360
21397
  this.data = { refused: "live_periscope_exists", ...live };
21361
21398
  }
21362
21399
  };
21363
- var priorDir = (stateDir) => join47(stateDir, "periscope-priors");
21364
- var priorPath = (stateDir, ticketRecordId) => join47(priorDir(stateDir), `${ticketRecordId}.json`);
21400
+ var priorDir = (stateDir) => join48(stateDir, "periscope-priors");
21401
+ var priorPath = (stateDir, ticketRecordId) => join48(priorDir(stateDir), `${ticketRecordId}.json`);
21365
21402
  function removePeriscopePrior(stateDir, ticketRecordId) {
21366
21403
  rmSync20(priorPath(stateDir, ticketRecordId), { force: true });
21367
21404
  }
@@ -21944,7 +21981,7 @@ function latestMtime(path) {
21944
21981
  if (!stat2.isDirectory()) return 0;
21945
21982
  let latest = stat2.mtimeMs;
21946
21983
  for (const entry of readdirSync14(path, { withFileTypes: true })) {
21947
- latest = Math.max(latest, latestMtime(join48(path, entry.name)));
21984
+ latest = Math.max(latest, latestMtime(join49(path, entry.name)));
21948
21985
  }
21949
21986
  return latest;
21950
21987
  }
@@ -21956,7 +21993,7 @@ function makeStaleChecker(paths, opts = {}) {
21956
21993
  return () => computeTreeSignature(paths) !== initial || opts.reloadSentinel !== void 0 && existsSync46(opts.reloadSentinel);
21957
21994
  }
21958
21995
  function reloadSentinelFor(stateDir) {
21959
- return join48(stateDir, "reload-requested");
21996
+ return join49(stateDir, "reload-requested");
21960
21997
  }
21961
21998
  function readReloadRequestedAt(stateDir) {
21962
21999
  try {
@@ -21966,7 +22003,7 @@ function readReloadRequestedAt(stateDir) {
21966
22003
  }
21967
22004
  }
21968
22005
  function daemonStampFor(stateDir) {
21969
- return join48(stateDir, "daemon.started");
22006
+ return join49(stateDir, "daemon.started");
21970
22007
  }
21971
22008
  function noteDaemonStarted(stateDir, now = Date.now()) {
21972
22009
  mkdirSync34(stateDir, { recursive: true });
@@ -22919,11 +22956,11 @@ function readDaemonStamp(stateDir) {
22919
22956
 
22920
22957
  // src/daemon-start-failure.ts
22921
22958
  import { existsSync as existsSync48, mkdirSync as mkdirSync35, readFileSync as readFileSync45, unlinkSync as unlinkSync4, writeFileSync as writeFileSync36 } from "fs";
22922
- import { dirname as dirname28, join as join49 } from "path";
22959
+ import { dirname as dirname28, join as join50 } from "path";
22923
22960
  var DAEMON_START_FAILED_KEY = "daemon_start_failed";
22924
22961
  var START_FAILURE_BACKOFF_MS = 6e4;
22925
22962
  var BACKOFF_AFTER_FAILURES = 2;
22926
- var fileFor3 = (stateDir) => join49(stateDir, ".daemon-start-failure.json");
22963
+ var fileFor3 = (stateDir) => join50(stateDir, ".daemon-start-failure.json");
22927
22964
  function readStartFailure(stateDir) {
22928
22965
  try {
22929
22966
  const parsed = JSON.parse(readFileSync45(fileFor3(stateDir), "utf8"));
@@ -22984,7 +23021,7 @@ async function reportStartFailure(o) {
22984
23021
  return delay;
22985
23022
  }
22986
23023
  function fallbackStateDir(configFile) {
22987
- return join49(dirname28(configFile), "state");
23024
+ return join50(dirname28(configFile), "state");
22988
23025
  }
22989
23026
 
22990
23027
  // src/projects-cmd.ts
@@ -24867,7 +24904,7 @@ ${run4.err}` });
24867
24904
  }
24868
24905
 
24869
24906
  // src/sample-ticket.ts
24870
- import { basename as basename12, dirname as dirname31, join as join50 } from "path";
24907
+ import { basename as basename12, dirname as dirname31, join as join51 } from "path";
24871
24908
  var SAMPLE_REPO = "crew-sample";
24872
24909
  var SAMPLE_REMOTE = `local/${SAMPLE_REPO}`;
24873
24910
  var SAMPLE_MARKER = "sample: true";
@@ -24890,8 +24927,8 @@ has something safe to work on: its test and build hooks always pass, it has no
24890
24927
  remote, and \`crew sample-ticket --remove\` deletes it.
24891
24928
  `;
24892
24929
  function sampleDir(existing, reposBase, workspace) {
24893
- if (existing.length > 0) return join50(dirname31(existing[0]), SAMPLE_REPO);
24894
- return join50(reposBase, workspace, SAMPLE_REPO);
24930
+ if (existing.length > 0) return join51(dirname31(existing[0]), SAMPLE_REPO);
24931
+ return join51(reposBase, workspace, SAMPLE_REPO);
24895
24932
  }
24896
24933
  var SAMPLE_TITLE = "Sample: add a documented `greet` function with a test";
24897
24934
  function sampleDescription() {
@@ -24936,7 +24973,7 @@ function planSampleTicket(i) {
24936
24973
 
24937
24974
  // src/worktree-sweep.ts
24938
24975
  import { existsSync as existsSync51, readFileSync as readFileSync48, readdirSync as readdirSync15 } from "fs";
24939
- import { basename as basename13, dirname as dirname32, join as join51, resolve as resolve5 } from "path";
24976
+ import { basename as basename13, dirname as dirname32, join as join52, resolve as resolve5 } from "path";
24940
24977
  function planWorktreeSweep(target, tickets, contract) {
24941
24978
  const terminal = new Set(contract.statuses.resolved.filter((s) => s !== contract.statuses.verified));
24942
24979
  const verified = contract.statuses.verified;
@@ -25013,7 +25050,7 @@ function siblingWorktreeDirs(target) {
25013
25050
  for (const name of names) {
25014
25051
  if (!name.startsWith(stem)) continue;
25015
25052
  const m = DIR_NUMBER_SUFFIXED.exec(name);
25016
- const path = join51(parent, name);
25053
+ const path = join52(parent, name);
25017
25054
  if (m && !registered.has(resolve5(path))) out.push({ path, number: m[1] });
25018
25055
  }
25019
25056
  return out;
@@ -25222,13 +25259,13 @@ function applyRemoteBranchCleanup(cwd, remote, branches2, dryRun, log) {
25222
25259
 
25223
25260
  // src/stream-sweep.ts
25224
25261
  import { existsSync as existsSync52, readdirSync as readdirSync16, rmSync as rmSync22, statSync as statSync15 } from "fs";
25225
- import { join as join52 } from "path";
25262
+ import { join as join53 } from "path";
25226
25263
  var DAY_MS2 = 24 * 60 * 60 * 1e3;
25227
25264
  function planStreamSweep(stateDir, retentionDays, now = Date.now()) {
25228
- const dir = join52(stateDir, "streams");
25265
+ const dir = join53(stateDir, "streams");
25229
25266
  if (!existsSync52(dir)) return [];
25230
25267
  const cutoff = now - retentionDays * DAY_MS2;
25231
- return readdirSync16(dir).map((name) => join52(dir, name)).filter((path) => {
25268
+ return readdirSync16(dir).map((name) => join53(dir, name)).filter((path) => {
25232
25269
  try {
25233
25270
  return statSync15(path).mtimeMs < cutoff;
25234
25271
  } catch {
@@ -25256,7 +25293,7 @@ function applyStreamSweep(paths, dryRun, log) {
25256
25293
  function planEventsSweep(stateDir, retentionDays, now = Date.now()) {
25257
25294
  if (!existsSync52(stateDir)) return [];
25258
25295
  const cutoff = now - retentionDays * DAY_MS2;
25259
- return readdirSync16(stateDir).filter((name) => ROTATED_EVENTS_RE.test(name)).map((name) => join52(stateDir, name)).filter((path) => {
25296
+ return readdirSync16(stateDir).filter((name) => ROTATED_EVENTS_RE.test(name)).map((name) => join53(stateDir, name)).filter((path) => {
25260
25297
  try {
25261
25298
  return statSync15(path).mtimeMs < cutoff;
25262
25299
  } catch {
@@ -25494,7 +25531,7 @@ import { createServer as createHttpServer } from "http";
25494
25531
  import { spawn as spawn9 } from "child_process";
25495
25532
  import { randomBytes as randomBytes2 } from "crypto";
25496
25533
  import { existsSync as existsSync53, mkdirSync as mkdirSync38, readFileSync as readFileSync49, writeFileSync as writeFileSync39, unlinkSync as unlinkSync5, readdirSync as readdirSync17 } from "fs";
25497
- import { join as join53 } from "path";
25534
+ import { join as join54 } from "path";
25498
25535
 
25499
25536
  // src/secret-compare.ts
25500
25537
  import { timingSafeEqual } from "crypto";
@@ -25587,7 +25624,7 @@ var defaultSpawn2 = (cmd, args, env) => {
25587
25624
  return child;
25588
25625
  };
25589
25626
  function syncDaemonStatePath(stateDir, workspaceId) {
25590
- return join53(stateDir, "passengers", `${workspaceId}-sync.json`);
25627
+ return join54(stateDir, "passengers", `${workspaceId}-sync.json`);
25591
25628
  }
25592
25629
  function readPersistedSyncDaemon(stateDir, workspaceId) {
25593
25630
  const path = syncDaemonStatePath(stateDir, workspaceId);
@@ -25600,7 +25637,7 @@ function readPersistedSyncDaemon(stateDir, workspaceId) {
25600
25637
  }
25601
25638
  function writePersistedSyncDaemon(stateDir, state) {
25602
25639
  const path = syncDaemonStatePath(stateDir, state.workspaceId);
25603
- mkdirSync38(join53(stateDir, "passengers"), { recursive: true });
25640
+ mkdirSync38(join54(stateDir, "passengers"), { recursive: true });
25604
25641
  writeFileSync39(path, `${JSON.stringify(state, null, 2)}
25605
25642
  `);
25606
25643
  }
@@ -25621,7 +25658,7 @@ function waitForExit(pid, alive, timeoutMs = 5e3) {
25621
25658
  }
25622
25659
  }
25623
25660
  function readAllPersistedSyncWorkspaceIds(stateDir) {
25624
- const dir = join53(stateDir, "passengers");
25661
+ const dir = join54(stateDir, "passengers");
25625
25662
  if (!existsSync53(dir)) return [];
25626
25663
  const suffix = "-sync.json";
25627
25664
  return readdirSync17(dir).filter((f) => f.endsWith(suffix)).map((f) => f.slice(0, -suffix.length));
@@ -26088,7 +26125,7 @@ async function startWorktreeIntel(d) {
26088
26125
  }
26089
26126
 
26090
26127
  // src/contract-refusal.ts
26091
- import { join as join54 } from "path";
26128
+ import { join as join55 } from "path";
26092
26129
  function contractFixers(dir, baseRef, tickets, locate) {
26093
26130
  const out = [];
26094
26131
  for (const t of tickets) {
@@ -26100,7 +26137,7 @@ function contractFixers(dir, baseRef, tickets, locate) {
26100
26137
  const text2 = gitOk(dir, ["show", `${branch}:${file}`]);
26101
26138
  if (text2 === null) continue;
26102
26139
  try {
26103
- parseRepoConfig(text2, join54(dir, file));
26140
+ parseRepoConfig(text2, join55(dir, file));
26104
26141
  } catch (e) {
26105
26142
  if (e instanceof RepoConfigError) continue;
26106
26143
  throw e;
@@ -26126,7 +26163,7 @@ import {
26126
26163
  } from "fs";
26127
26164
  import { createConnection } from "net";
26128
26165
  import { createServer as createServer2 } from "http";
26129
- import { basename as basename14, dirname as dirname34, join as join55 } from "path";
26166
+ import { basename as basename14, dirname as dirname34, join as join56 } from "path";
26130
26167
  import { execFile as execFile6, spawn as spawn12 } from "child_process";
26131
26168
 
26132
26169
  // src/periscope-control.ts
@@ -26363,7 +26400,7 @@ function runCrew(args, onLine, timeoutMs = 20 * 6e4) {
26363
26400
  // src/control-api.ts
26364
26401
  var PAUSABLE = ["dev", "design", "qa"];
26365
26402
  var CONTROL_SOCKET_NAME = "control.sock";
26366
- var controlSocketFor = (stateDir) => join55(stateDir, CONTROL_SOCKET_NAME);
26403
+ var controlSocketFor = (stateDir) => join56(stateDir, CONTROL_SOCKET_NAME);
26367
26404
  var MAX_SOCKET_PATH = 100;
26368
26405
  var MAX_TAIL_BYTES = 1024 * 1024;
26369
26406
  var MAX_WAIT_SECONDS = 30;
@@ -26450,7 +26487,7 @@ function candidates(live, rotated) {
26450
26487
  const out = [live];
26451
26488
  if (!rotated) return out;
26452
26489
  try {
26453
- for (const n of readdirSync18(dirname34(live))) if (ROTATED_EVENTS_RE.test(n)) out.push(join55(dirname34(live), n));
26490
+ for (const n of readdirSync18(dirname34(live))) if (ROTATED_EVENTS_RE.test(n)) out.push(join56(dirname34(live), n));
26454
26491
  } catch {
26455
26492
  }
26456
26493
  return out;
@@ -26650,7 +26687,7 @@ async function route(deps, method, url, req, abort) {
26650
26687
  if (p.startsWith("/streams/") && get2) {
26651
26688
  const run4 = decodeURIComponent(p.slice("/streams/".length));
26652
26689
  if (!RUN_NAME_RE.test(run4) || run4.includes("..") || /\.(pid|meta\.json|events\.jsonl)$/.test(run4)) return err2(400, "not a run name");
26653
- const file = join55(deps.stateDir, "streams", run4.endsWith(".jsonl") ? run4 : `${run4}.jsonl`);
26690
+ const file = join56(deps.stateDir, "streams", run4.endsWith(".jsonl") ? run4 : `${run4}.jsonl`);
26654
26691
  if (!existsSync54(file)) return err2(404, "no such run");
26655
26692
  return tailReply(file, url.searchParams, false, abort);
26656
26693
  }
@@ -26801,7 +26838,7 @@ function crewJson(args, timeoutMs = 6e4) {
26801
26838
 
26802
26839
  // src/periscope-mcp.ts
26803
26840
  import { lstat, mkdir, readdir, readFile, readlink, realpath, rm, stat, writeFile } from "fs/promises";
26804
- import { basename as basename15, dirname as dirname35, isAbsolute as isAbsolute5, join as join57, relative as relative2, resolve as resolve6, sep } from "path";
26841
+ import { basename as basename15, dirname as dirname35, isAbsolute as isAbsolute5, join as join58, relative as relative2, resolve as resolve6, sep } from "path";
26805
26842
  import { z } from "zod";
26806
26843
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
26807
26844
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
@@ -26809,11 +26846,11 @@ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/
26809
26846
  // src/periscope-endpoints.ts
26810
26847
  import { randomBytes as randomBytes3 } from "crypto";
26811
26848
  import { chmodSync as chmodSync5, existsSync as existsSync55, mkdirSync as mkdirSync40, readdirSync as readdirSync19, readFileSync as readFileSync50, rmSync as rmSync24, writeFileSync as writeFileSync40 } from "fs";
26812
- import { join as join56 } from "path";
26813
- var secretDir = (stateDir) => join56(stateDir, "periscope-mcp");
26814
- var secretFile = (stateDir, id) => join56(secretDir(stateDir), `${id}.json`);
26815
- var endpointDir = (stateDir) => join56(stateDir, "periscope-endpoints");
26816
- var endpointFile = (stateDir, id) => join56(endpointDir(stateDir), `${id}.json`);
26849
+ import { join as join57 } from "path";
26850
+ var secretDir = (stateDir) => join57(stateDir, "periscope-mcp");
26851
+ var secretFile = (stateDir, id) => join57(secretDir(stateDir), `${id}.json`);
26852
+ var endpointDir = (stateDir) => join57(stateDir, "periscope-endpoints");
26853
+ var endpointFile = (stateDir, id) => join57(endpointDir(stateDir), `${id}.json`);
26817
26854
  function mintPeriscopeSecret(stateDir, ticketRecordId) {
26818
26855
  mkdirSync40(secretDir(stateDir), { recursive: true, mode: 448 });
26819
26856
  const secret = randomBytes3(32).toString("base64url");
@@ -26954,13 +26991,13 @@ async function resolveInWorktree(root, requested) {
26954
26991
  let abs;
26955
26992
  if (isAbsolute5(requested)) {
26956
26993
  abs = resolve6(requested);
26957
- if (isInside(root, abs)) abs = join57(realRoot, relative2(root, abs));
26994
+ if (isInside(root, abs)) abs = join58(realRoot, relative2(root, abs));
26958
26995
  } else {
26959
26996
  abs = resolve6(realRoot, requested);
26960
26997
  }
26961
26998
  if (!isInside(realRoot, abs)) throw new PathRefusal(`${requested} is outside this periscope's worktree`);
26962
26999
  const { real, rest } = await realAncestor(abs);
26963
- const final = rest ? join57(real, rest) : real;
27000
+ const final = rest ? join58(real, rest) : real;
26964
27001
  if (!isInside(realRoot, final)) throw new PathRefusal(`${requested} is outside this periscope's worktree`);
26965
27002
  if (relative2(realRoot, final).split(sep).includes(".git")) throw new PathRefusal(".git is not reachable from a periscope");
26966
27003
  return final;
@@ -27028,7 +27065,7 @@ function createPeriscopeMcpServer(d, sc) {
27028
27065
  const entries = (await readdir(abs, { withFileTypes: true })).filter((e) => e.name !== ".git");
27029
27066
  const lines2 = await Promise.all(entries.map(async (e) => {
27030
27067
  if (e.isDirectory()) return `[DIR] ${e.name}`;
27031
- const size = (await lstat(join57(abs, e.name))).size;
27068
+ const size = (await lstat(join58(abs, e.name))).size;
27032
27069
  return `[FILE] ${e.name} (${size} bytes)`;
27033
27070
  }));
27034
27071
  return text(lines2.join("\n") || "(empty)");
@@ -27094,7 +27131,7 @@ function createPeriscopeMcpServer(d, sc) {
27094
27131
  annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
27095
27132
  }, async ({ path }) => {
27096
27133
  const parent = await inTree(dirname35(path) === "" ? "." : dirname35(path));
27097
- const abs = join57(parent, basename15(path));
27134
+ const abs = join58(parent, basename15(path));
27098
27135
  if (basename15(path) === ".git" || abs === parent) return text("path must name a file", true);
27099
27136
  const st = await lstat(abs).catch(() => void 0);
27100
27137
  if (!st) return text(`${path} does not exist`, true);
@@ -28277,7 +28314,7 @@ if (command === "passenger-sync-daemon") {
28277
28314
  }
28278
28315
  if (host === "linux" && hasSystemd) {
28279
28316
  const label = labelFor(CREW_HOME, "run");
28280
- const staleTimer = join58(homedir11(), ".config", "systemd", "user", `${label}.timer`);
28317
+ const staleTimer = join59(homedir11(), ".config", "systemd", "user", `${label}.timer`);
28281
28318
  if (existsSync56(staleTimer)) {
28282
28319
  process.stdout.write(
28283
28320
  `removing stale run timer from before the persistent-service cutover: ${staleTimer}${dryRun ? " (dry run)" : ""}
@@ -28317,6 +28354,14 @@ if (command === "passenger-sync-daemon") {
28317
28354
  const mine = matchShipRows(ships, cfg.ship.name, doctorMachineId(cfg.ship.stateDir)).rows;
28318
28355
  if (mine.length !== 1) problems.push(`ship record: ${mine.length} rows named "${cfg.ship.name}"`);
28319
28356
  else if (mine[0].platform && mine[0].platform !== host) problems.push(`ship record: declares ${mine[0].platform}, this host is ${host}`);
28357
+ const fleet = ships.map((x) => x.platform ?? "").filter(isShipPlatform);
28358
+ if (fleet.length > 0) {
28359
+ for (const r of doctorRepos) {
28360
+ if (!fleet.some((p) => satisfies(p, r.config.platform))) {
28361
+ problems.push(`repo ${r.name}: requires ${r.config.platform}, but no registered ship satisfies it (ships: ${[...new Set(fleet)].join(", ")})`);
28362
+ }
28363
+ }
28364
+ }
28320
28365
  }
28321
28366
  } catch (e) {
28322
28367
  problems.push(`tracker unreachable: ${e instanceof Error ? e.message : String(e)}`);
@@ -28580,7 +28625,7 @@ ${changed2.map((c) => ` - ${c}
28580
28625
  harnessBin: "claude",
28581
28626
  ...contract.sandboxNetwork ? { extraHosts: contract.sandboxNetwork.hosts, toolchains: contract.sandboxNetwork.toolchains } : {}
28582
28627
  },
28583
- policyFile: join58(cfg.ship.stateDir, "release", `${target.name}.policy.yaml`),
28628
+ policyFile: join59(cfg.ship.stateDir, "release", `${target.name}.policy.yaml`),
28584
28629
  repo: mirror,
28585
28630
  origin: forgeDescriptorFor(forgeHost).httpsUrl(mirror.host, mirror.path),
28586
28631
  base: effective.branch.base,
@@ -28648,11 +28693,18 @@ ${changed2.map((c) => ` - ${c}
28648
28693
  }, target.dir);
28649
28694
  const problems = validateEffective(repo);
28650
28695
  for (const p of problems) remit.warn(`${scope}: ${p}`);
28651
- if (!satisfies(cfg.ship.platform, repo.platform)) {
28696
+ const baseAdmitsShip = satisfies(cfg.ship.platform, repo.platform);
28697
+ if (!baseAdmitsShip && dryRun) {
28652
28698
  const detail = explain(cfg.ship.platform, repo.platform);
28653
28699
  remit.emit(`${scope}: skipping \u2014 ${detail}`, { step: "release" });
28654
28700
  return { scope, tests: "skipped", outcome: "skipped", detail };
28655
28701
  }
28702
+ if (baseAdmitsShip) {
28703
+ try {
28704
+ clearShipAttention(new State(cfg.ship.stateDir), repoPlatformUnreleasableKey(target.name));
28705
+ } catch {
28706
+ }
28707
+ }
28656
28708
  const who2 = releaserFor(repo.release, cfg.ship.name);
28657
28709
  if (!who2.releases) {
28658
28710
  const note = nonReleaserNote(target.name, who2.releaser);
@@ -28694,6 +28746,45 @@ ${changed2.map((c) => ` - ${c}
28694
28746
  );
28695
28747
  reportUnplaceable(c.route, preUnplaceable, tracker.contract.statuses.verified, remit);
28696
28748
  const remoteBase = remoteBranchExists(target.dir, repo.branch.remote, repo.branch.base);
28749
+ if (!baseAdmitsShip) {
28750
+ const baseRef = remoteBase ? `${repo.branch.remote}/${repo.branch.base}` : repo.branch.base;
28751
+ const verifiedPre = pre.filter((t) => t.status === tracker.contract.statuses.verified);
28752
+ const admitters = platformAdmitters(
28753
+ target.dir,
28754
+ baseRef,
28755
+ cfg.ship.platform,
28756
+ verifiedPre,
28757
+ (t) => locateBranchForTicket(target.dir, repo, t)?.branch ?? null
28758
+ );
28759
+ if (admitters.length === 0) {
28760
+ const detail = explain(cfg.ship.platform, repo.platform);
28761
+ const ids = verifiedPre.map((t) => t.issue_id);
28762
+ if (firstReport(`${scope}:platform:${ids.join(",")}`)) remit.emit(`${scope}: skipping \u2014 ${detail}`, { step: "release" });
28763
+ if (ids.length) {
28764
+ try {
28765
+ await raiseShipAttention(
28766
+ { state, emit: remit, route: c, ship: cfg.ship },
28767
+ repoPlatformUnreleasableItem(target.name, platformStuckNote(target.name, repo.platform, cfg.ship.platform, ids))
28768
+ );
28769
+ } catch {
28770
+ }
28771
+ } else {
28772
+ try {
28773
+ clearShipAttention(state, repoPlatformUnreleasableKey(target.name));
28774
+ } catch {
28775
+ }
28776
+ }
28777
+ return { scope, tests: "skipped", outcome: "skipped", detail };
28778
+ }
28779
+ try {
28780
+ clearShipAttention(state, repoPlatformUnreleasableKey(target.name));
28781
+ } catch {
28782
+ }
28783
+ remit.emit(
28784
+ `${scope}: the base contract requires ${repo.platform}, but ${admitters.map((a) => a.issueId).join(", ")} change${admitters.length === 1 ? "s" : ""} platform to ${admitters[0].platform}, which this ship satisfies \u2014 releasing`,
28785
+ { step: "release" }
28786
+ );
28787
+ }
28697
28788
  const d = decideRelease(target.dir, pre, tracker.contract, {
28698
28789
  tagPattern: repo.release.tagPattern ?? "v*",
28699
28790
  base: repo.branch.base,
@@ -29736,7 +29827,7 @@ ${cu.tail.trimEnd()}
29736
29827
  logFile: cfg.ship.logFile
29737
29828
  });
29738
29829
  }
29739
- const watchPaths = isCompiledBinary(import.meta.url) ? [process.execPath] : [join58(CREW_HOME, "src"), join58(CREW_HOME, "dist"), join58(CREW_HOME, "bin")];
29830
+ const watchPaths = isCompiledBinary(import.meta.url) ? [process.execPath] : [join59(CREW_HOME, "src"), join59(CREW_HOME, "dist"), join59(CREW_HOME, "bin")];
29740
29831
  const configPaths = daemonConfigPaths(cfg);
29741
29832
  watchPaths.push(...configPaths);
29742
29833
  noteDaemonStarted(cfg.ship.stateDir);
@@ -31773,10 +31864,10 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
31773
31864
  startupSeconds: cfg.ship.intelStartupSeconds,
31774
31865
  prepare: async (path) => {
31775
31866
  for (const f of repoWt.config.worktrees.copy) {
31776
- const src = join58(repoWt.dir, f);
31777
- if (!existsSync56(src) || existsSync56(join58(path, f))) continue;
31778
- mkdirSync41(dirOf2(join58(path, f)), { recursive: true });
31779
- copyFileSync2(src, join58(path, f));
31867
+ const src = join59(repoWt.dir, f);
31868
+ if (!existsSync56(src) || existsSync56(join59(path, f))) continue;
31869
+ mkdirSync41(dirOf2(join59(path, f)), { recursive: true });
31870
+ copyFileSync2(src, join59(path, f));
31780
31871
  }
31781
31872
  const setup = repoWt.config.hooks.setup;
31782
31873
  return setup ? runScript(setup, { cwd: path, shell: shellWt }) : null;
@@ -32105,10 +32196,10 @@ ${where.join("\n")}`);
32105
32196
  },
32106
32197
  prepare: async (path) => {
32107
32198
  for (const f of repoP.config.worktrees.copy) {
32108
- const src = join58(repoP.dir, f);
32199
+ const src = join59(repoP.dir, f);
32109
32200
  if (!existsSync56(src)) continue;
32110
- mkdirSync41(dirOf2(join58(path, f)), { recursive: true });
32111
- copyFileSync2(src, join58(path, f));
32201
+ mkdirSync41(dirOf2(join59(path, f)), { recursive: true });
32202
+ copyFileSync2(src, join59(path, f));
32112
32203
  }
32113
32204
  const setup = repoP.config.hooks.setup;
32114
32205
  return setup ? runScript(setup, { cwd: path, shell: shellP, onLine: (l) => {
@@ -32618,12 +32709,12 @@ ${where.join("\n")}`);
32618
32709
  `);
32619
32710
  }
32620
32711
  }
32621
- if (existsSync56(join58(dir, ".git")) && basename16(dir) === SAMPLE_REPO) rmSync25(dir, { recursive: true, force: true });
32712
+ if (existsSync56(join59(dir, ".git")) && basename16(dir) === SAMPLE_REPO) rmSync25(dir, { recursive: true, force: true });
32622
32713
  say("removed", { dir, closed }, `removed the sample repo${closed.length ? `, closed ${closed.join(", ")}` : ""}`);
32623
32714
  break;
32624
32715
  }
32625
32716
  const projectId = route2.resolved.areaId ?? resolveRepoProject(await tracker.projectRows(), value("project"));
32626
- const fresh = !existsSync56(join58(dir, ".git"));
32717
+ const fresh = !existsSync56(join59(dir, ".git"));
32627
32718
  if (existsSync56(dir) && fresh && readdirSync20(dir).length > 0) fail2(`${dir} exists and is not a git checkout \u2014 move it aside`);
32628
32719
  if (dryRun) {
32629
32720
  say("dry-run", { dir, newCheckout: fresh, repoRow: row?.id ?? null }, `would ${fresh ? "create" : "reuse"} ${dir}${row ? "" : ", create the Repos row"}, and file one ${tracker.contract.statuses.approved} ticket`);
@@ -32631,8 +32722,8 @@ ${where.join("\n")}`);
32631
32722
  }
32632
32723
  if (fresh) {
32633
32724
  mkdirSync41(dir, { recursive: true });
32634
- writeFileSync41(join58(dir, "README.md"), SAMPLE_README);
32635
- writeFileSync41(join58(dir, ".crew.yaml"), SAMPLE_CREW_YAML);
32725
+ writeFileSync41(join59(dir, "README.md"), SAMPLE_README);
32726
+ writeFileSync41(join59(dir, ".crew.yaml"), SAMPLE_CREW_YAML);
32636
32727
  const g = (...a) => {
32637
32728
  const r = spawnSync13("git", a, { cwd: dir, encoding: "utf8" });
32638
32729
  if (r.status !== 0) fail2(`git ${a[0]} failed in ${dir}: ${(r.stderr || r.stdout).trim()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.137.9",
3
+ "version": "0.137.11",
4
4
  "description": "A standing team of headless agents that picks work off a Tablation board, does it on a machine you control, and reports back.",
5
5
  "type": "module",
6
6
  "license": "MIT",