@osovv/vv-opencode 0.14.0 → 0.17.0
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 +110 -10
- package/dist/cli.js +5 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/agent.js +37 -72
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/completion.js +32 -16
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/preset.d.ts +45 -0
- package/dist/commands/preset.js +214 -0
- package/dist/commands/preset.js.map +1 -0
- package/dist/commands/upgrade.d.ts +21 -1
- package/dist/commands/upgrade.js +205 -51
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/lib/agent-models.d.ts +21 -0
- package/dist/lib/agent-models.js +106 -0
- package/dist/lib/agent-models.js.map +1 -0
- package/dist/lib/opencode.d.ts +6 -0
- package/dist/lib/opencode.js +73 -23
- package/dist/lib/opencode.js.map +1 -1
- package/dist/lib/vvoc-config.d.ts +169 -124
- package/dist/lib/vvoc-config.js +303 -101
- package/dist/lib/vvoc-config.js.map +1 -1
- package/package.json +1 -1
- package/schemas/vvoc/v1.json +1 -1
- package/schemas/vvoc/v2.json +124 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Portable OpenCode workflow package with plugins and a Bun CLI for setup, sync, d
|
|
|
4
4
|
|
|
5
5
|
## What You Get
|
|
6
6
|
|
|
7
|
-
- `vvoc` CLI for bootstrap, sync, inspection, and
|
|
7
|
+
- `vvoc` CLI for bootstrap, sync, inspection, model overrides, and named presets
|
|
8
8
|
- `GuardianPlugin` for permission review
|
|
9
9
|
- `MemoryPlugin` for explicit persistent memory
|
|
10
10
|
- `SystemContextInjectionPlugin` for reusable primary-session system guidance
|
|
@@ -47,6 +47,7 @@ vvoc install --scope project
|
|
|
47
47
|
- registers vvoc-managed OpenCode agents, including the primary `enhancer` agent
|
|
48
48
|
- creates managed prompt files under `vvoc/agents/` when missing
|
|
49
49
|
- creates and fully seeds the canonical `vvoc.json` file at `$XDG_CONFIG_HOME/vvoc/vvoc.json`
|
|
50
|
+
- seeds default `openai` and `zai` agent-model presets inside canonical `vvoc.json`
|
|
50
51
|
- keeps vvoc-managed config in one canonical file separate from native OpenCode config
|
|
51
52
|
- leaves unmanaged files alone unless `--force` is passed
|
|
52
53
|
|
|
@@ -124,7 +125,7 @@ vvoc config validate
|
|
|
124
125
|
- `doctor` reports parse problems and missing required setup
|
|
125
126
|
- `config validate` validates `$XDG_CONFIG_HOME/vvoc/vvoc.json` against the versioned vvoc JSON Schema
|
|
126
127
|
|
|
127
|
-
### Manage
|
|
128
|
+
### Manage Model Targets
|
|
128
129
|
|
|
129
130
|
List configured model overrides:
|
|
130
131
|
|
|
@@ -135,6 +136,8 @@ vvoc agent list
|
|
|
135
136
|
Set model overrides:
|
|
136
137
|
|
|
137
138
|
```bash
|
|
139
|
+
vvoc agent set default openai/gpt-5
|
|
140
|
+
vvoc agent set small-model openai/gpt-5-mini
|
|
138
141
|
vvoc agent set general openai/gpt-5-nano
|
|
139
142
|
vvoc agent set explore openai/gpt-5-nano
|
|
140
143
|
vvoc agent set enhancer openai/gpt-5
|
|
@@ -147,13 +150,17 @@ vvoc agent set memory-reviewer openai/gpt-5:high
|
|
|
147
150
|
Remove overrides:
|
|
148
151
|
|
|
149
152
|
```bash
|
|
153
|
+
vvoc agent unset default
|
|
154
|
+
vvoc agent unset small-model
|
|
150
155
|
vvoc agent unset spec-reviewer
|
|
151
156
|
vvoc agent unset guardian
|
|
152
157
|
vvoc agent unset memory-reviewer
|
|
153
158
|
```
|
|
154
159
|
|
|
155
|
-
Supported
|
|
160
|
+
Supported model target IDs:
|
|
156
161
|
|
|
162
|
+
- `default`
|
|
163
|
+
- `small-model`
|
|
157
164
|
- `guardian`
|
|
158
165
|
- `memory-reviewer`
|
|
159
166
|
- `general`
|
|
@@ -164,7 +171,92 @@ Supported agent IDs:
|
|
|
164
171
|
- `code-reviewer`
|
|
165
172
|
- `investitagor`
|
|
166
173
|
|
|
167
|
-
`
|
|
174
|
+
`default` writes OpenCode `model`, and `small-model` writes OpenCode `small_model`.
|
|
175
|
+
|
|
176
|
+
`guardian` and `memory-reviewer` accept `provider/model[:variant]` syntax. The other targets use `provider/model`.
|
|
177
|
+
|
|
178
|
+
### Switch Named Presets
|
|
179
|
+
|
|
180
|
+
List the presets stored in canonical `vvoc.json`:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
vvoc preset list
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Show a preset definition:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
vvoc preset show openai
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Apply a preset in one command:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
vvoc preset openai
|
|
196
|
+
vvoc preset zai --scope project
|
|
197
|
+
vvoc preset minimax
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Preset rules in v1:
|
|
201
|
+
|
|
202
|
+
- presets live only in canonical `vvoc.json`
|
|
203
|
+
- presets manage only model-target overrides in v1
|
|
204
|
+
- presets may be partial
|
|
205
|
+
- `vvoc preset <name>` only changes the targets listed in that preset
|
|
206
|
+
- targets not listed in the selected preset are left untouched
|
|
207
|
+
- `--scope` behaves like `vvoc agent set`: it changes the OpenCode target for OpenCode-managed targets, while canonical `vvoc.json` stays global
|
|
208
|
+
|
|
209
|
+
This replaces the common workflow of running many `vvoc agent set ...` commands when you want to switch a known group of model targets together.
|
|
210
|
+
|
|
211
|
+
The canonical config ships with starter `openai`, `zai`, and `minimax` presets and uses this format:
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"presets": {
|
|
216
|
+
"openai": {
|
|
217
|
+
"description": "Starter OpenAI overrides for common vvoc model targets.",
|
|
218
|
+
"agents": {
|
|
219
|
+
"default": "openai/gpt-5.4:xhigh",
|
|
220
|
+
"small-model": "openai/gpt-5.4-mini",
|
|
221
|
+
"guardian": "openaig/gpt-5.4-mini",
|
|
222
|
+
"explore": "openai/gpt-5.4-mini"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"zai": {
|
|
226
|
+
"description": "Starter ZAI overrides for common vvoc model targets.",
|
|
227
|
+
"agents": {
|
|
228
|
+
"default": "zai-coding-plan/glm-5.1",
|
|
229
|
+
"small-model": "zai-coding-plan/glm-4.7-flashx",
|
|
230
|
+
"guardian": "zai-coding-plan/glm-4.7-flash-x",
|
|
231
|
+
"explore": "zai-coding-plan/glm-4.7-flashx"
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"minimax": {
|
|
235
|
+
"description": "Starter MiniMax overrides for common vvoc model targets.",
|
|
236
|
+
"agents": {
|
|
237
|
+
"default": "minimax-coding-plan/minimax-m2.7",
|
|
238
|
+
"small-model": "minimax-coding-plan/minimax-m2.1",
|
|
239
|
+
"guardian": "minimax-coding-plan/minimax-m2.1",
|
|
240
|
+
"explore": "minimax-coding-plan/minimax-m2.1"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Preset `agents` support the same target IDs as `vvoc agent set`:
|
|
248
|
+
|
|
249
|
+
- `default`
|
|
250
|
+
- `small-model`
|
|
251
|
+
- `guardian`
|
|
252
|
+
- `memory-reviewer`
|
|
253
|
+
- `general`
|
|
254
|
+
- `explore`
|
|
255
|
+
- `enhancer`
|
|
256
|
+
- `implementer`
|
|
257
|
+
- `spec-reviewer`
|
|
258
|
+
- `code-reviewer`
|
|
259
|
+
- `investitagor`
|
|
168
260
|
|
|
169
261
|
### Plugin Inspection, Provider Presets, And Shell Completion
|
|
170
262
|
|
|
@@ -186,6 +278,9 @@ vvoc upgrade
|
|
|
186
278
|
vvoc version
|
|
187
279
|
```
|
|
188
280
|
|
|
281
|
+
- `vvoc upgrade` checks npm for a newer `@osovv/vv-opencode`, runs `bun add -g @osovv/vv-opencode@<latest>` when one exists, and then runs the default global `vvoc sync` flow.
|
|
282
|
+
- If the package upgrade succeeds but the follow-up sync cannot run, rerun `vvoc sync` manually.
|
|
283
|
+
|
|
189
284
|
## Command Reference
|
|
190
285
|
|
|
191
286
|
| Command | Purpose |
|
|
@@ -195,13 +290,14 @@ vvoc version
|
|
|
195
290
|
| `vvoc sync` | Refresh managed config and prompt files |
|
|
196
291
|
| `vvoc status` | Show current installation state |
|
|
197
292
|
| `vvoc doctor` | Diagnose setup problems |
|
|
198
|
-
| `vvoc agent list/set/unset` | Manage model overrides |
|
|
293
|
+
| `vvoc agent list/set/unset` | Manage model targets and overrides |
|
|
294
|
+
| `vvoc preset <name>/list/show <name>` | Switch or inspect declarative named presets |
|
|
199
295
|
| `vvoc guardian config` | Print or write the `guardian` section of `vvoc.json` |
|
|
200
296
|
| `vvoc config validate` | Validate canonical `vvoc.json` |
|
|
201
297
|
| `vvoc plugin list` | List OpenCode plugins from config |
|
|
202
298
|
| `vvoc path-provider stepfun-ai` | Patch a global provider endpoint preset |
|
|
203
299
|
| `vvoc completion` | Install shell completions |
|
|
204
|
-
| `vvoc upgrade` | Check npm
|
|
300
|
+
| `vvoc upgrade` | Check npm, globally install the latest package with Bun, then run `vvoc sync` |
|
|
205
301
|
| `vvoc version` | Print the installed `vvoc` version |
|
|
206
302
|
|
|
207
303
|
## Config And Data Layout
|
|
@@ -215,6 +311,8 @@ vvoc-managed config stays separate from OpenCode config and now has one canonica
|
|
|
215
311
|
|
|
216
312
|
- canonical config: `$XDG_CONFIG_HOME/vvoc/vvoc.json` or `~/.config/vvoc/vvoc.json`
|
|
217
313
|
|
|
314
|
+
That canonical config contains the `guardian`, `memory`, `secretsRedaction`, and `presets` sections.
|
|
315
|
+
|
|
218
316
|
Project scope still uses `./.vvoc/agents/` for managed prompt files, but vvoc's own settings always live in the canonical global config file.
|
|
219
317
|
|
|
220
318
|
Persisted vvoc data lives under the XDG data root:
|
|
@@ -240,17 +338,19 @@ Scope rules:
|
|
|
240
338
|
|
|
241
339
|
```json
|
|
242
340
|
{
|
|
243
|
-
"$schema": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@<installed-version>/schemas/vvoc/
|
|
244
|
-
"version":
|
|
341
|
+
"$schema": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@<installed-version>/schemas/vvoc/v2.json",
|
|
342
|
+
"version": 2
|
|
245
343
|
}
|
|
246
344
|
```
|
|
247
345
|
|
|
248
346
|
Schema source of truth and hosting strategy:
|
|
249
347
|
|
|
250
|
-
- the schema is checked into this repository at `schemas/vvoc/
|
|
348
|
+
- the current schema is checked into this repository at `schemas/vvoc/v2.json`
|
|
349
|
+
- the legacy schema remains checked in at `schemas/vvoc/v1.json`
|
|
251
350
|
- the package publishes that file to npm by shipping the `schemas/` directory
|
|
252
|
-
- the canonical hosted schema URL is version-pinned: `https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@<installed-version>/schemas/vvoc/
|
|
351
|
+
- the canonical hosted schema URL is version-pinned: `https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@<installed-version>/schemas/vvoc/v2.json`
|
|
253
352
|
- `v1.json` is immutable once published; breaking schema changes must ship as `v2.json` instead of rewriting `v1.json`
|
|
353
|
+
- existing `version: 1` configs still load during the migration window, and `vvoc install` or `vvoc sync` rewrites them to canonical `version: 2`
|
|
254
354
|
|
|
255
355
|
## Plugins Included
|
|
256
356
|
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// FILE: src/cli.ts
|
|
3
|
-
// VERSION: 0.2.
|
|
3
|
+
// VERSION: 0.2.7
|
|
4
4
|
// START_MODULE_CONTRACT
|
|
5
5
|
// PURPOSE: Assemble and run the vvoc CLI entrypoint.
|
|
6
6
|
// SCOPE: Package version lookup, top-level command registration, and main command execution.
|
|
7
|
-
// DEPENDS: [citty, src/commands/install.ts, src/commands/sync.ts, src/commands/status.ts, src/commands/doctor.ts, src/commands/guardian.ts, src/commands/path-provider.ts, src/commands/version.ts, src/lib/package.ts]
|
|
7
|
+
// DEPENDS: [citty, src/commands/install.ts, src/commands/preset.ts, src/commands/sync.ts, src/commands/status.ts, src/commands/doctor.ts, src/commands/guardian.ts, src/commands/path-provider.ts, src/commands/version.ts, src/lib/package.ts]
|
|
8
8
|
// LINKS: [M-CLI-COMMANDS]
|
|
9
9
|
// ROLE: SCRIPT
|
|
10
10
|
// MAP_MODE: LOCALS
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// END_MODULE_MAP
|
|
17
17
|
//
|
|
18
18
|
// START_CHANGE_SUMMARY
|
|
19
|
-
// LAST_CHANGE: [v0.2.
|
|
19
|
+
// LAST_CHANGE: [v0.2.7 - Added the top-level preset command for declarative multi-agent model switching.]
|
|
20
20
|
// END_CHANGE_SUMMARY
|
|
21
21
|
import { defineCommand, runMain } from "citty";
|
|
22
22
|
import agent from "./commands/agent.js";
|
|
@@ -27,6 +27,7 @@ import guardian from "./commands/guardian.js";
|
|
|
27
27
|
import init from "./commands/init.js";
|
|
28
28
|
import install from "./commands/install.js";
|
|
29
29
|
import pathProvider from "./commands/path-provider.js";
|
|
30
|
+
import preset from "./commands/preset.js";
|
|
30
31
|
import plugin from "./commands/plugin.js";
|
|
31
32
|
import status from "./commands/status.js";
|
|
32
33
|
import sync from "./commands/sync.js";
|
|
@@ -50,6 +51,7 @@ const main = defineCommand({
|
|
|
50
51
|
init,
|
|
51
52
|
install,
|
|
52
53
|
"path-provider": pathProvider,
|
|
54
|
+
preset,
|
|
53
55
|
plugin,
|
|
54
56
|
status,
|
|
55
57
|
sync,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,mBAAmB;AACnB,iBAAiB;AACjB,wBAAwB;AACxB,uDAAuD;AACvD,+FAA+F;AAC/F,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli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,IAAI;QACJ,OAAO;QACP,eAAe,EAAE,YAAY;QAC7B,MAAM;QACN,MAAM;QACN,MAAM;QACN,IAAI;QACJ,OAAO;QACP,OAAO;KACR;CACF,CAAC,CAAC;AACH,+BAA+B;AAE/B,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/commands/agent.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// FILE: src/commands/agent.ts
|
|
2
|
-
// VERSION: 0.
|
|
2
|
+
// VERSION: 0.8.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE: Manage model overrides for vvoc-owned
|
|
5
|
-
// SCOPE: Guardian and memory-reviewer section writes within vvoc.json plus built-in and
|
|
6
|
-
// DEPENDS: [citty, src/lib/managed-agents.ts, src/lib/opencode.ts, src/lib/vvoc-config.ts]
|
|
4
|
+
// PURPOSE: Manage model overrides for vvoc-owned agents plus selected OpenCode model targets.
|
|
5
|
+
// SCOPE: Guardian and memory-reviewer section writes within vvoc.json plus built-in, managed, and top-level OpenCode model set/unset/list operations via the vvoc agent command tree.
|
|
6
|
+
// DEPENDS: [citty, src/lib/agent-models.ts, src/lib/managed-agents.ts, src/lib/opencode.ts, src/lib/vvoc-config.ts]
|
|
7
7
|
// LINKS: [M-CLI-COMMANDS]
|
|
8
8
|
// ROLE: RUNTIME
|
|
9
9
|
// MAP_MODE: EXPORTS
|
|
@@ -14,19 +14,13 @@
|
|
|
14
14
|
// END_MODULE_MAP
|
|
15
15
|
//
|
|
16
16
|
// START_CHANGE_SUMMARY
|
|
17
|
-
// LAST_CHANGE: [v0.
|
|
17
|
+
// LAST_CHANGE: [v0.8.0 - Added OpenCode default and small-model targets to the vvoc agent command tree.]
|
|
18
18
|
// END_CHANGE_SUMMARY
|
|
19
19
|
import { defineCommand } from "citty";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
20
|
+
import { CONFIGURABLE_OPENCODE_SUBAGENTS, isConfigurableOpenCodeSubagentName, isOpenCodeDefaultModelTargetName, MODEL_TARGET_NAME_CHOICES, parseModelTargetName, parseGuardianStyleModelArg, parseOpenCodeModelArg, formatAgentModel, } from "../lib/agent-models.js";
|
|
21
|
+
import { MANAGED_OPENCODE_AGENTS } from "../lib/managed-agents.js";
|
|
22
|
+
import { describeWriteResult, installManagedAgentPrompts, readOpenCodeDefaultModel, readOpenCodeAgentModel, readManagedAgentModels, readVvocConfig, resolvePaths, writeGuardianConfig, writeOpenCodeDefaultModel, writeManagedAgentModel, writeMemoryConfig, writeOpenCodeAgentModel, } from "../lib/opencode.js";
|
|
22
23
|
import { createGuardianConfig, createMemoryConfig } from "../lib/vvoc-config.js";
|
|
23
|
-
const SPECIAL_AGENT_NAMES = ["guardian", "memory-reviewer"];
|
|
24
|
-
const CONFIGURABLE_OPENCODE_SUBAGENTS = ["general", "explore"];
|
|
25
|
-
const AGENT_NAME_CHOICES = [
|
|
26
|
-
...SPECIAL_AGENT_NAMES,
|
|
27
|
-
...CONFIGURABLE_OPENCODE_SUBAGENTS,
|
|
28
|
-
...MANAGED_OPENCODE_AGENTS.map((definition) => definition.name),
|
|
29
|
-
].join(", ");
|
|
30
24
|
const scopeArg = {
|
|
31
25
|
type: "enum",
|
|
32
26
|
options: ["global", "project"],
|
|
@@ -40,7 +34,7 @@ const configDirArg = {
|
|
|
40
34
|
const agentArg = {
|
|
41
35
|
type: "positional",
|
|
42
36
|
required: true,
|
|
43
|
-
description: `
|
|
37
|
+
description: `Model target ID (${MODEL_TARGET_NAME_CHOICES}).`,
|
|
44
38
|
};
|
|
45
39
|
const modelArg = {
|
|
46
40
|
type: "positional",
|
|
@@ -50,7 +44,7 @@ const modelArg = {
|
|
|
50
44
|
const agentSet = defineCommand({
|
|
51
45
|
meta: {
|
|
52
46
|
name: "set",
|
|
53
|
-
description: "Set
|
|
47
|
+
description: "Set a model target override.",
|
|
54
48
|
},
|
|
55
49
|
args: {
|
|
56
50
|
agent: agentArg,
|
|
@@ -59,7 +53,7 @@ const agentSet = defineCommand({
|
|
|
59
53
|
"config-dir": configDirArg,
|
|
60
54
|
},
|
|
61
55
|
async run({ args }) {
|
|
62
|
-
const agentName =
|
|
56
|
+
const agentName = parseModelTargetName(args.agent, "set");
|
|
63
57
|
const paths = await resolveCommandPaths(args);
|
|
64
58
|
if (agentName === "guardian") {
|
|
65
59
|
await setGuardianModelOverride(paths, args.model);
|
|
@@ -69,6 +63,15 @@ const agentSet = defineCommand({
|
|
|
69
63
|
await setMemoryReviewerModelOverride(paths, args.model);
|
|
70
64
|
return;
|
|
71
65
|
}
|
|
66
|
+
if (isOpenCodeDefaultModelTargetName(agentName)) {
|
|
67
|
+
const model = parseOpenCodeModelArg(args.model, "set");
|
|
68
|
+
const result = await writeOpenCodeDefaultModel(paths, resolveDefaultModelKey(agentName), {
|
|
69
|
+
model,
|
|
70
|
+
ensureEntry: true,
|
|
71
|
+
});
|
|
72
|
+
console.log(describeWriteResult(result));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
72
75
|
const model = parseOpenCodeModelArg(args.model, "set");
|
|
73
76
|
if (isConfigurableOpenCodeSubagentName(agentName)) {
|
|
74
77
|
const result = await writeOpenCodeAgentModel(paths, agentName, {
|
|
@@ -89,7 +92,7 @@ const agentSet = defineCommand({
|
|
|
89
92
|
const agentUnset = defineCommand({
|
|
90
93
|
meta: {
|
|
91
94
|
name: "unset",
|
|
92
|
-
description: "Remove
|
|
95
|
+
description: "Remove a model target override.",
|
|
93
96
|
},
|
|
94
97
|
args: {
|
|
95
98
|
agent: agentArg,
|
|
@@ -97,7 +100,7 @@ const agentUnset = defineCommand({
|
|
|
97
100
|
"config-dir": configDirArg,
|
|
98
101
|
},
|
|
99
102
|
async run({ args }) {
|
|
100
|
-
const agentName =
|
|
103
|
+
const agentName = parseModelTargetName(args.agent, "unset");
|
|
101
104
|
const paths = await resolveCommandPaths(args);
|
|
102
105
|
if (agentName === "guardian") {
|
|
103
106
|
await unsetGuardianModelOverride(paths);
|
|
@@ -107,6 +110,13 @@ const agentUnset = defineCommand({
|
|
|
107
110
|
await unsetMemoryReviewerModelOverride(paths);
|
|
108
111
|
return;
|
|
109
112
|
}
|
|
113
|
+
if (isOpenCodeDefaultModelTargetName(agentName)) {
|
|
114
|
+
const result = await writeOpenCodeDefaultModel(paths, resolveDefaultModelKey(agentName), {
|
|
115
|
+
ensureEntry: false,
|
|
116
|
+
});
|
|
117
|
+
console.log(describeWriteResult(result));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
110
120
|
if (isConfigurableOpenCodeSubagentName(agentName)) {
|
|
111
121
|
const result = await writeOpenCodeAgentModel(paths, agentName, {
|
|
112
122
|
ensureEntry: false,
|
|
@@ -123,7 +133,7 @@ const agentUnset = defineCommand({
|
|
|
123
133
|
const agentList = defineCommand({
|
|
124
134
|
meta: {
|
|
125
135
|
name: "list",
|
|
126
|
-
description: "List configured
|
|
136
|
+
description: "List configured model targets.",
|
|
127
137
|
},
|
|
128
138
|
args: {
|
|
129
139
|
scope: {
|
|
@@ -139,7 +149,9 @@ const agentList = defineCommand({
|
|
|
139
149
|
const guardianConfig = vvocConfig?.guardian;
|
|
140
150
|
const memoryConfig = vvocConfig?.memory;
|
|
141
151
|
const managedModels = await readManagedAgentModels(paths);
|
|
142
|
-
console.log(`
|
|
152
|
+
console.log(`Model targets (${scope}):`);
|
|
153
|
+
console.log(` default: ${formatAgentModel(await readOpenCodeDefaultModel(paths, "model"))}`);
|
|
154
|
+
console.log(` small-model: ${formatAgentModel(await readOpenCodeDefaultModel(paths, "small_model"))}`);
|
|
143
155
|
console.log(` guardian: ${formatAgentModel(guardianConfig?.model, guardianConfig?.variant)}`);
|
|
144
156
|
console.log(` memory-reviewer: ${formatAgentModel(memoryConfig?.reviewerModel, memoryConfig?.reviewerVariant)}`);
|
|
145
157
|
for (const agentName of CONFIGURABLE_OPENCODE_SUBAGENTS) {
|
|
@@ -154,7 +166,7 @@ const agentList = defineCommand({
|
|
|
154
166
|
export default defineCommand({
|
|
155
167
|
meta: {
|
|
156
168
|
name: "agent",
|
|
157
|
-
description: "Manage
|
|
169
|
+
description: "Manage model target overrides.",
|
|
158
170
|
},
|
|
159
171
|
subCommands: {
|
|
160
172
|
set: agentSet,
|
|
@@ -187,6 +199,9 @@ async function unsetMemoryReviewerModelOverride(paths) {
|
|
|
187
199
|
function resolveScope(value) {
|
|
188
200
|
return value === "project" ? "project" : "global";
|
|
189
201
|
}
|
|
202
|
+
function resolveDefaultModelKey(targetName) {
|
|
203
|
+
return targetName === "default" ? "model" : "small_model";
|
|
204
|
+
}
|
|
190
205
|
async function resolveCommandPaths(args) {
|
|
191
206
|
const configDir = typeof args["config-dir"] === "string" ? args["config-dir"] : undefined;
|
|
192
207
|
return resolvePaths({
|
|
@@ -195,54 +210,4 @@ async function resolveCommandPaths(args) {
|
|
|
195
210
|
configDir,
|
|
196
211
|
});
|
|
197
212
|
}
|
|
198
|
-
function formatAgentModel(model, variant) {
|
|
199
|
-
if (!model)
|
|
200
|
-
return "default";
|
|
201
|
-
return variant ? `${model}:${variant}` : model;
|
|
202
|
-
}
|
|
203
|
-
function parseAgentName(value, operation) {
|
|
204
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
205
|
-
throw new Error(`agent argument required for ${operation}`);
|
|
206
|
-
}
|
|
207
|
-
const trimmed = value.trim();
|
|
208
|
-
if (trimmed === "guardian" || trimmed === "memory-reviewer") {
|
|
209
|
-
return trimmed;
|
|
210
|
-
}
|
|
211
|
-
if (isConfigurableOpenCodeSubagentName(trimmed) || isManagedOpenCodeAgentName(trimmed)) {
|
|
212
|
-
return trimmed;
|
|
213
|
-
}
|
|
214
|
-
throw new Error(`unsupported agent: ${trimmed}. Expected one of: ${AGENT_NAME_CHOICES}`);
|
|
215
|
-
}
|
|
216
|
-
function isConfigurableOpenCodeSubagentName(value) {
|
|
217
|
-
return CONFIGURABLE_OPENCODE_SUBAGENTS.includes(value);
|
|
218
|
-
}
|
|
219
|
-
function parseGuardianStyleModelArg(value, operation) {
|
|
220
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
221
|
-
throw new Error(`model argument required for ${operation}`);
|
|
222
|
-
}
|
|
223
|
-
const trimmed = value.trim();
|
|
224
|
-
if (trimmed.includes(":")) {
|
|
225
|
-
const lastColon = trimmed.lastIndexOf(":");
|
|
226
|
-
const model = trimmed.slice(0, lastColon);
|
|
227
|
-
const variant = trimmed.slice(lastColon + 1);
|
|
228
|
-
if (!model.includes("/")) {
|
|
229
|
-
throw new Error(`model must be in provider/model-id format, got: ${trimmed}`);
|
|
230
|
-
}
|
|
231
|
-
return { model, variant };
|
|
232
|
-
}
|
|
233
|
-
if (!trimmed.includes("/")) {
|
|
234
|
-
throw new Error(`model must be in provider/model-id format, got: ${trimmed}`);
|
|
235
|
-
}
|
|
236
|
-
return { model: trimmed };
|
|
237
|
-
}
|
|
238
|
-
function parseOpenCodeModelArg(value, operation) {
|
|
239
|
-
if (typeof value !== "string" || !value.trim()) {
|
|
240
|
-
throw new Error(`model argument required for ${operation}`);
|
|
241
|
-
}
|
|
242
|
-
const trimmed = value.trim();
|
|
243
|
-
if (!trimmed.includes("/")) {
|
|
244
|
-
throw new Error(`model must be in provider/model-id format, got: ${trimmed}`);
|
|
245
|
-
}
|
|
246
|
-
return trimmed;
|
|
247
|
-
}
|
|
248
213
|
//# sourceMappingURL=agent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,iBAAiB;AACjB,wBAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,iBAAiB;AACjB,wBAAwB;AACxB,gGAAgG;AAChG,wLAAwL;AACxL,sHAAsH;AACtH,4BAA4B;AAC5B,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,mCAAmC;A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C;IAClB,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;AACpD,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAqC;IACnE,OAAO,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC;AAC5D,CAAC;AAED,KAAK,UAAU,mBAAmB,CAAC,IAA6B;IAC9D,MAAM,SAAS,GAAG,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC1F,OAAO,YAAY,CAAC;QAClB,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;QAC/B,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// FILE: src/commands/completion.ts
|
|
2
|
-
// VERSION: 0.5.
|
|
2
|
+
// VERSION: 0.5.8
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
4
|
// PURPOSE: Auto-detect shell and install vvoc completions idempotently.
|
|
5
|
-
// SCOPE: Shell detection, completion file writing, nested command
|
|
5
|
+
// SCOPE: Shell detection, completion file writing, nested command and preset completion generation for config/plugin/path-provider/preset and the `agent set|unset <target-id>` flow, and rc file patching.
|
|
6
6
|
// DEPENDS: [citty, node:fs/promises, node:path, node:os]
|
|
7
7
|
// LINKS: [M-CLI-COMPLETION, M-CLI-COMMANDS]
|
|
8
8
|
// ROLE: RUNTIME
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
// END_MODULE_MAP
|
|
19
19
|
//
|
|
20
20
|
// START_CHANGE_SUMMARY
|
|
21
|
-
// LAST_CHANGE: [v0.5.
|
|
21
|
+
// LAST_CHANGE: [v0.5.8 - Added OpenCode default and small-model targets to `vvoc agent` shell completions.]
|
|
22
22
|
// END_CHANGE_SUMMARY
|
|
23
23
|
import { defineCommand } from "citty";
|
|
24
24
|
import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
25
25
|
import { homedir } from "node:os";
|
|
26
26
|
import { resolve } from "node:path";
|
|
27
|
+
import { SUPPORTED_MODEL_TARGET_NAMES } from "../lib/agent-models.js";
|
|
27
28
|
const VVOC_TOP_LEVEL_COMMANDS = [
|
|
28
29
|
"agent",
|
|
29
30
|
"completion",
|
|
@@ -33,6 +34,7 @@ const VVOC_TOP_LEVEL_COMMANDS = [
|
|
|
33
34
|
"init",
|
|
34
35
|
"install",
|
|
35
36
|
"path-provider",
|
|
37
|
+
"preset",
|
|
36
38
|
"plugin",
|
|
37
39
|
"status",
|
|
38
40
|
"sync",
|
|
@@ -41,19 +43,11 @@ const VVOC_TOP_LEVEL_COMMANDS = [
|
|
|
41
43
|
];
|
|
42
44
|
const VVOC_CONFIG_COMMANDS = ["validate"];
|
|
43
45
|
const VVOC_PATH_PROVIDER_PRESETS = ["stepfun-ai"];
|
|
46
|
+
const VVOC_PRESET_COMMANDS = ["list", "show"];
|
|
47
|
+
const VVOC_PRESET_NAMES = ["openai", "zai", "minimax"];
|
|
44
48
|
const VVOC_PLUGIN_COMMANDS = ["list"];
|
|
45
49
|
const VVOC_AGENT_COMMANDS = ["set", "unset", "list"];
|
|
46
|
-
const VVOC_AGENT_TARGETS = [
|
|
47
|
-
"guardian",
|
|
48
|
-
"memory-reviewer",
|
|
49
|
-
"general",
|
|
50
|
-
"explore",
|
|
51
|
-
"enhancer",
|
|
52
|
-
"implementer",
|
|
53
|
-
"spec-reviewer",
|
|
54
|
-
"code-reviewer",
|
|
55
|
-
"investitagor",
|
|
56
|
-
];
|
|
50
|
+
const VVOC_AGENT_TARGETS = [...SUPPORTED_MODEL_TARGET_NAMES];
|
|
57
51
|
export default defineCommand({
|
|
58
52
|
meta: {
|
|
59
53
|
name: "completion",
|
|
@@ -152,6 +146,8 @@ export function generateBashCompletion() {
|
|
|
152
146
|
const topLevelCommands = VVOC_TOP_LEVEL_COMMANDS.join(" ");
|
|
153
147
|
const configCommands = VVOC_CONFIG_COMMANDS.join(" ");
|
|
154
148
|
const pathProviderPresets = VVOC_PATH_PROVIDER_PRESETS.join(" ");
|
|
149
|
+
const presetCommands = [...VVOC_PRESET_COMMANDS, ...VVOC_PRESET_NAMES].join(" ");
|
|
150
|
+
const presetNames = VVOC_PRESET_NAMES.join(" ");
|
|
155
151
|
const pluginCommands = VVOC_PLUGIN_COMMANDS.join(" ");
|
|
156
152
|
const agentCommands = VVOC_AGENT_COMMANDS.join(" ");
|
|
157
153
|
const agentTargets = VVOC_AGENT_TARGETS.join(" ");
|
|
@@ -175,6 +171,9 @@ export function generateBashCompletion() {
|
|
|
175
171
|
" path-provider)\n" +
|
|
176
172
|
" _vvoc_path_provider_presets\n" +
|
|
177
173
|
" ;;\n" +
|
|
174
|
+
" preset)\n" +
|
|
175
|
+
" _vvoc_preset_commands\n" +
|
|
176
|
+
" ;;\n" +
|
|
178
177
|
" plugin)\n" +
|
|
179
178
|
" _vvoc_plugin_commands\n" +
|
|
180
179
|
" ;;\n" +
|
|
@@ -185,6 +184,9 @@ export function generateBashCompletion() {
|
|
|
185
184
|
" agent:set|agent:unset)\n" +
|
|
186
185
|
" _vvoc_agent_target_commands\n" +
|
|
187
186
|
" ;;\n" +
|
|
187
|
+
" preset:show)\n" +
|
|
188
|
+
" _vvoc_preset_names\n" +
|
|
189
|
+
" ;;\n" +
|
|
188
190
|
" esac\n" +
|
|
189
191
|
" ;;\n" +
|
|
190
192
|
" esac\n" +
|
|
@@ -211,6 +213,20 @@ export function generateBashCompletion() {
|
|
|
211
213
|
' COMPREPLY=($(compgen -W "$commands" -- "$cur"))\n' +
|
|
212
214
|
"}\n" +
|
|
213
215
|
"\n" +
|
|
216
|
+
"_vvoc_preset_commands() {\n" +
|
|
217
|
+
' local commands="' +
|
|
218
|
+
presetCommands +
|
|
219
|
+
'"\n' +
|
|
220
|
+
' COMPREPLY=($(compgen -W "$commands" -- "$cur"))\n' +
|
|
221
|
+
"}\n" +
|
|
222
|
+
"\n" +
|
|
223
|
+
"_vvoc_preset_names() {\n" +
|
|
224
|
+
' local commands="' +
|
|
225
|
+
presetNames +
|
|
226
|
+
'"\n' +
|
|
227
|
+
' COMPREPLY=($(compgen -W "$commands" -- "$cur"))\n' +
|
|
228
|
+
"}\n" +
|
|
229
|
+
"\n" +
|
|
214
230
|
"_vvoc_agent_commands() {\n" +
|
|
215
231
|
' local commands="' +
|
|
216
232
|
agentCommands +
|
|
@@ -246,7 +262,7 @@ export function generateZshCompletion() {
|
|
|
246
262
|
for (const cmd of VVOC_TOP_LEVEL_COMMANDS) {
|
|
247
263
|
lines.push(' "' + cmd + '"');
|
|
248
264
|
}
|
|
249
|
-
lines.push(" )", "", ' _arguments -C "1: :(' + VVOC_TOP_LEVEL_COMMANDS.join(" ") + ')" "*::arg:->args"', "", " case $line[1] in", " agent)", " _vvoc_agent_cmds", " ;;", " config)", " _vvoc_config_cmds", " ;;", " path-provider)", " _vvoc_path_provider_cmds", " ;;", " plugin)", " _vvoc_plugin_cmds", " ;;", " esac", "}", "", "_vvoc_config_cmds() {", " local -a config_commands", " config_commands=(" + VVOC_CONFIG_COMMANDS.join(" ") + ")", ' _arguments "1: :(' + VVOC_CONFIG_COMMANDS.join(" ") + ')"', "}", "", "_vvoc_path_provider_cmds() {", ' _arguments "1: :(' + VVOC_PATH_PROVIDER_PRESETS.join(" ") + ')"', "}", "", "_vvoc_agent_cmds() {", " case $words[2] in", " set|unset)", ' _arguments "1: :(' + VVOC_AGENT_TARGETS.join(" ") + ')"', " ;;", " *)", ' _arguments "1: :(' + VVOC_AGENT_COMMANDS.join(" ") + ')"', " ;;", " esac", "}", "", "_vvoc_plugin_cmds() {", " local -a plugin_commands", " plugin_commands=(" + VVOC_PLUGIN_COMMANDS.join(" ") + ")", ' _arguments "1: :(' + VVOC_PLUGIN_COMMANDS.join(" ") + ')"', "}", "", "compdef _vvoc vvoc");
|
|
265
|
+
lines.push(" )", "", ' _arguments -C "1: :(' + VVOC_TOP_LEVEL_COMMANDS.join(" ") + ')" "*::arg:->args"', "", " case $line[1] in", " agent)", " _vvoc_agent_cmds", " ;;", " config)", " _vvoc_config_cmds", " ;;", " path-provider)", " _vvoc_path_provider_cmds", " ;;", " preset)", " _vvoc_preset_cmds", " ;;", " plugin)", " _vvoc_plugin_cmds", " ;;", " esac", "}", "", "_vvoc_config_cmds() {", " local -a config_commands", " config_commands=(" + VVOC_CONFIG_COMMANDS.join(" ") + ")", ' _arguments "1: :(' + VVOC_CONFIG_COMMANDS.join(" ") + ')"', "}", "", "_vvoc_path_provider_cmds() {", ' _arguments "1: :(' + VVOC_PATH_PROVIDER_PRESETS.join(" ") + ')"', "}", "", "_vvoc_preset_cmds() {", " case $words[2] in", " show)", ' _arguments "1: :(' + VVOC_PRESET_NAMES.join(" ") + ')"', " ;;", " *)", ' _arguments "1: :(' + [...VVOC_PRESET_COMMANDS, ...VVOC_PRESET_NAMES].join(" ") + ')"', " ;;", " esac", "}", "", "_vvoc_agent_cmds() {", " case $words[2] in", " set|unset)", ' _arguments "1: :(' + VVOC_AGENT_TARGETS.join(" ") + ')"', " ;;", " *)", ' _arguments "1: :(' + VVOC_AGENT_COMMANDS.join(" ") + ')"', " ;;", " esac", "}", "", "_vvoc_plugin_cmds() {", " local -a plugin_commands", " plugin_commands=(" + VVOC_PLUGIN_COMMANDS.join(" ") + ")", ' _arguments "1: :(' + VVOC_PLUGIN_COMMANDS.join(" ") + ')"', "}", "", "compdef _vvoc vvoc");
|
|
250
266
|
return lines.join("\n") + "\n";
|
|
251
267
|
}
|
|
252
268
|
export function generateFishCompletion() {
|
|
@@ -254,7 +270,7 @@ export function generateFishCompletion() {
|
|
|
254
270
|
for (const cmd of VVOC_TOP_LEVEL_COMMANDS) {
|
|
255
271
|
lines.push(" echo " + cmd);
|
|
256
272
|
}
|
|
257
|
-
lines.push("end", "", "function __vvoc_config_cmds", " echo " + VVOC_CONFIG_COMMANDS.join(" "), "end", "", "function __vvoc_path_provider_cmds", " echo " + VVOC_PATH_PROVIDER_PRESETS.join(" "), "end", "", "function __vvoc_agent_cmds", " echo " + VVOC_AGENT_COMMANDS.join(" "), "end", "", "function __vvoc_agent_target_cmds", " echo " + VVOC_AGENT_TARGETS.join(" "), "end", "", "function __vvoc_plugin_cmds", " echo " + VVOC_PLUGIN_COMMANDS.join(" "), "end", "", 'complete -c vvoc -f -a "(__vvoc_commands)"', 'complete -c vvoc -n "__fish_seen_subcommand_from agent; and not __fish_seen_subcommand_from set unset list" -f -a "(__vvoc_agent_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from set unset" -f -a "(__vvoc_agent_target_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from config" -f -a "(__vvoc_config_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from path-provider" -f -a "(__vvoc_path_provider_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from plugin" -f -a "(__vvoc_plugin_cmds)"');
|
|
273
|
+
lines.push("end", "", "function __vvoc_config_cmds", " echo " + VVOC_CONFIG_COMMANDS.join(" "), "end", "", "function __vvoc_path_provider_cmds", " echo " + VVOC_PATH_PROVIDER_PRESETS.join(" "), "end", "", "function __vvoc_preset_cmds", " echo " + [...VVOC_PRESET_COMMANDS, ...VVOC_PRESET_NAMES].join(" "), "end", "", "function __vvoc_preset_names", " echo " + VVOC_PRESET_NAMES.join(" "), "end", "", "function __vvoc_agent_cmds", " echo " + VVOC_AGENT_COMMANDS.join(" "), "end", "", "function __vvoc_agent_target_cmds", " echo " + VVOC_AGENT_TARGETS.join(" "), "end", "", "function __vvoc_plugin_cmds", " echo " + VVOC_PLUGIN_COMMANDS.join(" "), "end", "", 'complete -c vvoc -f -a "(__vvoc_commands)"', 'complete -c vvoc -n "__fish_seen_subcommand_from agent; and not __fish_seen_subcommand_from set unset list" -f -a "(__vvoc_agent_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from agent; and __fish_seen_subcommand_from set unset" -f -a "(__vvoc_agent_target_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from config" -f -a "(__vvoc_config_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from path-provider" -f -a "(__vvoc_path_provider_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from preset; and not __fish_seen_subcommand_from list show openai zai" -f -a "(__vvoc_preset_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from preset; and __fish_seen_subcommand_from show" -f -a "(__vvoc_preset_names)"', 'complete -c vvoc -n "__fish_seen_subcommand_from plugin" -f -a "(__vvoc_plugin_cmds)"');
|
|
258
274
|
return lines.join("\n") + "\n";
|
|
259
275
|
}
|
|
260
276
|
//# sourceMappingURL=completion.js.map
|