@archme/cli 0.26.0 → 0.27.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 +52 -17
- package/package.json +1 -1
- package/sandbox-image.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -19129,6 +19129,7 @@ function parseLocalRepos(raw) {
|
|
|
19129
19129
|
if (typeof raw2.haltedAt === "string" && raw2.haltedAt) entry.haltedAt = raw2.haltedAt;
|
|
19130
19130
|
if (typeof raw2.haltReason === "string" && raw2.haltReason) entry.haltReason = raw2.haltReason;
|
|
19131
19131
|
if (typeof raw2.haltCode === "string" && raw2.haltCode) entry.haltCode = raw2.haltCode;
|
|
19132
|
+
if (typeof raw2.haltSha === "string" && raw2.haltSha) entry.haltSha = raw2.haltSha;
|
|
19132
19133
|
const prPoll = parsePrPollState(raw2.prPoll);
|
|
19133
19134
|
if (prPoll) entry.prPoll = prPoll;
|
|
19134
19135
|
if (typeof raw2.prPausedAt === "string" && raw2.prPausedAt) entry.prPausedAt = raw2.prPausedAt;
|
|
@@ -19158,9 +19159,9 @@ function removeLocalReposBySlug(repos, slug) {
|
|
|
19158
19159
|
const want = slug.toLowerCase();
|
|
19159
19160
|
return repos.filter((r) => slugOf(r).toLowerCase() !== want);
|
|
19160
19161
|
}
|
|
19161
|
-
function markHalted(repos, watchedRepoId, reason, at, code) {
|
|
19162
|
+
function markHalted(repos, watchedRepoId, reason, at, code, sha2) {
|
|
19162
19163
|
return repos.map(
|
|
19163
|
-
(r) => r.watchedRepoId === watchedRepoId ? { ...r, haltedAt: at, haltReason: reason, haltCode: code } : r
|
|
19164
|
+
(r) => r.watchedRepoId === watchedRepoId ? { ...r, haltedAt: at, haltReason: reason, haltCode: code, haltSha: sha2 } : r
|
|
19164
19165
|
);
|
|
19165
19166
|
}
|
|
19166
19167
|
function setPrPollState(repos, watchedRepoId, prPoll) {
|
|
@@ -19176,7 +19177,7 @@ function markPrPaused(repos, watchedRepoId, at) {
|
|
|
19176
19177
|
function clearHalt(repos, watchedRepoId) {
|
|
19177
19178
|
return repos.map((r) => {
|
|
19178
19179
|
if (r.watchedRepoId !== watchedRepoId) return r;
|
|
19179
|
-
const { haltedAt: _at, haltReason: _reason, haltCode: _code, ...rest } = r;
|
|
19180
|
+
const { haltedAt: _at, haltReason: _reason, haltCode: _code, haltSha: _sha, ...rest } = r;
|
|
19180
19181
|
return rest;
|
|
19181
19182
|
});
|
|
19182
19183
|
}
|
|
@@ -19385,7 +19386,8 @@ function planPollTick(input) {
|
|
|
19385
19386
|
return {
|
|
19386
19387
|
kind: "halt",
|
|
19387
19388
|
code: decision.code,
|
|
19388
|
-
reason: localHaltReason(decision, input.jobForTarget, target)
|
|
19389
|
+
reason: localHaltReason(decision, input.jobForTarget, target),
|
|
19390
|
+
...decision.code === "job-terminal" && input.jobForTarget.status === "failed" ? { sha: target } : {}
|
|
19389
19391
|
};
|
|
19390
19392
|
case "advance":
|
|
19391
19393
|
return { kind: "idle", reason: decision.reason };
|
|
@@ -19393,10 +19395,14 @@ function planPollTick(input) {
|
|
|
19393
19395
|
return { kind: "idle", reason: `${short3(target)}: ${decision.reason}` };
|
|
19394
19396
|
}
|
|
19395
19397
|
}
|
|
19398
|
+
function haltHasCleared(halt, job, rolledUpThrough) {
|
|
19399
|
+
if (halt.haltCode !== "job-terminal" || !halt.haltSha) return false;
|
|
19400
|
+
return job?.status === "completed" || rolledUpThrough === halt.haltSha;
|
|
19401
|
+
}
|
|
19396
19402
|
function localHaltReason(decision, job, targetSha) {
|
|
19397
19403
|
if (decision.code !== "job-terminal" || !job) return decision.reason;
|
|
19398
19404
|
return `commit ${short3(targetSha)} could not be processed (job ${job.status} after ${job.attemptCount} attempt(s)). Local watch has stopped here rather than skipping it, because skipping would fold its changes into the next update.
|
|
19399
|
-
This one needs us \u2014 the failure is recorded against your account and visible to the ArchMe team. Get in touch if it is blocking you
|
|
19405
|
+
` + (job.status === "failed" ? `Press Retry on it in the board's History tab, and local watch carries on by itself once it completes. If it keeps failing, get in touch: the ArchMe team can see the failure.` : `This one needs us \u2014 the failure is recorded against your account and visible to the ArchMe team. Get in touch if it is blocking you.`);
|
|
19400
19406
|
}
|
|
19401
19407
|
function short3(sha2) {
|
|
19402
19408
|
return sha2.slice(0, 7);
|
|
@@ -19958,6 +19964,9 @@ var init_pushSubject = __esm({
|
|
|
19958
19964
|
});
|
|
19959
19965
|
|
|
19960
19966
|
// src/daemon/localPoller.ts
|
|
19967
|
+
function jobRepoOf(entry, row) {
|
|
19968
|
+
return row.repoOwner && row.repoName ? `${row.repoOwner}/${row.repoName}` : `${entry.repoOwner}/${entry.repoName}`;
|
|
19969
|
+
}
|
|
19961
19970
|
async function pollRepoOnce(entry, deps) {
|
|
19962
19971
|
const repo = `${entry.repoOwner}/${entry.repoName}`;
|
|
19963
19972
|
const gateTimeoutMs = deps.gateTimeoutMs ?? DEFAULT_GATE_TIMEOUT_MS;
|
|
@@ -19990,7 +19999,7 @@ async function pollRepoOnce(entry, deps) {
|
|
|
19990
19999
|
return { kind: "idle", reason: `${repo}: watching is disabled on the server` };
|
|
19991
20000
|
}
|
|
19992
20001
|
await deps.git.fetchOrigin(entry.mirrorPath, row.repoBranch);
|
|
19993
|
-
const jobRepo =
|
|
20002
|
+
const jobRepo = jobRepoOf(entry, row);
|
|
19994
20003
|
const read = await deps.readMarker(row.projectId, row.archmeBranch, jobRepo);
|
|
19995
20004
|
const marker = { ...read, sha: read.rolledUpThrough ?? read.sha };
|
|
19996
20005
|
const upstreamTip = await deps.git.revParse(entry.mirrorPath, `origin/${row.repoBranch}`);
|
|
@@ -20038,14 +20047,35 @@ async function pollRepoOnce(entry, deps) {
|
|
|
20038
20047
|
}
|
|
20039
20048
|
return decision;
|
|
20040
20049
|
}
|
|
20050
|
+
async function clearHaltIfRetried(entry, key, deps) {
|
|
20051
|
+
if (!entry.haltSha) return false;
|
|
20052
|
+
try {
|
|
20053
|
+
const row = await deps.readWatchedRepo(entry.watchedRepoId);
|
|
20054
|
+
if (!row) return false;
|
|
20055
|
+
const repo = jobRepoOf(entry, row);
|
|
20056
|
+
const [job, marker] = await Promise.all([
|
|
20057
|
+
deps.readJobForSha(row.projectId, row.archmeBranch, repo, entry.haltSha),
|
|
20058
|
+
deps.readMarker(row.projectId, row.archmeBranch, repo)
|
|
20059
|
+
]);
|
|
20060
|
+
if (!haltHasCleared(entry, job, marker.rolledUpThrough)) return false;
|
|
20061
|
+
await deps.clearHalt(entry);
|
|
20062
|
+
return true;
|
|
20063
|
+
} catch (err4) {
|
|
20064
|
+
deps.log(` local poll ${key}: could not check its halt (checked again next tick): ${err4.message}`);
|
|
20065
|
+
return false;
|
|
20066
|
+
}
|
|
20067
|
+
}
|
|
20041
20068
|
async function pollAllRepos(repos, deps) {
|
|
20042
20069
|
const outcomes = [];
|
|
20043
20070
|
for (const entry of repos) {
|
|
20044
20071
|
const key = `${entry.repoOwner}/${entry.repoName} (${entry.watchedRepoId.slice(0, 8)})`;
|
|
20045
20072
|
const { watchedRepoId } = entry;
|
|
20046
20073
|
if (entry.haltedAt) {
|
|
20047
|
-
|
|
20048
|
-
|
|
20074
|
+
if (!await clearHaltIfRetried(entry, key, deps)) {
|
|
20075
|
+
outcomes.push({ watchedRepoId, outcome: "halted", haltCode: entry.haltCode, haltReason: entry.haltReason, haltedAt: entry.haltedAt });
|
|
20076
|
+
continue;
|
|
20077
|
+
}
|
|
20078
|
+
deps.log(` local poll resumed for ${key}: commit ${short4(entry.haltSha)} no longer blocks it`);
|
|
20049
20079
|
}
|
|
20050
20080
|
try {
|
|
20051
20081
|
const action = await pollRepoOnce(entry, deps);
|
|
@@ -20059,7 +20089,7 @@ async function pollAllRepos(repos, deps) {
|
|
|
20059
20089
|
haltReason: action.reason,
|
|
20060
20090
|
haltedAt: new Date(deps.now()).toISOString()
|
|
20061
20091
|
});
|
|
20062
|
-
await deps.persistHalt(entry, action.reason, action.code).catch((err4) => {
|
|
20092
|
+
await deps.persistHalt(entry, action.reason, action.code, action.sha).catch((err4) => {
|
|
20063
20093
|
deps.log(` local poll ${key}: could not save the halt (checked again next tick): ${err4.message}`);
|
|
20064
20094
|
});
|
|
20065
20095
|
deps.log(
|
|
@@ -20070,8 +20100,9 @@ async function pollAllRepos(repos, deps) {
|
|
|
20070
20100
|
No further commits will be processed for this repo.
|
|
20071
20101
|
Advancing past a failed commit would fold it into the next diff and break the
|
|
20072
20102
|
one-ArchMe-commit-per-git-commit guarantee, so this stops instead.
|
|
20073
|
-
|
|
20074
|
-
`
|
|
20103
|
+
` + (action.sha ? ` Retry it on the board's History tab; local watch carries on by itself once it completes.
|
|
20104
|
+
` : ` When the cause is fixed: archme local-watch --resume ${entry.repoOwner}/${entry.repoName}
|
|
20105
|
+
`)
|
|
20075
20106
|
);
|
|
20076
20107
|
continue;
|
|
20077
20108
|
}
|
|
@@ -20121,12 +20152,15 @@ function makePollerDeps(client, log, gateTimeoutMs) {
|
|
|
20121
20152
|
firstSeen.set(key, nowMs);
|
|
20122
20153
|
return nowMs;
|
|
20123
20154
|
},
|
|
20124
|
-
async persistHalt(entry, reason, code) {
|
|
20155
|
+
async persistHalt(entry, reason, code, sha2) {
|
|
20125
20156
|
const repos = await loadLocalRepos();
|
|
20126
20157
|
await saveLocalRepos(
|
|
20127
|
-
markHalted(repos, entry.watchedRepoId, reason, (/* @__PURE__ */ new Date()).toISOString(), code)
|
|
20158
|
+
markHalted(repos, entry.watchedRepoId, reason, (/* @__PURE__ */ new Date()).toISOString(), code, sha2)
|
|
20128
20159
|
);
|
|
20129
20160
|
},
|
|
20161
|
+
async clearHalt(entry) {
|
|
20162
|
+
await saveLocalRepos(clearHalt(await loadLocalRepos(), entry.watchedRepoId));
|
|
20163
|
+
},
|
|
20130
20164
|
async readWatchedRepo(watchedRepoId) {
|
|
20131
20165
|
const { data, error } = await client.from("watched_repos").select("project_id, branch, commit_update_archme_branch, source_kind, enabled, pr_update_mode, repo_owner, repo_name, deleted_at").eq("id", watchedRepoId).maybeSingle();
|
|
20132
20166
|
if (error) throw new Error(`could not read the watched repo: ${error.message}`);
|
|
@@ -27664,7 +27698,7 @@ async function runLocalWatchResume(slug, deps = {}) {
|
|
|
27664
27698
|
const stillTerminal = halted.some((m) => m.haltCode === "job-terminal");
|
|
27665
27699
|
if (stillTerminal) {
|
|
27666
27700
|
console.log(
|
|
27667
|
-
"\nNote: at least one of these stopped because a job failed outright. Resuming\ndoes not re-run a failed job \u2014 local watch will stop again on the next tick.\
|
|
27701
|
+
"\nNote: at least one of these stopped because a job failed outright. Resuming\ndoes not re-run a failed job \u2014 local watch will stop again on the next tick.\nPress Retry on that commit in the board's History tab; local watch carries on\nby itself once it completes (if it doesn't, run this command again)."
|
|
27668
27702
|
);
|
|
27669
27703
|
} else {
|
|
27670
27704
|
console.log("\nLocal watch resumes from the recorded commit on the next tick.");
|
|
@@ -30160,7 +30194,7 @@ ${project}
|
|
|
30160
30194
|
|
|
30161
30195
|
${access}
|
|
30162
30196
|
|
|
30163
|
-
4. **Ask whether to review pull requests** too (\`--prs\` or \`--no-prs\`): each
|
|
30197
|
+
4. **Ask whether to review pull requests** too (\`--prs\` or \`--no-prs\`): each PR's first review is one Claude run on their subscription, and later pushes run only when someone presses Update on the PR.${opts.githubAppAllowed ? " With local watch, a private repo's PRs need `gh auth login`, and PRs from forks are never reviewed." : " A private repo's PRs need `gh auth login`, and PRs from forks are never reviewed."}
|
|
30164
30198
|
|
|
30165
30199
|
## 5. Hand off
|
|
30166
30200
|
|
|
@@ -32659,8 +32693,9 @@ Options:
|
|
|
32659
32693
|
--project <org/slug> Project to write to (default: derived from the repo name)
|
|
32660
32694
|
--branch <name> Branch to track (default: the repo's default branch)
|
|
32661
32695
|
--yes Don't ask for confirmation (needs an explicit repo-path)
|
|
32662
|
-
--prs / --no-prs Also review pull requests (
|
|
32663
|
-
|
|
32696
|
+
--prs / --no-prs Also review pull requests (a PR's first review is one Claude
|
|
32697
|
+
run, later pushes wait for Update in the app; a private
|
|
32698
|
+
repo needs gh auth login)
|
|
32664
32699
|
|
|
32665
32700
|
Watching queues work; a local daemon does it. After registering: archme daemon start`);
|
|
32666
32701
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@archme/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.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