opencode-snippets 1.6.0 → 1.7.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.
- package/README.md +68 -1
- 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 +20 -10
- 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 +29 -11
- 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 +69 -5
package/README.md
CHANGED
|
@@ -233,6 +233,70 @@ Use `<prepend>` for content that should appear at the top of your message. Multi
|
|
|
233
233
|
- Unclosed tags are handled leniently (rest of content becomes the block)
|
|
234
234
|
- Nested blocks are not allowed—the hashtag is left unchanged
|
|
235
235
|
|
|
236
|
+
### Inject Blocks (Experimental)
|
|
237
|
+
|
|
238
|
+
Add persistent context that the LLM sees throughout the entire agentic loop, without cluttering your visible message:
|
|
239
|
+
|
|
240
|
+
```markdown
|
|
241
|
+
---
|
|
242
|
+
aliases: safe
|
|
243
|
+
---
|
|
244
|
+
Think step by step.
|
|
245
|
+
<inject>
|
|
246
|
+
IMPORTANT: Double-check all code for security vulnerabilities.
|
|
247
|
+
Always suggest tests for any implementation.
|
|
248
|
+
</inject>
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Input:** `Review this code #safe`
|
|
252
|
+
|
|
253
|
+
**What happens:**
|
|
254
|
+
- Your message shows: `Review this code Think step by step.`
|
|
255
|
+
- The LLM also receives the inject content as a separate context message
|
|
256
|
+
- This context persists for the entire conversation turn (agentic loop)
|
|
257
|
+
|
|
258
|
+
Use inject blocks for rules, constraints, or instructions that should influence all LLM responses without appearing inline in your message.
|
|
259
|
+
|
|
260
|
+
**Enable in config:**
|
|
261
|
+
|
|
262
|
+
```jsonc
|
|
263
|
+
{
|
|
264
|
+
"experimental": {
|
|
265
|
+
"injectBlocks": true
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Skill Rendering (Experimental)
|
|
271
|
+
|
|
272
|
+
Inline OpenCode skills directly into your messages using XML-style tags:
|
|
273
|
+
|
|
274
|
+
```markdown
|
|
275
|
+
Create a Jira ticket. <skill>jira</skill>
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Or use the self-closing format:
|
|
279
|
+
|
|
280
|
+
```markdown
|
|
281
|
+
<skill name="jira" /> Create a ticket for the bug.
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
**Enable in config:**
|
|
285
|
+
|
|
286
|
+
```jsonc
|
|
287
|
+
{
|
|
288
|
+
"experimental": {
|
|
289
|
+
"skillRendering": true
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Skills are loaded from OpenCode's standard skill directories:
|
|
295
|
+
- **Global**: `~/.config/opencode/skill/<name>/SKILL.md`
|
|
296
|
+
- **Project**: `.opencode/skill/<name>/SKILL.md`
|
|
297
|
+
|
|
298
|
+
When a skill tag is found, it's replaced with the skill's content body (frontmatter stripped). Unknown skills leave the tag unchanged.
|
|
299
|
+
|
|
236
300
|
## Example Snippets
|
|
237
301
|
|
|
238
302
|
### `~/.config/opencode/snippet/context.md`
|
|
@@ -297,7 +361,10 @@ A default config file is created automatically on first run.
|
|
|
297
361
|
"logging": {
|
|
298
362
|
"debug": false // Enable debug logging (logs: ~/.config/opencode/logs/snippets/daily/)
|
|
299
363
|
},
|
|
300
|
-
"
|
|
364
|
+
"experimental": {
|
|
365
|
+
"injectBlocks": false, // Enable <inject>...</inject> blocks for persistent context
|
|
366
|
+
"skillRendering": false // Enable <skill>name</skill> tag expansion
|
|
367
|
+
},
|
|
301
368
|
"hideCommandInOutput": false // Show only output for shell commands (hides "$ cmd\n-->")
|
|
302
369
|
}
|
|
303
370
|
```
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAqDlD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,MAmO5B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rmdir, unlink } from "node:fs/promises";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { createCommandExecuteHandler } from "./src/commands.js";
|
|
5
5
|
import { loadConfig } from "./src/config.js";
|
|
6
6
|
import { assembleMessage, expandHashtags } from "./src/expander.js";
|
|
7
|
+
import { InjectionManager } from "./src/injection-manager.js";
|
|
7
8
|
import { loadSnippets } from "./src/loader.js";
|
|
8
9
|
import { logger } from "./src/logger.js";
|
|
9
10
|
import { executeShellCommands } from "./src/shell.js";
|
|
11
|
+
import { loadSkills } from "./src/skill-loader.js";
|
|
12
|
+
import { expandSkillTags } from "./src/skill-renderer.js";
|
|
10
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
14
|
const __dirname = dirname(__filename);
|
|
12
15
|
const PLUGIN_ROOT = join(__dirname, "..");
|
|
13
16
|
const SKILL_DIR = join(PLUGIN_ROOT, "skill");
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Clean up legacy skill installation from pre-v1.7.0
|
|
19
|
+
* We used to force-install SKILL.md to ~/.config/opencode/skill/snippets/
|
|
20
|
+
* Now we register the skill path instead, so we remove the orphaned file.
|
|
21
|
+
*
|
|
22
|
+
* TODO: Remove this cleanup code around mid-2026 when most users have upgraded.
|
|
23
|
+
*/
|
|
24
|
+
async function cleanupLegacySkillInstall() {
|
|
16
25
|
const home = process.env.HOME || process.env.USERPROFILE || "";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
26
|
+
if (!home)
|
|
27
|
+
return;
|
|
28
|
+
const legacySkillDir = join(home, ".config", "opencode", "skill", "snippets");
|
|
29
|
+
const legacySkillPath = join(legacySkillDir, "SKILL.md");
|
|
20
30
|
try {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const existing = await globalFile.text();
|
|
30
|
-
const source = await sourceFile.text();
|
|
31
|
-
if (existing === source) {
|
|
32
|
-
logger.debug("Skill already installed", { path: globalSkillPath });
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
31
|
+
const file = Bun.file(legacySkillPath);
|
|
32
|
+
if (await file.exists()) {
|
|
33
|
+
await unlink(legacySkillPath);
|
|
34
|
+
logger.debug("Cleaned up legacy skill file", { path: legacySkillPath });
|
|
35
|
+
// Try to remove the empty directory too
|
|
36
|
+
await rmdir(legacySkillDir).catch(() => {
|
|
37
|
+
// Directory not empty or doesn't exist - that's fine
|
|
38
|
+
});
|
|
35
39
|
}
|
|
36
|
-
mkdirSync(globalSkillDir, { recursive: true });
|
|
37
|
-
await Bun.write(globalSkillPath, sourceFile);
|
|
38
|
-
logger.debug("Installed snippets skill", { path: globalSkillPath });
|
|
39
40
|
}
|
|
40
41
|
catch (err) {
|
|
41
|
-
logger.debug("Failed to
|
|
42
|
+
logger.debug("Failed to cleanup legacy skill", { error: String(err) });
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
@@ -54,99 +55,184 @@ export const SnippetsPlugin = async (ctx) => {
|
|
|
54
55
|
const config = loadConfig(ctx.directory);
|
|
55
56
|
// Apply config settings
|
|
56
57
|
logger.debugEnabled = config.logging.debug;
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
await installSkillToGlobal();
|
|
60
|
-
}
|
|
58
|
+
// Clean up legacy skill installation (pre-v1.7.0)
|
|
59
|
+
cleanupLegacySkillInstall();
|
|
61
60
|
// Load all snippets at startup (global + project directory)
|
|
62
61
|
const startupStart = performance.now();
|
|
63
62
|
const snippets = await loadSnippets(ctx.directory);
|
|
63
|
+
// Load skills if skill rendering is enabled
|
|
64
|
+
let skills = new Map();
|
|
65
|
+
if (config.experimental.skillRendering) {
|
|
66
|
+
skills = await loadSkills(ctx.directory);
|
|
67
|
+
}
|
|
64
68
|
const startupTime = performance.now() - startupStart;
|
|
65
69
|
logger.debug("Plugin startup complete", {
|
|
66
70
|
startupTimeMs: startupTime.toFixed(2),
|
|
67
71
|
snippetCount: snippets.size,
|
|
68
|
-
|
|
72
|
+
skillCount: skills.size,
|
|
73
|
+
skillRenderingEnabled: config.experimental.skillRendering,
|
|
74
|
+
injectBlocksEnabled: config.experimental.injectBlocks,
|
|
69
75
|
debugLogging: config.logging.debug,
|
|
70
76
|
});
|
|
71
77
|
// Create command handler
|
|
72
78
|
const commandHandler = createCommandExecuteHandler(ctx.client, snippets, ctx.directory);
|
|
79
|
+
const injectionManager = new InjectionManager();
|
|
73
80
|
/**
|
|
74
|
-
* Processes text parts for snippet expansion and shell command execution
|
|
81
|
+
* Processes text parts for snippet expansion, skill rendering, and shell command execution.
|
|
82
|
+
* Returns collected inject blocks from expanded snippets.
|
|
75
83
|
*/
|
|
76
84
|
const processTextParts = async (parts) => {
|
|
77
85
|
const messageStart = performance.now();
|
|
78
86
|
let expandTimeTotal = 0;
|
|
87
|
+
let skillTimeTotal = 0;
|
|
79
88
|
let shellTimeTotal = 0;
|
|
80
89
|
let processedParts = 0;
|
|
90
|
+
const allInjected = [];
|
|
91
|
+
const expandOptions = {
|
|
92
|
+
extractInject: config.experimental.injectBlocks,
|
|
93
|
+
};
|
|
81
94
|
for (const part of parts) {
|
|
82
95
|
if (part.type === "text" && part.text) {
|
|
83
|
-
// 1. Expand
|
|
96
|
+
// 1. Expand skill tags if skill rendering is enabled
|
|
97
|
+
if (config.experimental.skillRendering && skills.size > 0) {
|
|
98
|
+
const skillStart = performance.now();
|
|
99
|
+
part.text = expandSkillTags(part.text, skills);
|
|
100
|
+
skillTimeTotal += performance.now() - skillStart;
|
|
101
|
+
}
|
|
102
|
+
// 2. Expand hashtags recursively with loop detection
|
|
84
103
|
const expandStart = performance.now();
|
|
85
|
-
const expansionResult = expandHashtags(part.text, snippets);
|
|
104
|
+
const expansionResult = expandHashtags(part.text, snippets, new Map(), expandOptions);
|
|
86
105
|
part.text = assembleMessage(expansionResult);
|
|
87
|
-
|
|
88
|
-
expandTimeTotal +=
|
|
89
|
-
//
|
|
106
|
+
allInjected.push(...expansionResult.inject);
|
|
107
|
+
expandTimeTotal += performance.now() - expandStart;
|
|
108
|
+
// 3. Execute shell commands: !`command`
|
|
90
109
|
const shellStart = performance.now();
|
|
91
110
|
part.text = await executeShellCommands(part.text, ctx, {
|
|
92
111
|
hideCommandInOutput: config.hideCommandInOutput,
|
|
93
112
|
});
|
|
94
|
-
|
|
95
|
-
shellTimeTotal += shellTime;
|
|
113
|
+
shellTimeTotal += performance.now() - shellStart;
|
|
96
114
|
processedParts += 1;
|
|
97
115
|
}
|
|
98
116
|
}
|
|
99
|
-
const totalTime = performance.now() - messageStart;
|
|
100
117
|
if (processedParts > 0) {
|
|
118
|
+
const totalTime = performance.now() - messageStart;
|
|
101
119
|
logger.debug("Text parts processing complete", {
|
|
102
120
|
totalTimeMs: totalTime.toFixed(2),
|
|
121
|
+
skillTimeMs: skillTimeTotal.toFixed(2),
|
|
103
122
|
snippetExpandTimeMs: expandTimeTotal.toFixed(2),
|
|
104
123
|
shellTimeMs: shellTimeTotal.toFixed(2),
|
|
105
124
|
processedParts,
|
|
125
|
+
injectedCount: allInjected.length,
|
|
106
126
|
});
|
|
107
127
|
}
|
|
128
|
+
return allInjected;
|
|
108
129
|
};
|
|
109
130
|
return {
|
|
110
|
-
// Register /snippet command
|
|
131
|
+
// Register /snippet command and skill path
|
|
111
132
|
config: async (opencodeConfig) => {
|
|
133
|
+
// Register skill folder path for automatic discovery
|
|
134
|
+
const cfg = opencodeConfig;
|
|
135
|
+
cfg.skills ??= {};
|
|
136
|
+
cfg.skills.paths ??= [];
|
|
137
|
+
cfg.skills.paths.push(SKILL_DIR);
|
|
138
|
+
// Register /snippet command
|
|
112
139
|
opencodeConfig.command ??= {};
|
|
113
140
|
opencodeConfig.command.snippet = {
|
|
114
141
|
template: "",
|
|
115
142
|
description: "Manage text snippets (add, delete, list, help)",
|
|
116
143
|
};
|
|
117
144
|
},
|
|
118
|
-
// Handle /snippet command execution
|
|
119
145
|
"command.execute.before": commandHandler,
|
|
120
|
-
"chat.message": async (
|
|
121
|
-
// Only process user messages, never assistant messages
|
|
146
|
+
"chat.message": async (input, output) => {
|
|
122
147
|
if (output.message.role !== "user")
|
|
123
148
|
return;
|
|
124
|
-
|
|
125
|
-
if (output.parts.some((part) => "ignored" in part && part.ignored))
|
|
149
|
+
if (output.parts.some((part) => part.ignored))
|
|
126
150
|
return;
|
|
127
|
-
await processTextParts(output.parts);
|
|
151
|
+
const injected = await processTextParts(output.parts);
|
|
152
|
+
output.parts.forEach((part) => {
|
|
153
|
+
if (part.type === "text") {
|
|
154
|
+
part.snippetsProcessed = true;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
if (injected.length > 0) {
|
|
158
|
+
injectionManager.addInjections(input.sessionID, injected);
|
|
159
|
+
}
|
|
128
160
|
},
|
|
129
|
-
|
|
130
|
-
|
|
161
|
+
"experimental.chat.messages.transform": async (input, output) => {
|
|
162
|
+
const sessionID = input.sessionID || input.session?.id || output.messages[0]?.info?.sessionID;
|
|
163
|
+
logger.debug("Transform hook called", {
|
|
164
|
+
inputSessionID: input.sessionID,
|
|
165
|
+
extractedSessionID: sessionID,
|
|
166
|
+
messageCount: output.messages.length,
|
|
167
|
+
hasSessionID: !!sessionID,
|
|
168
|
+
});
|
|
131
169
|
for (const message of output.messages) {
|
|
132
|
-
// Only process user messages
|
|
133
170
|
if (message.info.role === "user") {
|
|
134
|
-
|
|
135
|
-
|
|
171
|
+
if (message.parts.some((part) => part.snippetsProcessed))
|
|
172
|
+
continue;
|
|
173
|
+
if (message.parts.some((part) => part.ignored))
|
|
136
174
|
continue;
|
|
137
|
-
await processTextParts(message.parts);
|
|
175
|
+
const injected = await processTextParts(message.parts);
|
|
176
|
+
if (injected.length > 0 && sessionID) {
|
|
177
|
+
injectionManager.addInjections(sessionID, injected);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (sessionID) {
|
|
182
|
+
const injections = injectionManager.getInjections(sessionID);
|
|
183
|
+
logger.debug("Transform hook - checking for injections", {
|
|
184
|
+
sessionID,
|
|
185
|
+
hasInjections: !!injections,
|
|
186
|
+
injectionCount: injections?.length || 0,
|
|
187
|
+
messageTexts: output.messages.map((m) => ({
|
|
188
|
+
role: m.info.role,
|
|
189
|
+
text: m.parts
|
|
190
|
+
.filter((p) => p.type === "text")
|
|
191
|
+
.map((p) => (p.text || "").slice(0, 50))
|
|
192
|
+
.join(" | "),
|
|
193
|
+
snippetsProcessed: m.parts.some((p) => p.snippetsProcessed),
|
|
194
|
+
})),
|
|
195
|
+
});
|
|
196
|
+
if (injections && injections.length > 0) {
|
|
197
|
+
const beforeCount = output.messages.length;
|
|
198
|
+
for (const injectText of injections) {
|
|
199
|
+
output.messages.push({
|
|
200
|
+
info: {
|
|
201
|
+
role: "user",
|
|
202
|
+
sessionID: sessionID,
|
|
203
|
+
},
|
|
204
|
+
parts: [{ type: "text", text: injectText }],
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
logger.debug("Injected ephemeral user messages", {
|
|
208
|
+
sessionID,
|
|
209
|
+
injectionCount: injections.length,
|
|
210
|
+
messagesBefore: beforeCount,
|
|
211
|
+
messagesAfter: output.messages.length,
|
|
212
|
+
});
|
|
138
213
|
}
|
|
139
214
|
}
|
|
140
215
|
},
|
|
141
|
-
|
|
216
|
+
"session.idle": async (event) => {
|
|
217
|
+
injectionManager.clearSession(event.sessionID);
|
|
218
|
+
},
|
|
219
|
+
// Process skill tool output to expand snippets and skill tags in skill content
|
|
142
220
|
"tool.execute.after": async (input, output) => {
|
|
143
|
-
// Only process the skill tool
|
|
144
221
|
if (input.tool !== "skill")
|
|
145
222
|
return;
|
|
146
223
|
// The skill tool returns markdown content in its output
|
|
147
|
-
// Expand hashtags in the skill content
|
|
224
|
+
// Expand skill tags and hashtags in the skill content
|
|
148
225
|
if (typeof output.output === "string" && output.output.trim()) {
|
|
149
|
-
|
|
226
|
+
let processed = output.output;
|
|
227
|
+
// First expand skill tags if enabled
|
|
228
|
+
if (config.experimental.skillRendering && skills.size > 0) {
|
|
229
|
+
processed = expandSkillTags(processed, skills);
|
|
230
|
+
}
|
|
231
|
+
// Then expand hashtag snippets
|
|
232
|
+
const expandOptions = {
|
|
233
|
+
extractInject: config.experimental.injectBlocks,
|
|
234
|
+
};
|
|
235
|
+
const expansionResult = expandHashtags(processed, snippets, new Map(), expandOptions);
|
|
150
236
|
output.output = assembleMessage(expansionResult);
|
|
151
237
|
logger.debug("Skill content expanded", {
|
|
152
238
|
tool: input.tool,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAsB,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQxF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAqB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAsB,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CA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B,MAAM,aAAa,GAAkB;oBACnC,aAAa,EAAE,MAAM,CAAC,YAAY,CAAC,YAAY;iBAChD,CAAC;gBACF,MAAM,eAAe,GAAG,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;gBACtF,MAAM,CAAC,MAAM,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;gBAEjD,MAAM,CAAC,KAAK,CAAC,wBAAwB,EAAE;oBACrC,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,MAAM,EAAE,KAAK,CAAC,MAAM;iBACrB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/src/config.d.ts
CHANGED
|
@@ -9,14 +9,23 @@ export interface LoggingConfig {
|
|
|
9
9
|
/** Enable debug logging to file */
|
|
10
10
|
debug: boolean;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Experimental features configuration
|
|
14
|
+
*/
|
|
15
|
+
export interface ExperimentalConfig {
|
|
16
|
+
/** Enable skill rendering with <skill>name</skill> or <skill name="name" /> syntax */
|
|
17
|
+
skillRendering: boolean;
|
|
18
|
+
/** Enable <inject>...</inject> blocks for persistent context messages */
|
|
19
|
+
injectBlocks: boolean;
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* Configuration schema for the snippets plugin
|
|
14
23
|
*/
|
|
15
24
|
export interface SnippetsConfig {
|
|
16
25
|
/** Logging settings */
|
|
17
26
|
logging: LoggingConfig;
|
|
18
|
-
/**
|
|
19
|
-
|
|
27
|
+
/** Experimental features */
|
|
28
|
+
experimental: ExperimentalConfig;
|
|
20
29
|
/** Hide shell command in output, showing only the result */
|
|
21
30
|
hideCommandInOutput: boolean;
|
|
22
31
|
}
|
package/dist/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,OAAO,EAAE,aAAa,CAAC;IAEvB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sFAAsF;IACtF,cAAc,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uBAAuB;IACvB,OAAO,EAAE,aAAa,CAAC;IAEvB,4BAA4B;IAC5B,YAAY,EAAE,kBAAkB,CAAC;IAEjC,4DAA4D;IAC5D,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAoHD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,cAAc,CA+B9D;AA0BD;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D"}
|
package/dist/src/config.js
CHANGED
|
@@ -9,7 +9,10 @@ const DEFAULT_CONFIG = {
|
|
|
9
9
|
logging: {
|
|
10
10
|
debug: false,
|
|
11
11
|
},
|
|
12
|
-
|
|
12
|
+
experimental: {
|
|
13
|
+
skillRendering: false,
|
|
14
|
+
injectBlocks: false,
|
|
15
|
+
},
|
|
13
16
|
hideCommandInOutput: false,
|
|
14
17
|
};
|
|
15
18
|
/**
|
|
@@ -28,12 +31,15 @@ const DEFAULT_CONFIG_CONTENT = `{
|
|
|
28
31
|
"debug": false
|
|
29
32
|
},
|
|
30
33
|
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
// Experimental features (may change or be removed)
|
|
35
|
+
"experimental": {
|
|
36
|
+
// Enable skill rendering with <skill>name</skill> or <skill name="name" /> syntax
|
|
37
|
+
// When enabled, skill tags are replaced with the skill's content body
|
|
38
|
+
// Skills are loaded from OpenCode's standard skill directories
|
|
39
|
+
// Values: true, false, "enabled", "disabled"
|
|
40
|
+
// Default: false
|
|
41
|
+
"skillRendering": false
|
|
42
|
+
},
|
|
37
43
|
|
|
38
44
|
// Hide shell command in snippet output
|
|
39
45
|
// When false (default), shell commands show as "$ command\\n--> output"
|
|
@@ -126,7 +132,7 @@ export function loadConfig(projectDir) {
|
|
|
126
132
|
}
|
|
127
133
|
logger.debug("Final config", {
|
|
128
134
|
loggingDebug: config.logging.debug,
|
|
129
|
-
|
|
135
|
+
experimentalSkillRendering: config.experimental.skillRendering,
|
|
130
136
|
hideCommandInOutput: config.hideCommandInOutput,
|
|
131
137
|
});
|
|
132
138
|
return config;
|
|
@@ -136,13 +142,17 @@ export function loadConfig(projectDir) {
|
|
|
136
142
|
*/
|
|
137
143
|
function mergeConfig(base, raw) {
|
|
138
144
|
const debugValue = normalizeBooleanSetting(raw.logging?.debug);
|
|
139
|
-
const
|
|
145
|
+
const skillRenderingValue = normalizeBooleanSetting(raw.experimental?.skillRendering);
|
|
146
|
+
const injectBlocksValue = normalizeBooleanSetting(raw.experimental?.injectBlocks);
|
|
140
147
|
const hideCommandValue = normalizeBooleanSetting(raw.hideCommandInOutput);
|
|
141
148
|
return {
|
|
142
149
|
logging: {
|
|
143
150
|
debug: debugValue !== undefined ? debugValue : base.logging.debug,
|
|
144
151
|
},
|
|
145
|
-
|
|
152
|
+
experimental: {
|
|
153
|
+
skillRendering: skillRenderingValue !== undefined ? skillRenderingValue : base.experimental.skillRendering,
|
|
154
|
+
injectBlocks: injectBlocksValue !== undefined ? injectBlocksValue : base.experimental.injectBlocks,
|
|
155
|
+
},
|
|
146
156
|
hideCommandInOutput: hideCommandValue !== undefined ? hideCommandValue : base.hideCommandInOutput,
|
|
147
157
|
};
|
|
148
158
|
}
|
package/dist/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAqDrC;;GAEG;AACH,MAAM,cAAc,GAAmB;IACrC,OAAO,EAAE;QACP,KAAK,EAAE,KAAK;KACb;IACD,YAAY,EAAE;QACZ,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,KAAK;KACpB;IACD,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,sBAAsB,G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AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,KAAK,CAAC,kBAAkB,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACrD,OAAO,eAAe,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC;AACjD,CAAC"}
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export declare const PATTERNS: {
|
|
|
6
6
|
readonly HASHTAG: RegExp;
|
|
7
7
|
/** Matches shell commands like !`command` */
|
|
8
8
|
readonly SHELL_COMMAND: RegExp;
|
|
9
|
+
/**
|
|
10
|
+
* Matches skill tags in two formats:
|
|
11
|
+
* 1. Self-closing: <skill name="skill-name" /> or <skill name='skill-name'/>
|
|
12
|
+
* 2. Block format: <skill>skill-name</skill>
|
|
13
|
+
*/
|
|
14
|
+
readonly SKILL_TAG_SELF_CLOSING: RegExp;
|
|
15
|
+
readonly SKILL_TAG_BLOCK: RegExp;
|
|
9
16
|
};
|
|
10
17
|
/**
|
|
11
18
|
* File system paths
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB,0CAA0C;;IAG1C,6CAA6C;;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB,0CAA0C;;IAG1C,6CAA6C;;IAG7C;;;;OAIG;;;CAGK,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,KAAK;IAChB,uCAAuC;;IAGvC,yBAAyB;;IAGzB,yBAAyB;;CAEjB,CAAC;AAEX;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM;;;EAMjD;AAED;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB,uCAAuC;;CAE/B,CAAC"}
|
package/dist/src/constants.js
CHANGED
|
@@ -8,6 +8,13 @@ export const PATTERNS = {
|
|
|
8
8
|
HASHTAG: /#([a-z0-9\-_]+)/gi,
|
|
9
9
|
/** Matches shell commands like !`command` */
|
|
10
10
|
SHELL_COMMAND: /!`([^`]+)`/g,
|
|
11
|
+
/**
|
|
12
|
+
* Matches skill tags in two formats:
|
|
13
|
+
* 1. Self-closing: <skill name="skill-name" /> or <skill name='skill-name'/>
|
|
14
|
+
* 2. Block format: <skill>skill-name</skill>
|
|
15
|
+
*/
|
|
16
|
+
SKILL_TAG_SELF_CLOSING: /<skill\s+name=["']([^"']+)["']\s*\/>/gi,
|
|
17
|
+
SKILL_TAG_BLOCK: /<skill>([^<]+)<\/skill>/gi,
|
|
11
18
|
};
|
|
12
19
|
/**
|
|
13
20
|
* File system paths
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,0CAA0C;IAC1C,OAAO,EAAE,mBAAmB;IAE5B,6CAA6C;IAC7C,aAAa,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,0CAA0C;IAC1C,OAAO,EAAE,mBAAmB;IAE5B,6CAA6C;IAC7C,aAAa,EAAE,aAAa;IAE5B;;;;OAIG;IACH,sBAAsB,EAAE,wCAAwC;IAChE,eAAe,EAAE,2BAA2B;CACpC,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,uCAAuC;IACvC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC;IAElD,yBAAyB;IACzB,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,CAAC;IAE/D,yBAAyB;IACzB,kBAAkB,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC;CAC7E,CAAC;AAEX;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC5D,OAAO;QACL,YAAY,EAAE,UAAU;QACxB,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,uCAAuC;IACvC,iBAAiB,EAAE,KAAK;CAChB,CAAC"}
|
package/dist/src/expander.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { ExpansionResult, ParsedSnippetContent, SnippetRegistry } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Options for snippet expansion
|
|
4
|
+
*/
|
|
5
|
+
export interface ExpandOptions {
|
|
6
|
+
/** Whether to extract inject blocks (default: true). If false, inject tags are left as-is. */
|
|
7
|
+
extractInject?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Parses snippet content to extract inline text and prepend/append/inject blocks
|
|
4
11
|
*
|
|
5
12
|
* Uses a lenient stack-based parser:
|
|
6
13
|
* - Unclosed tags → treat rest of content as block
|
|
@@ -8,9 +15,10 @@ import type { ExpansionResult, ParsedSnippetContent, SnippetRegistry } from "./t
|
|
|
8
15
|
* - Multiple blocks → collected in document order
|
|
9
16
|
*
|
|
10
17
|
* @param content - The raw snippet content to parse
|
|
11
|
-
* @
|
|
18
|
+
* @param options - Parsing options
|
|
19
|
+
* @returns Parsed content with inline, prepend, append, and inject parts, or null on error
|
|
12
20
|
*/
|
|
13
|
-
export declare function parseSnippetBlocks(content: string): ParsedSnippetContent | null;
|
|
21
|
+
export declare function parseSnippetBlocks(content: string, options?: ExpandOptions): ParsedSnippetContent | null;
|
|
14
22
|
/**
|
|
15
23
|
* Expands hashtags in text recursively with loop detection
|
|
16
24
|
*
|
|
@@ -20,9 +28,10 @@ export declare function parseSnippetBlocks(content: string): ParsedSnippetConten
|
|
|
20
28
|
* @param text - The text containing hashtags to expand
|
|
21
29
|
* @param registry - The snippet registry to look up hashtags
|
|
22
30
|
* @param expansionCounts - Map tracking how many times each snippet has been expanded
|
|
31
|
+
* @param options - Expansion options
|
|
23
32
|
* @returns ExpansionResult with text and collected blocks
|
|
24
33
|
*/
|
|
25
|
-
export declare function expandHashtags(text: string, registry: SnippetRegistry, expansionCounts?: Map<string, number
|
|
34
|
+
export declare function expandHashtags(text: string, registry: SnippetRegistry, expansionCounts?: Map<string, number>, options?: ExpandOptions): ExpansionResult;
|
|
26
35
|
/**
|
|
27
36
|
* Assembles the final message from an expansion result
|
|
28
37
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expander.d.ts","sourceRoot":"","sources":["../../src/expander.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYzF
|
|
1
|
+
{"version":3,"file":"expander.d.ts","sourceRoot":"","sources":["../../src/expander.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYzF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8FAA8F;IAC9F,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAkB,GAC1B,oBAAoB,GAAG,IAAI,CAoF7B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,eAAe,EACzB,eAAe,sBAA4B,EAC3C,OAAO,GAAE,aAAkB,GAC1B,eAAe,CAkFjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAmB/D"}
|