open-azdo 0.1.4 → 0.1.6
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/README.md
CHANGED
|
@@ -37,6 +37,7 @@ Common Azure Pipeline defaults:
|
|
|
37
37
|
|
|
38
38
|
Optional flags:
|
|
39
39
|
|
|
40
|
+
- `--opencode-variant <name>` provider-specific variant or reasoning level, for example `minimal`, `low`, `medium`, `high`, or `xhigh`
|
|
40
41
|
- `--opencode-timeout-ms <milliseconds>` default `300000`
|
|
41
42
|
- `--workspace <path>`
|
|
42
43
|
- `--organization <name>`
|
|
@@ -75,6 +76,10 @@ trigger: none
|
|
|
75
76
|
pool:
|
|
76
77
|
vmImage: ubuntu-latest
|
|
77
78
|
|
|
79
|
+
variables:
|
|
80
|
+
OpenCodeModel: openai/gpt-5.4
|
|
81
|
+
OpenCodeThinking: high
|
|
82
|
+
|
|
78
83
|
steps:
|
|
79
84
|
- checkout: self
|
|
80
85
|
clean: true
|
|
@@ -92,11 +97,13 @@ steps:
|
|
|
92
97
|
tar -xzf opencode.tar.gz -C opencode-bin
|
|
93
98
|
export PATH="$PWD/opencode-bin:$PATH"
|
|
94
99
|
|
|
95
|
-
bun x open-azdo review --model "$(OpenCodeModel)"
|
|
100
|
+
bun x open-azdo review --model "$(OpenCodeModel)" --opencode-variant "$(OpenCodeThinking)"
|
|
96
101
|
displayName: Review Pull Request
|
|
97
102
|
env:
|
|
98
103
|
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
|
99
104
|
OPENAI_API_KEY: $(OpenAIApiKey)
|
|
105
|
+
# Alternative to the CLI flag above:
|
|
106
|
+
# OPEN_AZDO_OPENCODE_VARIANT: $(OpenCodeThinking)
|
|
100
107
|
OPEN_AZDO_OPENCODE_TIMEOUT_MS: "300000"
|
|
101
108
|
```
|
|
102
109
|
|
package/dist/open-azdo.js
CHANGED
|
@@ -26790,6 +26790,7 @@ var ReviewConfigValue = Service("open-azdo/ReviewConfigValue");
|
|
|
26790
26790
|
var RawReviewConfigSchema = exports_Schema.Struct({
|
|
26791
26791
|
command: exports_Schema.Literal("review"),
|
|
26792
26792
|
model: NonEmptyString2,
|
|
26793
|
+
opencodeVariant: exports_Schema.optionalKey(NonEmptyString2),
|
|
26793
26794
|
opencodeTimeoutMs: PositiveInt,
|
|
26794
26795
|
workspace: NonEmptyString2,
|
|
26795
26796
|
organization: NonEmptyString2,
|
|
@@ -26822,6 +26823,7 @@ var loadReviewConfig = exports_Effect.fn("config.loadReviewConfig")(function* (a
|
|
|
26822
26823
|
try: () => exports_Schema.decodeUnknownSync(RawReviewConfigSchema)(compactOptionalKeys({
|
|
26823
26824
|
command: "review",
|
|
26824
26825
|
model: readStringFlag(parsedArgs.flags, "model") ?? env.OPEN_AZDO_MODEL,
|
|
26826
|
+
opencodeVariant: readStringFlag(parsedArgs.flags, "opencode-variant") ?? readOptionalEnvString(env.OPEN_AZDO_OPENCODE_VARIANT),
|
|
26825
26827
|
opencodeTimeoutMs: toPositiveInt(readStringFlag(parsedArgs.flags, "opencode-timeout-ms") ?? env.OPEN_AZDO_OPENCODE_TIMEOUT_MS ?? "300000"),
|
|
26826
26828
|
workspace: readStringFlag(parsedArgs.flags, "workspace") ?? env.OPEN_AZDO_WORKSPACE ?? env.BUILD_SOURCESDIRECTORY,
|
|
26827
26829
|
organization,
|
|
@@ -26904,6 +26906,7 @@ var parseArgs = (argv) => {
|
|
|
26904
26906
|
var toReviewConfig = (rawConfig) => ({
|
|
26905
26907
|
command: rawConfig.command,
|
|
26906
26908
|
model: rawConfig.model,
|
|
26909
|
+
opencodeVariant: rawConfig.opencodeVariant,
|
|
26907
26910
|
opencodeTimeoutMs: rawConfig.opencodeTimeoutMs,
|
|
26908
26911
|
workspace: rawConfig.workspace,
|
|
26909
26912
|
organization: rawConfig.organization,
|
|
@@ -26939,6 +26942,13 @@ var readStringFlag = (flags, key) => {
|
|
|
26939
26942
|
return typeof value3 === "string" ? value3 : undefined;
|
|
26940
26943
|
};
|
|
26941
26944
|
var readBooleanFlag = (flags, key) => flags[key] === true;
|
|
26945
|
+
var readOptionalEnvString = (value3) => {
|
|
26946
|
+
if (typeof value3 !== "string") {
|
|
26947
|
+
return;
|
|
26948
|
+
}
|
|
26949
|
+
const trimmed = value3.trim();
|
|
26950
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
26951
|
+
};
|
|
26942
26952
|
var toPositiveInt = (value3) => {
|
|
26943
26953
|
if (!value3) {
|
|
26944
26954
|
return Number.NaN;
|
|
@@ -28474,8 +28484,62 @@ var buildOpenCodeConfig = (agentName) => ({
|
|
|
28474
28484
|
}
|
|
28475
28485
|
}
|
|
28476
28486
|
});
|
|
28487
|
+
var buildOpenCodeArgs = (config, prompt) => [
|
|
28488
|
+
"run",
|
|
28489
|
+
"--format",
|
|
28490
|
+
"json",
|
|
28491
|
+
"--agent",
|
|
28492
|
+
config.agent,
|
|
28493
|
+
"--model",
|
|
28494
|
+
config.model,
|
|
28495
|
+
...config.opencodeVariant ? ["--variant", config.opencodeVariant] : [],
|
|
28496
|
+
prompt
|
|
28497
|
+
];
|
|
28477
28498
|
var extractFinalResponse = (output) => {
|
|
28478
28499
|
const texts = [];
|
|
28500
|
+
const structuredCandidates = [];
|
|
28501
|
+
const maybeCollectStructuredCandidate = (value3) => {
|
|
28502
|
+
if (!value3 || typeof value3 !== "object" || Array.isArray(value3)) {
|
|
28503
|
+
return;
|
|
28504
|
+
}
|
|
28505
|
+
if ("summary" in value3 && "verdict" in value3 && "findings" in value3) {
|
|
28506
|
+
structuredCandidates.push(JSON.stringify(value3));
|
|
28507
|
+
}
|
|
28508
|
+
};
|
|
28509
|
+
const collectTextCandidates = (value3) => {
|
|
28510
|
+
if (!value3) {
|
|
28511
|
+
return;
|
|
28512
|
+
}
|
|
28513
|
+
if (typeof value3 === "string") {
|
|
28514
|
+
const trimmed = value3.trim();
|
|
28515
|
+
if (!trimmed) {
|
|
28516
|
+
return;
|
|
28517
|
+
}
|
|
28518
|
+
texts.push(trimmed);
|
|
28519
|
+
try {
|
|
28520
|
+
maybeCollectStructuredCandidate(JSON.parse(trimmed));
|
|
28521
|
+
} catch {}
|
|
28522
|
+
return;
|
|
28523
|
+
}
|
|
28524
|
+
if (Array.isArray(value3)) {
|
|
28525
|
+
for (const entry of value3) {
|
|
28526
|
+
collectTextCandidates(entry);
|
|
28527
|
+
}
|
|
28528
|
+
return;
|
|
28529
|
+
}
|
|
28530
|
+
if (typeof value3 !== "object") {
|
|
28531
|
+
return;
|
|
28532
|
+
}
|
|
28533
|
+
maybeCollectStructuredCandidate(value3);
|
|
28534
|
+
if ("type" in value3 && value3.type === "text" && "text" in value3 && typeof value3.text === "string") {
|
|
28535
|
+
texts.push(value3.text.trim());
|
|
28536
|
+
}
|
|
28537
|
+
for (const [key, nested] of Object.entries(value3)) {
|
|
28538
|
+
if ((key === "text" || key === "content" || key === "message" || key === "part" || key === "parts" || key === "delta" || key === "textDelta" || key === "response" || key === "result" || key === "data" || key === "info") && nested !== undefined) {
|
|
28539
|
+
collectTextCandidates(nested);
|
|
28540
|
+
}
|
|
28541
|
+
}
|
|
28542
|
+
};
|
|
28479
28543
|
for (const line of output.split(`
|
|
28480
28544
|
`)) {
|
|
28481
28545
|
const trimmed = line.trim();
|
|
@@ -28488,23 +28552,15 @@ var extractFinalResponse = (output) => {
|
|
|
28488
28552
|
texts.push(event);
|
|
28489
28553
|
continue;
|
|
28490
28554
|
}
|
|
28491
|
-
|
|
28492
|
-
texts.push(event.text);
|
|
28493
|
-
}
|
|
28494
|
-
if (typeof event.content === "string") {
|
|
28495
|
-
texts.push(event.content);
|
|
28496
|
-
}
|
|
28497
|
-
if (Array.isArray(event.content)) {
|
|
28498
|
-
for (const part of event.content) {
|
|
28499
|
-
if (part && typeof part.text === "string") {
|
|
28500
|
-
texts.push(part.text);
|
|
28501
|
-
}
|
|
28502
|
-
}
|
|
28503
|
-
}
|
|
28555
|
+
collectTextCandidates(event);
|
|
28504
28556
|
} catch {
|
|
28505
28557
|
texts.push(trimmed);
|
|
28506
28558
|
}
|
|
28507
28559
|
}
|
|
28560
|
+
const structuredResponse = structuredCandidates.at(-1)?.trim();
|
|
28561
|
+
if (structuredResponse) {
|
|
28562
|
+
return structuredResponse;
|
|
28563
|
+
}
|
|
28508
28564
|
const response = texts.join(`
|
|
28509
28565
|
`).trim();
|
|
28510
28566
|
if (!response) {
|
|
@@ -28553,7 +28609,7 @@ class OpenCodeService extends Service()("open-azdo/OpenCodeService") {
|
|
|
28553
28609
|
const result3 = yield* runner.execute({
|
|
28554
28610
|
operation: "OpenCodeService.run",
|
|
28555
28611
|
command: "opencode",
|
|
28556
|
-
args:
|
|
28612
|
+
args: buildOpenCodeArgs(config, prompt),
|
|
28557
28613
|
cwd: config.workspace,
|
|
28558
28614
|
timeoutMs: config.opencodeTimeoutMs,
|
|
28559
28615
|
env: {
|
|
@@ -28589,7 +28645,11 @@ class OpenCodeService extends Service()("open-azdo/OpenCodeService") {
|
|
|
28589
28645
|
message: "OpenCode did not return a valid final response.",
|
|
28590
28646
|
output: String(error)
|
|
28591
28647
|
})
|
|
28592
|
-
})
|
|
28648
|
+
}).pipe(exports_Effect.tapError((error) => logError2("Failed to extract final OpenCode response.", {
|
|
28649
|
+
stdoutPreview: truncateForLog(result3.stdout),
|
|
28650
|
+
stderrPreview: truncateForLog(result3.stderr),
|
|
28651
|
+
detail: error.message
|
|
28652
|
+
})));
|
|
28593
28653
|
yield* logInfo2("Extracted final OpenCode response.", {
|
|
28594
28654
|
responseChars: response.length,
|
|
28595
28655
|
responsePreview: truncateForLog(response)
|
|
@@ -28672,6 +28732,7 @@ var writeStdout = exports_Effect.fn("cli.writeStdout")(function* (text) {
|
|
|
28672
28732
|
var reviewLogFields = (config) => ({
|
|
28673
28733
|
command: config.command,
|
|
28674
28734
|
model: config.model,
|
|
28735
|
+
opencodeVariant: config.opencodeVariant,
|
|
28675
28736
|
opencodeTimeoutMs: config.opencodeTimeoutMs,
|
|
28676
28737
|
workspace: config.workspace,
|
|
28677
28738
|
organization: config.organization,
|
|
@@ -29940,4 +30001,4 @@ var main = async (argv, env) => await exports_Effect.runPromise(runCliWithExitHa
|
|
|
29940
30001
|
// bin/open-azdo.ts
|
|
29941
30002
|
process.exitCode = await main(process.argv.slice(2), process.env);
|
|
29942
30003
|
|
|
29943
|
-
//# debugId=
|
|
30004
|
+
//# debugId=D1E0CFCA8A85885F64756E2164756E21
|