@archme/cli 0.5.2 → 0.5.3

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 +32 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -9964,6 +9964,23 @@ var init_classifyOutcome = __esm({
9964
9964
  }
9965
9965
  });
9966
9966
 
9967
+ // src/daemon/heartbeatHealth.ts
9968
+ function classifyHeartbeat(error, row) {
9969
+ if (error) return { kind: "error", message: error.message ?? "unknown error" };
9970
+ if (row == null) {
9971
+ return {
9972
+ kind: "disowned",
9973
+ message: "lease is no longer held by this worker (reaped or re-claimed) \u2014 this run will not count"
9974
+ };
9975
+ }
9976
+ return { kind: "ok" };
9977
+ }
9978
+ var init_heartbeatHealth = __esm({
9979
+ "src/daemon/heartbeatHealth.ts"() {
9980
+ "use strict";
9981
+ }
9982
+ });
9983
+
9967
9984
  // node_modules/balanced-match/dist/esm/index.js
9968
9985
  var balanced, maybeMatch, range;
9969
9986
  var init_esm = __esm({
@@ -14129,7 +14146,7 @@ async function cmdDiff(args) {
14129
14146
  );
14130
14147
  return 0;
14131
14148
  }
14132
- async function augmentChangesWithSymbolsAtSha(changes, after, cwd) {
14149
+ async function augmentChangesWithSymbolsAtSha(changes, after, cwd, onFile) {
14133
14150
  const warnings = [];
14134
14151
  for (const change of changes) {
14135
14152
  if (change.status === "deleted") continue;
@@ -14141,6 +14158,7 @@ async function augmentChangesWithSymbolsAtSha(changes, after, cwd) {
14141
14158
  maxBuffer: 1e7
14142
14159
  });
14143
14160
  if (result.exitCode === 0) {
14161
+ onFile?.(change.path, Buffer.byteLength(result.stdout, "utf8"));
14144
14162
  try {
14145
14163
  const outline = await outlineSource(result.stdout, change.path);
14146
14164
  symbols = outline.data.symbols;
@@ -14150,6 +14168,7 @@ async function augmentChangesWithSymbolsAtSha(changes, after, cwd) {
14150
14168
  }
14151
14169
  if (!symbols) {
14152
14170
  try {
14171
+ onFile?.(change.path, null);
14153
14172
  const outline = await runOutline(resolve(cwd, change.path));
14154
14173
  symbols = outline.data.symbols;
14155
14174
  if (after) {
@@ -16155,7 +16174,7 @@ async function rpcClaim(ctx, deviceId) {
16155
16174
  }
16156
16175
  async function rpcHeartbeat(ctx, jobId, deviceId) {
16157
16176
  if (!deviceId) return;
16158
- const { error } = await withAuthRetry(
16177
+ const { data, error } = await withAuthRetry(
16159
16178
  `[${jobId}] heartbeat`,
16160
16179
  () => ctx.supabase.rpc("heartbeat_archme_job", {
16161
16180
  p_job_id: jobId,
@@ -16165,7 +16184,8 @@ async function rpcHeartbeat(ctx, jobId, deviceId) {
16165
16184
  }),
16166
16185
  ctx.reLogin
16167
16186
  );
16168
- if (error) console.error(`[${jobId}] heartbeat error:`, error.message);
16187
+ const verdict = classifyHeartbeat(error, data);
16188
+ if (verdict.kind !== "ok") console.error(`[${jobId}] heartbeat ${verdict.kind}: ${verdict.message}`);
16169
16189
  }
16170
16190
  async function rpcComplete(ctx, jobId, deviceId, summary2, kind, changed, metrics, logs, advanceMarker = true, affected) {
16171
16191
  const extra = {
@@ -16605,7 +16625,13 @@ async function runJob(ctx, job, claimDeviceId) {
16605
16625
  const changedSymbolsByFile = /* @__PURE__ */ new Map();
16606
16626
  try {
16607
16627
  const { changes } = await runDiff(diff.range, repoDir);
16608
- await augmentChangesWithSymbolsAtSha(changes, diff.after, repoDir);
16628
+ logPhase(job.id, "seed_start", { files: changes.length });
16629
+ await augmentChangesWithSymbolsAtSha(
16630
+ changes,
16631
+ diff.after,
16632
+ repoDir,
16633
+ (path7, bytes2) => log(`parse ${path7}${bytes2 == null ? "" : ` bytes=${bytes2}`}`)
16634
+ );
16609
16635
  for (const change of changes) {
16610
16636
  if (change.status === "deleted") continue;
16611
16637
  const ann = change;
@@ -16621,6 +16647,7 @@ async function runJob(ctx, job, claimDeviceId) {
16621
16647
  const affected = resolveAffected(seedArch, diff.changedFiles, changedSymbolsByFile);
16622
16648
  affectedForComplete = affected;
16623
16649
  const symbolsInFile = async (file) => {
16650
+ log(`parse ${file} (removed-symbol scan)`);
16624
16651
  const outline = await runOutline(join18(worktreeDir, file));
16625
16652
  if (outline.tier !== 2) return null;
16626
16653
  return outline.data.symbols.map((s) => s.name);
@@ -17210,6 +17237,7 @@ var init_run = __esm({
17210
17237
  init_model_pin();
17211
17238
  init_digest();
17212
17239
  init_classifyOutcome();
17240
+ init_heartbeatHealth();
17213
17241
  init_affected();
17214
17242
  init_scanPrompts();
17215
17243
  init_storyGranularity();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archme/cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
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",