@kb-labs/commit-cli 0.5.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.
Files changed (118) hide show
  1. package/README.md +120 -0
  2. package/dist/cli/commands/apply.d.ts +22 -0
  3. package/dist/cli/commands/apply.js +132 -0
  4. package/dist/cli/commands/apply.js.map +1 -0
  5. package/dist/cli/commands/flags.d.ts +99 -0
  6. package/dist/cli/commands/flags.js +73 -0
  7. package/dist/cli/commands/flags.js.map +1 -0
  8. package/dist/cli/commands/generate.d.ts +45 -0
  9. package/dist/cli/commands/generate.js +149 -0
  10. package/dist/cli/commands/generate.js.map +1 -0
  11. package/dist/cli/commands/index.d.ts +1 -0
  12. package/dist/cli/commands/index.js +73 -0
  13. package/dist/cli/commands/index.js.map +1 -0
  14. package/dist/cli/commands/open.d.ts +50 -0
  15. package/dist/cli/commands/open.js +80 -0
  16. package/dist/cli/commands/open.js.map +1 -0
  17. package/dist/cli/commands/push.d.ts +18 -0
  18. package/dist/cli/commands/push.js +71 -0
  19. package/dist/cli/commands/push.js.map +1 -0
  20. package/dist/cli/commands/reset.d.ts +15 -0
  21. package/dist/cli/commands/reset.js +52 -0
  22. package/dist/cli/commands/reset.js.map +1 -0
  23. package/dist/cli/commands/run.d.ts +51 -0
  24. package/dist/cli/commands/run.js +190 -0
  25. package/dist/cli/commands/run.js.map +1 -0
  26. package/dist/index.d.ts +5 -0
  27. package/dist/index.js +916 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/lifecycle/setup.d.ts +53 -0
  30. package/dist/lifecycle/setup.js +96 -0
  31. package/dist/lifecycle/setup.js.map +1 -0
  32. package/dist/manifest.d.ts +207 -0
  33. package/dist/manifest.js +833 -0
  34. package/dist/manifest.js.map +1 -0
  35. package/dist/rest/handlers/actions-handler.d.ts +16 -0
  36. package/dist/rest/handlers/actions-handler.js +15 -0
  37. package/dist/rest/handlers/actions-handler.js.map +1 -0
  38. package/dist/rest/handlers/apply-handler.d.ts +26 -0
  39. package/dist/rest/handlers/apply-handler.js +115 -0
  40. package/dist/rest/handlers/apply-handler.js.map +1 -0
  41. package/dist/rest/handlers/diff-handler.d.ts +20 -0
  42. package/dist/rest/handlers/diff-handler.js +64 -0
  43. package/dist/rest/handlers/diff-handler.js.map +1 -0
  44. package/dist/rest/handlers/files-handler.d.ts +16 -0
  45. package/dist/rest/handlers/files-handler.js +143 -0
  46. package/dist/rest/handlers/files-handler.js.map +1 -0
  47. package/dist/rest/handlers/generate-handler.d.ts +66 -0
  48. package/dist/rest/handlers/generate-handler.js +97 -0
  49. package/dist/rest/handlers/generate-handler.js.map +1 -0
  50. package/dist/rest/handlers/git-status-handler.d.ts +13 -0
  51. package/dist/rest/handlers/git-status-handler.js +58 -0
  52. package/dist/rest/handlers/git-status-handler.js.map +1 -0
  53. package/dist/rest/handlers/patch-plan-handler.d.ts +23 -0
  54. package/dist/rest/handlers/patch-plan-handler.js +50 -0
  55. package/dist/rest/handlers/patch-plan-handler.js.map +1 -0
  56. package/dist/rest/handlers/plan-handler.d.ts +50 -0
  57. package/dist/rest/handlers/plan-handler.js +32 -0
  58. package/dist/rest/handlers/plan-handler.js.map +1 -0
  59. package/dist/rest/handlers/push-handler.d.ts +25 -0
  60. package/dist/rest/handlers/push-handler.js +75 -0
  61. package/dist/rest/handlers/push-handler.js.map +1 -0
  62. package/dist/rest/handlers/regenerate-handler.d.ts +37 -0
  63. package/dist/rest/handlers/regenerate-handler.js +124 -0
  64. package/dist/rest/handlers/regenerate-handler.js.map +1 -0
  65. package/dist/rest/handlers/reset-handler.d.ts +17 -0
  66. package/dist/rest/handlers/reset-handler.js +30 -0
  67. package/dist/rest/handlers/reset-handler.js.map +1 -0
  68. package/dist/rest/handlers/scope-resolver.d.ts +15 -0
  69. package/dist/rest/handlers/scope-resolver.js +12 -0
  70. package/dist/rest/handlers/scope-resolver.js.map +1 -0
  71. package/dist/rest/handlers/scopes-handler.d.ts +12 -0
  72. package/dist/rest/handlers/scopes-handler.js +24 -0
  73. package/dist/rest/handlers/scopes-handler.js.map +1 -0
  74. package/dist/rest/handlers/status-handler.d.ts +27 -0
  75. package/dist/rest/handlers/status-handler.js +91 -0
  76. package/dist/rest/handlers/status-handler.js.map +1 -0
  77. package/dist/rest/handlers/summarize-handler.d.ts +21 -0
  78. package/dist/rest/handlers/summarize-handler.js +106 -0
  79. package/dist/rest/handlers/summarize-handler.js.map +1 -0
  80. package/dist/widgets/220.js +446 -0
  81. package/dist/widgets/220.js.map +1 -0
  82. package/dist/widgets/331.js +2 -0
  83. package/dist/widgets/331.js.map +1 -0
  84. package/dist/widgets/403.js +2 -0
  85. package/dist/widgets/403.js.map +1 -0
  86. package/dist/widgets/406.js +35 -0
  87. package/dist/widgets/406.js.map +1 -0
  88. package/dist/widgets/455.js +2 -0
  89. package/dist/widgets/455.js.map +1 -0
  90. package/dist/widgets/482.js +2 -0
  91. package/dist/widgets/482.js.map +1 -0
  92. package/dist/widgets/485.js +2 -0
  93. package/dist/widgets/485.js.map +1 -0
  94. package/dist/widgets/527.js +2 -0
  95. package/dist/widgets/527.js.map +1 -0
  96. package/dist/widgets/628.js +2 -0
  97. package/dist/widgets/628.js.map +1 -0
  98. package/dist/widgets/694.js +2 -0
  99. package/dist/widgets/694.js.map +1 -0
  100. package/dist/widgets/712.js +2 -0
  101. package/dist/widgets/712.js.map +1 -0
  102. package/dist/widgets/866.js +2 -0
  103. package/dist/widgets/866.js.map +1 -0
  104. package/dist/widgets/915.js +39 -0
  105. package/dist/widgets/915.js.map +1 -0
  106. package/dist/widgets/957.js +10 -0
  107. package/dist/widgets/957.js.map +1 -0
  108. package/dist/widgets/983.js +2 -0
  109. package/dist/widgets/983.js.map +1 -0
  110. package/dist/widgets/@mf-types.d.ts +3 -0
  111. package/dist/widgets/@mf-types.zip +0 -0
  112. package/dist/widgets/__federation_expose_CommitOverview.js +2 -0
  113. package/dist/widgets/__federation_expose_CommitOverview.js.map +1 -0
  114. package/dist/widgets/mf-manifest.json +260 -0
  115. package/dist/widgets/mf-stats.json +302 -0
  116. package/dist/widgets/remoteEntry.js +7 -0
  117. package/dist/widgets/remoteEntry.js.map +1 -0
  118. package/package.json +95 -0
package/dist/index.js ADDED
@@ -0,0 +1,916 @@
1
+ import { COMMIT_ENV_VARS, COMMIT_CACHE_PREFIX, COMMIT_ROUTES, COMMIT_BASE_PATH, defaultCommitConfig } from '@kb-labs/commit-contracts';
2
+ import { combinePermissions, gitWorkflowPreset, kbPlatformPreset, defineCommandFlags } from '@kb-labs/sdk';
3
+
4
+ // src/cli/commands/flags.ts
5
+ var generateFlags = {
6
+ scope: {
7
+ type: "string",
8
+ description: "Filter by package name (@kb-labs/core), wildcard (@kb-labs/*), or path pattern (packages/**)",
9
+ alias: "s"
10
+ },
11
+ json: {
12
+ type: "boolean",
13
+ description: "Output JSON",
14
+ default: false
15
+ }
16
+ };
17
+ var applyFlags = {
18
+ force: {
19
+ type: "boolean",
20
+ description: "Apply even if working tree changed",
21
+ default: false,
22
+ alias: "f"
23
+ },
24
+ json: {
25
+ type: "boolean",
26
+ description: "Output JSON",
27
+ default: false
28
+ }
29
+ };
30
+ var pushFlags = {
31
+ force: {
32
+ type: "boolean",
33
+ description: "Force push (dangerous!)",
34
+ default: false,
35
+ alias: "f"
36
+ },
37
+ json: {
38
+ type: "boolean",
39
+ description: "Output JSON",
40
+ default: false
41
+ }
42
+ };
43
+ var runFlags = {
44
+ scope: {
45
+ type: "string",
46
+ description: "Filter by package name (@kb-labs/core), wildcard (@kb-labs/*), or path pattern (packages/**)",
47
+ alias: "s"
48
+ },
49
+ json: {
50
+ type: "boolean",
51
+ description: "Output JSON",
52
+ default: false
53
+ },
54
+ "dry-run": {
55
+ type: "boolean",
56
+ description: "Generate plan only, do not apply",
57
+ default: false
58
+ },
59
+ "with-push": {
60
+ type: "boolean",
61
+ description: "Push after apply",
62
+ default: false
63
+ }
64
+ };
65
+ var jsonOnlyFlags = {
66
+ json: {
67
+ type: "boolean",
68
+ description: "Output JSON",
69
+ default: false
70
+ }
71
+ };
72
+ var emptyFlags = {};
73
+ var COMMIT_DIR = ".kb/commit";
74
+ var setup = {
75
+ files: [
76
+ {
77
+ path: `${COMMIT_DIR}/README.md`,
78
+ content: [
79
+ "# Commit Plugin Workspace",
80
+ "",
81
+ "This directory contains commit plugin data:",
82
+ "",
83
+ "- `current/` - Current commit plan (generated, not committed)",
84
+ "- `history/` - Applied commit plans history",
85
+ "",
86
+ "## Configuration",
87
+ "",
88
+ "Plugin configuration is stored in `kb.config.json` under `plugins.commit`.",
89
+ "",
90
+ "### Environment Variables",
91
+ "",
92
+ "| Variable | Description | Default |",
93
+ "|----------|-------------|---------|",
94
+ "| `KB_COMMIT_LLM_ENABLED` | Enable/disable LLM | `true` |",
95
+ "| `KB_COMMIT_LLM_TEMPERATURE` | LLM temperature (0-1) | `0.3` |",
96
+ "| `KB_COMMIT_LLM_MAX_TOKENS` | Max tokens for LLM | `2000` |",
97
+ "| `KB_COMMIT_STORAGE_DIR` | Storage directory | `.kb/commit` |",
98
+ "| `KB_COMMIT_AUTO_STAGE` | Auto-stage changes | `false` |",
99
+ "",
100
+ "## Commands",
101
+ "",
102
+ "```bash",
103
+ "# Full flow: generate \u2192 apply",
104
+ "kb commit",
105
+ "",
106
+ "# Generate plan only",
107
+ "kb commit:generate",
108
+ "",
109
+ "# Apply current plan",
110
+ "kb commit:apply",
111
+ "",
112
+ "# View current plan",
113
+ "kb commit:open",
114
+ "",
115
+ "# Reset current plan",
116
+ "kb commit:reset",
117
+ "",
118
+ "# Push commits",
119
+ "kb commit:push",
120
+ "```",
121
+ "",
122
+ "Re-run `kb commit setup --force` to regenerate defaults."
123
+ ].join("\n") + "\n",
124
+ description: "README for commit plugin workspace"
125
+ }
126
+ ],
127
+ config: [
128
+ {
129
+ pointer: "plugins.commit",
130
+ value: defaultCommitConfig
131
+ }
132
+ ],
133
+ scripts: [
134
+ {
135
+ name: "commit",
136
+ command: "kb commit",
137
+ description: "Generate and apply commits"
138
+ },
139
+ {
140
+ name: "commit:generate",
141
+ command: "kb commit:generate",
142
+ description: "Generate commit plan from changes"
143
+ }
144
+ ],
145
+ gitignore: [
146
+ ".kb/commit/current/",
147
+ ".kb/commit/history/"
148
+ ],
149
+ notes: [
150
+ "Run `kb commit` to analyze changes and generate commit plan.",
151
+ "Set KB_COMMIT_LLM_ENABLED=false to use heuristics only.",
152
+ "Use `kb commit:open` to view current plan before applying."
153
+ ]
154
+ };
155
+ async function run() {
156
+ return {
157
+ message: "Commit plugin setup completed. Try `kb commit` to generate commits!",
158
+ ...setup
159
+ };
160
+ }
161
+ var pluginPermissions = combinePermissions().with(gitWorkflowPreset).with(kbPlatformPreset).withEnv([...COMMIT_ENV_VARS]).withFs({
162
+ mode: "readWrite",
163
+ allow: [".kb/commit/**"]
164
+ }).withPlatform({
165
+ llm: true,
166
+ // Full LLM access for commit generation
167
+ cache: [COMMIT_CACHE_PREFIX],
168
+ // Cache namespace prefix from contracts
169
+ analytics: true
170
+ // Track commit generation events
171
+ }).withQuotas({
172
+ timeoutMs: 6e5,
173
+ // 10 min for LLM
174
+ memoryMb: 512
175
+ }).build();
176
+ var manifest = {
177
+ schema: "kb.plugin/3",
178
+ id: "@kb-labs/commit",
179
+ version: "0.1.0",
180
+ configSection: "commit",
181
+ display: {
182
+ name: "Commit Generator",
183
+ description: "AI-powered commit generation with conventional commit support.",
184
+ tags: ["commit", "git", "ai", "conventional-commits"]
185
+ },
186
+ // Platform requirements (LLM is optional but preferred)
187
+ platform: {
188
+ requires: ["storage", "cache"],
189
+ optional: ["llm", "analytics", "logger"]
190
+ },
191
+ // TODO: Implement V3 setup handler
192
+ // Setup temporarily disabled during migration - needs proper V3 implementation
193
+ // setup: {
194
+ // handler: './lifecycle/setup.js#default',
195
+ // handlerPath: './lifecycle/setup.js',
196
+ // describe: 'Initialize .kb/commit/ directory structure.',
197
+ // permissions: permissions.combine(
198
+ // permissions.presets.pluginWorkspace('commit'),
199
+ // {
200
+ // quotas: { timeoutMs: 10000, memoryMb: 128, cpuMs: 3000 },
201
+ // }
202
+ // ),
203
+ // },
204
+ // V3: cli wrapper with commands array
205
+ cli: {
206
+ commands: [
207
+ // Main command: commit (default flow)
208
+ {
209
+ id: "commit:commit",
210
+ // ✅ With plugin prefix
211
+ group: "commit",
212
+ describe: "Generate and apply commits (default flow).",
213
+ longDescription: "Analyzes changes, generates commit plan with LLM, applies commits locally. Use --dry-run to preview without applying, --with-push to push after applying.",
214
+ // ✅ V3: handler with #default suffix
215
+ handler: "./cli/commands/run.js#default",
216
+ handlerPath: "./cli/commands/run.js",
217
+ flags: defineCommandFlags(runFlags),
218
+ examples: [
219
+ "kb commit commit",
220
+ "kb commit commit --dry-run",
221
+ "kb commit commit --with-push",
222
+ 'kb commit commit --scope "src/components/**"'
223
+ ]
224
+ },
225
+ // commit:generate - Generate commit plan
226
+ {
227
+ id: "commit:generate",
228
+ group: "commit",
229
+ describe: "Generate commit plan from git changes.",
230
+ longDescription: "Analyzes staged and unstaged changes using git diff, then uses LLM to group related changes and generate conventional commit messages.",
231
+ handler: "./cli/commands/generate.js#default",
232
+ handlerPath: "./cli/commands/generate.js",
233
+ flags: defineCommandFlags(generateFlags),
234
+ examples: [
235
+ "kb commit generate",
236
+ "kb commit generate --json",
237
+ 'kb commit generate --scope "packages/**"'
238
+ ]
239
+ },
240
+ // commit:apply - Apply commit plan
241
+ {
242
+ id: "commit:apply",
243
+ group: "commit",
244
+ describe: "Apply current commit plan (create local commits).",
245
+ longDescription: "Creates git commits according to the current plan. Checks for staleness (working tree changes since plan generation) unless --force is used.",
246
+ handler: "./cli/commands/apply.js#default",
247
+ handlerPath: "./cli/commands/apply.js",
248
+ flags: defineCommandFlags(applyFlags),
249
+ examples: [
250
+ "kb commit apply",
251
+ "kb commit apply --force"
252
+ ]
253
+ },
254
+ // commit:push - Push commits
255
+ {
256
+ id: "commit:push",
257
+ group: "commit",
258
+ describe: "Push commits to remote repository.",
259
+ longDescription: "Pushes local commits to the remote. Refuses force push to protected branches (main, master) by default.",
260
+ handler: "./cli/commands/push.js#default",
261
+ handlerPath: "./cli/commands/push.js",
262
+ flags: defineCommandFlags(pushFlags),
263
+ examples: [
264
+ "kb commit push"
265
+ ]
266
+ },
267
+ // commit:open - Show current plan
268
+ {
269
+ id: "commit:open",
270
+ group: "commit",
271
+ describe: "Show current commit plan.",
272
+ longDescription: "Displays the current commit plan if one exists.",
273
+ handler: "./cli/commands/open.js#default",
274
+ handlerPath: "./cli/commands/open.js",
275
+ flags: defineCommandFlags(jsonOnlyFlags),
276
+ examples: [
277
+ "kb commit open",
278
+ "kb commit open --json"
279
+ ]
280
+ },
281
+ // commit:reset - Clear current plan
282
+ {
283
+ id: "commit:reset",
284
+ group: "commit",
285
+ describe: "Clear current commit plan.",
286
+ longDescription: "Removes the current commit plan from storage.",
287
+ handler: "./cli/commands/reset.js#default",
288
+ handlerPath: "./cli/commands/reset.js",
289
+ flags: defineCommandFlags(emptyFlags),
290
+ examples: [
291
+ "kb commit reset"
292
+ ]
293
+ }
294
+ ]
295
+ },
296
+ capabilities: [],
297
+ // ✅ V3: Manifest-first permissions using composable presets
298
+ permissions: pluginPermissions,
299
+ // REST API routes (inherit permissions from manifest)
300
+ rest: {
301
+ basePath: COMMIT_BASE_PATH,
302
+ routes: [
303
+ // GET /scopes
304
+ {
305
+ method: "GET",
306
+ path: COMMIT_ROUTES.SCOPES,
307
+ handler: "./rest/handlers/scopes-handler.js#default",
308
+ output: {
309
+ zod: "@kb-labs/sdk#SelectDataSchema"
310
+ }
311
+ },
312
+ // GET /status
313
+ {
314
+ method: "GET",
315
+ path: COMMIT_ROUTES.STATUS,
316
+ handler: "./rest/handlers/status-handler.js#default",
317
+ output: {
318
+ zod: "@kb-labs/commit-contracts#StatusResponseSchema"
319
+ }
320
+ },
321
+ // POST /generate
322
+ {
323
+ method: "POST",
324
+ path: COMMIT_ROUTES.GENERATE,
325
+ handler: "./rest/handlers/generate-handler.js#default",
326
+ input: {
327
+ zod: "@kb-labs/commit-contracts#GenerateRequestSchema"
328
+ },
329
+ output: {
330
+ zod: "@kb-labs/commit-contracts#GenerateResponseSchema"
331
+ },
332
+ timeoutMs: 3e5
333
+ // 5 minutes for LLM analysis
334
+ },
335
+ // GET /plan
336
+ {
337
+ method: "GET",
338
+ path: COMMIT_ROUTES.PLAN,
339
+ handler: "./rest/handlers/plan-handler.js#default",
340
+ output: {
341
+ zod: "@kb-labs/commit-contracts#PlanResponseSchema"
342
+ }
343
+ },
344
+ // POST /apply
345
+ {
346
+ method: "POST",
347
+ path: COMMIT_ROUTES.APPLY,
348
+ handler: "./rest/handlers/apply-handler.js#default",
349
+ input: {
350
+ zod: "@kb-labs/commit-contracts#ApplyRequestSchema"
351
+ },
352
+ output: {
353
+ zod: "@kb-labs/commit-contracts#ApplyResponseSchema"
354
+ },
355
+ timeoutMs: 6e5
356
+ // 10 min for pre/post hooks
357
+ },
358
+ // POST /push
359
+ {
360
+ method: "POST",
361
+ path: COMMIT_ROUTES.PUSH,
362
+ handler: "./rest/handlers/push-handler.js#default",
363
+ input: {
364
+ zod: "@kb-labs/commit-contracts#PushRequestSchema"
365
+ },
366
+ output: {
367
+ zod: "@kb-labs/commit-contracts#PushResponseSchema"
368
+ },
369
+ timeoutMs: 6e5
370
+ // 10 min for pre/post push hooks
371
+ },
372
+ // DELETE /plan
373
+ {
374
+ method: "DELETE",
375
+ path: COMMIT_ROUTES.RESET,
376
+ handler: "./rest/handlers/reset-handler.js#default",
377
+ output: {
378
+ zod: "@kb-labs/commit-contracts#ResetResponseSchema"
379
+ }
380
+ },
381
+ // GET /git-status
382
+ {
383
+ method: "GET",
384
+ path: COMMIT_ROUTES.GIT_STATUS,
385
+ handler: "./rest/handlers/git-status-handler.js#default",
386
+ output: {
387
+ zod: "@kb-labs/commit-contracts#GitStatusResponseSchema"
388
+ }
389
+ },
390
+ // GET /files
391
+ {
392
+ method: "GET",
393
+ path: COMMIT_ROUTES.FILES,
394
+ handler: "./rest/handlers/files-handler.js#default"
395
+ },
396
+ // GET /diff
397
+ {
398
+ method: "GET",
399
+ path: COMMIT_ROUTES.DIFF,
400
+ handler: "./rest/handlers/diff-handler.js#default",
401
+ output: {
402
+ zod: "@kb-labs/commit-contracts#FileDiffResponseSchema"
403
+ }
404
+ },
405
+ // POST /summarize
406
+ {
407
+ method: "POST",
408
+ path: COMMIT_ROUTES.SUMMARIZE,
409
+ handler: "./rest/handlers/summarize-handler.js#default",
410
+ input: {
411
+ zod: "@kb-labs/commit-contracts#SummarizeRequestSchema"
412
+ },
413
+ output: {
414
+ zod: "@kb-labs/commit-contracts#SummarizeResponseSchema"
415
+ }
416
+ },
417
+ // GET /actions
418
+ {
419
+ method: "GET",
420
+ path: COMMIT_ROUTES.ACTIONS,
421
+ handler: "./rest/handlers/actions-handler.js#default",
422
+ output: {
423
+ zod: "@kb-labs/commit-contracts#ActionsResponseSchema"
424
+ }
425
+ },
426
+ // PATCH /plan — edit a single commit in the plan
427
+ {
428
+ method: "PATCH",
429
+ path: COMMIT_ROUTES.PATCH_PLAN,
430
+ handler: "./rest/handlers/patch-plan-handler.js#default",
431
+ input: {
432
+ zod: "@kb-labs/commit-contracts#PatchPlanRequestSchema"
433
+ },
434
+ output: {
435
+ zod: "@kb-labs/commit-contracts#PatchPlanResponseSchema"
436
+ }
437
+ },
438
+ // POST /regenerate-commit — regenerate a single commit with LLM
439
+ {
440
+ method: "POST",
441
+ path: COMMIT_ROUTES.REGENERATE_COMMIT,
442
+ handler: "./rest/handlers/regenerate-handler.js#default",
443
+ input: {
444
+ zod: "@kb-labs/commit-contracts#RegenerateCommitRequestSchema"
445
+ },
446
+ output: {
447
+ zod: "@kb-labs/commit-contracts#RegenerateCommitResponseSchema"
448
+ },
449
+ timeoutMs: 3e5
450
+ // 5 minutes for LLM analysis
451
+ }
452
+ ]
453
+ },
454
+ // Studio V2 — Module Federation pages
455
+ studio: {
456
+ version: 2,
457
+ remoteName: "commitPlugin",
458
+ pages: [
459
+ {
460
+ id: "commit.overview",
461
+ title: "Commit",
462
+ icon: "GitlabOutlined",
463
+ route: "/p/commit",
464
+ entry: "./CommitOverview",
465
+ order: 1
466
+ }
467
+ ],
468
+ menus: [
469
+ {
470
+ id: "commit",
471
+ label: "Commit",
472
+ icon: "GitlabOutlined",
473
+ target: "commit.overview",
474
+ order: 30
475
+ }
476
+ ]
477
+ },
478
+ // Legacy V1 studio widgets (deleted)
479
+ /*
480
+ _legacy_studio: {
481
+ widgets: [
482
+ // Workspace Selector
483
+ {
484
+ id: 'commit.workspace-selector',
485
+ kind: 'select',
486
+ title: 'Select Scope',
487
+ description: 'Choose monorepo package or repository',
488
+ data: {
489
+ source: {
490
+ type: 'rest',
491
+ routeId: COMMIT_WIDGET_ROUTES.SCOPES,
492
+ method: 'GET',
493
+ },
494
+ },
495
+ options: {
496
+ searchable: true,
497
+ placeholder: 'Select scope...',
498
+ },
499
+ events: {
500
+ emit: [{
501
+ name: COMMIT_EVENTS.SCOPE_CHANGED,
502
+ payloadMap: { scope: 'value' }, // Maps selected value to payload.scope
503
+ }],
504
+ },
505
+ layoutHint: { w: 6, h: 1, minH: 1 },
506
+ order: 0,
507
+ },
508
+ // Status Metrics
509
+ {
510
+ id: 'commit.status',
511
+ kind: 'metric-group',
512
+ title: 'Commit Status',
513
+ description: 'Current plan and git status',
514
+ data: {
515
+ source: {
516
+ type: 'rest',
517
+ routeId: COMMIT_WIDGET_ROUTES.STATUS,
518
+ method: 'GET',
519
+ },
520
+ },
521
+ events: {
522
+ subscribe: [
523
+ {
524
+ name: COMMIT_EVENTS.SCOPE_CHANGED,
525
+ paramsMap: { scope: 'scope' }, // Maps payload.workspace to params.workspace
526
+ },
527
+ COMMIT_EVENTS.FORM_SUBMITTED,
528
+ ],
529
+ },
530
+ layoutHint: { w: 6, h: 2, minH: 2 },
531
+ order: 1,
532
+ },
533
+ // Plan Viewer (child of commit.plan-section)
534
+ {
535
+ id: 'commit.plan-viewer',
536
+ kind: 'cardlist',
537
+ title: '', // Title shown in parent section
538
+ description: '',
539
+ data: {
540
+ source: {
541
+ type: 'rest',
542
+ routeId: COMMIT_WIDGET_ROUTES.PLAN,
543
+ method: 'GET',
544
+ },
545
+ },
546
+ options: {
547
+ layout: 'list',
548
+ emptyMessage: 'No plan. Click Generate Plan to create commits.',
549
+ },
550
+ events: {
551
+ subscribe: [
552
+ {
553
+ name: COMMIT_EVENTS.SCOPE_CHANGED,
554
+ paramsMap: { scope: 'scope' },
555
+ },
556
+ {
557
+ name: COMMIT_EVENTS.PLAN_GENERATED,
558
+ // When plan is generated, update widget data with cards
559
+ // No paramsMap - use entire payload as widget data
560
+ },
561
+ COMMIT_EVENTS.FORM_SUBMITTED,
562
+ ],
563
+ },
564
+ order: 2,
565
+ },
566
+ // Git Files Table (child of commit.files-section)
567
+ {
568
+ id: 'commit.git-files',
569
+ kind: 'table',
570
+ title: '', // Title shown in parent section
571
+ description: '',
572
+ data: {
573
+ source: {
574
+ type: 'rest',
575
+ routeId: COMMIT_WIDGET_ROUTES.FILES,
576
+ method: 'GET',
577
+ },
578
+ },
579
+ options: {
580
+ columns: [
581
+ {
582
+ id: 'path',
583
+ label: 'File',
584
+ sortable: true,
585
+ width: '60%',
586
+ },
587
+ {
588
+ id: 'status',
589
+ label: 'Status',
590
+ sortable: true,
591
+ width: 80,
592
+ },
593
+ {
594
+ id: 'changes',
595
+ label: 'Changes',
596
+ sortable: false,
597
+ width: 120,
598
+ },
599
+ ],
600
+ pagination: false,
601
+ rowSelection: false,
602
+ size: 'small',
603
+ },
604
+ events: {
605
+ subscribe: [{
606
+ name: COMMIT_EVENTS.SCOPE_CHANGED,
607
+ paramsMap: { scope: 'scope' },
608
+ }],
609
+ },
610
+ order: 3,
611
+ },
612
+ // Quick Actions Widget
613
+ {
614
+ id: 'commit.actions',
615
+ kind: 'card',
616
+ title: 'Quick Actions',
617
+ description: 'Common commit workflow actions',
618
+ data: {
619
+ source: {
620
+ type: 'rest',
621
+ routeId: COMMIT_WIDGET_ROUTES.ACTIONS,
622
+ method: 'GET',
623
+ },
624
+ },
625
+ events: {
626
+ subscribe: [{
627
+ name: COMMIT_EVENTS.SCOPE_CHANGED,
628
+ paramsMap: { scope: 'scope' },
629
+ }],
630
+ },
631
+ actions: [
632
+ {
633
+ id: 'generate',
634
+ label: 'Generate Plan',
635
+ icon: 'ThunderboltOutlined',
636
+ variant: 'primary',
637
+ handler: {
638
+ type: 'rest',
639
+ routeId: COMMIT_WIDGET_ROUTES.GENERATE,
640
+ method: 'POST',
641
+ bodyMap: { scope: 'scope' },
642
+ onSuccess: {
643
+ emitEvent: COMMIT_EVENTS.PLAN_GENERATED,
644
+ // Response data will be used as payload (contains plan + workspace)
645
+ },
646
+ },
647
+ },
648
+ {
649
+ id: 'apply',
650
+ label: 'Apply Commits',
651
+ icon: 'CheckOutlined',
652
+ variant: 'default',
653
+ handler: {
654
+ type: 'rest',
655
+ routeId: COMMIT_WIDGET_ROUTES.APPLY,
656
+ method: 'POST',
657
+ bodyMap: { scope: 'scope' },
658
+ },
659
+ confirm: {
660
+ title: 'Apply Commits',
661
+ description: 'This will create git commits according to the plan. Continue?',
662
+ confirmLabel: 'Apply',
663
+ cancelLabel: 'Cancel',
664
+ },
665
+ },
666
+ {
667
+ id: 'push',
668
+ label: 'Push',
669
+ icon: 'UploadOutlined',
670
+ handler: {
671
+ type: 'rest',
672
+ routeId: COMMIT_WIDGET_ROUTES.PUSH,
673
+ method: 'POST',
674
+ bodyMap: { scope: 'scope' },
675
+ },
676
+ confirm: {
677
+ title: 'Push to Remote',
678
+ description: 'This will push commits to the remote repository. Continue?',
679
+ confirmLabel: 'Push',
680
+ cancelLabel: 'Cancel',
681
+ },
682
+ },
683
+ ],
684
+ layoutHint: { w: 6, h: 3, minH: 2 },
685
+ order: 6,
686
+ },
687
+ // Files Section (collapsible, GitLab-style)
688
+ {
689
+ id: 'commit.files-section',
690
+ kind: 'section',
691
+ title: 'Changed Files',
692
+ description: 'Files with uncommitted changes',
693
+ data: {
694
+ source: { type: 'static' }, // Sections use static source (no data)
695
+ },
696
+ options: {
697
+ collapsible: true,
698
+ defaultExpanded: true,
699
+ variant: 'bordered',
700
+ icon: 'FolderOutlined',
701
+ showDivider: true,
702
+ },
703
+ children: ['commit.git-files'],
704
+ events: {
705
+ subscribe: [{
706
+ name: COMMIT_EVENTS.SCOPE_CHANGED,
707
+ paramsMap: { scope: 'scope' },
708
+ }],
709
+ },
710
+ layoutHint: { w: 6, h: 8, minH: 4 },
711
+ order: 4,
712
+ },
713
+ // Plan Section (collapsible, GitLab-style)
714
+ {
715
+ id: 'commit.plan-section',
716
+ kind: 'section',
717
+ title: 'Commit Plan',
718
+ description: 'Generated commits ready to apply',
719
+ data: {
720
+ source: { type: 'static' }, // Sections use static source (no data)
721
+ },
722
+ options: {
723
+ collapsible: true,
724
+ defaultExpanded: true,
725
+ variant: 'bordered',
726
+ icon: 'FileTextOutlined',
727
+ showDivider: true,
728
+ },
729
+ children: ['commit.plan-viewer'],
730
+ events: {
731
+ subscribe: [
732
+ {
733
+ name: COMMIT_EVENTS.SCOPE_CHANGED,
734
+ paramsMap: { scope: 'scope' },
735
+ },
736
+ COMMIT_EVENTS.FORM_SUBMITTED,
737
+ ],
738
+ },
739
+ layoutHint: { w: 6, h: 8, minH: 4 },
740
+ order: 5,
741
+ },
742
+ ],
743
+ // Studio menus
744
+ menus: [
745
+ {
746
+ id: 'commit-menu',
747
+ label: 'Commit',
748
+ icon: 'GitlabOutlined',
749
+ target: '/plugins/commit/overview',
750
+ order: 0,
751
+ },
752
+ {
753
+ id: 'commit-overview',
754
+ label: 'Overview',
755
+ icon: 'DashboardOutlined',
756
+ parentId: 'commit-menu',
757
+ target: '/plugins/commit/overview',
758
+ order: 1,
759
+ },
760
+ {
761
+ id: 'commit-plan',
762
+ label: 'Plan',
763
+ icon: 'UnorderedListOutlined',
764
+ parentId: 'commit-menu',
765
+ target: '/plugins/commit/plan',
766
+ order: 2,
767
+ },
768
+ {
769
+ id: 'commit-files',
770
+ label: 'Files',
771
+ icon: 'FileTextOutlined',
772
+ parentId: 'commit-menu',
773
+ target: '/plugins/commit/files',
774
+ order: 3,
775
+ },
776
+ ],
777
+ // Studio layouts
778
+ layouts: [
779
+ // Overview page - Quick status and actions
780
+ {
781
+ id: 'commit.overview',
782
+ kind: 'grid',
783
+ title: 'Overview',
784
+ description: 'Workspace status and quick actions',
785
+ icon: 'home',
786
+ widgets: [
787
+ 'commit.workspace-selector',
788
+ 'commit.status',
789
+ 'commit.actions',
790
+ 'commit.plan-section', // Show plan section on overview too
791
+ ],
792
+ config: {
793
+ cols: 6,
794
+ gap: 16,
795
+ },
796
+ order: 1,
797
+ },
798
+ // Plan page - GitLab-style commit plan view
799
+ {
800
+ id: 'commit.plan',
801
+ kind: 'grid',
802
+ title: 'Commit Plan',
803
+ description: 'Review and manage generated commits',
804
+ icon: 'list',
805
+ widgets: [
806
+ 'commit.workspace-selector',
807
+ 'commit.files-section',
808
+ 'commit.plan-section',
809
+ ],
810
+ actions: [
811
+ {
812
+ id: 'generate',
813
+ label: 'Generate Plan',
814
+ icon: 'ThunderboltOutlined',
815
+ variant: 'primary',
816
+ handler: {
817
+ type: 'rest',
818
+ routeId: COMMIT_WIDGET_ROUTES.GENERATE,
819
+ method: 'POST',
820
+ },
821
+ },
822
+ {
823
+ id: 'apply',
824
+ label: 'Apply Commits',
825
+ icon: 'CheckOutlined',
826
+ variant: 'default',
827
+ handler: {
828
+ type: 'rest',
829
+ routeId: COMMIT_WIDGET_ROUTES.APPLY,
830
+ method: 'POST',
831
+ },
832
+ confirm: {
833
+ title: 'Apply Commits',
834
+ description: 'This will create git commits according to the plan. Continue?',
835
+ confirmLabel: 'Apply',
836
+ cancelLabel: 'Cancel',
837
+ },
838
+ },
839
+ {
840
+ id: 'push',
841
+ label: 'Push',
842
+ icon: 'UploadOutlined',
843
+ handler: {
844
+ type: 'rest',
845
+ routeId: COMMIT_WIDGET_ROUTES.PUSH,
846
+ method: 'POST',
847
+ },
848
+ confirm: {
849
+ title: 'Push to Remote',
850
+ description: 'This will push commits to the remote repository. Continue?',
851
+ confirmLabel: 'Push',
852
+ cancelLabel: 'Cancel',
853
+ },
854
+ },
855
+ {
856
+ id: 'reset',
857
+ label: 'Reset Plan',
858
+ icon: 'DeleteOutlined',
859
+ variant: 'danger',
860
+ handler: {
861
+ type: 'rest',
862
+ routeId: COMMIT_WIDGET_ROUTES.RESET,
863
+ method: 'DELETE',
864
+ },
865
+ confirm: {
866
+ title: 'Reset Plan',
867
+ description: 'This will delete the current commit plan. This action cannot be undone.',
868
+ confirmLabel: 'Delete',
869
+ cancelLabel: 'Cancel',
870
+ },
871
+ },
872
+ ],
873
+ config: {
874
+ cols: 6,
875
+ gap: 16,
876
+ },
877
+ order: 2,
878
+ },
879
+ // Files page - Changed files table
880
+ {
881
+ id: 'commit.files',
882
+ kind: 'grid',
883
+ title: 'Changed Files',
884
+ description: 'Git status and modified files',
885
+ icon: 'file',
886
+ widgets: [
887
+ 'commit.workspace-selector',
888
+ 'commit.git-files',
889
+ ],
890
+ config: {
891
+ cols: 6,
892
+ gap: 16,
893
+ },
894
+ order: 3,
895
+ },
896
+ ],
897
+ },
898
+ */
899
+ // Artifacts
900
+ artifacts: [
901
+ {
902
+ id: "commit.plan.json",
903
+ pathTemplate: ".kb/commit/current/plan.json",
904
+ description: "Current commit plan."
905
+ },
906
+ {
907
+ id: "commit.status.json",
908
+ pathTemplate: ".kb/commit/current/status.json",
909
+ description: "Git status snapshot at plan generation time."
910
+ }
911
+ ]
912
+ };
913
+
914
+ export { applyFlags, emptyFlags, generateFlags, jsonOnlyFlags, manifest, pushFlags, runFlags, run as setup };
915
+ //# sourceMappingURL=index.js.map
916
+ //# sourceMappingURL=index.js.map