@yagni-app/code-staging 1.2.14-staging.2406.1 → 1.2.14-staging.2417.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.
|
@@ -111,8 +111,9 @@ export declare function commitType(ticket: string, ticketBrief?: string): "fix"
|
|
|
111
111
|
export declare function commitTitle(ticket: string, ticketBrief?: string): string;
|
|
112
112
|
/**
|
|
113
113
|
* The title a run with a plan and no ticket title commits under (the cloud
|
|
114
|
-
* session reads its ticket from a file): the line under the plan's Goal
|
|
115
|
-
* heading, else its first line of prose. Undefined when the plan has
|
|
114
|
+
* session reads its ticket from a file): the line under the plan's Goal or
|
|
115
|
+
* Summary heading, else its first line of prose. Undefined when the plan has
|
|
116
|
+
* neither.
|
|
116
117
|
*/
|
|
117
118
|
export declare function planTitle(planText: string | undefined): string | undefined;
|
|
118
119
|
/**
|
|
@@ -125,9 +126,10 @@ export declare function deriveCommitScope(paths: string[]): string | undefined;
|
|
|
125
126
|
/** `<type>(<scope>): <title>`, dropping the parens when no scope was derivable. */
|
|
126
127
|
export declare function commitSubject(type: "fix" | "feat", scope: string | undefined, title: string): string;
|
|
127
128
|
/**
|
|
128
|
-
* A 2-3 sentence summary of the plan stage's output (markdown flattened
|
|
129
|
-
* three sentences, capped). No LLM call
|
|
130
|
-
* missing plan (a resumed run skipped the
|
|
129
|
+
* A 2-3 sentence summary of the plan stage's output (markdown flattened from
|
|
130
|
+
* its Goal or Summary heading on, first three sentences, capped). No LLM call
|
|
131
|
+
* — this is a deterministic excerpt. A missing plan (a resumed run skipped the
|
|
132
|
+
* build half) degrades honestly.
|
|
131
133
|
*/
|
|
132
134
|
export declare function summarizePlan(planText: string | undefined, ticket: string): string;
|
|
133
135
|
/**
|
|
@@ -83,20 +83,43 @@ export function commitTitle(ticket, ticketBrief) {
|
|
|
83
83
|
title = title.slice(echo.length).trim() || ticket;
|
|
84
84
|
return title.length > TITLE_MAX ? title.slice(0, TITLE_MAX).trimEnd() : title;
|
|
85
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* The heading a plan states its goal under: `## Goal` as a plan stage writes
|
|
88
|
+
* it, or `## Summary` as the host renders an approved plan into the session's
|
|
89
|
+
* `plan.md` (`renderPlanMarkdown` in the backend's `workItems/planPage.ts`).
|
|
90
|
+
* That file opens with the host's line naming the plan's version ("Plan v1,
|
|
91
|
+
* as a person approved it."), which is no title: every yak pull request's
|
|
92
|
+
* provenance commit was named after it (#3046, #3051, #3052, #3163).
|
|
93
|
+
*/
|
|
94
|
+
const GOAL_HEADING = /^#+\s*(?:goal|summary)\b/i;
|
|
95
|
+
/** The plan from under its goal's heading on, or the whole plan when it has none. */
|
|
96
|
+
function fromGoal(planText) {
|
|
97
|
+
const lines = planText.split("\n");
|
|
98
|
+
const goal = lines.findIndex((line) => GOAL_HEADING.test(line.trim()));
|
|
99
|
+
return goal >= 0 ? lines.slice(goal + 1).join("\n") : planText;
|
|
100
|
+
}
|
|
86
101
|
/**
|
|
87
102
|
* The title a run with a plan and no ticket title commits under (the cloud
|
|
88
|
-
* session reads its ticket from a file): the line under the plan's Goal
|
|
89
|
-
* heading, else its first line of prose. Undefined when the plan has
|
|
103
|
+
* session reads its ticket from a file): the line under the plan's Goal or
|
|
104
|
+
* Summary heading, else its first line of prose. Undefined when the plan has
|
|
105
|
+
* neither.
|
|
90
106
|
*/
|
|
91
107
|
export function planTitle(planText) {
|
|
92
108
|
const lines = (planText ?? "").split("\n").map((line) => line.trim());
|
|
93
109
|
const prose = (from) => lines.slice(from).find((line) => line && !line.startsWith("#") && !line.startsWith("```"));
|
|
94
|
-
const goal = lines.findIndex((line) =>
|
|
110
|
+
const goal = lines.findIndex((line) => GOAL_HEADING.test(line));
|
|
95
111
|
const line = (goal >= 0 ? prose(goal + 1) : undefined) ?? prose(0);
|
|
96
|
-
|
|
112
|
+
const title = line
|
|
97
113
|
?.replace(/^(?:[-*+]|\d+[.)])\s+/, "")
|
|
98
114
|
.replace(/`/g, "")
|
|
99
|
-
.trim()
|
|
115
|
+
.trim();
|
|
116
|
+
if (!title)
|
|
117
|
+
return undefined;
|
|
118
|
+
if (title.length <= TITLE_MAX)
|
|
119
|
+
return title;
|
|
120
|
+
// A Summary runs on past the cap: the title is its first sentence, which
|
|
121
|
+
// ends on a word, never on an abbreviation's stop ("the U.S. Billing cap").
|
|
122
|
+
return title.match(/^.+?[a-z0-9][a-z0-9)][.!?](?=\s+[A-Z])/)?.[0] ?? title;
|
|
100
123
|
}
|
|
101
124
|
/**
|
|
102
125
|
* A conventional-commit scope from the run's changed paths: the package name
|
|
@@ -124,12 +147,13 @@ export function commitSubject(type, scope, title) {
|
|
|
124
147
|
return scope ? `${type}(${scope}): ${title}` : `${type}: ${title}`;
|
|
125
148
|
}
|
|
126
149
|
/**
|
|
127
|
-
* A 2-3 sentence summary of the plan stage's output (markdown flattened
|
|
128
|
-
* three sentences, capped). No LLM call
|
|
129
|
-
* missing plan (a resumed run skipped the
|
|
150
|
+
* A 2-3 sentence summary of the plan stage's output (markdown flattened from
|
|
151
|
+
* its Goal or Summary heading on, first three sentences, capped). No LLM call
|
|
152
|
+
* — this is a deterministic excerpt. A missing plan (a resumed run skipped the
|
|
153
|
+
* build half) degrades honestly.
|
|
130
154
|
*/
|
|
131
155
|
export function summarizePlan(planText, ticket) {
|
|
132
|
-
const flat = (planText ?? "")
|
|
156
|
+
const flat = fromGoal(planText ?? "")
|
|
133
157
|
.replace(/^#+\s*/gm, "")
|
|
134
158
|
.replace(/^\s*(?:[-*+]|\d+[.)])\s+/gm, "")
|
|
135
159
|
.replace(/`{1,3}/g, "")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yagni-app/code-staging",
|
|
3
|
-
"version": "1.2.14-staging.
|
|
3
|
+
"version": "1.2.14-staging.2417.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": "
|
|
61
|
+
"yagniSourceSha": "7bc58b15ba25e753927d2cc43918fab2395a022c"
|
|
62
62
|
}
|