@archme/cli 0.4.3 → 0.4.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 +28 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -9581,6 +9581,9 @@ var init_daemonModel = __esm({
9581
9581
  });
9582
9582
 
9583
9583
  // src/scan/spawn-claude.ts
9584
+ function stripNulBytes(arg) {
9585
+ return arg.includes("\0") ? arg.replaceAll("\0", "\uFFFD") : arg;
9586
+ }
9584
9587
  function buildClaudeArgs(opts) {
9585
9588
  const tools = (opts.allowedTools ?? DEFAULT_ALLOWED_TOOLS).join(",");
9586
9589
  const args = [
@@ -9607,7 +9610,7 @@ function buildClaudeArgs(opts) {
9607
9610
  if (opts.model) {
9608
9611
  args.push("--model", opts.model);
9609
9612
  }
9610
- return args;
9613
+ return args.map(stripNulBytes);
9611
9614
  }
9612
9615
  function spawnClaude(opts) {
9613
9616
  requireBinary("claude");
@@ -14881,9 +14884,13 @@ function rateLimitDeferPlan(text, nowMs = Date.now(), defaultTimeZone = localTim
14881
14884
  }
14882
14885
  return null;
14883
14886
  }
14887
+ function stripPromptEcho(haystack, prompt) {
14888
+ if (!prompt || prompt.length < 40) return haystack;
14889
+ return haystack.split(prompt).join(" ");
14890
+ }
14884
14891
  function rateLimitDeferPlanForExit(channels, nowMs = Date.now(), defaultTimeZone = localTimeZone()) {
14885
- const haystack = `${channels.message}
14886
- ${channels.stderr}`;
14892
+ const haystack = stripPromptEcho(`${channels.message}
14893
+ ${channels.stderr}`, channels.prompt);
14887
14894
  return rateLimitDeferPlan(haystack, nowMs, defaultTimeZone);
14888
14895
  }
14889
14896
  var RATE_LIMIT_RE, MONTHS, RATE_LIMIT_TENTATIVE_PAUSE_MS, DATED_RESET_ROLLOVER_GRACE_MS, RATE_LIMIT_PAUSE_PADDING_MS, RATE_LIMIT_SHAPED_RE;
@@ -16428,6 +16435,7 @@ async function runJob(ctx, job, claimDeviceId) {
16428
16435
  };
16429
16436
  let metrics = { durations_ms: timings };
16430
16437
  let logs = { stdout: "", stderr: "" };
16438
+ let sentPrompt;
16431
16439
  const cleanupFns = [];
16432
16440
  const heartbeat = setInterval(() => {
16433
16441
  rpcHeartbeat(ctx, job.id, deviceId);
@@ -16561,6 +16569,7 @@ async function runJob(ctx, job, claimDeviceId) {
16561
16569
  }
16562
16570
  const bugsFolderId = await ensureBugsFolder(ctx.supabase, job.project_id);
16563
16571
  const prompt = buildDiffPrompt(job, projectSlug, diff, worktreeDir, affectedSeed, bugsFolderId);
16572
+ sentPrompt = prompt;
16564
16573
  if (cancelled.has(job.id)) {
16565
16574
  log(`cancelled before claude spawn, aborting`);
16566
16575
  return;
@@ -16677,9 +16686,14 @@ async function runJob(ctx, job, claimDeviceId) {
16677
16686
  return;
16678
16687
  }
16679
16688
  const msg = err2 instanceof Error ? err2.message : String(err2);
16680
- const haystack = `${msg}
16681
- ${logs.stderr}`;
16682
- const plan = rateLimitDeferPlanForExit({ message: msg, stderr: logs.stderr, stdout: logs.stdout });
16689
+ const haystack = stripPromptEcho(`${msg}
16690
+ ${logs.stderr}`, sentPrompt);
16691
+ const plan = rateLimitDeferPlanForExit({
16692
+ message: msg,
16693
+ stderr: logs.stderr,
16694
+ stdout: logs.stdout,
16695
+ prompt: sentPrompt
16696
+ });
16683
16697
  if (plan) {
16684
16698
  const { parsed, pauseUntil, info } = plan;
16685
16699
  if (!parsed) {
@@ -19267,7 +19281,14 @@ async function registerLocalWatch(args) {
19267
19281
  p_project_id: projectId,
19268
19282
  p_repo_owner: target.repoOwner,
19269
19283
  p_repo_name: target.repoName,
19270
- p_branch: target.repoBranch
19284
+ p_branch: target.repoBranch,
19285
+ // The ArchMe branch has to be RECORDED, not re-derived by each reader.
19286
+ // The poller resolves it from the row (`commit_update_archme_branch ??
19287
+ // branch`, mirroring the webhook); with the column unset it fell back to
19288
+ // the git branch, so registration checked `main-scan` while polling read
19289
+ // `main`, found no marker, and idled forever with everything looking
19290
+ // healthy. Migration 111.
19291
+ p_archme_branch: target.archmeBranch
19271
19292
  });
19272
19293
  if (watchErr || typeof watchedRepoId !== "string") {
19273
19294
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archme/cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.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",