opencode-effect-enforcer 0.2.4 → 0.2.6
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 -140
- package/docs/effect-4.0.0-rc.116-changelog.md +2654 -0
- package/docs/effect-4.0.0-rc.116.md +102 -0
- package/guidance/effect-first-development.md +23 -14
- package/guidance/progressive-disclosure-guidance.md +3 -3
- package/package.json +3 -3
- package/patterns/avoid-direct-tag-checks.md +1 -1
- package/patterns/avoid-process-env.md +4 -4
- package/patterns/context-tag-extends.md +4 -4
- package/patterns/prefer-redacted-config.md +10 -10
- package/patterns/require-effect-concurrency.md +1 -1
- package/skills/effect-ai-chat/SKILL.md +2 -2
- package/skills/effect-ai-language-model/SKILL.md +36 -4
- package/skills/effect-ai-prompt/SKILL.md +1 -1
- package/skills/effect-ai-provider/SKILL.md +23 -12
- package/skills/effect-ai-tool/SKILL.md +13 -0
- package/skills/effect-atom-rpc/SKILL.md +7 -1
- package/skills/effect-atom-state/SKILL.md +8 -2
- package/skills/effect-cache/SKILL.md +10 -1
- package/skills/effect-cli/SKILL.md +105 -94
- package/skills/effect-command-executor/SKILL.md +7 -1
- package/skills/effect-config/SKILL.md +67 -44
- package/skills/effect-domain-modeling/SKILL.md +3 -3
- package/skills/effect-error-handling/SKILL.md +2 -2
- package/skills/effect-fiber/SKILL.md +2 -2
- package/skills/effect-filesystem/SKILL.md +34 -4
- package/skills/effect-http-api/SKILL.md +17 -2
- package/skills/effect-http-client/SKILL.md +11 -2
- package/skills/effect-http-server/SKILL.md +28 -11
- package/skills/effect-layer-design/SKILL.md +6 -2
- package/skills/effect-mcp-server/SKILL.md +21 -4
- package/skills/effect-observability/SKILL.md +2 -2
- package/skills/effect-optics/SKILL.md +1 -1
- package/skills/effect-parallelization/SKILL.md +2 -2
- package/skills/effect-pattern-matching/SKILL.md +1 -1
- package/skills/effect-platform-abstraction/SKILL.md +3 -3
- package/skills/effect-rpc-api/SKILL.md +3 -3
- package/skills/effect-rpc-client/SKILL.md +14 -13
- package/skills/effect-rpc-cluster/SKILL.md +15 -12
- package/skills/effect-rpc-server/SKILL.md +11 -13
- package/skills/effect-scheduling/SKILL.md +7 -0
- package/skills/effect-schema-composition/SKILL.md +12 -4
- package/skills/effect-schema-v4/SKILL.md +75 -20
- package/skills/effect-scope/SKILL.md +4 -4
- package/skills/effect-socket/SKILL.md +161 -658
- package/skills/effect-sql/SKILL.md +50 -12
- package/skills/effect-stream/SKILL.md +19 -24
- package/skills/effect-testing/SKILL.md +35 -22
- package/skills/effect-workflow/SKILL.md +13 -2
- package/src/enforcer.ts +1 -1
- package/src/index.ts +1 -1
- package/src/skills.ts +4 -4
package/README.md
CHANGED
|
@@ -3,80 +3,54 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/opencode-effect-enforcer)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
guidance and reviews their TypeScript edits for common Effect anti-patterns.
|
|
6
|
+
**Spend less time teaching your coding agent Effect.**
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
If you keep reminding your agent to use typed errors, decode with Schema, or
|
|
9
|
+
check the current API, this plugin gives those reminders a permanent home in
|
|
10
|
+
OpenCode V2. It includes Effect guidance and skills the agent can consult while
|
|
11
|
+
working, plus checks that send common mistakes back for correction after edits.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## How it helps
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**Guidance** is included before every model call. Four documents cover
|
|
16
|
+
Effect-first design, schema-first modeling, typed dependencies, and how to
|
|
17
|
+
choose the relevant skills.
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"plugins": ["opencode-effect-enforcer"],
|
|
21
|
-
}
|
|
22
|
-
```
|
|
19
|
+
**Skills** explain how to use specific Effect APIs. The agent loads the relevant
|
|
20
|
+
guides through OpenCode's native skill tool, with 53 to choose from across
|
|
21
|
+
services, streams, HTTP, SQL, React, AI, and more.
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
to enable it only for that project. You can also pin a release, for example
|
|
28
|
-
`"opencode-effect-enforcer@0.2.4"`.
|
|
23
|
+
**Patterns** check the code after edits. 45 tested checks look for common
|
|
24
|
+
TypeScript and TSX mistakes and return correction advice and relevant skill
|
|
25
|
+
suggestions to the agent for its next turn.
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
Checks run after successful `write`, `edit`, `patch`, and `apply_patch` calls.
|
|
28
|
+
Edits and patches are checked only in newly added text; full-file writes and new
|
|
29
|
+
files are checked in full. Feedback asks the agent to fix valid findings or
|
|
30
|
+
explain intentional exceptions. Checks are advisory and do not block writes.
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
The bundled guidance and skills target **Effect `4.0.0-rc.116`**.
|
|
33
|
+
See the [rc.112 → rc.116 migration audit](docs/effect-4.0.0-rc.116.md)
|
|
34
|
+
and [complete upstream release notes](docs/effect-4.0.0-rc.116-changelog.md).
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
## Install
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Add the plugin to `opencode.jsonc` in your project, or
|
|
39
|
+
`~/.config/opencode/opencode.jsonc` for all projects:
|
|
39
40
|
|
|
40
41
|
```jsonc
|
|
41
42
|
{
|
|
42
43
|
"$schema": "https://opencode.ai/config.json",
|
|
43
|
-
"plugins": ["
|
|
44
|
+
"plugins": ["opencode-effect-enforcer"],
|
|
44
45
|
}
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
or `index` directly inside them, rather than using `package.json` exports.
|
|
49
|
-
Pointing at the repository root silently skips the plugin; pointing at the
|
|
50
|
-
`src/index.ts` file is rejected because configured local paths must be directories.
|
|
48
|
+
Start a new session. OpenCode installs the package automatically.
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
example path below:
|
|
50
|
+
## Explore what's included
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
opencode2 api get '/api/plugin?location[directory]=/path/to/project'
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Look for `opencode.effect-enforcer` with `state.status` set to `active`.
|
|
61
|
-
|
|
62
|
-
## What You Get
|
|
63
|
-
|
|
64
|
-
- **53 focused skills** registered in OpenCode's native skill catalog, covering
|
|
65
|
-
Effect's core, platform, AI, RPC, SQL, frontend, and testing APIs.
|
|
66
|
-
- **4 guidance documents** injected into model context so Effect-first
|
|
67
|
-
boundaries, domain modeling, dependency design, and skill routing stay
|
|
68
|
-
visible while the agent works.
|
|
69
|
-
- **45 tested patterns** run after successful `write`, `edit`, `patch`, and
|
|
70
|
-
`apply_patch` calls, reporting only violations in newly added text.
|
|
71
|
-
- **Advisory remediation** appended to the completed tool result so the model
|
|
72
|
-
reviews and fixes valid findings without a detector blocking the underlying
|
|
73
|
-
write.
|
|
74
|
-
|
|
75
|
-
## Source Catalog
|
|
76
|
-
|
|
77
|
-
Every bundled skill, pattern, and guidance document is linked below. Open only
|
|
78
|
-
the area relevant to your task, or expand a catalog to browse everything
|
|
79
|
-
available.
|
|
52
|
+
Browse the guidance, find a skill for your next task, or see what the patterns
|
|
53
|
+
look for.
|
|
80
54
|
|
|
81
55
|
### Guidance (4)
|
|
82
56
|
|
|
@@ -87,7 +61,7 @@ available.
|
|
|
87
61
|
|
|
88
62
|
### Skills (53)
|
|
89
63
|
|
|
90
|
-
#### Modeling
|
|
64
|
+
#### Modeling and core APIs
|
|
91
65
|
|
|
92
66
|
- [`effect-error-handling`](skills/effect-error-handling/SKILL.md): Model typed failures, inspect causes, report errors, and recover precisely.
|
|
93
67
|
- [`effect-schema-v4`](skills/effect-schema-v4/SKILL.md): Use current Effect Schema v4 APIs and migrate away from v3 patterns.
|
|
@@ -99,7 +73,7 @@ available.
|
|
|
99
73
|
- [`effect-typeclass-design`](skills/effect-typeclass-design/SKILL.md): Design typeclasses with curried signatures and dual data-first/data-last APIs.
|
|
100
74
|
- [`effect-graph`](skills/effect-graph/SKILL.md): Construct, traverse, analyze, and render immutable graphs.
|
|
101
75
|
|
|
102
|
-
#### Services,
|
|
76
|
+
#### Services, lifecycle, and concurrency
|
|
103
77
|
|
|
104
78
|
- [`effect-context-witness`](skills/effect-context-witness/SKILL.md): Choose between service witnesses and capability-based dependency injection.
|
|
105
79
|
- [`effect-service-implementation`](skills/effect-service-implementation/SKILL.md): Implement focused Effect services without monolithic interfaces.
|
|
@@ -114,7 +88,7 @@ available.
|
|
|
114
88
|
- [`effect-pubsub-event-bus`](skills/effect-pubsub-event-bus/SKILL.md): Implement typed publish/subscribe event buses with PubSub and Stream.
|
|
115
89
|
- [`effect-workflow`](skills/effect-workflow/SKILL.md): Build durable workflows, activities, queues, clocks, and compensating transactions.
|
|
116
90
|
|
|
117
|
-
#### Platform
|
|
91
|
+
#### Platform and runtime integration
|
|
118
92
|
|
|
119
93
|
- [`effect-platform-abstraction`](skills/effect-platform-abstraction/SKILL.md): Keep filesystem, process, HTTP, crypto, and terminal code portable.
|
|
120
94
|
- [`effect-platform-layers`](skills/effect-platform-layers/SKILL.md): Provide platform implementations cleanly at application boundaries.
|
|
@@ -125,7 +99,7 @@ available.
|
|
|
125
99
|
- [`effect-socket`](skills/effect-socket/SKILL.md): Build TCP, Unix-domain, and WebSocket clients, servers, and framed transports.
|
|
126
100
|
- [`effect-cli`](skills/effect-cli/SKILL.md): Build type-safe command-line interfaces with arguments, options, commands, and Layers.
|
|
127
101
|
|
|
128
|
-
#### HTTP, RPC,
|
|
102
|
+
#### HTTP, RPC, and persistence
|
|
129
103
|
|
|
130
104
|
- [`effect-http-api`](skills/effect-http-api/SKILL.md): Define typed HTTP APIs with schemas, security, handlers, clients, and OpenAPI.
|
|
131
105
|
- [`effect-http-client`](skills/effect-http-client/SKILL.md): Make typed outgoing HTTP requests with decoding, retries, streaming, and test transports.
|
|
@@ -136,7 +110,7 @@ available.
|
|
|
136
110
|
- [`effect-rpc-cluster`](skills/effect-rpc-cluster/SKILL.md): Build clustered RPC entities, sharding, singletons, cron jobs, and workflows.
|
|
137
111
|
- [`effect-sql`](skills/effect-sql/SKILL.md): Query databases and build schemas, models, resolvers, repositories, and migrations.
|
|
138
112
|
|
|
139
|
-
#### AI
|
|
113
|
+
#### AI and MCP
|
|
140
114
|
|
|
141
115
|
- [`effect-ai-language-model`](skills/effect-ai-language-model/SKILL.md): Generate text, structured output, streams, and tool calls through `LanguageModel`.
|
|
142
116
|
- [`effect-ai-prompt`](skills/effect-ai-prompt/SKILL.md): Construct and compose prompts from messages and multimodal parts.
|
|
@@ -146,13 +120,13 @@ available.
|
|
|
146
120
|
- [`effect-ai-chat`](skills/effect-ai-chat/SKILL.md): Build persistent multi-turn chats and agentic tool-calling loops.
|
|
147
121
|
- [`effect-mcp-server`](skills/effect-mcp-server/SKILL.md): Expose MCP tools, resources, and prompts over stdio or HTTP.
|
|
148
122
|
|
|
149
|
-
#### Frontend
|
|
123
|
+
#### Frontend state and composition
|
|
150
124
|
|
|
151
125
|
- [`effect-atom-state`](skills/effect-atom-state/SKILL.md): Manage reactive React state with Effect Atom.
|
|
152
126
|
- [`effect-atom-rpc`](skills/effect-atom-rpc/SKILL.md): Build cached, invalidating, SSR-aware RPC atoms for React clients.
|
|
153
127
|
- [`effect-react-composition`](skills/effect-react-composition/SKILL.md): Compose React components around explicit Effect Atom state and behavior.
|
|
154
128
|
|
|
155
|
-
#### Configuration,
|
|
129
|
+
#### Configuration, operations, and testing
|
|
156
130
|
|
|
157
131
|
- [`effect-config`](skills/effect-config/SKILL.md): Load, validate, compose, and test typed configuration sources.
|
|
158
132
|
- [`effect-observability`](skills/effect-observability/SKILL.md): Add structured logs, traces, metrics, and OTLP or Prometheus export.
|
|
@@ -163,7 +137,7 @@ available.
|
|
|
163
137
|
|
|
164
138
|
### Patterns (45)
|
|
165
139
|
|
|
166
|
-
#### Types,
|
|
140
|
+
#### Types, modeling, and collections
|
|
167
141
|
|
|
168
142
|
- [`avoid-any`](patterns/avoid-any.md): Flags assertions to `any` or `unknown` that erase type safety.
|
|
169
143
|
- [`casting-awareness`](patterns/casting-awareness.md): Reviews type assertions and suggests decoding, guards, or `satisfies`.
|
|
@@ -180,7 +154,7 @@ available.
|
|
|
180
154
|
- [`imperative-loops`](patterns/imperative-loops.md): Replaces imperative loops with functional collection transformations.
|
|
181
155
|
- [`prefer-arr-sort`](patterns/prefer-arr-sort.md): Replaces native array sorting with `Arr.sort` and explicit `Order`.
|
|
182
156
|
|
|
183
|
-
#### Errors
|
|
157
|
+
#### Errors and Effect boundaries
|
|
184
158
|
|
|
185
159
|
- [`avoid-data-tagged-error`](patterns/avoid-data-tagged-error.md): Reviews public or serialized `Data.TaggedError` values for schema-backed errors.
|
|
186
160
|
- [`avoid-untagged-errors`](patterns/avoid-untagged-errors.md): Reviews raw `Error` construction and discrimination in recoverable code.
|
|
@@ -192,7 +166,7 @@ available.
|
|
|
192
166
|
- [`prefer-effect-fn`](patterns/prefer-effect-fn.md): Wraps service methods with named, traced `Effect.fn` definitions.
|
|
193
167
|
- [`avoid-yield-ref`](patterns/avoid-yield-ref.md): Replaces direct yielding of Ref, Deferred, Fiber, and Latch with explicit operations.
|
|
194
168
|
|
|
195
|
-
#### Services,
|
|
169
|
+
#### Services, concurrency, and time
|
|
196
170
|
|
|
197
171
|
- [`context-tag-extends`](patterns/context-tag-extends.md): Replaces legacy service-tag APIs with `Context.Service`.
|
|
198
172
|
- [`avoid-mutable-state`](patterns/avoid-mutable-state.md): Reviews mutable `let` state inside Effect services in favor of `Ref`.
|
|
@@ -203,7 +177,7 @@ available.
|
|
|
203
177
|
- [`use-random-service`](patterns/use-random-service.md): Replaces `Math.random()` with Effect's testable Random service.
|
|
204
178
|
- [`use-console-service`](patterns/use-console-service.md): Replaces native console calls with Effect logging or Console services.
|
|
205
179
|
|
|
206
|
-
#### Platform, I/O,
|
|
180
|
+
#### Platform, I/O, and configuration
|
|
207
181
|
|
|
208
182
|
- [`avoid-native-fetch`](patterns/avoid-native-fetch.md): Replaces native `fetch` with Effect HTTP client modules.
|
|
209
183
|
- [`use-http-client-service`](patterns/use-http-client-service.md): Replaces `node:http` and `node:https` with Effect `HttpClient`.
|
|
@@ -218,83 +192,11 @@ available.
|
|
|
218
192
|
- [`avoid-process-env`](patterns/avoid-process-env.md): Replaces direct environment access with Effect Config.
|
|
219
193
|
- [`prefer-redacted-config`](patterns/prefer-redacted-config.md): Requires secret-like configuration values to remain redacted.
|
|
220
194
|
|
|
221
|
-
#### React
|
|
195
|
+
#### React and testing conventions
|
|
222
196
|
|
|
223
197
|
- [`avoid-react-hooks`](patterns/avoid-react-hooks.md): Reviews React state and effects for Effect Atom alternatives.
|
|
224
198
|
- [`avoid-expect-in-if`](patterns/avoid-expect-in-if.md): Prevents conditional assertions that allow tests to pass without checking behavior.
|
|
225
199
|
|
|
226
|
-
## Per-Agent Opt-Out
|
|
227
|
-
|
|
228
|
-
Set `opencode-effect-enforcer: false` in an agent's `request.body` when that
|
|
229
|
-
agent does not write Effect code. The plugin consumes the setting before the
|
|
230
|
-
request reaches the model provider.
|
|
231
|
-
|
|
232
|
-
```jsonc
|
|
233
|
-
{
|
|
234
|
-
"agents": {
|
|
235
|
-
"researcher": {
|
|
236
|
-
"description": "Handles non-code research",
|
|
237
|
-
"mode": "subagent",
|
|
238
|
-
"request": {
|
|
239
|
-
"body": {
|
|
240
|
-
"opencode-effect-enforcer": false,
|
|
241
|
-
},
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
For opted-out agents, the plugin does not inject guidance, advertise or allow
|
|
249
|
-
its `effect-*` skills, or run post-write pattern enforcement.
|
|
250
|
-
|
|
251
|
-
To disable the plugin entirely without removing its package entry, add a later
|
|
252
|
-
selector using the exported plugin ID:
|
|
253
|
-
|
|
254
|
-
```jsonc
|
|
255
|
-
{
|
|
256
|
-
"plugins": ["opencode-effect-enforcer", "-opencode.effect-enforcer"],
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
## Enforcement Semantics
|
|
261
|
-
|
|
262
|
-
Patterns run only after successful writes. For edits and patches, the plugin
|
|
263
|
-
captures the original files and computes changed spans from the final output,
|
|
264
|
-
so it does not report a pre-existing violation outside newly added text.
|
|
265
|
-
Full-file writes and new files treat the complete result as changed.
|
|
266
|
-
|
|
267
|
-
The matcher supports TypeScript and TSX ast-grep rules, regex detectors with
|
|
268
|
-
comment filtering, include and ignore globs, severity ordering, and targeted
|
|
269
|
-
skill suggestions. Inspection failures remain advisory and never convert a
|
|
270
|
-
successful write into a failed tool call.
|
|
271
|
-
|
|
272
|
-
## Development
|
|
273
|
-
|
|
274
|
-
```sh
|
|
275
|
-
bun install
|
|
276
|
-
bun run check
|
|
277
|
-
bun run test
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
The tests enforce a bidirectional pattern/test inventory and require every
|
|
281
|
-
skill, pattern, and guidance source to remain linked from this README.
|
|
282
|
-
|
|
283
|
-
GitHub releases are automatically verified and published to npm with provenance.
|
|
284
|
-
The release tag must exactly match the package version, such as `v0.2.0` for
|
|
285
|
-
`"version": "0.2.0"`.
|
|
286
|
-
|
|
287
|
-
There is no generated `dist` tree. OpenCode imports the TypeScript entrypoint,
|
|
288
|
-
and npm publishes the authoritative `src/`, `skills/`, `guidance/`, `patterns/`,
|
|
289
|
-
and `docs/` directories directly.
|
|
290
|
-
|
|
291
|
-
## Credits
|
|
292
|
-
|
|
293
|
-
This project is the OpenCode V2 port of
|
|
294
|
-
[`pi-effect-harness`](https://github.com/mpsuesser/pi-effect-harness). It keeps
|
|
295
|
-
the source guidance and pattern policy while using OpenCode's native skills,
|
|
296
|
-
context hooks, and package loading.
|
|
297
|
-
|
|
298
200
|
## License
|
|
299
201
|
|
|
300
202
|
[MIT](LICENSE)
|