@yagni-app/code-staging 1.2.13-staging.2158.1 → 1.2.13-staging.2167.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.
@@ -35,7 +35,22 @@ export interface PlanFile {
35
35
  repository: string;
36
36
  summary: string;
37
37
  }>;
38
+ /** The repository the change belongs in instead, when it is not this one (ENG-2966). */
39
+ wrongRepository?: {
40
+ repository: string;
41
+ why: string;
42
+ confidence: "high" | "low";
43
+ };
44
+ /** The other repositories that need a change before this one can work (ENG-3033). */
45
+ dependsOn: Array<{
46
+ repository: string;
47
+ what: string;
48
+ }>;
38
49
  }
50
+ /** The plan's `wrongRepository`, or null when it names no `owner/name`. Confidence is high only when said. */
51
+ export declare function readWrongRepository(value: unknown): PlanFile["wrongRepository"] | null;
52
+ /** The plan's `dependsOn`, one entry per distinct repository, in the order written. */
53
+ export declare function readDependsOn(value: unknown): PlanFile["dependsOn"];
39
54
  /** An `owner/name` repository the plan names, or null when it is not one. */
40
55
  export declare function repositoryName(value: unknown): string | null;
41
56
  /**
@@ -19,6 +19,34 @@ const MAX_TEXT = 500;
19
19
  * same number as `MAX_SPLIT_CHILDREN` in @yagni/shared, kept here because this package
20
20
  * does not depend on it. */
21
21
  const MAX_REPOSITORIES_NEEDED = 12;
22
+ /** The plan's `wrongRepository`, or null when it names no `owner/name`. Confidence is high only when said. */
23
+ export function readWrongRepository(value) {
24
+ if (!isRecord(value))
25
+ return null;
26
+ const repository = repositoryName(value.repository);
27
+ if (!repository)
28
+ return null;
29
+ return {
30
+ repository,
31
+ why: text(value.why) ?? "",
32
+ confidence: value.confidence === "high" ? "high" : "low",
33
+ };
34
+ }
35
+ /** The plan's `dependsOn`, one entry per distinct repository, in the order written. */
36
+ export function readDependsOn(value) {
37
+ const out = [];
38
+ const seen = new Set();
39
+ for (const entry of list(value)) {
40
+ const repository = isRecord(entry) ? repositoryName(entry.repository) : null;
41
+ if (!repository || seen.has(repository.toLowerCase()))
42
+ continue;
43
+ seen.add(repository.toLowerCase());
44
+ out.push({ repository, what: (isRecord(entry) && text(entry.what)) || "" });
45
+ if (out.length === MAX_REPOSITORIES_NEEDED)
46
+ break;
47
+ }
48
+ return out;
49
+ }
22
50
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
23
51
  /** An `owner/name` repository the plan names, or null when it is not one. */
24
52
  export function repositoryName(value) {
@@ -123,8 +151,18 @@ export function buildPlanFile(planText, fallbackPaths) {
123
151
  .filter((path) => path !== null);
124
152
  const paths = [...new Set(named.length > 0 ? named : fallbackPaths())].slice(0, MAX_LIST);
125
153
  const repositoriesNeeded = readRepositoriesNeeded(block?.repositoriesNeeded);
154
+ const wrongRepository = readWrongRepository(block?.wrongRepository);
126
155
  return {
127
- file: { version: 1, questions, decisionsCited, checks, paths, repositoriesNeeded },
156
+ file: {
157
+ version: 1,
158
+ questions,
159
+ decisionsCited,
160
+ checks,
161
+ paths,
162
+ repositoriesNeeded,
163
+ ...(wrongRepository ? { wrongRepository } : {}),
164
+ dependsOn: readDependsOn(block?.dependsOn),
165
+ },
128
166
  found: block !== null,
129
167
  };
130
168
  }
@@ -68,6 +68,12 @@ export declare const DECISIONS_READ_TOOL = "yagni_decisions_read_for_repository"
68
68
  * planner left out.
69
69
  */
70
70
  export declare const DOCUMENTATION_REPOSITORY_RULE: string;
71
+ /**
72
+ * Where the change belongs (ENG-2966, ENG-3033): a ticket routed to the wrong
73
+ * repository is said so, not planned around, and work this one cannot do
74
+ * without another repository is named, not left as a Risks bullet.
75
+ */
76
+ export declare const RIGHT_REPOSITORY_RULE: string;
71
77
  export declare const PLAN_JSON_CONTRACT: string;
72
78
  /**
73
79
  * The one-attempt lane's session (`yagni go --headless --cloud`): plan,
@@ -154,6 +154,19 @@ export const DECISIONS_READ_TOOL = "yagni_decisions_read_for_repository";
154
154
  export const DOCUMENTATION_REPOSITORY_RULE = "When a documentation repository in Other repositories documents this one and the change alters " +
155
155
  "behaviour its pages describe, list it in repositoriesNeeded too, with one line on the pages that " +
156
156
  "change. It is built beside the code, not after it.";
157
+ /**
158
+ * Where the change belongs (ENG-2966, ENG-3033): a ticket routed to the wrong
159
+ * repository is said so, not planned around, and work this one cannot do
160
+ * without another repository is named, not left as a Risks bullet.
161
+ */
162
+ export const RIGHT_REPOSITORY_RULE = '- "wrongRepository" is for a ticket whose change belongs in another repository the Other ' +
163
+ "repositories section lists (the code it asks to change is there, not here). Name that " +
164
+ 'repository, say why in one line, and give "confidence": "high" only when you read the code ' +
165
+ "there or the ticket names it. Do not plan around it in this repository and do not call this " +
166
+ "one the main repository; plan only what this repository needs. Leave it out when the change is here.\n" +
167
+ '- "dependsOn" lists every other repository that needs a change before this one can work, each ' +
168
+ "with one line on what it needs there, whether or not the Other repositories section lists it. " +
169
+ "Such a dependency is never only a Risks bullet. Never list a repository the change only reads.";
157
170
  export const PLAN_JSON_CONTRACT = "End your answer with a fenced ```plan-json block and nothing after it:\n" +
158
171
  "```plan-json\n" +
159
172
  "{\n" +
@@ -166,7 +179,9 @@ export const PLAN_JSON_CONTRACT = "End your answer with a fenced ```plan-json bl
166
179
  ' "decisionsCited": [{"id": "<the decision id the read returned>", "why": "one line"}],\n' +
167
180
  ' "checks": [{"name": "lint", "command": "pnpm lint", "cwd": "apps/web"}],\n' +
168
181
  ' "paths": ["apps/web"],\n' +
169
- ' "repositoriesNeeded": [{"repository": "owner/name", "summary": "one line on what changes there"}]\n' +
182
+ ' "repositoriesNeeded": [{"repository": "owner/name", "summary": "one line on what changes there"}],\n' +
183
+ ' "wrongRepository": {"repository": "owner/name", "why": "one line", "confidence": "high|low"},\n' +
184
+ ' "dependsOn": [{"repository": "owner/name", "what": "one line on what it needs there"}]\n' +
170
185
  "}\n" +
171
186
  "```\n" +
172
187
  "Rules the host enforces, so getting them wrong loses the question:\n" +
@@ -183,7 +198,9 @@ export const PLAN_JSON_CONTRACT = "End your answer with a fenced ```plan-json bl
183
198
  "with one line on what changes there. Only a repository the ticket's Other repositories section lists " +
184
199
  "counts; the host drops any other name. Leave it out for a change inside this repository alone, and " +
185
200
  "never list a repository the change only reads. " +
186
- DOCUMENTATION_REPOSITORY_RULE;
201
+ DOCUMENTATION_REPOSITORY_RULE +
202
+ "\n" +
203
+ RIGHT_REPOSITORY_RULE;
187
204
  /**
188
205
  * The cloud plan stage's task: the input folder the host wrote, read first,
189
206
  * then a plan grounded in the installed checkout, inside the stage's own
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yagni-app/code-staging",
3
- "version": "1.2.13-staging.2158.1",
3
+ "version": "1.2.13-staging.2167.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": "b6c406df664ab9bf4977c116c0fe9e30ea4bc631"
61
+ "yagniSourceSha": "eacf9167a622d9ff9a977d0fde9d29040a78aa60"
62
62
  }