opencode-snippets 1.2.0 → 1.4.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 +73 -13
- package/index.ts +20 -2
- package/package.json +4 -2
- package/src/commands.ts +335 -0
- package/src/constants.ts +2 -7
- package/src/expander.test.ts +468 -86
- package/src/expander.ts +167 -9
- package/src/loader.test.ts +25 -25
- package/src/loader.ts +154 -30
- package/src/logger.ts +2 -2
- package/src/notification.ts +29 -0
- package/src/types.ts +38 -2
package/src/types.ts
CHANGED
|
@@ -11,9 +11,21 @@ export interface Snippet {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Extended snippet info with file metadata
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export interface SnippetInfo {
|
|
17
|
+
name: string;
|
|
18
|
+
content: string;
|
|
19
|
+
aliases: string[];
|
|
20
|
+
description?: string;
|
|
21
|
+
filePath: string;
|
|
22
|
+
source: "global" | "project";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Snippet registry that maps keys to snippet info
|
|
27
|
+
*/
|
|
28
|
+
export type SnippetRegistry = Map<string, SnippetInfo>;
|
|
17
29
|
|
|
18
30
|
/**
|
|
19
31
|
* Frontmatter data from snippet files
|
|
@@ -24,3 +36,27 @@ export interface SnippetFrontmatter {
|
|
|
24
36
|
/** Optional description of what this snippet does */
|
|
25
37
|
description?: string;
|
|
26
38
|
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parsed snippet content with inline text and prepend/append blocks
|
|
42
|
+
*/
|
|
43
|
+
export interface ParsedSnippetContent {
|
|
44
|
+
/** Content outside blocks (replaces hashtag inline) */
|
|
45
|
+
inline: string;
|
|
46
|
+
/** <prepend> block contents in document order */
|
|
47
|
+
prepend: string[];
|
|
48
|
+
/** <append> block contents in document order */
|
|
49
|
+
append: string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Result of expanding hashtags, including collected prepend/append blocks
|
|
54
|
+
*/
|
|
55
|
+
export interface ExpansionResult {
|
|
56
|
+
/** The inline-expanded text */
|
|
57
|
+
text: string;
|
|
58
|
+
/** Collected prepend blocks from all expanded snippets */
|
|
59
|
+
prepend: string[];
|
|
60
|
+
/** Collected append blocks from all expanded snippets */
|
|
61
|
+
append: string[];
|
|
62
|
+
}
|