open-azdo 0.2.3 → 0.2.5
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/open-azdo.js
CHANGED
|
@@ -46932,17 +46932,17 @@ var runGit = (workspace, operation, args2, allowNonZeroExit = false) => exports_
|
|
|
46932
46932
|
allowNonZeroExit
|
|
46933
46933
|
});
|
|
46934
46934
|
});
|
|
46935
|
+
var resolveHeadReviewedSourceCommitCandidate = (workspace) => runGit(workspace, "Git.resolveReviewedSourceCommit.revList", ["rev-list", "--parents", "-n", "1", "HEAD"]).pipe(exports_Effect.map((result4) => {
|
|
46936
|
+
const hashes = result4.stdout.trim().split(/\s+/);
|
|
46937
|
+
return hashes.length === 3 ? "HEAD^2" : "HEAD";
|
|
46938
|
+
}));
|
|
46935
46939
|
var resolveReviewedSourceCommit = ({ workspace, sourceCommitId }) => exports_Effect.gen(function* () {
|
|
46936
|
-
const
|
|
46937
|
-
|
|
46938
|
-
|
|
46939
|
-
"-
|
|
46940
|
-
|
|
46941
|
-
|
|
46942
|
-
]).pipe(exports_Effect.map((result4) => {
|
|
46943
|
-
const hashes = result4.stdout.trim().split(/\s+/);
|
|
46944
|
-
return hashes.length === 3 ? "HEAD^2" : "HEAD";
|
|
46945
|
-
})));
|
|
46940
|
+
const fallbackCandidate = yield* resolveHeadReviewedSourceCommitCandidate(workspace);
|
|
46941
|
+
let candidate = fallbackCandidate;
|
|
46942
|
+
if (sourceCommitId !== undefined) {
|
|
46943
|
+
const explicitCandidate = yield* runGit(workspace, "Git.resolveReviewedSourceCommit.verifyExplicit", ["rev-parse", "--verify", `${sourceCommitId}^{commit}`], true);
|
|
46944
|
+
candidate = explicitCandidate.exitCode === 0 ? sourceCommitId : fallbackCandidate;
|
|
46945
|
+
}
|
|
46946
46946
|
const resolved = yield* runGit(workspace, "Git.resolveReviewedSourceCommit.revParse", [
|
|
46947
46947
|
"rev-parse",
|
|
46948
46948
|
"--verify",
|
|
@@ -47181,6 +47181,7 @@ var GitExecLive = exports_Layer.effect(GitExec, makeGitExec);
|
|
|
47181
47181
|
class OpenCodeRunner extends exports_ServiceMap.Service()("open-azdo/opencode/OpenCodeRunner") {
|
|
47182
47182
|
}
|
|
47183
47183
|
// ../../packages/core/src/opencode/Layers/OpenCodeRunner.ts
|
|
47184
|
+
var OPENCODE_MAX_OUTPUT_BYTES = 1e7;
|
|
47184
47185
|
var buildOpenCodeConfig = (agentName) => ({
|
|
47185
47186
|
$schema: "https://opencode.ai/config.json",
|
|
47186
47187
|
permission: {
|
|
@@ -47236,6 +47237,26 @@ var buildOpenCodeArgs = (request3) => [
|
|
|
47236
47237
|
var extractFinalResponse = (output) => {
|
|
47237
47238
|
const texts = [];
|
|
47238
47239
|
const structuredCandidates = [];
|
|
47240
|
+
const reportedErrors = [];
|
|
47241
|
+
const describeError = (value3) => {
|
|
47242
|
+
if (value3 === null || value3 === undefined) {
|
|
47243
|
+
return;
|
|
47244
|
+
}
|
|
47245
|
+
if (typeof value3 === "string") {
|
|
47246
|
+
const trimmed = value3.trim();
|
|
47247
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
47248
|
+
}
|
|
47249
|
+
if (typeof value3 !== "object" || Array.isArray(value3)) {
|
|
47250
|
+
return String(value3);
|
|
47251
|
+
}
|
|
47252
|
+
const record3 = value3;
|
|
47253
|
+
const message = describeError(record3.message) ?? describeError(record3.detail) ?? describeError(record3.data) ?? describeError(record3.error) ?? describeError(record3.cause);
|
|
47254
|
+
if (!message) {
|
|
47255
|
+
return stringifyJson2(record3);
|
|
47256
|
+
}
|
|
47257
|
+
const name = typeof record3.name === "string" ? record3.name.trim() : "";
|
|
47258
|
+
return name.length > 0 && !message.startsWith(`${name}:`) ? `${name}: ${message}` : message;
|
|
47259
|
+
};
|
|
47239
47260
|
const maybeCollectStructuredCandidate = (value3) => {
|
|
47240
47261
|
if (!value3 || typeof value3 !== "object" || Array.isArray(value3)) {
|
|
47241
47262
|
return;
|
|
@@ -47290,6 +47311,12 @@ var extractFinalResponse = (output) => {
|
|
|
47290
47311
|
texts.push(event);
|
|
47291
47312
|
continue;
|
|
47292
47313
|
}
|
|
47314
|
+
if (event && typeof event === "object" && !Array.isArray(event) && event.type === "error" && "error" in event) {
|
|
47315
|
+
const message = describeError(event.error);
|
|
47316
|
+
if (message) {
|
|
47317
|
+
reportedErrors.push(message);
|
|
47318
|
+
}
|
|
47319
|
+
}
|
|
47293
47320
|
collectTextCandidates(event);
|
|
47294
47321
|
} catch {
|
|
47295
47322
|
texts.push(trimmed);
|
|
@@ -47303,7 +47330,7 @@ var extractFinalResponse = (output) => {
|
|
|
47303
47330
|
`).trim();
|
|
47304
47331
|
if (!response) {
|
|
47305
47332
|
throw new OpenCodeOutputError({
|
|
47306
|
-
message: "OpenCode did not return a final response.",
|
|
47333
|
+
message: reportedErrors.at(-1) ?? "OpenCode did not return a final response.",
|
|
47307
47334
|
output
|
|
47308
47335
|
});
|
|
47309
47336
|
}
|
|
@@ -47345,6 +47372,7 @@ var makeOpenCodeRunner = exports_Effect.gen(function* () {
|
|
|
47345
47372
|
args: buildOpenCodeArgs(request3),
|
|
47346
47373
|
cwd: request3.workspace,
|
|
47347
47374
|
timeout: request3.timeout,
|
|
47375
|
+
maxOutputBytes: OPENCODE_MAX_OUTPUT_BYTES,
|
|
47348
47376
|
env: {
|
|
47349
47377
|
...request3.inheritedEnv,
|
|
47350
47378
|
OPENCODE_CONFIG: configPath,
|
|
@@ -48445,7 +48473,7 @@ var reviewCommandConfig = {
|
|
|
48445
48473
|
var reviewCommand = make33("review", reviewCommandConfig).pipe(withDescription3("Review an Azure DevOps pull request with OpenCode."), withHandler((input) => runReviewCommand(input)));
|
|
48446
48474
|
var openAzdoCli = make33("open-azdo").pipe(withDescription3("Secure Azure DevOps pull-request review CLI powered by OpenCode."), withSubcommands([reviewCommand]));
|
|
48447
48475
|
// package.json
|
|
48448
|
-
var version2 = "0.2.
|
|
48476
|
+
var version2 = "0.2.5";
|
|
48449
48477
|
|
|
48450
48478
|
// src/Main.ts
|
|
48451
48479
|
var cliProgram = run3(openAzdoCli, { version: version2 }).pipe(exports_Effect.scoped, exports_Effect.provide(BaseRuntimeLayer));
|
|
@@ -48454,4 +48482,4 @@ var main = () => runMain2(cliProgram, { disableErrorReporting: true });
|
|
|
48454
48482
|
// bin/open-azdo.ts
|
|
48455
48483
|
main();
|
|
48456
48484
|
|
|
48457
|
-
//# debugId=
|
|
48485
|
+
//# debugId=8152E5963DD16C2864756E2164756E21
|