@a1st/aix-schema 0.6.0 → 0.8.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/dist/jsonc.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parse, printParseErrorCode } from 'jsonc-parser';
1
+ import { parse, parseTree, findNodeAtLocation, createScanner, printParseErrorCode, modify, applyEdits, } from 'jsonc-parser';
2
2
  export function parseJsonc(content) {
3
3
  const errors = [], data = parse(content, errors, {
4
4
  allowTrailingComma: true,
@@ -13,4 +13,201 @@ export function parseJsonc(content) {
13
13
  })),
14
14
  };
15
15
  }
16
+ function isPlainObject(value) {
17
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
18
+ }
19
+ function detectJsoncIndent(content) {
20
+ const match = content.match(/^[ \t]+(?=\S)/m);
21
+ if (!match) {
22
+ return { tabSize: 3, insertSpaces: true };
23
+ }
24
+ const indentStr = match[0];
25
+ if (indentStr.startsWith('\t')) {
26
+ return { tabSize: 1, insertSpaces: false };
27
+ }
28
+ return { tabSize: indentStr.length, insertSpaces: true };
29
+ }
30
+ function safeRemoveFirstChildProperty(content, path) {
31
+ const root = parseTree(content);
32
+ if (!root) {
33
+ return undefined;
34
+ }
35
+ const node = findNodeAtLocation(root, path);
36
+ if (!node) {
37
+ return undefined;
38
+ }
39
+ const propNode = node.parent;
40
+ if (!propNode || propNode.type !== 'property') {
41
+ return undefined;
42
+ }
43
+ const parent = propNode.parent;
44
+ if (!parent || parent.type !== 'object' || !Array.isArray(parent.children)) {
45
+ return undefined;
46
+ }
47
+ const children = parent.children, index = children.indexOf(propNode);
48
+ if (index !== 0 || children.length <= 1) {
49
+ return undefined;
50
+ }
51
+ const nextChild = children[1];
52
+ if (!nextChild) {
53
+ return undefined;
54
+ }
55
+ const scanner = createScanner(content, false);
56
+ scanner.setPosition(propNode.offset + propNode.length);
57
+ let token = scanner.scan();
58
+ while (token !== 17 /* SyntaxKind.EOF */ && token !== 5 /* SyntaxKind.CommaToken */ && scanner.getTokenOffset() < nextChild.offset) {
59
+ token = scanner.scan();
60
+ }
61
+ let removeEnd = propNode.offset + propNode.length;
62
+ if (token === 5 /* SyntaxKind.CommaToken */) {
63
+ removeEnd = scanner.getTokenOffset() + scanner.getTokenLength();
64
+ const afterComma = content.slice(removeEnd), lineBreak = afterComma.match(/^[ \t]*\r?\n/);
65
+ if (lineBreak) {
66
+ removeEnd += lineBreak[0].length;
67
+ }
68
+ }
69
+ let removeBegin = propNode.offset;
70
+ while (removeBegin > parent.offset + 1 && content[removeBegin - 1] !== '\n') {
71
+ removeBegin--;
72
+ }
73
+ const triviaScanner = createScanner(content, false);
74
+ triviaScanner.setPosition(parent.offset + 1);
75
+ let t = triviaScanner.scan(), lastCommentOffset = -1;
76
+ while (triviaScanner.getTokenOffset() < propNode.offset) {
77
+ if (t === 12 /* SyntaxKind.LineCommentTrivia */ || t === 13 /* SyntaxKind.BlockCommentTrivia */) {
78
+ lastCommentOffset = triviaScanner.getTokenOffset();
79
+ }
80
+ t = triviaScanner.scan();
81
+ }
82
+ if (lastCommentOffset !== -1) {
83
+ const between = content.slice(lastCommentOffset, propNode.offset);
84
+ if (!/(?:\r?\n){2}/.test(between)) {
85
+ removeBegin = lastCommentOffset;
86
+ while (removeBegin > parent.offset + 1 && content[removeBegin - 1] !== '\n') {
87
+ removeBegin--;
88
+ }
89
+ }
90
+ }
91
+ return content.slice(0, removeBegin) + content.slice(removeEnd);
92
+ }
93
+ /**
94
+ * Modify or remove a value at a specified path in a JSONC string while preserving comments.
95
+ */
96
+ export function modifyJsonc(content, path, value, options = {}) {
97
+ if (value === undefined) {
98
+ const firstChildRemoval = safeRemoveFirstChildProperty(content, path);
99
+ if (firstChildRemoval !== undefined) {
100
+ if (content.endsWith('\n') && !firstChildRemoval.endsWith('\n')) {
101
+ return firstChildRemoval + '\n';
102
+ }
103
+ return firstChildRemoval;
104
+ }
105
+ }
106
+ const formattingOptions = {
107
+ ...detectJsoncIndent(content),
108
+ ...options,
109
+ };
110
+ const edits = modify(content, path, value, { formattingOptions });
111
+ let result = applyEdits(content, edits);
112
+ if (content.endsWith('\n') && !result.endsWith('\n')) {
113
+ result += '\n';
114
+ }
115
+ return result;
116
+ }
117
+ /**
118
+ * Remove a property at a specified path in a JSONC string while preserving comments.
119
+ */
120
+ export function removeJsoncProperty(content, path, options) {
121
+ return modifyJsonc(content, path, undefined, options);
122
+ }
123
+ /**
124
+ * Deeply merge an override object into existing JSONC content while preserving comments.
125
+ */
126
+ export function mergeJsonc(content, override, options = {}) {
127
+ if (!content.trim()) {
128
+ const tabSize = options.tabSize ?? 3;
129
+ return JSON.stringify(override, null, tabSize) + '\n';
130
+ }
131
+ let current = content;
132
+ const formattingOptions = {
133
+ ...detectJsoncIndent(current),
134
+ ...options,
135
+ };
136
+ function getExistingValueAtPath(path) {
137
+ const parsed = parse(current);
138
+ let val = parsed;
139
+ for (const p of path) {
140
+ if (!isPlainObject(val) && !Array.isArray(val)) {
141
+ return undefined;
142
+ }
143
+ val = val[p];
144
+ }
145
+ return val;
146
+ }
147
+ function applyLevel(obj, path) {
148
+ for (const [key, newValue] of Object.entries(obj)) {
149
+ const currentPath = [...path, key], oldValue = getExistingValueAtPath(currentPath), strategy = options.resolver?.({ key, path, oldValue, newValue });
150
+ if (strategy === 'keep') {
151
+ continue;
152
+ }
153
+ if (oldValue !== undefined && JSON.stringify(oldValue) === JSON.stringify(newValue)) {
154
+ continue;
155
+ }
156
+ if (strategy === 'replace') {
157
+ current = modifyJsonc(current, currentPath, newValue, formattingOptions);
158
+ }
159
+ else if (isPlainObject(newValue) && isPlainObject(oldValue)) {
160
+ applyLevel(newValue, currentPath);
161
+ }
162
+ else {
163
+ current = modifyJsonc(current, currentPath, newValue, formattingOptions);
164
+ }
165
+ }
166
+ }
167
+ applyLevel(override, []);
168
+ if (content.endsWith('\n') && !current.endsWith('\n')) {
169
+ current += '\n';
170
+ }
171
+ return current;
172
+ }
173
+ /**
174
+ * Apply changes from newObject to existing JSONC content, adding, updating, or removing
175
+ * properties while preserving comments on unchanged fields.
176
+ */
177
+ export function applyJsoncDiff(content, newObject, options = {}) {
178
+ let current = content;
179
+ const formattingOptions = {
180
+ ...detectJsoncIndent(current),
181
+ ...options,
182
+ };
183
+ function diffLevel(oldLevel, newLevel, path) {
184
+ if (isPlainObject(oldLevel)) {
185
+ for (const key of Object.keys(oldLevel)) {
186
+ if (!isPlainObject(newLevel) || !(key in newLevel)) {
187
+ current = modifyJsonc(current, [...path, key], undefined, formattingOptions);
188
+ }
189
+ }
190
+ }
191
+ if (isPlainObject(newLevel)) {
192
+ for (const [key, newValue] of Object.entries(newLevel)) {
193
+ const oldValue = isPlainObject(oldLevel) ? oldLevel[key] : undefined, currentPath = [...path, key];
194
+ if (isPlainObject(newValue) && isPlainObject(oldValue)) {
195
+ diffLevel(oldValue, newValue, currentPath);
196
+ }
197
+ else if (JSON.stringify(oldValue) !== JSON.stringify(newValue)) {
198
+ current = modifyJsonc(current, currentPath, newValue, formattingOptions);
199
+ }
200
+ }
201
+ }
202
+ }
203
+ const oldObj = parse(current);
204
+ if (!isPlainObject(oldObj)) {
205
+ return JSON.stringify(newObject, null, formattingOptions.tabSize) + '\n';
206
+ }
207
+ diffLevel(oldObj, newObject, []);
208
+ if (content.endsWith('\n') && !current.endsWith('\n')) {
209
+ current += '\n';
210
+ }
211
+ return current;
212
+ }
16
213
  //# sourceMappingURL=jsonc.js.map
package/dist/jsonc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"jsonc.js","sourceRoot":"","sources":["../src/jsonc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAO3E,MAAM,UAAU,UAAU,CAAc,OAAe;IACpD,MAAM,MAAM,GAAiB,EAAE,EACzB,IAAI,GAAG,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE;QAC3B,kBAAkB,EAAE,IAAI;QACxB,gBAAgB,EAAE,KAAK;KACzB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AE,CAAC;QACrD,OAAO,IAAI,IAAI,CAAC;IACnB,CAAC;IAED,OAAO,OAAO,CAAC;AAClB,CAAC"}
@@ -0,0 +1,135 @@
1
+ import { z } from 'zod';
2
+ export declare const marketplaceNameSchema: z.ZodString;
3
+ export declare const marketplaceObjectSchema: z.ZodObject<{
4
+ source: z.ZodUnion<[z.ZodString, z.ZodObject<{
5
+ git: z.ZodString;
6
+ ref: z.ZodOptional<z.ZodString>;
7
+ path: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ git: string;
10
+ path?: string | undefined;
11
+ ref?: string | undefined;
12
+ }, {
13
+ git: string;
14
+ path?: string | undefined;
15
+ ref?: string | undefined;
16
+ }>, z.ZodObject<{
17
+ path: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ path: string;
20
+ }, {
21
+ path: string;
22
+ }>]>;
23
+ enabled: z.ZodOptional<z.ZodBoolean>;
24
+ description: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ source: string | {
27
+ path: string;
28
+ } | {
29
+ git: string;
30
+ path?: string | undefined;
31
+ ref?: string | undefined;
32
+ };
33
+ description?: string | undefined;
34
+ enabled?: boolean | undefined;
35
+ }, {
36
+ source: string | {
37
+ path: string;
38
+ } | {
39
+ git: string;
40
+ path?: string | undefined;
41
+ ref?: string | undefined;
42
+ };
43
+ description?: string | undefined;
44
+ enabled?: boolean | undefined;
45
+ }>;
46
+ export declare const marketplaceValueSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
47
+ source: z.ZodUnion<[z.ZodString, z.ZodObject<{
48
+ git: z.ZodString;
49
+ ref: z.ZodOptional<z.ZodString>;
50
+ path: z.ZodOptional<z.ZodString>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ git: string;
53
+ path?: string | undefined;
54
+ ref?: string | undefined;
55
+ }, {
56
+ git: string;
57
+ path?: string | undefined;
58
+ ref?: string | undefined;
59
+ }>, z.ZodObject<{
60
+ path: z.ZodString;
61
+ }, "strip", z.ZodTypeAny, {
62
+ path: string;
63
+ }, {
64
+ path: string;
65
+ }>]>;
66
+ enabled: z.ZodOptional<z.ZodBoolean>;
67
+ description: z.ZodOptional<z.ZodString>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ source: string | {
70
+ path: string;
71
+ } | {
72
+ git: string;
73
+ path?: string | undefined;
74
+ ref?: string | undefined;
75
+ };
76
+ description?: string | undefined;
77
+ enabled?: boolean | undefined;
78
+ }, {
79
+ source: string | {
80
+ path: string;
81
+ } | {
82
+ git: string;
83
+ path?: string | undefined;
84
+ ref?: string | undefined;
85
+ };
86
+ description?: string | undefined;
87
+ enabled?: boolean | undefined;
88
+ }>]>;
89
+ export declare const marketplacesSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
90
+ source: z.ZodUnion<[z.ZodString, z.ZodObject<{
91
+ git: z.ZodString;
92
+ ref: z.ZodOptional<z.ZodString>;
93
+ path: z.ZodOptional<z.ZodString>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ git: string;
96
+ path?: string | undefined;
97
+ ref?: string | undefined;
98
+ }, {
99
+ git: string;
100
+ path?: string | undefined;
101
+ ref?: string | undefined;
102
+ }>, z.ZodObject<{
103
+ path: z.ZodString;
104
+ }, "strip", z.ZodTypeAny, {
105
+ path: string;
106
+ }, {
107
+ path: string;
108
+ }>]>;
109
+ enabled: z.ZodOptional<z.ZodBoolean>;
110
+ description: z.ZodOptional<z.ZodString>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ source: string | {
113
+ path: string;
114
+ } | {
115
+ git: string;
116
+ path?: string | undefined;
117
+ ref?: string | undefined;
118
+ };
119
+ description?: string | undefined;
120
+ enabled?: boolean | undefined;
121
+ }, {
122
+ source: string | {
123
+ path: string;
124
+ } | {
125
+ git: string;
126
+ path?: string | undefined;
127
+ ref?: string | undefined;
128
+ };
129
+ description?: string | undefined;
130
+ enabled?: boolean | undefined;
131
+ }>]>, z.ZodLiteral<false>]>>;
132
+ export type MarketplaceObject = z.infer<typeof marketplaceObjectSchema>;
133
+ export type MarketplaceValue = z.infer<typeof marketplaceValueSchema>;
134
+ export type MarketplacesConfig = z.infer<typeof marketplacesSchema>;
135
+ //# sourceMappingURL=marketplaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketplaces.d.ts","sourceRoot":"","sources":["../src/marketplaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB,aAQI,CAAC;AAEvC,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYY,CAAC;AAEjD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGjC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAE0D,CAAC;AAE1F,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { gitRefSchema, localRefSchema } from './references.js';
3
+ export const marketplaceNameSchema = z
4
+ .string()
5
+ .min(1)
6
+ .max(64)
7
+ .regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'Marketplace name must be lowercase alphanumeric with single hyphens (e.g., "claude-plugins-official")')
8
+ .describe('Marketplace identifier');
9
+ export const marketplaceObjectSchema = z
10
+ .object({
11
+ source: z
12
+ .union([
13
+ z.string().describe('Git shorthand, HTTPS URL, or local path'),
14
+ gitRefSchema,
15
+ localRefSchema,
16
+ ])
17
+ .describe('Source location of the marketplace catalog'),
18
+ enabled: z.boolean().optional().describe('Whether the marketplace is active (default: true)'),
19
+ description: z.string().optional().describe('Optional description of the marketplace'),
20
+ })
21
+ .describe('Marketplace configuration object');
22
+ export const marketplaceValueSchema = z.union([
23
+ z.string().describe('Marketplace source URL, git shorthand, or local directory path'),
24
+ marketplaceObjectSchema,
25
+ ]);
26
+ export const marketplacesSchema = z
27
+ .record(marketplaceNameSchema, z.union([marketplaceValueSchema, z.literal(false)]))
28
+ .describe('Map of marketplace names to their catalog locations (or false to disable)');
29
+ //# sourceMappingURL=marketplaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketplaces.js","sourceRoot":"","sources":["../src/marketplaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE/D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KAClC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CACH,0BAA0B,EAC1B,uGAAuG,CACzG;KACA,QAAQ,CAAC,wBAAwB,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACpC,MAAM,CAAC;IACL,MAAM,EAAE,CAAC;SACL,KAAK,CAAC;QACJ,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;QAC9D,YAAY;QACZ,cAAc;KAChB,CAAC;SACD,QAAQ,CAAC,4CAA4C,CAAC;IAC1D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IAC7F,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CACxF,CAAC;KACD,QAAQ,CAAC,kCAAkC,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gEAAgE,CAAC;IACrF,uBAAuB;CACzB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAC/B,MAAM,CAAC,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KAClF,QAAQ,CAAC,2EAA2E,CAAC,CAAC"}
@@ -0,0 +1,198 @@
1
+ import { z } from 'zod';
2
+ export declare const pluginNameSchema: z.ZodString;
3
+ export declare const pluginObjectSchema: z.ZodObject<{
4
+ marketplace: z.ZodOptional<z.ZodString>;
5
+ source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
6
+ git: z.ZodString;
7
+ ref: z.ZodOptional<z.ZodString>;
8
+ path: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ git: string;
11
+ path?: string | undefined;
12
+ ref?: string | undefined;
13
+ }, {
14
+ git: string;
15
+ path?: string | undefined;
16
+ ref?: string | undefined;
17
+ }>, z.ZodObject<{
18
+ path: z.ZodString;
19
+ }, "strip", z.ZodTypeAny, {
20
+ path: string;
21
+ }, {
22
+ path: string;
23
+ }>, z.ZodObject<{
24
+ version: z.ZodEffects<z.ZodString, string, string>;
25
+ registry: z.ZodOptional<z.ZodString>;
26
+ }, "strip", z.ZodTypeAny, {
27
+ version: string;
28
+ registry?: string | undefined;
29
+ }, {
30
+ version: string;
31
+ registry?: string | undefined;
32
+ }>]>>;
33
+ enabled: z.ZodOptional<z.ZodBoolean>;
34
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
35
+ editor: z.ZodOptional<z.ZodRecord<z.ZodEnum<["windsurf", "devin", "cursor", "claude-code", "copilot", "zed", "neovim", "antigravity", "agy", "opencode", "grok", "grok-cli"]>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
36
+ }, "strip", z.ZodTypeAny, {
37
+ options?: Record<string, unknown> | undefined;
38
+ enabled?: boolean | undefined;
39
+ editor?: Partial<Record<"windsurf" | "devin" | "cursor" | "claude-code" | "copilot" | "zed" | "neovim" | "antigravity" | "agy" | "opencode" | "grok" | "grok-cli", Record<string, unknown>>> | undefined;
40
+ source?: string | {
41
+ path: string;
42
+ } | {
43
+ git: string;
44
+ path?: string | undefined;
45
+ ref?: string | undefined;
46
+ } | {
47
+ version: string;
48
+ registry?: string | undefined;
49
+ } | undefined;
50
+ marketplace?: string | undefined;
51
+ }, {
52
+ options?: Record<string, unknown> | undefined;
53
+ enabled?: boolean | undefined;
54
+ editor?: Partial<Record<"windsurf" | "devin" | "cursor" | "claude-code" | "copilot" | "zed" | "neovim" | "antigravity" | "agy" | "opencode" | "grok" | "grok-cli", Record<string, unknown>>> | undefined;
55
+ source?: string | {
56
+ path: string;
57
+ } | {
58
+ git: string;
59
+ path?: string | undefined;
60
+ ref?: string | undefined;
61
+ } | {
62
+ version: string;
63
+ registry?: string | undefined;
64
+ } | undefined;
65
+ marketplace?: string | undefined;
66
+ }>;
67
+ export declare const pluginValueSchema: z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodObject<{
68
+ marketplace: z.ZodOptional<z.ZodString>;
69
+ source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
70
+ git: z.ZodString;
71
+ ref: z.ZodOptional<z.ZodString>;
72
+ path: z.ZodOptional<z.ZodString>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ git: string;
75
+ path?: string | undefined;
76
+ ref?: string | undefined;
77
+ }, {
78
+ git: string;
79
+ path?: string | undefined;
80
+ ref?: string | undefined;
81
+ }>, z.ZodObject<{
82
+ path: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ path: string;
85
+ }, {
86
+ path: string;
87
+ }>, z.ZodObject<{
88
+ version: z.ZodEffects<z.ZodString, string, string>;
89
+ registry: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ version: string;
92
+ registry?: string | undefined;
93
+ }, {
94
+ version: string;
95
+ registry?: string | undefined;
96
+ }>]>>;
97
+ enabled: z.ZodOptional<z.ZodBoolean>;
98
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
99
+ editor: z.ZodOptional<z.ZodRecord<z.ZodEnum<["windsurf", "devin", "cursor", "claude-code", "copilot", "zed", "neovim", "antigravity", "agy", "opencode", "grok", "grok-cli"]>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ options?: Record<string, unknown> | undefined;
102
+ enabled?: boolean | undefined;
103
+ editor?: Partial<Record<"windsurf" | "devin" | "cursor" | "claude-code" | "copilot" | "zed" | "neovim" | "antigravity" | "agy" | "opencode" | "grok" | "grok-cli", Record<string, unknown>>> | undefined;
104
+ source?: string | {
105
+ path: string;
106
+ } | {
107
+ git: string;
108
+ path?: string | undefined;
109
+ ref?: string | undefined;
110
+ } | {
111
+ version: string;
112
+ registry?: string | undefined;
113
+ } | undefined;
114
+ marketplace?: string | undefined;
115
+ }, {
116
+ options?: Record<string, unknown> | undefined;
117
+ enabled?: boolean | undefined;
118
+ editor?: Partial<Record<"windsurf" | "devin" | "cursor" | "claude-code" | "copilot" | "zed" | "neovim" | "antigravity" | "agy" | "opencode" | "grok" | "grok-cli", Record<string, unknown>>> | undefined;
119
+ source?: string | {
120
+ path: string;
121
+ } | {
122
+ git: string;
123
+ path?: string | undefined;
124
+ ref?: string | undefined;
125
+ } | {
126
+ version: string;
127
+ registry?: string | undefined;
128
+ } | undefined;
129
+ marketplace?: string | undefined;
130
+ }>]>;
131
+ export declare const pluginsSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodBoolean, z.ZodString, z.ZodObject<{
132
+ marketplace: z.ZodOptional<z.ZodString>;
133
+ source: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
134
+ git: z.ZodString;
135
+ ref: z.ZodOptional<z.ZodString>;
136
+ path: z.ZodOptional<z.ZodString>;
137
+ }, "strip", z.ZodTypeAny, {
138
+ git: string;
139
+ path?: string | undefined;
140
+ ref?: string | undefined;
141
+ }, {
142
+ git: string;
143
+ path?: string | undefined;
144
+ ref?: string | undefined;
145
+ }>, z.ZodObject<{
146
+ path: z.ZodString;
147
+ }, "strip", z.ZodTypeAny, {
148
+ path: string;
149
+ }, {
150
+ path: string;
151
+ }>, z.ZodObject<{
152
+ version: z.ZodEffects<z.ZodString, string, string>;
153
+ registry: z.ZodOptional<z.ZodString>;
154
+ }, "strip", z.ZodTypeAny, {
155
+ version: string;
156
+ registry?: string | undefined;
157
+ }, {
158
+ version: string;
159
+ registry?: string | undefined;
160
+ }>]>>;
161
+ enabled: z.ZodOptional<z.ZodBoolean>;
162
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
163
+ editor: z.ZodOptional<z.ZodRecord<z.ZodEnum<["windsurf", "devin", "cursor", "claude-code", "copilot", "zed", "neovim", "antigravity", "agy", "opencode", "grok", "grok-cli"]>, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ options?: Record<string, unknown> | undefined;
166
+ enabled?: boolean | undefined;
167
+ editor?: Partial<Record<"windsurf" | "devin" | "cursor" | "claude-code" | "copilot" | "zed" | "neovim" | "antigravity" | "agy" | "opencode" | "grok" | "grok-cli", Record<string, unknown>>> | undefined;
168
+ source?: string | {
169
+ path: string;
170
+ } | {
171
+ git: string;
172
+ path?: string | undefined;
173
+ ref?: string | undefined;
174
+ } | {
175
+ version: string;
176
+ registry?: string | undefined;
177
+ } | undefined;
178
+ marketplace?: string | undefined;
179
+ }, {
180
+ options?: Record<string, unknown> | undefined;
181
+ enabled?: boolean | undefined;
182
+ editor?: Partial<Record<"windsurf" | "devin" | "cursor" | "claude-code" | "copilot" | "zed" | "neovim" | "antigravity" | "agy" | "opencode" | "grok" | "grok-cli", Record<string, unknown>>> | undefined;
183
+ source?: string | {
184
+ path: string;
185
+ } | {
186
+ git: string;
187
+ path?: string | undefined;
188
+ ref?: string | undefined;
189
+ } | {
190
+ version: string;
191
+ registry?: string | undefined;
192
+ } | undefined;
193
+ marketplace?: string | undefined;
194
+ }>]>, z.ZodLiteral<false>]>>;
195
+ export type PluginObject = z.infer<typeof pluginObjectSchema>;
196
+ export type PluginValue = z.infer<typeof pluginValueSchema>;
197
+ export type PluginsConfig = z.infer<typeof pluginsSchema>;
198
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,gBAAgB,aAQ+E,CAAC;AAE7G,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWY,CAAC;AAE5C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAI5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAEkE,CAAC;AAE7F,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,30 @@
1
+ import { z } from 'zod';
2
+ import { sourceRefSchema } from './references.js';
3
+ import { editorEnum } from './editors.js';
4
+ export const pluginNameSchema = z
5
+ .string()
6
+ .min(1)
7
+ .max(128)
8
+ .regex(/^(@[a-z0-9_.-]+\/)?[a-z0-9_.-]+(@[a-z0-9_.-]+)?$/, 'Plugin name must be a valid package name or plugin@marketplace identifier')
9
+ .describe('Plugin identifier (e.g., "code-review", "code-review@claude-plugins-official", "@scope/pkg")');
10
+ export const pluginObjectSchema = z
11
+ .object({
12
+ marketplace: z.string().optional().describe('Marketplace name where plugin is published'),
13
+ source: sourceRefSchema.optional().describe('Direct source reference (path, git URL, npm package, or registry)'),
14
+ enabled: z.boolean().optional().describe('Whether the plugin is active (default: true)'),
15
+ options: z.record(z.unknown()).optional().describe('Plugin-specific configuration options'),
16
+ editor: z
17
+ .record(editorEnum, z.record(z.unknown()))
18
+ .optional()
19
+ .describe('Editor-specific plugin configuration fields'),
20
+ })
21
+ .describe('Plugin configuration object');
22
+ export const pluginValueSchema = z.union([
23
+ z.boolean().describe('Boolean flag to enable or disable plugin'),
24
+ z.string().describe('Source shorthand (path, git repo, or package name)'),
25
+ pluginObjectSchema,
26
+ ]);
27
+ export const pluginsSchema = z
28
+ .record(pluginNameSchema, z.union([pluginValueSchema, z.literal(false)]))
29
+ .describe('Map of plugin names or plugin@marketplace identifiers to their configuration');
30
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,GAAG,CAAC,CA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C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a1st/aix-schema",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "JSON Schema and validation for aix configuration",
5
5
  "keywords": [
6
6
  "ai-config",
@@ -34,8 +34,8 @@
34
34
  "scripts": {
35
35
  "build": "tsc -p tsconfig.build.json && npm run generate-schema",
36
36
  "generate-schema": "node --import=@poppinss/ts-exec scripts/generate-schema.ts && oxfmt schema.json",
37
- "test": "vitest run",
38
- "test:watch": "vitest"
37
+ "test": "node ../../scripts/test-runner.mjs run",
38
+ "test:watch": "node ../../scripts/test-runner.mjs"
39
39
  },
40
40
  "dependencies": {
41
41
  "compare-versions": "6.1.1",