@encoredigitalgroup/opencode 0.2.10 → 0.2.11
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 +3 -0
- package/dist/lib/PlanningConfigRpc.d.ts +30 -0
- package/dist/server/index.js +79 -24
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.js +65 -8
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -90,3 +90,6 @@ bun install
|
|
|
90
90
|
bun run check
|
|
91
91
|
bun run pack:check
|
|
92
92
|
```
|
|
93
|
+
|
|
94
|
+
Run `bun run local:install` to build the plugin and switch the local OpenCode configuration to this checkout. Run `bun run local:uninstall` to restore
|
|
95
|
+
`@encoredigitalgroup/opencode@latest`. Both commands preserve the plugin's configured options.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Rpc } from "@opencode/plugin";
|
|
2
|
+
import type { SkillMappings } from "../config";
|
|
3
|
+
export declare const planningConfigRpcID = "encoredigitalgroup.opencode-planning";
|
|
4
|
+
export type PlanningConfigRpcOutput = {
|
|
5
|
+
planDirectory: string;
|
|
6
|
+
skillMappings: SkillMappings;
|
|
7
|
+
};
|
|
8
|
+
type StandardValueSchema = Extract<Rpc.PortableValueSchema, {
|
|
9
|
+
"~standard": unknown;
|
|
10
|
+
}>;
|
|
11
|
+
type Typed<T> = {
|
|
12
|
+
"~standard": {
|
|
13
|
+
types?: {
|
|
14
|
+
input: T;
|
|
15
|
+
output: T;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type PlanningConfigRpcSchema<T> = StandardValueSchema & Typed<T>;
|
|
20
|
+
export declare const PlanningConfigRpc: {
|
|
21
|
+
id: string;
|
|
22
|
+
events: {};
|
|
23
|
+
methods: {
|
|
24
|
+
get: {
|
|
25
|
+
input: PlanningConfigRpcSchema<Record<string, never>>;
|
|
26
|
+
output: PlanningConfigRpcSchema<PlanningConfigRpcOutput>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {};
|
package/dist/server/index.js
CHANGED
|
@@ -156,6 +156,44 @@ class ConfigLoader {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
+
// src/lib/PlanningConfigRpc.ts
|
|
160
|
+
var planningConfigRpcID = "encoredigitalgroup.opencode-planning";
|
|
161
|
+
function schema(check) {
|
|
162
|
+
return {
|
|
163
|
+
"~standard": {
|
|
164
|
+
version: 1,
|
|
165
|
+
vendor: "@encoredigitalgroup/opencode",
|
|
166
|
+
validate: (value) => {
|
|
167
|
+
const issue = check(value);
|
|
168
|
+
return issue === null ? { value } : { issues: [{ message: issue }] };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function checkEmptyObject(value) {
|
|
174
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length === 0 ? null : "input must be an empty object";
|
|
175
|
+
}
|
|
176
|
+
function checkConfigOutput(value) {
|
|
177
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
178
|
+
return "output must be an object";
|
|
179
|
+
}
|
|
180
|
+
const config = value;
|
|
181
|
+
if (typeof config.planDirectory !== "string") {
|
|
182
|
+
return "output planDirectory must be a string";
|
|
183
|
+
}
|
|
184
|
+
return typeof config.skillMappings === "object" && config.skillMappings !== null && !Array.isArray(config.skillMappings) ? null : "output skillMappings must be an object";
|
|
185
|
+
}
|
|
186
|
+
var PlanningConfigRpc = {
|
|
187
|
+
id: planningConfigRpcID,
|
|
188
|
+
events: {},
|
|
189
|
+
methods: {
|
|
190
|
+
get: {
|
|
191
|
+
input: schema(checkEmptyObject),
|
|
192
|
+
output: schema(checkConfigOutput)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
159
197
|
// src/lib/SkillCommands.ts
|
|
160
198
|
class SkillCommands {
|
|
161
199
|
static getCommands(config) {
|
|
@@ -8420,7 +8458,7 @@ function findGitWorktreeRoot(startDir) {
|
|
|
8420
8458
|
|
|
8421
8459
|
// src/lib/Quota/rpc.ts
|
|
8422
8460
|
var QUOTA_RPC_ID = "slkiser.opencode-quota";
|
|
8423
|
-
function
|
|
8461
|
+
function schema2(check) {
|
|
8424
8462
|
return {
|
|
8425
8463
|
"~standard": {
|
|
8426
8464
|
version: 1,
|
|
@@ -8433,7 +8471,7 @@ function schema(check) {
|
|
|
8433
8471
|
};
|
|
8434
8472
|
}
|
|
8435
8473
|
function eventSchema(check) {
|
|
8436
|
-
return
|
|
8474
|
+
return schema2(check);
|
|
8437
8475
|
}
|
|
8438
8476
|
function checkSessionInput(value) {
|
|
8439
8477
|
if (!isRecord2(value))
|
|
@@ -8457,12 +8495,12 @@ var QuotaRpc = {
|
|
|
8457
8495
|
},
|
|
8458
8496
|
methods: {
|
|
8459
8497
|
snapshot: {
|
|
8460
|
-
input:
|
|
8461
|
-
output:
|
|
8498
|
+
input: schema2(checkSessionInput),
|
|
8499
|
+
output: schema2(checkSnapshotOutput)
|
|
8462
8500
|
},
|
|
8463
8501
|
refresh: {
|
|
8464
|
-
input:
|
|
8465
|
-
output:
|
|
8502
|
+
input: schema2(checkRefreshInput),
|
|
8503
|
+
output: schema2(checkSnapshotOutput)
|
|
8466
8504
|
}
|
|
8467
8505
|
}
|
|
8468
8506
|
};
|
|
@@ -9524,30 +9562,43 @@ var server_default = Plugin2.define({
|
|
|
9524
9562
|
const command = "feature-planning";
|
|
9525
9563
|
const route = SkillCommands.getCommands(pluginConfig)[command];
|
|
9526
9564
|
try {
|
|
9527
|
-
const
|
|
9528
|
-
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9565
|
+
const configRegistration = await ctx.rpc.register(PlanningConfigRpc, {
|
|
9566
|
+
get: async () => ({
|
|
9567
|
+
planDirectory: pluginConfig.planDirectory,
|
|
9568
|
+
skillMappings: pluginConfig.skillMappings
|
|
9569
|
+
})
|
|
9570
|
+
});
|
|
9571
|
+
let commandRegistration;
|
|
9572
|
+
try {
|
|
9573
|
+
commandRegistration = await ctx.command.transform((commands) => {
|
|
9574
|
+
commands.add({
|
|
9575
|
+
name: command,
|
|
9576
|
+
description: route.description,
|
|
9577
|
+
execute: async (input) => {
|
|
9578
|
+
const skills = await ctx.skill.list();
|
|
9579
|
+
const skill = skills.data.find((candidate) => candidate.name === route.skill);
|
|
9580
|
+
if (skill === undefined) {
|
|
9581
|
+
throw new Error(`OpenCode skill "${route.skill}" is not available for /${command}.`);
|
|
9582
|
+
}
|
|
9583
|
+
await ctx.session.prompt({
|
|
9584
|
+
sessionID: input.sessionID,
|
|
9585
|
+
...input.prompt,
|
|
9586
|
+
skills: [...input.prompt.skills ?? [], { id: skill.id }],
|
|
9587
|
+
delivery: input.delivery
|
|
9588
|
+
});
|
|
9536
9589
|
}
|
|
9537
|
-
|
|
9538
|
-
sessionID: input.sessionID,
|
|
9539
|
-
...input.prompt,
|
|
9540
|
-
skills: [...input.prompt.skills ?? [], { id: skill.id }],
|
|
9541
|
-
delivery: input.delivery
|
|
9542
|
-
});
|
|
9543
|
-
}
|
|
9590
|
+
});
|
|
9544
9591
|
});
|
|
9545
|
-
})
|
|
9592
|
+
} catch (error) {
|
|
9593
|
+
await configRegistration.dispose();
|
|
9594
|
+
throw error;
|
|
9595
|
+
}
|
|
9546
9596
|
let toolRegistration;
|
|
9547
9597
|
try {
|
|
9548
9598
|
toolRegistration = await TodoTracker.register(ctx, pluginConfig);
|
|
9549
9599
|
} catch (error) {
|
|
9550
9600
|
await commandRegistration.dispose();
|
|
9601
|
+
await configRegistration.dispose();
|
|
9551
9602
|
throw error;
|
|
9552
9603
|
}
|
|
9553
9604
|
return async () => {
|
|
@@ -9558,7 +9609,11 @@ var server_default = Plugin2.define({
|
|
|
9558
9609
|
await commandRegistration.dispose();
|
|
9559
9610
|
}
|
|
9560
9611
|
} finally {
|
|
9561
|
-
|
|
9612
|
+
try {
|
|
9613
|
+
await configRegistration.dispose();
|
|
9614
|
+
} finally {
|
|
9615
|
+
await quotaCleanup?.();
|
|
9616
|
+
}
|
|
9562
9617
|
}
|
|
9563
9618
|
};
|
|
9564
9619
|
} catch (error) {
|
package/dist/tui/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "@opencode/plugin/tui";
|
|
2
|
+
import { ConfigLoader } from "../config";
|
|
3
|
+
export declare function loadPickerConfig(context: Plugin.Context): Promise<ReturnType<typeof ConfigLoader.loadConfig>>;
|
|
2
4
|
declare const _default: Plugin.Definition;
|
|
3
5
|
export default _default;
|
package/dist/tui/index.js
CHANGED
|
@@ -987,6 +987,44 @@ class FilePickerCommands {
|
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
+
// src/lib/PlanningConfigRpc.ts
|
|
991
|
+
var planningConfigRpcID = "encoredigitalgroup.opencode-planning";
|
|
992
|
+
function schema(check) {
|
|
993
|
+
return {
|
|
994
|
+
"~standard": {
|
|
995
|
+
version: 1,
|
|
996
|
+
vendor: "@encoredigitalgroup/opencode",
|
|
997
|
+
validate: (value) => {
|
|
998
|
+
const issue = check(value);
|
|
999
|
+
return issue === null ? { value } : { issues: [{ message: issue }] };
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
function checkEmptyObject(value) {
|
|
1005
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length === 0 ? null : "input must be an empty object";
|
|
1006
|
+
}
|
|
1007
|
+
function checkConfigOutput(value) {
|
|
1008
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
1009
|
+
return "output must be an object";
|
|
1010
|
+
}
|
|
1011
|
+
const config = value;
|
|
1012
|
+
if (typeof config.planDirectory !== "string") {
|
|
1013
|
+
return "output planDirectory must be a string";
|
|
1014
|
+
}
|
|
1015
|
+
return typeof config.skillMappings === "object" && config.skillMappings !== null && !Array.isArray(config.skillMappings) ? null : "output skillMappings must be an object";
|
|
1016
|
+
}
|
|
1017
|
+
var PlanningConfigRpc = {
|
|
1018
|
+
id: planningConfigRpcID,
|
|
1019
|
+
events: {},
|
|
1020
|
+
methods: {
|
|
1021
|
+
get: {
|
|
1022
|
+
input: schema(checkEmptyObject),
|
|
1023
|
+
output: schema(checkConfigOutput)
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
|
|
990
1028
|
// src/lib/Quota/tui/index.tsx
|
|
991
1029
|
import { Plugin } from "@opencode/plugin/tui";
|
|
992
1030
|
|
|
@@ -1009,7 +1047,7 @@ function finiteNumber(value) {
|
|
|
1009
1047
|
|
|
1010
1048
|
// src/lib/Quota/rpc.ts
|
|
1011
1049
|
var QUOTA_RPC_ID = "slkiser.opencode-quota";
|
|
1012
|
-
function
|
|
1050
|
+
function schema2(check) {
|
|
1013
1051
|
return {
|
|
1014
1052
|
"~standard": {
|
|
1015
1053
|
version: 1,
|
|
@@ -1022,7 +1060,7 @@ function schema(check) {
|
|
|
1022
1060
|
};
|
|
1023
1061
|
}
|
|
1024
1062
|
function eventSchema(check) {
|
|
1025
|
-
return
|
|
1063
|
+
return schema2(check);
|
|
1026
1064
|
}
|
|
1027
1065
|
function checkSessionInput(value) {
|
|
1028
1066
|
if (!isRecord(value))
|
|
@@ -1046,12 +1084,12 @@ var QuotaRpc = {
|
|
|
1046
1084
|
},
|
|
1047
1085
|
methods: {
|
|
1048
1086
|
snapshot: {
|
|
1049
|
-
input:
|
|
1050
|
-
output:
|
|
1087
|
+
input: schema2(checkSessionInput),
|
|
1088
|
+
output: schema2(checkSnapshotOutput)
|
|
1051
1089
|
},
|
|
1052
1090
|
refresh: {
|
|
1053
|
-
input:
|
|
1054
|
-
output:
|
|
1091
|
+
input: schema2(checkRefreshInput),
|
|
1092
|
+
output: schema2(checkSnapshotOutput)
|
|
1055
1093
|
}
|
|
1056
1094
|
}
|
|
1057
1095
|
};
|
|
@@ -6953,6 +6991,23 @@ function PickerCommandLayer(props) {
|
|
|
6953
6991
|
FilePickerCommands.register(props.context, props.config);
|
|
6954
6992
|
return /* @__PURE__ */ jsx3(Fragment, {});
|
|
6955
6993
|
}
|
|
6994
|
+
async function loadPickerConfig(context) {
|
|
6995
|
+
const fallback = ConfigLoader.loadConfig(context.options);
|
|
6996
|
+
try {
|
|
6997
|
+
const location = context.location ?? context.data.location.default();
|
|
6998
|
+
const config = await context.client.rpc(PlanningConfigRpc).get({}, {
|
|
6999
|
+
location: { directory: location.directory },
|
|
7000
|
+
signal: AbortSignal.timeout(5000)
|
|
7001
|
+
});
|
|
7002
|
+
return {
|
|
7003
|
+
...fallback,
|
|
7004
|
+
planDirectory: config.planDirectory,
|
|
7005
|
+
skillMappings: config.skillMappings
|
|
7006
|
+
};
|
|
7007
|
+
} catch {
|
|
7008
|
+
return fallback;
|
|
7009
|
+
}
|
|
7010
|
+
}
|
|
6956
7011
|
function TodoSidebar(props) {
|
|
6957
7012
|
const todos = () => TodoTracker.sidebar(props.context.data.session.message.list(props.sessionID), props.context.data.session.status(props.sessionID) === "idle");
|
|
6958
7013
|
const color = (status) => status === "in_progress" ? props.context.theme.text.feedback.warning.base : props.context.theme.text.muted;
|
|
@@ -7006,11 +7061,12 @@ var tui_default2 = Plugin2.define({
|
|
|
7006
7061
|
id: "@encoredigitalgroup/opencode",
|
|
7007
7062
|
async setup(ctx) {
|
|
7008
7063
|
const quotaCleanup = ctx.storage === undefined ? undefined : await tui_default.setup(ctx);
|
|
7064
|
+
const pickerConfig = await loadPickerConfig(ctx);
|
|
7009
7065
|
const appSlot = ctx.ui.slot({
|
|
7010
7066
|
append: "app",
|
|
7011
7067
|
render: () => /* @__PURE__ */ jsx3(PickerCommandLayer, {
|
|
7012
7068
|
context: ctx,
|
|
7013
|
-
config:
|
|
7069
|
+
config: pickerConfig
|
|
7014
7070
|
})
|
|
7015
7071
|
});
|
|
7016
7072
|
let sidebarSlot;
|
|
@@ -7041,5 +7097,6 @@ var tui_default2 = Plugin2.define({
|
|
|
7041
7097
|
}
|
|
7042
7098
|
});
|
|
7043
7099
|
export {
|
|
7044
|
-
tui_default2 as default
|
|
7100
|
+
tui_default2 as default,
|
|
7101
|
+
loadPickerConfig
|
|
7045
7102
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@encoredigitalgroup/opencode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.11",
|
|
5
5
|
"description": "OpenCode planning pickers, a todo tracker, and a quota sidebar.",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rm -rf dist && bun build src/server/index.ts src/tui/index.tsx --outdir dist --target bun --external '@opencode/plugin' --external '@opencode/plugin/*' --external '@opentui/core' --external '@opentui/core/*' --external '@opentui/solid' --external '@opentui/solid/*' && tsc --emitDeclarationOnly",
|
|
36
36
|
"check": "bun run typecheck && bun run build",
|
|
37
|
+
"local:install": "bun run build && bun tools/local-plugin.ts install",
|
|
38
|
+
"local:uninstall": "bun tools/local-plugin.ts uninstall",
|
|
37
39
|
"pack:check": "bun pm pack --dry-run",
|
|
38
40
|
"test": "bun test",
|
|
39
41
|
"typecheck": "tsc --noEmit"
|