opencode-snippets 1.6.0 → 1.7.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.
- package/README.md +69 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +141 -55
- package/dist/index.js.map +1 -1
- package/dist/src/config.d.ts +11 -2
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +21 -11
- package/dist/src/config.js.map +1 -1
- package/dist/src/constants.d.ts +7 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +7 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/expander.d.ts +13 -4
- package/dist/src/expander.d.ts.map +1 -1
- package/dist/src/expander.js +42 -13
- package/dist/src/expander.js.map +1 -1
- package/dist/src/hook-types.d.ts +39 -0
- package/dist/src/hook-types.d.ts.map +1 -0
- package/dist/src/hook-types.js +5 -0
- package/dist/src/hook-types.js.map +1 -0
- package/dist/src/injection-manager.d.ts +20 -0
- package/dist/src/injection-manager.d.ts.map +1 -0
- package/dist/src/injection-manager.js +36 -0
- package/dist/src/injection-manager.js.map +1 -0
- package/dist/src/skill-loader.d.ts +35 -0
- package/dist/src/skill-loader.d.ts.map +1 -0
- package/dist/src/skill-loader.js +118 -0
- package/dist/src/skill-loader.js.map +1 -0
- package/dist/src/skill-renderer.d.ts +14 -0
- package/dist/src/skill-renderer.d.ts.map +1 -0
- package/dist/src/skill-renderer.js +42 -0
- package/dist/src/skill-renderer.js.map +1 -0
- package/dist/src/types.d.ts +4 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/skill/snippets/SKILL.md +70 -6
package/skill/snippets/SKILL.md
CHANGED
|
@@ -17,6 +17,12 @@ Reusable text blocks expanded via `#hashtag` in messages.
|
|
|
17
17
|
- **Global**: `~/.config/opencode/snippet/config.jsonc`
|
|
18
18
|
- **Project**: `.opencode/snippet/config.jsonc` (merges with global, project takes priority)
|
|
19
19
|
|
|
20
|
+
IMPORTANT: When modifying snippet configuration:
|
|
21
|
+
1. Check BOTH locations for existing config files
|
|
22
|
+
2. If only one exists, modify that one
|
|
23
|
+
3. If both exist, ask the user which one to modify
|
|
24
|
+
4. If neither exists, create the global config
|
|
25
|
+
|
|
20
26
|
### Logs
|
|
21
27
|
- **Debug logs**: `~/.config/opencode/logs/snippets/daily/YYYY-MM-DD.log`
|
|
22
28
|
|
|
@@ -29,7 +35,7 @@ Full config example with all options:
|
|
|
29
35
|
```jsonc
|
|
30
36
|
{
|
|
31
37
|
// JSON Schema for editor autocompletion
|
|
32
|
-
"$schema": "https://raw.githubusercontent.com/JosXa/opencode-snippets/
|
|
38
|
+
"$schema": "https://raw.githubusercontent.com/JosXa/opencode-snippets/v1.7.0/schema/config.schema.json",
|
|
33
39
|
|
|
34
40
|
// Logging settings
|
|
35
41
|
"logging": {
|
|
@@ -39,11 +45,19 @@ Full config example with all options:
|
|
|
39
45
|
"debug": false
|
|
40
46
|
},
|
|
41
47
|
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
// Experimental features (may change or be removed)
|
|
49
|
+
"experimental": {
|
|
50
|
+
// Enable <inject>...</inject> blocks for persistent context messages
|
|
51
|
+
// Default: false
|
|
52
|
+
"injectBlocks": false,
|
|
53
|
+
// Enable skill rendering with <skill>name</skill> syntax
|
|
54
|
+
// Default: false
|
|
55
|
+
"skillRendering": false
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// Hide shell command in output, showing only the result
|
|
59
|
+
// Default: false
|
|
60
|
+
"hideCommandInOutput": false
|
|
47
61
|
}
|
|
48
62
|
```
|
|
49
63
|
|
|
@@ -88,6 +102,56 @@ Output: Prepended section at top + `Create bug in Jira MCP about leak`.
|
|
|
88
102
|
|
|
89
103
|
Use `<append>` for reference material at end. Content inside blocks should use `##` headings.
|
|
90
104
|
|
|
105
|
+
### Inject Blocks (Experimental)
|
|
106
|
+
|
|
107
|
+
Add persistent context that the LLM sees throughout the entire agentic loop, without cluttering the visible message.
|
|
108
|
+
|
|
109
|
+
```md
|
|
110
|
+
---
|
|
111
|
+
aliases: safe
|
|
112
|
+
---
|
|
113
|
+
Think step by step.
|
|
114
|
+
<inject>
|
|
115
|
+
IMPORTANT: Double-check all code for security vulnerabilities.
|
|
116
|
+
Always suggest tests for any implementation.
|
|
117
|
+
</inject>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Input: `Review this code #safe`
|
|
121
|
+
Output: User sees "Review this code Think step by step." but the LLM also receives the inject content as separate context that persists for the entire conversation turn.
|
|
122
|
+
|
|
123
|
+
Use for rules, constraints, or context that should influence all responses without appearing inline.
|
|
124
|
+
|
|
125
|
+
Enable in config:
|
|
126
|
+
```jsonc
|
|
127
|
+
{
|
|
128
|
+
"experimental": {
|
|
129
|
+
"injectBlocks": true
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Skill Rendering (Experimental)
|
|
135
|
+
|
|
136
|
+
Inline OpenCode skills directly into messages using XML tags:
|
|
137
|
+
|
|
138
|
+
```md
|
|
139
|
+
Create a Jira ticket. <skill>jira</skill>
|
|
140
|
+
<!-- or -->
|
|
141
|
+
<skill name="jira" />
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Enable in config:
|
|
145
|
+
```jsonc
|
|
146
|
+
{
|
|
147
|
+
"experimental": {
|
|
148
|
+
"skillRendering": true
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Skills are loaded from OpenCode's standard directories (`~/.config/opencode/skill/` and `.opencode/skill/`).
|
|
154
|
+
|
|
91
155
|
## Commands
|
|
92
156
|
|
|
93
157
|
- `/snippet add <name> [content]` - create global snippet
|