@kb-labs/commit-contracts 0.6.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/LICENSE +4 -0
- package/README.md +90 -0
- package/dist/contract.d.ts +135 -0
- package/dist/contract.js +140 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +2410 -0
- package/dist/index.js +745 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.d.ts +1352 -0
- package/dist/schema.js +158 -0
- package/dist/schema.js.map +1 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2410 @@
|
|
|
1
|
+
import { PluginArtifactIds, PluginCommandIds } from './contract.js';
|
|
2
|
+
export { pluginContractsManifest } from './contract.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export { ActionsResponse, ActionsResponseSchema, ApplyInput, ApplyInputSchema, ApplyOutput, ApplyOutputSchema, ApplyResult, ApplyResultSchema, CommitGroup, CommitGroupSchema, CommitPlan, CommitPlanSchema, CommitReasoning, CommitReasoningSchema, CommitRunInput, CommitRunInputSchema, CommitRunOutput, CommitRunOutputSchema, ConventionalType, ConventionalTypeSchema, FileSummary, FileSummarySchema, GenerateInput, GenerateInputSchema, GenerateOutput, GenerateOutputSchema, GitStatus, GitStatusSchema, GitStatusSnapshot, GitStatusSnapshotSchema, OpenInput, OpenInputSchema, OpenOutput, OpenOutputSchema, PushInput, PushInputSchema, PushOutput, PushOutputSchema, PushResult, PushResultSchema, ReleaseHint, ReleaseHintSchema, ResetOutput, ResetOutputSchema } from './schema.js';
|
|
5
|
+
import * as _kb_labs_shared_command_kit from '@kb-labs/shared-command-kit';
|
|
6
|
+
import * as _kb_labs_shared_cli_ui from '@kb-labs/shared-cli-ui';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Type-safe helper functions for contracts
|
|
10
|
+
* @module @kb-labs/commit-contracts/helpers
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get artifact path pattern by ID (type-safe)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const path = getArtifactPath('commit.plan.json');
|
|
18
|
+
* // Returns: '.kb/commit/current/plan.json'
|
|
19
|
+
*/
|
|
20
|
+
declare function getArtifactPath<T extends PluginArtifactIds>(id: T): string;
|
|
21
|
+
/**
|
|
22
|
+
* Get artifact metadata by ID (type-safe)
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const artifact = getArtifact('commit.plan.json');
|
|
26
|
+
* // artifact.kind, artifact.description, etc.
|
|
27
|
+
*/
|
|
28
|
+
declare function getArtifact<T extends PluginArtifactIds>(id: T): {
|
|
29
|
+
readonly "commit.plan.json": {
|
|
30
|
+
readonly id: "commit.plan.json";
|
|
31
|
+
readonly kind: "json";
|
|
32
|
+
readonly description: "Current commit plan generated by LLM analysis of git changes.";
|
|
33
|
+
readonly pathPattern: ".kb/commit/current/plan.json";
|
|
34
|
+
readonly mediaType: "application/json";
|
|
35
|
+
readonly schemaRef: "@kb-labs/commit-contracts/schema#CommitPlan";
|
|
36
|
+
readonly example: {
|
|
37
|
+
readonly summary: "Example commit plan with two commits";
|
|
38
|
+
readonly payload: {
|
|
39
|
+
readonly schemaVersion: "1.0";
|
|
40
|
+
readonly commits: readonly [{
|
|
41
|
+
readonly id: "c1";
|
|
42
|
+
readonly type: "feat";
|
|
43
|
+
readonly scope: "ui";
|
|
44
|
+
readonly message: "add button component";
|
|
45
|
+
readonly files: readonly ["src/components/Button.tsx"];
|
|
46
|
+
readonly releaseHint: "minor";
|
|
47
|
+
}];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly "commit.status.json": {
|
|
52
|
+
readonly id: "commit.status.json";
|
|
53
|
+
readonly kind: "json";
|
|
54
|
+
readonly description: "Git status snapshot at plan generation time.";
|
|
55
|
+
readonly pathPattern: ".kb/commit/current/status.json";
|
|
56
|
+
readonly mediaType: "application/json";
|
|
57
|
+
readonly schemaRef: "@kb-labs/commit-contracts/schema#GitStatusSnapshot";
|
|
58
|
+
};
|
|
59
|
+
readonly "commit.history": {
|
|
60
|
+
readonly id: "commit.history";
|
|
61
|
+
readonly kind: "dir";
|
|
62
|
+
readonly description: "History of applied commit plans with results.";
|
|
63
|
+
readonly pathPattern: ".kb/commit/history/";
|
|
64
|
+
};
|
|
65
|
+
}[T];
|
|
66
|
+
/**
|
|
67
|
+
* Check if artifact ID exists in contracts (type-safe)
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* if (hasArtifact('commit.plan.json')) {
|
|
71
|
+
* // TypeScript knows the type!
|
|
72
|
+
* }
|
|
73
|
+
*/
|
|
74
|
+
declare function hasArtifact(id: string): id is PluginArtifactIds;
|
|
75
|
+
/**
|
|
76
|
+
* Get command metadata by ID (type-safe)
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* const command = getCommand('commit:generate');
|
|
80
|
+
* // command.description, command.input, command.output, etc.
|
|
81
|
+
*/
|
|
82
|
+
declare function getCommand<T extends PluginCommandIds>(id: T): {
|
|
83
|
+
readonly commit: {
|
|
84
|
+
readonly id: "commit";
|
|
85
|
+
readonly description: "Generate and apply commits (default flow).";
|
|
86
|
+
readonly input: {
|
|
87
|
+
readonly ref: "@kb-labs/commit-contracts/schema#CommitRunInput";
|
|
88
|
+
readonly format: "zod";
|
|
89
|
+
};
|
|
90
|
+
readonly output: {
|
|
91
|
+
readonly ref: "@kb-labs/commit-contracts/schema#CommitRunOutput";
|
|
92
|
+
readonly format: "zod";
|
|
93
|
+
};
|
|
94
|
+
readonly produces: ["commit.plan.json", "commit.status.json"];
|
|
95
|
+
readonly examples: ["kb commit", "kb commit --dry-run", "kb commit --with-push"];
|
|
96
|
+
};
|
|
97
|
+
readonly "commit:generate": {
|
|
98
|
+
readonly id: "commit:generate";
|
|
99
|
+
readonly description: "Generate commit plan from git changes using LLM.";
|
|
100
|
+
readonly input: {
|
|
101
|
+
readonly ref: "@kb-labs/commit-contracts/schema#GenerateInput";
|
|
102
|
+
readonly format: "zod";
|
|
103
|
+
};
|
|
104
|
+
readonly output: {
|
|
105
|
+
readonly ref: "@kb-labs/commit-contracts/schema#GenerateOutput";
|
|
106
|
+
readonly format: "zod";
|
|
107
|
+
};
|
|
108
|
+
readonly produces: ["commit.plan.json", "commit.status.json"];
|
|
109
|
+
readonly examples: ["kb commit generate", "kb commit generate --json", "kb commit generate --scope src/**"];
|
|
110
|
+
};
|
|
111
|
+
readonly "commit:apply": {
|
|
112
|
+
readonly id: "commit:apply";
|
|
113
|
+
readonly description: "Apply current commit plan (create local git commits).";
|
|
114
|
+
readonly input: {
|
|
115
|
+
readonly ref: "@kb-labs/commit-contracts/schema#ApplyInput";
|
|
116
|
+
readonly format: "zod";
|
|
117
|
+
};
|
|
118
|
+
readonly output: {
|
|
119
|
+
readonly ref: "@kb-labs/commit-contracts/schema#ApplyOutput";
|
|
120
|
+
readonly format: "zod";
|
|
121
|
+
};
|
|
122
|
+
readonly produces: [];
|
|
123
|
+
readonly examples: ["kb commit apply", "kb commit apply --force"];
|
|
124
|
+
};
|
|
125
|
+
readonly "commit:push": {
|
|
126
|
+
readonly id: "commit:push";
|
|
127
|
+
readonly description: "Push commits to remote repository.";
|
|
128
|
+
readonly input: {
|
|
129
|
+
readonly ref: "@kb-labs/commit-contracts/schema#PushInput";
|
|
130
|
+
readonly format: "zod";
|
|
131
|
+
};
|
|
132
|
+
readonly output: {
|
|
133
|
+
readonly ref: "@kb-labs/commit-contracts/schema#PushOutput";
|
|
134
|
+
readonly format: "zod";
|
|
135
|
+
};
|
|
136
|
+
readonly produces: [];
|
|
137
|
+
readonly examples: ["kb commit push", "kb commit push --force"];
|
|
138
|
+
};
|
|
139
|
+
readonly "commit:open": {
|
|
140
|
+
readonly id: "commit:open";
|
|
141
|
+
readonly description: "Show current commit plan.";
|
|
142
|
+
readonly input: {
|
|
143
|
+
readonly ref: "@kb-labs/commit-contracts/schema#OpenInput";
|
|
144
|
+
readonly format: "zod";
|
|
145
|
+
};
|
|
146
|
+
readonly output: {
|
|
147
|
+
readonly ref: "@kb-labs/commit-contracts/schema#OpenOutput";
|
|
148
|
+
readonly format: "zod";
|
|
149
|
+
};
|
|
150
|
+
readonly produces: [];
|
|
151
|
+
readonly examples: ["kb commit open", "kb commit open --json"];
|
|
152
|
+
};
|
|
153
|
+
readonly "commit:reset": {
|
|
154
|
+
readonly id: "commit:reset";
|
|
155
|
+
readonly description: "Clear current commit plan.";
|
|
156
|
+
readonly output: {
|
|
157
|
+
readonly ref: "@kb-labs/commit-contracts/schema#ResetOutput";
|
|
158
|
+
readonly format: "zod";
|
|
159
|
+
};
|
|
160
|
+
readonly produces: [];
|
|
161
|
+
readonly examples: ["kb commit reset"];
|
|
162
|
+
};
|
|
163
|
+
}[T];
|
|
164
|
+
/**
|
|
165
|
+
* Check if command ID exists in contracts (type-safe)
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* if (hasCommand('commit:generate')) {
|
|
169
|
+
* // TypeScript knows the type!
|
|
170
|
+
* }
|
|
171
|
+
*/
|
|
172
|
+
declare function hasCommand(id: string): id is PluginCommandIds;
|
|
173
|
+
/**
|
|
174
|
+
* Type-safe identity function for command IDs (useful for validation)
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* const cmdId = getCommandId('commit:generate'); // Compile-time validation!
|
|
178
|
+
*/
|
|
179
|
+
declare function getCommandId<T extends PluginCommandIds>(id: T): T;
|
|
180
|
+
/**
|
|
181
|
+
* Type-safe identity function for artifact IDs (useful for validation)
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* const artifactId = getArtifactId('commit.plan.json'); // Compile-time validation!
|
|
185
|
+
*/
|
|
186
|
+
declare function getArtifactId<T extends PluginArtifactIds>(id: T): T;
|
|
187
|
+
|
|
188
|
+
declare const pluginContractsSchema: z.ZodObject<{
|
|
189
|
+
schema: z.ZodLiteral<"kb.plugin.contracts/1">;
|
|
190
|
+
pluginId: z.ZodString;
|
|
191
|
+
contractsVersion: z.ZodString;
|
|
192
|
+
artifacts: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
193
|
+
id: z.ZodString;
|
|
194
|
+
kind: z.ZodEnum<["file", "json", "markdown", "binary", "dir", "log"]>;
|
|
195
|
+
description: z.ZodOptional<z.ZodString>;
|
|
196
|
+
pathPattern: z.ZodOptional<z.ZodString>;
|
|
197
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
198
|
+
schemaRef: z.ZodOptional<z.ZodString>;
|
|
199
|
+
example: z.ZodOptional<z.ZodObject<{
|
|
200
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
201
|
+
payload: z.ZodOptional<z.ZodUnknown>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
summary?: string | undefined;
|
|
204
|
+
payload?: unknown;
|
|
205
|
+
}, {
|
|
206
|
+
summary?: string | undefined;
|
|
207
|
+
payload?: unknown;
|
|
208
|
+
}>>;
|
|
209
|
+
}, "strip", z.ZodTypeAny, {
|
|
210
|
+
id: string;
|
|
211
|
+
kind: "file" | "json" | "markdown" | "binary" | "dir" | "log";
|
|
212
|
+
description?: string | undefined;
|
|
213
|
+
pathPattern?: string | undefined;
|
|
214
|
+
mediaType?: string | undefined;
|
|
215
|
+
schemaRef?: string | undefined;
|
|
216
|
+
example?: {
|
|
217
|
+
summary?: string | undefined;
|
|
218
|
+
payload?: unknown;
|
|
219
|
+
} | undefined;
|
|
220
|
+
}, {
|
|
221
|
+
id: string;
|
|
222
|
+
kind: "file" | "json" | "markdown" | "binary" | "dir" | "log";
|
|
223
|
+
description?: string | undefined;
|
|
224
|
+
pathPattern?: string | undefined;
|
|
225
|
+
mediaType?: string | undefined;
|
|
226
|
+
schemaRef?: string | undefined;
|
|
227
|
+
example?: {
|
|
228
|
+
summary?: string | undefined;
|
|
229
|
+
payload?: unknown;
|
|
230
|
+
} | undefined;
|
|
231
|
+
}>>;
|
|
232
|
+
commands: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
233
|
+
id: z.ZodString;
|
|
234
|
+
description: z.ZodOptional<z.ZodString>;
|
|
235
|
+
input: z.ZodOptional<z.ZodObject<{
|
|
236
|
+
ref: z.ZodString;
|
|
237
|
+
format: z.ZodOptional<z.ZodEnum<["zod", "json-schema", "openapi"]>>;
|
|
238
|
+
description: z.ZodOptional<z.ZodString>;
|
|
239
|
+
}, "strip", z.ZodTypeAny, {
|
|
240
|
+
ref: string;
|
|
241
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
242
|
+
description?: string | undefined;
|
|
243
|
+
}, {
|
|
244
|
+
ref: string;
|
|
245
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
246
|
+
description?: string | undefined;
|
|
247
|
+
}>>;
|
|
248
|
+
output: z.ZodOptional<z.ZodObject<{
|
|
249
|
+
ref: z.ZodString;
|
|
250
|
+
format: z.ZodOptional<z.ZodEnum<["zod", "json-schema", "openapi"]>>;
|
|
251
|
+
description: z.ZodOptional<z.ZodString>;
|
|
252
|
+
}, "strip", z.ZodTypeAny, {
|
|
253
|
+
ref: string;
|
|
254
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
255
|
+
description?: string | undefined;
|
|
256
|
+
}, {
|
|
257
|
+
ref: string;
|
|
258
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
259
|
+
description?: string | undefined;
|
|
260
|
+
}>>;
|
|
261
|
+
produces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
262
|
+
consumes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
263
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
264
|
+
}, "strip", z.ZodTypeAny, {
|
|
265
|
+
id: string;
|
|
266
|
+
description?: string | undefined;
|
|
267
|
+
produces?: string[] | undefined;
|
|
268
|
+
consumes?: string[] | undefined;
|
|
269
|
+
input?: {
|
|
270
|
+
ref: string;
|
|
271
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
272
|
+
description?: string | undefined;
|
|
273
|
+
} | undefined;
|
|
274
|
+
output?: {
|
|
275
|
+
ref: string;
|
|
276
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
277
|
+
description?: string | undefined;
|
|
278
|
+
} | undefined;
|
|
279
|
+
examples?: string[] | undefined;
|
|
280
|
+
}, {
|
|
281
|
+
id: string;
|
|
282
|
+
description?: string | undefined;
|
|
283
|
+
produces?: string[] | undefined;
|
|
284
|
+
consumes?: string[] | undefined;
|
|
285
|
+
input?: {
|
|
286
|
+
ref: string;
|
|
287
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
288
|
+
description?: string | undefined;
|
|
289
|
+
} | undefined;
|
|
290
|
+
output?: {
|
|
291
|
+
ref: string;
|
|
292
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
293
|
+
description?: string | undefined;
|
|
294
|
+
} | undefined;
|
|
295
|
+
examples?: string[] | undefined;
|
|
296
|
+
}>>>;
|
|
297
|
+
workflows: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
298
|
+
id: z.ZodString;
|
|
299
|
+
description: z.ZodOptional<z.ZodString>;
|
|
300
|
+
consumes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
301
|
+
produces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
302
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
303
|
+
id: z.ZodString;
|
|
304
|
+
description: z.ZodOptional<z.ZodString>;
|
|
305
|
+
commandId: z.ZodOptional<z.ZodString>;
|
|
306
|
+
consumes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
307
|
+
produces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
id: string;
|
|
310
|
+
description?: string | undefined;
|
|
311
|
+
produces?: string[] | undefined;
|
|
312
|
+
consumes?: string[] | undefined;
|
|
313
|
+
commandId?: string | undefined;
|
|
314
|
+
}, {
|
|
315
|
+
id: string;
|
|
316
|
+
description?: string | undefined;
|
|
317
|
+
produces?: string[] | undefined;
|
|
318
|
+
consumes?: string[] | undefined;
|
|
319
|
+
commandId?: string | undefined;
|
|
320
|
+
}>, "many">>;
|
|
321
|
+
}, "strip", z.ZodTypeAny, {
|
|
322
|
+
id: string;
|
|
323
|
+
description?: string | undefined;
|
|
324
|
+
produces?: string[] | undefined;
|
|
325
|
+
consumes?: string[] | undefined;
|
|
326
|
+
steps?: {
|
|
327
|
+
id: string;
|
|
328
|
+
description?: string | undefined;
|
|
329
|
+
produces?: string[] | undefined;
|
|
330
|
+
consumes?: string[] | undefined;
|
|
331
|
+
commandId?: string | undefined;
|
|
332
|
+
}[] | undefined;
|
|
333
|
+
}, {
|
|
334
|
+
id: string;
|
|
335
|
+
description?: string | undefined;
|
|
336
|
+
produces?: string[] | undefined;
|
|
337
|
+
consumes?: string[] | undefined;
|
|
338
|
+
steps?: {
|
|
339
|
+
id: string;
|
|
340
|
+
description?: string | undefined;
|
|
341
|
+
produces?: string[] | undefined;
|
|
342
|
+
consumes?: string[] | undefined;
|
|
343
|
+
commandId?: string | undefined;
|
|
344
|
+
}[] | undefined;
|
|
345
|
+
}>>>;
|
|
346
|
+
api: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
rest: z.ZodOptional<z.ZodObject<{
|
|
348
|
+
basePath: z.ZodString;
|
|
349
|
+
routes: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
350
|
+
id: z.ZodString;
|
|
351
|
+
method: z.ZodString;
|
|
352
|
+
path: z.ZodString;
|
|
353
|
+
description: z.ZodOptional<z.ZodString>;
|
|
354
|
+
request: z.ZodOptional<z.ZodObject<{
|
|
355
|
+
ref: z.ZodString;
|
|
356
|
+
format: z.ZodOptional<z.ZodEnum<["zod", "json-schema", "openapi"]>>;
|
|
357
|
+
description: z.ZodOptional<z.ZodString>;
|
|
358
|
+
}, "strip", z.ZodTypeAny, {
|
|
359
|
+
ref: string;
|
|
360
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
361
|
+
description?: string | undefined;
|
|
362
|
+
}, {
|
|
363
|
+
ref: string;
|
|
364
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
365
|
+
description?: string | undefined;
|
|
366
|
+
}>>;
|
|
367
|
+
response: z.ZodOptional<z.ZodObject<{
|
|
368
|
+
ref: z.ZodString;
|
|
369
|
+
format: z.ZodOptional<z.ZodEnum<["zod", "json-schema", "openapi"]>>;
|
|
370
|
+
description: z.ZodOptional<z.ZodString>;
|
|
371
|
+
}, "strip", z.ZodTypeAny, {
|
|
372
|
+
ref: string;
|
|
373
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
374
|
+
description?: string | undefined;
|
|
375
|
+
}, {
|
|
376
|
+
ref: string;
|
|
377
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
378
|
+
description?: string | undefined;
|
|
379
|
+
}>>;
|
|
380
|
+
produces: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
381
|
+
consumes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
382
|
+
}, "strip", z.ZodTypeAny, {
|
|
383
|
+
path: string;
|
|
384
|
+
id: string;
|
|
385
|
+
method: string;
|
|
386
|
+
description?: string | undefined;
|
|
387
|
+
request?: {
|
|
388
|
+
ref: string;
|
|
389
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
390
|
+
description?: string | undefined;
|
|
391
|
+
} | undefined;
|
|
392
|
+
response?: {
|
|
393
|
+
ref: string;
|
|
394
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
395
|
+
description?: string | undefined;
|
|
396
|
+
} | undefined;
|
|
397
|
+
produces?: string[] | undefined;
|
|
398
|
+
consumes?: string[] | undefined;
|
|
399
|
+
}, {
|
|
400
|
+
path: string;
|
|
401
|
+
id: string;
|
|
402
|
+
method: string;
|
|
403
|
+
description?: string | undefined;
|
|
404
|
+
request?: {
|
|
405
|
+
ref: string;
|
|
406
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
407
|
+
description?: string | undefined;
|
|
408
|
+
} | undefined;
|
|
409
|
+
response?: {
|
|
410
|
+
ref: string;
|
|
411
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
412
|
+
description?: string | undefined;
|
|
413
|
+
} | undefined;
|
|
414
|
+
produces?: string[] | undefined;
|
|
415
|
+
consumes?: string[] | undefined;
|
|
416
|
+
}>>;
|
|
417
|
+
}, "strip", z.ZodTypeAny, {
|
|
418
|
+
basePath: string;
|
|
419
|
+
routes: Record<string, {
|
|
420
|
+
path: string;
|
|
421
|
+
id: string;
|
|
422
|
+
method: string;
|
|
423
|
+
description?: string | undefined;
|
|
424
|
+
request?: {
|
|
425
|
+
ref: string;
|
|
426
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
427
|
+
description?: string | undefined;
|
|
428
|
+
} | undefined;
|
|
429
|
+
response?: {
|
|
430
|
+
ref: string;
|
|
431
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
432
|
+
description?: string | undefined;
|
|
433
|
+
} | undefined;
|
|
434
|
+
produces?: string[] | undefined;
|
|
435
|
+
consumes?: string[] | undefined;
|
|
436
|
+
}>;
|
|
437
|
+
}, {
|
|
438
|
+
basePath: string;
|
|
439
|
+
routes: Record<string, {
|
|
440
|
+
path: string;
|
|
441
|
+
id: string;
|
|
442
|
+
method: string;
|
|
443
|
+
description?: string | undefined;
|
|
444
|
+
request?: {
|
|
445
|
+
ref: string;
|
|
446
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
447
|
+
description?: string | undefined;
|
|
448
|
+
} | undefined;
|
|
449
|
+
response?: {
|
|
450
|
+
ref: string;
|
|
451
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
452
|
+
description?: string | undefined;
|
|
453
|
+
} | undefined;
|
|
454
|
+
produces?: string[] | undefined;
|
|
455
|
+
consumes?: string[] | undefined;
|
|
456
|
+
}>;
|
|
457
|
+
}>>;
|
|
458
|
+
}, "strip", z.ZodTypeAny, {
|
|
459
|
+
rest?: {
|
|
460
|
+
basePath: string;
|
|
461
|
+
routes: Record<string, {
|
|
462
|
+
path: string;
|
|
463
|
+
id: string;
|
|
464
|
+
method: string;
|
|
465
|
+
description?: string | undefined;
|
|
466
|
+
request?: {
|
|
467
|
+
ref: string;
|
|
468
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
469
|
+
description?: string | undefined;
|
|
470
|
+
} | undefined;
|
|
471
|
+
response?: {
|
|
472
|
+
ref: string;
|
|
473
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
474
|
+
description?: string | undefined;
|
|
475
|
+
} | undefined;
|
|
476
|
+
produces?: string[] | undefined;
|
|
477
|
+
consumes?: string[] | undefined;
|
|
478
|
+
}>;
|
|
479
|
+
} | undefined;
|
|
480
|
+
}, {
|
|
481
|
+
rest?: {
|
|
482
|
+
basePath: string;
|
|
483
|
+
routes: Record<string, {
|
|
484
|
+
path: string;
|
|
485
|
+
id: string;
|
|
486
|
+
method: string;
|
|
487
|
+
description?: string | undefined;
|
|
488
|
+
request?: {
|
|
489
|
+
ref: string;
|
|
490
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
491
|
+
description?: string | undefined;
|
|
492
|
+
} | undefined;
|
|
493
|
+
response?: {
|
|
494
|
+
ref: string;
|
|
495
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
496
|
+
description?: string | undefined;
|
|
497
|
+
} | undefined;
|
|
498
|
+
produces?: string[] | undefined;
|
|
499
|
+
consumes?: string[] | undefined;
|
|
500
|
+
}>;
|
|
501
|
+
} | undefined;
|
|
502
|
+
}>>;
|
|
503
|
+
}, "strict", z.ZodTypeAny, {
|
|
504
|
+
schema: "kb.plugin.contracts/1";
|
|
505
|
+
pluginId: string;
|
|
506
|
+
contractsVersion: string;
|
|
507
|
+
artifacts: Record<string, {
|
|
508
|
+
id: string;
|
|
509
|
+
kind: "file" | "json" | "markdown" | "binary" | "dir" | "log";
|
|
510
|
+
description?: string | undefined;
|
|
511
|
+
pathPattern?: string | undefined;
|
|
512
|
+
mediaType?: string | undefined;
|
|
513
|
+
schemaRef?: string | undefined;
|
|
514
|
+
example?: {
|
|
515
|
+
summary?: string | undefined;
|
|
516
|
+
payload?: unknown;
|
|
517
|
+
} | undefined;
|
|
518
|
+
}>;
|
|
519
|
+
commands?: Record<string, {
|
|
520
|
+
id: string;
|
|
521
|
+
description?: string | undefined;
|
|
522
|
+
produces?: string[] | undefined;
|
|
523
|
+
consumes?: string[] | undefined;
|
|
524
|
+
input?: {
|
|
525
|
+
ref: string;
|
|
526
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
527
|
+
description?: string | undefined;
|
|
528
|
+
} | undefined;
|
|
529
|
+
output?: {
|
|
530
|
+
ref: string;
|
|
531
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
532
|
+
description?: string | undefined;
|
|
533
|
+
} | undefined;
|
|
534
|
+
examples?: string[] | undefined;
|
|
535
|
+
}> | undefined;
|
|
536
|
+
workflows?: Record<string, {
|
|
537
|
+
id: string;
|
|
538
|
+
description?: string | undefined;
|
|
539
|
+
produces?: string[] | undefined;
|
|
540
|
+
consumes?: string[] | undefined;
|
|
541
|
+
steps?: {
|
|
542
|
+
id: string;
|
|
543
|
+
description?: string | undefined;
|
|
544
|
+
produces?: string[] | undefined;
|
|
545
|
+
consumes?: string[] | undefined;
|
|
546
|
+
commandId?: string | undefined;
|
|
547
|
+
}[] | undefined;
|
|
548
|
+
}> | undefined;
|
|
549
|
+
api?: {
|
|
550
|
+
rest?: {
|
|
551
|
+
basePath: string;
|
|
552
|
+
routes: Record<string, {
|
|
553
|
+
path: string;
|
|
554
|
+
id: string;
|
|
555
|
+
method: string;
|
|
556
|
+
description?: string | undefined;
|
|
557
|
+
request?: {
|
|
558
|
+
ref: string;
|
|
559
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
560
|
+
description?: string | undefined;
|
|
561
|
+
} | undefined;
|
|
562
|
+
response?: {
|
|
563
|
+
ref: string;
|
|
564
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
565
|
+
description?: string | undefined;
|
|
566
|
+
} | undefined;
|
|
567
|
+
produces?: string[] | undefined;
|
|
568
|
+
consumes?: string[] | undefined;
|
|
569
|
+
}>;
|
|
570
|
+
} | undefined;
|
|
571
|
+
} | undefined;
|
|
572
|
+
}, {
|
|
573
|
+
schema: "kb.plugin.contracts/1";
|
|
574
|
+
pluginId: string;
|
|
575
|
+
contractsVersion: string;
|
|
576
|
+
artifacts: Record<string, {
|
|
577
|
+
id: string;
|
|
578
|
+
kind: "file" | "json" | "markdown" | "binary" | "dir" | "log";
|
|
579
|
+
description?: string | undefined;
|
|
580
|
+
pathPattern?: string | undefined;
|
|
581
|
+
mediaType?: string | undefined;
|
|
582
|
+
schemaRef?: string | undefined;
|
|
583
|
+
example?: {
|
|
584
|
+
summary?: string | undefined;
|
|
585
|
+
payload?: unknown;
|
|
586
|
+
} | undefined;
|
|
587
|
+
}>;
|
|
588
|
+
commands?: Record<string, {
|
|
589
|
+
id: string;
|
|
590
|
+
description?: string | undefined;
|
|
591
|
+
produces?: string[] | undefined;
|
|
592
|
+
consumes?: string[] | undefined;
|
|
593
|
+
input?: {
|
|
594
|
+
ref: string;
|
|
595
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
596
|
+
description?: string | undefined;
|
|
597
|
+
} | undefined;
|
|
598
|
+
output?: {
|
|
599
|
+
ref: string;
|
|
600
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
601
|
+
description?: string | undefined;
|
|
602
|
+
} | undefined;
|
|
603
|
+
examples?: string[] | undefined;
|
|
604
|
+
}> | undefined;
|
|
605
|
+
workflows?: Record<string, {
|
|
606
|
+
id: string;
|
|
607
|
+
description?: string | undefined;
|
|
608
|
+
produces?: string[] | undefined;
|
|
609
|
+
consumes?: string[] | undefined;
|
|
610
|
+
steps?: {
|
|
611
|
+
id: string;
|
|
612
|
+
description?: string | undefined;
|
|
613
|
+
produces?: string[] | undefined;
|
|
614
|
+
consumes?: string[] | undefined;
|
|
615
|
+
commandId?: string | undefined;
|
|
616
|
+
}[] | undefined;
|
|
617
|
+
}> | undefined;
|
|
618
|
+
api?: {
|
|
619
|
+
rest?: {
|
|
620
|
+
basePath: string;
|
|
621
|
+
routes: Record<string, {
|
|
622
|
+
path: string;
|
|
623
|
+
id: string;
|
|
624
|
+
method: string;
|
|
625
|
+
description?: string | undefined;
|
|
626
|
+
request?: {
|
|
627
|
+
ref: string;
|
|
628
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
629
|
+
description?: string | undefined;
|
|
630
|
+
} | undefined;
|
|
631
|
+
response?: {
|
|
632
|
+
ref: string;
|
|
633
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
634
|
+
description?: string | undefined;
|
|
635
|
+
} | undefined;
|
|
636
|
+
produces?: string[] | undefined;
|
|
637
|
+
consumes?: string[] | undefined;
|
|
638
|
+
}>;
|
|
639
|
+
} | undefined;
|
|
640
|
+
} | undefined;
|
|
641
|
+
}>;
|
|
642
|
+
declare function parsePluginContracts(input: unknown): {
|
|
643
|
+
schema: "kb.plugin.contracts/1";
|
|
644
|
+
pluginId: string;
|
|
645
|
+
contractsVersion: string;
|
|
646
|
+
artifacts: Record<string, {
|
|
647
|
+
id: string;
|
|
648
|
+
kind: "file" | "json" | "markdown" | "binary" | "dir" | "log";
|
|
649
|
+
description?: string | undefined;
|
|
650
|
+
pathPattern?: string | undefined;
|
|
651
|
+
mediaType?: string | undefined;
|
|
652
|
+
schemaRef?: string | undefined;
|
|
653
|
+
example?: {
|
|
654
|
+
summary?: string | undefined;
|
|
655
|
+
payload?: unknown;
|
|
656
|
+
} | undefined;
|
|
657
|
+
}>;
|
|
658
|
+
commands?: Record<string, {
|
|
659
|
+
id: string;
|
|
660
|
+
description?: string | undefined;
|
|
661
|
+
produces?: string[] | undefined;
|
|
662
|
+
consumes?: string[] | undefined;
|
|
663
|
+
input?: {
|
|
664
|
+
ref: string;
|
|
665
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
666
|
+
description?: string | undefined;
|
|
667
|
+
} | undefined;
|
|
668
|
+
output?: {
|
|
669
|
+
ref: string;
|
|
670
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
671
|
+
description?: string | undefined;
|
|
672
|
+
} | undefined;
|
|
673
|
+
examples?: string[] | undefined;
|
|
674
|
+
}> | undefined;
|
|
675
|
+
workflows?: Record<string, {
|
|
676
|
+
id: string;
|
|
677
|
+
description?: string | undefined;
|
|
678
|
+
produces?: string[] | undefined;
|
|
679
|
+
consumes?: string[] | undefined;
|
|
680
|
+
steps?: {
|
|
681
|
+
id: string;
|
|
682
|
+
description?: string | undefined;
|
|
683
|
+
produces?: string[] | undefined;
|
|
684
|
+
consumes?: string[] | undefined;
|
|
685
|
+
commandId?: string | undefined;
|
|
686
|
+
}[] | undefined;
|
|
687
|
+
}> | undefined;
|
|
688
|
+
api?: {
|
|
689
|
+
rest?: {
|
|
690
|
+
basePath: string;
|
|
691
|
+
routes: Record<string, {
|
|
692
|
+
path: string;
|
|
693
|
+
id: string;
|
|
694
|
+
method: string;
|
|
695
|
+
description?: string | undefined;
|
|
696
|
+
request?: {
|
|
697
|
+
ref: string;
|
|
698
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
699
|
+
description?: string | undefined;
|
|
700
|
+
} | undefined;
|
|
701
|
+
response?: {
|
|
702
|
+
ref: string;
|
|
703
|
+
format?: "zod" | "json-schema" | "openapi" | undefined;
|
|
704
|
+
description?: string | undefined;
|
|
705
|
+
} | undefined;
|
|
706
|
+
produces?: string[] | undefined;
|
|
707
|
+
consumes?: string[] | undefined;
|
|
708
|
+
}>;
|
|
709
|
+
} | undefined;
|
|
710
|
+
} | undefined;
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
declare const contractsSchemaId: "kb.plugin.contracts/1";
|
|
714
|
+
type ContractsSchemaId = typeof contractsSchemaId;
|
|
715
|
+
declare const contractsVersion: "1.0.0";
|
|
716
|
+
|
|
717
|
+
type SchemaFormat = "zod" | "json-schema" | "openapi";
|
|
718
|
+
interface SchemaReference {
|
|
719
|
+
/**
|
|
720
|
+
* Reference to the schema. Can be a URI, npm package export, or local module path.
|
|
721
|
+
*/
|
|
722
|
+
ref: string;
|
|
723
|
+
/**
|
|
724
|
+
* Describes the format of the referenced schema.
|
|
725
|
+
*/
|
|
726
|
+
format?: SchemaFormat;
|
|
727
|
+
description?: string;
|
|
728
|
+
}
|
|
729
|
+
interface RestRouteContract {
|
|
730
|
+
id: string;
|
|
731
|
+
method: string;
|
|
732
|
+
path: string;
|
|
733
|
+
description?: string;
|
|
734
|
+
request?: SchemaReference;
|
|
735
|
+
response?: SchemaReference;
|
|
736
|
+
produces?: string[];
|
|
737
|
+
consumes?: string[];
|
|
738
|
+
}
|
|
739
|
+
interface RestApiContract {
|
|
740
|
+
basePath: string;
|
|
741
|
+
routes: Record<string, RestRouteContract>;
|
|
742
|
+
}
|
|
743
|
+
interface ApiContract {
|
|
744
|
+
rest?: RestApiContract;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
type ArtifactKind = "file" | "json" | "markdown" | "binary" | "dir" | "log";
|
|
748
|
+
interface ArtifactExample {
|
|
749
|
+
summary?: string;
|
|
750
|
+
payload?: unknown;
|
|
751
|
+
}
|
|
752
|
+
interface PluginArtifactContract {
|
|
753
|
+
id: string;
|
|
754
|
+
kind: ArtifactKind;
|
|
755
|
+
description?: string;
|
|
756
|
+
/**
|
|
757
|
+
* Relative path or glob pattern describing where the artifact is materialised.
|
|
758
|
+
* Example: "artifacts/template/hello/greeting.json"
|
|
759
|
+
*/
|
|
760
|
+
pathPattern?: string;
|
|
761
|
+
/**
|
|
762
|
+
* IANA media type describing the artifact. Example: "application/json".
|
|
763
|
+
*/
|
|
764
|
+
mediaType?: string;
|
|
765
|
+
/**
|
|
766
|
+
* Reference to a schema describing the artifact payload. Can be a URI or package export.
|
|
767
|
+
*/
|
|
768
|
+
schemaRef?: string;
|
|
769
|
+
/**
|
|
770
|
+
* Optional example payload to help documentation and tooling.
|
|
771
|
+
*/
|
|
772
|
+
example?: ArtifactExample;
|
|
773
|
+
}
|
|
774
|
+
type ArtifactContractsMap = Record<string, PluginArtifactContract>;
|
|
775
|
+
|
|
776
|
+
interface CommandContract {
|
|
777
|
+
id: string;
|
|
778
|
+
description?: string;
|
|
779
|
+
input?: SchemaReference;
|
|
780
|
+
output?: SchemaReference;
|
|
781
|
+
produces?: string[];
|
|
782
|
+
consumes?: string[];
|
|
783
|
+
examples?: string[];
|
|
784
|
+
}
|
|
785
|
+
type CommandContractsMap = Record<string, CommandContract>;
|
|
786
|
+
|
|
787
|
+
interface WorkflowStepContract {
|
|
788
|
+
id: string;
|
|
789
|
+
description?: string;
|
|
790
|
+
commandId?: string;
|
|
791
|
+
consumes?: string[];
|
|
792
|
+
produces?: string[];
|
|
793
|
+
}
|
|
794
|
+
interface WorkflowContract {
|
|
795
|
+
id: string;
|
|
796
|
+
description?: string;
|
|
797
|
+
consumes?: string[];
|
|
798
|
+
produces?: string[];
|
|
799
|
+
steps?: WorkflowStepContract[];
|
|
800
|
+
}
|
|
801
|
+
type WorkflowContractsMap = Record<string, WorkflowContract>;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Plugin Configuration Contract
|
|
805
|
+
*
|
|
806
|
+
* Defines the shape of plugin configuration stored in kb.config.json
|
|
807
|
+
* under plugins.commit section.
|
|
808
|
+
*
|
|
809
|
+
* This type is the single source of truth for:
|
|
810
|
+
* - defineSetup (setup handler knows what config to create)
|
|
811
|
+
* - defineCommand (commands can access typed config)
|
|
812
|
+
*/
|
|
813
|
+
/**
|
|
814
|
+
* LLM configuration for commit generation
|
|
815
|
+
*/
|
|
816
|
+
interface LLMConfig {
|
|
817
|
+
/** Whether to use LLM for commit generation (default: true) */
|
|
818
|
+
enabled: boolean;
|
|
819
|
+
/** Temperature for LLM responses (0-1, default: 0.3) */
|
|
820
|
+
temperature: number;
|
|
821
|
+
/** Maximum tokens for LLM response (default: 2000) */
|
|
822
|
+
maxTokens: number;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Storage configuration
|
|
826
|
+
*/
|
|
827
|
+
interface StorageConfig {
|
|
828
|
+
/** Directory for commit plugin data (default: .kb/commit) */
|
|
829
|
+
directory: string;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Git configuration
|
|
833
|
+
*/
|
|
834
|
+
interface GitConfig {
|
|
835
|
+
/** Protected branches that require confirmation (default: ['main', 'master']) */
|
|
836
|
+
protectedBranches: string[];
|
|
837
|
+
/** Whether to auto-stage all changes before commit (default: false) */
|
|
838
|
+
autoStage: boolean;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* A single commit scope definition
|
|
842
|
+
*/
|
|
843
|
+
interface CommitScope {
|
|
844
|
+
/** Scope identifier — used as value in selector and in API requests */
|
|
845
|
+
id: string;
|
|
846
|
+
/** Display label shown in Studio UI */
|
|
847
|
+
label: string;
|
|
848
|
+
/**
|
|
849
|
+
* Relative path from workspace root to the target git repository.
|
|
850
|
+
* Use "." for the workspace root itself.
|
|
851
|
+
* @example "."
|
|
852
|
+
* @example "public/kb-labs"
|
|
853
|
+
* @example "plugins/kb-labs-mind"
|
|
854
|
+
*/
|
|
855
|
+
path: string;
|
|
856
|
+
/** Optional description shown in Studio selector */
|
|
857
|
+
description?: string;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Scope configuration
|
|
861
|
+
*/
|
|
862
|
+
interface ScopeConfig {
|
|
863
|
+
/** Default scope id to pre-select in Studio and use when not specified via CLI */
|
|
864
|
+
default?: string;
|
|
865
|
+
/**
|
|
866
|
+
* Explicit list of available scopes.
|
|
867
|
+
* If not provided, falls back to a single "root" scope (workspace root).
|
|
868
|
+
*
|
|
869
|
+
* @example
|
|
870
|
+
* ```json
|
|
871
|
+
* "scopes": [
|
|
872
|
+
* { "id": "root", "label": "workspace root", "path": "." },
|
|
873
|
+
* { "id": "public/kb-labs", "label": "kb-labs (public)", "path": "public/kb-labs" }
|
|
874
|
+
* ]
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
|
+
scopes?: CommitScope[];
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Plugin configuration stored in kb.config.json
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* ```json
|
|
884
|
+
* {
|
|
885
|
+
* "plugins": {
|
|
886
|
+
* "commit": {
|
|
887
|
+
* "enabled": true,
|
|
888
|
+
* "llm": {
|
|
889
|
+
* "enabled": true,
|
|
890
|
+
* "temperature": 0.3,
|
|
891
|
+
* "maxTokens": 2000
|
|
892
|
+
* },
|
|
893
|
+
* "storage": {
|
|
894
|
+
* "directory": ".kb/commit"
|
|
895
|
+
* },
|
|
896
|
+
* "git": {
|
|
897
|
+
* "protectedBranches": ["main", "master"],
|
|
898
|
+
* "autoStage": false
|
|
899
|
+
* },
|
|
900
|
+
* "scope": {
|
|
901
|
+
* "default": "kb-labs-commit-plugin"
|
|
902
|
+
* }
|
|
903
|
+
* }
|
|
904
|
+
* }
|
|
905
|
+
* }
|
|
906
|
+
* ```
|
|
907
|
+
*/
|
|
908
|
+
interface CommitPluginConfig {
|
|
909
|
+
/** Whether the plugin is enabled */
|
|
910
|
+
enabled: boolean;
|
|
911
|
+
/** LLM configuration */
|
|
912
|
+
llm: LLMConfig;
|
|
913
|
+
/** Storage configuration */
|
|
914
|
+
storage: StorageConfig;
|
|
915
|
+
/** Git configuration */
|
|
916
|
+
git: GitConfig;
|
|
917
|
+
/** Scope configuration */
|
|
918
|
+
scope?: ScopeConfig;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Environment variables supported by commit plugin
|
|
922
|
+
* Must be declared in manifest.permissions.env.allow
|
|
923
|
+
*/
|
|
924
|
+
declare const COMMIT_ENV_VARS: readonly ["KB_COMMIT_LLM_ENABLED", "KB_COMMIT_LLM_TEMPERATURE", "KB_COMMIT_LLM_MAX_TOKENS", "KB_COMMIT_STORAGE_DIR", "KB_COMMIT_AUTO_STAGE"];
|
|
925
|
+
type CommitEnvVar = (typeof COMMIT_ENV_VARS)[number];
|
|
926
|
+
/**
|
|
927
|
+
* Default plugin configuration values
|
|
928
|
+
*/
|
|
929
|
+
declare const defaultCommitConfig: CommitPluginConfig;
|
|
930
|
+
/**
|
|
931
|
+
* Resolve config with env variable overrides
|
|
932
|
+
*
|
|
933
|
+
* @param fileConfig - Config from kb.config.json (via useConfig)
|
|
934
|
+
* @param env - Environment variables (from commitEnv.parse(runtime))
|
|
935
|
+
*/
|
|
936
|
+
declare function resolveCommitConfig(fileConfig?: Partial<CommitPluginConfig>, env?: Partial<{
|
|
937
|
+
KB_COMMIT_LLM_ENABLED: boolean;
|
|
938
|
+
KB_COMMIT_LLM_TEMPERATURE: number;
|
|
939
|
+
KB_COMMIT_LLM_MAX_TOKENS: number;
|
|
940
|
+
KB_COMMIT_STORAGE_DIR: string;
|
|
941
|
+
KB_COMMIT_AUTO_STAGE: boolean;
|
|
942
|
+
}>): CommitPluginConfig;
|
|
943
|
+
|
|
944
|
+
interface PluginContracts {
|
|
945
|
+
schema: ContractsSchemaId;
|
|
946
|
+
pluginId: string;
|
|
947
|
+
contractsVersion: string;
|
|
948
|
+
artifacts: ArtifactContractsMap;
|
|
949
|
+
commands?: CommandContractsMap;
|
|
950
|
+
workflows?: WorkflowContractsMap;
|
|
951
|
+
api?: ApiContract;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Single scope entry
|
|
956
|
+
*/
|
|
957
|
+
declare const ScopeSchema: z.ZodObject<{
|
|
958
|
+
id: z.ZodString;
|
|
959
|
+
name: z.ZodString;
|
|
960
|
+
path: z.ZodString;
|
|
961
|
+
description: z.ZodOptional<z.ZodString>;
|
|
962
|
+
}, "strip", z.ZodTypeAny, {
|
|
963
|
+
path: string;
|
|
964
|
+
id: string;
|
|
965
|
+
name: string;
|
|
966
|
+
description?: string | undefined;
|
|
967
|
+
}, {
|
|
968
|
+
path: string;
|
|
969
|
+
id: string;
|
|
970
|
+
name: string;
|
|
971
|
+
description?: string | undefined;
|
|
972
|
+
}>;
|
|
973
|
+
type Scope = z.infer<typeof ScopeSchema>;
|
|
974
|
+
/**
|
|
975
|
+
* GET /scopes response
|
|
976
|
+
*/
|
|
977
|
+
declare const ScopesResponseSchema: z.ZodObject<{
|
|
978
|
+
scopes: z.ZodArray<z.ZodObject<{
|
|
979
|
+
id: z.ZodString;
|
|
980
|
+
name: z.ZodString;
|
|
981
|
+
path: z.ZodString;
|
|
982
|
+
description: z.ZodOptional<z.ZodString>;
|
|
983
|
+
}, "strip", z.ZodTypeAny, {
|
|
984
|
+
path: string;
|
|
985
|
+
id: string;
|
|
986
|
+
name: string;
|
|
987
|
+
description?: string | undefined;
|
|
988
|
+
}, {
|
|
989
|
+
path: string;
|
|
990
|
+
id: string;
|
|
991
|
+
name: string;
|
|
992
|
+
description?: string | undefined;
|
|
993
|
+
}>, "many">;
|
|
994
|
+
}, "strip", z.ZodTypeAny, {
|
|
995
|
+
scopes: {
|
|
996
|
+
path: string;
|
|
997
|
+
id: string;
|
|
998
|
+
name: string;
|
|
999
|
+
description?: string | undefined;
|
|
1000
|
+
}[];
|
|
1001
|
+
}, {
|
|
1002
|
+
scopes: {
|
|
1003
|
+
path: string;
|
|
1004
|
+
id: string;
|
|
1005
|
+
name: string;
|
|
1006
|
+
description?: string | undefined;
|
|
1007
|
+
}[];
|
|
1008
|
+
}>;
|
|
1009
|
+
type ScopesResponse = z.infer<typeof ScopesResponseSchema>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Plan status lifecycle
|
|
1012
|
+
* - idle: No plan exists, need to generate
|
|
1013
|
+
* - ready: Plan generated, ready to apply
|
|
1014
|
+
* - applied: Plan applied as commits, ready to push
|
|
1015
|
+
* - pushed: Commits pushed to remote
|
|
1016
|
+
*/
|
|
1017
|
+
declare const PlanStatusSchema: z.ZodEnum<["idle", "ready", "applied", "pushed"]>;
|
|
1018
|
+
type PlanStatus = z.infer<typeof PlanStatusSchema>;
|
|
1019
|
+
/**
|
|
1020
|
+
* GET /status?scope=X response
|
|
1021
|
+
*/
|
|
1022
|
+
declare const StatusResponseSchema: z.ZodObject<{
|
|
1023
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1024
|
+
hasPlan: z.ZodBoolean;
|
|
1025
|
+
planStatus: z.ZodDefault<z.ZodEnum<["idle", "ready", "applied", "pushed"]>>;
|
|
1026
|
+
planTimestamp: z.ZodOptional<z.ZodString>;
|
|
1027
|
+
gitStatus: z.ZodOptional<z.ZodObject<{
|
|
1028
|
+
staged: z.ZodArray<z.ZodString, "many">;
|
|
1029
|
+
unstaged: z.ZodArray<z.ZodString, "many">;
|
|
1030
|
+
untracked: z.ZodArray<z.ZodString, "many">;
|
|
1031
|
+
}, "strip", z.ZodTypeAny, {
|
|
1032
|
+
staged: string[];
|
|
1033
|
+
unstaged: string[];
|
|
1034
|
+
untracked: string[];
|
|
1035
|
+
}, {
|
|
1036
|
+
staged: string[];
|
|
1037
|
+
unstaged: string[];
|
|
1038
|
+
untracked: string[];
|
|
1039
|
+
}>>;
|
|
1040
|
+
filesChanged: z.ZodDefault<z.ZodNumber>;
|
|
1041
|
+
commitsInPlan: z.ZodDefault<z.ZodNumber>;
|
|
1042
|
+
commitsApplied: z.ZodDefault<z.ZodNumber>;
|
|
1043
|
+
}, "strip", z.ZodTypeAny, {
|
|
1044
|
+
scope: string;
|
|
1045
|
+
hasPlan: boolean;
|
|
1046
|
+
planStatus: "applied" | "pushed" | "idle" | "ready";
|
|
1047
|
+
filesChanged: number;
|
|
1048
|
+
commitsInPlan: number;
|
|
1049
|
+
commitsApplied: number;
|
|
1050
|
+
gitStatus?: {
|
|
1051
|
+
staged: string[];
|
|
1052
|
+
unstaged: string[];
|
|
1053
|
+
untracked: string[];
|
|
1054
|
+
} | undefined;
|
|
1055
|
+
planTimestamp?: string | undefined;
|
|
1056
|
+
}, {
|
|
1057
|
+
hasPlan: boolean;
|
|
1058
|
+
scope?: string | undefined;
|
|
1059
|
+
gitStatus?: {
|
|
1060
|
+
staged: string[];
|
|
1061
|
+
unstaged: string[];
|
|
1062
|
+
untracked: string[];
|
|
1063
|
+
} | undefined;
|
|
1064
|
+
planStatus?: "applied" | "pushed" | "idle" | "ready" | undefined;
|
|
1065
|
+
planTimestamp?: string | undefined;
|
|
1066
|
+
filesChanged?: number | undefined;
|
|
1067
|
+
commitsInPlan?: number | undefined;
|
|
1068
|
+
commitsApplied?: number | undefined;
|
|
1069
|
+
}>;
|
|
1070
|
+
type StatusResponse = z.infer<typeof StatusResponseSchema>;
|
|
1071
|
+
/**
|
|
1072
|
+
* POST /generate request body
|
|
1073
|
+
*/
|
|
1074
|
+
declare const GenerateRequestSchema: z.ZodObject<{
|
|
1075
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1076
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
1077
|
+
allowSecrets: z.ZodDefault<z.ZodBoolean>;
|
|
1078
|
+
autoConfirm: z.ZodDefault<z.ZodBoolean>;
|
|
1079
|
+
}, "strip", z.ZodTypeAny, {
|
|
1080
|
+
scope: string;
|
|
1081
|
+
dryRun: boolean;
|
|
1082
|
+
allowSecrets: boolean;
|
|
1083
|
+
autoConfirm: boolean;
|
|
1084
|
+
}, {
|
|
1085
|
+
scope?: string | undefined;
|
|
1086
|
+
dryRun?: boolean | undefined;
|
|
1087
|
+
allowSecrets?: boolean | undefined;
|
|
1088
|
+
autoConfirm?: boolean | undefined;
|
|
1089
|
+
}>;
|
|
1090
|
+
type GenerateRequest = z.infer<typeof GenerateRequestSchema>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Secret match location
|
|
1093
|
+
*/
|
|
1094
|
+
declare const SecretMatchSchema: z.ZodObject<{
|
|
1095
|
+
file: z.ZodString;
|
|
1096
|
+
line: z.ZodNumber;
|
|
1097
|
+
column: z.ZodNumber;
|
|
1098
|
+
type: z.ZodString;
|
|
1099
|
+
pattern: z.ZodString;
|
|
1100
|
+
matched: z.ZodString;
|
|
1101
|
+
context: z.ZodString;
|
|
1102
|
+
}, "strip", z.ZodTypeAny, {
|
|
1103
|
+
file: string;
|
|
1104
|
+
type: string;
|
|
1105
|
+
line: number;
|
|
1106
|
+
column: number;
|
|
1107
|
+
pattern: string;
|
|
1108
|
+
matched: string;
|
|
1109
|
+
context: string;
|
|
1110
|
+
}, {
|
|
1111
|
+
file: string;
|
|
1112
|
+
type: string;
|
|
1113
|
+
line: number;
|
|
1114
|
+
column: number;
|
|
1115
|
+
pattern: string;
|
|
1116
|
+
matched: string;
|
|
1117
|
+
context: string;
|
|
1118
|
+
}>;
|
|
1119
|
+
type SecretMatch = z.infer<typeof SecretMatchSchema>;
|
|
1120
|
+
/**
|
|
1121
|
+
* POST /generate response
|
|
1122
|
+
*/
|
|
1123
|
+
declare const GenerateResponseSchema: z.ZodObject<{
|
|
1124
|
+
success: z.ZodBoolean;
|
|
1125
|
+
plan: z.ZodOptional<z.ZodObject<{
|
|
1126
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
1127
|
+
createdAt: z.ZodString;
|
|
1128
|
+
repoRoot: z.ZodString;
|
|
1129
|
+
gitStatus: z.ZodObject<{
|
|
1130
|
+
staged: z.ZodArray<z.ZodString, "many">;
|
|
1131
|
+
unstaged: z.ZodArray<z.ZodString, "many">;
|
|
1132
|
+
untracked: z.ZodArray<z.ZodString, "many">;
|
|
1133
|
+
}, "strip", z.ZodTypeAny, {
|
|
1134
|
+
staged: string[];
|
|
1135
|
+
unstaged: string[];
|
|
1136
|
+
untracked: string[];
|
|
1137
|
+
}, {
|
|
1138
|
+
staged: string[];
|
|
1139
|
+
unstaged: string[];
|
|
1140
|
+
untracked: string[];
|
|
1141
|
+
}>;
|
|
1142
|
+
commits: z.ZodArray<z.ZodObject<{
|
|
1143
|
+
id: z.ZodString;
|
|
1144
|
+
type: z.ZodEnum<["feat", "fix", "refactor", "chore", "docs", "test", "build", "ci", "perf"]>;
|
|
1145
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
1146
|
+
message: z.ZodString;
|
|
1147
|
+
body: z.ZodOptional<z.ZodString>;
|
|
1148
|
+
files: z.ZodArray<z.ZodString, "many">;
|
|
1149
|
+
releaseHint: z.ZodDefault<z.ZodEnum<["none", "patch", "minor", "major"]>>;
|
|
1150
|
+
breaking: z.ZodDefault<z.ZodBoolean>;
|
|
1151
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
1152
|
+
newBehavior: z.ZodDefault<z.ZodBoolean>;
|
|
1153
|
+
fixesBug: z.ZodDefault<z.ZodBoolean>;
|
|
1154
|
+
internalOnly: z.ZodDefault<z.ZodBoolean>;
|
|
1155
|
+
explanation: z.ZodDefault<z.ZodString>;
|
|
1156
|
+
confidence: z.ZodDefault<z.ZodNumber>;
|
|
1157
|
+
}, "strip", z.ZodTypeAny, {
|
|
1158
|
+
newBehavior: boolean;
|
|
1159
|
+
fixesBug: boolean;
|
|
1160
|
+
internalOnly: boolean;
|
|
1161
|
+
explanation: string;
|
|
1162
|
+
confidence: number;
|
|
1163
|
+
}, {
|
|
1164
|
+
newBehavior?: boolean | undefined;
|
|
1165
|
+
fixesBug?: boolean | undefined;
|
|
1166
|
+
internalOnly?: boolean | undefined;
|
|
1167
|
+
explanation?: string | undefined;
|
|
1168
|
+
confidence?: number | undefined;
|
|
1169
|
+
}>>;
|
|
1170
|
+
}, "strip", z.ZodTypeAny, {
|
|
1171
|
+
message: string;
|
|
1172
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1173
|
+
id: string;
|
|
1174
|
+
files: string[];
|
|
1175
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1176
|
+
breaking: boolean;
|
|
1177
|
+
scope?: string | undefined;
|
|
1178
|
+
body?: string | undefined;
|
|
1179
|
+
reasoning?: {
|
|
1180
|
+
newBehavior: boolean;
|
|
1181
|
+
fixesBug: boolean;
|
|
1182
|
+
internalOnly: boolean;
|
|
1183
|
+
explanation: string;
|
|
1184
|
+
confidence: number;
|
|
1185
|
+
} | undefined;
|
|
1186
|
+
}, {
|
|
1187
|
+
message: string;
|
|
1188
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1189
|
+
id: string;
|
|
1190
|
+
files: string[];
|
|
1191
|
+
scope?: string | undefined;
|
|
1192
|
+
body?: string | undefined;
|
|
1193
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1194
|
+
breaking?: boolean | undefined;
|
|
1195
|
+
reasoning?: {
|
|
1196
|
+
newBehavior?: boolean | undefined;
|
|
1197
|
+
fixesBug?: boolean | undefined;
|
|
1198
|
+
internalOnly?: boolean | undefined;
|
|
1199
|
+
explanation?: string | undefined;
|
|
1200
|
+
confidence?: number | undefined;
|
|
1201
|
+
} | undefined;
|
|
1202
|
+
}>, "many">;
|
|
1203
|
+
metadata: z.ZodObject<{
|
|
1204
|
+
totalFiles: z.ZodNumber;
|
|
1205
|
+
totalCommits: z.ZodNumber;
|
|
1206
|
+
llmUsed: z.ZodBoolean;
|
|
1207
|
+
tokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
1208
|
+
escalated: z.ZodOptional<z.ZodBoolean>;
|
|
1209
|
+
}, "strip", z.ZodTypeAny, {
|
|
1210
|
+
totalFiles: number;
|
|
1211
|
+
totalCommits: number;
|
|
1212
|
+
llmUsed: boolean;
|
|
1213
|
+
tokensUsed?: number | undefined;
|
|
1214
|
+
escalated?: boolean | undefined;
|
|
1215
|
+
}, {
|
|
1216
|
+
totalFiles: number;
|
|
1217
|
+
totalCommits: number;
|
|
1218
|
+
llmUsed: boolean;
|
|
1219
|
+
tokensUsed?: number | undefined;
|
|
1220
|
+
escalated?: boolean | undefined;
|
|
1221
|
+
}>;
|
|
1222
|
+
}, "strip", z.ZodTypeAny, {
|
|
1223
|
+
schemaVersion: "1.0";
|
|
1224
|
+
createdAt: string;
|
|
1225
|
+
repoRoot: string;
|
|
1226
|
+
gitStatus: {
|
|
1227
|
+
staged: string[];
|
|
1228
|
+
unstaged: string[];
|
|
1229
|
+
untracked: string[];
|
|
1230
|
+
};
|
|
1231
|
+
commits: {
|
|
1232
|
+
message: string;
|
|
1233
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1234
|
+
id: string;
|
|
1235
|
+
files: string[];
|
|
1236
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1237
|
+
breaking: boolean;
|
|
1238
|
+
scope?: string | undefined;
|
|
1239
|
+
body?: string | undefined;
|
|
1240
|
+
reasoning?: {
|
|
1241
|
+
newBehavior: boolean;
|
|
1242
|
+
fixesBug: boolean;
|
|
1243
|
+
internalOnly: boolean;
|
|
1244
|
+
explanation: string;
|
|
1245
|
+
confidence: number;
|
|
1246
|
+
} | undefined;
|
|
1247
|
+
}[];
|
|
1248
|
+
metadata: {
|
|
1249
|
+
totalFiles: number;
|
|
1250
|
+
totalCommits: number;
|
|
1251
|
+
llmUsed: boolean;
|
|
1252
|
+
tokensUsed?: number | undefined;
|
|
1253
|
+
escalated?: boolean | undefined;
|
|
1254
|
+
};
|
|
1255
|
+
}, {
|
|
1256
|
+
schemaVersion: "1.0";
|
|
1257
|
+
createdAt: string;
|
|
1258
|
+
repoRoot: string;
|
|
1259
|
+
gitStatus: {
|
|
1260
|
+
staged: string[];
|
|
1261
|
+
unstaged: string[];
|
|
1262
|
+
untracked: string[];
|
|
1263
|
+
};
|
|
1264
|
+
commits: {
|
|
1265
|
+
message: string;
|
|
1266
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1267
|
+
id: string;
|
|
1268
|
+
files: string[];
|
|
1269
|
+
scope?: string | undefined;
|
|
1270
|
+
body?: string | undefined;
|
|
1271
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1272
|
+
breaking?: boolean | undefined;
|
|
1273
|
+
reasoning?: {
|
|
1274
|
+
newBehavior?: boolean | undefined;
|
|
1275
|
+
fixesBug?: boolean | undefined;
|
|
1276
|
+
internalOnly?: boolean | undefined;
|
|
1277
|
+
explanation?: string | undefined;
|
|
1278
|
+
confidence?: number | undefined;
|
|
1279
|
+
} | undefined;
|
|
1280
|
+
}[];
|
|
1281
|
+
metadata: {
|
|
1282
|
+
totalFiles: number;
|
|
1283
|
+
totalCommits: number;
|
|
1284
|
+
llmUsed: boolean;
|
|
1285
|
+
tokensUsed?: number | undefined;
|
|
1286
|
+
escalated?: boolean | undefined;
|
|
1287
|
+
};
|
|
1288
|
+
}>>;
|
|
1289
|
+
planPath: z.ZodOptional<z.ZodString>;
|
|
1290
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1291
|
+
secretsDetected: z.ZodDefault<z.ZodBoolean>;
|
|
1292
|
+
secrets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1293
|
+
file: z.ZodString;
|
|
1294
|
+
line: z.ZodNumber;
|
|
1295
|
+
column: z.ZodNumber;
|
|
1296
|
+
type: z.ZodString;
|
|
1297
|
+
pattern: z.ZodString;
|
|
1298
|
+
matched: z.ZodString;
|
|
1299
|
+
context: z.ZodString;
|
|
1300
|
+
}, "strip", z.ZodTypeAny, {
|
|
1301
|
+
file: string;
|
|
1302
|
+
type: string;
|
|
1303
|
+
line: number;
|
|
1304
|
+
column: number;
|
|
1305
|
+
pattern: string;
|
|
1306
|
+
matched: string;
|
|
1307
|
+
context: string;
|
|
1308
|
+
}, {
|
|
1309
|
+
file: string;
|
|
1310
|
+
type: string;
|
|
1311
|
+
line: number;
|
|
1312
|
+
column: number;
|
|
1313
|
+
pattern: string;
|
|
1314
|
+
matched: string;
|
|
1315
|
+
context: string;
|
|
1316
|
+
}>, "many">>;
|
|
1317
|
+
message: z.ZodOptional<z.ZodString>;
|
|
1318
|
+
}, "strip", z.ZodTypeAny, {
|
|
1319
|
+
scope: string;
|
|
1320
|
+
success: boolean;
|
|
1321
|
+
secretsDetected: boolean;
|
|
1322
|
+
message?: string | undefined;
|
|
1323
|
+
plan?: {
|
|
1324
|
+
schemaVersion: "1.0";
|
|
1325
|
+
createdAt: string;
|
|
1326
|
+
repoRoot: string;
|
|
1327
|
+
gitStatus: {
|
|
1328
|
+
staged: string[];
|
|
1329
|
+
unstaged: string[];
|
|
1330
|
+
untracked: string[];
|
|
1331
|
+
};
|
|
1332
|
+
commits: {
|
|
1333
|
+
message: string;
|
|
1334
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1335
|
+
id: string;
|
|
1336
|
+
files: string[];
|
|
1337
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1338
|
+
breaking: boolean;
|
|
1339
|
+
scope?: string | undefined;
|
|
1340
|
+
body?: string | undefined;
|
|
1341
|
+
reasoning?: {
|
|
1342
|
+
newBehavior: boolean;
|
|
1343
|
+
fixesBug: boolean;
|
|
1344
|
+
internalOnly: boolean;
|
|
1345
|
+
explanation: string;
|
|
1346
|
+
confidence: number;
|
|
1347
|
+
} | undefined;
|
|
1348
|
+
}[];
|
|
1349
|
+
metadata: {
|
|
1350
|
+
totalFiles: number;
|
|
1351
|
+
totalCommits: number;
|
|
1352
|
+
llmUsed: boolean;
|
|
1353
|
+
tokensUsed?: number | undefined;
|
|
1354
|
+
escalated?: boolean | undefined;
|
|
1355
|
+
};
|
|
1356
|
+
} | undefined;
|
|
1357
|
+
planPath?: string | undefined;
|
|
1358
|
+
secrets?: {
|
|
1359
|
+
file: string;
|
|
1360
|
+
type: string;
|
|
1361
|
+
line: number;
|
|
1362
|
+
column: number;
|
|
1363
|
+
pattern: string;
|
|
1364
|
+
matched: string;
|
|
1365
|
+
context: string;
|
|
1366
|
+
}[] | undefined;
|
|
1367
|
+
}, {
|
|
1368
|
+
success: boolean;
|
|
1369
|
+
scope?: string | undefined;
|
|
1370
|
+
message?: string | undefined;
|
|
1371
|
+
plan?: {
|
|
1372
|
+
schemaVersion: "1.0";
|
|
1373
|
+
createdAt: string;
|
|
1374
|
+
repoRoot: string;
|
|
1375
|
+
gitStatus: {
|
|
1376
|
+
staged: string[];
|
|
1377
|
+
unstaged: string[];
|
|
1378
|
+
untracked: string[];
|
|
1379
|
+
};
|
|
1380
|
+
commits: {
|
|
1381
|
+
message: string;
|
|
1382
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1383
|
+
id: string;
|
|
1384
|
+
files: string[];
|
|
1385
|
+
scope?: string | undefined;
|
|
1386
|
+
body?: string | undefined;
|
|
1387
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1388
|
+
breaking?: boolean | undefined;
|
|
1389
|
+
reasoning?: {
|
|
1390
|
+
newBehavior?: boolean | undefined;
|
|
1391
|
+
fixesBug?: boolean | undefined;
|
|
1392
|
+
internalOnly?: boolean | undefined;
|
|
1393
|
+
explanation?: string | undefined;
|
|
1394
|
+
confidence?: number | undefined;
|
|
1395
|
+
} | undefined;
|
|
1396
|
+
}[];
|
|
1397
|
+
metadata: {
|
|
1398
|
+
totalFiles: number;
|
|
1399
|
+
totalCommits: number;
|
|
1400
|
+
llmUsed: boolean;
|
|
1401
|
+
tokensUsed?: number | undefined;
|
|
1402
|
+
escalated?: boolean | undefined;
|
|
1403
|
+
};
|
|
1404
|
+
} | undefined;
|
|
1405
|
+
planPath?: string | undefined;
|
|
1406
|
+
secretsDetected?: boolean | undefined;
|
|
1407
|
+
secrets?: {
|
|
1408
|
+
file: string;
|
|
1409
|
+
type: string;
|
|
1410
|
+
line: number;
|
|
1411
|
+
column: number;
|
|
1412
|
+
pattern: string;
|
|
1413
|
+
matched: string;
|
|
1414
|
+
context: string;
|
|
1415
|
+
}[] | undefined;
|
|
1416
|
+
}>;
|
|
1417
|
+
type GenerateResponse = z.infer<typeof GenerateResponseSchema>;
|
|
1418
|
+
/**
|
|
1419
|
+
* GET /plan?scope=X response
|
|
1420
|
+
*/
|
|
1421
|
+
declare const PlanResponseSchema: z.ZodObject<{
|
|
1422
|
+
hasPlan: z.ZodBoolean;
|
|
1423
|
+
plan: z.ZodOptional<z.ZodObject<{
|
|
1424
|
+
schemaVersion: z.ZodLiteral<"1.0">;
|
|
1425
|
+
createdAt: z.ZodString;
|
|
1426
|
+
repoRoot: z.ZodString;
|
|
1427
|
+
gitStatus: z.ZodObject<{
|
|
1428
|
+
staged: z.ZodArray<z.ZodString, "many">;
|
|
1429
|
+
unstaged: z.ZodArray<z.ZodString, "many">;
|
|
1430
|
+
untracked: z.ZodArray<z.ZodString, "many">;
|
|
1431
|
+
}, "strip", z.ZodTypeAny, {
|
|
1432
|
+
staged: string[];
|
|
1433
|
+
unstaged: string[];
|
|
1434
|
+
untracked: string[];
|
|
1435
|
+
}, {
|
|
1436
|
+
staged: string[];
|
|
1437
|
+
unstaged: string[];
|
|
1438
|
+
untracked: string[];
|
|
1439
|
+
}>;
|
|
1440
|
+
commits: z.ZodArray<z.ZodObject<{
|
|
1441
|
+
id: z.ZodString;
|
|
1442
|
+
type: z.ZodEnum<["feat", "fix", "refactor", "chore", "docs", "test", "build", "ci", "perf"]>;
|
|
1443
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
1444
|
+
message: z.ZodString;
|
|
1445
|
+
body: z.ZodOptional<z.ZodString>;
|
|
1446
|
+
files: z.ZodArray<z.ZodString, "many">;
|
|
1447
|
+
releaseHint: z.ZodDefault<z.ZodEnum<["none", "patch", "minor", "major"]>>;
|
|
1448
|
+
breaking: z.ZodDefault<z.ZodBoolean>;
|
|
1449
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
1450
|
+
newBehavior: z.ZodDefault<z.ZodBoolean>;
|
|
1451
|
+
fixesBug: z.ZodDefault<z.ZodBoolean>;
|
|
1452
|
+
internalOnly: z.ZodDefault<z.ZodBoolean>;
|
|
1453
|
+
explanation: z.ZodDefault<z.ZodString>;
|
|
1454
|
+
confidence: z.ZodDefault<z.ZodNumber>;
|
|
1455
|
+
}, "strip", z.ZodTypeAny, {
|
|
1456
|
+
newBehavior: boolean;
|
|
1457
|
+
fixesBug: boolean;
|
|
1458
|
+
internalOnly: boolean;
|
|
1459
|
+
explanation: string;
|
|
1460
|
+
confidence: number;
|
|
1461
|
+
}, {
|
|
1462
|
+
newBehavior?: boolean | undefined;
|
|
1463
|
+
fixesBug?: boolean | undefined;
|
|
1464
|
+
internalOnly?: boolean | undefined;
|
|
1465
|
+
explanation?: string | undefined;
|
|
1466
|
+
confidence?: number | undefined;
|
|
1467
|
+
}>>;
|
|
1468
|
+
}, "strip", z.ZodTypeAny, {
|
|
1469
|
+
message: string;
|
|
1470
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1471
|
+
id: string;
|
|
1472
|
+
files: string[];
|
|
1473
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1474
|
+
breaking: boolean;
|
|
1475
|
+
scope?: string | undefined;
|
|
1476
|
+
body?: string | undefined;
|
|
1477
|
+
reasoning?: {
|
|
1478
|
+
newBehavior: boolean;
|
|
1479
|
+
fixesBug: boolean;
|
|
1480
|
+
internalOnly: boolean;
|
|
1481
|
+
explanation: string;
|
|
1482
|
+
confidence: number;
|
|
1483
|
+
} | undefined;
|
|
1484
|
+
}, {
|
|
1485
|
+
message: string;
|
|
1486
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1487
|
+
id: string;
|
|
1488
|
+
files: string[];
|
|
1489
|
+
scope?: string | undefined;
|
|
1490
|
+
body?: string | undefined;
|
|
1491
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1492
|
+
breaking?: boolean | undefined;
|
|
1493
|
+
reasoning?: {
|
|
1494
|
+
newBehavior?: boolean | undefined;
|
|
1495
|
+
fixesBug?: boolean | undefined;
|
|
1496
|
+
internalOnly?: boolean | undefined;
|
|
1497
|
+
explanation?: string | undefined;
|
|
1498
|
+
confidence?: number | undefined;
|
|
1499
|
+
} | undefined;
|
|
1500
|
+
}>, "many">;
|
|
1501
|
+
metadata: z.ZodObject<{
|
|
1502
|
+
totalFiles: z.ZodNumber;
|
|
1503
|
+
totalCommits: z.ZodNumber;
|
|
1504
|
+
llmUsed: z.ZodBoolean;
|
|
1505
|
+
tokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
1506
|
+
escalated: z.ZodOptional<z.ZodBoolean>;
|
|
1507
|
+
}, "strip", z.ZodTypeAny, {
|
|
1508
|
+
totalFiles: number;
|
|
1509
|
+
totalCommits: number;
|
|
1510
|
+
llmUsed: boolean;
|
|
1511
|
+
tokensUsed?: number | undefined;
|
|
1512
|
+
escalated?: boolean | undefined;
|
|
1513
|
+
}, {
|
|
1514
|
+
totalFiles: number;
|
|
1515
|
+
totalCommits: number;
|
|
1516
|
+
llmUsed: boolean;
|
|
1517
|
+
tokensUsed?: number | undefined;
|
|
1518
|
+
escalated?: boolean | undefined;
|
|
1519
|
+
}>;
|
|
1520
|
+
}, "strip", z.ZodTypeAny, {
|
|
1521
|
+
schemaVersion: "1.0";
|
|
1522
|
+
createdAt: string;
|
|
1523
|
+
repoRoot: string;
|
|
1524
|
+
gitStatus: {
|
|
1525
|
+
staged: string[];
|
|
1526
|
+
unstaged: string[];
|
|
1527
|
+
untracked: string[];
|
|
1528
|
+
};
|
|
1529
|
+
commits: {
|
|
1530
|
+
message: string;
|
|
1531
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1532
|
+
id: string;
|
|
1533
|
+
files: string[];
|
|
1534
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1535
|
+
breaking: boolean;
|
|
1536
|
+
scope?: string | undefined;
|
|
1537
|
+
body?: string | undefined;
|
|
1538
|
+
reasoning?: {
|
|
1539
|
+
newBehavior: boolean;
|
|
1540
|
+
fixesBug: boolean;
|
|
1541
|
+
internalOnly: boolean;
|
|
1542
|
+
explanation: string;
|
|
1543
|
+
confidence: number;
|
|
1544
|
+
} | undefined;
|
|
1545
|
+
}[];
|
|
1546
|
+
metadata: {
|
|
1547
|
+
totalFiles: number;
|
|
1548
|
+
totalCommits: number;
|
|
1549
|
+
llmUsed: boolean;
|
|
1550
|
+
tokensUsed?: number | undefined;
|
|
1551
|
+
escalated?: boolean | undefined;
|
|
1552
|
+
};
|
|
1553
|
+
}, {
|
|
1554
|
+
schemaVersion: "1.0";
|
|
1555
|
+
createdAt: string;
|
|
1556
|
+
repoRoot: string;
|
|
1557
|
+
gitStatus: {
|
|
1558
|
+
staged: string[];
|
|
1559
|
+
unstaged: string[];
|
|
1560
|
+
untracked: string[];
|
|
1561
|
+
};
|
|
1562
|
+
commits: {
|
|
1563
|
+
message: string;
|
|
1564
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1565
|
+
id: string;
|
|
1566
|
+
files: string[];
|
|
1567
|
+
scope?: string | undefined;
|
|
1568
|
+
body?: string | undefined;
|
|
1569
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1570
|
+
breaking?: boolean | undefined;
|
|
1571
|
+
reasoning?: {
|
|
1572
|
+
newBehavior?: boolean | undefined;
|
|
1573
|
+
fixesBug?: boolean | undefined;
|
|
1574
|
+
internalOnly?: boolean | undefined;
|
|
1575
|
+
explanation?: string | undefined;
|
|
1576
|
+
confidence?: number | undefined;
|
|
1577
|
+
} | undefined;
|
|
1578
|
+
}[];
|
|
1579
|
+
metadata: {
|
|
1580
|
+
totalFiles: number;
|
|
1581
|
+
totalCommits: number;
|
|
1582
|
+
llmUsed: boolean;
|
|
1583
|
+
tokensUsed?: number | undefined;
|
|
1584
|
+
escalated?: boolean | undefined;
|
|
1585
|
+
};
|
|
1586
|
+
}>>;
|
|
1587
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1588
|
+
}, "strip", z.ZodTypeAny, {
|
|
1589
|
+
scope: string;
|
|
1590
|
+
hasPlan: boolean;
|
|
1591
|
+
plan?: {
|
|
1592
|
+
schemaVersion: "1.0";
|
|
1593
|
+
createdAt: string;
|
|
1594
|
+
repoRoot: string;
|
|
1595
|
+
gitStatus: {
|
|
1596
|
+
staged: string[];
|
|
1597
|
+
unstaged: string[];
|
|
1598
|
+
untracked: string[];
|
|
1599
|
+
};
|
|
1600
|
+
commits: {
|
|
1601
|
+
message: string;
|
|
1602
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1603
|
+
id: string;
|
|
1604
|
+
files: string[];
|
|
1605
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1606
|
+
breaking: boolean;
|
|
1607
|
+
scope?: string | undefined;
|
|
1608
|
+
body?: string | undefined;
|
|
1609
|
+
reasoning?: {
|
|
1610
|
+
newBehavior: boolean;
|
|
1611
|
+
fixesBug: boolean;
|
|
1612
|
+
internalOnly: boolean;
|
|
1613
|
+
explanation: string;
|
|
1614
|
+
confidence: number;
|
|
1615
|
+
} | undefined;
|
|
1616
|
+
}[];
|
|
1617
|
+
metadata: {
|
|
1618
|
+
totalFiles: number;
|
|
1619
|
+
totalCommits: number;
|
|
1620
|
+
llmUsed: boolean;
|
|
1621
|
+
tokensUsed?: number | undefined;
|
|
1622
|
+
escalated?: boolean | undefined;
|
|
1623
|
+
};
|
|
1624
|
+
} | undefined;
|
|
1625
|
+
}, {
|
|
1626
|
+
hasPlan: boolean;
|
|
1627
|
+
scope?: string | undefined;
|
|
1628
|
+
plan?: {
|
|
1629
|
+
schemaVersion: "1.0";
|
|
1630
|
+
createdAt: string;
|
|
1631
|
+
repoRoot: string;
|
|
1632
|
+
gitStatus: {
|
|
1633
|
+
staged: string[];
|
|
1634
|
+
unstaged: string[];
|
|
1635
|
+
untracked: string[];
|
|
1636
|
+
};
|
|
1637
|
+
commits: {
|
|
1638
|
+
message: string;
|
|
1639
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1640
|
+
id: string;
|
|
1641
|
+
files: string[];
|
|
1642
|
+
scope?: string | undefined;
|
|
1643
|
+
body?: string | undefined;
|
|
1644
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1645
|
+
breaking?: boolean | undefined;
|
|
1646
|
+
reasoning?: {
|
|
1647
|
+
newBehavior?: boolean | undefined;
|
|
1648
|
+
fixesBug?: boolean | undefined;
|
|
1649
|
+
internalOnly?: boolean | undefined;
|
|
1650
|
+
explanation?: string | undefined;
|
|
1651
|
+
confidence?: number | undefined;
|
|
1652
|
+
} | undefined;
|
|
1653
|
+
}[];
|
|
1654
|
+
metadata: {
|
|
1655
|
+
totalFiles: number;
|
|
1656
|
+
totalCommits: number;
|
|
1657
|
+
llmUsed: boolean;
|
|
1658
|
+
tokensUsed?: number | undefined;
|
|
1659
|
+
escalated?: boolean | undefined;
|
|
1660
|
+
};
|
|
1661
|
+
} | undefined;
|
|
1662
|
+
}>;
|
|
1663
|
+
type PlanResponse = z.infer<typeof PlanResponseSchema>;
|
|
1664
|
+
/**
|
|
1665
|
+
* PATCH /plan request body — edit a single commit in the plan
|
|
1666
|
+
*/
|
|
1667
|
+
declare const PatchPlanRequestSchema: z.ZodObject<{
|
|
1668
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1669
|
+
commitId: z.ZodString;
|
|
1670
|
+
message: z.ZodOptional<z.ZodString>;
|
|
1671
|
+
type: z.ZodOptional<z.ZodString>;
|
|
1672
|
+
scope_: z.ZodOptional<z.ZodString>;
|
|
1673
|
+
body: z.ZodOptional<z.ZodString>;
|
|
1674
|
+
}, "strip", z.ZodTypeAny, {
|
|
1675
|
+
scope: string;
|
|
1676
|
+
commitId: string;
|
|
1677
|
+
message?: string | undefined;
|
|
1678
|
+
type?: string | undefined;
|
|
1679
|
+
body?: string | undefined;
|
|
1680
|
+
scope_?: string | undefined;
|
|
1681
|
+
}, {
|
|
1682
|
+
commitId: string;
|
|
1683
|
+
scope?: string | undefined;
|
|
1684
|
+
message?: string | undefined;
|
|
1685
|
+
type?: string | undefined;
|
|
1686
|
+
body?: string | undefined;
|
|
1687
|
+
scope_?: string | undefined;
|
|
1688
|
+
}>;
|
|
1689
|
+
type PatchPlanRequest = z.infer<typeof PatchPlanRequestSchema>;
|
|
1690
|
+
/**
|
|
1691
|
+
* PATCH /plan response
|
|
1692
|
+
*/
|
|
1693
|
+
declare const PatchPlanResponseSchema: z.ZodObject<{
|
|
1694
|
+
success: z.ZodBoolean;
|
|
1695
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1696
|
+
commitId: z.ZodString;
|
|
1697
|
+
}, "strip", z.ZodTypeAny, {
|
|
1698
|
+
scope: string;
|
|
1699
|
+
success: boolean;
|
|
1700
|
+
commitId: string;
|
|
1701
|
+
}, {
|
|
1702
|
+
success: boolean;
|
|
1703
|
+
commitId: string;
|
|
1704
|
+
scope?: string | undefined;
|
|
1705
|
+
}>;
|
|
1706
|
+
type PatchPlanResponse = z.infer<typeof PatchPlanResponseSchema>;
|
|
1707
|
+
/**
|
|
1708
|
+
* POST /regenerate-commit request body
|
|
1709
|
+
*/
|
|
1710
|
+
declare const RegenerateCommitRequestSchema: z.ZodObject<{
|
|
1711
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1712
|
+
commitId: z.ZodString;
|
|
1713
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
1714
|
+
}, "strip", z.ZodTypeAny, {
|
|
1715
|
+
scope: string;
|
|
1716
|
+
commitId: string;
|
|
1717
|
+
instruction?: string | undefined;
|
|
1718
|
+
}, {
|
|
1719
|
+
commitId: string;
|
|
1720
|
+
scope?: string | undefined;
|
|
1721
|
+
instruction?: string | undefined;
|
|
1722
|
+
}>;
|
|
1723
|
+
type RegenerateCommitRequest = z.infer<typeof RegenerateCommitRequestSchema>;
|
|
1724
|
+
/**
|
|
1725
|
+
* POST /regenerate-commit response
|
|
1726
|
+
*/
|
|
1727
|
+
declare const RegenerateCommitResponseSchema: z.ZodObject<{
|
|
1728
|
+
success: z.ZodBoolean;
|
|
1729
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1730
|
+
commitId: z.ZodString;
|
|
1731
|
+
commit: z.ZodOptional<z.ZodObject<{
|
|
1732
|
+
id: z.ZodString;
|
|
1733
|
+
type: z.ZodEnum<["feat", "fix", "refactor", "chore", "docs", "test", "build", "ci", "perf"]>;
|
|
1734
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
1735
|
+
message: z.ZodString;
|
|
1736
|
+
body: z.ZodOptional<z.ZodString>;
|
|
1737
|
+
files: z.ZodArray<z.ZodString, "many">;
|
|
1738
|
+
releaseHint: z.ZodDefault<z.ZodEnum<["none", "patch", "minor", "major"]>>;
|
|
1739
|
+
breaking: z.ZodDefault<z.ZodBoolean>;
|
|
1740
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
1741
|
+
newBehavior: z.ZodDefault<z.ZodBoolean>;
|
|
1742
|
+
fixesBug: z.ZodDefault<z.ZodBoolean>;
|
|
1743
|
+
internalOnly: z.ZodDefault<z.ZodBoolean>;
|
|
1744
|
+
explanation: z.ZodDefault<z.ZodString>;
|
|
1745
|
+
confidence: z.ZodDefault<z.ZodNumber>;
|
|
1746
|
+
}, "strip", z.ZodTypeAny, {
|
|
1747
|
+
newBehavior: boolean;
|
|
1748
|
+
fixesBug: boolean;
|
|
1749
|
+
internalOnly: boolean;
|
|
1750
|
+
explanation: string;
|
|
1751
|
+
confidence: number;
|
|
1752
|
+
}, {
|
|
1753
|
+
newBehavior?: boolean | undefined;
|
|
1754
|
+
fixesBug?: boolean | undefined;
|
|
1755
|
+
internalOnly?: boolean | undefined;
|
|
1756
|
+
explanation?: string | undefined;
|
|
1757
|
+
confidence?: number | undefined;
|
|
1758
|
+
}>>;
|
|
1759
|
+
}, "strip", z.ZodTypeAny, {
|
|
1760
|
+
message: string;
|
|
1761
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1762
|
+
id: string;
|
|
1763
|
+
files: string[];
|
|
1764
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1765
|
+
breaking: boolean;
|
|
1766
|
+
scope?: string | undefined;
|
|
1767
|
+
body?: string | undefined;
|
|
1768
|
+
reasoning?: {
|
|
1769
|
+
newBehavior: boolean;
|
|
1770
|
+
fixesBug: boolean;
|
|
1771
|
+
internalOnly: boolean;
|
|
1772
|
+
explanation: string;
|
|
1773
|
+
confidence: number;
|
|
1774
|
+
} | undefined;
|
|
1775
|
+
}, {
|
|
1776
|
+
message: string;
|
|
1777
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1778
|
+
id: string;
|
|
1779
|
+
files: string[];
|
|
1780
|
+
scope?: string | undefined;
|
|
1781
|
+
body?: string | undefined;
|
|
1782
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1783
|
+
breaking?: boolean | undefined;
|
|
1784
|
+
reasoning?: {
|
|
1785
|
+
newBehavior?: boolean | undefined;
|
|
1786
|
+
fixesBug?: boolean | undefined;
|
|
1787
|
+
internalOnly?: boolean | undefined;
|
|
1788
|
+
explanation?: string | undefined;
|
|
1789
|
+
confidence?: number | undefined;
|
|
1790
|
+
} | undefined;
|
|
1791
|
+
}>>;
|
|
1792
|
+
}, "strip", z.ZodTypeAny, {
|
|
1793
|
+
scope: string;
|
|
1794
|
+
success: boolean;
|
|
1795
|
+
commitId: string;
|
|
1796
|
+
commit?: {
|
|
1797
|
+
message: string;
|
|
1798
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1799
|
+
id: string;
|
|
1800
|
+
files: string[];
|
|
1801
|
+
releaseHint: "minor" | "none" | "patch" | "major";
|
|
1802
|
+
breaking: boolean;
|
|
1803
|
+
scope?: string | undefined;
|
|
1804
|
+
body?: string | undefined;
|
|
1805
|
+
reasoning?: {
|
|
1806
|
+
newBehavior: boolean;
|
|
1807
|
+
fixesBug: boolean;
|
|
1808
|
+
internalOnly: boolean;
|
|
1809
|
+
explanation: string;
|
|
1810
|
+
confidence: number;
|
|
1811
|
+
} | undefined;
|
|
1812
|
+
} | undefined;
|
|
1813
|
+
}, {
|
|
1814
|
+
success: boolean;
|
|
1815
|
+
commitId: string;
|
|
1816
|
+
scope?: string | undefined;
|
|
1817
|
+
commit?: {
|
|
1818
|
+
message: string;
|
|
1819
|
+
type: "feat" | "fix" | "refactor" | "chore" | "docs" | "test" | "build" | "ci" | "perf";
|
|
1820
|
+
id: string;
|
|
1821
|
+
files: string[];
|
|
1822
|
+
scope?: string | undefined;
|
|
1823
|
+
body?: string | undefined;
|
|
1824
|
+
releaseHint?: "minor" | "none" | "patch" | "major" | undefined;
|
|
1825
|
+
breaking?: boolean | undefined;
|
|
1826
|
+
reasoning?: {
|
|
1827
|
+
newBehavior?: boolean | undefined;
|
|
1828
|
+
fixesBug?: boolean | undefined;
|
|
1829
|
+
internalOnly?: boolean | undefined;
|
|
1830
|
+
explanation?: string | undefined;
|
|
1831
|
+
confidence?: number | undefined;
|
|
1832
|
+
} | undefined;
|
|
1833
|
+
} | undefined;
|
|
1834
|
+
}>;
|
|
1835
|
+
type RegenerateCommitResponse = z.infer<typeof RegenerateCommitResponseSchema>;
|
|
1836
|
+
/**
|
|
1837
|
+
* POST /apply request body
|
|
1838
|
+
*/
|
|
1839
|
+
declare const ApplyRequestSchema: z.ZodObject<{
|
|
1840
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1841
|
+
force: z.ZodDefault<z.ZodBoolean>;
|
|
1842
|
+
/** Optional: apply only specific commits by ID. If omitted, applies all. */
|
|
1843
|
+
commitIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1844
|
+
}, "strip", z.ZodTypeAny, {
|
|
1845
|
+
scope: string;
|
|
1846
|
+
force: boolean;
|
|
1847
|
+
commitIds?: string[] | undefined;
|
|
1848
|
+
}, {
|
|
1849
|
+
scope?: string | undefined;
|
|
1850
|
+
force?: boolean | undefined;
|
|
1851
|
+
commitIds?: string[] | undefined;
|
|
1852
|
+
}>;
|
|
1853
|
+
type ApplyRequest = z.infer<typeof ApplyRequestSchema>;
|
|
1854
|
+
/**
|
|
1855
|
+
* POST /apply response
|
|
1856
|
+
*/
|
|
1857
|
+
declare const ApplyResponseSchema: z.ZodObject<{
|
|
1858
|
+
result: z.ZodObject<{
|
|
1859
|
+
success: z.ZodBoolean;
|
|
1860
|
+
appliedCommits: z.ZodArray<z.ZodObject<{
|
|
1861
|
+
groupId: z.ZodString;
|
|
1862
|
+
sha: z.ZodString;
|
|
1863
|
+
message: z.ZodString;
|
|
1864
|
+
}, "strip", z.ZodTypeAny, {
|
|
1865
|
+
message: string;
|
|
1866
|
+
sha: string;
|
|
1867
|
+
groupId: string;
|
|
1868
|
+
}, {
|
|
1869
|
+
message: string;
|
|
1870
|
+
sha: string;
|
|
1871
|
+
groupId: string;
|
|
1872
|
+
}>, "many">;
|
|
1873
|
+
errors: z.ZodArray<z.ZodString, "many">;
|
|
1874
|
+
}, "strip", z.ZodTypeAny, {
|
|
1875
|
+
success: boolean;
|
|
1876
|
+
errors: string[];
|
|
1877
|
+
appliedCommits: {
|
|
1878
|
+
message: string;
|
|
1879
|
+
sha: string;
|
|
1880
|
+
groupId: string;
|
|
1881
|
+
}[];
|
|
1882
|
+
}, {
|
|
1883
|
+
success: boolean;
|
|
1884
|
+
errors: string[];
|
|
1885
|
+
appliedCommits: {
|
|
1886
|
+
message: string;
|
|
1887
|
+
sha: string;
|
|
1888
|
+
groupId: string;
|
|
1889
|
+
}[];
|
|
1890
|
+
}>;
|
|
1891
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1892
|
+
}, "strip", z.ZodTypeAny, {
|
|
1893
|
+
scope: string;
|
|
1894
|
+
result: {
|
|
1895
|
+
success: boolean;
|
|
1896
|
+
errors: string[];
|
|
1897
|
+
appliedCommits: {
|
|
1898
|
+
message: string;
|
|
1899
|
+
sha: string;
|
|
1900
|
+
groupId: string;
|
|
1901
|
+
}[];
|
|
1902
|
+
};
|
|
1903
|
+
}, {
|
|
1904
|
+
result: {
|
|
1905
|
+
success: boolean;
|
|
1906
|
+
errors: string[];
|
|
1907
|
+
appliedCommits: {
|
|
1908
|
+
message: string;
|
|
1909
|
+
sha: string;
|
|
1910
|
+
groupId: string;
|
|
1911
|
+
}[];
|
|
1912
|
+
};
|
|
1913
|
+
scope?: string | undefined;
|
|
1914
|
+
}>;
|
|
1915
|
+
type ApplyResponse = z.infer<typeof ApplyResponseSchema>;
|
|
1916
|
+
/**
|
|
1917
|
+
* POST /push request body
|
|
1918
|
+
*/
|
|
1919
|
+
declare const PushRequestSchema: z.ZodObject<{
|
|
1920
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1921
|
+
remote: z.ZodDefault<z.ZodString>;
|
|
1922
|
+
force: z.ZodDefault<z.ZodBoolean>;
|
|
1923
|
+
}, "strip", z.ZodTypeAny, {
|
|
1924
|
+
scope: string;
|
|
1925
|
+
force: boolean;
|
|
1926
|
+
remote: string;
|
|
1927
|
+
}, {
|
|
1928
|
+
scope?: string | undefined;
|
|
1929
|
+
force?: boolean | undefined;
|
|
1930
|
+
remote?: string | undefined;
|
|
1931
|
+
}>;
|
|
1932
|
+
type PushRequest = z.infer<typeof PushRequestSchema>;
|
|
1933
|
+
/**
|
|
1934
|
+
* POST /push response
|
|
1935
|
+
*/
|
|
1936
|
+
declare const PushResponseSchema: z.ZodObject<{
|
|
1937
|
+
result: z.ZodObject<{
|
|
1938
|
+
success: z.ZodBoolean;
|
|
1939
|
+
remote: z.ZodString;
|
|
1940
|
+
branch: z.ZodString;
|
|
1941
|
+
commitsPushed: z.ZodNumber;
|
|
1942
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1943
|
+
}, "strip", z.ZodTypeAny, {
|
|
1944
|
+
success: boolean;
|
|
1945
|
+
remote: string;
|
|
1946
|
+
branch: string;
|
|
1947
|
+
commitsPushed: number;
|
|
1948
|
+
error?: string | undefined;
|
|
1949
|
+
}, {
|
|
1950
|
+
success: boolean;
|
|
1951
|
+
remote: string;
|
|
1952
|
+
branch: string;
|
|
1953
|
+
commitsPushed: number;
|
|
1954
|
+
error?: string | undefined;
|
|
1955
|
+
}>;
|
|
1956
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1957
|
+
}, "strip", z.ZodTypeAny, {
|
|
1958
|
+
scope: string;
|
|
1959
|
+
result: {
|
|
1960
|
+
success: boolean;
|
|
1961
|
+
remote: string;
|
|
1962
|
+
branch: string;
|
|
1963
|
+
commitsPushed: number;
|
|
1964
|
+
error?: string | undefined;
|
|
1965
|
+
};
|
|
1966
|
+
}, {
|
|
1967
|
+
result: {
|
|
1968
|
+
success: boolean;
|
|
1969
|
+
remote: string;
|
|
1970
|
+
branch: string;
|
|
1971
|
+
commitsPushed: number;
|
|
1972
|
+
error?: string | undefined;
|
|
1973
|
+
};
|
|
1974
|
+
scope?: string | undefined;
|
|
1975
|
+
}>;
|
|
1976
|
+
type PushResponse = z.infer<typeof PushResponseSchema>;
|
|
1977
|
+
/**
|
|
1978
|
+
* DELETE /plan?scope=X response
|
|
1979
|
+
*/
|
|
1980
|
+
declare const ResetResponseSchema: z.ZodObject<{
|
|
1981
|
+
success: z.ZodBoolean;
|
|
1982
|
+
message: z.ZodString;
|
|
1983
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1984
|
+
}, "strip", z.ZodTypeAny, {
|
|
1985
|
+
scope: string;
|
|
1986
|
+
message: string;
|
|
1987
|
+
success: boolean;
|
|
1988
|
+
}, {
|
|
1989
|
+
message: string;
|
|
1990
|
+
success: boolean;
|
|
1991
|
+
scope?: string | undefined;
|
|
1992
|
+
}>;
|
|
1993
|
+
type ResetResponse = z.infer<typeof ResetResponseSchema>;
|
|
1994
|
+
/**
|
|
1995
|
+
* GET /git-status?scope=X response
|
|
1996
|
+
*/
|
|
1997
|
+
declare const GitStatusResponseSchema: z.ZodObject<{
|
|
1998
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
1999
|
+
status: z.ZodObject<{
|
|
2000
|
+
staged: z.ZodArray<z.ZodString, "many">;
|
|
2001
|
+
unstaged: z.ZodArray<z.ZodString, "many">;
|
|
2002
|
+
untracked: z.ZodArray<z.ZodString, "many">;
|
|
2003
|
+
}, "strip", z.ZodTypeAny, {
|
|
2004
|
+
staged: string[];
|
|
2005
|
+
unstaged: string[];
|
|
2006
|
+
untracked: string[];
|
|
2007
|
+
}, {
|
|
2008
|
+
staged: string[];
|
|
2009
|
+
unstaged: string[];
|
|
2010
|
+
untracked: string[];
|
|
2011
|
+
}>;
|
|
2012
|
+
summaries: z.ZodArray<z.ZodObject<{
|
|
2013
|
+
path: z.ZodString;
|
|
2014
|
+
status: z.ZodEnum<["added", "modified", "deleted", "renamed", "copied"]>;
|
|
2015
|
+
additions: z.ZodNumber;
|
|
2016
|
+
deletions: z.ZodNumber;
|
|
2017
|
+
binary: z.ZodDefault<z.ZodBoolean>;
|
|
2018
|
+
isNewFile: z.ZodDefault<z.ZodBoolean>;
|
|
2019
|
+
}, "strip", z.ZodTypeAny, {
|
|
2020
|
+
binary: boolean;
|
|
2021
|
+
path: string;
|
|
2022
|
+
status: "added" | "modified" | "deleted" | "renamed" | "copied";
|
|
2023
|
+
additions: number;
|
|
2024
|
+
deletions: number;
|
|
2025
|
+
isNewFile: boolean;
|
|
2026
|
+
}, {
|
|
2027
|
+
path: string;
|
|
2028
|
+
status: "added" | "modified" | "deleted" | "renamed" | "copied";
|
|
2029
|
+
additions: number;
|
|
2030
|
+
deletions: number;
|
|
2031
|
+
binary?: boolean | undefined;
|
|
2032
|
+
isNewFile?: boolean | undefined;
|
|
2033
|
+
}>, "many">;
|
|
2034
|
+
totalFiles: z.ZodNumber;
|
|
2035
|
+
}, "strip", z.ZodTypeAny, {
|
|
2036
|
+
scope: string;
|
|
2037
|
+
status: {
|
|
2038
|
+
staged: string[];
|
|
2039
|
+
unstaged: string[];
|
|
2040
|
+
untracked: string[];
|
|
2041
|
+
};
|
|
2042
|
+
totalFiles: number;
|
|
2043
|
+
summaries: {
|
|
2044
|
+
binary: boolean;
|
|
2045
|
+
path: string;
|
|
2046
|
+
status: "added" | "modified" | "deleted" | "renamed" | "copied";
|
|
2047
|
+
additions: number;
|
|
2048
|
+
deletions: number;
|
|
2049
|
+
isNewFile: boolean;
|
|
2050
|
+
}[];
|
|
2051
|
+
}, {
|
|
2052
|
+
status: {
|
|
2053
|
+
staged: string[];
|
|
2054
|
+
unstaged: string[];
|
|
2055
|
+
untracked: string[];
|
|
2056
|
+
};
|
|
2057
|
+
totalFiles: number;
|
|
2058
|
+
summaries: {
|
|
2059
|
+
path: string;
|
|
2060
|
+
status: "added" | "modified" | "deleted" | "renamed" | "copied";
|
|
2061
|
+
additions: number;
|
|
2062
|
+
deletions: number;
|
|
2063
|
+
binary?: boolean | undefined;
|
|
2064
|
+
isNewFile?: boolean | undefined;
|
|
2065
|
+
}[];
|
|
2066
|
+
scope?: string | undefined;
|
|
2067
|
+
}>;
|
|
2068
|
+
type GitStatusResponse = z.infer<typeof GitStatusResponseSchema>;
|
|
2069
|
+
/**
|
|
2070
|
+
* GET /diff?scope=X&file=Y response
|
|
2071
|
+
*/
|
|
2072
|
+
declare const FileDiffResponseSchema: z.ZodObject<{
|
|
2073
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
2074
|
+
file: z.ZodString;
|
|
2075
|
+
diff: z.ZodString;
|
|
2076
|
+
additions: z.ZodDefault<z.ZodNumber>;
|
|
2077
|
+
deletions: z.ZodDefault<z.ZodNumber>;
|
|
2078
|
+
}, "strip", z.ZodTypeAny, {
|
|
2079
|
+
file: string;
|
|
2080
|
+
scope: string;
|
|
2081
|
+
additions: number;
|
|
2082
|
+
deletions: number;
|
|
2083
|
+
diff: string;
|
|
2084
|
+
}, {
|
|
2085
|
+
file: string;
|
|
2086
|
+
diff: string;
|
|
2087
|
+
scope?: string | undefined;
|
|
2088
|
+
additions?: number | undefined;
|
|
2089
|
+
deletions?: number | undefined;
|
|
2090
|
+
}>;
|
|
2091
|
+
type FileDiffResponse = z.infer<typeof FileDiffResponseSchema>;
|
|
2092
|
+
/**
|
|
2093
|
+
* POST /summarize request body
|
|
2094
|
+
*/
|
|
2095
|
+
declare const SummarizeRequestSchema: z.ZodObject<{
|
|
2096
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
2097
|
+
/** Optional file path - if provided, summarize only this file */
|
|
2098
|
+
file: z.ZodOptional<z.ZodString>;
|
|
2099
|
+
}, "strip", z.ZodTypeAny, {
|
|
2100
|
+
scope: string;
|
|
2101
|
+
file?: string | undefined;
|
|
2102
|
+
}, {
|
|
2103
|
+
file?: string | undefined;
|
|
2104
|
+
scope?: string | undefined;
|
|
2105
|
+
}>;
|
|
2106
|
+
type SummarizeRequest = z.infer<typeof SummarizeRequestSchema>;
|
|
2107
|
+
/**
|
|
2108
|
+
* POST /summarize response
|
|
2109
|
+
*/
|
|
2110
|
+
declare const SummarizeResponseSchema: z.ZodObject<{
|
|
2111
|
+
scope: z.ZodDefault<z.ZodString>;
|
|
2112
|
+
file: z.ZodOptional<z.ZodString>;
|
|
2113
|
+
summary: z.ZodString;
|
|
2114
|
+
/** Token usage for the LLM call */
|
|
2115
|
+
tokensUsed: z.ZodOptional<z.ZodNumber>;
|
|
2116
|
+
}, "strip", z.ZodTypeAny, {
|
|
2117
|
+
scope: string;
|
|
2118
|
+
summary: string;
|
|
2119
|
+
file?: string | undefined;
|
|
2120
|
+
tokensUsed?: number | undefined;
|
|
2121
|
+
}, {
|
|
2122
|
+
summary: string;
|
|
2123
|
+
file?: string | undefined;
|
|
2124
|
+
scope?: string | undefined;
|
|
2125
|
+
tokensUsed?: number | undefined;
|
|
2126
|
+
}>;
|
|
2127
|
+
type SummarizeResponse = z.infer<typeof SummarizeResponseSchema>;
|
|
2128
|
+
|
|
2129
|
+
/**
|
|
2130
|
+
* Declarative flag definitions for commit plugin commands
|
|
2131
|
+
*
|
|
2132
|
+
* Using the new defineFlags system from @kb-labs/sdk for:
|
|
2133
|
+
* - Type safety
|
|
2134
|
+
* - Runtime validation
|
|
2135
|
+
* - Automatic type inference
|
|
2136
|
+
* - Consistent DX across commands
|
|
2137
|
+
*/
|
|
2138
|
+
/**
|
|
2139
|
+
* Flags for commit:commit (run) command
|
|
2140
|
+
*
|
|
2141
|
+
* @example
|
|
2142
|
+
* ```bash
|
|
2143
|
+
* kb commit commit --scope="@kb-labs/core" --dry-run --with-push
|
|
2144
|
+
* ```
|
|
2145
|
+
*/
|
|
2146
|
+
declare const commitFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
|
|
2147
|
+
scope: {
|
|
2148
|
+
type: "string";
|
|
2149
|
+
description: string;
|
|
2150
|
+
examples: string[];
|
|
2151
|
+
};
|
|
2152
|
+
json: {
|
|
2153
|
+
type: "boolean";
|
|
2154
|
+
description: string;
|
|
2155
|
+
default: false;
|
|
2156
|
+
};
|
|
2157
|
+
"dry-run": {
|
|
2158
|
+
type: "boolean";
|
|
2159
|
+
description: string;
|
|
2160
|
+
default: false;
|
|
2161
|
+
};
|
|
2162
|
+
"with-push": {
|
|
2163
|
+
type: "boolean";
|
|
2164
|
+
description: string;
|
|
2165
|
+
default: false;
|
|
2166
|
+
};
|
|
2167
|
+
"allow-secrets": {
|
|
2168
|
+
type: "boolean";
|
|
2169
|
+
description: string;
|
|
2170
|
+
default: false;
|
|
2171
|
+
};
|
|
2172
|
+
yes: {
|
|
2173
|
+
type: "boolean";
|
|
2174
|
+
description: string;
|
|
2175
|
+
default: false;
|
|
2176
|
+
};
|
|
2177
|
+
}>;
|
|
2178
|
+
/**
|
|
2179
|
+
* Inferred TypeScript type for commit command input
|
|
2180
|
+
*
|
|
2181
|
+
* Type resolves to:
|
|
2182
|
+
* {
|
|
2183
|
+
* scope?: string;
|
|
2184
|
+
* json: boolean;
|
|
2185
|
+
* 'dry-run': boolean;
|
|
2186
|
+
* 'with-push': boolean;
|
|
2187
|
+
* }
|
|
2188
|
+
*/
|
|
2189
|
+
type CommitFlags = typeof commitFlags.infer;
|
|
2190
|
+
/**
|
|
2191
|
+
* Flags for commit:generate command
|
|
2192
|
+
*
|
|
2193
|
+
* @example
|
|
2194
|
+
* ```bash
|
|
2195
|
+
* kb commit generate --scope="@kb-labs/cli" --json
|
|
2196
|
+
* ```
|
|
2197
|
+
*/
|
|
2198
|
+
declare const generateFlags: _kb_labs_shared_command_kit.FlagSchemaWithInfer<{
|
|
2199
|
+
scope: {
|
|
2200
|
+
type: "string";
|
|
2201
|
+
description: string;
|
|
2202
|
+
examples: string[];
|
|
2203
|
+
};
|
|
2204
|
+
json: {
|
|
2205
|
+
type: "boolean";
|
|
2206
|
+
description: string;
|
|
2207
|
+
default: false;
|
|
2208
|
+
};
|
|
2209
|
+
"allow-secrets": {
|
|
2210
|
+
type: "boolean";
|
|
2211
|
+
description: string;
|
|
2212
|
+
default: false;
|
|
2213
|
+
};
|
|
2214
|
+
yes: {
|
|
2215
|
+
type: "boolean";
|
|
2216
|
+
description: string;
|
|
2217
|
+
default: false;
|
|
2218
|
+
};
|
|
2219
|
+
}>;
|
|
2220
|
+
/**
|
|
2221
|
+
* Inferred TypeScript type for generate command input
|
|
2222
|
+
*
|
|
2223
|
+
* Type resolves to:
|
|
2224
|
+
* {
|
|
2225
|
+
* scope?: string;
|
|
2226
|
+
* json: boolean;
|
|
2227
|
+
* }
|
|
2228
|
+
*/
|
|
2229
|
+
type GenerateFlags = typeof generateFlags.infer;
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* Environment variable definitions for commit plugin
|
|
2233
|
+
*/
|
|
2234
|
+
declare const commitEnv: _kb_labs_shared_cli_ui.EnvDefinition<{
|
|
2235
|
+
KB_COMMIT_LLM_ENABLED: {
|
|
2236
|
+
type: "boolean";
|
|
2237
|
+
default: true;
|
|
2238
|
+
description: string;
|
|
2239
|
+
};
|
|
2240
|
+
KB_COMMIT_LLM_TEMPERATURE: {
|
|
2241
|
+
type: "number";
|
|
2242
|
+
default: number;
|
|
2243
|
+
description: string;
|
|
2244
|
+
validate: (v: number) => void;
|
|
2245
|
+
};
|
|
2246
|
+
KB_COMMIT_LLM_MAX_TOKENS: {
|
|
2247
|
+
type: "number";
|
|
2248
|
+
default: number;
|
|
2249
|
+
description: string;
|
|
2250
|
+
};
|
|
2251
|
+
KB_COMMIT_STORAGE_DIR: {
|
|
2252
|
+
type: "string";
|
|
2253
|
+
default: string;
|
|
2254
|
+
description: string;
|
|
2255
|
+
};
|
|
2256
|
+
KB_COMMIT_AUTO_STAGE: {
|
|
2257
|
+
type: "boolean";
|
|
2258
|
+
default: false;
|
|
2259
|
+
description: string;
|
|
2260
|
+
};
|
|
2261
|
+
}>;
|
|
2262
|
+
type CommitEnv = typeof commitEnv.type;
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* @module @kb-labs/commit-contracts/routes
|
|
2266
|
+
* REST API route constants for commit plugin
|
|
2267
|
+
*/
|
|
2268
|
+
/**
|
|
2269
|
+
* REST API base path for commit plugin
|
|
2270
|
+
*/
|
|
2271
|
+
declare const COMMIT_BASE_PATH: "/v1/plugins/commit";
|
|
2272
|
+
/**
|
|
2273
|
+
* REST API route paths (relative to basePath)
|
|
2274
|
+
*
|
|
2275
|
+
* These are used in both:
|
|
2276
|
+
* - manifest.rest.routes[].path (route definitions)
|
|
2277
|
+
* - manifest.studio.widgets[].data.source.routeId (widget data sources)
|
|
2278
|
+
* - manifest.studio.widgets[].actions[].endpoint.routeId (widget actions)
|
|
2279
|
+
*/
|
|
2280
|
+
declare const COMMIT_ROUTES: {
|
|
2281
|
+
/** GET /scopes - List available scopes */
|
|
2282
|
+
readonly SCOPES: "/scopes";
|
|
2283
|
+
/** GET /status - Get current status (plan + git) */
|
|
2284
|
+
readonly STATUS: "/status";
|
|
2285
|
+
/** GET /plan - Get current commit plan */
|
|
2286
|
+
readonly PLAN: "/plan";
|
|
2287
|
+
/** GET /git-status - Get git status with file details */
|
|
2288
|
+
readonly GIT_STATUS: "/git-status";
|
|
2289
|
+
/** GET /files - Get file tree with diff statistics */
|
|
2290
|
+
readonly FILES: "/files";
|
|
2291
|
+
/** GET /diff - Get diff for a specific file */
|
|
2292
|
+
readonly DIFF: "/diff";
|
|
2293
|
+
/** POST /summarize - Summarize changes using LLM */
|
|
2294
|
+
readonly SUMMARIZE: "/summarize";
|
|
2295
|
+
/** GET /actions - Get actions widget data */
|
|
2296
|
+
readonly ACTIONS: "/actions";
|
|
2297
|
+
/** POST /generate - Generate new commit plan */
|
|
2298
|
+
readonly GENERATE: "/generate";
|
|
2299
|
+
/** POST /apply - Apply commit plan */
|
|
2300
|
+
readonly APPLY: "/apply";
|
|
2301
|
+
/** POST /push - Push commits to remote */
|
|
2302
|
+
readonly PUSH: "/push";
|
|
2303
|
+
/** DELETE /plan - Delete current plan */
|
|
2304
|
+
readonly RESET: "/plan";
|
|
2305
|
+
/** PATCH /plan - Edit a single commit in the plan */
|
|
2306
|
+
readonly PATCH_PLAN: "/plan";
|
|
2307
|
+
/** POST /regenerate-commit - Regenerate a single commit */
|
|
2308
|
+
readonly REGENERATE_COMMIT: "/regenerate-commit";
|
|
2309
|
+
};
|
|
2310
|
+
/**
|
|
2311
|
+
* Full REST API URLs (basePath + route)
|
|
2312
|
+
* Useful for testing and documentation
|
|
2313
|
+
*/
|
|
2314
|
+
declare const COMMIT_FULL_ROUTES: {
|
|
2315
|
+
readonly SCOPES: "/v1/plugins/commit/scopes";
|
|
2316
|
+
readonly STATUS: "/v1/plugins/commit/status";
|
|
2317
|
+
readonly PLAN: "/v1/plugins/commit/plan";
|
|
2318
|
+
readonly GIT_STATUS: "/v1/plugins/commit/git-status";
|
|
2319
|
+
readonly FILES: "/v1/plugins/commit/files";
|
|
2320
|
+
readonly DIFF: "/v1/plugins/commit/diff";
|
|
2321
|
+
readonly SUMMARIZE: "/v1/plugins/commit/summarize";
|
|
2322
|
+
readonly ACTIONS: "/v1/plugins/commit/actions";
|
|
2323
|
+
readonly GENERATE: "/v1/plugins/commit/generate";
|
|
2324
|
+
readonly APPLY: "/v1/plugins/commit/apply";
|
|
2325
|
+
readonly PUSH: "/v1/plugins/commit/push";
|
|
2326
|
+
readonly RESET: "/v1/plugins/commit/plan";
|
|
2327
|
+
readonly PATCH_PLAN: "/v1/plugins/commit/plan";
|
|
2328
|
+
readonly REGENERATE_COMMIT: "/v1/plugins/commit/regenerate-commit";
|
|
2329
|
+
};
|
|
2330
|
+
/**
|
|
2331
|
+
* Widget-friendly route IDs (without leading slash)
|
|
2332
|
+
* Use these in manifest.studio.widgets[].data.source.routeId
|
|
2333
|
+
*/
|
|
2334
|
+
declare const COMMIT_WIDGET_ROUTES: {
|
|
2335
|
+
readonly SCOPES: "scopes";
|
|
2336
|
+
readonly STATUS: "status";
|
|
2337
|
+
readonly PLAN: "plan";
|
|
2338
|
+
readonly GIT_STATUS: "git-status";
|
|
2339
|
+
readonly FILES: "files";
|
|
2340
|
+
readonly DIFF: "diff";
|
|
2341
|
+
readonly SUMMARIZE: "summarize";
|
|
2342
|
+
readonly ACTIONS: "actions";
|
|
2343
|
+
readonly GENERATE: "generate";
|
|
2344
|
+
readonly APPLY: "apply";
|
|
2345
|
+
readonly PUSH: "push";
|
|
2346
|
+
readonly RESET: "plan";
|
|
2347
|
+
readonly PATCH_PLAN: "plan";
|
|
2348
|
+
readonly REGENERATE_COMMIT: "regenerate-commit";
|
|
2349
|
+
};
|
|
2350
|
+
type CommitRoute = (typeof COMMIT_ROUTES)[keyof typeof COMMIT_ROUTES];
|
|
2351
|
+
type CommitWidgetRoute = (typeof COMMIT_WIDGET_ROUTES)[keyof typeof COMMIT_WIDGET_ROUTES];
|
|
2352
|
+
|
|
2353
|
+
/**
|
|
2354
|
+
* @module @kb-labs/commit-contracts/events
|
|
2355
|
+
* Studio event definitions for commit plugin
|
|
2356
|
+
*/
|
|
2357
|
+
/**
|
|
2358
|
+
* Event names for commit plugin widgets
|
|
2359
|
+
*/
|
|
2360
|
+
declare const COMMIT_EVENTS: {
|
|
2361
|
+
/** Scope selector changed */
|
|
2362
|
+
readonly SCOPE_CHANGED: "scope:changed";
|
|
2363
|
+
/** Form submitted (actions widget) */
|
|
2364
|
+
readonly FORM_SUBMITTED: "form:submitted";
|
|
2365
|
+
/** Commit plan generated */
|
|
2366
|
+
readonly PLAN_GENERATED: "plan:generated";
|
|
2367
|
+
};
|
|
2368
|
+
type CommitEventName = (typeof COMMIT_EVENTS)[keyof typeof COMMIT_EVENTS];
|
|
2369
|
+
/**
|
|
2370
|
+
* Event payload types
|
|
2371
|
+
*/
|
|
2372
|
+
/** Payload for scope:changed event */
|
|
2373
|
+
interface ScopeChangedPayload {
|
|
2374
|
+
/** Selected scope ID */
|
|
2375
|
+
scope: string;
|
|
2376
|
+
}
|
|
2377
|
+
/** Payload for form:submitted event */
|
|
2378
|
+
interface FormSubmittedPayload {
|
|
2379
|
+
/** Action ID that was submitted */
|
|
2380
|
+
action: string;
|
|
2381
|
+
/** Form data (if any) */
|
|
2382
|
+
data?: Record<string, unknown>;
|
|
2383
|
+
}
|
|
2384
|
+
/** Payload for plan:generated event */
|
|
2385
|
+
interface PlanGeneratedPayload {
|
|
2386
|
+
/** The generated commit plan */
|
|
2387
|
+
plan: {
|
|
2388
|
+
commits: Array<{
|
|
2389
|
+
type: string;
|
|
2390
|
+
scope?: string;
|
|
2391
|
+
message: string;
|
|
2392
|
+
body?: string;
|
|
2393
|
+
files: string[];
|
|
2394
|
+
}>;
|
|
2395
|
+
};
|
|
2396
|
+
/** Scope where plan was generated */
|
|
2397
|
+
scope: string;
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
* Union type for all commit event payloads
|
|
2401
|
+
*/
|
|
2402
|
+
type CommitEventPayload = ScopeChangedPayload | FormSubmittedPayload | PlanGeneratedPayload;
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* Cache key prefix for commit plugin
|
|
2406
|
+
* Used for platform cache namespacing: commit:git-status:*, commit:plan-applied:*
|
|
2407
|
+
*/
|
|
2408
|
+
declare const COMMIT_CACHE_PREFIX: "commit:";
|
|
2409
|
+
|
|
2410
|
+
export { type ApiContract, type ApplyRequest, ApplyRequestSchema, type ApplyResponse, ApplyResponseSchema, type ArtifactContractsMap, type ArtifactExample, type ArtifactKind, COMMIT_BASE_PATH, COMMIT_CACHE_PREFIX, COMMIT_ENV_VARS, COMMIT_EVENTS, COMMIT_FULL_ROUTES, COMMIT_ROUTES, COMMIT_WIDGET_ROUTES, type CommandContract, type CommandContractsMap, type CommitEnv, type CommitEnvVar, type CommitEventName, type CommitEventPayload, type CommitFlags, type CommitPluginConfig, type CommitRoute, type CommitScope, type CommitWidgetRoute, type FileDiffResponse, FileDiffResponseSchema, type FormSubmittedPayload, type GenerateFlags, type GenerateRequest, GenerateRequestSchema, type GenerateResponse, GenerateResponseSchema, type GitConfig, type GitStatusResponse, GitStatusResponseSchema, type LLMConfig, type PatchPlanRequest, PatchPlanRequestSchema, type PatchPlanResponse, PatchPlanResponseSchema, type PlanGeneratedPayload, type PlanResponse, PlanResponseSchema, type PlanStatus, PlanStatusSchema, type PluginArtifactContract, PluginArtifactIds, PluginCommandIds, type PluginContracts, type PushRequest, PushRequestSchema, type PushResponse, PushResponseSchema, type RegenerateCommitRequest, RegenerateCommitRequestSchema, type RegenerateCommitResponse, RegenerateCommitResponseSchema, type ResetResponse, ResetResponseSchema, type RestApiContract, type RestRouteContract, type SchemaReference, type Scope, type ScopeChangedPayload, type ScopeConfig, ScopeSchema, type ScopesResponse, ScopesResponseSchema, type SecretMatch, SecretMatchSchema, type StatusResponse, StatusResponseSchema, type StorageConfig, type SummarizeRequest, SummarizeRequestSchema, type SummarizeResponse, SummarizeResponseSchema, type WorkflowContract, type WorkflowContractsMap, type WorkflowStepContract, commitEnv, commitFlags, contractsSchemaId, contractsVersion, defaultCommitConfig, generateFlags, getArtifact, getArtifactId, getArtifactPath, getCommand, getCommandId, hasArtifact, hasCommand, parsePluginContracts, pluginContractsSchema, resolveCommitConfig };
|