@archme/cli 0.23.0 → 0.24.0

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/cli.js CHANGED
@@ -18920,7 +18920,13 @@ function pickSourceMarker(rows, legacy, repo) {
18920
18920
  return legacy?.last_source_sha && !legacy.last_source_repo ? { sha: legacy.last_source_sha, repo: null } : { sha: null, repo: null };
18921
18921
  }
18922
18922
  const row = rows.find((r) => sameRepo(`${r.repo_owner}/${r.repo_name}`, repo));
18923
- if (row) return { sha: row.last_source_sha, repo: `${row.repo_owner}/${row.repo_name}` };
18923
+ if (row) {
18924
+ return {
18925
+ sha: row.last_source_sha,
18926
+ repo: `${row.repo_owner}/${row.repo_name}`,
18927
+ ...row.rolled_up_through_sha ? { rolledUpThrough: row.rolled_up_through_sha } : {}
18928
+ };
18929
+ }
18924
18930
  if (legacy?.last_source_sha && sameRepo(legacy.last_source_repo, repo)) {
18925
18931
  return { sha: legacy.last_source_sha, repo: legacy.last_source_repo };
18926
18932
  }
@@ -18937,7 +18943,7 @@ async function readBranchMarker(client, projectId, archmeBranch, repo) {
18937
18943
  const { data, error } = await client.from("branches").select("id, last_source_sha, last_source_repo").eq("project_id", projectId).eq("name", archmeBranch).is("deleted_at", null).maybeSingle();
18938
18944
  if (error || !data) return NO_MARKER;
18939
18945
  const branch = data;
18940
- const markers = await client.from("branch_source_markers").select("repo_owner, repo_name, last_source_sha").eq("branch_id", branch.id);
18946
+ const markers = await client.from("branch_source_markers").select("repo_owner, repo_name, last_source_sha, rolled_up_through_sha").eq("branch_id", branch.id);
18941
18947
  if (markers.error && !MISSING_RELATION.has(markers.error.code ?? "")) {
18942
18948
  return NO_MARKER;
18943
18949
  }
@@ -19972,7 +19978,8 @@ async function pollRepoOnce(entry, deps) {
19972
19978
  }
19973
19979
  await deps.git.fetchOrigin(entry.mirrorPath, row.repoBranch);
19974
19980
  const jobRepo = row.repoOwner && row.repoName ? `${row.repoOwner}/${row.repoName}` : repo;
19975
- const marker = await deps.readMarker(row.projectId, row.archmeBranch, jobRepo);
19981
+ const read = await deps.readMarker(row.projectId, row.archmeBranch, jobRepo);
19982
+ const marker = { ...read, sha: read.rolledUpThrough ?? read.sha };
19976
19983
  const upstreamTip = await deps.git.revParse(entry.mirrorPath, `origin/${row.repoBranch}`);
19977
19984
  const base = {
19978
19985
  marker,
@@ -23954,6 +23961,12 @@ async function computeDiff(job, repoDir, marker, gitEnv) {
23954
23961
  }
23955
23962
  const { exitCode } = await execa("git", ["merge-base", "--is-ancestor", after, base], { cwd: repoDir, reject: false });
23956
23963
  if (exitCode === 0) return "skip";
23964
+ const before = job.before_sha?.toLowerCase();
23965
+ if (!job.forced && before && before !== base.toLowerCase() && before !== marker.rolledUpThrough?.toLowerCase()) {
23966
+ throw new Error(
23967
+ `commit ${after.slice(0, 8)} does not follow ${base.slice(0, 8)}, the last commit this board reflects for ${job.repo_owner}/${job.repo_name}: a commit between them has no architecture update. Requeue it, or roll it up into the next one.`
23968
+ );
23969
+ }
23957
23970
  const payload = await buildDiffPayload(repoDir, base, after);
23958
23971
  if (job.forced) payload.provenance = await forcePushProvenance(repoDir, base, after);
23959
23972
  return payload;
@@ -33268,7 +33281,12 @@ function parseCredentials(raw) {
33268
33281
  }
33269
33282
  function parseMarker(raw) {
33270
33283
  if (!isObj2(raw)) fail("marker must be an object");
33271
- return { sha: optStr(raw, "sha", "marker"), repo: optStr(raw, "repo", "marker") };
33284
+ const rolledUpThrough = optStr(raw, "rolledUpThrough", "marker");
33285
+ return {
33286
+ sha: optStr(raw, "sha", "marker"),
33287
+ repo: optStr(raw, "repo", "marker"),
33288
+ ...rolledUpThrough ? { rolledUpThrough } : {}
33289
+ };
33272
33290
  }
33273
33291
  function parseSeedArch(raw) {
33274
33292
  if (raw === null || raw === void 0) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archme/cli",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Map your codebase into a living architecture diagram: run `archme init` in a repo to scan it, `archme daemon start` to keep it current on every commit.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "image": "ghcr.io/architectme/archme-job",
3
- "digest": "sha256:3c2485d70aaa785c55a1fc9afaa29ffd0fa5284fb85847a0e9510072435bea9f"
3
+ "digest": "sha256:a3570fe75b9b66cc7a345e5c0a7efc8ed52d1dfc79571ef4362795c7d27a0efc"
4
4
  }