@yagni-app/code-staging 1.2.7-staging.2062.1 → 1.2.8-staging.2073.1

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.
@@ -29,11 +29,22 @@ export interface ContinuationInputs {
29
29
  reviewRoundsDone: number;
30
30
  /** The host's short code for why the earlier attempt stopped. */
31
31
  priorStop: string;
32
+ /**
33
+ * The attempt's base commit, which the cloud lane's host names (YAG-1042): a
34
+ * cloud execution starts past the earlier executions' commits, so its
35
+ * reviewer diffs the whole change from here. Absent from an older host's
36
+ * file, or when the value is not a commit id.
37
+ */
38
+ baseSha?: string;
32
39
  }
33
- /** Parse and validate the continue file's text; a reason when it cannot be used. */
40
+ /**
41
+ * Parse and validate the continue file's text; a reason when it cannot be
42
+ * used. `ignored` says what a usable file carried that was dropped.
43
+ */
34
44
  export declare function parseContinuation(raw: string): {
35
45
  ok: true;
36
46
  value: ContinuationInputs;
47
+ ignored?: string;
37
48
  } | {
38
49
  ok: false;
39
50
  reason: string;
@@ -20,7 +20,11 @@
20
20
  import { missionDesignContext } from "./mission.js";
21
21
  import { MAX_REVIEW_ROUNDS } from "./types.js";
22
22
  const CONTINUATION_STAGES = ["implement", "review", "fix", "verify"];
23
- /** Parse and validate the continue file's text; a reason when it cannot be used. */
23
+ const COMMIT_SHA = /^[0-9a-f]{40}$/;
24
+ /**
25
+ * Parse and validate the continue file's text; a reason when it cannot be
26
+ * used. `ignored` says what a usable file carried that was dropped.
27
+ */
24
28
  export function parseContinuation(raw) {
25
29
  let data;
26
30
  try {
@@ -48,9 +52,17 @@ export function parseContinuation(raw) {
48
52
  };
49
53
  }
50
54
  const priorStop = typeof obj.priorStop === "string" ? obj.priorStop.trim() : "";
55
+ // It reaches a shell command and a prompt, so only a commit id is read.
56
+ const baseSha = typeof obj.baseSha === "string" && COMMIT_SHA.test(obj.baseSha) ? obj.baseSha : undefined;
51
57
  return {
52
58
  ok: true,
53
- value: { stageAtStop: stage, reviewRoundsDone: rounds, priorStop },
59
+ value: {
60
+ stageAtStop: stage,
61
+ reviewRoundsDone: rounds,
62
+ priorStop,
63
+ ...(baseSha ? { baseSha } : {}),
64
+ },
65
+ ...("baseSha" in obj && !baseSha ? { ignored: "its baseSha is not a commit id" } : {}),
54
66
  };
55
67
  }
56
68
  /** True when the earlier attempt got past implement, so the run re-enters the review loop. */
@@ -69,10 +81,14 @@ export function continuationReviewInput(continuation, mission, committed = false
69
81
  const stopped = `this build continues an earlier attempt that stopped during its ${continuation.stageAtStop ?? "unknown"} stage${why}. `;
70
82
  // A cloud execution starts from the attempt's pushed branch: the earlier
71
83
  // work is in its commits, not in the working tree.
84
+ const base = continuation.baseSha;
72
85
  const summary = committed
73
86
  ? `No implement summary: ${stopped}` +
74
- "That attempt's change is committed on this branch. Review the whole change against the base commit the ticket names " +
75
- "(`git diff <base>...HEAD`), plus anything `git status` lists."
87
+ (base
88
+ ? `That attempt's change is committed on this branch, past the attempt's base commit ${base}. Review the whole change against it ` +
89
+ `(\`git diff ${base}\`, committed or not; \`git log ${base}..HEAD\` lists the commits), plus any new files \`git status\` lists.`
90
+ : "That attempt's change is committed on this branch. Review the whole change against the base commit the ticket names " +
91
+ "(`git diff <base>...HEAD`), plus anything `git status` lists.")
76
92
  : `No implement summary: ${stopped}` +
77
93
  "That attempt's change is already in the working tree as uncommitted edits on top of HEAD. " +
78
94
  "Review the whole change against HEAD (`git diff HEAD`, plus any untracked files `git status` lists).";
@@ -354,8 +354,12 @@ export async function runHeadlessGo(argv, deps = {}) {
354
354
  else if (args.continueFile) {
355
355
  const raw = read(args.continueFile, "continue file");
356
356
  const parsed = typeof raw === "string" ? parseContinuation(raw) : undefined;
357
- if (parsed?.ok)
357
+ if (parsed?.ok) {
358
358
  continuation = parsed.value;
359
+ if (parsed.ignored) {
360
+ writeErr(`Ignoring part of --continue-file ${args.continueFile}: ${parsed.ignored}, so the reviewer reads the change with a bare \`git diff\`.`);
361
+ }
362
+ }
359
363
  else if (typeof raw !== "string")
360
364
  writeErr(`${raw.error}. Running as a normal mission.`);
361
365
  else if (parsed)
@@ -559,11 +563,14 @@ export async function runHeadlessGo(argv, deps = {}) {
559
563
  const onBase = baseSha ? { base: baseSha } : {};
560
564
  // Its reviewer reads the change from that commit too (YAG-1041). A
561
565
  // continuation starts past the attempt's earlier commits, so its start is
562
- // not where the change begins: its reviewer keeps the bare `git diff`.
563
- const reviewLane = lane && baseSha && !continuation
566
+ // not where the change begins: its reviewer reads from the attempt's base
567
+ // that `continue.json` names (YAG-1042), and an older host's file, which
568
+ // names none, keeps the bare `git diff`.
569
+ const diffBase = continuation ? continuation.baseSha : baseSha;
570
+ const reviewLane = lane && diffBase
564
571
  ? {
565
572
  ...lane,
566
- stages: lane.stages.map((s) => (s.id === "review" ? { ...s, diffBase: baseSha } : s)),
573
+ stages: lane.stages.map((s) => (s.id === "review" ? { ...s, diffBase } : s)),
567
574
  }
568
575
  : lane;
569
576
  let gate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagni-app/code-staging",
3
- "version": "1.2.7-staging.2062.1",
3
+ "version": "1.2.8-staging.2073.1",
4
4
  "description": "YAGNI Code: a terminal coding agent that already knows your company. One YAGNI login routes the model and grounds the agent in your team's context.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "YAGNI, Inc. <jack@yagni.app> (https://yagni.app)",
@@ -58,5 +58,5 @@
58
58
  "turndown": "^7.2.4",
59
59
  "typebox": "^1.3.15"
60
60
  },
61
- "yagniSourceSha": "a52f06325dd8542ceb7055b6fc9a7c965c8c77bd"
61
+ "yagniSourceSha": "d1e92ce55231613eb6b479dfb99b564f7ea94486"
62
62
  }