opencode-snippets 2.0.1 → 2.1.0

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 (47) hide show
  1. package/README.md +49 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +102 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/commands.js +15 -8
  6. package/dist/src/commands.js.map +1 -1
  7. package/dist/src/config.d.ts +2 -0
  8. package/dist/src/config.d.ts.map +1 -1
  9. package/dist/src/config.js +12 -2
  10. package/dist/src/config.js.map +1 -1
  11. package/dist/src/constants.d.ts +6 -1
  12. package/dist/src/constants.d.ts.map +1 -1
  13. package/dist/src/constants.js +6 -1
  14. package/dist/src/constants.js.map +1 -1
  15. package/dist/src/expander.d.ts.map +1 -1
  16. package/dist/src/expander.js +4 -1
  17. package/dist/src/expander.js.map +1 -1
  18. package/dist/src/hook-types.d.ts +3 -0
  19. package/dist/src/hook-types.d.ts.map +1 -1
  20. package/dist/src/loader.d.ts.map +1 -1
  21. package/dist/src/loader.js +61 -25
  22. package/dist/src/loader.js.map +1 -1
  23. package/dist/src/skill-load-manager.d.ts +10 -0
  24. package/dist/src/skill-load-manager.d.ts.map +1 -0
  25. package/dist/src/skill-load-manager.js +30 -0
  26. package/dist/src/skill-load-manager.js.map +1 -0
  27. package/dist/src/skill-loader.d.ts +8 -1
  28. package/dist/src/skill-loader.d.ts.map +1 -1
  29. package/dist/src/skill-loader.js +66 -17
  30. package/dist/src/skill-loader.js.map +1 -1
  31. package/dist/src/skill-loading.d.ts +11 -0
  32. package/dist/src/skill-loading.d.ts.map +1 -0
  33. package/dist/src/skill-loading.js +122 -0
  34. package/dist/src/skill-loading.js.map +1 -0
  35. package/dist/src/tui-search.d.ts +2 -0
  36. package/dist/src/tui-search.d.ts.map +1 -1
  37. package/dist/src/tui-search.js +61 -16
  38. package/dist/src/tui-search.js.map +1 -1
  39. package/dist/src/tui-trigger.d.ts +4 -0
  40. package/dist/src/tui-trigger.d.ts.map +1 -1
  41. package/dist/src/tui-trigger.js +28 -0
  42. package/dist/src/tui-trigger.js.map +1 -1
  43. package/dist/tui.d.ts.map +1 -1
  44. package/dist/tui.jsx +85 -30
  45. package/dist/tui.jsx.map +1 -1
  46. package/package.json +1 -1
  47. package/skill/snippets/SKILL.md +38 -6
@@ -10,12 +10,16 @@ Reusable text blocks expanded via `#hashtag` in messages.
10
10
  ## Locations
11
11
 
12
12
  ### Snippets
13
- - **Global**: `~/.config/opencode/snippet/*.md`
14
- - **Project**: `.opencode/snippet/*.md` (overrides global)
13
+ - **Global directories**: `~/.config/opencode/snippet/` and `~/.config/opencode/snippets/`
14
+ - **Project directories**: `.opencode/snippet/` and `.opencode/snippets/` (project overrides global, `snippet/` wins over `snippets/`)
15
15
 
16
16
  ### Configuration
17
- - **Global**: `~/.config/opencode/snippet/config.jsonc`
18
- - **Project**: `.opencode/snippet/config.jsonc` (merges with global, project takes priority)
17
+ - **Global file**: `~/.config/opencode/snippet/config.jsonc`
18
+ - **Project file**: `.opencode/snippet/config.jsonc` (merges with global, project takes priority)
19
+
20
+ IMPORTANT: Snippets live only in those four snippet directories. Check those exact locations. Do not glob anywhere else in the repo or workspace.
21
+
22
+ IMPORTANT: Config files stay under `snippet/config.jsonc`. The plural `snippets/` support is for snippet markdown files only.
19
23
 
20
24
  IMPORTANT: When modifying snippet configuration:
21
25
  1. Check BOTH locations for existing config files
@@ -35,7 +39,7 @@ Full config example with all options:
35
39
  ```jsonc
36
40
  {
37
41
  // JSON Schema for editor autocompletion
38
- "$schema": "https://raw.githubusercontent.com/JosXa/opencode-snippets/v2.0.1/schema/config.schema.json",
42
+ "$schema": "https://raw.githubusercontent.com/JosXa/opencode-snippets/v2.1.0/schema/config.schema.json",
39
43
 
40
44
  // Logging settings
41
45
  "logging": {
@@ -52,7 +56,10 @@ Full config example with all options:
52
56
  "injectBlocks": false,
53
57
  // Enable skill rendering with <skill>name</skill> syntax
54
58
  // Default: false
55
- "skillRendering": false
59
+ "skillRendering": false,
60
+ // Enable #skill(name) syntax
61
+ // Default: false
62
+ "skillLoading": false
56
63
  },
57
64
 
58
65
  // Hide shell command in output, showing only the result
@@ -152,6 +159,31 @@ Enable in config:
152
159
 
153
160
  Skills are loaded from OpenCode's standard directories (`~/.config/opencode/skill/` and `.opencode/skill/`).
154
161
 
162
+ ### Skill Loading (Experimental)
163
+
164
+ Load OpenCode skills with command-style syntax while keeping the visible message compact:
165
+
166
+ ```md
167
+ Use caveman mode. #skill(caveman)
168
+ <!-- or -->
169
+ #skill("opencode-config")
170
+ ```
171
+
172
+ Enable in config:
173
+ ```jsonc
174
+ {
175
+ "experimental": {
176
+ "skillLoading": true
177
+ }
178
+ }
179
+ ```
180
+
181
+ Visible transcript text becomes `↳ Loaded name`. The model receives the full OpenCode-style `<skill_content>` wrapper above that message.
182
+
183
+ Treat `#skill(...)` as hidden context injection, not inline expansion. User usually sees compact placeholder text, while the model receives an extra injected user message containing the full `<skill_content>` payload. Do not assume one visible bubble can hold different hidden text. The implementation achieves this by inserting an additional hidden message before the visible one.
184
+
185
+ `#skill(...)` also works when produced by snippet expansion, not only when the user types it directly.
186
+
155
187
  ## Commands
156
188
 
157
189
  - `/snippet add <name> [content]` - create global snippet