ghostrail 0.7.3 → 0.8.0
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.
- package/dist/agent/claude-code.d.ts.map +1 -1
- package/dist/agent/claude-code.js +18 -3
- package/dist/agent/claude-code.js.map +1 -1
- package/dist/agent/failure.d.ts +26 -0
- package/dist/agent/failure.d.ts.map +1 -1
- package/dist/agent/failure.js +26 -1
- package/dist/agent/failure.js.map +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/prompt.d.ts +10 -2
- package/dist/agent/prompt.d.ts.map +1 -1
- package/dist/agent/prompt.js +17 -3
- package/dist/agent/prompt.js.map +1 -1
- package/dist/agent/result.d.ts +3 -2
- package/dist/agent/result.d.ts.map +1 -1
- package/dist/agent/result.js +19 -4
- package/dist/agent/result.js.map +1 -1
- package/dist/backend/container.d.ts.map +1 -1
- package/dist/backend/container.js +46 -1
- package/dist/backend/container.js.map +1 -1
- package/dist/backend/docker.d.ts +15 -0
- package/dist/backend/docker.d.ts.map +1 -1
- package/dist/backend/docker.js +15 -0
- package/dist/backend/docker.js.map +1 -1
- package/dist/claude-profile/classify.d.ts +6 -1
- package/dist/claude-profile/classify.d.ts.map +1 -1
- package/dist/claude-profile/classify.js +95 -22
- package/dist/claude-profile/classify.js.map +1 -1
- package/dist/cli/commands.d.ts +4 -2
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +128 -4
- package/dist/cli/commands.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +3 -1
- package/dist/commands/help.js.map +1 -1
- package/dist/init/drift.d.ts +68 -0
- package/dist/init/drift.d.ts.map +1 -0
- package/dist/init/drift.js +103 -0
- package/dist/init/drift.js.map +1 -0
- package/dist/loop/engine.d.ts +1 -1
- package/dist/loop/engine.d.ts.map +1 -1
- package/dist/loop/engine.js +40 -8
- package/dist/loop/engine.js.map +1 -1
- package/dist/loop/ports.d.ts +33 -1
- package/dist/loop/ports.d.ts.map +1 -1
- package/dist/publish/gh.d.ts +33 -0
- package/dist/publish/gh.d.ts.map +1 -1
- package/dist/publish/gh.js +61 -0
- package/dist/publish/gh.js.map +1 -1
- package/dist/publish/githost.d.ts +35 -7
- package/dist/publish/githost.d.ts.map +1 -1
- package/dist/publish/githost.js +51 -9
- package/dist/publish/githost.js.map +1 -1
- package/dist/publish/github-publisher.d.ts +25 -2
- package/dist/publish/github-publisher.d.ts.map +1 -1
- package/dist/publish/github-publisher.js +46 -6
- package/dist/publish/github-publisher.js.map +1 -1
- package/dist/respond/respond.d.ts.map +1 -1
- package/dist/respond/respond.js +17 -3
- package/dist/respond/respond.js.map +1 -1
- package/dist/source/linear.d.ts +6 -1
- package/dist/source/linear.d.ts.map +1 -1
- package/dist/source/linear.js +25 -6
- package/dist/source/linear.js.map +1 -1
- package/docker/factory.Dockerfile +8 -0
- package/package.json +1 -1
- package/skill/ghostrail/SKILL.md +62 -16
- package/templates/code-local/prompts/resolve-issue.md +20 -2
- package/templates/code-local/prompts/respond.md +1 -1
- package/templates/code-local/prompts/triage.md +4 -0
- package/templates/content-loop/prompts/draft.md +6 -2
- package/templates/content-loop/prompts/respond.md +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a customized scaffolded file is missing relative to the template it came
|
|
3
|
+
* from. The manifest records a hash per file, not the text, so a three-way
|
|
4
|
+
* merge is impossible for repos that already exist. What is possible, and what
|
|
5
|
+
* every hand port has actually consisted of, is naming the two things a
|
|
6
|
+
* template gains that a prompt must mention to work: a placeholder the renderer
|
|
7
|
+
* substitutes, and a field the result parser reads.
|
|
8
|
+
*/
|
|
9
|
+
/** Placeholders and result-document fields a file is missing. */
|
|
10
|
+
export interface Signals {
|
|
11
|
+
/** `{{name}}` placeholders the template renders and this file never mentions. */
|
|
12
|
+
placeholders: string[];
|
|
13
|
+
/** Result-document keys the template documents and this file does not. */
|
|
14
|
+
fields: string[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Every distinct `{{name}}` in the text, sorted and deduplicated. The array is
|
|
18
|
+
* fresh on every call, so a caller may keep or mutate it freely.
|
|
19
|
+
*
|
|
20
|
+
* Case is preserved and significant: `{{ID}}` and `{{id}}` are two entries and
|
|
21
|
+
* both are extracted. This is a syntactic scan, so a template writing `{{ID}}`
|
|
22
|
+
* yields `ID` even though the renderer would not substitute it. That is a bug
|
|
23
|
+
* in the template, and hiding it helps nobody.
|
|
24
|
+
*/
|
|
25
|
+
export declare function extractPlaceholders(text: string): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Every distinct JSON key named on a line that also mentions `"status"`.
|
|
28
|
+
*
|
|
29
|
+
* Scoping to those lines is what keeps prose elsewhere in a prompt from
|
|
30
|
+
* contributing a field. `status` itself is excluded: it is the discriminator,
|
|
31
|
+
* present in every example, and never the thing a repo is missing.
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractResultFields(text: string): string[];
|
|
34
|
+
/**
|
|
35
|
+
* What `template` has and `current` lacks. The difference runs one way only: a
|
|
36
|
+
* repo carrying extra placeholders or fields is ahead or simply different, not
|
|
37
|
+
* drifting behind, and `--update` has nothing to say about that.
|
|
38
|
+
*/
|
|
39
|
+
export declare function missingSignals(current: string, template: string): Signals;
|
|
40
|
+
/** True when there is nothing for a human to place. */
|
|
41
|
+
export declare function isClean(signals: Signals): boolean;
|
|
42
|
+
/** The prompt roles a config can name, in report order. */
|
|
43
|
+
export type PromptRole = "agent" | "respond" | "triage";
|
|
44
|
+
/** Prompt paths a config names, by role. A role the config omits is absent. */
|
|
45
|
+
export type PromptPaths = Partial<Record<PromptRole, string>>;
|
|
46
|
+
/**
|
|
47
|
+
* Pair a template file with the repo file that plays the same part.
|
|
48
|
+
*
|
|
49
|
+
* The template's own config says which of its files fills each prompt role; the
|
|
50
|
+
* repo's config says where that role lives in the repo. Pairing by role rather
|
|
51
|
+
* than by path is the whole point: a repo that relocated its prompts (as
|
|
52
|
+
* testbotpro did, to `ghostrail/prompts/`) was invisible to a path-based
|
|
53
|
+
* comparison, which reported every real prompt as missing and named three files
|
|
54
|
+
* that do not exist.
|
|
55
|
+
*
|
|
56
|
+
* Two absences need opposite answers, which is why `repoPrompts` is nullable:
|
|
57
|
+
*
|
|
58
|
+
* - `undefined` means the repo's config could not be read or parsed. Nothing is
|
|
59
|
+
* known about where anything lives, so fall back to the template's own path.
|
|
60
|
+
* Treating it as "no roles configured" would skip every prompt in the repo and
|
|
61
|
+
* report nothing at all, which is worse than guessing.
|
|
62
|
+
* - A present object with the role missing means the config was read and simply
|
|
63
|
+
* does not enable that stage. There is nothing to compare, so skip it.
|
|
64
|
+
*
|
|
65
|
+
* Anything that is not a template prompt keeps its own relative path.
|
|
66
|
+
*/
|
|
67
|
+
export declare function repoPathFor(templateRel: string, templatePrompts: PromptPaths, repoPrompts: PromptPaths | undefined): string | undefined;
|
|
68
|
+
//# sourceMappingURL=drift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift.d.ts","sourceRoot":"","sources":["../../src/init/drift.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iEAAiE;AACjE,MAAM,WAAW,OAAO;IACtB,iFAAiF;IACjF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAiBD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAI1D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAU1D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOzE;AAED,uDAAuD;AACvD,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEjD;AAED,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAExD,+EAA+E;AAC/E,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,WAAW,EAC5B,WAAW,EAAE,WAAW,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAOpB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a customized scaffolded file is missing relative to the template it came
|
|
3
|
+
* from. The manifest records a hash per file, not the text, so a three-way
|
|
4
|
+
* merge is impossible for repos that already exist. What is possible, and what
|
|
5
|
+
* every hand port has actually consisted of, is naming the two things a
|
|
6
|
+
* template gains that a prompt must mention to work: a placeholder the renderer
|
|
7
|
+
* substitutes, and a field the result parser reads.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* `{{name}}`, with no inner spaces. The renderer substitutes exactly this
|
|
11
|
+
* shape, so `{{ id }}` is deliberately not a match: reporting it would send
|
|
12
|
+
* someone chasing a placeholder that never fires.
|
|
13
|
+
*/
|
|
14
|
+
const PLACEHOLDER = /\{\{([A-Za-z0-9_]+)\}\}/g;
|
|
15
|
+
/** A JSON key. Applied only to lines that also mention `"status"`. */
|
|
16
|
+
const JSON_KEY = /"([A-Za-z0-9_]+)"\s*:/g;
|
|
17
|
+
/** Sorted, deduplicated. A set with a stable order, so output never churns. */
|
|
18
|
+
function sortedSet(values) {
|
|
19
|
+
return [...new Set(values)].sort();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Every distinct `{{name}}` in the text, sorted and deduplicated. The array is
|
|
23
|
+
* fresh on every call, so a caller may keep or mutate it freely.
|
|
24
|
+
*
|
|
25
|
+
* Case is preserved and significant: `{{ID}}` and `{{id}}` are two entries and
|
|
26
|
+
* both are extracted. This is a syntactic scan, so a template writing `{{ID}}`
|
|
27
|
+
* yields `ID` even though the renderer would not substitute it. That is a bug
|
|
28
|
+
* in the template, and hiding it helps nobody.
|
|
29
|
+
*/
|
|
30
|
+
export function extractPlaceholders(text) {
|
|
31
|
+
const names = [];
|
|
32
|
+
for (const match of text.matchAll(PLACEHOLDER))
|
|
33
|
+
names.push(match[1]);
|
|
34
|
+
return sortedSet(names);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Every distinct JSON key named on a line that also mentions `"status"`.
|
|
38
|
+
*
|
|
39
|
+
* Scoping to those lines is what keeps prose elsewhere in a prompt from
|
|
40
|
+
* contributing a field. `status` itself is excluded: it is the discriminator,
|
|
41
|
+
* present in every example, and never the thing a repo is missing.
|
|
42
|
+
*/
|
|
43
|
+
export function extractResultFields(text) {
|
|
44
|
+
const fields = [];
|
|
45
|
+
for (const line of text.split("\n")) {
|
|
46
|
+
if (!line.includes('"status"'))
|
|
47
|
+
continue;
|
|
48
|
+
for (const match of line.matchAll(JSON_KEY)) {
|
|
49
|
+
const key = match[1];
|
|
50
|
+
if (key !== "status")
|
|
51
|
+
fields.push(key);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return sortedSet(fields);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* What `template` has and `current` lacks. The difference runs one way only: a
|
|
58
|
+
* repo carrying extra placeholders or fields is ahead or simply different, not
|
|
59
|
+
* drifting behind, and `--update` has nothing to say about that.
|
|
60
|
+
*/
|
|
61
|
+
export function missingSignals(current, template) {
|
|
62
|
+
const has = (values) => new Set(values);
|
|
63
|
+
const mine = { p: has(extractPlaceholders(current)), f: has(extractResultFields(current)) };
|
|
64
|
+
return {
|
|
65
|
+
placeholders: extractPlaceholders(template).filter((name) => !mine.p.has(name)),
|
|
66
|
+
fields: extractResultFields(template).filter((name) => !mine.f.has(name)),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** True when there is nothing for a human to place. */
|
|
70
|
+
export function isClean(signals) {
|
|
71
|
+
return signals.placeholders.length === 0 && signals.fields.length === 0;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Pair a template file with the repo file that plays the same part.
|
|
75
|
+
*
|
|
76
|
+
* The template's own config says which of its files fills each prompt role; the
|
|
77
|
+
* repo's config says where that role lives in the repo. Pairing by role rather
|
|
78
|
+
* than by path is the whole point: a repo that relocated its prompts (as
|
|
79
|
+
* testbotpro did, to `ghostrail/prompts/`) was invisible to a path-based
|
|
80
|
+
* comparison, which reported every real prompt as missing and named three files
|
|
81
|
+
* that do not exist.
|
|
82
|
+
*
|
|
83
|
+
* Two absences need opposite answers, which is why `repoPrompts` is nullable:
|
|
84
|
+
*
|
|
85
|
+
* - `undefined` means the repo's config could not be read or parsed. Nothing is
|
|
86
|
+
* known about where anything lives, so fall back to the template's own path.
|
|
87
|
+
* Treating it as "no roles configured" would skip every prompt in the repo and
|
|
88
|
+
* report nothing at all, which is worse than guessing.
|
|
89
|
+
* - A present object with the role missing means the config was read and simply
|
|
90
|
+
* does not enable that stage. There is nothing to compare, so skip it.
|
|
91
|
+
*
|
|
92
|
+
* Anything that is not a template prompt keeps its own relative path.
|
|
93
|
+
*/
|
|
94
|
+
export function repoPathFor(templateRel, templatePrompts, repoPrompts) {
|
|
95
|
+
const roles = ["agent", "respond", "triage"];
|
|
96
|
+
for (const role of roles) {
|
|
97
|
+
if (templatePrompts[role] !== templateRel)
|
|
98
|
+
continue;
|
|
99
|
+
return repoPrompts === undefined ? templateRel : repoPrompts[role];
|
|
100
|
+
}
|
|
101
|
+
return templateRel;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=drift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift.js","sourceRoot":"","sources":["../../src/init/drift.ts"],"names":[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ible work, and for each item (up to the
|
|
27
27
|
* `max_items_per_run` guardrail) claim it, provision an isolated workspace, run
|
|
28
28
|
* the agent, gate a successful change, and route the outcome to a PR (done),
|
|
29
|
-
* back to a human (blocked), or to a reset (failed
|
|
29
|
+
* back to a human (blocked/noop), or to a reset (failed). The whole tick runs
|
|
30
30
|
* under a single global lock so only one tick executes at a time; if the lock
|
|
31
31
|
* is already held, nothing runs.
|
|
32
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/loop/engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EACV,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,SAAS,
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/loop/engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,oBAAoB,CAAC;AAG9D,OAAO,KAAK,EACV,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,SAAS,EAET,MAAM,EAEP,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAa,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzD,qDAAqD;AACrD,MAAM,WAAW,QAAQ;IACvB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAqDD;;;;;;;;;;;;GAYG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CA4B1F"}
|
package/dist/loop/engine.js
CHANGED
|
@@ -53,7 +53,7 @@ async function ignoreErrors(action) {
|
|
|
53
53
|
* Run one factory tick: discover eligible work, and for each item (up to the
|
|
54
54
|
* `max_items_per_run` guardrail) claim it, provision an isolated workspace, run
|
|
55
55
|
* the agent, gate a successful change, and route the outcome to a PR (done),
|
|
56
|
-
* back to a human (blocked), or to a reset (failed
|
|
56
|
+
* back to a human (blocked/noop), or to a reset (failed). The whole tick runs
|
|
57
57
|
* under a single global lock so only one tick executes at a time; if the lock
|
|
58
58
|
* is already held, nothing runs.
|
|
59
59
|
*
|
|
@@ -155,11 +155,36 @@ async function runItem(deps, config, item, logger) {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* The tracker comment for a run that changed nothing. A noop leaves the item
|
|
160
|
+
* open, so the comment has to carry enough for the person receiving it to
|
|
161
|
+
* decide whether to close it, re-scope it, or send it back.
|
|
162
|
+
*/
|
|
163
|
+
function noopComment(reason) {
|
|
164
|
+
const opening = "The factory ran this item and made no change.";
|
|
165
|
+
return reason === undefined
|
|
166
|
+
? `${opening} The agent gave no reason, so this one needs a human look.`
|
|
167
|
+
: `${opening}\n\n${reason}`;
|
|
168
|
+
}
|
|
158
169
|
async function route(deps, config, item, workspace, outcome, logger) {
|
|
159
170
|
switch (outcome.status) {
|
|
160
|
-
case "noop":
|
|
161
|
-
|
|
162
|
-
|
|
171
|
+
case "noop": {
|
|
172
|
+
const { reason } = outcome;
|
|
173
|
+
logger.info(reason === undefined ? `${item.id}: no change` : `${item.id}: no change, ${reason}`);
|
|
174
|
+
// A noop is not a failure, so it does not reset: putting the item back in
|
|
175
|
+
// the eligible pool would have the next tick claim it, run the agent, and
|
|
176
|
+
// noop again, forever, at full agent cost per tick. It is not success
|
|
177
|
+
// either, so it must not stay claimed by the bot, which is what silently
|
|
178
|
+
// stranded items In Progress with nothing on the tracker to explain it.
|
|
179
|
+
// Say what happened and give it to a person, exactly like "blocked".
|
|
180
|
+
await deps.source.comment(item, noopComment(reason));
|
|
181
|
+
await deps.source.reassignToHuman(item);
|
|
182
|
+
return {
|
|
183
|
+
itemId: item.id,
|
|
184
|
+
state: "noop",
|
|
185
|
+
...(reason === undefined ? {} : { summary: reason }),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
163
188
|
case "blocked":
|
|
164
189
|
logger.info(`${item.id}: blocked, handing back to a human`);
|
|
165
190
|
await deps.source.comment(item, outcome.questions);
|
|
@@ -174,10 +199,17 @@ async function route(deps, config, item, workspace, outcome, logger) {
|
|
|
174
199
|
await deps.source.reset(item);
|
|
175
200
|
return { itemId: item.id, state: "failed", error: outcome.error };
|
|
176
201
|
case "done":
|
|
177
|
-
return routeDone(deps, config, item, workspace, outcome.summary, outcome
|
|
202
|
+
return routeDone(deps, config, item, workspace, outcome.summary, prContent(outcome), logger);
|
|
178
203
|
}
|
|
179
204
|
}
|
|
180
|
-
|
|
205
|
+
/** The optional PR parts of a done outcome, dropping the fields the agent omitted. */
|
|
206
|
+
function prContent(outcome) {
|
|
207
|
+
return {
|
|
208
|
+
...(outcome.type === undefined ? {} : { commitType: outcome.type }),
|
|
209
|
+
...(outcome.testPlan === undefined ? {} : { testPlan: outcome.testPlan }),
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
async function routeDone(deps, config, item, workspace, summary, content, logger) {
|
|
181
213
|
if (config.gate.commands.length > 0) {
|
|
182
214
|
const gate = await deps.gate.run({
|
|
183
215
|
backend: deps.backend,
|
|
@@ -196,14 +228,14 @@ async function routeDone(deps, config, item, workspace, summary, type, logger) {
|
|
|
196
228
|
if (!config.output.openPr) {
|
|
197
229
|
return { itemId: item.id, state: "done", summary, gate };
|
|
198
230
|
}
|
|
199
|
-
const pr = await deps.publisher.openPullRequest(item, workspace, summary,
|
|
231
|
+
const pr = await deps.publisher.openPullRequest(item, workspace, summary, content);
|
|
200
232
|
logger.info(`${item.id}: opened ${pr.url}`);
|
|
201
233
|
return { itemId: item.id, state: "done", summary, gate, prUrl: pr.url };
|
|
202
234
|
}
|
|
203
235
|
if (!config.output.openPr) {
|
|
204
236
|
return { itemId: item.id, state: "done", summary };
|
|
205
237
|
}
|
|
206
|
-
const pr = await deps.publisher.openPullRequest(item, workspace, summary,
|
|
238
|
+
const pr = await deps.publisher.openPullRequest(item, workspace, summary, content);
|
|
207
239
|
logger.info(`${item.id}: opened ${pr.url}`);
|
|
208
240
|
return { itemId: item.id, state: "done", summary, prUrl: pr.url };
|
|
209
241
|
}
|
package/dist/loop/engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/loop/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/loop/engine.ts"],"names":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,CAAC,MAAM,EAAE,CAAC;YAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC3D,CAAC;QACD,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnF,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;IAC1E,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IACrD,CAAC;IACD,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACnF,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC;AACpE,CAAC"}
|
package/dist/loop/ports.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ export interface WorkItem {
|
|
|
13
13
|
id: string;
|
|
14
14
|
title: string;
|
|
15
15
|
url?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The issue body, when the tracker has one. The agent runs with no network
|
|
18
|
+
* tools, so it can never open `url`: this is the only route by which what the
|
|
19
|
+
* issue actually says reaches the prompt. Absent when the tracker holds no
|
|
20
|
+
* description, or holds only whitespace.
|
|
21
|
+
*/
|
|
22
|
+
description?: string;
|
|
16
23
|
}
|
|
17
24
|
/** A comment on a tracker item (shape shared with PR comments). */
|
|
18
25
|
export interface Comment {
|
|
@@ -68,6 +75,13 @@ export type AgentOutcome = {
|
|
|
68
75
|
summary: string;
|
|
69
76
|
/** Conventional-commit type the agent chose (feat/fix/docs/...); sets the commit + PR title. */
|
|
70
77
|
type?: string;
|
|
78
|
+
/**
|
|
79
|
+
* How a reviewer checks this change by hand. Absent when the agent did
|
|
80
|
+
* not offer one, which is the norm for a repo whose scaffolded prompt
|
|
81
|
+
* predates the field; the PR body then omits the section rather than
|
|
82
|
+
* heading an empty one.
|
|
83
|
+
*/
|
|
84
|
+
testPlan?: string;
|
|
71
85
|
} | {
|
|
72
86
|
status: "blocked";
|
|
73
87
|
questions: string;
|
|
@@ -76,6 +90,13 @@ export type AgentOutcome = {
|
|
|
76
90
|
error: string;
|
|
77
91
|
} | {
|
|
78
92
|
status: "noop";
|
|
93
|
+
/**
|
|
94
|
+
* Why nothing changed, in the agent's own words. Present when the agent
|
|
95
|
+
* said so in its result document, or when it wrote no result at all and
|
|
96
|
+
* the reason was recovered from its output envelope. Undefined only when
|
|
97
|
+
* there was nothing to recover.
|
|
98
|
+
*/
|
|
99
|
+
reason?: string;
|
|
79
100
|
};
|
|
80
101
|
/** Everything an agent needs to work one item in its provisioned workspace. */
|
|
81
102
|
export interface AgentContext {
|
|
@@ -114,10 +135,21 @@ export interface PullRequest {
|
|
|
114
135
|
number: number;
|
|
115
136
|
url: string;
|
|
116
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* The optional narrative parts of a factory pull request. These arrived as two
|
|
140
|
+
* bare trailing strings, which is exactly the shape a caller transposes, so
|
|
141
|
+
* they travel together and named.
|
|
142
|
+
*/
|
|
143
|
+
export interface PullRequestContent {
|
|
144
|
+
/** Conventional-commit type; sets the commit and PR title. Falls back to the publisher's default. */
|
|
145
|
+
commitType?: string;
|
|
146
|
+
/** How a reviewer checks the change by hand. Omitted from the body when absent. */
|
|
147
|
+
testPlan?: string;
|
|
148
|
+
}
|
|
117
149
|
/** Opens the pull request for a green run. Never merges. */
|
|
118
150
|
export interface Publisher {
|
|
119
151
|
/** Open a PR for a green run. `commitType` overrides the default conventional-commit type. */
|
|
120
|
-
openPullRequest(item: WorkItem, workspace: Workspace, summary: string,
|
|
152
|
+
openPullRequest(item: WorkItem, workspace: Workspace, summary: string, content?: PullRequestContent): Promise<PullRequest>;
|
|
121
153
|
}
|
|
122
154
|
/** A single-holder lock (the `flock` analog) so only one run executes at a time. */
|
|
123
155
|
export interface Lock {
|
package/dist/loop/ports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/loop/ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEnE;;;;;;GAMG;AAEH,2CAA2C;AAC3C,MAAM,WAAW,QAAQ;IACvB,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/loop/ports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEnE;;;;;;GAMG;AAEH,2CAA2C;AAC3C,MAAM,WAAW,QAAQ;IACvB,yCAAyC;IACzC,EAAE,EAAE,M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1B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,0EAA0E;AAC1E,MAAM,WAAW,IAAI;IACnB,GAAG,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAChD;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,qGAAqG;IACrG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,4DAA4D;AAC5D,MAAM,WAAW,SAAS;IACxB,8FAA8F;IAC9F,eAAe,CACb,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,WAAW,CAAC,CAAC;CACzB;AAED,oFAAoF;AACpF,MAAM,WAAW,IAAI;IACnB,6DAA6D;IAC7D,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,mEAAmE;AACnE,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B"}
|
package/dist/publish/gh.d.ts
CHANGED
|
@@ -16,6 +16,15 @@ export type GhRunner = (args: readonly string[]) => Promise<{
|
|
|
16
16
|
* be opened with no local checkout, e.g. after a container pushes the branch.
|
|
17
17
|
*/
|
|
18
18
|
export declare function parseRepoSlug(remote: string): string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Color and description ghostrail gives a label it has to create itself. Both
|
|
21
|
+
* are only ever used at creation time: a label the repo already has keeps its
|
|
22
|
+
* own, whatever they are.
|
|
23
|
+
*/
|
|
24
|
+
export declare const GHOSTRAIL_LABEL_COLOR = "5319e7";
|
|
25
|
+
export declare const GHOSTRAIL_LABEL_DESCRIPTION = "Opened by the ghostrail factory";
|
|
26
|
+
/** Build `gh label create` args for a label ghostrail applies to its own PRs. */
|
|
27
|
+
export declare function ghCreateLabelArgs(label: string): string[];
|
|
19
28
|
/** Build `gh pr create` args from a PR spec (one `--label` per label, in order). */
|
|
20
29
|
export declare function ghOpenPrArgs(spec: PrSpec): string[];
|
|
21
30
|
/** Parse `gh pr list --json number,url,headRefName` output into open PRs. */
|
|
@@ -35,7 +44,31 @@ export declare class GhHost implements GitHost {
|
|
|
35
44
|
*/
|
|
36
45
|
constructor(run: GhRunner, repoSlug?: string);
|
|
37
46
|
openPr(spec: PrSpec): Promise<PrRef>;
|
|
47
|
+
/**
|
|
48
|
+
* Create `label` when the repo does not have it yet.
|
|
49
|
+
*
|
|
50
|
+
* A GitHub label is a per-repo object, and `gh pr create --label` refuses a
|
|
51
|
+
* name the repo has never seen. Without this, a run that has already done all
|
|
52
|
+
* its work (agent, gate, commit, push) throws the PR away at the last step
|
|
53
|
+
* over a label the operator was never told to create. The label is not
|
|
54
|
+
* decoration either: the respond pass finds factory PRs by listing on it, so
|
|
55
|
+
* dropping it and opening the PR anyway would leave a PR nothing ever
|
|
56
|
+
* revisits.
|
|
57
|
+
*
|
|
58
|
+
* Never `--force`, so a label the repo already uses keeps its own color and
|
|
59
|
+
* description. From the second run on, this call simply fails with "already
|
|
60
|
+
* exists", which is the expected outcome and not an error; a concurrent run
|
|
61
|
+
* that created it first lands there too.
|
|
62
|
+
*
|
|
63
|
+
* Its exit code is deliberately ignored. `gh pr create` is the authority on
|
|
64
|
+
* whether the PR can be opened, and it reports the real problem (a token that
|
|
65
|
+
* cannot write labels, say) in its own words. Throwing here would replace
|
|
66
|
+
* that with a worse message, and would newly fail runs where the label
|
|
67
|
+
* already exists but creating it was not permitted.
|
|
68
|
+
*/
|
|
69
|
+
private ensureLabel;
|
|
38
70
|
listOpenPrs(label: string): Promise<OpenPr[]>;
|
|
71
|
+
findOpenPrByBranch(headBranch: string): Promise<OpenPr | undefined>;
|
|
39
72
|
listComments(prNumber: number): Promise<PrComment[]>;
|
|
40
73
|
postComment(prNumber: number, body: string): Promise<void>;
|
|
41
74
|
private exec;
|
package/dist/publish/gh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gh.d.ts","sourceRoot":"","sources":["../../src/publish/gh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG9E,2EAA2E;AAC3E,MAAM,MAAM,QAAQ,GAAG,CACrB,IAAI,EAAE,SAAS,MAAM,EAAE,KACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEnE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUhE;AAED,oFAAoF;AACpF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAgBnD;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAYxD;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,CAqB5D;AAWD,sEAAsE;AACtE,qBAAa,MAAO,YAAW,OAAO;IACpC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAW;IAC/B,OAAO,CAAC,QAAQ,CAAC,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IAEnC;;;;;;OAMG;gBACS,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,MAAM;IAKtC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAM1C;;;;;;;;;;;;;;;;;;;;;OAqBG;YACW,WAAW;IAMnB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAc7C,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAcnE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAKpD,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAIlD,IAAI;CAUnB"}
|
package/dist/publish/gh.js
CHANGED
|
@@ -23,6 +23,25 @@ export function parseRepoSlug(remote) {
|
|
|
23
23
|
return url[1];
|
|
24
24
|
return undefined;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Color and description ghostrail gives a label it has to create itself. Both
|
|
28
|
+
* are only ever used at creation time: a label the repo already has keeps its
|
|
29
|
+
* own, whatever they are.
|
|
30
|
+
*/
|
|
31
|
+
export const GHOSTRAIL_LABEL_COLOR = "5319e7";
|
|
32
|
+
export const GHOSTRAIL_LABEL_DESCRIPTION = "Opened by the ghostrail factory";
|
|
33
|
+
/** Build `gh label create` args for a label ghostrail applies to its own PRs. */
|
|
34
|
+
export function ghCreateLabelArgs(label) {
|
|
35
|
+
return [
|
|
36
|
+
"label",
|
|
37
|
+
"create",
|
|
38
|
+
label,
|
|
39
|
+
"--color",
|
|
40
|
+
GHOSTRAIL_LABEL_COLOR,
|
|
41
|
+
"--description",
|
|
42
|
+
GHOSTRAIL_LABEL_DESCRIPTION,
|
|
43
|
+
];
|
|
44
|
+
}
|
|
26
45
|
/** Build `gh pr create` args from a PR spec (one `--label` per label, in order). */
|
|
27
46
|
export function ghOpenPrArgs(spec) {
|
|
28
47
|
const args = [
|
|
@@ -108,9 +127,38 @@ export class GhHost {
|
|
|
108
127
|
this.repoSlug = repoSlug;
|
|
109
128
|
}
|
|
110
129
|
async openPr(spec) {
|
|
130
|
+
for (const label of spec.labels)
|
|
131
|
+
await this.ensureLabel(label);
|
|
111
132
|
const result = await this.exec(ghOpenPrArgs(spec));
|
|
112
133
|
return parsePrUrl(result.stdout);
|
|
113
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Create `label` when the repo does not have it yet.
|
|
137
|
+
*
|
|
138
|
+
* A GitHub label is a per-repo object, and `gh pr create --label` refuses a
|
|
139
|
+
* name the repo has never seen. Without this, a run that has already done all
|
|
140
|
+
* its work (agent, gate, commit, push) throws the PR away at the last step
|
|
141
|
+
* over a label the operator was never told to create. The label is not
|
|
142
|
+
* decoration either: the respond pass finds factory PRs by listing on it, so
|
|
143
|
+
* dropping it and opening the PR anyway would leave a PR nothing ever
|
|
144
|
+
* revisits.
|
|
145
|
+
*
|
|
146
|
+
* Never `--force`, so a label the repo already uses keeps its own color and
|
|
147
|
+
* description. From the second run on, this call simply fails with "already
|
|
148
|
+
* exists", which is the expected outcome and not an error; a concurrent run
|
|
149
|
+
* that created it first lands there too.
|
|
150
|
+
*
|
|
151
|
+
* Its exit code is deliberately ignored. `gh pr create` is the authority on
|
|
152
|
+
* whether the PR can be opened, and it reports the real problem (a token that
|
|
153
|
+
* cannot write labels, say) in its own words. Throwing here would replace
|
|
154
|
+
* that with a worse message, and would newly fail runs where the label
|
|
155
|
+
* already exists but creating it was not permitted.
|
|
156
|
+
*/
|
|
157
|
+
async ensureLabel(label) {
|
|
158
|
+
const args = ghCreateLabelArgs(label);
|
|
159
|
+
const scoped = this.repoSlug === undefined ? args : [...args, "--repo", this.repoSlug];
|
|
160
|
+
await this.run(scoped);
|
|
161
|
+
}
|
|
114
162
|
async listOpenPrs(label) {
|
|
115
163
|
const result = await this.exec([
|
|
116
164
|
"pr",
|
|
@@ -124,6 +172,19 @@ export class GhHost {
|
|
|
124
172
|
]);
|
|
125
173
|
return parseOpenPrList(result.stdout);
|
|
126
174
|
}
|
|
175
|
+
async findOpenPrByBranch(headBranch) {
|
|
176
|
+
const result = await this.exec([
|
|
177
|
+
"pr",
|
|
178
|
+
"list",
|
|
179
|
+
"--head",
|
|
180
|
+
headBranch,
|
|
181
|
+
"--state",
|
|
182
|
+
"open",
|
|
183
|
+
"--json",
|
|
184
|
+
"number,url,headRefName",
|
|
185
|
+
]);
|
|
186
|
+
return parseOpenPrList(result.stdout)[0];
|
|
187
|
+
}
|
|
127
188
|
async listComments(prNumber) {
|
|
128
189
|
const result = await this.exec(["pr", "view", String(prNumber), "--json", "comments"]);
|
|
129
190
|
return parseCommentList(result.stdout);
|
package/dist/publish/gh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gh.js","sourceRoot":"","sources":["../../src/publish/gh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,+CAA+C;IAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAChF,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1C,6EAA6E;IAC7E,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,oEAAoE,CAAC,CAAC;IAChG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,SAA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8,11 +8,31 @@ export declare const GHOSTRAIL_MARKER = "<!-- ghostrail -->";
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const SCRATCH_DIR = ".ghostrail";
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
* Without the exclusion a bare `git add -A`
|
|
13
|
-
* any staged artifacts) into every factory
|
|
11
|
+
* The git invocations that stage the agent's work: everything in the workspace
|
|
12
|
+
* except the factory's scratch dir. Without the exclusion a bare `git add -A`
|
|
13
|
+
* sweeps `.ghostrail/result.json` (and any staged artifacts) into every factory
|
|
14
|
+
* PR.
|
|
15
|
+
*
|
|
16
|
+
* This is deliberately two commands rather than the one it looks like it should
|
|
17
|
+
* be. `git add -A -- . :(exclude).ghostrail` fails outright in any repo whose
|
|
18
|
+
* `.gitignore` lists the scratch dir: git reads the excluded path as an explicit
|
|
19
|
+
* pathspec, notices it is ignored, prints "The following paths are ignored by
|
|
20
|
+
* one of your .gitignore files" and exits 1. Staging everything and then
|
|
21
|
+
* dropping the scratch dir from the index works whether or not the repo ignores
|
|
22
|
+
* it, and `reset` (rather than `rm --cached`) leaves a scratch path that really
|
|
23
|
+
* is tracked alone instead of staging its deletion.
|
|
14
24
|
*/
|
|
15
|
-
export declare function
|
|
25
|
+
export declare function gitStageAllArgs(): string[][];
|
|
26
|
+
/**
|
|
27
|
+
* True when a failed `git push` was rejected because the remote branch holds
|
|
28
|
+
* work the local branch does not, rather than for some unrelated reason (a
|
|
29
|
+
* missing remote, no permission, a broken network).
|
|
30
|
+
*
|
|
31
|
+
* Git words this several ways depending on version and remote, so match the
|
|
32
|
+
* parts that have been stable: the `[rejected]` marker, and the hints git
|
|
33
|
+
* prints for a non-fast-forward and for a stale ref.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isNonFastForward(output: string): boolean;
|
|
16
36
|
export interface PrSpec {
|
|
17
37
|
baseBranch: string;
|
|
18
38
|
headBranch: string;
|
|
@@ -44,6 +64,8 @@ export interface PrComment {
|
|
|
44
64
|
export interface GitHost {
|
|
45
65
|
openPr(spec: PrSpec): Promise<PrRef>;
|
|
46
66
|
listOpenPrs(label: string): Promise<OpenPr[]>;
|
|
67
|
+
/** The open PR whose head is `headBranch`, or undefined when there is none. */
|
|
68
|
+
findOpenPrByBranch(headBranch: string): Promise<OpenPr | undefined>;
|
|
47
69
|
listComments(prNumber: number): Promise<PrComment[]>;
|
|
48
70
|
postComment(prNumber: number, body: string): Promise<void>;
|
|
49
71
|
}
|
|
@@ -59,8 +81,14 @@ export declare function parsePrUrl(stdout: string): PrRef;
|
|
|
59
81
|
*/
|
|
60
82
|
export declare function commitMessage(id: string, title: string, type?: string): string;
|
|
61
83
|
/**
|
|
62
|
-
* Build the PR body: the agent's summary
|
|
63
|
-
*
|
|
84
|
+
* Build the PR body: the agent's summary under a heading, an optional test plan
|
|
85
|
+
* under its own, a ruled-off footer linking the tracker item, and the hidden
|
|
86
|
+
* ghostrail marker so the respond pass can recognize its own PRs.
|
|
87
|
+
*
|
|
88
|
+
* The summary is trimmed and otherwise passed through byte for byte. Agents
|
|
89
|
+
* write it as one long paragraph and it is tempting to reflow, but guessing at
|
|
90
|
+
* paragraph breaks would corrupt code fences and lists. Structure comes from
|
|
91
|
+
* the headings around it; the prose itself is the prompt's job.
|
|
64
92
|
*/
|
|
65
|
-
export declare function prBody(item: WorkItem, summary: string): string;
|
|
93
|
+
export declare function prBody(item: WorkItem, summary: string, testPlan?: string): string;
|
|
66
94
|
//# sourceMappingURL=githost.d.ts.map
|