@aryaminus/controlkeel-opencode 0.1.28 → 0.1.29
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.
|
@@ -11,3 +11,7 @@ Recommended flow:
|
|
|
11
11
|
4. Read the returned `review.id` and `browser_url`
|
|
12
12
|
5. Wait with `controlkeel review plan wait --id <review_id> --timeout 30 --json`
|
|
13
13
|
6. Do not execute until the review is approved
|
|
14
|
+
|
|
15
|
+
Fallback when the `submit_plan` tool is stale in a long-running OpenCode session:
|
|
16
|
+
- If the tool returns an error like `ControlKeel CLI [object Object] is too old`, run the CLI flow above directly.
|
|
17
|
+
- Restart OpenCode after plugin updates so `.opencode/plugins/controlkeel-governance.ts` is reloaded.
|
|
@@ -24,16 +24,42 @@ export const ControlKeelGovernance: Plugin = async ({ project, client, $, direct
|
|
|
24
24
|
return output
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
if (output instanceof Uint8Array) {
|
|
28
|
+
return new TextDecoder().decode(output)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (output instanceof ArrayBuffer) {
|
|
32
|
+
return new TextDecoder().decode(new Uint8Array(output))
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
if (output == null) {
|
|
28
36
|
return ""
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
if (typeof output === "object") {
|
|
40
|
+
if (typeof (output as { text?: unknown }).text === "function") {
|
|
41
|
+
try {
|
|
42
|
+
const direct = await (output as { text: () => Promise<string> }).text()
|
|
43
|
+
if (typeof direct === "string") {
|
|
44
|
+
return direct
|
|
45
|
+
}
|
|
46
|
+
} catch (_error) {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
32
50
|
const stdout = (output as { stdout?: unknown }).stdout
|
|
33
51
|
if (typeof stdout === "string") {
|
|
34
52
|
return stdout
|
|
35
53
|
}
|
|
36
54
|
|
|
55
|
+
if (stdout instanceof Uint8Array) {
|
|
56
|
+
return new TextDecoder().decode(stdout)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (stdout instanceof ArrayBuffer) {
|
|
60
|
+
return new TextDecoder().decode(new Uint8Array(stdout))
|
|
61
|
+
}
|
|
62
|
+
|
|
37
63
|
if (stdout && typeof (stdout as { text?: unknown }).text === "function") {
|
|
38
64
|
try {
|
|
39
65
|
const streamed = await (stdout as { text: () => Promise<string> }).text()
|
|
@@ -80,7 +106,15 @@ export const ControlKeelGovernance: Plugin = async ({ project, client, $, direct
|
|
|
80
106
|
let versionOutput = ""
|
|
81
107
|
|
|
82
108
|
try {
|
|
83
|
-
|
|
109
|
+
const versionProc = Bun.spawn(["controlkeel", "version"], {
|
|
110
|
+
stdout: "pipe",
|
|
111
|
+
stderr: "pipe",
|
|
112
|
+
})
|
|
113
|
+
versionOutput = await new Response(versionProc.stdout).text()
|
|
114
|
+
const versionExit = await versionProc.exited
|
|
115
|
+
if (versionExit !== 0) {
|
|
116
|
+
throw new Error(`controlkeel version exited with code ${versionExit}`)
|
|
117
|
+
}
|
|
84
118
|
} catch (error) {
|
|
85
119
|
throw new Error(
|
|
86
120
|
"Failed to run `controlkeel version`. Install ControlKeel >= 0.1.26 and ensure `controlkeel` is on PATH."
|
package/index.js
CHANGED
|
@@ -20,16 +20,42 @@ export const ControlKeelGovernance = async ({ $, directory }) => {
|
|
|
20
20
|
return output
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
if (output instanceof Uint8Array) {
|
|
24
|
+
return new TextDecoder().decode(output)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (output instanceof ArrayBuffer) {
|
|
28
|
+
return new TextDecoder().decode(new Uint8Array(output))
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
if (output == null) {
|
|
24
32
|
return ""
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
if (typeof output === "object") {
|
|
36
|
+
if (typeof output.text === "function") {
|
|
37
|
+
try {
|
|
38
|
+
const direct = await output.text()
|
|
39
|
+
if (typeof direct === "string") {
|
|
40
|
+
return direct
|
|
41
|
+
}
|
|
42
|
+
} catch (_error) {
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
28
46
|
const stdout = output.stdout
|
|
29
47
|
if (typeof stdout === "string") {
|
|
30
48
|
return stdout
|
|
31
49
|
}
|
|
32
50
|
|
|
51
|
+
if (stdout instanceof Uint8Array) {
|
|
52
|
+
return new TextDecoder().decode(stdout)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (stdout instanceof ArrayBuffer) {
|
|
56
|
+
return new TextDecoder().decode(new Uint8Array(stdout))
|
|
57
|
+
}
|
|
58
|
+
|
|
33
59
|
if (stdout && typeof stdout.text === "function") {
|
|
34
60
|
try {
|
|
35
61
|
const streamed = await stdout.text()
|
|
@@ -73,7 +99,15 @@ export const ControlKeelGovernance = async ({ $, directory }) => {
|
|
|
73
99
|
let versionOutput = ""
|
|
74
100
|
|
|
75
101
|
try {
|
|
76
|
-
|
|
102
|
+
const versionProc = Bun.spawn(["controlkeel", "version"], {
|
|
103
|
+
stdout: "pipe",
|
|
104
|
+
stderr: "pipe",
|
|
105
|
+
})
|
|
106
|
+
versionOutput = await new Response(versionProc.stdout).text()
|
|
107
|
+
const versionExit = await versionProc.exited
|
|
108
|
+
if (versionExit !== 0) {
|
|
109
|
+
throw new Error(`controlkeel version exited with code ${versionExit}`)
|
|
110
|
+
}
|
|
77
111
|
} catch (_error) {
|
|
78
112
|
throw new Error(
|
|
79
113
|
"Failed to run `controlkeel version`. Install ControlKeel >= 0.1.26 and ensure `controlkeel` is on PATH."
|
package/package.json
CHANGED