@tablation/crew 0.80.0 → 0.80.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +43 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -11975,6 +11975,27 @@ function planStamp(cwd, tickets, contract, fromSha, toSha, merged = /* @__PURE__
11975
11975
  function mergedAtFor(cwd, sha, fallback) {
11976
11976
  return cwd && commitDate(cwd, sha) || fallback;
11977
11977
  }
11978
+ async function applyMergeStamp(tracker, merged, tickets, emit, dryRun, cwd) {
11979
+ let stamped = 0;
11980
+ const at = (/* @__PURE__ */ new Date()).toISOString();
11981
+ for (const ticket of tickets) {
11982
+ const sha = merged.get(ticket.issue_id);
11983
+ if (dryRun) {
11984
+ emit.emit(`would stamp commit_sha${sha ? ` (${sha.slice(0, 8)})` : ""}`, { ticket: ticket.issue_id });
11985
+ stamped++;
11986
+ continue;
11987
+ }
11988
+ if (!sha || ticket.commit_sha === sha) continue;
11989
+ try {
11990
+ await tracker.updateTicket(ticket.id, { commit_sha: sha, merged_at: mergedAtFor(cwd, sha, at) });
11991
+ emit.emit(`stamped commit_sha (${sha.slice(0, 8)})`, { ticket: ticket.issue_id });
11992
+ stamped++;
11993
+ } catch (e) {
11994
+ emit.warn(`could not stamp commit_sha: ${e.message}`, { ticket: ticket.issue_id });
11995
+ }
11996
+ }
11997
+ return stamped;
11998
+ }
11978
11999
  async function applyStamp(tracker, plan, version, contract, emit, dryRun, cwd) {
11979
12000
  let stamped = 0;
11980
12001
  const at = (/* @__PURE__ */ new Date()).toISOString();
@@ -11987,6 +12008,7 @@ async function applyStamp(tracker, plan, version, contract, emit, dryRun, cwd) {
11987
12008
  stamped++;
11988
12009
  continue;
11989
12010
  }
12011
+ const recordMerge = !!sha && !ticket.commit_sha;
11990
12012
  try {
11991
12013
  await tracker.updateTicket(ticket.id, {
11992
12014
  status: contract.statuses.deployed,
@@ -11997,7 +12019,7 @@ async function applyStamp(tracker, plan, version, contract, emit, dryRun, cwd) {
11997
12019
  // ticket's record should mean the same thing regardless of which
11998
12020
  // release mode closed it (ISSUE-218). `merged_at` is the commit's own
11999
12021
  // date, not the stamp time (which trails the deploy in ci_* modes).
12000
- ...sha ? { commit_sha: sha, merged_at: mergedAtFor(cwd, sha, at) } : {}
12022
+ ...recordMerge && sha ? { commit_sha: sha, merged_at: mergedAtFor(cwd, sha, at) } : {}
12001
12023
  });
12002
12024
  emit.emit(`stamped ${contract.statuses.deployed}${version ? ` (${version})` : ""}${shaNote}`, {
12003
12025
  ticket: ticket.issue_id
@@ -13072,6 +13094,13 @@ async function mergeAndRelease(o, decision, fresh, releaseBranch, isolated = fal
13072
13094
  }
13073
13095
  }
13074
13096
  }
13097
+ if (o.repo.release.mode === "ci_auto" || o.repo.release.mode === "ci_manual") {
13098
+ try {
13099
+ await o.onBasePushed?.(merged);
13100
+ } catch (e) {
13101
+ o.emit.warn(`could not record merged tickets: ${e.message}`);
13102
+ }
13103
+ }
13075
13104
  let deployed = false;
13076
13105
  let integrated = false;
13077
13106
  if (o.repo.release.mode === "integrate") {
@@ -18292,6 +18321,19 @@ ${changed2.map((c) => ` - ${c}
18292
18321
  skipTests: flag("skip-tests"),
18293
18322
  shell: cfg.ship.shell,
18294
18323
  mergeOnly: command === "merge",
18324
+ // ci_* modes: record the merge on the board when it lands on base,
18325
+ // not only once CI confirms the release live (CREW-2820).
18326
+ onBasePushed: async (merged) => {
18327
+ remit.enter("reconcile");
18328
+ await applyMergeStamp(
18329
+ tracker,
18330
+ new Map(merged.map((m) => [m.ticket.issue_id, m.sha])),
18331
+ merged.map((m) => m.ticket),
18332
+ remit,
18333
+ dryRun,
18334
+ target.dir
18335
+ );
18336
+ },
18295
18337
  // `deploy` is the "go now" button: it exists for a commit a previous
18296
18338
  // deploy failed on, where nothing new will merge but the work is
18297
18339
  // genuinely unreleased.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tablation/crew",
3
- "version": "0.80.0",
3
+ "version": "0.80.1",
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",