@a1st/aix-schema 0.0.3

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 (74) hide show
  1. package/dist/aix.d.ts +51 -0
  2. package/dist/aix.d.ts.map +1 -0
  3. package/dist/aix.js +39 -0
  4. package/dist/aix.js.map +1 -0
  5. package/dist/config.d.ts +12130 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +36 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/core.d.ts +17 -0
  10. package/dist/core.d.ts.map +1 -0
  11. package/dist/core.js +34 -0
  12. package/dist/core.js.map +1 -0
  13. package/dist/editors.d.ts +3288 -0
  14. package/dist/editors.d.ts.map +1 -0
  15. package/dist/editors.js +52 -0
  16. package/dist/editors.js.map +1 -0
  17. package/dist/factory.d.ts +7 -0
  18. package/dist/factory.d.ts.map +1 -0
  19. package/dist/factory.js +15 -0
  20. package/dist/factory.js.map +1 -0
  21. package/dist/hooks.d.ts +106 -0
  22. package/dist/hooks.d.ts.map +1 -0
  23. package/dist/hooks.js +50 -0
  24. package/dist/hooks.js.map +1 -0
  25. package/dist/index.d.ts +18 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +18 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/jsonc.d.ts +10 -0
  30. package/dist/jsonc.d.ts.map +1 -0
  31. package/dist/jsonc.js +16 -0
  32. package/dist/jsonc.js.map +1 -0
  33. package/dist/mcp.d.ts +508 -0
  34. package/dist/mcp.d.ts.map +1 -0
  35. package/dist/mcp.js +92 -0
  36. package/dist/mcp.js.map +1 -0
  37. package/dist/migrate.d.ts +11 -0
  38. package/dist/migrate.d.ts.map +1 -0
  39. package/dist/migrate.js +24 -0
  40. package/dist/migrate.js.map +1 -0
  41. package/dist/normalize.d.ts +36 -0
  42. package/dist/normalize.d.ts.map +1 -0
  43. package/dist/normalize.js +143 -0
  44. package/dist/normalize.js.map +1 -0
  45. package/dist/prompts.d.ts +297 -0
  46. package/dist/prompts.d.ts.map +1 -0
  47. package/dist/prompts.js +50 -0
  48. package/dist/prompts.js.map +1 -0
  49. package/dist/references.d.ts +60 -0
  50. package/dist/references.d.ts.map +1 -0
  51. package/dist/references.js +23 -0
  52. package/dist/references.js.map +1 -0
  53. package/dist/rules.d.ts +534 -0
  54. package/dist/rules.d.ts.map +1 -0
  55. package/dist/rules.js +85 -0
  56. package/dist/rules.js.map +1 -0
  57. package/dist/skill.d.ts +38 -0
  58. package/dist/skill.d.ts.map +1 -0
  59. package/dist/skill.js +18 -0
  60. package/dist/skill.js.map +1 -0
  61. package/dist/skills.d.ts +183 -0
  62. package/dist/skills.d.ts.map +1 -0
  63. package/dist/skills.js +26 -0
  64. package/dist/skills.js.map +1 -0
  65. package/dist/validate.d.ts +17 -0
  66. package/dist/validate.d.ts.map +1 -0
  67. package/dist/validate.js +34 -0
  68. package/dist/validate.js.map +1 -0
  69. package/dist/version.d.ts +3 -0
  70. package/dist/version.d.ts.map +1 -0
  71. package/dist/version.js +5 -0
  72. package/dist/version.js.map +1 -0
  73. package/package.json +42 -0
  74. package/schema.json +1408 -0
@@ -0,0 +1,36 @@
1
+ import type { AiJsonConfig } from './config.js';
2
+ /**
3
+ * Detect if a string is a local path reference.
4
+ */
5
+ export declare function isLocalPath(value: string): boolean;
6
+ /**
7
+ * Normalize a source reference string to its object form.
8
+ * - Local paths (./, ../, /, file:) → { path: "..." }
9
+ * - NPM with subpath (pkg/path/file.md) → { npm: { npm: "pkg", path: "path/file.md" } }
10
+ * - Everything else (URLs, git shorthands) → { git: { url: "..." } }
11
+ */
12
+ export declare function normalizeSourceRef(value: string | Record<string, unknown>): Record<string, unknown>;
13
+ /**
14
+ * Normalize a rules config object, expanding string shorthands.
15
+ */
16
+ export declare function normalizeRulesConfig(rules: Record<string, string | Record<string, unknown>>): Record<string, Record<string, unknown>>;
17
+ /**
18
+ * Normalize a prompts config object, expanding string shorthands.
19
+ */
20
+ export declare function normalizePromptsConfig(prompts: Record<string, string | Record<string, unknown>>): Record<string, Record<string, unknown>>;
21
+ /**
22
+ * Normalize editors from array shorthand to object form.
23
+ * - String items: "windsurf" → { windsurf: { enabled: true } }
24
+ * - Object items: { "cursor": {...} } → merged with enabled: true
25
+ * - Unlisted editors are implicitly disabled.
26
+ */
27
+ export declare function normalizeEditors(editors: string[] | Array<string | Record<string, unknown>> | Record<string, unknown>): Record<string, {
28
+ enabled: boolean;
29
+ [key: string]: unknown;
30
+ }>;
31
+ /**
32
+ * Normalize entire ai.json config, expanding all shorthands to their verbose forms.
33
+ * This should be called after schema validation but before internal processing.
34
+ */
35
+ export declare function normalizeConfig(config: unknown): AiJsonConfig;
36
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAOhD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD;AAmDD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAqBnG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACvD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAOzC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzD,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAOzC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrF,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,CAmB9D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,CAiC7D"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Prefixes that indicate a local file path reference.
3
+ */
4
+ const LOCAL_PATH_PREFIXES = ['./', '../', '/', 'file:'];
5
+ /**
6
+ * Detect if a string is a local path reference.
7
+ */
8
+ export function isLocalPath(value) {
9
+ return LOCAL_PATH_PREFIXES.some((p) => value.startsWith(p));
10
+ }
11
+ /**
12
+ * Parse npm package reference with optional subpath from a string.
13
+ * Requires file extension to distinguish from plain package names.
14
+ *
15
+ * Examples:
16
+ * - "@scope/pkg/rules/style.md" → { npm: "@scope/pkg", path: "rules/style.md" }
17
+ * - "pkg/prompts/review.md" → { npm: "pkg", path: "prompts/review.md" }
18
+ * - "@scope/pkg" → undefined (no subpath with extension)
19
+ */
20
+ function parseNpmRef(str) {
21
+ // Must have a file extension to be treated as npm with subpath
22
+ const hasExtension = /\.[a-z0-9]+$/i.test(str);
23
+ if (!hasExtension) {
24
+ return undefined;
25
+ }
26
+ // Don't match git shorthands or URLs
27
+ if (str.includes(':')) {
28
+ return undefined;
29
+ }
30
+ if (str.startsWith('@')) {
31
+ // Scoped: @scope/package/subpath
32
+ const parts = str.split('/');
33
+ if (parts.length < 3) {
34
+ return undefined;
35
+ } // Need at least @scope/pkg/file.ext
36
+ return {
37
+ npm: `${parts[0]}/${parts[1]}`,
38
+ path: parts.slice(2).join('/'),
39
+ };
40
+ }
41
+ // Unscoped: package/subpath
42
+ const slashIdx = str.indexOf('/');
43
+ if (slashIdx === -1) {
44
+ return undefined;
45
+ } // No subpath
46
+ return {
47
+ npm: str.slice(0, slashIdx),
48
+ path: str.slice(slashIdx + 1),
49
+ };
50
+ }
51
+ /**
52
+ * Normalize a source reference string to its object form.
53
+ * - Local paths (./, ../, /, file:) → { path: "..." }
54
+ * - NPM with subpath (pkg/path/file.md) → { npm: { npm: "pkg", path: "path/file.md" } }
55
+ * - Everything else (URLs, git shorthands) → { git: { url: "..." } }
56
+ */
57
+ export function normalizeSourceRef(value) {
58
+ if (typeof value !== 'string') {
59
+ return value;
60
+ }
61
+ if (isLocalPath(value)) {
62
+ // Strip file: prefix if present
63
+ const path = value.startsWith('file:') ? value.slice(5) : value;
64
+ return { path };
65
+ }
66
+ // Check for npm with subpath (has file extension)
67
+ const npmParsed = parseNpmRef(value);
68
+ if (npmParsed) {
69
+ return { npm: npmParsed };
70
+ }
71
+ // Everything else is a git/URL reference
72
+ return { git: { url: value } };
73
+ }
74
+ /**
75
+ * Normalize a rules config object, expanding string shorthands.
76
+ */
77
+ export function normalizeRulesConfig(rules) {
78
+ const result = {};
79
+ for (const [name, value] of Object.entries(rules)) {
80
+ result[name] = normalizeSourceRef(value);
81
+ }
82
+ return result;
83
+ }
84
+ /**
85
+ * Normalize a prompts config object, expanding string shorthands.
86
+ */
87
+ export function normalizePromptsConfig(prompts) {
88
+ const result = {};
89
+ for (const [name, value] of Object.entries(prompts)) {
90
+ result[name] = normalizeSourceRef(value);
91
+ }
92
+ return result;
93
+ }
94
+ /**
95
+ * Normalize editors from array shorthand to object form.
96
+ * - String items: "windsurf" → { windsurf: { enabled: true } }
97
+ * - Object items: { "cursor": {...} } → merged with enabled: true
98
+ * - Unlisted editors are implicitly disabled.
99
+ */
100
+ export function normalizeEditors(editors) {
101
+ if (!Array.isArray(editors)) {
102
+ return editors;
103
+ }
104
+ const result = {};
105
+ for (const item of editors) {
106
+ if (typeof item === 'string') {
107
+ result[item] = { enabled: true };
108
+ }
109
+ else {
110
+ // Object entry: { "cursor": { aiSettings: {...} } }
111
+ for (const [name, config] of Object.entries(item)) {
112
+ result[name] = { enabled: true, ...config };
113
+ }
114
+ }
115
+ }
116
+ return result;
117
+ }
118
+ /**
119
+ * Normalize entire ai.json config, expanding all shorthands to their verbose forms.
120
+ * This should be called after schema validation but before internal processing.
121
+ */
122
+ export function normalizeConfig(config) {
123
+ if (typeof config !== 'object' || config === null) {
124
+ return config;
125
+ }
126
+ const normalized = { ...config };
127
+ // Normalize editors
128
+ if (normalized.editors) {
129
+ normalized.editors = normalizeEditors(normalized.editors);
130
+ }
131
+ // Normalize rules (object format)
132
+ if (normalized.rules && typeof normalized.rules === 'object' && !Array.isArray(normalized.rules)) {
133
+ normalized.rules = normalizeRulesConfig(normalized.rules);
134
+ }
135
+ // Normalize prompts (object format)
136
+ if (normalized.prompts &&
137
+ typeof normalized.prompts === 'object' &&
138
+ !Array.isArray(normalized.prompts)) {
139
+ normalized.prompts = normalizePromptsConfig(normalized.prompts);
140
+ }
141
+ return normalized;
142
+ }
143
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACtC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,WAAW,CAAC,GAAW;IAC7B,+DAA+D;IAC/D,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/C,IAAI,CAA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AO,GAAG,sBAAsB,CACxC,UAAU,CAAC,OAA2D,CACxE,CAAC;IACL,CAAC;IAED,OAAO,UAA0B,CAAC;AACrC,CAAC"}
@@ -0,0 +1,297 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Prompt object with metadata and content source.
4
+ * Note: `name` is no longer needed in object form - it's the key in the parent object.
5
+ */
6
+ export declare const promptObjectSchema: z.ZodEffects<z.ZodObject<{
7
+ description: z.ZodOptional<z.ZodString>;
8
+ argumentHint: z.ZodOptional<z.ZodString>;
9
+ content: z.ZodOptional<z.ZodString>;
10
+ path: z.ZodOptional<z.ZodString>;
11
+ git: z.ZodOptional<z.ZodObject<{
12
+ url: z.ZodString;
13
+ path: z.ZodOptional<z.ZodString>;
14
+ ref: z.ZodOptional<z.ZodString>;
15
+ }, "strip", z.ZodTypeAny, {
16
+ url: string;
17
+ path?: string | undefined;
18
+ ref?: string | undefined;
19
+ }, {
20
+ url: string;
21
+ path?: string | undefined;
22
+ ref?: string | undefined;
23
+ }>>;
24
+ npm: z.ZodOptional<z.ZodObject<{
25
+ npm: z.ZodString;
26
+ path: z.ZodString;
27
+ version: z.ZodOptional<z.ZodString>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ path: string;
30
+ npm: string;
31
+ version?: string | undefined;
32
+ }, {
33
+ path: string;
34
+ npm: string;
35
+ version?: string | undefined;
36
+ }>>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ path?: string | undefined;
39
+ git?: {
40
+ url: string;
41
+ path?: string | undefined;
42
+ ref?: string | undefined;
43
+ } | undefined;
44
+ npm?: {
45
+ path: string;
46
+ npm: string;
47
+ version?: string | undefined;
48
+ } | undefined;
49
+ description?: string | undefined;
50
+ content?: string | undefined;
51
+ argumentHint?: string | undefined;
52
+ }, {
53
+ path?: string | undefined;
54
+ git?: {
55
+ url: string;
56
+ path?: string | undefined;
57
+ ref?: string | undefined;
58
+ } | undefined;
59
+ npm?: {
60
+ path: string;
61
+ npm: string;
62
+ version?: string | undefined;
63
+ } | undefined;
64
+ description?: string | undefined;
65
+ content?: string | undefined;
66
+ argumentHint?: string | undefined;
67
+ }>, {
68
+ path?: string | undefined;
69
+ git?: {
70
+ url: string;
71
+ path?: string | undefined;
72
+ ref?: string | undefined;
73
+ } | undefined;
74
+ npm?: {
75
+ path: string;
76
+ npm: string;
77
+ version?: string | undefined;
78
+ } | undefined;
79
+ description?: string | undefined;
80
+ content?: string | undefined;
81
+ argumentHint?: string | undefined;
82
+ }, {
83
+ path?: string | undefined;
84
+ git?: {
85
+ url: string;
86
+ path?: string | undefined;
87
+ ref?: string | undefined;
88
+ } | undefined;
89
+ npm?: {
90
+ path: string;
91
+ npm: string;
92
+ version?: string | undefined;
93
+ } | undefined;
94
+ description?: string | undefined;
95
+ content?: string | undefined;
96
+ argumentHint?: string | undefined;
97
+ }>;
98
+ /**
99
+ * A prompt value can be:
100
+ * - String: source reference (local path or git URL) - normalized at parse time
101
+ * - Object: full prompt with content source and optional metadata
102
+ */
103
+ export declare const promptValueSchema: z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodObject<{
104
+ description: z.ZodOptional<z.ZodString>;
105
+ argumentHint: z.ZodOptional<z.ZodString>;
106
+ content: z.ZodOptional<z.ZodString>;
107
+ path: z.ZodOptional<z.ZodString>;
108
+ git: z.ZodOptional<z.ZodObject<{
109
+ url: z.ZodString;
110
+ path: z.ZodOptional<z.ZodString>;
111
+ ref: z.ZodOptional<z.ZodString>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ url: string;
114
+ path?: string | undefined;
115
+ ref?: string | undefined;
116
+ }, {
117
+ url: string;
118
+ path?: string | undefined;
119
+ ref?: string | undefined;
120
+ }>>;
121
+ npm: z.ZodOptional<z.ZodObject<{
122
+ npm: z.ZodString;
123
+ path: z.ZodString;
124
+ version: z.ZodOptional<z.ZodString>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ path: string;
127
+ npm: string;
128
+ version?: string | undefined;
129
+ }, {
130
+ path: string;
131
+ npm: string;
132
+ version?: string | undefined;
133
+ }>>;
134
+ }, "strip", z.ZodTypeAny, {
135
+ path?: string | undefined;
136
+ git?: {
137
+ url: string;
138
+ path?: string | undefined;
139
+ ref?: string | undefined;
140
+ } | undefined;
141
+ npm?: {
142
+ path: string;
143
+ npm: string;
144
+ version?: string | undefined;
145
+ } | undefined;
146
+ description?: string | undefined;
147
+ content?: string | undefined;
148
+ argumentHint?: string | undefined;
149
+ }, {
150
+ path?: string | undefined;
151
+ git?: {
152
+ url: string;
153
+ path?: string | undefined;
154
+ ref?: string | undefined;
155
+ } | undefined;
156
+ npm?: {
157
+ path: string;
158
+ npm: string;
159
+ version?: string | undefined;
160
+ } | undefined;
161
+ description?: string | undefined;
162
+ content?: string | undefined;
163
+ argumentHint?: string | undefined;
164
+ }>, {
165
+ path?: string | undefined;
166
+ git?: {
167
+ url: string;
168
+ path?: string | undefined;
169
+ ref?: string | undefined;
170
+ } | undefined;
171
+ npm?: {
172
+ path: string;
173
+ npm: string;
174
+ version?: string | undefined;
175
+ } | undefined;
176
+ description?: string | undefined;
177
+ content?: string | undefined;
178
+ argumentHint?: string | undefined;
179
+ }, {
180
+ path?: string | undefined;
181
+ git?: {
182
+ url: string;
183
+ path?: string | undefined;
184
+ ref?: string | undefined;
185
+ } | undefined;
186
+ npm?: {
187
+ path: string;
188
+ npm: string;
189
+ version?: string | undefined;
190
+ } | undefined;
191
+ description?: string | undefined;
192
+ content?: string | undefined;
193
+ argumentHint?: string | undefined;
194
+ }>]>;
195
+ /**
196
+ * Prompt name validation (key in the prompts object).
197
+ */
198
+ export declare const promptNameSchema: z.ZodString;
199
+ /**
200
+ * Prompts config - object keyed by prompt name.
201
+ */
202
+ export declare const promptsSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEffects<z.ZodObject<{
203
+ description: z.ZodOptional<z.ZodString>;
204
+ argumentHint: z.ZodOptional<z.ZodString>;
205
+ content: z.ZodOptional<z.ZodString>;
206
+ path: z.ZodOptional<z.ZodString>;
207
+ git: z.ZodOptional<z.ZodObject<{
208
+ url: z.ZodString;
209
+ path: z.ZodOptional<z.ZodString>;
210
+ ref: z.ZodOptional<z.ZodString>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ url: string;
213
+ path?: string | undefined;
214
+ ref?: string | undefined;
215
+ }, {
216
+ url: string;
217
+ path?: string | undefined;
218
+ ref?: string | undefined;
219
+ }>>;
220
+ npm: z.ZodOptional<z.ZodObject<{
221
+ npm: z.ZodString;
222
+ path: z.ZodString;
223
+ version: z.ZodOptional<z.ZodString>;
224
+ }, "strip", z.ZodTypeAny, {
225
+ path: string;
226
+ npm: string;
227
+ version?: string | undefined;
228
+ }, {
229
+ path: string;
230
+ npm: string;
231
+ version?: string | undefined;
232
+ }>>;
233
+ }, "strip", z.ZodTypeAny, {
234
+ path?: string | undefined;
235
+ git?: {
236
+ url: string;
237
+ path?: string | undefined;
238
+ ref?: string | undefined;
239
+ } | undefined;
240
+ npm?: {
241
+ path: string;
242
+ npm: string;
243
+ version?: string | undefined;
244
+ } | undefined;
245
+ description?: string | undefined;
246
+ content?: string | undefined;
247
+ argumentHint?: string | undefined;
248
+ }, {
249
+ path?: string | undefined;
250
+ git?: {
251
+ url: string;
252
+ path?: string | undefined;
253
+ ref?: string | undefined;
254
+ } | undefined;
255
+ npm?: {
256
+ path: string;
257
+ npm: string;
258
+ version?: string | undefined;
259
+ } | undefined;
260
+ description?: string | undefined;
261
+ content?: string | undefined;
262
+ argumentHint?: string | undefined;
263
+ }>, {
264
+ path?: string | undefined;
265
+ git?: {
266
+ url: string;
267
+ path?: string | undefined;
268
+ ref?: string | undefined;
269
+ } | undefined;
270
+ npm?: {
271
+ path: string;
272
+ npm: string;
273
+ version?: string | undefined;
274
+ } | undefined;
275
+ description?: string | undefined;
276
+ content?: string | undefined;
277
+ argumentHint?: string | undefined;
278
+ }, {
279
+ path?: string | undefined;
280
+ git?: {
281
+ url: string;
282
+ path?: string | undefined;
283
+ ref?: string | undefined;
284
+ } | undefined;
285
+ npm?: {
286
+ path: string;
287
+ npm: string;
288
+ version?: string | undefined;
289
+ } | undefined;
290
+ description?: string | undefined;
291
+ content?: string | undefined;
292
+ argumentHint?: string | undefined;
293
+ }>]>, z.ZodLiteral<false>]>>;
294
+ export type PromptObject = z.infer<typeof promptObjectSchema>;
295
+ export type PromptValue = z.infer<typeof promptValueSchema>;
296
+ export type PromptsConfig = z.infer<typeof promptsSchema>;
297
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBU,CAAC;AAa1C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAoD,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,gBAAgB,aAQ6B,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAEoD,CAAC;AAE/E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+ import { gitSourceSchema, npmSourceSchema } from './rules.js';
3
+ /**
4
+ * Prompt object with metadata and content source.
5
+ * Note: `name` is no longer needed in object form - it's the key in the parent object.
6
+ */
7
+ export const promptObjectSchema = z
8
+ .object({
9
+ description: z.string().optional().describe('Shown in command picker'),
10
+ argumentHint: z.string().optional().describe('Hint for arguments (e.g., "[file] [message]")'),
11
+ content: z.string().optional().describe('Inline prompt content'),
12
+ path: z.string().optional().describe('Local file path to prompt content'),
13
+ git: gitSourceSchema.optional().describe('Git repository source'),
14
+ npm: npmSourceSchema.optional().describe('NPM package source'),
15
+ })
16
+ .refine((data) => {
17
+ const sources = [data.content, data.path, data.git, data.npm].filter(Boolean);
18
+ return sources.length === 1;
19
+ }, { message: 'Exactly one content source required: content, path, git, or npm' })
20
+ .describe('Prompt/command definition');
21
+ /**
22
+ * String shorthand for source references.
23
+ * - Local paths: "./prompts/review.md", "../shared/prompts.md", "/abs/path", "file:../foo"
24
+ * - Git URLs: "https://...", "git+https://...", "github:user/repo", "user/repo#ref"
25
+ */
26
+ const promptStringSchema = z
27
+ .string()
28
+ .describe('Source reference: local path (./, ../, /, file:), git URL (https://), or git shorthand (github:)');
29
+ /**
30
+ * A prompt value can be:
31
+ * - String: source reference (local path or git URL) - normalized at parse time
32
+ * - Object: full prompt with content source and optional metadata
33
+ */
34
+ export const promptValueSchema = z.union([promptStringSchema, promptObjectSchema]);
35
+ /**
36
+ * Prompt name validation (key in the prompts object).
37
+ */
38
+ export const promptNameSchema = z
39
+ .string()
40
+ .min(1)
41
+ .max(64)
42
+ .regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'Prompt name must be lowercase alphanumeric with single hyphens (e.g., "code-review")')
43
+ .describe('Prompt name (used as key and command name)');
44
+ /**
45
+ * Prompts config - object keyed by prompt name.
46
+ */
47
+ export const promptsSchema = z
48
+ .record(promptNameSchema, z.union([promptValueSchema, z.literal(false)]))
49
+ .describe('Map of prompt names to their definitions (or false to disable)');
50
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACL,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IACtE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;IAC7F,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IAChE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IACzE,GAAG,EAAE,eAAe,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACjE,GAAG,EAAE,eAAe,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;CAChE,CAAC;KACD,MAAM,CACJ,CAAC,IAAI,EAAE,EAAE;IACN,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE9E,OAAO,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;AAC/B,CAAC,EACD,EAAE,OAAO,EAAE,iEAAiE,EAAE,CAChF;KACA,QAAQ,CAAC,2BAA2B,CAAC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,QAAQ,CACN,kGAAkG,CACpG,CAAC;AAEL;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CAAC;AAEnF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CACH,0BAA0B,EAC1B,sFAAsF,CACxF;KACA,QAAQ,CAAC,4CAA4C,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC1B,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACxE,QAAQ,CAAC,gEAAgE,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ export declare const localRefSchema: z.ZodObject<{
3
+ path: z.ZodString;
4
+ }, "strip", z.ZodTypeAny, {
5
+ path: string;
6
+ }, {
7
+ path: string;
8
+ }>;
9
+ export declare const gitRefSchema: z.ZodObject<{
10
+ git: z.ZodString;
11
+ ref: z.ZodOptional<z.ZodString>;
12
+ path: z.ZodOptional<z.ZodString>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ git: string;
15
+ path?: string | undefined;
16
+ ref?: string | undefined;
17
+ }, {
18
+ git: string;
19
+ path?: string | undefined;
20
+ ref?: string | undefined;
21
+ }>;
22
+ export declare const registryRefSchema: z.ZodObject<{
23
+ version: z.ZodEffects<z.ZodString, string, string>;
24
+ registry: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ version: string;
27
+ registry?: string | undefined;
28
+ }, {
29
+ version: string;
30
+ registry?: string | undefined;
31
+ }>;
32
+ export declare const sourceRefSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
33
+ git: z.ZodString;
34
+ ref: z.ZodOptional<z.ZodString>;
35
+ path: z.ZodOptional<z.ZodString>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ git: string;
38
+ path?: string | undefined;
39
+ ref?: string | undefined;
40
+ }, {
41
+ git: string;
42
+ path?: string | undefined;
43
+ ref?: string | undefined;
44
+ }>, z.ZodObject<{
45
+ path: z.ZodString;
46
+ }, "strip", z.ZodTypeAny, {
47
+ path: string;
48
+ }, {
49
+ path: string;
50
+ }>, z.ZodObject<{
51
+ version: z.ZodEffects<z.ZodString, string, string>;
52
+ registry: z.ZodOptional<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ version: string;
55
+ registry?: string | undefined;
56
+ }, {
57
+ version: string;
58
+ registry?: string | undefined;
59
+ }>]>;
60
+ //# sourceMappingURL=references.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;EAIvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;IAO6B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { semverRangeSchema } from './core.js';
3
+ export const localRefSchema = z.object({
4
+ path: z.string().describe('Local file or directory path'),
5
+ });
6
+ export const gitRefSchema = z.object({
7
+ git: z.string().describe('Git URL (e.g., "github:user/repo", "https://...")'),
8
+ ref: z.string().optional().describe('Git ref (branch, tag, commit)'),
9
+ path: z.string().optional().describe('Subdirectory within repo'),
10
+ });
11
+ export const registryRefSchema = z.object({
12
+ version: semverRangeSchema.describe('Version range from registry'),
13
+ registry: z.string().url().optional().describe('Custom registry URL'),
14
+ });
15
+ export const sourceRefSchema = z
16
+ .union([
17
+ z.string().describe('Shorthand: version range or local path'),
18
+ gitRefSchema,
19
+ localRefSchema,
20
+ registryRefSchema,
21
+ ])
22
+ .describe('Reference to a skill, config, or resource');
23
+ //# sourceMappingURL=references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.js","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IAC7E,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IACpE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;CAClE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,iBAAiB,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACvE,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC5B,KAAK,CAAC;IACJ,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IAC7D,YAAY;IACZ,cAAc;IACd,iBAAiB;CACnB,CAAC;KACD,QAAQ,CAAC,2CAA2C,CAAC,CAAC"}