@osovv/vv-opencode 0.18.0 → 0.21.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 +42 -42
- package/dist/cli.js +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/agent.js +9 -193
- package/dist/commands/agent.js.map +1 -1
- package/dist/commands/completion.js +28 -25
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config-validate.js +58 -5
- package/dist/commands/config-validate.js.map +1 -1
- package/dist/commands/doctor.js +11 -2
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +2 -1
- package/dist/commands/init.js +30 -28
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/patch-provider.d.ts +19 -0
- package/dist/commands/patch-provider.js +23 -2
- package/dist/commands/patch-provider.js.map +1 -1
- package/dist/commands/preset.d.ts +3 -11
- package/dist/commands/preset.js +81 -85
- package/dist/commands/preset.js.map +1 -1
- package/dist/commands/role.d.ts +20 -0
- package/dist/commands/role.js +184 -0
- package/dist/commands/role.js.map +1 -0
- package/dist/commands/status.js +17 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-models.d.ts +10 -1
- package/dist/lib/agent-models.js +34 -15
- package/dist/lib/agent-models.js.map +1 -1
- package/dist/lib/model-roles.d.ts +44 -0
- package/dist/lib/model-roles.js +144 -0
- package/dist/lib/model-roles.js.map +1 -0
- package/dist/lib/opencode.d.ts +21 -0
- package/dist/lib/opencode.js +178 -31
- package/dist/lib/opencode.js.map +1 -1
- package/dist/lib/vvoc-config.d.ts +24 -10
- package/dist/lib/vvoc-config.js +166 -104
- package/dist/lib/vvoc-config.js.map +1 -1
- package/dist/plugins/guardian/index.js +124 -15
- package/dist/plugins/guardian/index.js.map +1 -1
- package/dist/plugins/memory/index.js +116 -10
- package/dist/plugins/memory/index.js.map +1 -1
- package/dist/plugins/memory-store.d.ts +0 -2
- package/dist/plugins/memory-store.js +2 -3
- package/dist/plugins/memory-store.js.map +1 -1
- package/dist/plugins/model-roles/index.d.ts +2 -0
- package/dist/plugins/model-roles/index.js +230 -0
- package/dist/plugins/model-roles/index.js.map +1 -0
- package/package.json +6 -2
- package/schemas/vvoc/v1.json +1 -1
- package/schemas/vvoc/v2.json +1 -1
- package/schemas/vvoc/v3.json +127 -0
- package/templates/agents/code-reviewer.md +12 -0
- package/templates/agents/enhancer.md +54 -21
- package/templates/agents/implementer.md +19 -0
- package/templates/agents/investitagor.md +18 -6
- package/templates/agents/spec-reviewer.md +14 -1
package/README.md
CHANGED
|
@@ -5,12 +5,12 @@ Portable OpenCode workflow package with a Bun CLI that installs and maintains Op
|
|
|
5
5
|
## What This Package Does
|
|
6
6
|
|
|
7
7
|
- installs one pinned `@osovv/vv-opencode@<version>` entry into OpenCode
|
|
8
|
-
- that package entry exports
|
|
8
|
+
- that package entry exports five plugins: `GuardianPlugin`, `MemoryPlugin`, `ModelRolesPlugin`, `SystemContextInjectionPlugin`, `SecretsRedactionPlugin`
|
|
9
9
|
- creates and maintains canonical `vvoc` config at `$XDG_CONFIG_HOME/vvoc/vvoc.json`
|
|
10
10
|
- scaffolds managed prompt files under `vvoc/agents/`
|
|
11
11
|
- registers managed OpenCode agents: `enhancer`, `implementer`, `spec-reviewer`, `code-reviewer`, `investitagor`
|
|
12
12
|
- installs plugin-managed agents: `guardian`, `memory-reviewer`
|
|
13
|
-
- ships
|
|
13
|
+
- ships role presets, diagnostics, and shell completion through the `vvoc` CLI
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
16
16
|
|
|
@@ -44,10 +44,11 @@ vvoc install --scope project
|
|
|
44
44
|
- create or refresh canonical `vvoc.json`
|
|
45
45
|
- refresh managed built-in presets: `vv-openai`, `vv-zai`, `vv-minimax`
|
|
46
46
|
|
|
47
|
-
That package entry exports
|
|
47
|
+
That package entry exports five plugins:
|
|
48
48
|
|
|
49
49
|
- `GuardianPlugin`
|
|
50
50
|
- `MemoryPlugin`
|
|
51
|
+
- `ModelRolesPlugin`
|
|
51
52
|
- `SystemContextInjectionPlugin`
|
|
52
53
|
- `SecretsRedactionPlugin`
|
|
53
54
|
|
|
@@ -77,6 +78,7 @@ Persisted vvoc data lives here:
|
|
|
77
78
|
|
|
78
79
|
`vvoc.json` currently contains these top-level sections:
|
|
79
80
|
|
|
81
|
+
- `roles`
|
|
80
82
|
- `guardian`
|
|
81
83
|
- `memory`
|
|
82
84
|
- `secretsRedaction`
|
|
@@ -86,12 +88,12 @@ The current schema is versioned and published with the package:
|
|
|
86
88
|
|
|
87
89
|
```json
|
|
88
90
|
{
|
|
89
|
-
"$schema": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@<installed-version>/schemas/vvoc/
|
|
90
|
-
"version":
|
|
91
|
+
"$schema": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@<installed-version>/schemas/vvoc/v3.json",
|
|
92
|
+
"version": 3
|
|
91
93
|
}
|
|
92
94
|
```
|
|
93
95
|
|
|
94
|
-
Schema source of truth lives in this repository at `schemas/vvoc/
|
|
96
|
+
Schema source of truth lives in this repository at `schemas/vvoc/v3.json`.
|
|
95
97
|
|
|
96
98
|
## CLI Overview
|
|
97
99
|
|
|
@@ -103,83 +105,81 @@ Schema source of truth lives in this repository at `schemas/vvoc/v2.json`.
|
|
|
103
105
|
| `vvoc status` | Show current installation state |
|
|
104
106
|
| `vvoc doctor` | Diagnose setup problems and exit non-zero if problems are found |
|
|
105
107
|
| `vvoc config validate` | Validate canonical `vvoc.json` |
|
|
106
|
-
| `vvoc
|
|
108
|
+
| `vvoc role list/set/unset` | Manage canonical role assignments |
|
|
107
109
|
| `vvoc preset list`, `vvoc preset show <name>`, `vvoc preset <name>` | Inspect or apply named presets |
|
|
108
110
|
| `vvoc guardian config` | Print or write the `guardian` section of `vvoc.json` |
|
|
109
111
|
| `vvoc plugin list` | List plugin entries from OpenCode config |
|
|
110
|
-
| `vvoc patch-provider stepfun-ai|zai` | Patch a global OpenCode config preset |
|
|
112
|
+
| `vvoc patch-provider stepfun-ai|zai|openai` | Patch a global OpenCode config preset |
|
|
111
113
|
| `vvoc completion` | Install shell completions |
|
|
112
114
|
| `vvoc upgrade` | Upgrade the global package and run a follow-up sync |
|
|
113
115
|
| `vvoc version` | Print the installed package version |
|
|
114
116
|
|
|
115
|
-
## Model
|
|
117
|
+
## Model Roles And Presets
|
|
116
118
|
|
|
117
|
-
Inspect current
|
|
119
|
+
Inspect current role assignments:
|
|
118
120
|
|
|
119
121
|
```bash
|
|
120
|
-
vvoc
|
|
122
|
+
vvoc role list
|
|
121
123
|
```
|
|
122
124
|
|
|
123
|
-
Set
|
|
125
|
+
Set role assignments (`provider/model[:variant]`):
|
|
124
126
|
|
|
125
127
|
```bash
|
|
126
|
-
vvoc
|
|
127
|
-
vvoc
|
|
128
|
-
vvoc
|
|
129
|
-
vvoc
|
|
130
|
-
vvoc agent set explore openai/gpt-5.4-mini
|
|
128
|
+
vvoc role set default openai/gpt-5.4
|
|
129
|
+
vvoc role set smart openai/gpt-5.4:xhigh
|
|
130
|
+
vvoc role set fast openai/gpt-5.4-mini
|
|
131
|
+
vvoc role set team-review anthropic/claude-sonnet-4-5:high
|
|
131
132
|
```
|
|
132
133
|
|
|
133
|
-
Remove
|
|
134
|
+
Remove custom role assignments:
|
|
134
135
|
|
|
135
136
|
```bash
|
|
136
|
-
vvoc
|
|
137
|
-
vvoc agent unset explore
|
|
138
|
-
vvoc agent unset guardian
|
|
137
|
+
vvoc role unset team-review
|
|
139
138
|
```
|
|
140
139
|
|
|
141
|
-
|
|
140
|
+
Built-in role IDs:
|
|
142
141
|
|
|
143
142
|
- `default`
|
|
144
|
-
- `
|
|
145
|
-
- `
|
|
146
|
-
- `
|
|
147
|
-
- `general`
|
|
148
|
-
- `explore`
|
|
149
|
-
- `enhancer`
|
|
150
|
-
- `implementer`
|
|
151
|
-
- `spec-reviewer`
|
|
152
|
-
- `code-reviewer`
|
|
153
|
-
- `investitagor`
|
|
143
|
+
- `smart`
|
|
144
|
+
- `fast`
|
|
145
|
+
- `vision`
|
|
154
146
|
|
|
155
|
-
|
|
147
|
+
Role notes:
|
|
156
148
|
|
|
157
|
-
- `
|
|
158
|
-
-
|
|
159
|
-
-
|
|
160
|
-
- `guardian` and `memory-reviewer` live in canonical `vvoc.json`, so they remain global even when `--scope project` is passed
|
|
149
|
+
- `vvoc role` mutates only canonical global `vvoc.json` (`roles` map)
|
|
150
|
+
- built-in roles cannot be removed with `vvoc role unset`
|
|
151
|
+
- custom role IDs must use lowercase letters, digits, and hyphens
|
|
161
152
|
|
|
162
|
-
Presets are stored in canonical `vvoc.json` and are useful when you want to switch several
|
|
153
|
+
Presets are stored in canonical `vvoc.json` and are useful when you want to switch several role assignments together:
|
|
163
154
|
|
|
164
155
|
```bash
|
|
165
156
|
vvoc preset list
|
|
166
157
|
vvoc preset show vv-openai
|
|
167
158
|
vvoc preset vv-openai
|
|
168
|
-
vvoc preset vv-zai
|
|
159
|
+
vvoc preset vv-zai
|
|
169
160
|
```
|
|
170
161
|
|
|
171
162
|
Preset rules:
|
|
172
163
|
|
|
173
164
|
- managed built-in presets are `vv-openai`, `vv-zai`, and `vv-minimax`
|
|
174
165
|
- `vvoc install` and `vvoc sync` always refresh those managed `vv-*` presets back to vvoc defaults
|
|
166
|
+
- `vv-openai` uses the vv-managed OpenAI alias model `openai/vv-gpt-5.4-xhigh` as its default target so GPT-5.4 xhigh can be selected as an exact root default model
|
|
167
|
+
- run `vvoc patch-provider openai` before applying `vv-openai` if the alias model is not already present in your global OpenCode config
|
|
175
168
|
- user-defined presets with other names are preserved as-is, including legacy names such as `openai`, `zai`, and `minimax`
|
|
176
169
|
- presets may be partial
|
|
177
|
-
- applying a preset only changes the
|
|
178
|
-
-
|
|
179
|
-
-
|
|
170
|
+
- applying a preset only changes the roles listed in that preset
|
|
171
|
+
- `vvoc preset list/show/apply` reads the current canonical `vvoc.json` as-is and only bootstraps defaults when the file is missing
|
|
172
|
+
- on existing `vvoc.json`, preset commands do not reseed or refresh managed preset definitions as a side effect
|
|
173
|
+
- preset application updates only canonical global `vvoc.json` role assignments and does not rewrite OpenCode config directly
|
|
180
174
|
|
|
181
175
|
## Plugins Included
|
|
182
176
|
|
|
177
|
+
### ModelRolesPlugin
|
|
178
|
+
|
|
179
|
+
`ModelRolesPlugin` resolves `vv-role:*` model references at startup for supported OpenCode config fields (`model`, `small_model`, `agent.*.model`, and `command.*.model`).
|
|
180
|
+
|
|
181
|
+
Agent role assignments that include `:variant` are translated into native `model` plus `variant` fields.
|
|
182
|
+
|
|
183
183
|
### GuardianPlugin
|
|
184
184
|
|
|
185
185
|
`GuardianPlugin` reviews OpenCode permission requests with a constrained `guardian` agent and safe deny behavior.
|
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// FILE: src/cli.ts
|
|
3
|
-
// VERSION: 0.2.
|
|
3
|
+
// VERSION: 0.2.10
|
|
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
7
|
// INPUTS: Process argv plus command metadata from registered subcommands.
|
|
8
8
|
// OUTPUTS: The executed vvoc command tree.
|
|
9
|
-
// DEPENDS: [citty, src/commands/
|
|
9
|
+
// DEPENDS: [citty, src/commands/completion.ts, src/commands/config.ts, src/commands/doctor.ts, src/commands/guardian.ts, src/commands/init.ts, src/commands/install.ts, src/commands/patch-provider.ts, src/commands/preset.ts, src/commands/plugin.ts, src/commands/role.ts, src/commands/status.ts, src/commands/sync.ts, src/commands/upgrade.ts, src/commands/version.ts, src/lib/package.ts]
|
|
10
10
|
// LINKS: [M-CLI-COMMANDS]
|
|
11
11
|
// ROLE: SCRIPT
|
|
12
12
|
// MAP_MODE: LOCALS
|
|
@@ -18,10 +18,9 @@
|
|
|
18
18
|
// END_MODULE_MAP
|
|
19
19
|
//
|
|
20
20
|
// START_CHANGE_SUMMARY
|
|
21
|
-
// LAST_CHANGE: [v0.2.
|
|
21
|
+
// LAST_CHANGE: [v0.2.10 - Aligned module dependency metadata with the actual imported command tree.]
|
|
22
22
|
// END_CHANGE_SUMMARY
|
|
23
23
|
import { defineCommand, runMain } from "citty";
|
|
24
|
-
import agent from "./commands/agent.js";
|
|
25
24
|
import completion from "./commands/completion.js";
|
|
26
25
|
import config from "./commands/config.js";
|
|
27
26
|
import doctor from "./commands/doctor.js";
|
|
@@ -31,6 +30,7 @@ import install from "./commands/install.js";
|
|
|
31
30
|
import patchProvider from "./commands/patch-provider.js";
|
|
32
31
|
import preset from "./commands/preset.js";
|
|
33
32
|
import plugin from "./commands/plugin.js";
|
|
33
|
+
import role from "./commands/role.js";
|
|
34
34
|
import status from "./commands/status.js";
|
|
35
35
|
import sync from "./commands/sync.js";
|
|
36
36
|
import upgrade from "./commands/upgrade.js";
|
|
@@ -45,7 +45,6 @@ const main = defineCommand({
|
|
|
45
45
|
description: "Install and sync vv-opencode plugins for OpenCode.",
|
|
46
46
|
},
|
|
47
47
|
subCommands: {
|
|
48
|
-
agent,
|
|
49
48
|
completion,
|
|
50
49
|
config,
|
|
51
50
|
doctor,
|
|
@@ -55,6 +54,7 @@ const main = defineCommand({
|
|
|
55
54
|
"patch-provider": patchProvider,
|
|
56
55
|
preset,
|
|
57
56
|
plugin,
|
|
57
|
+
role,
|
|
58
58
|
status,
|
|
59
59
|
sync,
|
|
60
60
|
upgrade,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,mBAAmB;AACnB,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,mBAAmB;AACnB,kBAAkB;AAClB,wBAAwB;AACxB,uDAAuD;AACvD,+FAA+F;AAC/F,4EAA4E;AAC5E,6CAA6C;AAC7C,oYAAoY;AACpY,4BAA4B;AAC5B,iBAAiB;AACjB,qBAAqB;AACrB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,oEAAoE;AACpE,wCAAwC;AACxC,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,uGAAuG;AACvG,qBAAqB;AAErB,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAClD,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAC9C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,aAAa,MAAM,8BAA8B,CAAC;AACzD,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAC1C,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,iCAAiC;AACjC,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAC;AAEjD,MAAM,IAAI,GAAG,aAAa,CAAC;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,oDAAoD;KAClE;IACD,WAAW,EAAE;QACX,UAAU;QACV,MAAM;QACN,MAAM;QACN,QAAQ;QACR,IAAI;QACJ,OAAO;QACP,gBAAgB,EAAE,aAAa;QAC/B,MAAM;QACN,MAAM;QACN,IAAI;QACJ,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,213 +1,29 @@
|
|
|
1
1
|
// FILE: src/commands/agent.ts
|
|
2
|
-
// VERSION: 0.
|
|
2
|
+
// VERSION: 1.0.0
|
|
3
3
|
// START_MODULE_CONTRACT
|
|
4
|
-
// PURPOSE:
|
|
5
|
-
// SCOPE:
|
|
6
|
-
// DEPENDS: [citty
|
|
4
|
+
// PURPOSE: Keep a legacy vvoc agent command shim for backwards compatibility messaging.
|
|
5
|
+
// SCOPE: Emit a clear migration error directing users to vvoc role.
|
|
6
|
+
// DEPENDS: [citty]
|
|
7
7
|
// LINKS: [M-CLI-COMMANDS]
|
|
8
8
|
// ROLE: RUNTIME
|
|
9
9
|
// MAP_MODE: EXPORTS
|
|
10
10
|
// END_MODULE_CONTRACT
|
|
11
11
|
//
|
|
12
12
|
// START_MODULE_MAP
|
|
13
|
-
// default -
|
|
13
|
+
// default - Legacy command shim for vvoc agent.
|
|
14
14
|
// END_MODULE_MAP
|
|
15
15
|
//
|
|
16
16
|
// START_CHANGE_SUMMARY
|
|
17
|
-
// LAST_CHANGE: [
|
|
17
|
+
// LAST_CHANGE: [v1.0.0 - Retired vvoc agent behavior and replaced it with a migration message to vvoc role.]
|
|
18
18
|
// END_CHANGE_SUMMARY
|
|
19
19
|
import { defineCommand } from "citty";
|
|
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";
|
|
23
|
-
import { createGuardianConfig, createMemoryConfig } from "../lib/vvoc-config.js";
|
|
24
|
-
const scopeArg = {
|
|
25
|
-
type: "enum",
|
|
26
|
-
options: ["global", "project"],
|
|
27
|
-
default: "global",
|
|
28
|
-
description: "Write global or project config.",
|
|
29
|
-
};
|
|
30
|
-
const configDirArg = {
|
|
31
|
-
type: "string",
|
|
32
|
-
description: "Override the global config home.",
|
|
33
|
-
};
|
|
34
|
-
const agentArg = {
|
|
35
|
-
type: "positional",
|
|
36
|
-
required: true,
|
|
37
|
-
description: `Model target ID (${MODEL_TARGET_NAME_CHOICES}).`,
|
|
38
|
-
};
|
|
39
|
-
const modelArg = {
|
|
40
|
-
type: "positional",
|
|
41
|
-
required: true,
|
|
42
|
-
description: "Model in provider/model-id format. Guardian and memory-reviewer also accept provider/model-id[:variant].",
|
|
43
|
-
};
|
|
44
|
-
const agentSet = defineCommand({
|
|
45
|
-
meta: {
|
|
46
|
-
name: "set",
|
|
47
|
-
description: "Set a model target override.",
|
|
48
|
-
},
|
|
49
|
-
args: {
|
|
50
|
-
agent: agentArg,
|
|
51
|
-
model: modelArg,
|
|
52
|
-
scope: scopeArg,
|
|
53
|
-
"config-dir": configDirArg,
|
|
54
|
-
},
|
|
55
|
-
async run({ args }) {
|
|
56
|
-
const agentName = parseModelTargetName(args.agent, "set");
|
|
57
|
-
const paths = await resolveCommandPaths(args);
|
|
58
|
-
if (agentName === "guardian") {
|
|
59
|
-
await setGuardianModelOverride(paths, args.model);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (agentName === "memory-reviewer") {
|
|
63
|
-
await setMemoryReviewerModelOverride(paths, args.model);
|
|
64
|
-
return;
|
|
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
|
-
}
|
|
75
|
-
const model = parseOpenCodeModelArg(args.model, "set");
|
|
76
|
-
if (isConfigurableOpenCodeSubagentName(agentName)) {
|
|
77
|
-
const result = await writeOpenCodeAgentModel(paths, agentName, {
|
|
78
|
-
model,
|
|
79
|
-
ensureEntry: true,
|
|
80
|
-
});
|
|
81
|
-
console.log(describeWriteResult(result));
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
await installManagedAgentPrompts(paths, { force: false });
|
|
85
|
-
const result = await writeManagedAgentModel(paths, agentName, {
|
|
86
|
-
model,
|
|
87
|
-
ensureEntry: true,
|
|
88
|
-
});
|
|
89
|
-
console.log(describeWriteResult(result));
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
const agentUnset = defineCommand({
|
|
93
|
-
meta: {
|
|
94
|
-
name: "unset",
|
|
95
|
-
description: "Remove a model target override.",
|
|
96
|
-
},
|
|
97
|
-
args: {
|
|
98
|
-
agent: agentArg,
|
|
99
|
-
scope: scopeArg,
|
|
100
|
-
"config-dir": configDirArg,
|
|
101
|
-
},
|
|
102
|
-
async run({ args }) {
|
|
103
|
-
const agentName = parseModelTargetName(args.agent, "unset");
|
|
104
|
-
const paths = await resolveCommandPaths(args);
|
|
105
|
-
if (agentName === "guardian") {
|
|
106
|
-
await unsetGuardianModelOverride(paths);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (agentName === "memory-reviewer") {
|
|
110
|
-
await unsetMemoryReviewerModelOverride(paths);
|
|
111
|
-
return;
|
|
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
|
-
}
|
|
120
|
-
if (isConfigurableOpenCodeSubagentName(agentName)) {
|
|
121
|
-
const result = await writeOpenCodeAgentModel(paths, agentName, {
|
|
122
|
-
ensureEntry: false,
|
|
123
|
-
});
|
|
124
|
-
console.log(describeWriteResult(result));
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const result = await writeManagedAgentModel(paths, agentName, {
|
|
128
|
-
ensureEntry: false,
|
|
129
|
-
});
|
|
130
|
-
console.log(describeWriteResult(result));
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
const agentList = defineCommand({
|
|
134
|
-
meta: {
|
|
135
|
-
name: "list",
|
|
136
|
-
description: "List configured model targets.",
|
|
137
|
-
},
|
|
138
|
-
args: {
|
|
139
|
-
scope: {
|
|
140
|
-
...scopeArg,
|
|
141
|
-
description: "Show global or project config.",
|
|
142
|
-
},
|
|
143
|
-
"config-dir": configDirArg,
|
|
144
|
-
},
|
|
145
|
-
async run({ args }) {
|
|
146
|
-
const scope = resolveScope(args.scope);
|
|
147
|
-
const paths = await resolveCommandPaths(args);
|
|
148
|
-
const vvocConfig = await readVvocConfig(paths);
|
|
149
|
-
const guardianConfig = vvocConfig?.guardian;
|
|
150
|
-
const memoryConfig = vvocConfig?.memory;
|
|
151
|
-
const managedModels = await readManagedAgentModels(paths);
|
|
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"))}`);
|
|
155
|
-
console.log(` guardian: ${formatAgentModel(guardianConfig?.model, guardianConfig?.variant)}`);
|
|
156
|
-
console.log(` memory-reviewer: ${formatAgentModel(memoryConfig?.reviewerModel, memoryConfig?.reviewerVariant)}`);
|
|
157
|
-
for (const agentName of CONFIGURABLE_OPENCODE_SUBAGENTS) {
|
|
158
|
-
const model = await readOpenCodeAgentModel(paths, agentName);
|
|
159
|
-
console.log(` ${agentName}: ${formatAgentModel(model)}`);
|
|
160
|
-
}
|
|
161
|
-
for (const definition of MANAGED_OPENCODE_AGENTS) {
|
|
162
|
-
console.log(` ${definition.name}: ${formatAgentModel(managedModels[definition.name])}`);
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
20
|
export default defineCommand({
|
|
167
21
|
meta: {
|
|
168
22
|
name: "agent",
|
|
169
|
-
description: "
|
|
23
|
+
description: "Legacy alias removed in favor of vvoc role.",
|
|
170
24
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
unset: agentUnset,
|
|
174
|
-
list: agentList,
|
|
25
|
+
async run() {
|
|
26
|
+
throw new Error("`vvoc agent` has been removed. Use `vvoc role` instead.");
|
|
175
27
|
},
|
|
176
28
|
});
|
|
177
|
-
async function setGuardianModelOverride(paths, value) {
|
|
178
|
-
const { model, variant } = parseGuardianStyleModelArg(value, "set");
|
|
179
|
-
const result = await writeGuardianConfig(paths, { model, variant }, { merge: true });
|
|
180
|
-
console.log(describeWriteResult(result));
|
|
181
|
-
}
|
|
182
|
-
async function unsetGuardianModelOverride(paths) {
|
|
183
|
-
const currentGuardian = (await readVvocConfig(paths))?.guardian ?? createGuardianConfig();
|
|
184
|
-
const { model: _model, variant: _variant, ...rest } = currentGuardian;
|
|
185
|
-
const result = await writeGuardianConfig(paths, rest);
|
|
186
|
-
console.log(describeWriteResult(result));
|
|
187
|
-
}
|
|
188
|
-
async function setMemoryReviewerModelOverride(paths, value) {
|
|
189
|
-
const { model, variant } = parseGuardianStyleModelArg(value, "set");
|
|
190
|
-
const result = await writeMemoryConfig(paths, { reviewerModel: model, reviewerVariant: variant }, { merge: true });
|
|
191
|
-
console.log(describeWriteResult(result));
|
|
192
|
-
}
|
|
193
|
-
async function unsetMemoryReviewerModelOverride(paths) {
|
|
194
|
-
const currentMemory = (await readVvocConfig(paths))?.memory ?? createMemoryConfig();
|
|
195
|
-
const { reviewerModel: _reviewerModel, reviewerVariant: _reviewerVariant, ...rest } = currentMemory;
|
|
196
|
-
const result = await writeMemoryConfig(paths, rest);
|
|
197
|
-
console.log(describeWriteResult(result));
|
|
198
|
-
}
|
|
199
|
-
function resolveScope(value) {
|
|
200
|
-
return value === "project" ? "project" : "global";
|
|
201
|
-
}
|
|
202
|
-
function resolveDefaultModelKey(targetName) {
|
|
203
|
-
return targetName === "default" ? "model" : "small_model";
|
|
204
|
-
}
|
|
205
|
-
async function resolveCommandPaths(args) {
|
|
206
|
-
const configDir = typeof args["config-dir"] === "string" ? args["config-dir"] : undefined;
|
|
207
|
-
return resolvePaths({
|
|
208
|
-
scope: resolveScope(args.scope),
|
|
209
|
-
cwd: process.cwd(),
|
|
210
|
-
configDir,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
29
|
//# 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,0FAA0F;AAC1F,sEAAsE;AACtE,qBAAqB;AACrB,4BAA4B;AAC5B,kBAAkB;AAClB,sBAAsB;AACtB,sBAAsB;AACtB,EAAE;AACF,mBAAmB;AACnB,kDAAkD;AAClD,iBAAiB;AACjB,EAAE;AACF,uBAAuB;AACvB,+GAA+G;AAC/G,qBAAqB;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,eAAe,aAAa,CAAC;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,6CAA6C;KAC3D;IACD,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// FILE: src/commands/completion.ts
|
|
2
|
-
// VERSION: 0.5.
|
|
2
|
+
// VERSION: 0.5.14
|
|
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 and preset completion generation for config/plugin/patch-provider/preset and the `
|
|
5
|
+
// SCOPE: Shell detection, completion file writing, nested command and preset completion generation for config/plugin/patch-provider/preset and the `role set|unset` flow, and rc file patching.
|
|
6
6
|
// INPUTS: Current shell environment plus built-in vvoc command and preset names.
|
|
7
7
|
// OUTPUTS: Shell-specific completion scripts and idempotent rc/config patches.
|
|
8
|
-
// DEPENDS: [citty, node:fs/promises, node:path, node:os]
|
|
8
|
+
// DEPENDS: [citty, node:fs/promises, node:path, node:os, src/lib/model-roles.ts]
|
|
9
9
|
// LINKS: [M-CLI-COMPLETION, M-CLI-COMMANDS]
|
|
10
10
|
// ROLE: RUNTIME
|
|
11
11
|
// MAP_MODE: EXPORTS
|
|
@@ -14,21 +14,20 @@
|
|
|
14
14
|
// START_MODULE_MAP
|
|
15
15
|
// default - Completion install command definition for vvoc.
|
|
16
16
|
// detectShell - Detect current shell from SHELL env or process.
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
17
|
+
// generateBashCompletion - Build the bash completion script.
|
|
18
|
+
// generateZshCompletion - Build the zsh completion script.
|
|
19
|
+
// generateFishCompletion - Build the fish completion script.
|
|
20
20
|
// END_MODULE_MAP
|
|
21
21
|
//
|
|
22
22
|
// START_CHANGE_SUMMARY
|
|
23
|
-
// LAST_CHANGE: [v0.5.
|
|
23
|
+
// LAST_CHANGE: [v0.5.14 - Restricted unset-role completions so shell suggestions no longer imply built-in roles are unsettable.]
|
|
24
24
|
// END_CHANGE_SUMMARY
|
|
25
25
|
import { defineCommand } from "citty";
|
|
26
26
|
import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
27
27
|
import { homedir } from "node:os";
|
|
28
28
|
import { resolve } from "node:path";
|
|
29
|
-
import {
|
|
29
|
+
import { BUILTIN_ROLE_NAMES } from "../lib/model-roles.js";
|
|
30
30
|
const VVOC_TOP_LEVEL_COMMANDS = [
|
|
31
|
-
"agent",
|
|
32
31
|
"completion",
|
|
33
32
|
"config",
|
|
34
33
|
"doctor",
|
|
@@ -38,18 +37,19 @@ const VVOC_TOP_LEVEL_COMMANDS = [
|
|
|
38
37
|
"patch-provider",
|
|
39
38
|
"preset",
|
|
40
39
|
"plugin",
|
|
40
|
+
"role",
|
|
41
41
|
"status",
|
|
42
42
|
"sync",
|
|
43
43
|
"upgrade",
|
|
44
44
|
"version",
|
|
45
45
|
];
|
|
46
46
|
const VVOC_CONFIG_COMMANDS = ["validate"];
|
|
47
|
-
const VVOC_PATCH_PROVIDER_PRESETS = ["stepfun-ai", "zai"];
|
|
47
|
+
const VVOC_PATCH_PROVIDER_PRESETS = ["stepfun-ai", "zai", "openai"];
|
|
48
48
|
const VVOC_PRESET_COMMANDS = ["list", "show"];
|
|
49
|
-
const VVOC_PRESET_NAMES = ["openai", "zai", "minimax"];
|
|
49
|
+
const VVOC_PRESET_NAMES = ["vv-openai", "vv-zai", "vv-minimax"];
|
|
50
50
|
const VVOC_PLUGIN_COMMANDS = ["list"];
|
|
51
|
-
const
|
|
52
|
-
const
|
|
51
|
+
const VVOC_ROLE_COMMANDS = ["set", "unset", "list"];
|
|
52
|
+
const VVOC_ROLE_IDS = [...BUILTIN_ROLE_NAMES];
|
|
53
53
|
export default defineCommand({
|
|
54
54
|
meta: {
|
|
55
55
|
name: "completion",
|
|
@@ -151,8 +151,8 @@ export function generateBashCompletion() {
|
|
|
151
151
|
const presetCommands = [...VVOC_PRESET_COMMANDS, ...VVOC_PRESET_NAMES].join(" ");
|
|
152
152
|
const presetNames = VVOC_PRESET_NAMES.join(" ");
|
|
153
153
|
const pluginCommands = VVOC_PLUGIN_COMMANDS.join(" ");
|
|
154
|
-
const
|
|
155
|
-
const
|
|
154
|
+
const roleCommands = VVOC_ROLE_COMMANDS.join(" ");
|
|
155
|
+
const roleIds = VVOC_ROLE_IDS.join(" ");
|
|
156
156
|
return ("# bash completion for vvoc\n" +
|
|
157
157
|
"_vvoc() {\n" +
|
|
158
158
|
" local cur prev words cword\n" +
|
|
@@ -164,8 +164,8 @@ export function generateBashCompletion() {
|
|
|
164
164
|
" ;;\n" +
|
|
165
165
|
" 2)\n" +
|
|
166
166
|
' case "${words[1]}" in\n' +
|
|
167
|
-
"
|
|
168
|
-
"
|
|
167
|
+
" role)\n" +
|
|
168
|
+
" _vvoc_role_commands\n" +
|
|
169
169
|
" ;;\n" +
|
|
170
170
|
" config)\n" +
|
|
171
171
|
" _vvoc_config_commands\n" +
|
|
@@ -183,8 +183,8 @@ export function generateBashCompletion() {
|
|
|
183
183
|
" ;;\n" +
|
|
184
184
|
" 3)\n" +
|
|
185
185
|
' case "${words[1]}:${words[2]}" in\n' +
|
|
186
|
-
"
|
|
187
|
-
"
|
|
186
|
+
" role:set)\n" +
|
|
187
|
+
" _vvoc_role_ids\n" +
|
|
188
188
|
" ;;\n" +
|
|
189
189
|
" preset:show)\n" +
|
|
190
190
|
" _vvoc_preset_names\n" +
|
|
@@ -229,16 +229,16 @@ export function generateBashCompletion() {
|
|
|
229
229
|
' COMPREPLY=($(compgen -W "$commands" -- "$cur"))\n' +
|
|
230
230
|
"}\n" +
|
|
231
231
|
"\n" +
|
|
232
|
-
"
|
|
232
|
+
"_vvoc_role_commands() {\n" +
|
|
233
233
|
' local commands="' +
|
|
234
|
-
|
|
234
|
+
roleCommands +
|
|
235
235
|
'"\n' +
|
|
236
236
|
' COMPREPLY=($(compgen -W "$commands" -- "$cur"))\n' +
|
|
237
237
|
"}\n" +
|
|
238
238
|
"\n" +
|
|
239
|
-
"
|
|
239
|
+
"_vvoc_role_ids() {\n" +
|
|
240
240
|
' local commands="' +
|
|
241
|
-
|
|
241
|
+
roleIds +
|
|
242
242
|
'"\n' +
|
|
243
243
|
' COMPREPLY=($(compgen -W "$commands" -- "$cur"))\n' +
|
|
244
244
|
"}\n" +
|
|
@@ -264,15 +264,18 @@ export function generateZshCompletion() {
|
|
|
264
264
|
for (const cmd of VVOC_TOP_LEVEL_COMMANDS) {
|
|
265
265
|
lines.push(' "' + cmd + '"');
|
|
266
266
|
}
|
|
267
|
-
lines.push(" )", "", ' _arguments -C "1: :(' + VVOC_TOP_LEVEL_COMMANDS.join(" ") + ')" "*::arg:->args"', "", " case $line[1] in", "
|
|
267
|
+
lines.push(" )", "", ' _arguments -C "1: :(' + VVOC_TOP_LEVEL_COMMANDS.join(" ") + ')" "*::arg:->args"', "", " case $line[1] in", " role)", " _vvoc_role_cmds", " ;;", " config)", " _vvoc_config_cmds", " ;;", " patch-provider)", " _vvoc_patch_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_patch_provider_cmds() {", ' _arguments "1: :(' + VVOC_PATCH_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_role_cmds() {", " case $words[2] in", " set)", ' _arguments "1: :(' + VVOC_ROLE_IDS.join(" ") + ')"', " ;;", " unset)", ' _arguments "1: :<custom-role-id>"', " ;;", " *)", ' _arguments "1: :(' + VVOC_ROLE_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");
|
|
268
268
|
return lines.join("\n") + "\n";
|
|
269
269
|
}
|
|
270
270
|
export function generateFishCompletion() {
|
|
271
|
+
const presetCommands = [...VVOC_PRESET_COMMANDS, ...VVOC_PRESET_NAMES].join(" ");
|
|
271
272
|
const lines = ["# fish completion for vvoc", "", "function __vvoc_commands"];
|
|
272
273
|
for (const cmd of VVOC_TOP_LEVEL_COMMANDS) {
|
|
273
274
|
lines.push(" echo " + cmd);
|
|
274
275
|
}
|
|
275
|
-
lines.push("end", "", "function __vvoc_config_cmds", " echo " + VVOC_CONFIG_COMMANDS.join(" "), "end", "", "function __vvoc_patch_provider_cmds", " echo " + VVOC_PATCH_PROVIDER_PRESETS.join(" "), "end", "", "function __vvoc_preset_cmds", " echo " +
|
|
276
|
+
lines.push("end", "", "function __vvoc_config_cmds", " echo " + VVOC_CONFIG_COMMANDS.join(" "), "end", "", "function __vvoc_patch_provider_cmds", " echo " + VVOC_PATCH_PROVIDER_PRESETS.join(" "), "end", "", "function __vvoc_preset_cmds", " echo " + presetCommands, "end", "", "function __vvoc_preset_names", " echo " + VVOC_PRESET_NAMES.join(" "), "end", "", "function __vvoc_role_cmds", " echo " + VVOC_ROLE_COMMANDS.join(" "), "end", "", "function __vvoc_role_ids", " echo " + VVOC_ROLE_IDS.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 role; and not __fish_seen_subcommand_from set unset list" -f -a "(__vvoc_role_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from role; and __fish_seen_subcommand_from set" -f -a "(__vvoc_role_ids)"', 'complete -c vvoc -n "__fish_seen_subcommand_from config" -f -a "(__vvoc_config_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from patch-provider" -f -a "(__vvoc_patch_provider_cmds)"', 'complete -c vvoc -n "__fish_seen_subcommand_from preset; and not __fish_seen_subcommand_from ' +
|
|
277
|
+
presetCommands +
|
|
278
|
+
'" -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)"');
|
|
276
279
|
return lines.join("\n") + "\n";
|
|
277
280
|
}
|
|
278
281
|
//# sourceMappingURL=completion.js.map
|