@2digits/opencode-plugin 0.0.5 → 0.0.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/dist/index.js +108 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,48 +1,72 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{tool as
|
|
3
|
-
|
|
2
|
+
import r from"dedent";import{tool as i}from"@opencode-ai/plugin";import s from"dedent";function o(t){return i({description:"Create GitHub issue in 2digits-agency/configs with agent feedback",args:{title:i.schema.string().meta({title:"Concise issue title",description:s`
|
|
3
|
+
A concise title for the issue. This will be used as the issue title.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
Good example: "Prefer method notation over arrow functions in object literals"
|
|
6
|
+
Bad example: "Write cleaner code"
|
|
7
|
+
`}),feedback:i.schema.string().meta({title:"Detailed feedback",description:s`
|
|
8
|
+
Provide a detailed explanation of what went wrong and what the user expected to happen.
|
|
9
|
+
This will be used as the issue body.
|
|
10
|
+
`}),context:i.schema.string().meta({title:"Relevant code or conversation snippets",description:s`
|
|
11
|
+
Show the before and after code or conversation snippets that triggered the issue.
|
|
12
|
+
`}),suggestedRule:i.schema.string().meta({title:"Suggested rule",description:s`
|
|
13
|
+
Propose a rule to prevent this happening in the future.
|
|
14
|
+
Keep in mind that the rule should be specific and not too broad.
|
|
15
|
+
For example, if the issue is about a specific pattern, propose a rule that addresses that pattern.
|
|
16
|
+
`})},async execute(e,a){let n=`[Agent Feedback] ${e.title}`,d=await t.$`opencode --version`.text(),c=s`
|
|
17
|
+
# Feedback
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
${j.context}
|
|
11
|
-
\`\`\`
|
|
12
|
-
`:"",j.suggestedRule?z`
|
|
13
|
-
## Suggested Rule
|
|
19
|
+
${e.feedback}
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
`:"",z`
|
|
17
|
-
---
|
|
21
|
+
## Context
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
`].filter(Boolean).join(`
|
|
23
|
+
${e.context}
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
Submit feedback about something the agent did wrong or could improve.
|
|
25
|
+
## Suggested Rule
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
${e.suggestedRule}
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
<details>
|
|
30
|
+
<summary>Technical Details</summary>
|
|
31
|
+
|
|
32
|
+
- OpenCode Version: ${d}
|
|
33
|
+
- Project Name: ${t.directory}
|
|
34
|
+
- Agent Name: ${a.agent}
|
|
35
|
+
</details>
|
|
31
36
|
|
|
32
|
-
|
|
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
|
+
---
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
_Created via \`/fix\` command in OpenCode_
|
|
40
|
+
`;return`Created issue: ${(await t.$`gh issue create \
|
|
41
|
+
--repo 2digits-agency/configs \
|
|
42
|
+
--title ${n} \
|
|
43
|
+
--body ${c} \
|
|
44
|
+
--label agent-feedback`.text()).trim()}`}})}var l=r`
|
|
45
|
+
Submit feedback about something the agent did wrong or could improve.
|
|
46
|
+
|
|
47
|
+
## Instructions
|
|
48
|
+
|
|
49
|
+
1. Ask clarifying questions to understand:
|
|
50
|
+
- What specifically went wrong?
|
|
51
|
+
- What should have happened instead?
|
|
52
|
+
- Is this a recurring pattern or one-off?
|
|
53
|
+
|
|
54
|
+
2. Use the \`create_feedback_issue\` tool with:
|
|
55
|
+
- **title**: Concise description of the issue
|
|
56
|
+
- **feedback**: Detailed explanation of what went wrong
|
|
57
|
+
- **context**: Relevant code/conversation snippets
|
|
58
|
+
- **suggestedRule**: Propose a rule to prevent this
|
|
59
|
+
|
|
60
|
+
3. Return the issue URL so user can track/discuss
|
|
39
61
|
|
|
40
|
-
|
|
62
|
+
## User Input
|
|
63
|
+
|
|
64
|
+
<Feedback>
|
|
65
|
+
$ARGUMENTS
|
|
66
|
+
</Feedback>
|
|
67
|
+
`;async function p(t){return{config:async(e)=>{e.command=e.command??{},e.command.fix={description:"Submit feedback about agent behavior to improve shared rules",template:l}},"experimental.chat.system.transform":async(e,a)=>{a.system.push(r`
|
|
68
|
+
Instructions from: @2digits/opencode-plugin
|
|
41
69
|
|
|
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
70
|
${`## Code Quality Standards
|
|
47
71
|
|
|
48
72
|
- Make minimal, surgical changes
|
|
@@ -57,6 +81,55 @@ ${`## Code Quality Standards
|
|
|
57
81
|
- Nested ternaries beyond 2 levels
|
|
58
82
|
- Barrel files (index.ts re-exports) in large modules
|
|
59
83
|
|
|
84
|
+
## Method Notation in Object Literals
|
|
85
|
+
|
|
86
|
+
Prefer method notation (\`name() {}\`) over arrow functions (\`name: () => {}\`) in object literals with function properties:
|
|
87
|
+
|
|
88
|
+
\`\`\`ts
|
|
89
|
+
// \u274C Arrow function syntax
|
|
90
|
+
Effect.tryPromise({
|
|
91
|
+
try: () => someAsyncOperation(),
|
|
92
|
+
catch: () => new SomeError({ message: 'failed' }),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// \u2705 Method notation
|
|
96
|
+
Effect.tryPromise({
|
|
97
|
+
try(abortSignal) {
|
|
98
|
+
return someAsyncOperation(abortSignal);
|
|
99
|
+
},
|
|
100
|
+
catch(cause) {
|
|
101
|
+
return new SomeError({ cause });
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
\`\`\`
|
|
105
|
+
|
|
106
|
+
Benefits:
|
|
107
|
+
|
|
108
|
+
- More concise (no \`=>\` needed)
|
|
109
|
+
- More readable for multi-line function bodies
|
|
110
|
+
- Exposes API-provided parameters (e.g., \`abortSignal\` in Effect.tryPromise, \`cause\` in catch)
|
|
111
|
+
|
|
112
|
+
## Embedded Language Strings
|
|
113
|
+
|
|
114
|
+
Use \`dedent\` for multi-line template literals containing embedded languages. Alias the import to the language name for IDE syntax highlighting:
|
|
115
|
+
|
|
116
|
+
\`\`\`ts
|
|
117
|
+
import markdown from 'dedent';
|
|
118
|
+
import sql from 'dedent';
|
|
119
|
+
import html from 'dedent';
|
|
120
|
+
|
|
121
|
+
const readme = markdown\`
|
|
122
|
+
# My Package
|
|
123
|
+
|
|
124
|
+
A description of the package.
|
|
125
|
+
\`;
|
|
126
|
+
|
|
127
|
+
const query = sql\`
|
|
128
|
+
SELECT * FROM users
|
|
129
|
+
WHERE id = \${userId}
|
|
130
|
+
\`;
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
60
133
|
## ENTROPY REMINDER
|
|
61
134
|
|
|
62
135
|
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.
|
|
@@ -85,8 +158,5 @@ Fight entropy. Leave the codebase better than you found it.
|
|
|
85
158
|
- Prefer controlled components with explicit state management
|
|
86
159
|
- Extract complex logic into custom hooks
|
|
87
160
|
- Name useState pairs as \`[value, setValue]\`
|
|
88
|
-
`}
|
|
89
|
-
|
|
90
|
-
--title ${H} \
|
|
91
|
-
--body ${G} \
|
|
92
|
-
--label agent-feedback`.text()).trim()}`}})}}}export{Q as default};
|
|
161
|
+
`}
|
|
162
|
+
`)},tool:{create_feedback_issue:o(t)}}}export{p as default};
|