@codetreker/daynight 0.0.0-stage → 0.2.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.
- package/dist/cli.d.ts +17 -0
- package/dist/cli.js +164 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +32 -0
- package/dist/config.js +263 -0
- package/dist/config.js.map +1 -0
- package/dist/coordinator.d.ts +39 -0
- package/dist/coordinator.js +390 -0
- package/dist/coordinator.js.map +1 -0
- package/dist/copilot.d.ts +44 -0
- package/dist/copilot.js +263 -0
- package/dist/copilot.js.map +1 -0
- package/dist/diagnostics.d.ts +1 -0
- package/dist/diagnostics.js +16 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/git.d.ts +41 -0
- package/dist/git.js +539 -0
- package/dist/git.js.map +1 -0
- package/dist/github.d.ts +70 -0
- package/dist/github.js +675 -0
- package/dist/github.js.map +1 -0
- package/dist/instance-lock.d.ts +5 -0
- package/dist/instance-lock.js +115 -0
- package/dist/instance-lock.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +12 -0
- package/dist/main.js.map +1 -0
- package/dist/paths.d.ts +33 -0
- package/dist/paths.js +155 -0
- package/dist/paths.js.map +1 -0
- package/dist/processes.d.ts +23 -0
- package/dist/processes.js +182 -0
- package/dist/processes.js.map +1 -0
- package/dist/repositories.d.ts +15 -0
- package/dist/repositories.js +159 -0
- package/dist/repositories.js.map +1 -0
- package/dist/review-list.d.ts +5 -0
- package/dist/review-list.js +123 -0
- package/dist/review-list.js.map +1 -0
- package/dist/runtime.d.ts +24 -0
- package/dist/runtime.js +77 -0
- package/dist/runtime.js.map +1 -0
- package/dist/store.d.ts +136 -0
- package/dist/store.js +579 -0
- package/dist/store.js.map +1 -0
- package/package.json +33 -3
- package/README.md +0 -3
package/dist/copilot.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { lstat, mkdir, mkdtemp, open } from "node:fs/promises";
|
|
3
|
+
import { Readable, Transform } from "node:stream";
|
|
4
|
+
import { pipeline } from "node:stream/promises";
|
|
5
|
+
import crossSpawn from "cross-spawn";
|
|
6
|
+
import { remoteIdentity } from "./config.js";
|
|
7
|
+
import { isolatedGitEnvironment } from "./git.js";
|
|
8
|
+
const asError = (value) => value instanceof Error ? value : new Error(String(value));
|
|
9
|
+
const positiveInteger = (value, name) => {
|
|
10
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > 2_147_483_647)
|
|
11
|
+
throw new Error(`${name} must be a positive integer no greater than 2147483647.`);
|
|
12
|
+
};
|
|
13
|
+
const sessionExists = async (directory) => {
|
|
14
|
+
try {
|
|
15
|
+
if (!(await lstat(directory)).isDirectory())
|
|
16
|
+
throw new Error(`Copilot session history ${directory} must be a directory.`);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT")
|
|
21
|
+
return false;
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const reviewPrompt = (review, worktree, repository, previous) => `You are the Copilot code review agent for daynight.
|
|
26
|
+
Review this immutable target:
|
|
27
|
+
${JSON.stringify({ host: review.host, repositoryId: review.githubId, repository: `${repository.owner}/${repository.name}`, pullRequest: review.number,
|
|
28
|
+
reviewId: review.id, revision: review.revision, headSha: review.headSha, baseBranch: review.baseRef, baseSha: worktree.baseSha, mergeBaseSha: worktree.mergeBaseSha })}
|
|
29
|
+
The worktree is already prepared. Review the changes from merge-base to head and trace affected callers and contracts. Its Git environment exposes the original commit objects and a complete checkout.
|
|
30
|
+
${previous === undefined ? "" : `A previous unfinished review may have published results: ${JSON.stringify(previous)}. Reconcile its existing effects; do not publish a review for its obsolete target merely to confirm it.\n`}This attempt may follow an interrupted or incomplete attempt of this same review. First inspect the PR's existing reviews and inline comments for the stable identity below. If this target's required result was already published successfully, confirm it without publishing it again; otherwise finish the remaining work.
|
|
31
|
+
Stable review identity: daynight review=${review.id} revision=${review.revision} head=${review.headSha}
|
|
32
|
+
Publish the review yourself using gh api. Immediately before publication re-read the PR and require it to be Open, non-Draft, with head SHA ${review.headSha} and base branch ${JSON.stringify(review.baseRef)}. If it is stale, closed, Draft, inaccessible, or publication fails, explain the problem and do not output the completion marker.
|
|
33
|
+
Use POST repos/${repository.owner}/${repository.name}/pulls/${review.number}/reviews on host ${review.host}. Explicitly set commit_id to ${review.headSha} and include the stable review identity in the review body. Use English and identify yourself as Copilot in published text.
|
|
34
|
+
Report only actionable Critical or Major problems introduced by this change, using inline comments on the relevant changed lines in a COMMENT review. Never submit REQUEST_CHANGES. If no Critical or Major problem remains, publish APPROVE. Verify the required publication succeeded. Do not treat an existing COMMENT as evidence of approval, and do not claim success when you cannot approve your own PR.
|
|
35
|
+
The repository and worktree are dedicated to this review system. Worktree creation, reset and cleanup belong to daynight; do not perform those lifecycle operations. Keep supplementary clones and temporary resources under the supplied temporary directory.
|
|
36
|
+
Run all tools in the foreground, await and reap them, and stop every service or other tool you started before returning. Do not leave background or detached processes running.
|
|
37
|
+
After the required review result has been published or confirmed, finish stdout with exactly this standalone line, with no text after it:
|
|
38
|
+
PR ${review.number} Review Completed
|
|
39
|
+
`;
|
|
40
|
+
class LastLine extends Transform {
|
|
41
|
+
decoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
42
|
+
limit;
|
|
43
|
+
line = "";
|
|
44
|
+
overflow = false;
|
|
45
|
+
lastNonempty = null;
|
|
46
|
+
constructor(limit) { super(); this.limit = limit; }
|
|
47
|
+
accept(text) {
|
|
48
|
+
for (const piece of text.split(/(?<=\n)/)) {
|
|
49
|
+
const newline = piece.endsWith("\n");
|
|
50
|
+
const content = newline ? piece.slice(0, -1) : piece;
|
|
51
|
+
if (this.line.length + content.length > this.limit)
|
|
52
|
+
this.overflow = true;
|
|
53
|
+
if (!this.overflow)
|
|
54
|
+
this.line += content;
|
|
55
|
+
if (newline) {
|
|
56
|
+
const value = this.line.endsWith("\r") ? this.line.slice(0, -1) : this.line;
|
|
57
|
+
if (this.overflow || value.length !== 0)
|
|
58
|
+
this.lastNonempty = this.overflow ? null : value;
|
|
59
|
+
this.line = "";
|
|
60
|
+
this.overflow = false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_transform(chunk, _encoding, callback) {
|
|
65
|
+
try {
|
|
66
|
+
this.accept(this.decoder.decode(chunk, { stream: true }));
|
|
67
|
+
callback(null, chunk);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
callback(asError(error));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
_flush(callback) {
|
|
74
|
+
try {
|
|
75
|
+
this.accept(this.decoder.decode());
|
|
76
|
+
if (this.overflow || this.line.length !== 0)
|
|
77
|
+
this.lastNonempty = this.overflow ? null : this.line;
|
|
78
|
+
callback();
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
callback(asError(error));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Runs one persisted attempt; the caller retains scheduling, final state transitions, and descendant-process exclusion. */
|
|
86
|
+
export const createCopilotRunner = (options) => {
|
|
87
|
+
const now = options.now === undefined ? Date.now : options.now;
|
|
88
|
+
const grace = options.terminationGraceMs === undefined ? 5_000 : options.terminationGraceMs;
|
|
89
|
+
const lineLimit = options.maxLineCharacters === undefined ? 8_192 : options.maxLineCharacters;
|
|
90
|
+
positiveInteger(options.timeoutMs, "Copilot timeout");
|
|
91
|
+
positiveInteger(grace, "Termination grace");
|
|
92
|
+
positiveInteger(lineLimit, "Line character limit");
|
|
93
|
+
if (options.processOwner.trim() === "")
|
|
94
|
+
throw new Error("Copilot process owner must be nonempty.");
|
|
95
|
+
const run = async (store, reviewId, worktree, input = {}) => {
|
|
96
|
+
input.signal?.throwIfAborted();
|
|
97
|
+
const review = store.getReview(reviewId);
|
|
98
|
+
if (review === null)
|
|
99
|
+
throw new Error("The Copilot review does not exist.");
|
|
100
|
+
const pr = store.getPullRequest(review);
|
|
101
|
+
const repository = store.getRepository(review);
|
|
102
|
+
if (pr === null || repository === null || pr.sessionId === null || pr.worktreePath !== worktree.path || review.headSha !== worktree.headSha || review.baseSha !== worktree.baseSha)
|
|
103
|
+
throw new Error("The prepared Copilot target does not match persisted review state.");
|
|
104
|
+
const coordinate = remoteIdentity(repository.remote, "Review repository remote");
|
|
105
|
+
const sessionDirectory = path.join(options.paths.copilotDirectory, "session-state", pr.sessionId);
|
|
106
|
+
const existing = await sessionExists(sessionDirectory);
|
|
107
|
+
if (pr.sessionEstablished && !existing)
|
|
108
|
+
throw new Error(`Established Copilot session ${pr.sessionId} is missing its history at ${sessionDirectory}.`);
|
|
109
|
+
if (existing && !pr.sessionEstablished)
|
|
110
|
+
store.markSessionEstablished(pr);
|
|
111
|
+
const mode = existing ? "resume" : "create";
|
|
112
|
+
const reviewLogs = path.join(options.paths.logsDirectory, review.id);
|
|
113
|
+
await Promise.all([options.paths.copilotDirectory, options.paths.cacheDirectory, options.paths.temporaryDirectory, reviewLogs].map((directory) => mkdir(directory, { recursive: true })));
|
|
114
|
+
const attemptDirectory = await mkdtemp(path.join(reviewLogs, `${review.attemptCount + 1}-`));
|
|
115
|
+
const stdoutLogPath = path.join(attemptDirectory, "stdout.log");
|
|
116
|
+
const stderrLogPath = path.join(attemptDirectory, "stderr.log");
|
|
117
|
+
const stdoutFile = await open(stdoutLogPath, "wx", 0o600);
|
|
118
|
+
let stderrFile;
|
|
119
|
+
try {
|
|
120
|
+
stderrFile = await open(stderrLogPath, "wx", 0o600);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
await stdoutFile.close();
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
let launched;
|
|
127
|
+
try {
|
|
128
|
+
input.signal?.throwIfAborted();
|
|
129
|
+
launched = store.startAttempt(review.id, { processOwner: options.processOwner, stdoutLogPath, stderrLogPath }, now());
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
await Promise.all([stdoutFile.close(), stderrFile.close()]);
|
|
133
|
+
throw error;
|
|
134
|
+
}
|
|
135
|
+
const attempt = { reviewId: review.id, attempt: launched.attemptCount };
|
|
136
|
+
const errors = [];
|
|
137
|
+
const outcome = { attempt, sessionId: pr.sessionId, sessionMode: mode, stdoutLogPath, stderrLogPath,
|
|
138
|
+
completed: false, directProcessClosed: false, captureComplete: false, exitCode: null, signal: null, lastNonemptyLine: null, interruption: null, launchFailure: null, errors };
|
|
139
|
+
const parentEnvironment = options.environment === undefined ? process.env : options.environment;
|
|
140
|
+
const environment = { ...parentEnvironment, ...isolatedGitEnvironment(parentEnvironment, worktree.gitEnvironment),
|
|
141
|
+
COPILOT_HOME: options.paths.copilotDirectory, COPILOT_CACHE_HOME: options.paths.cacheDirectory,
|
|
142
|
+
TMPDIR: options.paths.temporaryDirectory, TMP: options.paths.temporaryDirectory, TEMP: options.paths.temporaryDirectory,
|
|
143
|
+
NO_COLOR: "1", GH_PROMPT_DISABLED: "1", GH_FORCE_TTY: "", PAGER: "cat", GH_PAGER: "cat" };
|
|
144
|
+
delete environment.GH_DEBUG;
|
|
145
|
+
const args = [...(options.command?.args === undefined ? [] : options.command.args), "-C", worktree.path,
|
|
146
|
+
`--${mode === "resume" ? "resume" : "session-id"}=${pr.sessionId}`, "-s", "--output-format", "text", "--stream", "on", "--no-color",
|
|
147
|
+
"--no-ask-user", "--no-auto-update", "--allow-all-tools", "--log-dir", attemptDirectory];
|
|
148
|
+
const commandFile = options.command === undefined ? "copilot" : options.command.file;
|
|
149
|
+
let child;
|
|
150
|
+
try {
|
|
151
|
+
child = crossSpawn(commandFile, args, { cwd: worktree.path, env: environment, shell: false, windowsHide: true, detached: process.platform !== "win32", stdio: ["pipe", "pipe", "pipe"] });
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
errors.push(asError(error));
|
|
155
|
+
await Promise.all([stdoutFile.close(), stderrFile.close()]);
|
|
156
|
+
outcome.directProcessClosed = true;
|
|
157
|
+
return outcome;
|
|
158
|
+
}
|
|
159
|
+
const parser = new LastLine(lineLimit);
|
|
160
|
+
let timeout;
|
|
161
|
+
let force;
|
|
162
|
+
let abandon;
|
|
163
|
+
let stopped = false;
|
|
164
|
+
let resolveClose;
|
|
165
|
+
const closed = new Promise((resolve) => { resolveClose = resolve; });
|
|
166
|
+
const stop = () => {
|
|
167
|
+
if (stopped || outcome.directProcessClosed || outcome.launchFailure !== null)
|
|
168
|
+
return;
|
|
169
|
+
stopped = true;
|
|
170
|
+
if (input.stopProcess !== undefined && child.pid !== undefined) {
|
|
171
|
+
void input.stopProcess(child, attempt).catch((error) => { errors.push(asError(error)); }).finally(() => {
|
|
172
|
+
if (!outcome.directProcessClosed) {
|
|
173
|
+
errors.push(new Error("Copilot termination could not confirm its direct process and streams closed; retained state requires operator recovery."));
|
|
174
|
+
child.stdin.destroy();
|
|
175
|
+
child.stdout.destroy();
|
|
176
|
+
child.stderr.destroy();
|
|
177
|
+
resolveClose();
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
child.kill("SIGTERM");
|
|
183
|
+
force = setTimeout(() => {
|
|
184
|
+
child.kill("SIGKILL");
|
|
185
|
+
abandon = setTimeout(() => {
|
|
186
|
+
errors.push(new Error("Copilot did not close its process and streams within the termination grace period; descendant processes must be excluded before reuse."));
|
|
187
|
+
child.stdin.destroy();
|
|
188
|
+
child.stdout.destroy();
|
|
189
|
+
child.stderr.destroy();
|
|
190
|
+
resolveClose();
|
|
191
|
+
}, grace);
|
|
192
|
+
}, grace);
|
|
193
|
+
};
|
|
194
|
+
child.once("error", (error) => {
|
|
195
|
+
errors.push(error);
|
|
196
|
+
const failed = error;
|
|
197
|
+
// cross-spawn reports an unresolved Windows command when its cmd.exe wrapper exits.
|
|
198
|
+
// https://github.com/moxystudio/node-cross-spawn/blob/77cd97f3ca7b62c904a63a698fc4a79bf41977d0/lib/enoent.js#L6
|
|
199
|
+
if (failed.code === "ENOENT" && failed.syscall === `spawn ${commandFile}` && failed.path === commandFile &&
|
|
200
|
+
(child.pid === undefined || (process.platform === "win32" && failed.errno === "ENOENT" && Array.isArray(failed.spawnargs) &&
|
|
201
|
+
failed.spawnargs.length === args.length && failed.spawnargs.every((argument, index) => argument === args[index])))) {
|
|
202
|
+
outcome.launchFailure = "command-not-found";
|
|
203
|
+
}
|
|
204
|
+
else
|
|
205
|
+
stop();
|
|
206
|
+
});
|
|
207
|
+
child.once("spawn", () => {
|
|
208
|
+
try {
|
|
209
|
+
store.recordProcess(attempt, { pid: child.pid, identity: `${options.processOwner}:${review.id}:${attempt.attempt}` });
|
|
210
|
+
input.onProcess?.(child, attempt);
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
errors.push(asError(error));
|
|
214
|
+
stop();
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
child.once("close", (code, signal) => { outcome.directProcessClosed = true; outcome.exitCode = code; outcome.signal = signal; resolveClose(); });
|
|
218
|
+
const abort = () => { outcome.interruption = "aborted"; stop(); };
|
|
219
|
+
input.signal?.addEventListener("abort", abort, { once: true });
|
|
220
|
+
timeout = setTimeout(() => { outcome.interruption = "timeout"; stop(); }, options.timeoutMs);
|
|
221
|
+
const capture = async (operation, promptInput = false) => {
|
|
222
|
+
try {
|
|
223
|
+
await operation;
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
errors.push(asError(error));
|
|
228
|
+
// A wrapper can close its input before cross-spawn reports that the command was not found.
|
|
229
|
+
// The process close or configured timeout still bounds a failed prompt delivery.
|
|
230
|
+
if (!promptInput)
|
|
231
|
+
stop();
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
const outputs = [capture(pipeline(child.stdout, parser, stdoutFile.createWriteStream())), capture(pipeline(child.stderr, stderrFile.createWriteStream())),
|
|
236
|
+
capture(pipeline(Readable.from([reviewPrompt(launched, worktree, coordinate, input.previousReview)]), child.stdin), true)];
|
|
237
|
+
if (input.signal?.aborted)
|
|
238
|
+
abort();
|
|
239
|
+
await closed;
|
|
240
|
+
if (timeout !== undefined)
|
|
241
|
+
clearTimeout(timeout);
|
|
242
|
+
if (force !== undefined)
|
|
243
|
+
clearTimeout(force);
|
|
244
|
+
if (abandon !== undefined)
|
|
245
|
+
clearTimeout(abandon);
|
|
246
|
+
input.signal?.removeEventListener("abort", abort);
|
|
247
|
+
outcome.captureComplete = (await Promise.all(outputs)).every(Boolean);
|
|
248
|
+
outcome.lastNonemptyLine = parser.lastNonempty;
|
|
249
|
+
try {
|
|
250
|
+
if (await sessionExists(sessionDirectory))
|
|
251
|
+
store.markSessionEstablished(pr);
|
|
252
|
+
else
|
|
253
|
+
errors.push(new Error(`Copilot session ${pr.sessionId} did not retain its history at ${sessionDirectory}.`));
|
|
254
|
+
}
|
|
255
|
+
catch (error) {
|
|
256
|
+
errors.push(asError(error));
|
|
257
|
+
}
|
|
258
|
+
outcome.completed = outcome.directProcessClosed && outcome.captureComplete && errors.length === 0 && outcome.interruption === null && outcome.exitCode === 0 && outcome.signal === null && outcome.lastNonemptyLine === `PR ${review.number} Review Completed`;
|
|
259
|
+
return outcome;
|
|
260
|
+
};
|
|
261
|
+
return { run };
|
|
262
|
+
};
|
|
263
|
+
//# sourceMappingURL=copilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot.js","sourceRoot":"","sources":["../src/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD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@ -0,0 +1,16 @@
|
|
|
1
|
+
export const formatError = (error) => {
|
|
2
|
+
if (!(error instanceof Error)) {
|
|
3
|
+
return String(error);
|
|
4
|
+
}
|
|
5
|
+
const details = [error.message];
|
|
6
|
+
if (error instanceof AggregateError) {
|
|
7
|
+
for (const child of error.errors) {
|
|
8
|
+
details.push(formatError(child));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
if (error.cause !== undefined) {
|
|
12
|
+
details.push(`Caused by: ${formatError(error.cause)}`);
|
|
13
|
+
}
|
|
14
|
+
return details.join("\n");
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=diagnostics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAU,EAAE;IACpD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,MAAM,OAAO,GAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IACD,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,cAAc,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC"}
|
package/dist/git.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RepositoryConfiguration } from "./config.js";
|
|
2
|
+
import type { CommandExecutor, GitHubClient, GitHubRepository } from "./github.js";
|
|
3
|
+
import type { OperationsStopped, ProcessesExcluded, PullRequestIdentity, Store } from "./store.js";
|
|
4
|
+
export type LocalRepository = {
|
|
5
|
+
configuration: RepositoryConfiguration;
|
|
6
|
+
repository: GitHubRepository;
|
|
7
|
+
root: string;
|
|
8
|
+
commonDirectory: string;
|
|
9
|
+
rootIdentity: string;
|
|
10
|
+
commonIdentity: string;
|
|
11
|
+
};
|
|
12
|
+
export type PreparedWorktree = {
|
|
13
|
+
kind: "prepared";
|
|
14
|
+
path: string;
|
|
15
|
+
headSha: string;
|
|
16
|
+
baseSha: string;
|
|
17
|
+
mergeBaseSha: string;
|
|
18
|
+
gitEnvironment: Record<string, string | undefined>;
|
|
19
|
+
};
|
|
20
|
+
export declare class GitCommandError extends Error {
|
|
21
|
+
readonly completed: boolean;
|
|
22
|
+
constructor(message: string, cause: unknown, completed: boolean);
|
|
23
|
+
}
|
|
24
|
+
/** Child overrides: undefined entries erase inherited selectors before prepared settings apply. */
|
|
25
|
+
export declare const isolatedGitEnvironment: (inherited: Readonly<Record<string, string | undefined>>, prepared: Readonly<Record<string, string | undefined>>) => Record<string, string | undefined>;
|
|
26
|
+
export declare const createGitManager: (options: {
|
|
27
|
+
temporaryDirectory: string;
|
|
28
|
+
client: GitHubClient;
|
|
29
|
+
execute?: CommandExecutor;
|
|
30
|
+
now?: () => number;
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
maxBufferBytes?: number;
|
|
33
|
+
}) => {
|
|
34
|
+
ensureRepository: (configuration: RepositoryConfiguration, signal?: AbortSignal) => Promise<LocalRepository>;
|
|
35
|
+
prepareWorktree: (store: Store, local: LocalRepository, reviewId: string, proof: ProcessesExcluded, signal?: AbortSignal) => Promise<PreparedWorktree | {
|
|
36
|
+
kind: "changed";
|
|
37
|
+
}>;
|
|
38
|
+
cleanupWorktree: (store: Store, local: LocalRepository, identity: PullRequestIdentity, proof: ProcessesExcluded & OperationsStopped, signal?: AbortSignal) => Promise<{
|
|
39
|
+
kind: "cleaned" | "reopened";
|
|
40
|
+
}>;
|
|
41
|
+
};
|