@osovv/vv-opencode 0.1.0 → 0.2.2

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.
Files changed (43) hide show
  1. package/README.md +244 -20
  2. package/dist/commands/doctor.d.ts +1 -7
  3. package/dist/commands/doctor.js +6 -20
  4. package/dist/commands/doctor.js.map +1 -1
  5. package/dist/commands/guardian.js +1 -1
  6. package/dist/commands/guardian.js.map +1 -1
  7. package/dist/commands/install.d.ts +6 -7
  8. package/dist/commands/install.js +17 -17
  9. package/dist/commands/install.js.map +1 -1
  10. package/dist/commands/status.d.ts +1 -1
  11. package/dist/commands/status.js +5 -5
  12. package/dist/commands/status.js.map +1 -1
  13. package/dist/commands/sync.d.ts +2 -8
  14. package/dist/commands/sync.js +7 -16
  15. package/dist/commands/sync.js.map +1 -1
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/lib/opencode.d.ts +15 -13
  20. package/dist/lib/opencode.js +105 -110
  21. package/dist/lib/opencode.js.map +1 -1
  22. package/dist/lib/vvoc-paths.d.ts +9 -0
  23. package/dist/lib/vvoc-paths.js +48 -0
  24. package/dist/lib/vvoc-paths.js.map +1 -0
  25. package/dist/plugins/guardian.js +20 -21
  26. package/dist/plugins/guardian.js.map +1 -1
  27. package/dist/plugins/memory-store.d.ts +55 -0
  28. package/dist/plugins/memory-store.js +472 -0
  29. package/dist/plugins/memory-store.js.map +1 -0
  30. package/dist/plugins/memory.d.ts +2 -0
  31. package/dist/plugins/memory.js +323 -0
  32. package/dist/plugins/memory.js.map +1 -0
  33. package/package.json +16 -6
  34. package/AGENTS.md +0 -164
  35. package/dist/lib/opencode.test.d.ts +0 -1
  36. package/dist/lib/opencode.test.js +0 -47
  37. package/dist/lib/opencode.test.js.map +0 -1
  38. package/docs/development-plan.xml +0 -155
  39. package/docs/knowledge-graph.xml +0 -42
  40. package/docs/operational-packets.xml +0 -106
  41. package/docs/requirements.xml +0 -66
  42. package/docs/technology.xml +0 -51
  43. package/docs/verification-plan.xml +0 -145
@@ -1,155 +0,0 @@
1
- <DevelopmentPlan VERSION="0.2.0">
2
- <ArchitectureNotes>
3
- <objective>Package the existing Guardian plugin without behavior drift, while adding a small CLI that manages portable OpenCode config safely.</objective>
4
- <non-goal>Do not expand into a large monorepo or broad profile manager before the first plugin packaging path is stable.</non-goal>
5
- <risk-1>Config file mutation must stay conservative because users may already have hand-maintained JSONC with comments.</risk-1>
6
- </ArchitectureNotes>
7
-
8
- <Modules>
9
- <M-CLI-CONFIG NAME="OpenCodeConfigTools" TYPE="UTILITY" LAYER="0" ORDER="1" STATUS="implemented">
10
- <contract>
11
- <purpose>Resolve OpenCode config paths, edit JSONC safely, render managed Guardian config, and inspect installation state.</purpose>
12
- <inputs>
13
- <param name="scope" type="global | project" />
14
- <param name="cwd" type="string" />
15
- <param name="configDir" type="string | undefined" />
16
- </inputs>
17
- <outputs>
18
- <param name="ResolvedPaths | WriteResult | InstallationInspection" type="object" />
19
- </outputs>
20
- <errors>
21
- <error code="INVALID_JSONC" />
22
- <error code="INVALID_GUARDIAN_CONFIG" />
23
- </errors>
24
- </contract>
25
- <interface>
26
- <export-resolvePaths PURPOSE="Resolve config and Guardian file paths for the selected scope." />
27
- <export-ensurePackageInstalled PURPOSE="Ensure the npm plugin is registered in OpenCode config." />
28
- <export-syncGuardianConfig PURPOSE="Rewrite managed Guardian config while preserving current values." />
29
- </interface>
30
- <depends>none</depends>
31
- <target>
32
- <source>src/lib/opencode.ts</source>
33
- <tests>src/lib/opencode.test.ts</tests>
34
- </target>
35
- <observability>
36
- <log-prefix>[OpenCodeConfigTools]</log-prefix>
37
- <critical-block>BLOCK_SYNC_GUARDIAN_CONFIG</critical-block>
38
- </observability>
39
- <verification-ref>V-M-CLI-CONFIG</verification-ref>
40
- <notes>
41
- <note-1>Main config edits should preserve comments when only the plugin array changes.</note-1>
42
- </notes>
43
- </M-CLI-CONFIG>
44
-
45
- <M-CLI-COMMANDS NAME="VVOCCommands" TYPE="ENTRY_POINT" LAYER="1" ORDER="1" STATUS="implemented">
46
- <contract>
47
- <purpose>Expose install, sync, status, doctor, and Guardian config subcommands through citty.</purpose>
48
- <inputs>
49
- <param name="argv" type="string[]" />
50
- </inputs>
51
- <outputs>
52
- <param name="stdout/stderr" type="terminal output" />
53
- </outputs>
54
- <errors>
55
- <error code="INVALID_ARGUMENT" />
56
- </errors>
57
- </contract>
58
- <interface>
59
- <export-install PURPOSE="Bootstrap plugin registration and optional Guardian config." />
60
- <export-sync PURPOSE="Refresh managed config files." />
61
- <export-doctor PURPOSE="Diagnose installation drift or invalid config." />
62
- </interface>
63
- <depends>M-CLI-CONFIG</depends>
64
- <target>
65
- <source>src/cli.ts + src/commands/*.ts</source>
66
- <tests>src/lib/opencode.test.ts</tests>
67
- </target>
68
- <observability>
69
- <log-prefix>[VVOC]</log-prefix>
70
- <critical-block>BLOCK_APPLY_COMMAND</critical-block>
71
- </observability>
72
- <verification-ref>V-M-CLI-COMMANDS</verification-ref>
73
- <notes>
74
- <note-1>Commands should stay thin and delegate file logic to `M-CLI-CONFIG`.</note-1>
75
- </notes>
76
- </M-CLI-COMMANDS>
77
-
78
- <M-PLUGIN-GUARDIAN NAME="GuardianPlugin" TYPE="INTEGRATION" LAYER="0" ORDER="2" STATUS="implemented">
79
- <contract>
80
- <purpose>Review OpenCode permission requests with a constrained Guardian agent and auto-allow only low-risk actions.</purpose>
81
- <inputs>
82
- <param name="PluginInput" type="@opencode-ai/plugin input" />
83
- </inputs>
84
- <outputs>
85
- <param name="Hooks" type="OpenCode plugin hooks" />
86
- </outputs>
87
- <errors>
88
- <error code="GUARDIAN_REVIEW_FAILED" />
89
- <error code="PERMISSION_REPLY_FAILED" />
90
- </errors>
91
- </contract>
92
- <interface>
93
- <export-GuardianPlugin PURPOSE="Register Guardian hooks, config agent, and permission review flow." />
94
- </interface>
95
- <depends>none</depends>
96
- <target>
97
- <source>src/plugins/guardian.ts</source>
98
- <tests>typecheck-only in v1</tests>
99
- </target>
100
- <observability>
101
- <log-prefix>[guardian]</log-prefix>
102
- <critical-block>BLOCK_REVIEW_PERMISSION</critical-block>
103
- </observability>
104
- <verification-ref>V-M-PLUGIN-GUARDIAN</verification-ref>
105
- <notes>
106
- <note-1>This module is a direct port of the existing standalone plugin and should change minimally at first.</note-1>
107
- </notes>
108
- </M-PLUGIN-GUARDIAN>
109
- </Modules>
110
-
111
- <DataFlow>
112
- <DF-PLUGIN-INSTALL NAME="PluginInstall" TRIGGER="vvoc install">
113
- <step-1>Resolve scope-specific OpenCode and Guardian config paths.</step-1>
114
- <step-2>Ensure `@osovv/vv-opencode` exists in the OpenCode `plugin` array.</step-2>
115
- <step-3>Create `guardian.jsonc` when it does not already exist.</step-3>
116
- <evidence>`vvoc status`, parsed config content, and successful typecheck/build.</evidence>
117
- </DF-PLUGIN-INSTALL>
118
- <DF-CONFIG-SYNC NAME="ManagedConfigSync" TRIGGER="vvoc sync">
119
- <step-1>Inspect whether Guardian config is CLI-managed.</step-1>
120
- <step-2>Parse current Guardian values from JSONC.</step-2>
121
- <step-3>Rewrite managed file canonically while preserving current values.</step-3>
122
- <evidence>Stable rewritten `guardian.jsonc` and no overwrite of unmanaged files without force.</evidence>
123
- </DF-CONFIG-SYNC>
124
- <DF-GUARDIAN-SETTINGS NAME="GuardianConfigWrite" TRIGGER="vvoc guardian config">
125
- <step-1>Parse CLI overrides for model, variant, timeout, and thresholds.</step-1>
126
- <step-2>Render a managed Guardian config template.</step-2>
127
- <step-3>Write or print the config depending on mode.</step-3>
128
- <evidence>JSONC parse succeeds and plugin can load the written file later.</evidence>
129
- </DF-GUARDIAN-SETTINGS>
130
- <DF-GUARDIAN-REVIEW NAME="GuardianPermissionReview" TRIGGER="permission.asked event">
131
- <step-1>Capture relevant tool and command intent for the session.</step-1>
132
- <step-2>Build a bounded transcript and planned action prompt.</step-2>
133
- <step-3>Run Guardian, interpret risk, and auto-reply only when below threshold.</step-3>
134
- <evidence>Guardian logs, toasts, and permission reply behavior inside OpenCode.</evidence>
135
- </DF-GUARDIAN-REVIEW>
136
- </DataFlow>
137
-
138
- <ImplementationOrder>
139
- <Phase-1 name="CLI Foundation" status="done">
140
- <goal>Establish safe config mutation helpers and wire them into a usable Bun CLI.</goal>
141
- <step-1 module="M-CLI-CONFIG" status="done" verification="V-M-CLI-CONFIG">Implement path resolution, JSONC edits, inspection, and Guardian template helpers.</step-1>
142
- <step-2 module="M-CLI-COMMANDS" status="done" verification="V-M-CLI-COMMANDS">Expose install, sync, status, doctor, and Guardian config commands.</step-2>
143
- </Phase-1>
144
- <Phase-2 name="Guardian Packaging" status="done">
145
- <goal>Move the existing standalone Guardian plugin into the repository and export it from the package.</goal>
146
- <step-1 module="M-PLUGIN-GUARDIAN" status="done" verification="V-M-PLUGIN-GUARDIAN">Port the current Guardian plugin source into `src/plugins/guardian.ts`.</step-1>
147
- </Phase-2>
148
- </ImplementationOrder>
149
-
150
- <ExecutionPolicy>
151
- <default-profile>balanced</default-profile>
152
- <controller-owns>docs/development-plan.xml, docs/knowledge-graph.xml, docs/verification-plan.xml</controller-owns>
153
- <worker-owns>Only package source files, tests, and narrowly scoped documentation updates required by the approved module changes.</worker-owns>
154
- </ExecutionPolicy>
155
- </DevelopmentPlan>
@@ -1,42 +0,0 @@
1
- <KnowledgeGraph>
2
- <Project NAME="@osovv/vv-opencode" VERSION="0.2.0">
3
- <keywords>opencode, plugins, workflow</keywords>
4
- <annotation>Portable OpenCode workflow package with plugins and a Bun CLI for install, sync, and cross-device setup.</annotation>
5
-
6
- <M-CLI-CONFIG NAME="OpenCodeConfigTools" TYPE="UTILITY" STATUS="implemented">
7
- <purpose>Path resolution, JSONC-aware config mutation, managed Guardian config rendering, and installation inspection.</purpose>
8
- <path>src/lib/opencode.ts</path>
9
- <depends>none</depends>
10
- <verification-ref>V-M-CLI-CONFIG</verification-ref>
11
- <annotations>
12
- <fn-resolvePaths PURPOSE="Resolve scope-aware config file paths for OpenCode and Guardian." />
13
- <fn-ensurePackageInstalled PURPOSE="Add the package name to the OpenCode plugin array if needed." />
14
- <fn-syncGuardianConfig PURPOSE="Rewrite managed Guardian config while preserving current values." />
15
- </annotations>
16
- </M-CLI-CONFIG>
17
-
18
- <M-CLI-COMMANDS NAME="VVOCCommands" TYPE="ENTRY_POINT" STATUS="implemented">
19
- <purpose>Compose the `vvoc` CLI and expose install, sync, status, doctor, and Guardian config commands.</purpose>
20
- <path>src/cli.ts + src/commands/*.ts</path>
21
- <depends>M-CLI-CONFIG</depends>
22
- <verification-ref>V-M-CLI-COMMANDS</verification-ref>
23
- <annotations>
24
- <export-install PURPOSE="Bootstrap package registration and optional Guardian config." />
25
- <export-sync PURPOSE="Refresh managed config files." />
26
- <export-guardian PURPOSE="Expose Guardian-specific helper commands." />
27
- </annotations>
28
- </M-CLI-COMMANDS>
29
-
30
- <M-PLUGIN-GUARDIAN NAME="GuardianPlugin" TYPE="INTEGRATION" STATUS="implemented">
31
- <purpose>Review OpenCode permission requests using a constrained Guardian agent and safe fallback behavior.</purpose>
32
- <path>src/plugins/guardian.ts</path>
33
- <depends>none</depends>
34
- <verification-ref>V-M-PLUGIN-GUARDIAN</verification-ref>
35
- <annotations>
36
- <export-GuardianPlugin PURPOSE="Register Guardian hooks for config, events, tool intent capture, and permission review." />
37
- </annotations>
38
- </M-PLUGIN-GUARDIAN>
39
-
40
- <CrossLink from="M-CLI-COMMANDS" to="M-CLI-CONFIG" relation="uses" />
41
- </Project>
42
- </KnowledgeGraph>
@@ -1,106 +0,0 @@
1
- <OperationalPackets VERSION="0.1.0">
2
- <ExecutionPacketTemplate>
3
- <ExecutionPacket>
4
- <module-id>M-EXAMPLE</module-id>
5
- <module-name>ExampleDomain</module-name>
6
- <purpose>Implement the approved module without architectural drift.</purpose>
7
- <write-scope>
8
- <file-1>src/example/index.ts</file-1>
9
- <file-2>src/example/index.test.ts</file-2>
10
- </write-scope>
11
- <contract-excerpt><![CDATA[
12
- Planned module contract excerpt goes here.
13
- ]]></contract-excerpt>
14
- <graph-entry-excerpt><![CDATA[
15
- Knowledge graph entry excerpt goes here.
16
- ]]></graph-entry-excerpt>
17
- <dependency-contract-summaries>
18
- <dependency-1 module="M-LOGGER">Structured logger interface with stable marker fields.</dependency-1>
19
- </dependency-contract-summaries>
20
- <verification-excerpt><![CDATA[
21
- Verification-plan excerpt goes here.
22
- ]]></verification-excerpt>
23
- <expected-graph-delta-fields>
24
- <field-1>imports</field-1>
25
- <field-2>exports</field-2>
26
- <field-3>annotations</field-3>
27
- <field-4>CrossLinks</field-4>
28
- </expected-graph-delta-fields>
29
- <expected-verification-delta-fields>
30
- <field-1>test-files</field-1>
31
- <field-2>module-checks</field-2>
32
- <field-3>required-log-markers</field-3>
33
- <field-4>follow-up-checks</field-4>
34
- </expected-verification-delta-fields>
35
- <notes>
36
- <note-1>Workers should only read more context when the packet is insufficient.</note-1>
37
- </notes>
38
- </ExecutionPacket>
39
- </ExecutionPacketTemplate>
40
-
41
- <GraphDeltaTemplate>
42
- <GraphDelta module="M-EXAMPLE">
43
- <imports-added>
44
- <import-1>M-LOGGER</import-1>
45
- </imports-added>
46
- <imports-removed />
47
- <exports-added>
48
- <export-1>runExample</export-1>
49
- </exports-added>
50
- <exports-removed />
51
- <annotations-added>
52
- <annotation-1>&lt;fn-runExample PURPOSE="Execute the example flow" /&gt;</annotation-1>
53
- </annotations-added>
54
- <annotations-removed />
55
- <cross-links-added>
56
- <CrossLink from="M-EXAMPLE" to="M-LOGGER" relation="uses" />
57
- </cross-links-added>
58
- <cross-links-removed />
59
- <notes>
60
- <note-1>Only list graph facts that really changed in the code.</note-1>
61
- </notes>
62
- </GraphDelta>
63
- </GraphDeltaTemplate>
64
-
65
- <VerificationDeltaTemplate>
66
- <VerificationDelta module="M-EXAMPLE">
67
- <test-files-added>
68
- <file-1>src/example/index.test.ts</file-1>
69
- </test-files-added>
70
- <test-files-removed />
71
- <module-checks>
72
- <command-1>bun test src/example/index.test.ts</command-1>
73
- <command-2>bun x tsc --noEmit</command-2>
74
- </module-checks>
75
- <required-log-markers>
76
- <marker-1>[ExampleDomain][runExample][BLOCK_EXECUTE_FLOW]</marker-1>
77
- </required-log-markers>
78
- <required-trace-assertions>
79
- <assertion-1>Failure path must not emit BLOCK_PERSIST_RESULT.</assertion-1>
80
- </required-trace-assertions>
81
- <wave-follow-up>
82
- <item-1>Run merged-surface integration check for the logger adapter.</item-1>
83
- </wave-follow-up>
84
- <phase-follow-up>
85
- <item-1>Run the broader regression suite before marking the phase done.</item-1>
86
- </phase-follow-up>
87
- </VerificationDelta>
88
- </VerificationDeltaTemplate>
89
-
90
- <FailurePacketTemplate>
91
- <FailurePacket>
92
- <scenario>Primary success path fails on valid input.</scenario>
93
- <contract-ref>M-EXAMPLE / V-M-EXAMPLE / scenario-1</contract-ref>
94
- <expected-evidence>
95
- <marker-1>[ExampleDomain][runExample][BLOCK_VALIDATE_INPUT]</marker-1>
96
- <assertion-1>Expected return value should equal "ok".</assertion-1>
97
- </expected-evidence>
98
- <observed-evidence>
99
- <log-1>[ExampleDomain][runExample][BLOCK_VALIDATE_INPUT] emitted</log-1>
100
- <trace-1>BLOCK_VALIDATE_INPUT -&gt; threw EXAMPLE_INVALID_STATE</trace-1>
101
- </observed-evidence>
102
- <first-divergent-block>BLOCK_VALIDATE_INPUT</first-divergent-block>
103
- <suggested-next-action>Read the contract, inspect the divergent block, and apply the smallest safe fix.</suggested-next-action>
104
- </FailurePacket>
105
- </FailurePacketTemplate>
106
- </OperationalPackets>
@@ -1,66 +0,0 @@
1
- <RequirementsAnalysis VERSION="0.2.0">
2
- <Project>
3
- <name>@osovv/vv-opencode</name>
4
- <annotation>Portable OpenCode workflow package with plugins and a Bun CLI for install, sync, and cross-device setup.</annotation>
5
- <keywords>opencode, plugins, workflow</keywords>
6
- </Project>
7
-
8
- <Actors>
9
- <actor-User>Engineer who wants a portable OpenCode workflow across devices and repositories.</actor-User>
10
- <actor-System>CLI and plugin runtime that install, sync, and execute the configured workflow safely.</actor-System>
11
- </Actors>
12
-
13
- <UseCases>
14
- <UC-001>
15
- <Actor>User</Actor>
16
- <Action>Runs `vvoc install` for global or project scope.</Action>
17
- <Goal>To register `@osovv/vv-opencode` in OpenCode config and bootstrap Guardian config when needed.</Goal>
18
- <Preconditions>Bun and OpenCode are available, and the target config location is writable.</Preconditions>
19
- <AcceptanceCriteria>The package name appears in the resolved OpenCode config and a default Guardian config can be created idempotently.</AcceptanceCriteria>
20
- <Priority>high</Priority>
21
- <RelatedFlows>DF-PLUGIN-INSTALL</RelatedFlows>
22
- </UC-001>
23
- <UC-002>
24
- <Actor>User</Actor>
25
- <Action>Runs `vvoc sync` on another machine or after package updates.</Action>
26
- <Goal>To refresh managed workflow files without clobbering manually-owned config.</Goal>
27
- <Preconditions>The target config files already exist or can be created.</Preconditions>
28
- <AcceptanceCriteria>Managed files are rewritten canonically, existing values are preserved, and unmanaged files are skipped unless force is explicit.</AcceptanceCriteria>
29
- <Priority>high</Priority>
30
- <RelatedFlows>DF-CONFIG-SYNC</RelatedFlows>
31
- </UC-002>
32
- <UC-003>
33
- <Actor>User</Actor>
34
- <Action>Runs `vvoc guardian config` with optional model, variant, timeout, or threshold overrides.</Action>
35
- <Goal>To customize Guardian behavior without editing JSONC by hand.</Goal>
36
- <Preconditions>A target OpenCode config scope has been chosen.</Preconditions>
37
- <AcceptanceCriteria>The generated `guardian.jsonc` is valid, readable by the plugin, and safe to resync later.</AcceptanceCriteria>
38
- <Priority>high</Priority>
39
- <RelatedFlows>DF-GUARDIAN-SETTINGS</RelatedFlows>
40
- </UC-003>
41
- </UseCases>
42
-
43
- <NonGoals>
44
- <item-1>No public plugin marketplace, profile manager, or multi-package monorepo in v1.</item-1>
45
- <item-2>No forced overwrite of unmanaged user config files without an explicit force flag.</item-2>
46
- <item-3>No attempt to redesign Guardian logic before it is safely packaged and reproducible from this repository.</item-3>
47
- </NonGoals>
48
-
49
- <Constraints>
50
- <constraint-1>OpenCode config integration must follow documented global and project path conventions.</constraint-1>
51
- <constraint-2>Guardian must remain compatible with the current standalone plugin behavior while being moved into the repo.</constraint-2>
52
- <constraint-3>Config writes must be idempotent and preserve existing JSONC comments in the main OpenCode config where practical.</constraint-3>
53
- <constraint-4>Generated Guardian config should be clearly marked as CLI-managed so sync can distinguish owned and non-owned files.</constraint-4>
54
- </Constraints>
55
-
56
- <Risks>
57
- <risk-1>Repositories or machines may contain multiple config files (`.json` and `.jsonc`) that can drift from each other.</risk-1>
58
- <risk-2>Unsafe rewrites of user-maintained config could damage trust in the CLI.</risk-2>
59
- <risk-3>Guardian depends on OpenCode plugin and SDK surface area that may evolve over time.</risk-3>
60
- </Risks>
61
-
62
- <OpenQuestions>
63
- <question-1>Should future versions also manage agents, commands, skills, and themes in addition to plugins and Guardian config?</question-1>
64
- <question-2>Should the package eventually export multiple plugins from the same npm entrypoint or separate them by subpath and opt-in config?</question-2>
65
- </OpenQuestions>
66
- </RequirementsAnalysis>
@@ -1,51 +0,0 @@
1
- <TechnologyStack VERSION="0.2.0">
2
- <Runtime>Bun 1.3.8</Runtime>
3
- <Language>TypeScript 5.8.2</Language>
4
- <Framework>citty 0.2.2</Framework>
5
-
6
- <Dependencies>
7
- <dep name="@opencode-ai/plugin" version="1.3.17" purpose="Type-safe OpenCode plugin API and hook definitions" />
8
- <dep name="@opencode-ai/sdk" version="1.3.17" purpose="OpenCode client types and runtime interactions used by Guardian" />
9
- <dep name="citty" version="0.2.2" purpose="CLI command tree and argument parsing for `vvoc`" />
10
- <dep name="jsonc-parser" version="3.3.1" purpose="Safe JSONC-aware config parsing and in-place edits" />
11
- </Dependencies>
12
-
13
- <VersionConstraints>
14
- <constraint lib="bun" min="1.3.8" max="1.3.x" reason="The package and local verification target Bun-based runtime and test execution." />
15
- <constraint lib="@opencode-ai/plugin" min="1.3.17" max="1.3.x" reason="Guardian depends on the current plugin hook and input shape." />
16
- <constraint lib="@opencode-ai/sdk" min="1.3.17" max="1.3.x" reason="Guardian uses current SDK message, part, and config types." />
17
- </VersionConstraints>
18
-
19
- <Tooling>
20
- <tool name="package-manager" value="bun" version="1.3.8" />
21
- <tool name="compiler" value="typescript" version="5.8.2" />
22
- <tool name="test-runner" value="bun test" version="1.3.8" />
23
- </Tooling>
24
-
25
- <Testing>
26
- <module-level>
27
- <command>bun test src/lib/opencode.test.ts</command>
28
- <focus>Fast deterministic checks for config merge and Guardian config rendering.</focus>
29
- </module-level>
30
- <wave-level>
31
- <command>bun run typecheck &amp;&amp; bun test</command>
32
- <focus>Checks merged CLI and helper behavior after coordinated changes.</focus>
33
- </wave-level>
34
- <phase-level>
35
- <command>bun run build &amp;&amp; bun test</command>
36
- <focus>Validates package output and regression-safe baseline behavior.</focus>
37
- </phase-level>
38
- <mocking-policy>Prefer direct pure-function verification and fixture text over broad mocks.</mocking-policy>
39
- </Testing>
40
-
41
- <Observability>
42
- <logger>OpenCode app log via `client.app.log()` plus Guardian best-effort debug file in `/tmp`.</logger>
43
- <log-format>[service][function][block] message</log-format>
44
- <required-fields>service, level, message, requestID, sessionID</required-fields>
45
- <redaction>Never log secrets, credentials, or raw high-risk payloads beyond the existing Guardian truncation policy.</redaction>
46
- </Observability>
47
-
48
- <DeliveryShape>
49
- <shape>One public npm package that exports OpenCode plugins and ships a Bun CLI binary named `vvoc`.</shape>
50
- </DeliveryShape>
51
- </TechnologyStack>
@@ -1,145 +0,0 @@
1
- <VerificationPlan VERSION="0.2.0">
2
- <GlobalPolicy>
3
- <log-format>[service][function][block] message</log-format>
4
- <deterministic-first>true</deterministic-first>
5
- <module-level-focus>Fast deterministic checks for config mutation and rendering helpers.</module-level-focus>
6
- <wave-level-focus>Typecheck and test the merged CLI + helper surface after each coordinated change.</wave-level-focus>
7
- <phase-level-focus>Buildable package output plus stable command behavior for installation and sync workflows.</phase-level-focus>
8
- <redaction>Never log secrets, credentials, raw tokens, or high-risk payloads outside the existing Guardian truncation policy.</redaction>
9
- </GlobalPolicy>
10
-
11
- <CriticalFlows>
12
- <VF-PLUGIN-INSTALL NAME="PluginInstall" USE_CASES="UC-001" DATA_FLOW="DF-PLUGIN-INSTALL" PRIORITY="high">
13
- <scenario>User installs the package into a fresh or existing OpenCode config.</scenario>
14
- <expected-outcome>The package name is present in the resolved `plugin` array and OpenCode can later load the plugin from npm.</expected-outcome>
15
- <required-signals>
16
- <trace-sequence>resolvePaths -&gt; ensurePackageInstalled -&gt; status reports configured</trace-sequence>
17
- </required-signals>
18
- </VF-PLUGIN-INSTALL>
19
- <VF-CONFIG-SYNC NAME="ManagedConfigSync" USE_CASES="UC-002" DATA_FLOW="DF-CONFIG-SYNC" PRIORITY="high">
20
- <scenario>User syncs a managed Guardian config after changing package versions or moving to another device.</scenario>
21
- <expected-outcome>The managed file is rewritten canonically and current values survive the rewrite.</expected-outcome>
22
- <required-signals>
23
- <trace-sequence>inspect managed file -&gt; parse current values -&gt; render canonical JSONC</trace-sequence>
24
- </required-signals>
25
- </VF-CONFIG-SYNC>
26
- <VF-GUARDIAN-REVIEW NAME="GuardianReview" USE_CASES="UC-003" DATA_FLOW="DF-GUARDIAN-REVIEW" PRIORITY="high">
27
- <scenario>OpenCode asks for a permission decision while Guardian is active.</scenario>
28
- <expected-outcome>Low-risk actions may be auto-approved and higher-risk actions fall back to manual approval.</expected-outcome>
29
- <required-signals>
30
- <log-marker>guardian review started</log-marker>
31
- <log-marker>guardian review completed</log-marker>
32
- </required-signals>
33
- </VF-GUARDIAN-REVIEW>
34
- <VF-SAFE-UPDATES NAME="SafeUpdates" USE_CASES="UC-002" DATA_FLOW="DF-CONFIG-SYNC" PRIORITY="high">
35
- <scenario>User already owns a manually-maintained Guardian config file.</scenario>
36
- <expected-outcome>The CLI skips rewriting it unless force is explicit.</expected-outcome>
37
- <required-signals>
38
- <trace-sequence>detect unmanaged file -&gt; skip write</trace-sequence>
39
- </required-signals>
40
- </VF-SAFE-UPDATES>
41
- <VF-CROSS-DEVICE-SETUP NAME="CrossDeviceSetup" USE_CASES="UC-001, UC-002" DATA_FLOW="DF-PLUGIN-INSTALL" PRIORITY="high">
42
- <scenario>User repeats install or sync on another machine.</scenario>
43
- <expected-outcome>The same package and config layout can be recreated with predictable CLI output.</expected-outcome>
44
- <required-signals>
45
- <trace-sequence>install -&gt; status -&gt; doctor</trace-sequence>
46
- </required-signals>
47
- </VF-CROSS-DEVICE-SETUP>
48
- </CriticalFlows>
49
-
50
- <ModuleVerification>
51
- <V-M-CLI-CONFIG MODULE="M-CLI-CONFIG" PRIORITY="high">
52
- <test-files>
53
- <file>src/lib/opencode.test.ts</file>
54
- </test-files>
55
- <module-checks>
56
- <check-1>bun test src/lib/opencode.test.ts</check-1>
57
- <check-2>bun x tsc --noEmit</check-2>
58
- </module-checks>
59
- <scenarios>
60
- <scenario-1 kind="success">Fresh install config renders with schema and plugin array.</scenario-1>
61
- <scenario-2 kind="success">Existing JSONC comments survive plugin insertion.</scenario-2>
62
- <scenario-3 kind="success">Guardian config round-trips explicit override values.</scenario-3>
63
- <scenario-4 kind="failure">Invalid plugin array or invalid Guardian config shape fails loudly.</scenario-4>
64
- </scenarios>
65
- <required-log-markers />
66
- <required-trace-assertions>
67
- <assertion-1>Sync must not overwrite unmanaged Guardian config without force.</assertion-1>
68
- </required-trace-assertions>
69
- <wave-follow-up>Smoke command output for `status` and `doctor` after build.</wave-follow-up>
70
- <phase-follow-up>Extend tests to cover more path and scope permutations.</phase-follow-up>
71
- </V-M-CLI-CONFIG>
72
-
73
- <V-M-CLI-COMMANDS MODULE="M-CLI-COMMANDS" PRIORITY="medium">
74
- <test-files>
75
- <file>src/lib/opencode.test.ts</file>
76
- </test-files>
77
- <module-checks>
78
- <check-1>bun run build</check-1>
79
- <check-2>bun test</check-2>
80
- </module-checks>
81
- <scenarios>
82
- <scenario-1 kind="success">CLI compiles and registers all planned top-level subcommands.</scenario-1>
83
- <scenario-2 kind="success">`guardian config --print` emits valid JSONC content.</scenario-2>
84
- </scenarios>
85
- <required-log-markers />
86
- <required-trace-assertions>
87
- <assertion-1>Command handlers should delegate file mutation to helper utilities instead of duplicating filesystem logic.</assertion-1>
88
- </required-trace-assertions>
89
- <wave-follow-up>Verify `vvoc install`, `vvoc sync`, and `vvoc doctor` against a temp config directory.</wave-follow-up>
90
- <phase-follow-up>Add command-level smoke tests once temp-dir fixtures are introduced.</phase-follow-up>
91
- </V-M-CLI-COMMANDS>
92
-
93
- <V-M-PLUGIN-GUARDIAN MODULE="M-PLUGIN-GUARDIAN" PRIORITY="high">
94
- <test-files>
95
- <file>typecheck-only in v1</file>
96
- </test-files>
97
- <module-checks>
98
- <check-1>bun x tsc --noEmit</check-1>
99
- </module-checks>
100
- <scenarios>
101
- <scenario-1 kind="success">Guardian plugin exports compile against current OpenCode plugin and SDK types.</scenario-1>
102
- <scenario-2 kind="failure">Review failures fall back to manual approval instead of silently allowing.</scenario-2>
103
- </scenarios>
104
- <required-log-markers>
105
- <marker-1>guardian plugin initialized</marker-1>
106
- <marker-2>guardian review started</marker-2>
107
- <marker-3>guardian review completed</marker-3>
108
- </required-log-markers>
109
- <required-trace-assertions>
110
- <assertion-1>Auto-allow only occurs when Guardian returns a risk score below the configured threshold.</assertion-1>
111
- </required-trace-assertions>
112
- <wave-follow-up>Add isolated behavioral tests around assessment parsing and decision thresholds.</wave-follow-up>
113
- <phase-follow-up>Consider extracting pure Guardian parsing helpers for direct unit coverage.</phase-follow-up>
114
- </V-M-PLUGIN-GUARDIAN>
115
- </ModuleVerification>
116
-
117
- <PhaseGates>
118
- <Gate-Phase-1 PHASE="Phase-1">
119
- <goal>CLI foundation is buildable and the helper layer has deterministic checks.</goal>
120
- <commands>
121
- <command-1>bun x tsc --noEmit</command-1>
122
- <command-2>bun test</command-2>
123
- </commands>
124
- <required-evidence>
125
- <evidence-1>Config merge and Guardian config rendering are covered by module-local tests.</evidence-1>
126
- </required-evidence>
127
- </Gate-Phase-1>
128
- <Gate-Phase-2 PHASE="Phase-2">
129
- <goal>Guardian is packaged from the repo and exported without behavior drift.</goal>
130
- <commands>
131
- <command-1>bun run build</command-1>
132
- <command-2>bun x tsc --noEmit</command-2>
133
- </commands>
134
- <required-evidence>
135
- <evidence-1>`src/plugins/guardian.ts` is present and package root exports `GuardianPlugin`.</evidence-1>
136
- </required-evidence>
137
- </Gate-Phase-2>
138
- </PhaseGates>
139
-
140
- <FailurePackets>
141
- <packet-template>
142
- <expected-fields>scenario, expected-evidence, observed-evidence, first-divergent-block, next-action</expected-fields>
143
- </packet-template>
144
- </FailurePackets>
145
- </VerificationPlan>