dryai 2.1.0 → 3.0.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 +140 -122
- package/dest/cli.d.ts +68 -0
- package/dest/cli.js +147 -0
- package/dest/commands/skills/add.d.ts +4 -3
- package/dest/commands/skills/add.js +44 -12
- package/dest/commands/skills/index.d.ts +3 -3
- package/dest/commands/skills/index.js +19 -12
- package/dest/commands/skills/list.d.ts +2 -2
- package/dest/commands/skills/list.js +4 -3
- package/dest/commands/skills/rehash-all.d.ts +2 -2
- package/dest/commands/skills/rehash-all.js +6 -5
- package/dest/commands/skills/rehash.d.ts +2 -2
- package/dest/commands/skills/rehash.js +3 -2
- package/dest/commands/skills/remove.d.ts +2 -2
- package/dest/commands/skills/remove.js +3 -2
- package/dest/commands/skills/update-all.d.ts +2 -2
- package/dest/commands/skills/update-all.js +8 -7
- package/dest/commands/skills/update.d.ts +2 -2
- package/dest/commands/skills/update.js +6 -5
- package/dest/commands/sync.d.ts +6 -0
- package/dest/commands/sync.js +8 -0
- package/dest/lib/agent-definition-helpers.d.ts +74 -0
- package/dest/lib/agent-definition-helpers.js +68 -0
- package/dest/lib/agent-definitions.d.ts +333 -0
- package/dest/lib/agent-definitions.js +301 -0
- package/dest/lib/agent-types.d.ts +46 -0
- package/dest/lib/agent-types.js +1 -0
- package/dest/lib/agents.d.ts +81 -0
- package/dest/lib/agents.js +301 -0
- package/dest/lib/command-options.d.ts +1 -1
- package/dest/lib/command-options.js +1 -1
- package/dest/lib/context.d.ts +8 -25
- package/dest/lib/context.js +8 -26
- package/dest/lib/frontmatter.d.ts +27 -70
- package/dest/lib/frontmatter.js +23 -42
- package/dest/lib/object-helpers.d.ts +5 -0
- package/dest/lib/object-helpers.js +6 -0
- package/dest/lib/skills.d.ts +35 -93
- package/dest/lib/skills.js +66 -8
- package/dest/lib/sync.d.ts +7 -0
- package/dest/lib/sync.js +503 -0
- package/dest/main.js +6 -86
- package/package.json +3 -3
- package/dest/commands/install.d.ts +0 -3
- package/dest/commands/install.js +0 -4
- package/dest/lib/install.d.ts +0 -8
- package/dest/lib/install.js +0 -380
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AgentCmdSyncSpec, AgentRuleSyncSpec, AgentSkillSyncSpec } from './agent-types.js';
|
|
3
|
+
type ConfiguredTargetRoots = Record<string, Record<string, string>>;
|
|
4
|
+
/**
|
|
5
|
+
* The central sync agent registry, mapping each agent name to its command, rule, and skill definitions.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AGENT_DEFINITIONS: {
|
|
8
|
+
readonly copilot: {
|
|
9
|
+
readonly displayLabel: "Copilot";
|
|
10
|
+
readonly targetRoots: {
|
|
11
|
+
readonly prompts: readonly [".copilot", "prompts"];
|
|
12
|
+
readonly instructions: readonly [".copilot", "instructions"];
|
|
13
|
+
readonly skills: readonly [".copilot", "skills"];
|
|
14
|
+
};
|
|
15
|
+
readonly command: {
|
|
16
|
+
frontmatterSection: {
|
|
17
|
+
schema: z.ZodType<Record<string, never> | undefined, unknown, z.core.$ZodTypeInternals<Record<string, never> | undefined, unknown>>;
|
|
18
|
+
createSyncInputExtension: (value: unknown, context: {
|
|
19
|
+
currentInput: AgentCmdSyncSpec;
|
|
20
|
+
sectionValues: ReadonlyMap<string, unknown>;
|
|
21
|
+
}) => {
|
|
22
|
+
success: false;
|
|
23
|
+
issues: readonly z.ZodIssue[];
|
|
24
|
+
} | {
|
|
25
|
+
success: true;
|
|
26
|
+
data: Partial<AgentCmdSyncSpec>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
ownershipKey: {
|
|
30
|
+
prefix: "copilot:prompt-path:";
|
|
31
|
+
descriptionLabel: string;
|
|
32
|
+
createKey: (value: string) => `copilot:prompt-path:${string}`;
|
|
33
|
+
createKeyForInput: (value: import("./agent-types.js").OwnershipKeyInput) => `copilot:prompt-path:${string}`;
|
|
34
|
+
};
|
|
35
|
+
outputPathCreators: {
|
|
36
|
+
createTargetPath: (value: {
|
|
37
|
+
targetRoots: ConfiguredTargetRoots;
|
|
38
|
+
itemName: string;
|
|
39
|
+
sourceFileStem: string;
|
|
40
|
+
}) => string;
|
|
41
|
+
createWritePath: (targetPath: string) => string;
|
|
42
|
+
};
|
|
43
|
+
metadata: {
|
|
44
|
+
schema: z.ZodObject<{
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
description: z.ZodString;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
create: (value: {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
}) => {
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
target: {
|
|
57
|
+
buildTarget: (value: {
|
|
58
|
+
targetRoots: ConfiguredTargetRoots;
|
|
59
|
+
input: AgentCmdSyncSpec;
|
|
60
|
+
}) => {
|
|
61
|
+
agent: string;
|
|
62
|
+
body: string;
|
|
63
|
+
metadata: {
|
|
64
|
+
name: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
67
|
+
outputPath: string;
|
|
68
|
+
targetType: "markdown";
|
|
69
|
+
writePath: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly rule: {
|
|
74
|
+
frontmatterSection: {
|
|
75
|
+
schema: z.ZodType<{
|
|
76
|
+
applyTo: string;
|
|
77
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
78
|
+
applyTo: string;
|
|
79
|
+
}, unknown>>;
|
|
80
|
+
createSyncInputExtension: (value: unknown, context: {
|
|
81
|
+
currentInput: AgentRuleSyncSpec;
|
|
82
|
+
sectionValues: ReadonlyMap<string, unknown>;
|
|
83
|
+
}) => {
|
|
84
|
+
success: false;
|
|
85
|
+
issues: readonly z.ZodIssue[];
|
|
86
|
+
} | {
|
|
87
|
+
success: true;
|
|
88
|
+
data: Partial<AgentRuleSyncSpec>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
ownershipKey: {
|
|
92
|
+
prefix: "copilot:instruction-path:";
|
|
93
|
+
descriptionLabel: string;
|
|
94
|
+
createKey: (value: string) => `copilot:instruction-path:${string}`;
|
|
95
|
+
createKeyForInput: (value: import("./agent-types.js").OwnershipKeyInput) => `copilot:instruction-path:${string}`;
|
|
96
|
+
};
|
|
97
|
+
outputPathCreators: {
|
|
98
|
+
createTargetPath: (value: {
|
|
99
|
+
targetRoots: ConfiguredTargetRoots;
|
|
100
|
+
itemName: string;
|
|
101
|
+
sourceFileStem: string;
|
|
102
|
+
}) => string;
|
|
103
|
+
createWritePath: (targetPath: string) => string;
|
|
104
|
+
};
|
|
105
|
+
metadata: {
|
|
106
|
+
schema: z.ZodObject<{
|
|
107
|
+
description: z.ZodString;
|
|
108
|
+
applyTo: z.ZodString;
|
|
109
|
+
}, z.core.$strict>;
|
|
110
|
+
create: (value: {
|
|
111
|
+
description: string;
|
|
112
|
+
applyTo: string;
|
|
113
|
+
}) => {
|
|
114
|
+
description: string;
|
|
115
|
+
applyTo: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
target: {
|
|
119
|
+
buildTarget: (value: {
|
|
120
|
+
targetRoots: ConfiguredTargetRoots;
|
|
121
|
+
input: AgentRuleSyncSpec;
|
|
122
|
+
}) => {
|
|
123
|
+
agent: string;
|
|
124
|
+
body: string;
|
|
125
|
+
metadata: {
|
|
126
|
+
description: string;
|
|
127
|
+
applyTo: string;
|
|
128
|
+
};
|
|
129
|
+
outputPath: string;
|
|
130
|
+
targetType: "markdown";
|
|
131
|
+
writePath: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
readonly skill: {
|
|
136
|
+
ownershipKey: {
|
|
137
|
+
prefix: "copilot:skill-name:";
|
|
138
|
+
descriptionLabel: string;
|
|
139
|
+
createKey: (value: string) => `copilot:skill-name:${string}`;
|
|
140
|
+
createKeyForInput: (value: import("./agent-types.js").OwnershipKeyInput) => `copilot:skill-name:${string}`;
|
|
141
|
+
};
|
|
142
|
+
outputPathCreators: {
|
|
143
|
+
createTargetPath: (value: {
|
|
144
|
+
targetRoots: ConfiguredTargetRoots;
|
|
145
|
+
itemName: string;
|
|
146
|
+
sourceFileStem: string;
|
|
147
|
+
}) => string;
|
|
148
|
+
createWritePath: (targetPath: string) => string;
|
|
149
|
+
};
|
|
150
|
+
target: {
|
|
151
|
+
buildTarget: (value: {
|
|
152
|
+
targetRoots: ConfiguredTargetRoots;
|
|
153
|
+
input: AgentSkillSyncSpec;
|
|
154
|
+
}) => {
|
|
155
|
+
agent: string;
|
|
156
|
+
outputPath: string;
|
|
157
|
+
sourceDir: string;
|
|
158
|
+
targetType: "directory";
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
readonly cursor: {
|
|
164
|
+
readonly displayLabel: "Cursor";
|
|
165
|
+
readonly targetRoots: {
|
|
166
|
+
readonly rules: readonly [".cursor", "rules"];
|
|
167
|
+
readonly skills: readonly [".cursor", "skills"];
|
|
168
|
+
};
|
|
169
|
+
readonly command: {
|
|
170
|
+
frontmatterSection: {
|
|
171
|
+
schema: z.ZodType<{
|
|
172
|
+
'disable-model-invocation'?: boolean | undefined;
|
|
173
|
+
} | undefined, unknown, z.core.$ZodTypeInternals<{
|
|
174
|
+
'disable-model-invocation'?: boolean | undefined;
|
|
175
|
+
} | undefined, unknown>>;
|
|
176
|
+
createSyncInputExtension: (value: unknown, context: {
|
|
177
|
+
currentInput: AgentCmdSyncSpec;
|
|
178
|
+
sectionValues: ReadonlyMap<string, unknown>;
|
|
179
|
+
}) => {
|
|
180
|
+
success: false;
|
|
181
|
+
issues: readonly z.ZodIssue[];
|
|
182
|
+
} | {
|
|
183
|
+
success: true;
|
|
184
|
+
data: Partial<AgentCmdSyncSpec>;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
ownershipKey: {
|
|
188
|
+
prefix: "cursor:skill-name:";
|
|
189
|
+
descriptionLabel: string;
|
|
190
|
+
createKey: (value: string) => `cursor:skill-name:${string}`;
|
|
191
|
+
createKeyForInput: (value: import("./agent-types.js").OwnershipKeyInput) => `cursor:skill-name:${string}`;
|
|
192
|
+
};
|
|
193
|
+
outputPathCreators: {
|
|
194
|
+
createTargetPath: (value: {
|
|
195
|
+
targetRoots: ConfiguredTargetRoots;
|
|
196
|
+
itemName: string;
|
|
197
|
+
sourceFileStem: string;
|
|
198
|
+
}) => string;
|
|
199
|
+
createWritePath: (targetPath: string) => string;
|
|
200
|
+
};
|
|
201
|
+
metadata: {
|
|
202
|
+
schema: z.ZodObject<{
|
|
203
|
+
name: z.ZodString;
|
|
204
|
+
description: z.ZodString;
|
|
205
|
+
'disable-model-invocation': z.ZodOptional<z.ZodBoolean>;
|
|
206
|
+
}, z.core.$strict>;
|
|
207
|
+
create: (value: {
|
|
208
|
+
name: string;
|
|
209
|
+
description: string;
|
|
210
|
+
disableModelInvocation: boolean | undefined;
|
|
211
|
+
}) => {
|
|
212
|
+
name: string;
|
|
213
|
+
description: string;
|
|
214
|
+
'disable-model-invocation'?: boolean | undefined;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
target: {
|
|
218
|
+
buildTarget: (value: {
|
|
219
|
+
targetRoots: ConfiguredTargetRoots;
|
|
220
|
+
input: AgentCmdSyncSpec;
|
|
221
|
+
}) => {
|
|
222
|
+
agent: string;
|
|
223
|
+
body: string;
|
|
224
|
+
metadata: {
|
|
225
|
+
name: string;
|
|
226
|
+
description: string;
|
|
227
|
+
'disable-model-invocation'?: boolean | undefined;
|
|
228
|
+
};
|
|
229
|
+
outputPath: string;
|
|
230
|
+
targetType: "markdown";
|
|
231
|
+
writePath: string;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
readonly rule: {
|
|
236
|
+
frontmatterSection: {
|
|
237
|
+
schema: z.ZodType<{
|
|
238
|
+
alwaysApply?: boolean | undefined;
|
|
239
|
+
globs?: string | undefined;
|
|
240
|
+
} | undefined, unknown, z.core.$ZodTypeInternals<{
|
|
241
|
+
alwaysApply?: boolean | undefined;
|
|
242
|
+
globs?: string | undefined;
|
|
243
|
+
} | undefined, unknown>>;
|
|
244
|
+
createSyncInputExtension: (value: unknown, context: {
|
|
245
|
+
currentInput: AgentRuleSyncSpec;
|
|
246
|
+
sectionValues: ReadonlyMap<string, unknown>;
|
|
247
|
+
}) => {
|
|
248
|
+
success: false;
|
|
249
|
+
issues: readonly z.ZodIssue[];
|
|
250
|
+
} | {
|
|
251
|
+
success: true;
|
|
252
|
+
data: Partial<AgentRuleSyncSpec>;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
ownershipKey: {
|
|
256
|
+
prefix: "cursor:rule-path:";
|
|
257
|
+
descriptionLabel: string;
|
|
258
|
+
createKey: (value: string) => `cursor:rule-path:${string}`;
|
|
259
|
+
createKeyForInput: (value: import("./agent-types.js").OwnershipKeyInput) => `cursor:rule-path:${string}`;
|
|
260
|
+
};
|
|
261
|
+
outputPathCreators: {
|
|
262
|
+
createTargetPath: (value: {
|
|
263
|
+
targetRoots: ConfiguredTargetRoots;
|
|
264
|
+
itemName: string;
|
|
265
|
+
sourceFileStem: string;
|
|
266
|
+
}) => string;
|
|
267
|
+
createWritePath: (targetPath: string) => string;
|
|
268
|
+
};
|
|
269
|
+
metadata: {
|
|
270
|
+
schema: z.ZodObject<{
|
|
271
|
+
description: z.ZodString;
|
|
272
|
+
globs: z.ZodOptional<z.ZodString>;
|
|
273
|
+
alwaysApply: z.ZodBoolean;
|
|
274
|
+
}, z.core.$strict>;
|
|
275
|
+
create: (value: {
|
|
276
|
+
description: string;
|
|
277
|
+
globs: string | undefined;
|
|
278
|
+
alwaysApply: boolean;
|
|
279
|
+
}) => {
|
|
280
|
+
description: string;
|
|
281
|
+
alwaysApply: boolean;
|
|
282
|
+
globs?: string | undefined;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
target: {
|
|
286
|
+
buildTarget: (value: {
|
|
287
|
+
targetRoots: ConfiguredTargetRoots;
|
|
288
|
+
input: AgentRuleSyncSpec;
|
|
289
|
+
}) => {
|
|
290
|
+
agent: string;
|
|
291
|
+
body: string;
|
|
292
|
+
metadata: {
|
|
293
|
+
description: string;
|
|
294
|
+
alwaysApply: boolean;
|
|
295
|
+
globs?: string | undefined;
|
|
296
|
+
};
|
|
297
|
+
outputPath: string;
|
|
298
|
+
targetType: "markdown";
|
|
299
|
+
writePath: string;
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
readonly skill: {
|
|
304
|
+
ownershipKey: {
|
|
305
|
+
prefix: "cursor:skill-name:";
|
|
306
|
+
descriptionLabel: string;
|
|
307
|
+
createKey: (value: string) => `cursor:skill-name:${string}`;
|
|
308
|
+
createKeyForInput: (value: import("./agent-types.js").OwnershipKeyInput) => `cursor:skill-name:${string}`;
|
|
309
|
+
};
|
|
310
|
+
outputPathCreators: {
|
|
311
|
+
createTargetPath: (value: {
|
|
312
|
+
targetRoots: ConfiguredTargetRoots;
|
|
313
|
+
itemName: string;
|
|
314
|
+
sourceFileStem: string;
|
|
315
|
+
}) => string;
|
|
316
|
+
createWritePath: (targetPath: string) => string;
|
|
317
|
+
};
|
|
318
|
+
target: {
|
|
319
|
+
buildTarget: (value: {
|
|
320
|
+
targetRoots: ConfiguredTargetRoots;
|
|
321
|
+
input: AgentSkillSyncSpec;
|
|
322
|
+
}) => {
|
|
323
|
+
agent: string;
|
|
324
|
+
outputPath: string;
|
|
325
|
+
sourceDir: string;
|
|
326
|
+
targetType: "directory";
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
export {};
|
|
333
|
+
//# sourceMappingURL=agent-definitions.d.ts.map
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { defineAgentFrontmatterSection, defineMetadata, defineOutputPathCreators, defineOwnershipKey, defineTarget, } from './agent-definition-helpers.js';
|
|
4
|
+
import { compactObject } from './object-helpers.js';
|
|
5
|
+
const nonEmptyStringSchema = z.string().trim().min(1);
|
|
6
|
+
/**
|
|
7
|
+
* The central sync agent registry, mapping each agent name to its command, rule, and skill definitions.
|
|
8
|
+
*/
|
|
9
|
+
export const AGENT_DEFINITIONS = {
|
|
10
|
+
copilot: {
|
|
11
|
+
displayLabel: 'Copilot',
|
|
12
|
+
targetRoots: {
|
|
13
|
+
prompts: ['.copilot', 'prompts'],
|
|
14
|
+
instructions: ['.copilot', 'instructions'],
|
|
15
|
+
skills: ['.copilot', 'skills'],
|
|
16
|
+
},
|
|
17
|
+
command: (() => {
|
|
18
|
+
const outputPathCreators = defineOutputPathCreators({
|
|
19
|
+
createTargetPath: ({ targetRoots, sourceFileStem }) => path.join(targetRoots.copilot.prompts, `${sourceFileStem}.prompt.md`),
|
|
20
|
+
});
|
|
21
|
+
const frontmatterSectionSchema = z.strictObject({}).optional();
|
|
22
|
+
const metadata = defineMetadata({
|
|
23
|
+
shape: {
|
|
24
|
+
name: z.string().min(1),
|
|
25
|
+
description: z.string().min(1),
|
|
26
|
+
},
|
|
27
|
+
buildMetadata: (value) => compactObject({
|
|
28
|
+
name: value.name,
|
|
29
|
+
description: value.description,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
frontmatterSection: defineAgentFrontmatterSection({
|
|
34
|
+
schema: frontmatterSectionSchema,
|
|
35
|
+
extendSyncInput: () => ({}),
|
|
36
|
+
}),
|
|
37
|
+
ownershipKey: defineOwnershipKey({
|
|
38
|
+
prefix: 'copilot:prompt-path:',
|
|
39
|
+
descriptionLabel: 'Copilot prompt output',
|
|
40
|
+
selectSuffix: (value) => value.outputPath,
|
|
41
|
+
}),
|
|
42
|
+
outputPathCreators,
|
|
43
|
+
metadata,
|
|
44
|
+
target: defineTarget({
|
|
45
|
+
buildTarget: ({ targetRoots, input, }) => {
|
|
46
|
+
const outputPath = outputPathCreators.createTargetPath({
|
|
47
|
+
targetRoots,
|
|
48
|
+
itemName: input.name,
|
|
49
|
+
sourceFileStem: input.sourceFileStem,
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
agent: 'copilot',
|
|
53
|
+
body: input.body,
|
|
54
|
+
metadata: metadata.create({
|
|
55
|
+
name: input.name,
|
|
56
|
+
description: input.description,
|
|
57
|
+
}),
|
|
58
|
+
outputPath,
|
|
59
|
+
targetType: 'markdown',
|
|
60
|
+
writePath: outputPath,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
})(),
|
|
66
|
+
rule: (() => {
|
|
67
|
+
const outputPathCreators = defineOutputPathCreators({
|
|
68
|
+
createTargetPath: ({ targetRoots, sourceFileStem }) => path.join(targetRoots.copilot.instructions, `${sourceFileStem}.instructions.md`),
|
|
69
|
+
});
|
|
70
|
+
const frontmatterSectionSchema = z.strictObject({
|
|
71
|
+
applyTo: nonEmptyStringSchema,
|
|
72
|
+
});
|
|
73
|
+
const metadata = defineMetadata({
|
|
74
|
+
shape: {
|
|
75
|
+
description: z.string().min(1),
|
|
76
|
+
applyTo: z.string().min(1),
|
|
77
|
+
},
|
|
78
|
+
buildMetadata: (value) => compactObject({
|
|
79
|
+
description: value.description,
|
|
80
|
+
applyTo: value.applyTo,
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
frontmatterSection: defineAgentFrontmatterSection({
|
|
85
|
+
schema: frontmatterSectionSchema,
|
|
86
|
+
extendSyncInput: (value) => ({
|
|
87
|
+
applyTo: value.applyTo,
|
|
88
|
+
}),
|
|
89
|
+
}),
|
|
90
|
+
ownershipKey: defineOwnershipKey({
|
|
91
|
+
prefix: 'copilot:instruction-path:',
|
|
92
|
+
descriptionLabel: 'Copilot instruction output',
|
|
93
|
+
selectSuffix: (value) => value.outputPath,
|
|
94
|
+
}),
|
|
95
|
+
outputPathCreators,
|
|
96
|
+
metadata,
|
|
97
|
+
target: defineTarget({
|
|
98
|
+
buildTarget: ({ targetRoots, input, }) => {
|
|
99
|
+
const outputPath = outputPathCreators.createTargetPath({
|
|
100
|
+
targetRoots,
|
|
101
|
+
itemName: input.name,
|
|
102
|
+
sourceFileStem: input.sourceFileStem,
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
agent: 'copilot',
|
|
106
|
+
body: input.body,
|
|
107
|
+
metadata: metadata.create({
|
|
108
|
+
description: input.description,
|
|
109
|
+
applyTo: input.applyTo,
|
|
110
|
+
}),
|
|
111
|
+
outputPath,
|
|
112
|
+
targetType: 'markdown',
|
|
113
|
+
writePath: outputPath,
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
}),
|
|
117
|
+
};
|
|
118
|
+
})(),
|
|
119
|
+
skill: (() => {
|
|
120
|
+
const outputPathCreators = defineOutputPathCreators({
|
|
121
|
+
createTargetPath: ({ targetRoots, itemName }) => path.join(targetRoots.copilot.skills, itemName),
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
ownershipKey: defineOwnershipKey({
|
|
125
|
+
prefix: 'copilot:skill-name:',
|
|
126
|
+
descriptionLabel: 'Copilot skill name',
|
|
127
|
+
selectSuffix: (value) => value.name,
|
|
128
|
+
}),
|
|
129
|
+
outputPathCreators,
|
|
130
|
+
target: defineTarget({
|
|
131
|
+
buildTarget: ({ targetRoots, input, }) => ({
|
|
132
|
+
agent: 'copilot',
|
|
133
|
+
outputPath: outputPathCreators.createTargetPath({
|
|
134
|
+
targetRoots,
|
|
135
|
+
itemName: input.name,
|
|
136
|
+
sourceFileStem: input.name,
|
|
137
|
+
}),
|
|
138
|
+
sourceDir: input.sourceDir,
|
|
139
|
+
targetType: 'directory',
|
|
140
|
+
}),
|
|
141
|
+
}),
|
|
142
|
+
};
|
|
143
|
+
})(),
|
|
144
|
+
},
|
|
145
|
+
cursor: {
|
|
146
|
+
displayLabel: 'Cursor',
|
|
147
|
+
targetRoots: {
|
|
148
|
+
rules: ['.cursor', 'rules'],
|
|
149
|
+
skills: ['.cursor', 'skills'],
|
|
150
|
+
},
|
|
151
|
+
command: (() => {
|
|
152
|
+
const outputPathCreators = defineOutputPathCreators({
|
|
153
|
+
createTargetPath: ({ targetRoots, itemName }) => path.join(targetRoots.cursor.skills, itemName),
|
|
154
|
+
createWritePath: (targetPath) => path.join(targetPath, 'SKILL.md'),
|
|
155
|
+
});
|
|
156
|
+
const frontmatterSectionSchema = z
|
|
157
|
+
.strictObject({
|
|
158
|
+
'disable-model-invocation': z.boolean().optional(),
|
|
159
|
+
})
|
|
160
|
+
.optional();
|
|
161
|
+
const metadata = defineMetadata({
|
|
162
|
+
shape: {
|
|
163
|
+
name: z.string().min(1),
|
|
164
|
+
description: z.string().min(1),
|
|
165
|
+
'disable-model-invocation': z.boolean().optional(),
|
|
166
|
+
},
|
|
167
|
+
buildMetadata: (value) => compactObject({
|
|
168
|
+
name: value.name,
|
|
169
|
+
description: value.description,
|
|
170
|
+
'disable-model-invocation': value.disableModelInvocation,
|
|
171
|
+
}),
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
frontmatterSection: defineAgentFrontmatterSection({
|
|
175
|
+
schema: frontmatterSectionSchema,
|
|
176
|
+
extendSyncInput: (value) => ({
|
|
177
|
+
disableModelInvocation: value?.['disable-model-invocation'],
|
|
178
|
+
}),
|
|
179
|
+
}),
|
|
180
|
+
ownershipKey: defineOwnershipKey({
|
|
181
|
+
prefix: 'cursor:skill-name:',
|
|
182
|
+
descriptionLabel: 'Cursor skill name',
|
|
183
|
+
selectSuffix: (value) => value.name,
|
|
184
|
+
}),
|
|
185
|
+
outputPathCreators,
|
|
186
|
+
metadata,
|
|
187
|
+
target: defineTarget({
|
|
188
|
+
buildTarget: ({ targetRoots, input, }) => {
|
|
189
|
+
const outputPath = outputPathCreators.createTargetPath({
|
|
190
|
+
targetRoots,
|
|
191
|
+
itemName: input.name,
|
|
192
|
+
sourceFileStem: input.sourceFileStem,
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
agent: 'cursor',
|
|
196
|
+
body: input.body,
|
|
197
|
+
metadata: metadata.create({
|
|
198
|
+
name: input.name,
|
|
199
|
+
description: input.description,
|
|
200
|
+
disableModelInvocation: input.disableModelInvocation,
|
|
201
|
+
}),
|
|
202
|
+
outputPath,
|
|
203
|
+
targetType: 'markdown',
|
|
204
|
+
writePath: outputPathCreators.createWritePath(outputPath),
|
|
205
|
+
};
|
|
206
|
+
},
|
|
207
|
+
}),
|
|
208
|
+
};
|
|
209
|
+
})(),
|
|
210
|
+
rule: (() => {
|
|
211
|
+
const outputPathCreators = defineOutputPathCreators({
|
|
212
|
+
createTargetPath: ({ targetRoots, sourceFileStem }) => path.join(targetRoots.cursor.rules, `${sourceFileStem}.mdc`),
|
|
213
|
+
});
|
|
214
|
+
const frontmatterSectionSchema = z
|
|
215
|
+
.strictObject({
|
|
216
|
+
alwaysApply: z.boolean().optional(),
|
|
217
|
+
globs: nonEmptyStringSchema.optional(),
|
|
218
|
+
})
|
|
219
|
+
.optional();
|
|
220
|
+
const metadata = defineMetadata({
|
|
221
|
+
shape: {
|
|
222
|
+
description: z.string().min(1),
|
|
223
|
+
globs: z.string().min(1).optional(),
|
|
224
|
+
alwaysApply: z.boolean(),
|
|
225
|
+
},
|
|
226
|
+
buildMetadata: (value) => compactObject({
|
|
227
|
+
description: value.description,
|
|
228
|
+
globs: value.globs,
|
|
229
|
+
alwaysApply: value.alwaysApply,
|
|
230
|
+
}),
|
|
231
|
+
});
|
|
232
|
+
return {
|
|
233
|
+
frontmatterSection: defineAgentFrontmatterSection({
|
|
234
|
+
schema: frontmatterSectionSchema,
|
|
235
|
+
extendSyncInput: (value, { currentInput }) => {
|
|
236
|
+
const scopedGlobs = value?.globs ?? currentInput.applyTo;
|
|
237
|
+
const alwaysApply = value?.alwaysApply ??
|
|
238
|
+
(scopedGlobs === undefined || scopedGlobs === '**');
|
|
239
|
+
return {
|
|
240
|
+
alwaysApply,
|
|
241
|
+
globs: alwaysApply ? undefined : scopedGlobs,
|
|
242
|
+
};
|
|
243
|
+
},
|
|
244
|
+
}),
|
|
245
|
+
ownershipKey: defineOwnershipKey({
|
|
246
|
+
prefix: 'cursor:rule-path:',
|
|
247
|
+
descriptionLabel: 'Cursor rule output',
|
|
248
|
+
selectSuffix: (value) => value.outputPath,
|
|
249
|
+
}),
|
|
250
|
+
outputPathCreators,
|
|
251
|
+
metadata,
|
|
252
|
+
target: defineTarget({
|
|
253
|
+
buildTarget: ({ targetRoots, input, }) => {
|
|
254
|
+
const outputPath = outputPathCreators.createTargetPath({
|
|
255
|
+
targetRoots,
|
|
256
|
+
itemName: input.name,
|
|
257
|
+
sourceFileStem: input.sourceFileStem,
|
|
258
|
+
});
|
|
259
|
+
return {
|
|
260
|
+
agent: 'cursor',
|
|
261
|
+
body: input.body,
|
|
262
|
+
metadata: metadata.create({
|
|
263
|
+
description: input.description,
|
|
264
|
+
globs: input.globs,
|
|
265
|
+
alwaysApply: input.alwaysApply,
|
|
266
|
+
}),
|
|
267
|
+
outputPath,
|
|
268
|
+
targetType: 'markdown',
|
|
269
|
+
writePath: outputPath,
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
}),
|
|
273
|
+
};
|
|
274
|
+
})(),
|
|
275
|
+
skill: (() => {
|
|
276
|
+
const outputPathCreators = defineOutputPathCreators({
|
|
277
|
+
createTargetPath: ({ targetRoots, itemName }) => path.join(targetRoots.cursor.skills, itemName),
|
|
278
|
+
});
|
|
279
|
+
return {
|
|
280
|
+
ownershipKey: defineOwnershipKey({
|
|
281
|
+
prefix: 'cursor:skill-name:',
|
|
282
|
+
descriptionLabel: 'Cursor skill name',
|
|
283
|
+
selectSuffix: (value) => value.name,
|
|
284
|
+
}),
|
|
285
|
+
outputPathCreators,
|
|
286
|
+
target: defineTarget({
|
|
287
|
+
buildTarget: ({ targetRoots, input, }) => ({
|
|
288
|
+
agent: 'cursor',
|
|
289
|
+
outputPath: outputPathCreators.createTargetPath({
|
|
290
|
+
targetRoots,
|
|
291
|
+
itemName: input.name,
|
|
292
|
+
sourceFileStem: input.name,
|
|
293
|
+
}),
|
|
294
|
+
sourceDir: input.sourceDir,
|
|
295
|
+
targetType: 'directory',
|
|
296
|
+
}),
|
|
297
|
+
}),
|
|
298
|
+
};
|
|
299
|
+
})(),
|
|
300
|
+
},
|
|
301
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { TargetRoots } from './agents.js';
|
|
2
|
+
export declare const SYNC_ITEM_KINDS: readonly ["command", "rule", "skill"];
|
|
3
|
+
export type SyncItemKind = (typeof SYNC_ITEM_KINDS)[number];
|
|
4
|
+
export type OwnershipKeyInput = {
|
|
5
|
+
name: string;
|
|
6
|
+
outputPath: string;
|
|
7
|
+
};
|
|
8
|
+
export type AgentCmdSyncSpec = {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
sourceFileStem: string;
|
|
12
|
+
body: string;
|
|
13
|
+
disableModelInvocation: boolean | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type AgentRuleSyncSpec = {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
sourceFileStem: string;
|
|
19
|
+
body: string;
|
|
20
|
+
applyTo: string;
|
|
21
|
+
globs: string | undefined;
|
|
22
|
+
alwaysApply: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type AgentSkillSyncSpec = {
|
|
25
|
+
name: string;
|
|
26
|
+
sourceDir: string;
|
|
27
|
+
};
|
|
28
|
+
export type AgentSyncSpecByKind = {
|
|
29
|
+
command: AgentCmdSyncSpec;
|
|
30
|
+
rule: AgentRuleSyncSpec;
|
|
31
|
+
skill: AgentSkillSyncSpec;
|
|
32
|
+
};
|
|
33
|
+
export type SyncTargetSpec = {
|
|
34
|
+
kind: 'command';
|
|
35
|
+
input: AgentCmdSyncSpec;
|
|
36
|
+
targetRoots: TargetRoots;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'rule';
|
|
39
|
+
input: AgentRuleSyncSpec;
|
|
40
|
+
targetRoots: TargetRoots;
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'skill';
|
|
43
|
+
input: AgentSkillSyncSpec;
|
|
44
|
+
targetRoots: TargetRoots;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=agent-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SYNC_ITEM_KINDS = ['command', 'rule', 'skill'];
|