@archme/cli 0.5.2 → 0.5.4

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 +36 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -8755,7 +8755,7 @@ function xmlEscape(s) {
8755
8755
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8756
8756
  }
8757
8757
  function renderLaunchdPlist(opts) {
8758
- const argLines = [opts.nodeBin, opts.cliEntry, "daemon", "run"].map((a2) => ` <string>${xmlEscape(a2)}</string>`).join("\n");
8758
+ const argLines = [opts.nodeBin, ...NODE_FLAGS, opts.cliEntry, "daemon", "run"].map((a2) => ` <string>${xmlEscape(a2)}</string>`).join("\n");
8759
8759
  const envLines = Object.entries(unitEnv(opts.env)).map(
8760
8760
  ([k, v]) => ` <key>${xmlEscape(k)}</key>
8761
8761
  <string>${xmlEscape(v)}</string>`
@@ -8801,6 +8801,7 @@ function renderSystemdUnit(opts) {
8801
8801
  const envLines = Object.entries(unitEnv(opts.env)).map(([k, v]) => `Environment="${k}=${systemdEnvEscape(v)}"`).join("\n");
8802
8802
  const execStart = [
8803
8803
  systemdArgQuote(opts.nodeBin),
8804
+ ...NODE_FLAGS,
8804
8805
  systemdArgQuote(opts.cliEntry),
8805
8806
  "daemon",
8806
8807
  "run"
@@ -8821,11 +8822,13 @@ ${envLines}
8821
8822
  WantedBy=default.target
8822
8823
  `;
8823
8824
  }
8825
+ var NODE_FLAGS;
8824
8826
  var init_unitFiles = __esm({
8825
8827
  "src/daemon/service/unitFiles.ts"() {
8826
8828
  "use strict";
8827
8829
  init_paths();
8828
8830
  init_supervision();
8831
+ NODE_FLAGS = ["--liftoff-only"];
8829
8832
  }
8830
8833
  });
8831
8834
 
@@ -9964,6 +9967,23 @@ var init_classifyOutcome = __esm({
9964
9967
  }
9965
9968
  });
9966
9969
 
9970
+ // src/daemon/heartbeatHealth.ts
9971
+ function classifyHeartbeat(error, row) {
9972
+ if (error) return { kind: "error", message: error.message ?? "unknown error" };
9973
+ if (row == null) {
9974
+ return {
9975
+ kind: "disowned",
9976
+ message: "lease is no longer held by this worker (reaped or re-claimed) \u2014 this run will not count"
9977
+ };
9978
+ }
9979
+ return { kind: "ok" };
9980
+ }
9981
+ var init_heartbeatHealth = __esm({
9982
+ "src/daemon/heartbeatHealth.ts"() {
9983
+ "use strict";
9984
+ }
9985
+ });
9986
+
9967
9987
  // node_modules/balanced-match/dist/esm/index.js
9968
9988
  var balanced, maybeMatch, range;
9969
9989
  var init_esm = __esm({
@@ -14129,7 +14149,7 @@ async function cmdDiff(args) {
14129
14149
  );
14130
14150
  return 0;
14131
14151
  }
14132
- async function augmentChangesWithSymbolsAtSha(changes, after, cwd) {
14152
+ async function augmentChangesWithSymbolsAtSha(changes, after, cwd, onFile) {
14133
14153
  const warnings = [];
14134
14154
  for (const change of changes) {
14135
14155
  if (change.status === "deleted") continue;
@@ -14141,6 +14161,7 @@ async function augmentChangesWithSymbolsAtSha(changes, after, cwd) {
14141
14161
  maxBuffer: 1e7
14142
14162
  });
14143
14163
  if (result.exitCode === 0) {
14164
+ onFile?.(change.path, Buffer.byteLength(result.stdout, "utf8"));
14144
14165
  try {
14145
14166
  const outline = await outlineSource(result.stdout, change.path);
14146
14167
  symbols = outline.data.symbols;
@@ -14150,6 +14171,7 @@ async function augmentChangesWithSymbolsAtSha(changes, after, cwd) {
14150
14171
  }
14151
14172
  if (!symbols) {
14152
14173
  try {
14174
+ onFile?.(change.path, null);
14153
14175
  const outline = await runOutline(resolve(cwd, change.path));
14154
14176
  symbols = outline.data.symbols;
14155
14177
  if (after) {
@@ -16155,7 +16177,7 @@ async function rpcClaim(ctx, deviceId) {
16155
16177
  }
16156
16178
  async function rpcHeartbeat(ctx, jobId, deviceId) {
16157
16179
  if (!deviceId) return;
16158
- const { error } = await withAuthRetry(
16180
+ const { data, error } = await withAuthRetry(
16159
16181
  `[${jobId}] heartbeat`,
16160
16182
  () => ctx.supabase.rpc("heartbeat_archme_job", {
16161
16183
  p_job_id: jobId,
@@ -16165,7 +16187,8 @@ async function rpcHeartbeat(ctx, jobId, deviceId) {
16165
16187
  }),
16166
16188
  ctx.reLogin
16167
16189
  );
16168
- if (error) console.error(`[${jobId}] heartbeat error:`, error.message);
16190
+ const verdict = classifyHeartbeat(error, data);
16191
+ if (verdict.kind !== "ok") console.error(`[${jobId}] heartbeat ${verdict.kind}: ${verdict.message}`);
16169
16192
  }
16170
16193
  async function rpcComplete(ctx, jobId, deviceId, summary2, kind, changed, metrics, logs, advanceMarker = true, affected) {
16171
16194
  const extra = {
@@ -16605,7 +16628,13 @@ async function runJob(ctx, job, claimDeviceId) {
16605
16628
  const changedSymbolsByFile = /* @__PURE__ */ new Map();
16606
16629
  try {
16607
16630
  const { changes } = await runDiff(diff.range, repoDir);
16608
- await augmentChangesWithSymbolsAtSha(changes, diff.after, repoDir);
16631
+ logPhase(job.id, "seed_start", { files: changes.length });
16632
+ await augmentChangesWithSymbolsAtSha(
16633
+ changes,
16634
+ diff.after,
16635
+ repoDir,
16636
+ (path7, bytes2) => log(`parse ${path7}${bytes2 == null ? "" : ` bytes=${bytes2}`}`)
16637
+ );
16609
16638
  for (const change of changes) {
16610
16639
  if (change.status === "deleted") continue;
16611
16640
  const ann = change;
@@ -16621,6 +16650,7 @@ async function runJob(ctx, job, claimDeviceId) {
16621
16650
  const affected = resolveAffected(seedArch, diff.changedFiles, changedSymbolsByFile);
16622
16651
  affectedForComplete = affected;
16623
16652
  const symbolsInFile = async (file) => {
16653
+ log(`parse ${file} (removed-symbol scan)`);
16624
16654
  const outline = await runOutline(join18(worktreeDir, file));
16625
16655
  if (outline.tier !== 2) return null;
16626
16656
  return outline.data.symbols.map((s) => s.name);
@@ -17210,6 +17240,7 @@ var init_run = __esm({
17210
17240
  init_model_pin();
17211
17241
  init_digest();
17212
17242
  init_classifyOutcome();
17243
+ init_heartbeatHealth();
17213
17244
  init_affected();
17214
17245
  init_scanPrompts();
17215
17246
  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.4",
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",