@2digits/opencode-plugin 0.0.1

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.
@@ -0,0 +1,3 @@
1
+ import { Hooks, PluginInput } from "@opencode-ai/plugin";
2
+ declare function plugin(ctx: PluginInput): Promise<Hooks>;
3
+ export { plugin as default };
package/dist/index.js ADDED
@@ -0,0 +1,92 @@
1
+ // @bun
2
+ import{tool as v}from"@opencode-ai/plugin";import z from"dedent";function J(j){return[z`
3
+ ## Feedback
4
+
5
+ ${j.feedback}
6
+ `,j.context?z`
7
+ ## Context
8
+
9
+ \`\`\`
10
+ ${j.context}
11
+ \`\`\`
12
+ `:"",j.suggestedRule?z`
13
+ ## Suggested Rule
14
+
15
+ ${j.suggestedRule}
16
+ `:"",z`
17
+ ---
18
+
19
+ _Created via \`/fix\` command in OpenCode_
20
+ `].filter(Boolean).join(`
21
+
22
+ `)}var K=z`
23
+ Submit feedback about something the agent did wrong or could improve.
24
+
25
+ ## Instructions
26
+
27
+ 1. Ask clarifying questions to understand:
28
+ - What specifically went wrong?
29
+ - What should have happened instead?
30
+ - Is this a recurring pattern or one-off?
31
+
32
+ 2. Use the \`create_feedback_issue\` tool with:
33
+ - **title**: Concise description of the issue
34
+ - **feedback**: Detailed explanation of what went wrong
35
+ - **context**: Relevant code/conversation snippets (optional)
36
+ - **suggestedRule**: If obvious, propose a rule to prevent this (optional)
37
+
38
+ 3. Return the issue URL so user can track/discuss
39
+
40
+ ## User Input
41
+
42
+ <Feedback>
43
+ $ARGUMENTS
44
+ </Feedback>
45
+ `;async function Q(j){return{config:async(h)=>{h.command=h.command??{},h.command.fix={description:"Submit feedback about agent behavior to improve shared rules",template:K}},"experimental.chat.system.transform":async(h,G)=>{G.system.push(`Instructions from: @2digits/opencode-plugin
46
+ ${`## Code Quality Standards
47
+
48
+ - Make minimal, surgical changes
49
+ - Never compromise type safety: No any, no non-null assertion operator (!), no type assertions (as Type)
50
+ - Make illegal states unrepresentable: Model domain with ADTs/discriminated unions; parse inputs at boundaries into typed structures; if state can't exist, code can't mishandle it
51
+ - Abstractions: Consciously constrained, pragmatically parameterised, doggedly documented
52
+
53
+ ## Patterns to Avoid
54
+
55
+ - Premature optimization
56
+ - Magic strings/numbers without constants
57
+ - Nested ternaries beyond 2 levels
58
+ - Barrel files (index.ts re-exports) in large modules
59
+
60
+ ## ENTROPY REMINDER
61
+
62
+ This codebase will outlive you. Every shortcut you take becomes someone else's burden. Every hack compounds into technical debt that slows the whole team down.
63
+
64
+ You are not just writing code. You are shaping the future of this project. The patterns you establish will be copied. The corners you cut will be cut again.
65
+
66
+ Fight entropy. Leave the codebase better than you found it.
67
+
68
+
69
+ ## Effect Patterns
70
+
71
+ - Use Effect.gen for readable sequential composition
72
+ - Define tagged errors with Schema.TaggedError (not Data.TaggedError)
73
+ - Services use Context.Tag class pattern: \\\`class Foo extends Context.Tag("@app/Foo")<Foo, Interface>() {}\\\`
74
+ - Always use Effect.fn for traceable service methods
75
+ - Prefer Layer.effect for service construction, Layer.succeed for simple values
76
+ - Use HttpClient.filterStatusOk to convert non-2xx to ResponseError
77
+ - Always call Effect.scoped after consuming response body
78
+
79
+
80
+ ## React/Next.js Patterns
81
+
82
+ - Prefer Server Components by default, use 'use client' only when needed
83
+ - Colocate data fetching with components that use it
84
+ - Use Suspense boundaries for loading states
85
+ - Prefer controlled components with explicit state management
86
+ - Extract complex logic into custom hooks
87
+ - Name useState pairs as \`[value, setValue]\`
88
+ `}`)},tool:{create_feedback_issue:v({description:"Create GitHub issue in 2digits-agency/configs with agent feedback",args:{title:v.schema.string().describe("Concise issue title"),feedback:v.schema.string().describe("Detailed feedback about what went wrong"),context:v.schema.string().optional().describe("Relevant conversation context"),suggestedRule:v.schema.string().optional().describe("Proposed rule to add")},async execute(h){let G=J(h),H=`[Agent Feedback] ${h.title}`;return`Created issue: ${(await j.$`gh issue create \
89
+ --repo 2digits-agency/configs \
90
+ --title ${H} \
91
+ --body ${G} \
92
+ --label agent-feedback`.text()).trim()}`}})}}}export{Q as default};
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@2digits/opencode-plugin",
3
+ "version": "0.0.1",
4
+ "description": "OpenCode plugin for 2digits team - shared rules and feedback system",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/2digits-agency/configs.git",
8
+ "directory": "packages/opencode-plugin"
9
+ },
10
+ "type": "module",
11
+ "module": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "import": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ }
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "sideEffects": false,
26
+ "license": "MIT",
27
+ "dependencies": {
28
+ "@opencode-ai/plugin": "1.1.25",
29
+ "dedent": "1.7.1"
30
+ },
31
+ "devDependencies": {
32
+ "@types/bun": "1.3.6",
33
+ "@typescript/native-preview": "7.0.0-dev.20260118.1",
34
+ "bunup": "0.16.20",
35
+ "typescript": "5.9.3",
36
+ "@2digits/tsconfig": "0.8.6"
37
+ },
38
+ "scripts": {
39
+ "build": "bunup",
40
+ "dev": "bunup --watch",
41
+ "types": "tsgo --noEmit"
42
+ }
43
+ }