@archme/cli 0.23.0 → 0.25.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 +30 -17
- package/package.json +1 -1
- package/sandbox-image.json +1 -1
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)
|
|
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
|
|
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,
|
|
@@ -22252,7 +22259,7 @@ function deriveWebOrigin(apiUrl, onMalformed = "throw") {
|
|
|
22252
22259
|
}
|
|
22253
22260
|
function buildWebUrl(opts) {
|
|
22254
22261
|
const origin = deriveWebOrigin(opts.apiUrl, opts.onMalformed ?? "throw");
|
|
22255
|
-
return `${origin}/a/${encodeURIComponent(opts.orgSlug)}/${encodeURIComponent(opts.projectSlug)}/${encodeURIComponent(opts.
|
|
22262
|
+
return `${origin}/a/${encodeURIComponent(opts.orgSlug)}/${encodeURIComponent(opts.projectSlug)}/${encodeURIComponent(opts.branchName)}`;
|
|
22256
22263
|
}
|
|
22257
22264
|
var init_web_url = __esm({
|
|
22258
22265
|
"src/scan/web-url.ts"() {
|
|
@@ -22529,10 +22536,11 @@ function resolveArchitectureBranchName(branches) {
|
|
|
22529
22536
|
}
|
|
22530
22537
|
return branches[0].name;
|
|
22531
22538
|
}
|
|
22532
|
-
var SCAN_BRANCH_SUFFIX;
|
|
22539
|
+
var SCAN_BRANCH_SUFFIX, DEFAULT_BRANCH_NAME;
|
|
22533
22540
|
var init_branchResolution = __esm({
|
|
22534
22541
|
"../shared/branchResolution.ts"() {
|
|
22535
22542
|
SCAN_BRANCH_SUFFIX = "-scan";
|
|
22543
|
+
DEFAULT_BRANCH_NAME = "main-scan";
|
|
22536
22544
|
}
|
|
22537
22545
|
});
|
|
22538
22546
|
|
|
@@ -22752,7 +22760,7 @@ async function resolveOrCreateProject(supabase, userId, fullSlug) {
|
|
|
22752
22760
|
throw new Error("failed to create project: insert returned no row");
|
|
22753
22761
|
}
|
|
22754
22762
|
const projectId = created.id;
|
|
22755
|
-
const { error: bErr } = await supabase.from("branches").insert({ project_id: projectId, name:
|
|
22763
|
+
const { error: bErr } = await supabase.from("branches").insert({ project_id: projectId, name: DEFAULT_BRANCH_NAME, is_default: true });
|
|
22756
22764
|
if (bErr) {
|
|
22757
22765
|
const { error: rollbackErr } = await supabase.from("projects").update({ deleted_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", projectId);
|
|
22758
22766
|
if (rollbackErr) {
|
|
@@ -22768,7 +22776,7 @@ async function resolveOrCreateProject(supabase, userId, fullSlug) {
|
|
|
22768
22776
|
orgSlug: org.slug,
|
|
22769
22777
|
projectSlug,
|
|
22770
22778
|
projectId,
|
|
22771
|
-
defaultBranch:
|
|
22779
|
+
defaultBranch: DEFAULT_BRANCH_NAME,
|
|
22772
22780
|
created: true
|
|
22773
22781
|
};
|
|
22774
22782
|
}
|
|
@@ -22793,7 +22801,7 @@ async function claimSignupDefaultProject(supabase, org, projectSlug) {
|
|
|
22793
22801
|
const { data: branches } = await supabase.from("branches").select("name, is_default").eq("project_id", row.id).is("deleted_at", null);
|
|
22794
22802
|
const existing = branches ?? [];
|
|
22795
22803
|
if (existing.length === 0) {
|
|
22796
|
-
const { error: bErr } = await supabase.from("branches").insert({ project_id: row.id, name:
|
|
22804
|
+
const { error: bErr } = await supabase.from("branches").insert({ project_id: row.id, name: DEFAULT_BRANCH_NAME, is_default: true });
|
|
22797
22805
|
if (bErr) return null;
|
|
22798
22806
|
}
|
|
22799
22807
|
const { error: renameErr } = await supabase.from("projects").update({ name: projectSlug, slug: projectSlug }).eq("id", row.id);
|
|
@@ -22802,7 +22810,7 @@ async function claimSignupDefaultProject(supabase, org, projectSlug) {
|
|
|
22802
22810
|
orgSlug: org.slug,
|
|
22803
22811
|
projectSlug,
|
|
22804
22812
|
projectId: row.id,
|
|
22805
|
-
defaultBranch: existing.find((b) => b.is_default)?.name ??
|
|
22813
|
+
defaultBranch: existing.find((b) => b.is_default)?.name ?? DEFAULT_BRANCH_NAME,
|
|
22806
22814
|
created: true
|
|
22807
22815
|
};
|
|
22808
22816
|
} catch {
|
|
@@ -22831,7 +22839,7 @@ async function fetchExistingProject(supabase, org, projectSlug) {
|
|
|
22831
22839
|
`branches lookup failed for project \`${org.slug}/${projectSlug}\``
|
|
22832
22840
|
);
|
|
22833
22841
|
const rows = branches ?? [];
|
|
22834
|
-
const defaultBranch = rows.find((b) => b.is_default)?.name ??
|
|
22842
|
+
const defaultBranch = rows.find((b) => b.is_default)?.name ?? DEFAULT_BRANCH_NAME;
|
|
22835
22843
|
const architectureBranch = resolveArchitectureBranchName(rows.map((b) => ({ name: b.name, isDefault: b.is_default }))) ?? defaultBranch;
|
|
22836
22844
|
return {
|
|
22837
22845
|
orgSlug: org.slug,
|
|
@@ -23104,13 +23112,11 @@ async function runScan(opts, deps = {}) {
|
|
|
23104
23112
|
if (markerErr) log(` marker advance failed (next daemon job has no usable base): ${markerErr}`);
|
|
23105
23113
|
else log(` marker advanced: ${branchName2} \u2192 ${headSha.slice(0, 8)}${repo ? ` (${repo})` : ""}`);
|
|
23106
23114
|
}
|
|
23107
|
-
const diffBase = resolved2.defaultBranch;
|
|
23108
23115
|
const webUrl = buildWebUrl({
|
|
23109
23116
|
apiUrl: mcpUrl,
|
|
23110
23117
|
orgSlug: resolved2.orgSlug,
|
|
23111
23118
|
projectSlug: resolved2.projectSlug,
|
|
23112
23119
|
branchName: branchName2,
|
|
23113
|
-
defaultBranch: diffBase,
|
|
23114
23120
|
// CLI: throw on malformed mcpUrl so misconfiguration is loud.
|
|
23115
23121
|
onMalformed: "throw"
|
|
23116
23122
|
});
|
|
@@ -23954,6 +23960,12 @@ async function computeDiff(job, repoDir, marker, gitEnv) {
|
|
|
23954
23960
|
}
|
|
23955
23961
|
const { exitCode } = await execa("git", ["merge-base", "--is-ancestor", after, base], { cwd: repoDir, reject: false });
|
|
23956
23962
|
if (exitCode === 0) return "skip";
|
|
23963
|
+
const before = job.before_sha?.toLowerCase();
|
|
23964
|
+
if (!job.forced && before && before !== base.toLowerCase() && before !== marker.rolledUpThrough?.toLowerCase()) {
|
|
23965
|
+
throw new Error(
|
|
23966
|
+
`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.`
|
|
23967
|
+
);
|
|
23968
|
+
}
|
|
23957
23969
|
const payload = await buildDiffPayload(repoDir, base, after);
|
|
23958
23970
|
if (job.forced) payload.provenance = await forcePushProvenance(repoDir, base, after);
|
|
23959
23971
|
return payload;
|
|
@@ -30971,7 +30983,6 @@ async function alreadyOnBoard(opts, deps, root, repo) {
|
|
|
30971
30983
|
orgSlug: existing.orgSlug,
|
|
30972
30984
|
projectSlug: existing.projectSlug,
|
|
30973
30985
|
branchName: branch,
|
|
30974
|
-
defaultBranch: existing.defaultBranch,
|
|
30975
30986
|
onMalformed: "fallback"
|
|
30976
30987
|
});
|
|
30977
30988
|
return { project: pin.project, branch, webUrl };
|
|
@@ -31187,7 +31198,6 @@ async function buildSingle(opts, deps, setup, handoff, conversation, interactive
|
|
|
31187
31198
|
orgSlug: project.orgSlug,
|
|
31188
31199
|
projectSlug: project.projectSlug,
|
|
31189
31200
|
branchName: scanBranch,
|
|
31190
|
-
defaultBranch: project.defaultBranch,
|
|
31191
31201
|
onMalformed: "throw"
|
|
31192
31202
|
});
|
|
31193
31203
|
let exitCode = 0;
|
|
@@ -31562,7 +31572,6 @@ ${fullSlug} already holds other repos, so ${git4.repoSlug} needs its own contain
|
|
|
31562
31572
|
orgSlug: project.orgSlug,
|
|
31563
31573
|
projectSlug: project.projectSlug,
|
|
31564
31574
|
branchName: scanBranch,
|
|
31565
|
-
defaultBranch: project.defaultBranch,
|
|
31566
31575
|
onMalformed: "throw"
|
|
31567
31576
|
});
|
|
31568
31577
|
log(`
|
|
@@ -31587,7 +31596,6 @@ ${fullSlug} already holds other repos, so ${git4.repoSlug} needs its own contain
|
|
|
31587
31596
|
orgSlug: project.orgSlug,
|
|
31588
31597
|
projectSlug: project.projectSlug,
|
|
31589
31598
|
branchName: scanBranch,
|
|
31590
|
-
defaultBranch: project.defaultBranch,
|
|
31591
31599
|
onMalformed: "throw"
|
|
31592
31600
|
});
|
|
31593
31601
|
const wantsScan = shouldRunScan({
|
|
@@ -33268,7 +33276,12 @@ function parseCredentials(raw) {
|
|
|
33268
33276
|
}
|
|
33269
33277
|
function parseMarker(raw) {
|
|
33270
33278
|
if (!isObj2(raw)) fail("marker must be an object");
|
|
33271
|
-
|
|
33279
|
+
const rolledUpThrough = optStr(raw, "rolledUpThrough", "marker");
|
|
33280
|
+
return {
|
|
33281
|
+
sha: optStr(raw, "sha", "marker"),
|
|
33282
|
+
repo: optStr(raw, "repo", "marker"),
|
|
33283
|
+
...rolledUpThrough ? { rolledUpThrough } : {}
|
|
33284
|
+
};
|
|
33272
33285
|
}
|
|
33273
33286
|
function parseSeedArch(raw) {
|
|
33274
33287
|
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.
|
|
3
|
+
"version": "0.25.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",
|
package/sandbox-image.json
CHANGED