@kb-labs/release-manager-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 (133) hide show
  1. package/README.md +211 -0
  2. package/dist/cli/commands/changelog.d.ts +17 -0
  3. package/dist/cli/commands/changelog.js +156 -0
  4. package/dist/cli/commands/changelog.js.map +1 -0
  5. package/dist/cli/commands/plan.d.ts +12 -0
  6. package/dist/cli/commands/plan.js +117 -0
  7. package/dist/cli/commands/plan.js.map +1 -0
  8. package/dist/cli/commands/publish.d.ts +15 -0
  9. package/dist/cli/commands/publish.js +486 -0
  10. package/dist/cli/commands/publish.js.map +1 -0
  11. package/dist/cli/commands/report.d.ts +9 -0
  12. package/dist/cli/commands/report.js +77 -0
  13. package/dist/cli/commands/report.js.map +1 -0
  14. package/dist/cli/commands/rollback.d.ts +9 -0
  15. package/dist/cli/commands/rollback.js +42 -0
  16. package/dist/cli/commands/rollback.js.map +1 -0
  17. package/dist/cli/commands/run.d.ts +16 -0
  18. package/dist/cli/commands/run.js +539 -0
  19. package/dist/cli/commands/run.js.map +1 -0
  20. package/dist/cli/commands/verify.d.ts +14 -0
  21. package/dist/cli/commands/verify.js +106 -0
  22. package/dist/cli/commands/verify.js.map +1 -0
  23. package/dist/contracts/release.schema.d.ts +503 -0
  24. package/dist/contracts/release.schema.js +45 -0
  25. package/dist/contracts/release.schema.js.map +1 -0
  26. package/dist/index.d.ts +76 -0
  27. package/dist/index.js +689 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/manifest.d.ts +292 -0
  30. package/dist/manifest.js +604 -0
  31. package/dist/manifest.js.map +1 -0
  32. package/dist/rest/handlers/build-handler.d.ts +20 -0
  33. package/dist/rest/handlers/build-handler.js +68 -0
  34. package/dist/rest/handlers/build-handler.js.map +1 -0
  35. package/dist/rest/handlers/changelog-generate-handler.d.ts +20 -0
  36. package/dist/rest/handlers/changelog-generate-handler.js +169 -0
  37. package/dist/rest/handlers/changelog-generate-handler.js.map +1 -0
  38. package/dist/rest/handlers/changelog-handler.d.ts +16 -0
  39. package/dist/rest/handlers/changelog-handler.js +50 -0
  40. package/dist/rest/handlers/changelog-handler.js.map +1 -0
  41. package/dist/rest/handlers/changelog-save-handler.d.ts +13 -0
  42. package/dist/rest/handlers/changelog-save-handler.js +42 -0
  43. package/dist/rest/handlers/changelog-save-handler.js.map +1 -0
  44. package/dist/rest/handlers/checklist-handler.d.ts +39 -0
  45. package/dist/rest/handlers/checklist-handler.js +155 -0
  46. package/dist/rest/handlers/checklist-handler.js.map +1 -0
  47. package/dist/rest/handlers/generate-handler.d.ts +35 -0
  48. package/dist/rest/handlers/generate-handler.js +206 -0
  49. package/dist/rest/handlers/generate-handler.js.map +1 -0
  50. package/dist/rest/handlers/get-checks-handler.d.ts +15 -0
  51. package/dist/rest/handlers/get-checks-handler.js +22 -0
  52. package/dist/rest/handlers/get-checks-handler.js.map +1 -0
  53. package/dist/rest/handlers/git-timeline-handler.d.ts +26 -0
  54. package/dist/rest/handlers/git-timeline-handler.js +209 -0
  55. package/dist/rest/handlers/git-timeline-handler.js.map +1 -0
  56. package/dist/rest/handlers/history-changelog-handler.d.ts +14 -0
  57. package/dist/rest/handlers/history-changelog-handler.js +34 -0
  58. package/dist/rest/handlers/history-changelog-handler.js.map +1 -0
  59. package/dist/rest/handlers/history-handler.d.ts +20 -0
  60. package/dist/rest/handlers/history-handler.js +75 -0
  61. package/dist/rest/handlers/history-handler.js.map +1 -0
  62. package/dist/rest/handlers/history-plan-handler.d.ts +30 -0
  63. package/dist/rest/handlers/history-plan-handler.js +34 -0
  64. package/dist/rest/handlers/history-plan-handler.js.map +1 -0
  65. package/dist/rest/handlers/history-report-handler.d.ts +64 -0
  66. package/dist/rest/handlers/history-report-handler.js +34 -0
  67. package/dist/rest/handlers/history-report-handler.js.map +1 -0
  68. package/dist/rest/handlers/plan-handler.d.ts +29 -0
  69. package/dist/rest/handlers/plan-handler.js +75 -0
  70. package/dist/rest/handlers/plan-handler.js.map +1 -0
  71. package/dist/rest/handlers/preview-handler.d.ts +26 -0
  72. package/dist/rest/handlers/preview-handler.js +127 -0
  73. package/dist/rest/handlers/preview-handler.js.map +1 -0
  74. package/dist/rest/handlers/report-handler.d.ts +65 -0
  75. package/dist/rest/handlers/report-handler.js +48 -0
  76. package/dist/rest/handlers/report-handler.js.map +1 -0
  77. package/dist/rest/handlers/reset-handler.d.ts +12 -0
  78. package/dist/rest/handlers/reset-handler.js +38 -0
  79. package/dist/rest/handlers/reset-handler.js.map +1 -0
  80. package/dist/rest/handlers/run-checks-handler.d.ts +20 -0
  81. package/dist/rest/handlers/run-checks-handler.js +58 -0
  82. package/dist/rest/handlers/run-checks-handler.js.map +1 -0
  83. package/dist/rest/handlers/run-handler.d.ts +68 -0
  84. package/dist/rest/handlers/run-handler.js +274 -0
  85. package/dist/rest/handlers/run-handler.js.map +1 -0
  86. package/dist/rest/handlers/scopes-handler.d.ts +20 -0
  87. package/dist/rest/handlers/scopes-handler.js +63 -0
  88. package/dist/rest/handlers/scopes-handler.js.map +1 -0
  89. package/dist/rest/handlers/status-handler.d.ts +24 -0
  90. package/dist/rest/handlers/status-handler.js +120 -0
  91. package/dist/rest/handlers/status-handler.js.map +1 -0
  92. package/dist/setup/handler.d.ts +19 -0
  93. package/dist/setup/handler.js +103 -0
  94. package/dist/setup/handler.js.map +1 -0
  95. package/dist/widgets/220.js +446 -0
  96. package/dist/widgets/220.js.map +1 -0
  97. package/dist/widgets/331.js +2 -0
  98. package/dist/widgets/331.js.map +1 -0
  99. package/dist/widgets/403.js +2 -0
  100. package/dist/widgets/403.js.map +1 -0
  101. package/dist/widgets/406.js +35 -0
  102. package/dist/widgets/406.js.map +1 -0
  103. package/dist/widgets/455.js +2 -0
  104. package/dist/widgets/455.js.map +1 -0
  105. package/dist/widgets/482.js +2 -0
  106. package/dist/widgets/482.js.map +1 -0
  107. package/dist/widgets/485.js +2 -0
  108. package/dist/widgets/485.js.map +1 -0
  109. package/dist/widgets/527.js +2 -0
  110. package/dist/widgets/527.js.map +1 -0
  111. package/dist/widgets/628.js +2 -0
  112. package/dist/widgets/628.js.map +1 -0
  113. package/dist/widgets/694.js +2 -0
  114. package/dist/widgets/694.js.map +1 -0
  115. package/dist/widgets/712.js +2 -0
  116. package/dist/widgets/712.js.map +1 -0
  117. package/dist/widgets/866.js +2 -0
  118. package/dist/widgets/866.js.map +1 -0
  119. package/dist/widgets/915.js +39 -0
  120. package/dist/widgets/915.js.map +1 -0
  121. package/dist/widgets/957.js +10 -0
  122. package/dist/widgets/957.js.map +1 -0
  123. package/dist/widgets/983.js +2 -0
  124. package/dist/widgets/983.js.map +1 -0
  125. package/dist/widgets/@mf-types.d.ts +3 -0
  126. package/dist/widgets/@mf-types.zip +0 -0
  127. package/dist/widgets/__federation_expose_ReleasePage.js +2 -0
  128. package/dist/widgets/__federation_expose_ReleasePage.js.map +1 -0
  129. package/dist/widgets/mf-manifest.json +260 -0
  130. package/dist/widgets/mf-stats.json +302 -0
  131. package/dist/widgets/remoteEntry.js +7 -0
  132. package/dist/widgets/remoteEntry.js.map +1 -0
  133. package/package.json +81 -0
package/dist/index.js ADDED
@@ -0,0 +1,689 @@
1
+ import { combinePermissions, gitWorkflowPreset, kbPlatformPreset, npmPublishPreset, ciEnvironmentPreset, defineCommandFlags } from '@kb-labs/sdk';
2
+ export { findRepoRoot } from '@kb-labs/sdk';
3
+ import { RELEASE_CACHE_PREFIX, RELEASE_ROUTES, RELEASE_BASE_PATH } from '@kb-labs/release-manager-contracts';
4
+ import { join } from 'path';
5
+ import { readFile } from 'fs/promises';
6
+ import globby from 'globby';
7
+
8
+ // src/manifest.ts
9
+ var pluginPermissions = combinePermissions().with(gitWorkflowPreset).with(kbPlatformPreset).with(npmPublishPreset).with(ciEnvironmentPreset).withEnv(["KB_RELEASE_*", "NODE_ENV"]).withFs({
10
+ mode: "readWrite",
11
+ allow: [
12
+ ".kb/release/**",
13
+ "package.json",
14
+ "**/package.json",
15
+ "pnpm-workspace.yaml",
16
+ "**/*.yml",
17
+ "**/*.yaml",
18
+ "CHANGELOG.md",
19
+ "**/CHANGELOG.md"
20
+ ]
21
+ // Note: deny patterns (*.key, *.secret, node_modules) are enforced by platform
22
+ }).withShell({
23
+ allow: ["git", "npm"]
24
+ // git: timeline/tagging/commits, npm: publish packages
25
+ }).withPlatform({
26
+ cache: [RELEASE_CACHE_PREFIX],
27
+ // Cache namespace prefix for plan/changelog caching
28
+ llm: true,
29
+ // LLM for changelog generation
30
+ analytics: true
31
+ // Track release events
32
+ }).withQuotas({
33
+ timeoutMs: 6e5,
34
+ // 10 min for complex releases
35
+ memoryMb: 2048,
36
+ cpuMs: 3e5
37
+ // 5 min CPU time
38
+ }).build();
39
+ var manifest = {
40
+ schema: "kb.plugin/3",
41
+ id: "@kb-labs/release",
42
+ version: "0.1.0",
43
+ display: {
44
+ name: "Release Manager",
45
+ description: "Plan, execute, and audit releases across your workspace.",
46
+ tags: ["release", "publish", "versioning"]
47
+ },
48
+ // Platform requirements
49
+ platform: {
50
+ requires: ["storage", "cache"],
51
+ // cache required for plan/changelog caching
52
+ optional: ["llm", "analytics", "logger"]
53
+ },
54
+ // Setup handler - V3 pattern
55
+ setup: {
56
+ handler: "./setup/handler.js#default",
57
+ handlerPath: "./setup/handler.js",
58
+ describe: "Prepare the .kb/release workspace (plans, reports, backups)."
59
+ },
60
+ // CLI commands - V3 format
61
+ cli: {
62
+ commands: [
63
+ // release:plan - Analyze changes and prepare release plan
64
+ {
65
+ id: "release:plan",
66
+ group: "release",
67
+ describe: "Analyze changes and prepare release plan",
68
+ longDescription: "Detect modified packages and compute version bumps based on changes",
69
+ handler: "./cli/commands/plan.js#default",
70
+ handlerPath: "./cli/commands/plan.js",
71
+ flags: defineCommandFlags({
72
+ scope: { type: "string", description: "Package scope (glob pattern)" },
73
+ bump: {
74
+ type: "string",
75
+ choices: ["patch", "minor", "major", "auto"],
76
+ default: "auto",
77
+ description: "Version bump strategy"
78
+ },
79
+ json: { type: "boolean", description: "Print plan as JSON" }
80
+ }),
81
+ examples: [
82
+ "kb release plan",
83
+ "kb release plan --scope packages/*",
84
+ "kb release plan --bump minor",
85
+ "kb release plan --json"
86
+ ]
87
+ },
88
+ // release:run - Execute release process
89
+ {
90
+ id: "release:run",
91
+ group: "release",
92
+ describe: "Execute release process (plan, check, publish)",
93
+ longDescription: "Run full release: plan versions, run checks, publish packages",
94
+ handler: "./cli/commands/run.js#default",
95
+ handlerPath: "./cli/commands/run.js",
96
+ flags: defineCommandFlags({
97
+ scope: { type: "string", description: "Package scope (glob pattern)" },
98
+ strict: { type: "boolean", description: "Fail on any check failure" },
99
+ "dry-run": { type: "boolean", description: "Simulate release without publishing" },
100
+ "skip-checks": { type: "boolean", description: "Skip pre-release checks" },
101
+ json: { type: "boolean", description: "Print result as JSON" }
102
+ }),
103
+ examples: [
104
+ "kb release run",
105
+ "kb release run --dry-run",
106
+ "kb release run --strict --json",
107
+ "kb release run --scope packages/core"
108
+ ]
109
+ },
110
+ // release:publish - Publish packages to npm
111
+ {
112
+ id: "release:publish",
113
+ group: "release",
114
+ describe: "Publish packages to npm registry with interactive OTP",
115
+ longDescription: "Smart npm publish with interactive 2FA support and better UX",
116
+ handler: "./cli/commands/publish.js#default",
117
+ handlerPath: "./cli/commands/publish.js",
118
+ flags: defineCommandFlags({
119
+ scope: { type: "string", description: "Package scope (glob pattern)" },
120
+ otp: { type: "string", description: "One-time password (optional, will prompt if needed)" },
121
+ "dry-run": { type: "boolean", description: "Simulate publish without actually publishing" },
122
+ tag: { type: "string", description: "NPM dist-tag (default: latest)" },
123
+ access: {
124
+ type: "string",
125
+ choices: ["public", "restricted"],
126
+ description: "Package access level"
127
+ },
128
+ token: { type: "string", description: "NPM auth token (overrides NPM_TOKEN env)" },
129
+ json: { type: "boolean", description: "Output in JSON format" }
130
+ }),
131
+ examples: [
132
+ "kb release publish",
133
+ "kb release publish --scope @kb-labs/core",
134
+ "kb release publish --otp 123456",
135
+ "kb release publish --dry-run",
136
+ "kb release publish --tag next --access public"
137
+ ]
138
+ },
139
+ // release:rollback - Rollback last release
140
+ {
141
+ id: "release:rollback",
142
+ group: "release",
143
+ describe: "Rollback last release",
144
+ longDescription: "Restore workspace state from backup snapshot",
145
+ handler: "./cli/commands/rollback.js#default",
146
+ handlerPath: "./cli/commands/rollback.js",
147
+ flags: defineCommandFlags({
148
+ json: { type: "boolean", description: "Output in JSON format" }
149
+ }),
150
+ examples: ["kb release rollback", "kb release rollback --json"]
151
+ },
152
+ // release:report - Show last release report
153
+ {
154
+ id: "release:report",
155
+ group: "release",
156
+ describe: "Show last release report",
157
+ longDescription: "Display the most recent release execution report",
158
+ handler: "./cli/commands/report.js#default",
159
+ handlerPath: "./cli/commands/report.js",
160
+ flags: defineCommandFlags({
161
+ json: { type: "boolean", description: "Output in JSON format" }
162
+ }),
163
+ examples: ["kb release report", "kb release report --json"]
164
+ },
165
+ // release:changelog - Generate changelog
166
+ {
167
+ id: "release:changelog",
168
+ group: "release",
169
+ describe: "Generate changelog from conventional commits",
170
+ longDescription: "Parse git history and generate changelog with conventional commits support",
171
+ handler: "./cli/commands/changelog.js#default",
172
+ handlerPath: "./cli/commands/changelog.js",
173
+ flags: defineCommandFlags({
174
+ scope: { type: "string", description: "Filter to specific package" },
175
+ from: { type: "string", description: "Start commit/tag" },
176
+ to: { type: "string", description: "End commit/tag (default: HEAD)" },
177
+ "since-tag": { type: "string", description: "Shorthand for --from <tag>" },
178
+ format: {
179
+ type: "string",
180
+ choices: ["json", "md", "both"],
181
+ default: "both",
182
+ description: "Output format"
183
+ },
184
+ level: {
185
+ type: "string",
186
+ choices: ["compact", "standard", "detailed"],
187
+ default: "standard",
188
+ description: "Detail level"
189
+ },
190
+ template: {
191
+ type: "string",
192
+ description: "Template name (builtin: corporate, corporate-ai, technical, compact) or custom path"
193
+ },
194
+ "breaking-only": { type: "boolean", description: "Show only breaking changes" },
195
+ include: { type: "string", description: "Comma-separated types to include" },
196
+ exclude: { type: "string", description: "Types to exclude" },
197
+ "workspace-only": { type: "boolean", description: "Only workspace changelog" },
198
+ "per-package": { type: "boolean", description: "Only per-package changelogs" },
199
+ force: { type: "boolean", description: "Skip audit gate" },
200
+ "allow-major": { type: "boolean", description: "Allow major bumps for experimental packages" },
201
+ preid: { type: "string", description: "Pre-release identifier (rc, beta, alpha)" }
202
+ }),
203
+ examples: [
204
+ "kb release changelog",
205
+ "kb release changelog --from v1.0.0",
206
+ "kb release changelog --format md --level detailed",
207
+ "kb release changelog --template corporate-ai",
208
+ "kb release changelog --template ./my-template.ts",
209
+ "kb release changelog --breaking-only"
210
+ ]
211
+ },
212
+ // release:verify - Validate release readiness
213
+ {
214
+ id: "release:verify",
215
+ group: "release",
216
+ describe: "Validate release readiness",
217
+ longDescription: "Validate release readiness via flag gates (packages, breaking changes, commit types)",
218
+ handler: "./cli/commands/verify.js#default",
219
+ handlerPath: "./cli/commands/verify.js",
220
+ flags: defineCommandFlags({
221
+ "fail-if-empty": { type: "boolean", description: "Fail if no version bumps needed" },
222
+ "fail-on-breaking": { type: "boolean", description: "Fail if breaking changes detected" },
223
+ "allow-types": {
224
+ type: "string",
225
+ description: "Comma-separated types required (e.g., feat,fix)"
226
+ },
227
+ json: { type: "boolean", description: "Output in JSON format" }
228
+ }),
229
+ examples: [
230
+ "kb release verify",
231
+ "kb release verify --fail-if-empty",
232
+ "kb release verify --allow-types feat,fix"
233
+ ]
234
+ }
235
+ ]
236
+ },
237
+ // REST API routes - V3 format (scope-based architecture)
238
+ rest: {
239
+ basePath: RELEASE_BASE_PATH,
240
+ routes: [
241
+ // GET /scopes - List available release scopes
242
+ {
243
+ method: "GET",
244
+ path: RELEASE_ROUTES.SCOPES,
245
+ handler: "./rest/handlers/scopes-handler.js#default",
246
+ handlerPath: "./rest/handlers/scopes-handler.js",
247
+ output: {
248
+ zod: "@kb-labs/release-manager-contracts#ScopesResponseSchema"
249
+ }
250
+ },
251
+ // GET /status - Get release status for a scope
252
+ {
253
+ method: "GET",
254
+ path: RELEASE_ROUTES.STATUS,
255
+ handler: "./rest/handlers/status-handler.js#default",
256
+ handlerPath: "./rest/handlers/status-handler.js",
257
+ output: {
258
+ zod: "@kb-labs/release-manager-contracts#StatusResponseSchema"
259
+ }
260
+ },
261
+ // GET /plan - Get current release plan for a scope
262
+ {
263
+ method: "GET",
264
+ path: RELEASE_ROUTES.PLAN,
265
+ handler: "./rest/handlers/plan-handler.js#default",
266
+ handlerPath: "./rest/handlers/plan-handler.js",
267
+ input: {
268
+ zod: "@kb-labs/release-manager-contracts#PlanInputSchema"
269
+ },
270
+ output: {
271
+ zod: "@kb-labs/release-manager-contracts#PlanResponseSchema"
272
+ }
273
+ },
274
+ // POST /generate - Generate release plan (LLM)
275
+ {
276
+ method: "POST",
277
+ path: RELEASE_ROUTES.GENERATE,
278
+ handler: "./rest/handlers/generate-handler.js#default",
279
+ handlerPath: "./rest/handlers/generate-handler.js",
280
+ input: {
281
+ zod: "@kb-labs/release-manager-contracts#GeneratePlanRequestSchema"
282
+ },
283
+ output: {
284
+ zod: "@kb-labs/release-manager-contracts#GeneratePlanResponseSchema"
285
+ },
286
+ timeoutMs: 12e4
287
+ // 2 minutes for LLM analysis
288
+ },
289
+ // DELETE /plan - Reset release plan
290
+ {
291
+ method: "DELETE",
292
+ path: RELEASE_ROUTES.RESET,
293
+ handler: "./rest/handlers/reset-handler.js#default",
294
+ handlerPath: "./rest/handlers/reset-handler.js",
295
+ input: {
296
+ zod: "@kb-labs/release-manager-contracts#ResetPlanRequestSchema"
297
+ },
298
+ output: {
299
+ zod: "@kb-labs/release-manager-contracts#ResetPlanResponseSchema"
300
+ }
301
+ },
302
+ // GET /changelog - Get changelog for a scope
303
+ {
304
+ method: "GET",
305
+ path: RELEASE_ROUTES.CHANGELOG,
306
+ handler: "./rest/handlers/changelog-handler.js#default",
307
+ handlerPath: "./rest/handlers/changelog-handler.js",
308
+ input: {
309
+ zod: "@kb-labs/release-manager-contracts#ChangelogInputSchema"
310
+ },
311
+ output: {
312
+ zod: "@kb-labs/release-manager-contracts#ChangelogResponseSchema"
313
+ }
314
+ },
315
+ // POST /changelog/generate - Generate changelog (LLM)
316
+ {
317
+ method: "POST",
318
+ path: RELEASE_ROUTES.CHANGELOG_GENERATE,
319
+ handler: "./rest/handlers/changelog-generate-handler.js#default",
320
+ handlerPath: "./rest/handlers/changelog-generate-handler.js",
321
+ input: {
322
+ zod: "@kb-labs/release-manager-contracts#GenerateChangelogRequestSchema"
323
+ },
324
+ output: {
325
+ zod: "@kb-labs/release-manager-contracts#GenerateChangelogResponseSchema"
326
+ },
327
+ timeoutMs: 12e4
328
+ // 2 minutes for LLM generation
329
+ },
330
+ // POST /changelog/save - Save edited changelog
331
+ {
332
+ method: "POST",
333
+ path: RELEASE_ROUTES.CHANGELOG_SAVE,
334
+ handler: "./rest/handlers/changelog-save-handler.js#default",
335
+ handlerPath: "./rest/handlers/changelog-save-handler.js",
336
+ input: {
337
+ zod: "@kb-labs/release-manager-contracts#SaveChangelogRequestSchema"
338
+ },
339
+ output: {
340
+ zod: "@kb-labs/release-manager-contracts#SaveChangelogResponseSchema"
341
+ }
342
+ },
343
+ // POST /run - Execute release process
344
+ {
345
+ method: "POST",
346
+ path: RELEASE_ROUTES.RUN,
347
+ handler: "./rest/handlers/run-handler.js#default",
348
+ handlerPath: "./rest/handlers/run-handler.js",
349
+ input: {
350
+ zod: "@kb-labs/release-manager-contracts#RunReleaseRequestSchema"
351
+ },
352
+ output: {
353
+ zod: "@kb-labs/release-manager-contracts#RunReleaseResponseSchema"
354
+ },
355
+ timeoutMs: 3e5
356
+ // 5 minutes for release execution
357
+ },
358
+ // GET /report - Get latest release report
359
+ {
360
+ method: "GET",
361
+ path: RELEASE_ROUTES.REPORT,
362
+ handler: "./rest/handlers/report-handler.js#default",
363
+ handlerPath: "./rest/handlers/report-handler.js",
364
+ output: {
365
+ zod: "@kb-labs/release-manager-contracts#ReportResponseSchema"
366
+ }
367
+ },
368
+ // GET /history - Get release history
369
+ {
370
+ method: "GET",
371
+ path: RELEASE_ROUTES.HISTORY,
372
+ handler: "./rest/handlers/history-handler.js#default",
373
+ handlerPath: "./rest/handlers/history-handler.js",
374
+ output: {
375
+ zod: "@kb-labs/release-manager-contracts#HistoryResponseSchema"
376
+ }
377
+ },
378
+ // GET /history/:id/report - Get historical release report
379
+ {
380
+ method: "GET",
381
+ path: RELEASE_ROUTES.HISTORY_REPORT,
382
+ handler: "./rest/handlers/history-report-handler.js#default",
383
+ handlerPath: "./rest/handlers/history-report-handler.js",
384
+ output: {
385
+ zod: "@kb-labs/release-manager-contracts#HistoryReportResponseSchema"
386
+ }
387
+ },
388
+ // GET /history/:id/plan - Get historical release plan
389
+ {
390
+ method: "GET",
391
+ path: RELEASE_ROUTES.HISTORY_PLAN,
392
+ handler: "./rest/handlers/history-plan-handler.js#default",
393
+ handlerPath: "./rest/handlers/history-plan-handler.js",
394
+ output: {
395
+ zod: "@kb-labs/release-manager-contracts#HistoryPlanResponseSchema"
396
+ }
397
+ },
398
+ // GET /history/:id/changelog - Get historical changelog
399
+ {
400
+ method: "GET",
401
+ path: RELEASE_ROUTES.HISTORY_CHANGELOG,
402
+ handler: "./rest/handlers/history-changelog-handler.js#default",
403
+ handlerPath: "./rest/handlers/history-changelog-handler.js",
404
+ output: {
405
+ zod: "@kb-labs/release-manager-contracts#HistoryChangelogResponseSchema"
406
+ }
407
+ },
408
+ // GET /git-timeline - Get git commit timeline and version preview
409
+ {
410
+ method: "GET",
411
+ path: RELEASE_ROUTES.GIT_TIMELINE,
412
+ handler: "./rest/handlers/git-timeline-handler.js#default",
413
+ handlerPath: "./rest/handlers/git-timeline-handler.js",
414
+ output: {
415
+ zod: "@kb-labs/release-manager-contracts#GitTimelineResponseSchema"
416
+ }
417
+ },
418
+ // GET /preview - Preview package contents before publish
419
+ {
420
+ method: "GET",
421
+ path: RELEASE_ROUTES.PREVIEW,
422
+ handler: "./rest/handlers/preview-handler.js#default",
423
+ handlerPath: "./rest/handlers/preview-handler.js",
424
+ output: {
425
+ zod: "@kb-labs/release-manager-contracts#PreviewResponseSchema"
426
+ }
427
+ },
428
+ // POST /build - Trigger package build
429
+ {
430
+ method: "POST",
431
+ path: RELEASE_ROUTES.BUILD,
432
+ handler: "./rest/handlers/build-handler.js#default",
433
+ handlerPath: "./rest/handlers/build-handler.js",
434
+ input: {
435
+ zod: "@kb-labs/release-manager-contracts#BuildRequestSchema"
436
+ },
437
+ output: {
438
+ zod: "@kb-labs/release-manager-contracts#BuildResponseSchema"
439
+ },
440
+ timeoutMs: 3e5
441
+ // 5 minutes for build
442
+ },
443
+ // GET /checklist - Get unified release checklist status
444
+ {
445
+ method: "GET",
446
+ path: RELEASE_ROUTES.CHECKLIST,
447
+ handler: "./rest/handlers/checklist-handler.js#default",
448
+ handlerPath: "./rest/handlers/checklist-handler.js",
449
+ output: {
450
+ zod: "@kb-labs/release-manager-contracts#ReleaseChecklistSchema"
451
+ }
452
+ },
453
+ // GET /checks - Get list of configured checks (without running them)
454
+ {
455
+ method: "GET",
456
+ path: RELEASE_ROUTES.CHECKS,
457
+ handler: "./rest/handlers/get-checks-handler.js#default",
458
+ handlerPath: "./rest/handlers/get-checks-handler.js",
459
+ output: {
460
+ zod: "@kb-labs/release-manager-contracts#GetChecksResponseSchema"
461
+ }
462
+ },
463
+ // POST /checks/run - Run pre-release checks from kb.config.json release.checks
464
+ {
465
+ method: "POST",
466
+ path: RELEASE_ROUTES.CHECKS_RUN,
467
+ handler: "./rest/handlers/run-checks-handler.js#default",
468
+ handlerPath: "./rest/handlers/run-checks-handler.js",
469
+ input: {
470
+ zod: "@kb-labs/release-manager-contracts#RunChecksRequestSchema"
471
+ },
472
+ output: {
473
+ zod: "@kb-labs/release-manager-contracts#RunChecksResponseSchema"
474
+ },
475
+ timeoutMs: 6e5
476
+ // 10 minutes - all checks combined
477
+ }
478
+ ]
479
+ },
480
+ // Studio V2 — Module Federation pages
481
+ studio: {
482
+ version: 2,
483
+ remoteName: "releasePlugin",
484
+ pages: [
485
+ {
486
+ id: "release.overview",
487
+ title: "Release",
488
+ icon: "RocketOutlined",
489
+ route: "/p/release",
490
+ entry: "./ReleasePage",
491
+ order: 1
492
+ }
493
+ ],
494
+ menus: [
495
+ {
496
+ id: "release",
497
+ label: "Release",
498
+ icon: "RocketOutlined",
499
+ target: "release.overview",
500
+ order: 60
501
+ }
502
+ ]
503
+ },
504
+ // Studio widgets (legacy - commented out, using new UI integration)
505
+ // studio_legacy: {
506
+ // widgets: [
507
+ // {
508
+ // id: 'release.plan',
509
+ // kind: 'infopanel',
510
+ // title: 'Latest Release Plan',
511
+ // description: 'Shows the most recent release plan generated via `kb release plan`.',
512
+ // data: {
513
+ // source: {
514
+ // type: 'rest',
515
+ // routeId: 'plan/latest',
516
+ // method: 'GET',
517
+ // },
518
+ // },
519
+ // layoutHint: {
520
+ // w: 4,
521
+ // h: 5,
522
+ // minW: 3,
523
+ // minH: 3,
524
+ // },
525
+ // },
526
+ // {
527
+ // id: 'release.report',
528
+ // kind: 'cardlist',
529
+ // title: 'Release Report',
530
+ // description: 'Status of the last release execution.',
531
+ // data: {
532
+ // source: {
533
+ // type: 'rest',
534
+ // routeId: 'report/latest',
535
+ // method: 'GET',
536
+ // },
537
+ // },
538
+ // options: {
539
+ // layout: 'list',
540
+ // },
541
+ // layoutHint: {
542
+ // w: 4,
543
+ // h: 4,
544
+ // minW: 3,
545
+ // minH: 3,
546
+ // },
547
+ // },
548
+ // ],
549
+ // menus: [
550
+ // {
551
+ // id: 'release-menu',
552
+ // label: 'Release',
553
+ // icon: 'RocketOutlined',
554
+ // target: '/plugins/release/dashboard',
555
+ // order: 0,
556
+ // },
557
+ // {
558
+ // id: 'release-dashboard',
559
+ // label: 'Dashboard',
560
+ // icon: 'DashboardOutlined',
561
+ // parentId: 'release-menu',
562
+ // target: '/plugins/release/dashboard',
563
+ // order: 1,
564
+ // },
565
+ // ],
566
+ // layouts: [
567
+ // {
568
+ // id: 'release.dashboard',
569
+ // kind: 'grid',
570
+ // title: 'Release Dashboard',
571
+ // description: 'Overview of release planning and execution.',
572
+ // config: {
573
+ // cols: { sm: 2, md: 4, lg: 6 },
574
+ // rowHeight: 5,
575
+ // },
576
+ // },
577
+ // ],
578
+ // },
579
+ // Auto-detects kb.config.json section for useConfig()
580
+ // maps to profiles[].products.release in kb.config.json
581
+ configSection: "release",
582
+ capabilities: ["fs:read", "fs:write"],
583
+ // V3: Manifest-first permissions using composable presets
584
+ permissions: pluginPermissions,
585
+ // Artifacts
586
+ artifacts: [
587
+ {
588
+ id: "release.plan.json",
589
+ pathTemplate: ".kb/release/plan.json",
590
+ description: "Serialized release plan generated by `kb release plan`."
591
+ },
592
+ {
593
+ id: "release.report.json",
594
+ pathTemplate: ".kb/release/report.json",
595
+ description: "Execution report emitted by `kb release run`."
596
+ },
597
+ {
598
+ id: "release.changelog.md",
599
+ pathTemplate: ".kb/release/changelog.md",
600
+ description: "Workspace changelog output produced during release."
601
+ }
602
+ ]
603
+ };
604
+ function scopeToDir(scope) {
605
+ return scope.replace(/^@/, "").replace(/\//g, "-").replace(/:/g, "-").replace(/\*/g, "");
606
+ }
607
+ function dirToScope(dirName) {
608
+ if (dirName === "root") {
609
+ return "root";
610
+ }
611
+ const parts = dirName.split("-");
612
+ if (parts.length >= 2) {
613
+ return "@" + parts[0] + "-" + parts[1] + "/" + parts.slice(2).join("-");
614
+ }
615
+ return dirName;
616
+ }
617
+ async function resolveScopePath(repoRoot, scope) {
618
+ if (scope === "root") {
619
+ return repoRoot;
620
+ }
621
+ if (scope.startsWith("@")) {
622
+ const packageJsonPaths = await globby("**/package.json", {
623
+ cwd: repoRoot,
624
+ absolute: true,
625
+ onlyFiles: true,
626
+ ignore: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.git/**", "**/.*/**"]
627
+ });
628
+ for (const pkgJsonPath of packageJsonPaths) {
629
+ try {
630
+ const pkg = JSON.parse(await readFile(pkgJsonPath, "utf-8"));
631
+ if (pkg.name === scope) {
632
+ return join(pkgJsonPath, "..");
633
+ }
634
+ } catch {
635
+ }
636
+ }
637
+ }
638
+ return join(repoRoot, scope);
639
+ }
640
+
641
+ // src/infra/analytics/events.ts
642
+ var ANALYTICS_PREFIX = {
643
+ PLAN: "release.plan",
644
+ RUN: "release.run",
645
+ ROLLBACK: "release.rollback",
646
+ REPORT: "release.report",
647
+ CHANGELOG: "release.changelog",
648
+ PREVIEW: "release.preview",
649
+ VERIFY: "release.verify",
650
+ PUBLISH: "release.publish"
651
+ };
652
+ var ANALYTICS_SUFFIX = {
653
+ STARTED: "started",
654
+ FINISHED: "finished"
655
+ };
656
+ var ANALYTICS_EVENTS = {
657
+ // Plan events
658
+ PLAN_STARTED: `${ANALYTICS_PREFIX.PLAN}.${ANALYTICS_SUFFIX.STARTED}`,
659
+ PLAN_FINISHED: `${ANALYTICS_PREFIX.PLAN}.${ANALYTICS_SUFFIX.FINISHED}`,
660
+ // Run events
661
+ RUN_STARTED: `${ANALYTICS_PREFIX.RUN}.${ANALYTICS_SUFFIX.STARTED}`,
662
+ RUN_FINISHED: `${ANALYTICS_PREFIX.RUN}.${ANALYTICS_SUFFIX.FINISHED}`,
663
+ // Rollback events
664
+ ROLLBACK_STARTED: `${ANALYTICS_PREFIX.ROLLBACK}.${ANALYTICS_SUFFIX.STARTED}`,
665
+ ROLLBACK_FINISHED: `${ANALYTICS_PREFIX.ROLLBACK}.${ANALYTICS_SUFFIX.FINISHED}`,
666
+ // Report events
667
+ REPORT_STARTED: `${ANALYTICS_PREFIX.REPORT}.${ANALYTICS_SUFFIX.STARTED}`,
668
+ REPORT_FINISHED: `${ANALYTICS_PREFIX.REPORT}.${ANALYTICS_SUFFIX.FINISHED}`,
669
+ // Changelog events
670
+ CHANGELOG_STARTED: `${ANALYTICS_PREFIX.CHANGELOG}.${ANALYTICS_SUFFIX.STARTED}`,
671
+ CHANGELOG_FINISHED: `${ANALYTICS_PREFIX.CHANGELOG}.${ANALYTICS_SUFFIX.FINISHED}`,
672
+ // Preview events
673
+ PREVIEW_STARTED: `${ANALYTICS_PREFIX.PREVIEW}.${ANALYTICS_SUFFIX.STARTED}`,
674
+ PREVIEW_FINISHED: `${ANALYTICS_PREFIX.PREVIEW}.${ANALYTICS_SUFFIX.FINISHED}`,
675
+ // Verify events
676
+ VERIFY_STARTED: `${ANALYTICS_PREFIX.VERIFY}.${ANALYTICS_SUFFIX.STARTED}`,
677
+ VERIFY_FINISHED: `${ANALYTICS_PREFIX.VERIFY}.${ANALYTICS_SUFFIX.FINISHED}`,
678
+ // Publish events
679
+ PUBLISH_STARTED: `${ANALYTICS_PREFIX.PUBLISH}.${ANALYTICS_SUFFIX.STARTED}`,
680
+ PUBLISH_FINISHED: `${ANALYTICS_PREFIX.PUBLISH}.${ANALYTICS_SUFFIX.FINISHED}`
681
+ };
682
+ var ANALYTICS_ACTOR = {
683
+ type: "agent",
684
+ id: "release-cli"
685
+ };
686
+
687
+ export { ANALYTICS_ACTOR, ANALYTICS_EVENTS, ANALYTICS_PREFIX, ANALYTICS_SUFFIX, dirToScope, manifest, resolveScopePath, scopeToDir };
688
+ //# sourceMappingURL=index.js.map
689
+ //# sourceMappingURL=index.js.map