@cockpit-ai/core 0.1.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/index.d.ts +485 -0
- package/dist/index.js +316 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import { z, ZodError, ZodTypeAny } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const AdapterNameSchema: z.ZodEnum<["claude-code", "cursor", "copilot", "opencode"]>;
|
|
4
|
+
type AdapterName = z.infer<typeof AdapterNameSchema>;
|
|
5
|
+
declare const ProfileConfigSchema: z.ZodObject<{
|
|
6
|
+
cockpit: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>;
|
|
7
|
+
profile: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
sync: z.ZodOptional<z.ZodObject<{
|
|
10
|
+
remote: z.ZodOptional<z.ZodString>;
|
|
11
|
+
auto_sync: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
auto_sync: boolean;
|
|
14
|
+
remote?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
remote?: string | undefined;
|
|
17
|
+
auto_sync?: boolean | undefined;
|
|
18
|
+
}>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
name: string;
|
|
21
|
+
sync?: {
|
|
22
|
+
auto_sync: boolean;
|
|
23
|
+
remote?: string | undefined;
|
|
24
|
+
} | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
name: string;
|
|
27
|
+
sync?: {
|
|
28
|
+
remote?: string | undefined;
|
|
29
|
+
auto_sync?: boolean | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}>>;
|
|
32
|
+
preferences: z.ZodOptional<z.ZodObject<{
|
|
33
|
+
language: z.ZodDefault<z.ZodString>;
|
|
34
|
+
default_model: z.ZodDefault<z.ZodString>;
|
|
35
|
+
default_adapter: z.ZodDefault<z.ZodEnum<["claude-code", "cursor", "copilot", "opencode"]>>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
language: string;
|
|
38
|
+
default_model: string;
|
|
39
|
+
default_adapter: "claude-code" | "cursor" | "copilot" | "opencode";
|
|
40
|
+
}, {
|
|
41
|
+
language?: string | undefined;
|
|
42
|
+
default_model?: string | undefined;
|
|
43
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
44
|
+
}>>;
|
|
45
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
global: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
47
|
+
project: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
global?: string[] | undefined;
|
|
50
|
+
project?: string[] | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
global?: string[] | undefined;
|
|
53
|
+
project?: string[] | undefined;
|
|
54
|
+
}>>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
cockpit: string;
|
|
57
|
+
profile?: {
|
|
58
|
+
name: string;
|
|
59
|
+
sync?: {
|
|
60
|
+
auto_sync: boolean;
|
|
61
|
+
remote?: string | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
preferences?: {
|
|
65
|
+
language: string;
|
|
66
|
+
default_model: string;
|
|
67
|
+
default_adapter: "claude-code" | "cursor" | "copilot" | "opencode";
|
|
68
|
+
} | undefined;
|
|
69
|
+
context?: {
|
|
70
|
+
global?: string[] | undefined;
|
|
71
|
+
project?: string[] | undefined;
|
|
72
|
+
} | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
cockpit: string | number;
|
|
75
|
+
profile?: {
|
|
76
|
+
name: string;
|
|
77
|
+
sync?: {
|
|
78
|
+
remote?: string | undefined;
|
|
79
|
+
auto_sync?: boolean | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
} | undefined;
|
|
82
|
+
preferences?: {
|
|
83
|
+
language?: string | undefined;
|
|
84
|
+
default_model?: string | undefined;
|
|
85
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
context?: {
|
|
88
|
+
global?: string[] | undefined;
|
|
89
|
+
project?: string[] | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
}>;
|
|
92
|
+
type ProfileConfig = z.infer<typeof ProfileConfigSchema>;
|
|
93
|
+
declare const WorkspaceConfigSchema: z.ZodObject<{
|
|
94
|
+
cockpit: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>;
|
|
95
|
+
workspace: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
default_adapter: z.ZodOptional<z.ZodEnum<["claude-code", "cursor", "copilot", "opencode"]>>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
name: string;
|
|
100
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
101
|
+
}, {
|
|
102
|
+
name: string;
|
|
103
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
104
|
+
}>>;
|
|
105
|
+
adapters: z.ZodOptional<z.ZodArray<z.ZodEnum<["claude-code", "cursor", "copilot", "opencode"]>, "many">>;
|
|
106
|
+
skills: z.ZodOptional<z.ZodObject<{
|
|
107
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
include?: string[] | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
include?: string[] | undefined;
|
|
112
|
+
}>>;
|
|
113
|
+
agents: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
include?: string[] | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
include?: string[] | undefined;
|
|
119
|
+
}>>;
|
|
120
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
global: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
122
|
+
project: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
global?: string[] | undefined;
|
|
125
|
+
project?: string[] | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
global?: string[] | undefined;
|
|
128
|
+
project?: string[] | undefined;
|
|
129
|
+
}>>;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
cockpit: string;
|
|
132
|
+
context?: {
|
|
133
|
+
global?: string[] | undefined;
|
|
134
|
+
project?: string[] | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
workspace?: {
|
|
137
|
+
name: string;
|
|
138
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
139
|
+
} | undefined;
|
|
140
|
+
adapters?: ("claude-code" | "cursor" | "copilot" | "opencode")[] | undefined;
|
|
141
|
+
skills?: {
|
|
142
|
+
include?: string[] | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
agents?: {
|
|
145
|
+
include?: string[] | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
}, {
|
|
148
|
+
cockpit: string | number;
|
|
149
|
+
context?: {
|
|
150
|
+
global?: string[] | undefined;
|
|
151
|
+
project?: string[] | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
workspace?: {
|
|
154
|
+
name: string;
|
|
155
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
156
|
+
} | undefined;
|
|
157
|
+
adapters?: ("claude-code" | "cursor" | "copilot" | "opencode")[] | undefined;
|
|
158
|
+
skills?: {
|
|
159
|
+
include?: string[] | undefined;
|
|
160
|
+
} | undefined;
|
|
161
|
+
agents?: {
|
|
162
|
+
include?: string[] | undefined;
|
|
163
|
+
} | undefined;
|
|
164
|
+
}>;
|
|
165
|
+
type WorkspaceConfig = z.infer<typeof WorkspaceConfigSchema>;
|
|
166
|
+
declare const ProjectConfigSchema: z.ZodObject<{
|
|
167
|
+
cockpit: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string, string | number>;
|
|
168
|
+
project: z.ZodOptional<z.ZodObject<{
|
|
169
|
+
name: z.ZodOptional<z.ZodString>;
|
|
170
|
+
default_adapter: z.ZodOptional<z.ZodEnum<["claude-code", "cursor", "copilot", "opencode"]>>;
|
|
171
|
+
}, "strip", z.ZodTypeAny, {
|
|
172
|
+
name?: string | undefined;
|
|
173
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
174
|
+
}, {
|
|
175
|
+
name?: string | undefined;
|
|
176
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
177
|
+
}>>;
|
|
178
|
+
adapters: z.ZodOptional<z.ZodArray<z.ZodEnum<["claude-code", "cursor", "copilot", "opencode"]>, "many">>;
|
|
179
|
+
skills: z.ZodOptional<z.ZodObject<{
|
|
180
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
include?: string[] | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
include?: string[] | undefined;
|
|
185
|
+
}>>;
|
|
186
|
+
agents: z.ZodOptional<z.ZodObject<{
|
|
187
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
include?: string[] | undefined;
|
|
190
|
+
}, {
|
|
191
|
+
include?: string[] | undefined;
|
|
192
|
+
}>>;
|
|
193
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
194
|
+
global: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
195
|
+
project: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
196
|
+
}, "strip", z.ZodTypeAny, {
|
|
197
|
+
global?: string[] | undefined;
|
|
198
|
+
project?: string[] | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
global?: string[] | undefined;
|
|
201
|
+
project?: string[] | undefined;
|
|
202
|
+
}>>;
|
|
203
|
+
}, "strip", z.ZodTypeAny, {
|
|
204
|
+
cockpit: string;
|
|
205
|
+
project?: {
|
|
206
|
+
name?: string | undefined;
|
|
207
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
208
|
+
} | undefined;
|
|
209
|
+
context?: {
|
|
210
|
+
global?: string[] | undefined;
|
|
211
|
+
project?: string[] | undefined;
|
|
212
|
+
} | undefined;
|
|
213
|
+
adapters?: ("claude-code" | "cursor" | "copilot" | "opencode")[] | undefined;
|
|
214
|
+
skills?: {
|
|
215
|
+
include?: string[] | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
agents?: {
|
|
218
|
+
include?: string[] | undefined;
|
|
219
|
+
} | undefined;
|
|
220
|
+
}, {
|
|
221
|
+
cockpit: string | number;
|
|
222
|
+
project?: {
|
|
223
|
+
name?: string | undefined;
|
|
224
|
+
default_adapter?: "claude-code" | "cursor" | "copilot" | "opencode" | undefined;
|
|
225
|
+
} | undefined;
|
|
226
|
+
context?: {
|
|
227
|
+
global?: string[] | undefined;
|
|
228
|
+
project?: string[] | undefined;
|
|
229
|
+
} | undefined;
|
|
230
|
+
adapters?: ("claude-code" | "cursor" | "copilot" | "opencode")[] | undefined;
|
|
231
|
+
skills?: {
|
|
232
|
+
include?: string[] | undefined;
|
|
233
|
+
} | undefined;
|
|
234
|
+
agents?: {
|
|
235
|
+
include?: string[] | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
}>;
|
|
238
|
+
type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
239
|
+
interface ResolvedConfig {
|
|
240
|
+
profilePath: string | null;
|
|
241
|
+
workspacePath: string | null;
|
|
242
|
+
projectPath: string | null;
|
|
243
|
+
name: string;
|
|
244
|
+
defaultAdapter: AdapterName;
|
|
245
|
+
adapters: AdapterName[];
|
|
246
|
+
preferences: {
|
|
247
|
+
language: string;
|
|
248
|
+
defaultModel: string;
|
|
249
|
+
};
|
|
250
|
+
context: {
|
|
251
|
+
global: string[];
|
|
252
|
+
project: string[];
|
|
253
|
+
};
|
|
254
|
+
skills: {
|
|
255
|
+
include: string[];
|
|
256
|
+
};
|
|
257
|
+
agents: {
|
|
258
|
+
include: string[];
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare const SkillDefinitionSchema: z.ZodObject<{
|
|
263
|
+
name: z.ZodString;
|
|
264
|
+
version: z.ZodDefault<z.ZodString>;
|
|
265
|
+
description: z.ZodOptional<z.ZodString>;
|
|
266
|
+
trigger: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
267
|
+
prompt: z.ZodString;
|
|
268
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
269
|
+
adapters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
270
|
+
type: z.ZodOptional<z.ZodEnum<["command", "rule"]>>;
|
|
271
|
+
alwaysApply: z.ZodOptional<z.ZodBoolean>;
|
|
272
|
+
}, "strip", z.ZodTypeAny, {
|
|
273
|
+
type?: "command" | "rule" | undefined;
|
|
274
|
+
alwaysApply?: boolean | undefined;
|
|
275
|
+
}, {
|
|
276
|
+
type?: "command" | "rule" | undefined;
|
|
277
|
+
alwaysApply?: boolean | undefined;
|
|
278
|
+
}>>>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
name: string;
|
|
281
|
+
version: string;
|
|
282
|
+
prompt: string;
|
|
283
|
+
adapters?: Record<string, {
|
|
284
|
+
type?: "command" | "rule" | undefined;
|
|
285
|
+
alwaysApply?: boolean | undefined;
|
|
286
|
+
}> | undefined;
|
|
287
|
+
description?: string | undefined;
|
|
288
|
+
trigger?: string[] | undefined;
|
|
289
|
+
tools?: string[] | undefined;
|
|
290
|
+
}, {
|
|
291
|
+
name: string;
|
|
292
|
+
prompt: string;
|
|
293
|
+
adapters?: Record<string, {
|
|
294
|
+
type?: "command" | "rule" | undefined;
|
|
295
|
+
alwaysApply?: boolean | undefined;
|
|
296
|
+
}> | undefined;
|
|
297
|
+
version?: string | undefined;
|
|
298
|
+
description?: string | undefined;
|
|
299
|
+
trigger?: string[] | undefined;
|
|
300
|
+
tools?: string[] | undefined;
|
|
301
|
+
}>;
|
|
302
|
+
type SkillDefinition = z.infer<typeof SkillDefinitionSchema>;
|
|
303
|
+
interface ResolvedSkill {
|
|
304
|
+
name: string;
|
|
305
|
+
version: string;
|
|
306
|
+
description: string | undefined;
|
|
307
|
+
trigger: string[];
|
|
308
|
+
prompt: string;
|
|
309
|
+
tools: string[];
|
|
310
|
+
sourcePath: string;
|
|
311
|
+
adapterConfig: Partial<Record<AdapterName, {
|
|
312
|
+
type?: string;
|
|
313
|
+
alwaysApply?: boolean;
|
|
314
|
+
}>>;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
declare const AgentDefinitionSchema: z.ZodObject<{
|
|
318
|
+
name: z.ZodString;
|
|
319
|
+
role: z.ZodString;
|
|
320
|
+
model: z.ZodDefault<z.ZodString>;
|
|
321
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
322
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
323
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
324
|
+
}, "strip", z.ZodTypeAny, {
|
|
325
|
+
include?: string[] | undefined;
|
|
326
|
+
rules?: string[] | undefined;
|
|
327
|
+
}, {
|
|
328
|
+
include?: string[] | undefined;
|
|
329
|
+
rules?: string[] | undefined;
|
|
330
|
+
}>>;
|
|
331
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
332
|
+
worktree: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
auto_create: z.ZodDefault<z.ZodBoolean>;
|
|
334
|
+
branch_prefix: z.ZodOptional<z.ZodString>;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
auto_create: boolean;
|
|
337
|
+
branch_prefix?: string | undefined;
|
|
338
|
+
}, {
|
|
339
|
+
auto_create?: boolean | undefined;
|
|
340
|
+
branch_prefix?: string | undefined;
|
|
341
|
+
}>>;
|
|
342
|
+
}, "strip", z.ZodTypeAny, {
|
|
343
|
+
name: string;
|
|
344
|
+
role: string;
|
|
345
|
+
model: string;
|
|
346
|
+
context?: {
|
|
347
|
+
include?: string[] | undefined;
|
|
348
|
+
rules?: string[] | undefined;
|
|
349
|
+
} | undefined;
|
|
350
|
+
skills?: string[] | undefined;
|
|
351
|
+
worktree?: {
|
|
352
|
+
auto_create: boolean;
|
|
353
|
+
branch_prefix?: string | undefined;
|
|
354
|
+
} | undefined;
|
|
355
|
+
}, {
|
|
356
|
+
name: string;
|
|
357
|
+
role: string;
|
|
358
|
+
context?: {
|
|
359
|
+
include?: string[] | undefined;
|
|
360
|
+
rules?: string[] | undefined;
|
|
361
|
+
} | undefined;
|
|
362
|
+
skills?: string[] | undefined;
|
|
363
|
+
model?: string | undefined;
|
|
364
|
+
worktree?: {
|
|
365
|
+
auto_create?: boolean | undefined;
|
|
366
|
+
branch_prefix?: string | undefined;
|
|
367
|
+
} | undefined;
|
|
368
|
+
}>;
|
|
369
|
+
type AgentDefinition = z.infer<typeof AgentDefinitionSchema>;
|
|
370
|
+
type AgentStatus = "idle" | "running" | "stopped" | "error";
|
|
371
|
+
interface ResolvedAgent {
|
|
372
|
+
name: string;
|
|
373
|
+
role: string;
|
|
374
|
+
model: string;
|
|
375
|
+
skills: string[];
|
|
376
|
+
contextIncludes: string[];
|
|
377
|
+
contextRules: string[];
|
|
378
|
+
worktreeConfig: {
|
|
379
|
+
autoCreate: boolean;
|
|
380
|
+
branchPrefix: string | undefined;
|
|
381
|
+
};
|
|
382
|
+
sourcePath: string;
|
|
383
|
+
status: AgentStatus;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
declare const ContextRuleSchema: z.ZodObject<{
|
|
387
|
+
content: z.ZodString;
|
|
388
|
+
scope: z.ZodDefault<z.ZodEnum<["global", "project"]>>;
|
|
389
|
+
source: z.ZodOptional<z.ZodString>;
|
|
390
|
+
}, "strip", z.ZodTypeAny, {
|
|
391
|
+
content: string;
|
|
392
|
+
scope: "global" | "project";
|
|
393
|
+
source?: string | undefined;
|
|
394
|
+
}, {
|
|
395
|
+
content: string;
|
|
396
|
+
scope?: "global" | "project" | undefined;
|
|
397
|
+
source?: string | undefined;
|
|
398
|
+
}>;
|
|
399
|
+
type ContextRule = z.infer<typeof ContextRuleSchema>;
|
|
400
|
+
interface ResolvedContext {
|
|
401
|
+
global: ContextRule[];
|
|
402
|
+
project: ContextRule[];
|
|
403
|
+
}
|
|
404
|
+
declare function buildResolvedContext(globalRules: string[], projectRules: string[], source?: string): ResolvedContext;
|
|
405
|
+
|
|
406
|
+
interface CockpitAdapter {
|
|
407
|
+
readonly name: string;
|
|
408
|
+
/** Detect if this tool is used in the given project */
|
|
409
|
+
detect(projectPath: string): Promise<boolean>;
|
|
410
|
+
/** Convert a Cockpit skill to the tool's native format */
|
|
411
|
+
applySkill(projectPath: string, skill: ResolvedSkill): Promise<void>;
|
|
412
|
+
/** Convert Cockpit context to the tool's native format */
|
|
413
|
+
applyContext(projectPath: string, context: ResolvedContext): Promise<void>;
|
|
414
|
+
/** Convert a Cockpit agent definition to the tool's native format */
|
|
415
|
+
applyAgent(projectPath: string, agent: ResolvedAgent): Promise<void>;
|
|
416
|
+
/** Clean up tool-specific config files */
|
|
417
|
+
clean(projectPath: string): Promise<void>;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
declare class ConfigLoadError extends Error {
|
|
421
|
+
readonly path: string;
|
|
422
|
+
readonly cause?: unknown | undefined;
|
|
423
|
+
constructor(path: string, message: string, cause?: unknown | undefined);
|
|
424
|
+
}
|
|
425
|
+
declare class ConfigValidationError extends Error {
|
|
426
|
+
readonly path: string;
|
|
427
|
+
readonly issues: ZodError["issues"];
|
|
428
|
+
constructor(path: string, issues: ZodError["issues"]);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Load and validate a YAML config file against a Zod schema.
|
|
432
|
+
* Throws ConfigLoadError or ConfigValidationError on failure.
|
|
433
|
+
* Using ZodTypeAny + z.infer ensures transforms are reflected in the return type.
|
|
434
|
+
*/
|
|
435
|
+
declare function loadConfig<S extends ZodTypeAny>(path: string, schema: S): z.infer<S>;
|
|
436
|
+
/**
|
|
437
|
+
* Attempt to load a config file, returning null if the file doesn't exist.
|
|
438
|
+
* Still throws on parse errors or validation failures.
|
|
439
|
+
*/
|
|
440
|
+
declare function tryLoadConfig<S extends ZodTypeAny>(path: string, schema: S): z.infer<S> | null;
|
|
441
|
+
|
|
442
|
+
interface ResolveOptions {
|
|
443
|
+
profilePath?: string | null;
|
|
444
|
+
workspacePath?: string | null;
|
|
445
|
+
projectPath?: string | null;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Load and merge configs in order: Profile → Workspace → Project.
|
|
449
|
+
* Later layers override earlier ones (deep merge for arrays).
|
|
450
|
+
*/
|
|
451
|
+
declare function resolveConfig(options: ResolveOptions): ResolvedConfig;
|
|
452
|
+
declare function mergeConfigs(paths: {
|
|
453
|
+
profilePath: string | null;
|
|
454
|
+
workspacePath: string | null;
|
|
455
|
+
projectPath: string | null;
|
|
456
|
+
}, profile: ProfileConfig | null, workspace: WorkspaceConfig | null, project: ProjectConfig | null): ResolvedConfig;
|
|
457
|
+
|
|
458
|
+
declare const COCKPIT_DIR = ".cockpit";
|
|
459
|
+
declare const CONFIG_FILE = "config.yaml";
|
|
460
|
+
declare const PROFILE_FILE = "profile.yaml";
|
|
461
|
+
declare function getProfileDir(): string;
|
|
462
|
+
declare function getProfilePath(): string;
|
|
463
|
+
declare function getCockpitConfigPath(dir: string): string;
|
|
464
|
+
/**
|
|
465
|
+
* Walk up the directory tree from `cwd` looking for a `.cockpit/config.yaml`.
|
|
466
|
+
* Returns the directory containing `.cockpit/` (not the config file path).
|
|
467
|
+
* Returns null if nothing is found up to the filesystem root.
|
|
468
|
+
*/
|
|
469
|
+
declare function findWorkspaceRoot(cwd: string): string | null;
|
|
470
|
+
/**
|
|
471
|
+
* Find the nearest project `.cockpit/config.yaml` from `cwd`.
|
|
472
|
+
* Stops at workspace root if found (same dir is fine — workspace IS project).
|
|
473
|
+
*/
|
|
474
|
+
declare function findProjectRoot(cwd: string): string | null;
|
|
475
|
+
/**
|
|
476
|
+
* Locate all relevant config paths from the given working directory.
|
|
477
|
+
*/
|
|
478
|
+
interface ConfigPaths {
|
|
479
|
+
profilePath: string | null;
|
|
480
|
+
workspacePath: string | null;
|
|
481
|
+
projectPath: string | null;
|
|
482
|
+
}
|
|
483
|
+
declare function findConfigPaths(cwd: string): ConfigPaths;
|
|
484
|
+
|
|
485
|
+
export { type AdapterName, type AgentDefinition, AgentDefinitionSchema, type AgentStatus, COCKPIT_DIR, CONFIG_FILE, type CockpitAdapter, ConfigLoadError, type ConfigPaths, ConfigValidationError, type ContextRule, ContextRuleSchema, PROFILE_FILE, type ProfileConfig, ProfileConfigSchema, type ProjectConfig, ProjectConfigSchema, type ResolveOptions, type ResolvedAgent, type ResolvedConfig, type ResolvedContext, type ResolvedSkill, type SkillDefinition, SkillDefinitionSchema, type WorkspaceConfig, WorkspaceConfigSchema, buildResolvedContext, findConfigPaths, findProjectRoot, findWorkspaceRoot, getCockpitConfigPath, getProfileDir, getProfilePath, loadConfig, mergeConfigs, resolveConfig, tryLoadConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// src/types/config.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var AdapterNameSchema = z.enum([
|
|
4
|
+
"claude-code",
|
|
5
|
+
"cursor",
|
|
6
|
+
"copilot",
|
|
7
|
+
"opencode"
|
|
8
|
+
]);
|
|
9
|
+
var ContextRulesSchema = z.object({
|
|
10
|
+
global: z.array(z.string()).optional(),
|
|
11
|
+
project: z.array(z.string()).optional()
|
|
12
|
+
});
|
|
13
|
+
var IncludeListSchema = z.object({
|
|
14
|
+
include: z.array(z.string()).optional()
|
|
15
|
+
});
|
|
16
|
+
var ProfileConfigSchema = z.object({
|
|
17
|
+
cockpit: z.union([z.string(), z.number()]).transform(String),
|
|
18
|
+
profile: z.object({
|
|
19
|
+
name: z.string(),
|
|
20
|
+
sync: z.object({
|
|
21
|
+
remote: z.string().optional(),
|
|
22
|
+
auto_sync: z.boolean().default(false)
|
|
23
|
+
}).optional()
|
|
24
|
+
}).optional(),
|
|
25
|
+
preferences: z.object({
|
|
26
|
+
language: z.string().default("en"),
|
|
27
|
+
default_model: z.string().default("claude-sonnet-4-6"),
|
|
28
|
+
default_adapter: AdapterNameSchema.default("claude-code")
|
|
29
|
+
}).optional(),
|
|
30
|
+
context: ContextRulesSchema.optional()
|
|
31
|
+
});
|
|
32
|
+
var WorkspaceConfigSchema = z.object({
|
|
33
|
+
cockpit: z.union([z.string(), z.number()]).transform(String),
|
|
34
|
+
workspace: z.object({
|
|
35
|
+
name: z.string(),
|
|
36
|
+
default_adapter: AdapterNameSchema.optional()
|
|
37
|
+
}).optional(),
|
|
38
|
+
adapters: z.array(AdapterNameSchema).optional(),
|
|
39
|
+
skills: IncludeListSchema.optional(),
|
|
40
|
+
agents: IncludeListSchema.optional(),
|
|
41
|
+
context: ContextRulesSchema.optional()
|
|
42
|
+
});
|
|
43
|
+
var ProjectConfigSchema = z.object({
|
|
44
|
+
cockpit: z.union([z.string(), z.number()]).transform(String),
|
|
45
|
+
project: z.object({
|
|
46
|
+
name: z.string().optional(),
|
|
47
|
+
default_adapter: AdapterNameSchema.optional()
|
|
48
|
+
}).optional(),
|
|
49
|
+
adapters: z.array(AdapterNameSchema).optional(),
|
|
50
|
+
skills: IncludeListSchema.optional(),
|
|
51
|
+
agents: IncludeListSchema.optional(),
|
|
52
|
+
context: ContextRulesSchema.optional()
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// src/types/skill.ts
|
|
56
|
+
import { z as z2 } from "zod";
|
|
57
|
+
var SkillDefinitionSchema = z2.object({
|
|
58
|
+
name: z2.string(),
|
|
59
|
+
version: z2.string().default("1.0.0"),
|
|
60
|
+
description: z2.string().optional(),
|
|
61
|
+
trigger: z2.array(z2.string()).optional(),
|
|
62
|
+
prompt: z2.string(),
|
|
63
|
+
tools: z2.array(z2.string()).optional(),
|
|
64
|
+
adapters: z2.record(
|
|
65
|
+
z2.string(),
|
|
66
|
+
z2.object({
|
|
67
|
+
type: z2.enum(["command", "rule"]).optional(),
|
|
68
|
+
alwaysApply: z2.boolean().optional()
|
|
69
|
+
})
|
|
70
|
+
).optional()
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// src/types/agent.ts
|
|
74
|
+
import { z as z3 } from "zod";
|
|
75
|
+
var AgentDefinitionSchema = z3.object({
|
|
76
|
+
name: z3.string(),
|
|
77
|
+
role: z3.string(),
|
|
78
|
+
model: z3.string().default("claude-sonnet-4-6"),
|
|
79
|
+
context: z3.object({
|
|
80
|
+
include: z3.array(z3.string()).optional(),
|
|
81
|
+
rules: z3.array(z3.string()).optional()
|
|
82
|
+
}).optional(),
|
|
83
|
+
skills: z3.array(z3.string()).optional(),
|
|
84
|
+
worktree: z3.object({
|
|
85
|
+
auto_create: z3.boolean().default(false),
|
|
86
|
+
branch_prefix: z3.string().optional()
|
|
87
|
+
}).optional()
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// src/types/context.ts
|
|
91
|
+
import { z as z4 } from "zod";
|
|
92
|
+
var ContextRuleSchema = z4.object({
|
|
93
|
+
content: z4.string(),
|
|
94
|
+
scope: z4.enum(["global", "project"]).default("global"),
|
|
95
|
+
source: z4.string().optional()
|
|
96
|
+
});
|
|
97
|
+
function buildResolvedContext(globalRules, projectRules, source) {
|
|
98
|
+
return {
|
|
99
|
+
global: globalRules.map((content) => ({ content, scope: "global", source })),
|
|
100
|
+
project: projectRules.map((content) => ({ content, scope: "project", source }))
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// src/config/loader.ts
|
|
105
|
+
import { readFileSync } from "fs";
|
|
106
|
+
import { parse as parseYaml } from "yaml";
|
|
107
|
+
var ConfigLoadError = class extends Error {
|
|
108
|
+
constructor(path, message, cause) {
|
|
109
|
+
super(`Failed to load config at ${path}: ${message}`);
|
|
110
|
+
this.path = path;
|
|
111
|
+
this.cause = cause;
|
|
112
|
+
this.name = "ConfigLoadError";
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
var ConfigValidationError = class extends Error {
|
|
116
|
+
constructor(path, issues) {
|
|
117
|
+
super(
|
|
118
|
+
`Invalid config at ${path}:
|
|
119
|
+
${issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join("\n")}`
|
|
120
|
+
);
|
|
121
|
+
this.path = path;
|
|
122
|
+
this.issues = issues;
|
|
123
|
+
this.name = "ConfigValidationError";
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
function loadConfig(path, schema) {
|
|
127
|
+
let raw;
|
|
128
|
+
try {
|
|
129
|
+
raw = readFileSync(path, "utf-8");
|
|
130
|
+
} catch (err) {
|
|
131
|
+
throw new ConfigLoadError(path, "file not found or not readable", err);
|
|
132
|
+
}
|
|
133
|
+
let parsed;
|
|
134
|
+
try {
|
|
135
|
+
parsed = parseYaml(raw);
|
|
136
|
+
} catch (err) {
|
|
137
|
+
throw new ConfigLoadError(path, "invalid YAML", err);
|
|
138
|
+
}
|
|
139
|
+
const result = schema.safeParse(parsed);
|
|
140
|
+
if (!result.success) {
|
|
141
|
+
throw new ConfigValidationError(path, result.error.issues);
|
|
142
|
+
}
|
|
143
|
+
return result.data;
|
|
144
|
+
}
|
|
145
|
+
function tryLoadConfig(path, schema) {
|
|
146
|
+
try {
|
|
147
|
+
return loadConfig(path, schema);
|
|
148
|
+
} catch (err) {
|
|
149
|
+
if (err instanceof ConfigLoadError) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
throw err;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// src/config/resolver.ts
|
|
157
|
+
function mergeStringArrays(...arrays) {
|
|
158
|
+
const seen = /* @__PURE__ */ new Set();
|
|
159
|
+
const result = [];
|
|
160
|
+
for (const arr of arrays) {
|
|
161
|
+
for (const item of arr ?? []) {
|
|
162
|
+
if (!seen.has(item)) {
|
|
163
|
+
seen.add(item);
|
|
164
|
+
result.push(item);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return result;
|
|
169
|
+
}
|
|
170
|
+
function resolveConfig(options) {
|
|
171
|
+
const { profilePath, workspacePath, projectPath } = options;
|
|
172
|
+
const profile = profilePath ? tryLoadConfig(profilePath, ProfileConfigSchema) : null;
|
|
173
|
+
const workspace = workspacePath ? tryLoadConfig(workspacePath, WorkspaceConfigSchema) : null;
|
|
174
|
+
const project = projectPath ? tryLoadConfig(projectPath, ProjectConfigSchema) : null;
|
|
175
|
+
return mergeConfigs(
|
|
176
|
+
{ profilePath: profilePath ?? null, workspacePath: workspacePath ?? null, projectPath: projectPath ?? null },
|
|
177
|
+
profile,
|
|
178
|
+
workspace,
|
|
179
|
+
project
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
function mergeConfigs(paths, profile, workspace, project) {
|
|
183
|
+
const name = project?.project?.name ?? workspace?.workspace?.name ?? profile?.profile?.name ?? "unnamed";
|
|
184
|
+
const defaultAdapter = project?.project?.default_adapter ?? workspace?.workspace?.default_adapter ?? profile?.preferences?.default_adapter ?? "claude-code";
|
|
185
|
+
const adapters = mergeStringArrays(
|
|
186
|
+
profile?.preferences?.default_adapter ? [profile.preferences.default_adapter] : [],
|
|
187
|
+
workspace?.adapters,
|
|
188
|
+
project?.adapters
|
|
189
|
+
);
|
|
190
|
+
if (!adapters.includes(defaultAdapter)) {
|
|
191
|
+
adapters.unshift(defaultAdapter);
|
|
192
|
+
}
|
|
193
|
+
const language = profile?.preferences?.language ?? "en";
|
|
194
|
+
const defaultModel = profile?.preferences?.default_model ?? "claude-sonnet-4-6";
|
|
195
|
+
const globalContext = mergeStringArrays(
|
|
196
|
+
profile?.context?.global,
|
|
197
|
+
workspace?.context?.global,
|
|
198
|
+
project?.context?.global
|
|
199
|
+
);
|
|
200
|
+
const projectContext = mergeStringArrays(
|
|
201
|
+
profile?.context?.project,
|
|
202
|
+
workspace?.context?.project,
|
|
203
|
+
project?.context?.project
|
|
204
|
+
);
|
|
205
|
+
const skillIncludes = mergeStringArrays(
|
|
206
|
+
workspace?.skills?.include,
|
|
207
|
+
project?.skills?.include
|
|
208
|
+
);
|
|
209
|
+
const agentIncludes = mergeStringArrays(
|
|
210
|
+
workspace?.agents?.include,
|
|
211
|
+
project?.agents?.include
|
|
212
|
+
);
|
|
213
|
+
return {
|
|
214
|
+
profilePath: paths.profilePath,
|
|
215
|
+
workspacePath: paths.workspacePath,
|
|
216
|
+
projectPath: paths.projectPath,
|
|
217
|
+
name,
|
|
218
|
+
defaultAdapter,
|
|
219
|
+
adapters,
|
|
220
|
+
preferences: { language, defaultModel },
|
|
221
|
+
context: { global: globalContext, project: projectContext },
|
|
222
|
+
skills: { include: skillIncludes },
|
|
223
|
+
agents: { include: agentIncludes }
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// src/config/finder.ts
|
|
228
|
+
import { existsSync } from "fs";
|
|
229
|
+
import { join, dirname } from "path";
|
|
230
|
+
import { homedir } from "os";
|
|
231
|
+
var COCKPIT_DIR = ".cockpit";
|
|
232
|
+
var CONFIG_FILE = "config.yaml";
|
|
233
|
+
var PROFILE_FILE = "profile.yaml";
|
|
234
|
+
function getProfileDir() {
|
|
235
|
+
return join(homedir(), COCKPIT_DIR);
|
|
236
|
+
}
|
|
237
|
+
function getProfilePath() {
|
|
238
|
+
return join(getProfileDir(), PROFILE_FILE);
|
|
239
|
+
}
|
|
240
|
+
function getCockpitConfigPath(dir) {
|
|
241
|
+
return join(dir, COCKPIT_DIR, CONFIG_FILE);
|
|
242
|
+
}
|
|
243
|
+
function findWorkspaceRoot(cwd) {
|
|
244
|
+
let current = cwd;
|
|
245
|
+
while (true) {
|
|
246
|
+
const configPath = getCockpitConfigPath(current);
|
|
247
|
+
if (existsSync(configPath)) {
|
|
248
|
+
return current;
|
|
249
|
+
}
|
|
250
|
+
const parent = dirname(current);
|
|
251
|
+
if (parent === current) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
current = parent;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function findProjectRoot(cwd) {
|
|
258
|
+
const configPath = getCockpitConfigPath(cwd);
|
|
259
|
+
if (existsSync(configPath)) {
|
|
260
|
+
return cwd;
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
function findConfigPaths(cwd) {
|
|
265
|
+
const profilePath = existsSync(getProfilePath()) ? getProfilePath() : null;
|
|
266
|
+
const roots = [];
|
|
267
|
+
let current = cwd;
|
|
268
|
+
while (true) {
|
|
269
|
+
if (existsSync(getCockpitConfigPath(current))) {
|
|
270
|
+
roots.push(current);
|
|
271
|
+
}
|
|
272
|
+
const parent = dirname(current);
|
|
273
|
+
if (parent === current) break;
|
|
274
|
+
current = parent;
|
|
275
|
+
}
|
|
276
|
+
if (roots.length === 0) {
|
|
277
|
+
return { profilePath, workspacePath: null, projectPath: null };
|
|
278
|
+
}
|
|
279
|
+
if (roots.length === 1) {
|
|
280
|
+
return {
|
|
281
|
+
profilePath,
|
|
282
|
+
workspacePath: getCockpitConfigPath(roots[0]),
|
|
283
|
+
projectPath: null
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
profilePath,
|
|
288
|
+
workspacePath: getCockpitConfigPath(roots[1]),
|
|
289
|
+
projectPath: getCockpitConfigPath(roots[0])
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
export {
|
|
293
|
+
AgentDefinitionSchema,
|
|
294
|
+
COCKPIT_DIR,
|
|
295
|
+
CONFIG_FILE,
|
|
296
|
+
ConfigLoadError,
|
|
297
|
+
ConfigValidationError,
|
|
298
|
+
ContextRuleSchema,
|
|
299
|
+
PROFILE_FILE,
|
|
300
|
+
ProfileConfigSchema,
|
|
301
|
+
ProjectConfigSchema,
|
|
302
|
+
SkillDefinitionSchema,
|
|
303
|
+
WorkspaceConfigSchema,
|
|
304
|
+
buildResolvedContext,
|
|
305
|
+
findConfigPaths,
|
|
306
|
+
findProjectRoot,
|
|
307
|
+
findWorkspaceRoot,
|
|
308
|
+
getCockpitConfigPath,
|
|
309
|
+
getProfileDir,
|
|
310
|
+
getProfilePath,
|
|
311
|
+
loadConfig,
|
|
312
|
+
mergeConfigs,
|
|
313
|
+
resolveConfig,
|
|
314
|
+
tryLoadConfig
|
|
315
|
+
};
|
|
316
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/config.ts","../src/types/skill.ts","../src/types/agent.ts","../src/types/context.ts","../src/config/loader.ts","../src/config/resolver.ts","../src/config/finder.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ─── Shared ────────────────────────────────────────────────────────────────\n\nconst AdapterNameSchema = z.enum([\n \"claude-code\",\n \"cursor\",\n \"copilot\",\n \"opencode\",\n]);\nexport type AdapterName = z.infer<typeof AdapterNameSchema>;\n\nconst ContextRulesSchema = z.object({\n global: z.array(z.string()).optional(),\n project: z.array(z.string()).optional(),\n});\n\nconst IncludeListSchema = z.object({\n include: z.array(z.string()).optional(),\n});\n\n// ─── Profile Config ────────────────────────────────────────────────────────\n\nexport const ProfileConfigSchema = z.object({\n cockpit: z.union([z.string(), z.number()]).transform(String),\n\n profile: z\n .object({\n name: z.string(),\n sync: z\n .object({\n remote: z.string().optional(),\n auto_sync: z.boolean().default(false),\n })\n .optional(),\n })\n .optional(),\n\n preferences: z\n .object({\n language: z.string().default(\"en\"),\n default_model: z.string().default(\"claude-sonnet-4-6\"),\n default_adapter: AdapterNameSchema.default(\"claude-code\"),\n })\n .optional(),\n\n context: ContextRulesSchema.optional(),\n});\n\nexport type ProfileConfig = z.infer<typeof ProfileConfigSchema>;\n\n// ─── Workspace Config ──────────────────────────────────────────────────────\n\nexport const WorkspaceConfigSchema = z.object({\n cockpit: z.union([z.string(), z.number()]).transform(String),\n\n workspace: z\n .object({\n name: z.string(),\n default_adapter: AdapterNameSchema.optional(),\n })\n .optional(),\n\n adapters: z.array(AdapterNameSchema).optional(),\n\n skills: IncludeListSchema.optional(),\n\n agents: IncludeListSchema.optional(),\n\n context: ContextRulesSchema.optional(),\n});\n\nexport type WorkspaceConfig = z.infer<typeof WorkspaceConfigSchema>;\n\n// ─── Project Config ────────────────────────────────────────────────────────\n\nexport const ProjectConfigSchema = z.object({\n cockpit: z.union([z.string(), z.number()]).transform(String),\n\n project: z\n .object({\n name: z.string().optional(),\n default_adapter: AdapterNameSchema.optional(),\n })\n .optional(),\n\n adapters: z.array(AdapterNameSchema).optional(),\n\n skills: IncludeListSchema.optional(),\n\n agents: IncludeListSchema.optional(),\n\n context: ContextRulesSchema.optional(),\n});\n\nexport type ProjectConfig = z.infer<typeof ProjectConfigSchema>;\n\n// ─── Resolved Config ───────────────────────────────────────────────────────\n\nexport interface ResolvedConfig {\n profilePath: string | null;\n workspacePath: string | null;\n projectPath: string | null;\n\n name: string;\n defaultAdapter: AdapterName;\n adapters: AdapterName[];\n\n preferences: {\n language: string;\n defaultModel: string;\n };\n\n context: {\n global: string[];\n project: string[];\n };\n\n skills: {\n include: string[];\n };\n\n agents: {\n include: string[];\n };\n}\n","import { z } from \"zod\";\nimport { type AdapterName } from \"./config.js\";\n\n// ─── Skill Definition ──────────────────────────────────────────────────────\n\nexport const SkillDefinitionSchema = z.object({\n name: z.string(),\n version: z.string().default(\"1.0.0\"),\n description: z.string().optional(),\n\n trigger: z.array(z.string()).optional(),\n\n prompt: z.string(),\n\n tools: z.array(z.string()).optional(),\n\n adapters: z\n .record(\n z.string(),\n z.object({\n type: z.enum([\"command\", \"rule\"]).optional(),\n alwaysApply: z.boolean().optional(),\n })\n )\n .optional(),\n});\n\nexport type SkillDefinition = z.infer<typeof SkillDefinitionSchema>;\n\n// ─── Resolved Skill ────────────────────────────────────────────────────────\n\nexport interface ResolvedSkill {\n name: string;\n version: string;\n description: string | undefined;\n trigger: string[];\n prompt: string;\n tools: string[];\n sourcePath: string;\n adapterConfig: Partial<Record<AdapterName, { type?: string; alwaysApply?: boolean }>>;\n}\n","import { z } from \"zod\";\n\n// ─── Agent Definition ──────────────────────────────────────────────────────\n\nexport const AgentDefinitionSchema = z.object({\n name: z.string(),\n role: z.string(),\n model: z.string().default(\"claude-sonnet-4-6\"),\n\n context: z\n .object({\n include: z.array(z.string()).optional(),\n rules: z.array(z.string()).optional(),\n })\n .optional(),\n\n skills: z.array(z.string()).optional(),\n\n worktree: z\n .object({\n auto_create: z.boolean().default(false),\n branch_prefix: z.string().optional(),\n })\n .optional(),\n});\n\nexport type AgentDefinition = z.infer<typeof AgentDefinitionSchema>;\n\n// ─── Agent State ───────────────────────────────────────────────────────────\n\nexport type AgentStatus = \"idle\" | \"running\" | \"stopped\" | \"error\";\n\nexport interface ResolvedAgent {\n name: string;\n role: string;\n model: string;\n skills: string[];\n contextIncludes: string[];\n contextRules: string[];\n worktreeConfig: {\n autoCreate: boolean;\n branchPrefix: string | undefined;\n };\n sourcePath: string;\n status: AgentStatus;\n}\n","import { z } from \"zod\";\n\n// ─── Context Rule ──────────────────────────────────────────────────────────\n\nexport const ContextRuleSchema = z.object({\n content: z.string(),\n scope: z.enum([\"global\", \"project\"]).default(\"global\"),\n source: z.string().optional(),\n});\n\nexport type ContextRule = z.infer<typeof ContextRuleSchema>;\n\n// ─── Resolved Context ──────────────────────────────────────────────────────\n\nexport interface ResolvedContext {\n global: ContextRule[];\n project: ContextRule[];\n}\n\n// ─── Helpers ───────────────────────────────────────────────────────────────\n\nexport function buildResolvedContext(\n globalRules: string[],\n projectRules: string[],\n source?: string\n): ResolvedContext {\n return {\n global: globalRules.map((content) => ({ content, scope: \"global\", source })),\n project: projectRules.map((content) => ({ content, scope: \"project\", source })),\n };\n}\n","import { readFileSync } from \"node:fs\";\nimport { parse as parseYaml } from \"yaml\";\nimport { type ZodTypeAny, type z, ZodError } from \"zod\";\n\n// ─── Errors ────────────────────────────────────────────────────────────────\n\nexport class ConfigLoadError extends Error {\n constructor(\n public readonly path: string,\n message: string,\n public readonly cause?: unknown\n ) {\n super(`Failed to load config at ${path}: ${message}`);\n this.name = \"ConfigLoadError\";\n }\n}\n\nexport class ConfigValidationError extends Error {\n constructor(\n public readonly path: string,\n public readonly issues: ZodError[\"issues\"]\n ) {\n super(\n `Invalid config at ${path}:\\n${issues.map((i) => ` ${i.path.join(\".\")}: ${i.message}`).join(\"\\n\")}`\n );\n this.name = \"ConfigValidationError\";\n }\n}\n\n// ─── Loader ────────────────────────────────────────────────────────────────\n\n/**\n * Load and validate a YAML config file against a Zod schema.\n * Throws ConfigLoadError or ConfigValidationError on failure.\n * Using ZodTypeAny + z.infer ensures transforms are reflected in the return type.\n */\nexport function loadConfig<S extends ZodTypeAny>(path: string, schema: S): z.infer<S> {\n let raw: string;\n try {\n raw = readFileSync(path, \"utf-8\");\n } catch (err) {\n throw new ConfigLoadError(path, \"file not found or not readable\", err);\n }\n\n let parsed: unknown;\n try {\n parsed = parseYaml(raw);\n } catch (err) {\n throw new ConfigLoadError(path, \"invalid YAML\", err);\n }\n\n const result = schema.safeParse(parsed);\n if (!result.success) {\n throw new ConfigValidationError(path, (result.error as ZodError).issues);\n }\n\n return result.data as z.infer<S>;\n}\n\n/**\n * Attempt to load a config file, returning null if the file doesn't exist.\n * Still throws on parse errors or validation failures.\n */\nexport function tryLoadConfig<S extends ZodTypeAny>(path: string, schema: S): z.infer<S> | null {\n try {\n return loadConfig(path, schema);\n } catch (err) {\n if (err instanceof ConfigLoadError) {\n return null;\n }\n throw err;\n }\n}\n","import {\n type ProfileConfig,\n type WorkspaceConfig,\n type ProjectConfig,\n type ResolvedConfig,\n type AdapterName,\n ProfileConfigSchema,\n WorkspaceConfigSchema,\n ProjectConfigSchema,\n} from \"../types/config.js\";\nimport { tryLoadConfig } from \"./loader.js\";\n\n// ─── Deep Merge Helpers ────────────────────────────────────────────────────\n\nfunction mergeStringArrays(...arrays: (string[] | undefined)[]): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n for (const arr of arrays) {\n for (const item of arr ?? []) {\n if (!seen.has(item)) {\n seen.add(item);\n result.push(item);\n }\n }\n }\n return result;\n}\n\nfunction lastDefined<T>(...values: (T | undefined)[]): T | undefined {\n for (let i = values.length - 1; i >= 0; i--) {\n if (values[i] !== undefined) return values[i];\n }\n return undefined;\n}\n\n// ─── Resolver ─────────────────────────────────────────────────────────────\n\nexport interface ResolveOptions {\n profilePath?: string | null;\n workspacePath?: string | null;\n projectPath?: string | null;\n}\n\n/**\n * Load and merge configs in order: Profile → Workspace → Project.\n * Later layers override earlier ones (deep merge for arrays).\n */\nexport function resolveConfig(options: ResolveOptions): ResolvedConfig {\n const { profilePath, workspacePath, projectPath } = options;\n\n const profile = profilePath\n ? tryLoadConfig(profilePath, ProfileConfigSchema)\n : null;\n\n const workspace = workspacePath\n ? tryLoadConfig(workspacePath, WorkspaceConfigSchema)\n : null;\n\n const project = projectPath\n ? tryLoadConfig(projectPath, ProjectConfigSchema)\n : null;\n\n return mergeConfigs(\n { profilePath: profilePath ?? null, workspacePath: workspacePath ?? null, projectPath: projectPath ?? null },\n profile,\n workspace,\n project\n );\n}\n\nexport function mergeConfigs(\n paths: { profilePath: string | null; workspacePath: string | null; projectPath: string | null },\n profile: ProfileConfig | null,\n workspace: WorkspaceConfig | null,\n project: ProjectConfig | null\n): ResolvedConfig {\n // Name resolution: project > workspace > profile > fallback\n const name =\n project?.project?.name ??\n workspace?.workspace?.name ??\n profile?.profile?.name ??\n \"unnamed\";\n\n // Default adapter\n const defaultAdapter: AdapterName =\n project?.project?.default_adapter ??\n workspace?.workspace?.default_adapter ??\n profile?.preferences?.default_adapter ??\n \"claude-code\";\n\n // Adapters list: merge all, project overrides workspace overrides profile\n const adapters: AdapterName[] = mergeStringArrays(\n profile?.preferences?.default_adapter ? [profile.preferences.default_adapter] : [],\n workspace?.adapters,\n project?.adapters\n ) as AdapterName[];\n\n // Ensure default adapter is in list\n if (!adapters.includes(defaultAdapter)) {\n adapters.unshift(defaultAdapter);\n }\n\n // Preferences: profile base, overridden by nothing in workspace/project yet\n const language = profile?.preferences?.language ?? \"en\";\n const defaultModel = profile?.preferences?.default_model ?? \"claude-sonnet-4-6\";\n\n // Context: accumulate all global/project rules (all layers contribute)\n const globalContext = mergeStringArrays(\n profile?.context?.global,\n workspace?.context?.global,\n project?.context?.global\n );\n\n const projectContext = mergeStringArrays(\n profile?.context?.project,\n workspace?.context?.project,\n project?.context?.project\n );\n\n // Skills includes\n const skillIncludes = mergeStringArrays(\n workspace?.skills?.include,\n project?.skills?.include\n );\n\n // Agent includes\n const agentIncludes = mergeStringArrays(\n workspace?.agents?.include,\n project?.agents?.include\n );\n\n return {\n profilePath: paths.profilePath,\n workspacePath: paths.workspacePath,\n projectPath: paths.projectPath,\n name,\n defaultAdapter,\n adapters,\n preferences: { language, defaultModel },\n context: { global: globalContext, project: projectContext },\n skills: { include: skillIncludes },\n agents: { include: agentIncludes },\n };\n}\n","import { existsSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nexport const COCKPIT_DIR = \".cockpit\";\nexport const CONFIG_FILE = \"config.yaml\";\nexport const PROFILE_FILE = \"profile.yaml\";\n\n// ─── Path Helpers ──────────────────────────────────────────────────────────\n\nexport function getProfileDir(): string {\n return join(homedir(), COCKPIT_DIR);\n}\n\nexport function getProfilePath(): string {\n return join(getProfileDir(), PROFILE_FILE);\n}\n\nexport function getCockpitConfigPath(dir: string): string {\n return join(dir, COCKPIT_DIR, CONFIG_FILE);\n}\n\n// ─── Finder ────────────────────────────────────────────────────────────────\n\n/**\n * Walk up the directory tree from `cwd` looking for a `.cockpit/config.yaml`.\n * Returns the directory containing `.cockpit/` (not the config file path).\n * Returns null if nothing is found up to the filesystem root.\n */\nexport function findWorkspaceRoot(cwd: string): string | null {\n let current = cwd;\n\n while (true) {\n const configPath = getCockpitConfigPath(current);\n if (existsSync(configPath)) {\n return current;\n }\n\n const parent = dirname(current);\n if (parent === current) {\n // Reached filesystem root\n return null;\n }\n\n current = parent;\n }\n}\n\n/**\n * Find the nearest project `.cockpit/config.yaml` from `cwd`.\n * Stops at workspace root if found (same dir is fine — workspace IS project).\n */\nexport function findProjectRoot(cwd: string): string | null {\n const configPath = getCockpitConfigPath(cwd);\n if (existsSync(configPath)) {\n return cwd;\n }\n return null;\n}\n\n/**\n * Locate all relevant config paths from the given working directory.\n */\nexport interface ConfigPaths {\n profilePath: string | null;\n workspacePath: string | null;\n projectPath: string | null;\n}\n\nexport function findConfigPaths(cwd: string): ConfigPaths {\n const profilePath = existsSync(getProfilePath()) ? getProfilePath() : null;\n\n // Collect all `.cockpit/config.yaml` roots walking up from cwd.\n // roots[0] = nearest, roots[1] = next ancestor, etc.\n const roots: string[] = [];\n let current = cwd;\n while (true) {\n if (existsSync(getCockpitConfigPath(current))) {\n roots.push(current);\n }\n const parent = dirname(current);\n if (parent === current) break; // filesystem root\n current = parent;\n }\n\n if (roots.length === 0) {\n return { profilePath, workspacePath: null, projectPath: null };\n }\n\n if (roots.length === 1) {\n // Only one config found → it is the workspace, no project-level config\n return {\n profilePath,\n workspacePath: getCockpitConfigPath(roots[0]!),\n projectPath: null,\n };\n }\n\n // Two or more: nearest = project, next ancestor = workspace\n return {\n profilePath,\n workspacePath: getCockpitConfigPath(roots[1]!),\n projectPath: getCockpitConf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W,QAAS;AACxB,cAAU;AAAA,EACZ;AAEA,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,EAAE,aAAa,eAAe,MAAM,aAAa,KAAK;AAAA,EAC/D;AAEA,MAAI,MAAM,WAAW,GAAG;AAEtB,WAAO;AAAA,MACL;AAAA,MACA,eAAe,qBAAqB,MAAM,CAAC,CAAE;AAAA,MAC7C,aAAa;AAAA,IACf;AAAA,EACF;AAGA,SAAO;AAAA,IACL;AAAA,IACA,eAAe,qBAAqB,MAAM,CAAC,CAAE;AAAA,IAC7C,aAAa,qBAAqB,MAAM,CAAC,CAAE;AAAA,EAC7C;AACF;","names":["z","z","z"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cockpit-ai/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Cockpit core types, config loader, and utilities",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"yaml": "^2.4.0",
|
|
25
|
+
"zod": "^3.23.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"tsup": "^8.0.0",
|
|
30
|
+
"typescript": "^5.5.0",
|
|
31
|
+
"vitest": "^2.0.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsup",
|
|
35
|
+
"dev": "tsup --watch",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"test:watch": "vitest",
|
|
38
|
+
"clean": "rm -rf dist"
|
|
39
|
+
}
|
|
40
|
+
}
|