@mks2508/better-logger 5.0.0 → 5.0.2

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 (162) hide show
  1. package/dist/chunks/{Logger-Cbi1f10o.js → Logger-CKqzXDh3.js} +2 -2
  2. package/dist/chunks/{Logger-Cbi1f10o.js.map → Logger-CKqzXDh3.js.map} +1 -1
  3. package/dist/chunks/{Logger-BZ7B7OXE.js → Logger-D_vuKP4l.js} +2 -2
  4. package/dist/chunks/{Logger-BZ7B7OXE.js.map → Logger-D_vuKP4l.js.map} +1 -1
  5. package/dist/chunks/cli-module-B-njrTWb.js +2 -0
  6. package/dist/chunks/cli-module-B-njrTWb.js.map +1 -0
  7. package/dist/chunks/{cli-module-ClIJmaT8.js → cli-module-Cx7qotPY.js} +16 -9
  8. package/dist/chunks/cli-module-Cx7qotPY.js.map +1 -0
  9. package/dist/cli.cjs +1 -1
  10. package/dist/cli.js +1 -1
  11. package/dist/exports.cjs +1 -1
  12. package/dist/exports.js +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +3 -3
  15. package/dist/styling.cjs +1 -1
  16. package/dist/styling.js +2 -2
  17. package/dist/terminal/formatter.d.ts.map +1 -1
  18. package/package.json +5 -1
  19. package/.claude/settings.local.json +0 -48
  20. package/.github/workflows/ci-quality.yml +0 -357
  21. package/.github/workflows/docs-demo.yml +0 -119
  22. package/.github/workflows/releases-core.yml +0 -512
  23. package/.github/workflows/releases-full.yml +0 -582
  24. package/.github/workflows-backup/ci.yml +0 -221
  25. package/.github/workflows-backup/nightly.yml +0 -196
  26. package/.github/workflows-backup/release-optimized.yml +0 -373
  27. package/.github/workflows-backup/release.yml +0 -269
  28. package/.release-notes-0.2.0.md +0 -129
  29. package/.yamllint +0 -28
  30. package/CHANGELOG.json +0 -1076
  31. package/CHANGELOG.md +0 -209
  32. package/CLAUDE.md +0 -217
  33. package/bun.lock +0 -333
  34. package/demo.html +0 -847
  35. package/dist/chunks/cli-module-CadqgZ1Z.js +0 -2
  36. package/dist/chunks/cli-module-CadqgZ1Z.js.map +0 -1
  37. package/dist/chunks/cli-module-ClIJmaT8.js.map +0 -1
  38. package/docs/API.md +0 -918
  39. package/docs/CORE.md +0 -264
  40. package/docs/DEVELOPMENT.md +0 -731
  41. package/docs/EXPORTS.md +0 -467
  42. package/docs/PACKAGES.md +0 -244
  43. package/docs/STYLING.md +0 -405
  44. package/docs/_config.yml +0 -36
  45. package/docs/index.md +0 -179
  46. package/examples/README.md +0 -208
  47. package/examples/basic-logging.js +0 -75
  48. package/examples/data-export.js +0 -234
  49. package/examples/package.json +0 -16
  50. package/examples/performance-timing.js +0 -170
  51. package/examples/simplified-api.js +0 -124
  52. package/examples/styling-themes.js +0 -207
  53. package/index.html +0 -358
  54. package/packages/core/package.json +0 -57
  55. package/packages/exports/package.json +0 -41
  56. package/packages/nodejs-opentui/README.md +0 -232
  57. package/packages/nodejs-opentui/package.json +0 -72
  58. package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
  59. package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
  60. package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
  61. package/packages/nodejs-opentui/src/index.ts +0 -133
  62. package/packages/nodejs-opentui/src/types.ts +0 -158
  63. package/packages/nodejs-opentui/tsconfig.json +0 -20
  64. package/packages/styling/package.json +0 -41
  65. package/playground/demo-all.ts +0 -95
  66. package/playground/demo-box.ts +0 -85
  67. package/playground/demo-levels.ts +0 -56
  68. package/playground/demo-real-world.ts +0 -98
  69. package/playground/demo-spinner.ts +0 -77
  70. package/playground/demo-steps.ts +0 -72
  71. package/playground/demo-table.ts +0 -83
  72. package/project-utils/README.md +0 -172
  73. package/project-utils/auto-release-gemini.ts +0 -1193
  74. package/project-utils/auto-release-ui.ts +0 -1329
  75. package/project-utils/commit-generator.ts +0 -1385
  76. package/project-utils/commit-ui.ts +0 -264
  77. package/project-utils/git-utils.ts +0 -199
  78. package/project-utils/github-release-manager.ts +0 -466
  79. package/project-utils/project-config.ts +0 -260
  80. package/project-utils/prompt-templates.js +0 -345
  81. package/project-utils/prompt-templates.ts +0 -422
  82. package/project-utils/version-manager.ts +0 -1078
  83. package/public/vite.svg +0 -1
  84. package/src/Logger.ts +0 -1858
  85. package/src/ScopedLogger.ts +0 -256
  86. package/src/cli/CommandProcessor.ts +0 -248
  87. package/src/cli/commands/ConfigCommand.ts +0 -93
  88. package/src/cli/commands/ExportCommand.ts +0 -276
  89. package/src/cli/commands/HistoryCommand.ts +0 -117
  90. package/src/cli/commands/StatusCommand.ts +0 -112
  91. package/src/cli/commands/ThemeCommand.ts +0 -88
  92. package/src/cli/help.ts +0 -127
  93. package/src/cli/index.ts +0 -71
  94. package/src/cli-module.ts +0 -21
  95. package/src/cli-primitives/box.ts +0 -86
  96. package/src/cli-primitives/cli-table.ts +0 -62
  97. package/src/cli-primitives/divider.ts +0 -17
  98. package/src/cli-primitives/header.ts +0 -18
  99. package/src/cli-primitives/index.ts +0 -13
  100. package/src/cli-primitives/server-fallback.ts +0 -54
  101. package/src/cli-primitives/spinner.ts +0 -133
  102. package/src/cli-primitives/step.ts +0 -22
  103. package/src/constants.ts +0 -313
  104. package/src/core.ts +0 -397
  105. package/src/example.ts +0 -210
  106. package/src/exports-module.ts +0 -311
  107. package/src/handlers/AnalyticsLogHandler.ts +0 -22
  108. package/src/handlers/ExportLogHandler.ts +0 -610
  109. package/src/handlers/FileLogHandler.ts +0 -169
  110. package/src/handlers/RemoteLogHandler.ts +0 -42
  111. package/src/handlers/index.ts +0 -8
  112. package/src/hooks/HookManager.ts +0 -177
  113. package/src/hooks/index.ts +0 -1
  114. package/src/index.ts +0 -395
  115. package/src/main.ts +0 -196
  116. package/src/serializers/SerializerRegistry.ts +0 -173
  117. package/src/serializers/index.ts +0 -1
  118. package/src/style.css +0 -96
  119. package/src/styling/LogStyleBuilder.ts +0 -355
  120. package/src/styling/SemanticStyles.ts +0 -380
  121. package/src/styling/SmartPresets.ts +0 -288
  122. package/src/styling/StyleBuilder.ts +0 -319
  123. package/src/styling/StyleCache.ts +0 -131
  124. package/src/styling/banners.ts +0 -168
  125. package/src/styling/index.ts +0 -27
  126. package/src/styling/themes.ts +0 -235
  127. package/src/styling-module.ts +0 -244
  128. package/src/terminal/color-converter.ts +0 -315
  129. package/src/terminal/formatter.ts +0 -236
  130. package/src/terminal/terminal-renderer.ts +0 -342
  131. package/src/transports/ConsoleTransport.ts +0 -28
  132. package/src/transports/FileTransport.ts +0 -53
  133. package/src/transports/HttpTransport.ts +0 -56
  134. package/src/transports/TransportManager.ts +0 -130
  135. package/src/transports/index.ts +0 -4
  136. package/src/types/core.ts +0 -417
  137. package/src/types/handlers.ts +0 -95
  138. package/src/types/hooks.ts +0 -45
  139. package/src/types/index.ts +0 -83
  140. package/src/types/serializers.ts +0 -30
  141. package/src/types/transports.ts +0 -52
  142. package/src/typescript.svg +0 -1
  143. package/src/utils/adapter.ts +0 -291
  144. package/src/utils/ansi-colors.ts +0 -333
  145. package/src/utils/environment-detector.ts +0 -170
  146. package/src/utils/environment.ts +0 -94
  147. package/src/utils/formatting.ts +0 -332
  148. package/src/utils/index.ts +0 -33
  149. package/src/utils/opentui-detection.ts +0 -138
  150. package/src/utils/output.ts +0 -227
  151. package/src/utils/stackTrace.ts +0 -144
  152. package/src/utils/timestamps.ts +0 -80
  153. package/src/vite-env.d.ts +0 -1
  154. package/src/writers/BufferWriter.ts +0 -157
  155. package/src/writers/index.ts +0 -6
  156. package/test-core-browser.html +0 -237
  157. package/test-core-node.js +0 -63
  158. package/tests/test-conflict-resolution.ts +0 -391
  159. package/tests/validate-workflows.sh +0 -131
  160. package/tests/yaml-autofix.sh +0 -146
  161. package/tsconfig.json +0 -50
  162. package/vite.config.ts +0 -256
@@ -1,1329 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { execSync } from "child_process"
4
- import { platform } from "os"
5
- import { readFileSync, existsSync, writeFileSync, mkdirSync } from "fs"
6
- import { join } from "path"
7
- import {
8
- PROJECT_COMPONENTS,
9
- WORK_TYPES,
10
- BUILD_MODES,
11
- VERSION_PREFIXES,
12
- PERFORMANCE_IMPACTS,
13
- getComponentIds,
14
- getWorkTypeIds,
15
- formatComponentsList,
16
- PROJECT_INFO
17
- } from './project-config'
18
-
19
- interface ReleaseOptions {
20
- // General Configuration
21
- useAI: boolean
22
- dryRun: boolean
23
- autoApprove: boolean
24
- autoCommit: boolean
25
- force: boolean
26
- quiet: boolean
27
-
28
- // Version Management
29
- versionType: 'major' | 'minor' | 'patch' | 'auto'
30
- versionPrefix: 'alpha' | 'beta' | 'rc' | 'stable' | 'pre-alpha'
31
-
32
- // Build Configuration
33
- buildMode: 'full' | 'core' | 'styling' | 'exports' | 'selective' | 'skip'
34
- selectedModules: string[]
35
- docsOnly: boolean
36
-
37
- // Commit Configuration
38
- workType: 'feature' | 'fix' | 'refactor' | 'docs' | 'test'
39
- affectedComponents: string[]
40
- context: string
41
- performanceImpact: 'none' | 'minor' | 'major'
42
-
43
- // Extended Context (from auto-release-gemini.ts)
44
- focusArea?: string
45
- targetPlatform?: string
46
- urgency?: string
47
- targetAudience?: string
48
- dependencies?: string
49
-
50
- // Publishing
51
- createGitHubRelease: boolean
52
- publishNpm: boolean
53
- publishGitHub: boolean
54
- npmTag?: string
55
-
56
- // Advanced
57
- skipTests: boolean
58
- skipTypeCheck: boolean
59
- keepLocalChanges: boolean
60
- }
61
-
62
- interface UIState {
63
- step: number
64
- maxStep: number
65
- config: Partial<ReleaseOptions>
66
- canGoBack: boolean
67
- previewCommand: string
68
- projectStatus: ProjectStatus
69
- selectedPreset?: string
70
- }
71
-
72
- interface ProjectStatus {
73
- currentVersion: string
74
- lastRelease: string
75
- lastReleaseDate: string
76
- gitStatus: string
77
- isClean: boolean
78
- hasUncommitted: boolean
79
- }
80
-
81
- interface QuickAction {
82
- id: string
83
- name: string
84
- description: string
85
- emoji: string
86
- config: Partial<ReleaseOptions>
87
- resultingVersion: string
88
- }
89
-
90
- class NavigationController {
91
- private state: UIState
92
- private history: UIState[] = []
93
- private tempDir: string
94
- private stateFile: string
95
-
96
- constructor(initialState: UIState) {
97
- this.state = initialState
98
- this.tempDir = join(process.cwd(), 'project-utils/.ui-temp')
99
- this.stateFile = join(this.tempDir, 'ui-state.json')
100
-
101
- // Crear directorio temporal
102
- if (!existsSync(this.tempDir)) {
103
- mkdirSync(this.tempDir, { recursive: true })
104
- }
105
- }
106
-
107
- getCurrentState(): UIState {
108
- return { ...this.state }
109
- }
110
-
111
- goNext(newState: Partial<UIState>): UIState {
112
- // Guardar estado actual en historial
113
- this.history.push({ ...this.state })
114
-
115
- // Actualizar estado
116
- this.state = {
117
- ...this.state,
118
- ...newState,
119
- step: this.state.step + 1,
120
- canGoBack: true
121
- }
122
-
123
- // Persistir estado
124
- this.persistState()
125
- return { ...this.state }
126
- }
127
-
128
- goBack(): UIState | null {
129
- if (this.history.length === 0) {
130
- return null
131
- }
132
-
133
- // Restaurar estado anterior
134
- this.state = this.history.pop()!
135
- this.state.canGoBack = this.history.length > 0
136
-
137
- this.persistState()
138
- return { ...this.state }
139
- }
140
-
141
- updateConfig(config: Partial<ReleaseOptions>): void {
142
- this.state.config = { ...this.state.config, ...config }
143
- this.state.previewCommand = this.generatePreviewCommand()
144
- this.persistState()
145
- }
146
-
147
- private persistState(): void {
148
- try {
149
- writeFileSync(this.stateFile, JSON.stringify(this.state, null, 2))
150
- } catch (error) {
151
- // Silent fail para evitar crashes
152
- }
153
- }
154
-
155
- private generatePreviewCommand(): string {
156
- const config = this.state.config
157
- const args: string[] = []
158
-
159
- if (config.useAI) args.push("--ai")
160
- if (config.dryRun) args.push("--dry-run")
161
- if (config.autoApprove) args.push("--auto-approve")
162
- if (config.force) args.push("--force")
163
- if (config.versionType && config.versionType !== 'auto') {
164
- args.push(`--type ${config.versionType}`)
165
- }
166
- if (config.versionPrefix && config.versionPrefix !== 'stable') {
167
- args.push(`--prefix ${config.versionPrefix}`)
168
- }
169
- if (config.workType) args.push(`--work-type ${config.workType}`)
170
- if (config.affectedComponents?.length) {
171
- args.push(`--affected-components ${config.affectedComponents.join(',')}`)
172
- }
173
- if (config.context) args.push(`--context "${config.context}"`)
174
- if (config.performanceImpact && config.performanceImpact !== 'none') {
175
- args.push(`--performance-impact ${config.performanceImpact}`)
176
- }
177
-
178
- // Extended context parameters
179
- if (config.focusArea) args.push(`--focus "${config.focusArea}"`)
180
- if (config.targetPlatform && config.targetPlatform !== 'universal') {
181
- args.push(`--target-platform ${config.targetPlatform}`)
182
- }
183
- if (config.urgency && config.urgency !== 'normal') {
184
- args.push(`--urgency ${config.urgency}`)
185
- }
186
- if (config.targetAudience && config.targetAudience !== 'public') {
187
- args.push(`--audience ${config.targetAudience}`)
188
- }
189
- if (config.dependencies && config.dependencies !== 'both') {
190
- args.push(`--dependencies ${config.dependencies}`)
191
- }
192
-
193
- if (config.publishNpm) args.push("--publish-npm")
194
- if (config.publishGitHub) args.push("--publish-github")
195
- if (!config.createGitHubRelease) args.push("--no-github")
196
-
197
- return `bun auto-release-gemini.ts ${args.join(' ')}`
198
- }
199
-
200
- cleanup(): void {
201
- try {
202
- if (existsSync(this.stateFile)) {
203
- execSync(`rm -f "${this.stateFile}"`)
204
- }
205
- } catch (error) {
206
- // Silent cleanup
207
- }
208
- }
209
- }
210
-
211
- class AutoReleaseUIv2 {
212
- private platform = platform()
213
- private projectRoot = process.cwd()
214
- private navigation: NavigationController
215
-
216
- constructor() {
217
- const projectStatus = this.getProjectStatus()
218
- const initialState: UIState = {
219
- step: 1,
220
- maxStep: 3,
221
- config: {},
222
- canGoBack: false,
223
- previewCommand: "",
224
- projectStatus
225
- }
226
-
227
- this.navigation = new NavigationController(initialState)
228
- }
229
-
230
- private getProjectStatus(): ProjectStatus {
231
- let currentVersion = "unknown"
232
- let lastRelease = "none"
233
- let lastReleaseDate = "never"
234
- let gitStatus = ""
235
- let isClean = true
236
- let hasUncommitted = false
237
-
238
- // Current version
239
- try {
240
- const packageJson = JSON.parse(readFileSync(join(this.projectRoot, 'package.json'), 'utf-8'))
241
- currentVersion = packageJson.version
242
- } catch {}
243
-
244
- // Last release
245
- try {
246
- const changelog = JSON.parse(readFileSync(join(this.projectRoot, 'CHANGELOG.json'), 'utf-8'))
247
- const latest = changelog.versions[0]
248
- if (latest) {
249
- lastRelease = latest.version
250
- lastReleaseDate = latest.date
251
- }
252
- } catch {}
253
-
254
- // Git status
255
- try {
256
- gitStatus = execSync('git status --porcelain', { encoding: 'utf-8' }).trim()
257
- isClean = !gitStatus
258
- hasUncommitted = !!gitStatus
259
- } catch {}
260
-
261
- return {
262
- currentVersion,
263
- lastRelease,
264
- lastReleaseDate,
265
- gitStatus,
266
- isClean,
267
- hasUncommitted
268
- }
269
- }
270
-
271
- private getQuickActions(): QuickAction[] {
272
- const current = this.navigation.getCurrentState().projectStatus.currentVersion
273
- const [major, minor, patch, preRelease] = current.split(/[.-]/)
274
-
275
- return [
276
- {
277
- id: "hotfix",
278
- name: "🚨 Hotfix",
279
- description: "Critical patch + immediate publish",
280
- emoji: "🚨",
281
- config: {
282
- versionType: 'patch',
283
- versionPrefix: 'stable',
284
- buildMode: 'full',
285
- workType: 'fix',
286
- useAI: true,
287
- createGitHubRelease: true,
288
- publishNpm: true,
289
- autoApprove: true
290
- },
291
- resultingVersion: `${major}.${minor}.${parseInt(patch) + 1}`
292
- },
293
- {
294
- id: "feature",
295
- name: "✨ Feature",
296
- description: "New feature + GitHub release",
297
- emoji: "✨",
298
- config: {
299
- versionType: 'minor',
300
- versionPrefix: 'stable',
301
- buildMode: 'full',
302
- workType: 'feature',
303
- useAI: true,
304
- createGitHubRelease: true,
305
- publishNpm: false
306
- },
307
- resultingVersion: `${major}.${parseInt(minor) + 1}.0`
308
- },
309
- {
310
- id: "alpha",
311
- name: "🧪 Alpha",
312
- description: "Testing release + GitHub packages",
313
- emoji: "🧪",
314
- config: {
315
- versionType: 'minor',
316
- versionPrefix: 'alpha',
317
- buildMode: 'full',
318
- workType: 'feature',
319
- useAI: true,
320
- createGitHubRelease: true,
321
- publishGitHub: true,
322
- publishNpm: false
323
- },
324
- resultingVersion: `${major}.${parseInt(minor) + 1}.0-alpha.1`
325
- },
326
- {
327
- id: "major",
328
- name: "💥 Major",
329
- description: "Breaking changes + full release",
330
- emoji: "💥",
331
- config: {
332
- versionType: 'major',
333
- versionPrefix: 'stable',
334
- buildMode: 'full',
335
- workType: 'feature',
336
- useAI: true,
337
- createGitHubRelease: true,
338
- publishNpm: true,
339
- performanceImpact: 'major'
340
- },
341
- resultingVersion: `${parseInt(major) + 1}.0.0`
342
- }
343
- ]
344
- }
345
-
346
- async collectReleaseInfo(): Promise<ReleaseOptions> {
347
- try {
348
- if (this.platform === "darwin") {
349
- return await this.macOSWizard()
350
- } else if (this.platform === "linux") {
351
- return await this.linuxWizard()
352
- } else {
353
- return await this.fallbackWizard()
354
- }
355
- } catch (error) {
356
- if (error instanceof Error && error.message === "Cancelled") {
357
- console.log("❌ Release cancelled by user")
358
- process.exit(0)
359
- }
360
- console.log("⚠️ GUI not available, falling back to text input")
361
- return await this.fallbackWizard()
362
- } finally {
363
- this.navigation.cleanup()
364
- }
365
- }
366
-
367
- private async macOSWizard(): Promise<ReleaseOptions> {
368
- let state = this.navigation.getCurrentState()
369
-
370
- while (state.step <= state.maxStep) {
371
- switch (state.step) {
372
- case 1:
373
- state = await this.macOSStep1_Welcome(state)
374
- break
375
- case 2:
376
- state = await this.macOSStep2_Configuration(state)
377
- break
378
- case 3:
379
- state = await this.macOSStep3_Confirmation(state)
380
- break
381
- default:
382
- return state.config as ReleaseOptions
383
- }
384
- }
385
-
386
- return state.config as ReleaseOptions
387
- }
388
-
389
- private async macOSStep1_Welcome(currentState: UIState): Promise<UIState> {
390
- // First handle commits if needed
391
- const updatedState = await this.handleUncommittedChanges(currentState)
392
-
393
- const status = updatedState.projectStatus
394
- const quickActions = this.getQuickActions()
395
-
396
- // Build the action options with actual values
397
- const actionOptions = [
398
- `🚨 Hotfix → ${quickActions[0].resultingVersion} (patch + publish)`,
399
- `✨ Feature → ${quickActions[1].resultingVersion} (minor + GitHub)`,
400
- `🧪 Alpha → ${quickActions[2].resultingVersion} (test + packages)`,
401
- `💥 Major → ${quickActions[3].resultingVersion} (breaking + full)`,
402
- `⚙️ Custom Configuration...`
403
- ]
404
-
405
- const statusText = `🚀 AUTO-RELEASE MANAGER v2.0\\n` +
406
- `━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n\\n` +
407
- `📊 PROJECT STATUS:\\n` +
408
- `${status.isClean ? '✅' : '⚠️'} Git: ${status.isClean ? 'Clean working directory' : 'Has uncommitted changes'}\\n` +
409
- `📦 Version: ${status.currentVersion}\\n` +
410
- `📋 Last: ${status.lastRelease} (${status.lastReleaseDate})\\n\\n` +
411
- `🎯 SELECT ACTION:`
412
-
413
- const script = `
414
- const app = Application.currentApplication()
415
- app.includeStandardAdditions = true
416
-
417
- const statusText = "${statusText}"
418
-
419
- const actionOptions = ${JSON.stringify(actionOptions)}
420
-
421
- const result = app.chooseFromList(actionOptions, {
422
- withTitle: "🚀 Auto-Release Manager",
423
- withPrompt: statusText,
424
- defaultItems: ["⚙️ Custom Configuration..."],
425
- multipleSelectionsAllowed: false
426
- })
427
-
428
- if (result === false) {
429
- throw new Error("Cancelled")
430
- }
431
-
432
- const selected = result[0]
433
-
434
- if (selected.includes("Hotfix")) {
435
- JSON.stringify({ action: "hotfix", preset: "Hotfix" })
436
- } else if (selected.includes("Feature")) {
437
- JSON.stringify({ action: "feature", preset: "Feature Release" })
438
- } else if (selected.includes("Alpha")) {
439
- JSON.stringify({ action: "alpha", preset: "Alpha Testing" })
440
- } else if (selected.includes("Major")) {
441
- JSON.stringify({ action: "major", preset: "Major Release" })
442
- } else {
443
- JSON.stringify({ action: "custom", preset: null })
444
- }
445
- `
446
-
447
- try {
448
- const result = execSync(`osascript -l JavaScript -e '${script.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
449
- const choice = JSON.parse(result)
450
-
451
- if (choice.action !== "custom") {
452
- // Quick action selected - apply preset and skip to confirmation
453
- const quickAction = quickActions.find(qa => qa.id === choice.action)!
454
- return this.navigation.goNext({
455
- step: 3, // Skip to confirmation
456
- config: {
457
- ...quickAction.config,
458
- context: `${quickAction.description} release`,
459
- affectedComponents: ['core']
460
- },
461
- selectedPreset: choice.preset,
462
- projectStatus: updatedState.projectStatus
463
- })
464
- } else {
465
- // Custom configuration
466
- return this.navigation.goNext({
467
- config: {
468
- useAI: true,
469
- dryRun: false,
470
- autoApprove: false
471
- },
472
- projectStatus: updatedState.projectStatus
473
- })
474
- }
475
- } catch (error) {
476
- throw new Error("Cancelled")
477
- }
478
- }
479
-
480
- private async macOSStep2_Configuration(currentState: UIState): Promise<UIState> {
481
- const config = currentState.config
482
-
483
- // Collect all configuration in a series of dialogs
484
- const versionScript = `
485
- const app = Application.currentApplication()
486
- app.includeStandardAdditions = true
487
-
488
- // Version Type Selection - build dynamic versions
489
- const currentVersion = "${currentState.projectStatus.currentVersion}"
490
- const versionTypes = [
491
- "patch → " + currentVersion.replace(/\\d+$/, (m) => String(parseInt(m) + 1)) + " (bug fixes)",
492
- "minor → " + currentVersion.replace(/\\d+\\.\\d+/, (m) => m.replace(/\\d+$/, (n) => String(parseInt(n) + 1)) + '.0') + " (new features)",
493
- "major → " + currentVersion.replace(/^\\d+/, (m) => String(parseInt(m) + 1)) + '.0.0' + " (breaking changes)",
494
- "auto → AI-detected based on commits"
495
- ]
496
-
497
- const versionResult = app.chooseFromList(versionTypes, {
498
- withTitle: "📦 VERSIONING (Step 2/6)",
499
- withPrompt: "Current: " + currentVersion + "\\nLast Release: ${currentState.projectStatus.lastRelease}\\n\\nSelect version increment:",
500
- defaultItems: [versionTypes[0]]
501
- })
502
-
503
- if (versionResult === false) {
504
- JSON.stringify({ action: "back" })
505
- } else {
506
- const versionType = versionResult[0].split(" ")[0]
507
-
508
- // Version Prefix Selection - using centralized config
509
- const prefixes = [
510
- "stable (Production-ready release)",
511
- "alpha (Early testing and development)",
512
- "beta (Feature-complete testing phase)",
513
- "rc (Final testing before stable release)",
514
- "pre-alpha (Experimental and unstable features)"
515
- ]
516
-
517
- const prefixResult = app.chooseFromList(prefixes, {
518
- withTitle: "🏷️ VERSION PREFIX (Step 3/6)",
519
- withPrompt: "Version Type: " + versionType + "\\n\\nSelect version prefix:",
520
- defaultItems: ["stable (production ready)"]
521
- })
522
-
523
- if (prefixResult === false) {
524
- JSON.stringify({ action: "back" })
525
- } else {
526
- const prefix = prefixResult[0].split(" ")[0]
527
- JSON.stringify({
528
- action: "next",
529
- versionType: versionType,
530
- versionPrefix: prefix
531
- })
532
- }
533
- }
534
- `
535
-
536
- try {
537
- const versionResult = execSync(`osascript -l JavaScript -e '${versionScript.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
538
- const versionChoice = JSON.parse(versionResult)
539
-
540
- if (versionChoice.action === "back") {
541
- return this.navigation.goBack()!
542
- }
543
-
544
- // Build Configuration
545
- const buildScript = `
546
- const app = Application.currentApplication()
547
- app.includeStandardAdditions = true
548
-
549
- // Build modes - using centralized config
550
- const buildModes = [
551
- "full (Complete bundle with all modules)",
552
- "core (Essential logging functionality - minimal size)",
553
- "styling (Core + visual features and theming)",
554
- "exports (Core + export handlers and remote logging)",
555
- "selective (Choose specific modules to include)",
556
- "skip (Use existing build artifacts)"
557
- ]
558
-
559
- const buildResult = app.chooseFromList(buildModes, {
560
- withTitle: "🔨 BUILD CONFIGURATION (Step 4/6)",
561
- withPrompt: "Version: ${versionChoice.versionType} (${versionChoice.versionPrefix})\\n\\nSelect build mode:",
562
- defaultItems: ["full (all modules + complete bundle)"]
563
- })
564
-
565
- if (buildResult === false) {
566
- JSON.stringify({ action: "back" })
567
- } else {
568
- const buildMode = buildResult[0].split(" ")[0]
569
- JSON.stringify({
570
- action: "next",
571
- buildMode: buildMode
572
- })
573
- }
574
- `
575
-
576
- const buildResult = execSync(`osascript -l JavaScript -e '${buildScript.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
577
- const buildChoice = JSON.parse(buildResult)
578
-
579
- if (buildChoice.action === "back") {
580
- return this.navigation.goBack()!
581
- }
582
-
583
- // Work Details
584
- const workScript = `
585
- const app = Application.currentApplication()
586
- app.includeStandardAdditions = true
587
-
588
- // Get context
589
- const contextResult = app.displayDialog("💭 DESCRIBE CHANGES (Step 5/6)\\n\\nDescribe what you implemented/fixed:", {
590
- defaultAnswer: "",
591
- withTitle: "🚀 Release Context",
592
- buttons: ["← Back", "Next →"],
593
- defaultButton: "Next →"
594
- })
595
-
596
- if (contextResult.buttonReturned === "← Back") {
597
- JSON.stringify({ action: "back" })
598
- } else {
599
- const context = contextResult.textReturned
600
-
601
- // Work type - using centralized config
602
- const workTypes = [
603
- "feature (New functionality or capabilities)",
604
- "fix (Bug fixes and issue resolution)",
605
- "refactor (Code improvements without functional changes)",
606
- "docs (Documentation updates and improvements)",
607
- "test (Testing improvements and new test cases)",
608
- "chore (Maintenance tasks and dependency updates)",
609
- "perf (Performance improvements and optimizations)"
610
- ]
611
-
612
- const workResult = app.chooseFromList(workTypes, {
613
- withTitle: "🏷️ WORK TYPE (Step 6/6)",
614
- withPrompt: "Context: " + context + "\\n\\nSelect primary work type:",
615
- defaultItems: ["feature (new functionality)"]
616
- })
617
-
618
- if (workResult === false) {
619
- JSON.stringify({ action: "back" })
620
- } else {
621
- const workType = workResult[0].split(" ")[0]
622
-
623
- // Components - using centralized config
624
- const components = [
625
- "core (Core logging functionality and Logger class)",
626
- "styling (Visual features, themes, and CSS styling system)",
627
- "exports (Export handlers and remote logging capabilities)",
628
- "cli (Command-line interface and utilities)",
629
- "docs (Documentation, README files, and guides)",
630
- "tests (Test suites, fixtures, and testing utilities)",
631
- "examples (Usage examples and sample applications)",
632
- "workflows (GitHub Actions workflows and CI/CD configuration)"
633
- ]
634
- const componentResult = app.chooseFromList(components, {
635
- withTitle: "📦 AFFECTED COMPONENTS",
636
- withPrompt: "Context: " + context + "\\nType: " + workType + "\\n\\nSelect affected components:",
637
- multipleSelectionsAllowed: true,
638
- defaultItems: ["core (Core logging functionality and Logger class)"]
639
- })
640
-
641
- const affectedComponents = componentResult === false ? ["core"] : componentResult.map(c => c.split(" ")[0])
642
-
643
- JSON.stringify({
644
- action: "next",
645
- context: context,
646
- workType: workType,
647
- affectedComponents: affectedComponents
648
- })
649
- }
650
- }
651
- `
652
-
653
- const workResult = execSync(`osascript -l JavaScript -e '${workScript.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
654
- const workChoice = JSON.parse(workResult)
655
-
656
- if (workChoice.action === "back") {
657
- return this.navigation.goBack()!
658
- }
659
-
660
- // Publishing options - quick dialog
661
- const publishScript = `
662
- const app = Application.currentApplication()
663
- app.includeStandardAdditions = true
664
-
665
- const publishOptions = [
666
- "GitHub Release only",
667
- "NPM Registry + GitHub Release",
668
- "GitHub Packages + GitHub Release",
669
- "Full publish (NPM + GitHub + Packages)",
670
- "No publishing"
671
- ]
672
-
673
- const publishResult = app.chooseFromList(publishOptions, {
674
- withTitle: "📤 PUBLISHING OPTIONS",
675
- withPrompt: "Select publishing targets:",
676
- defaultItems: ["GitHub Release only"]
677
- })
678
-
679
- if (publishResult === false) {
680
- JSON.stringify({ action: "back" })
681
- } else {
682
- const selected = publishResult[0]
683
- JSON.stringify({
684
- action: "next",
685
- publishOption: selected
686
- })
687
- }
688
- `
689
-
690
- const publishResult = execSync(`osascript -l JavaScript -e '${publishScript.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
691
- const publishChoice = JSON.parse(publishResult)
692
-
693
- if (publishChoice.action === "back") {
694
- return this.navigation.goBack()!
695
- }
696
-
697
- // Build final configuration
698
- const finalConfig: Partial<ReleaseOptions> = {
699
- ...config,
700
- versionType: versionChoice.versionType as any,
701
- versionPrefix: versionChoice.versionPrefix as any,
702
- buildMode: buildChoice.buildMode as any,
703
- context: workChoice.context,
704
- workType: workChoice.workType as any,
705
- affectedComponents: workChoice.affectedComponents,
706
- createGitHubRelease: !publishChoice.publishOption.includes("No publishing"),
707
- publishNpm: publishChoice.publishOption.includes("NPM Registry"),
708
- publishGitHub: publishChoice.publishOption.includes("GitHub Packages"),
709
- performanceImpact: 'none',
710
- useAI: true,
711
- selectedModules: [],
712
- docsOnly: false,
713
- skipTests: false,
714
- skipTypeCheck: false,
715
- keepLocalChanges: false
716
- }
717
-
718
- return this.navigation.goNext({
719
- config: finalConfig
720
- })
721
-
722
- } catch (error) {
723
- throw new Error("Cancelled")
724
- }
725
- }
726
-
727
- private async macOSStep3_Confirmation(currentState: UIState): Promise<UIState> {
728
- const config = currentState.config
729
- const preview = this.navigation.getCurrentState().previewCommand
730
-
731
- const script = `
732
- const app = Application.currentApplication()
733
- app.includeStandardAdditions = true
734
-
735
- const summary = "🚀 FINAL CONFIRMATION (Step 3/3)\\n" +
736
- "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n\\n" +
737
- "✅ READY TO EXECUTE:\\n" +
738
- "━━━━━━━━━━━━━━━━━━\\n\\n" +
739
- "🎯 Actions that will be performed:\\n" +
740
- "1. ${config.autoCommit ? 'Auto-commit pending changes' : 'Use current committed state'}\\n" +
741
- "2. Generate version: ${config.versionType} (${config.versionPrefix})\\n" +
742
- "3. Build: ${config.buildMode} modules\\n" +
743
- "4. ${config.useAI ? 'Generate AI documentation with Gemini' : 'Generate basic documentation'}\\n" +
744
- "5. Commit: ${config.workType}(${(config.affectedComponents || []).join(',')})\\n" +
745
- "6. ${config.createGitHubRelease ? 'Create GitHub Release' : 'Skip GitHub Release'}\\n" +
746
- "7. ${config.publishNpm ? 'Publish to NPM Registry' : ''}${config.publishGitHub ? 'Publish to GitHub Packages' : ''}\\n\\n" +
747
- "⏱️ Estimated time: 3-5 minutes\\n" +
748
- "💾 Backup: Auto-backup branch will be created\\n\\n" +
749
- "🔍 PREVIEW COMMAND:\\n" +
750
- "${preview}"
751
-
752
- const result = app.displayDialog(summary, {
753
- withTitle: "🚀 Execute Release",
754
- buttons: ["← Back", "Cancel", "🚀 Execute"],
755
- defaultButton: "🚀 Execute"
756
- })
757
-
758
- if (result.buttonReturned === "← Back") {
759
- JSON.stringify({ action: "back" })
760
- } else if (result.buttonReturned === "Cancel") {
761
- JSON.stringify({ action: "cancel" })
762
- } else {
763
- JSON.stringify({ action: "execute" })
764
- }
765
- `
766
-
767
- try {
768
- const result = execSync(`osascript -l JavaScript -e '${script.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
769
- const choice = JSON.parse(result)
770
-
771
- if (choice.action === "back") {
772
- return this.navigation.goBack()!
773
- } else if (choice.action === "cancel") {
774
- throw new Error("Cancelled")
775
- } else {
776
- // Ready to execute
777
- return this.navigation.goNext({
778
- step: 4 // Beyond maxStep to exit wizard
779
- })
780
- }
781
- } catch (error) {
782
- throw new Error("Cancelled")
783
- }
784
- }
785
-
786
- private async linuxWizard(): Promise<ReleaseOptions> {
787
- // Simplified Linux implementation
788
- console.log("🐧 Linux wizard not fully implemented yet")
789
- return this.fallbackWizard()
790
- }
791
-
792
- private async fallbackWizard(): Promise<ReleaseOptions> {
793
- const readline = require('readline').createInterface({
794
- input: process.stdin,
795
- output: process.stdout
796
- })
797
-
798
- const question = (prompt: string): Promise<string> => {
799
- return new Promise((resolve) => {
800
- readline.question(prompt, resolve)
801
- })
802
- }
803
-
804
- console.log("\n🚀 AUTO-RELEASE MANAGER")
805
- console.log("=" .repeat(50))
806
-
807
- const status = this.navigation.getCurrentState().projectStatus
808
- console.log(`📦 Current: ${status.currentVersion}`)
809
- console.log(`📋 Last: ${status.lastRelease} (${status.lastReleaseDate})`)
810
- console.log(`${status.isClean ? '✅' : '⚠️'} Git: ${status.isClean ? 'Clean' : 'Has changes'}`)
811
-
812
- console.log("\nQuick actions:")
813
- const quickActions = this.getQuickActions()
814
- quickActions.forEach((action, i) => {
815
- console.log(`${i + 1}. ${action.emoji} ${action.name} → ${action.resultingVersion}`)
816
- })
817
- console.log(`${quickActions.length + 1}. ⚙️ Custom configuration`)
818
-
819
- const choice = await question(`\nSelect (1-${quickActions.length + 1}): `)
820
- const choiceNum = parseInt(choice)
821
-
822
- if (choiceNum >= 1 && choiceNum <= quickActions.length) {
823
- const selected = quickActions[choiceNum - 1]
824
- const config: ReleaseOptions = {
825
- ...selected.config,
826
- context: `${selected.description} release`,
827
- affectedComponents: ['core'],
828
- selectedModules: [],
829
- docsOnly: false,
830
- skipTests: false,
831
- skipTypeCheck: false,
832
- keepLocalChanges: false
833
- } as ReleaseOptions
834
-
835
- console.log(`\n✅ Selected: ${selected.name}`)
836
- console.log(`📋 Will create: ${selected.resultingVersion}`)
837
-
838
- const confirm = await question("Continue? (y/n): ")
839
- if (confirm.toLowerCase() !== 'y') {
840
- throw new Error("Cancelled")
841
- }
842
-
843
- readline.close()
844
- return config
845
- } else {
846
- // Custom configuration - simplified
847
- console.log("\n⚙️ Custom Configuration")
848
- const versionType = await question("Version type (patch/minor/major) [patch]: ") || "patch"
849
- const workType = await question(`Work type (${getWorkTypeIds().slice(0, 5).join('/')}) [feature]: `) || "feature"
850
- const context = await question("Describe changes: ")
851
- const componentsInput = await question(`Components (${getComponentIds().join(',')}): `) || "core"
852
- const publishNpm = await question("Publish to NPM? (y/n) [n]: ")
853
-
854
- readline.close()
855
-
856
- return {
857
- versionType: versionType as any,
858
- versionPrefix: 'stable',
859
- buildMode: 'full',
860
- workType: workType as any,
861
- context,
862
- affectedComponents: componentsInput.split(",").map(c => c.trim()),
863
- createGitHubRelease: true,
864
- publishNpm: publishNpm.toLowerCase() === 'y',
865
- publishGitHub: false,
866
- useAI: true,
867
- dryRun: false,
868
- autoApprove: false,
869
- autoCommit: false,
870
- force: false,
871
- quiet: false,
872
- selectedModules: [],
873
- docsOnly: false,
874
- performanceImpact: 'none',
875
- skipTests: false,
876
- skipTypeCheck: false,
877
- keepLocalChanges: false
878
- }
879
- }
880
- }
881
-
882
- async executeRelease(options: ReleaseOptions): Promise<void> {
883
- console.log("\n🚀 Executing Auto-Release...")
884
- console.log("=============================")
885
-
886
- // Build command arguments
887
- const args: string[] = []
888
-
889
- if (options.useAI) args.push("--ai")
890
- if (options.dryRun) args.push("--dry-run")
891
- if (options.autoApprove) args.push("--auto-approve")
892
- if (options.autoCommit) args.push("--auto-commit")
893
- if (options.force) args.push("--force")
894
- if (options.versionType !== 'auto') {
895
- args.push("--type", options.versionType)
896
- }
897
- if (options.versionPrefix !== 'stable') {
898
- args.push("--prefix", options.versionPrefix)
899
- }
900
- args.push("--work-type", options.workType)
901
- args.push("--affected-components", options.affectedComponents.join(","))
902
- args.push("--context", `"${options.context}"`)
903
- if (options.performanceImpact !== 'none') {
904
- args.push("--performance-impact", options.performanceImpact)
905
- }
906
-
907
- // Extended context parameters
908
- if (options.focusArea) {
909
- args.push("--focus", `"${options.focusArea}"`)
910
- }
911
- if (options.targetPlatform && options.targetPlatform !== 'universal') {
912
- args.push("--target-platform", options.targetPlatform)
913
- }
914
- if (options.urgency && options.urgency !== 'normal') {
915
- args.push("--urgency", options.urgency)
916
- }
917
- if (options.targetAudience && options.targetAudience !== 'public') {
918
- args.push("--audience", options.targetAudience)
919
- }
920
- if (options.dependencies && options.dependencies !== 'both') {
921
- args.push("--dependencies", options.dependencies)
922
- }
923
-
924
- if (!options.createGitHubRelease) args.push("--no-github")
925
- if (options.publishNpm) args.push("--publish-npm")
926
- if (options.publishGitHub) args.push("--publish-github")
927
-
928
- const command = `bun project-utils/auto-release-gemini.ts ${args.join(" ")}`
929
- console.log(`\n📋 Executing: ${command}`)
930
- console.log("=" .repeat(50))
931
-
932
- try {
933
- execSync(command, { stdio: 'inherit' })
934
- console.log("\n✅ Release completed successfully!")
935
- } catch (error) {
936
- console.error("\n❌ Release failed:", error)
937
- console.log("\n🔧 Troubleshooting:")
938
- console.log("- Check git status: git status")
939
- console.log("- View recent commits: git log --oneline -5")
940
- console.log("- Retry with --dry-run to test")
941
- process.exit(1)
942
- }
943
- }
944
-
945
- private async handleUncommittedChanges(currentState: UIState): Promise<UIState> {
946
- const status = currentState.projectStatus
947
-
948
- if (!status.hasUncommitted) {
949
- // No hay cambios, mostrar commits desde última release
950
- return await this.showCommitsSinceLastRelease(currentState)
951
- }
952
-
953
- // Hay cambios no commiteados - proponer commit
954
- if (this.platform === "darwin") {
955
- return await this.macOSCommitDialog(currentState)
956
- } else {
957
- return await this.fallbackCommitDialog(currentState)
958
- }
959
- }
960
-
961
- private async showCommitsSinceLastRelease(currentState: UIState): Promise<UIState> {
962
- try {
963
- // Obtener commits desde la última release
964
- const lastTag = execSync('git describe --tags --abbrev=0 2>/dev/null || echo "HEAD~10"', { encoding: 'utf-8' }).trim()
965
- const commits = execSync(`git log ${lastTag}..HEAD --oneline`, { encoding: 'utf-8' }).trim()
966
-
967
- if (this.platform === "darwin") {
968
- const script = `
969
- const app = Application.currentApplication()
970
- app.includeStandardAdditions = true
971
-
972
- const commitsText = "${commits.replace(/\n/g, '\\n')}"
973
- const message = "📋 COMMITS SINCE LAST RELEASE\\n" +
974
- "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n\\n" +
975
- "✅ Working directory is clean\\n" +
976
- "📦 Last release: ${currentState.projectStatus.lastRelease}\\n\\n" +
977
- "🎯 Commits to be included:\\n" +
978
- (commitsText || "No new commits since last release") + "\\n\\n" +
979
- "Ready to proceed with release?"
980
-
981
- const result = app.displayDialog(message, {
982
- withTitle: "🚀 Release Preview",
983
- buttons: ["Cancel", "Continue →"],
984
- defaultButton: "Continue →"
985
- })
986
-
987
- if (result.buttonReturned === "Cancel") {
988
- JSON.stringify({ action: "cancel" })
989
- } else {
990
- JSON.stringify({ action: "continue" })
991
- }
992
- `
993
-
994
- const result = execSync(`osascript -l JavaScript -e '${script.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
995
- const choice = JSON.parse(result)
996
-
997
- if (choice.action === "cancel") {
998
- throw new Error("Cancelled")
999
- }
1000
-
1001
- return currentState // Continue with existing flow
1002
- } else {
1003
- console.log("\n📋 COMMITS SINCE LAST RELEASE:")
1004
- console.log("=" .repeat(50))
1005
- console.log(`Last release: ${currentState.projectStatus.lastRelease}`)
1006
- console.log("\nCommits to include:")
1007
- console.log(commits || "No new commits since last release")
1008
- console.log("\n✅ Working directory is clean - ready for release")
1009
-
1010
- return currentState
1011
- }
1012
- } catch (error) {
1013
- console.warn("⚠️ Could not fetch commit history")
1014
- return currentState
1015
- }
1016
- }
1017
-
1018
- private async macOSCommitDialog(currentState: UIState): Promise<UIState> {
1019
- const status = currentState.projectStatus
1020
-
1021
- const script = `
1022
- const app = Application.currentApplication()
1023
- app.includeStandardAdditions = true
1024
-
1025
- const changesText = "${status.gitStatus.split('\n').slice(0, 10).join('\\n').replace(/"/g, '\\"')}"
1026
- const message = "⚠️ UNCOMMITTED CHANGES DETECTED\\n" +
1027
- "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n\\n" +
1028
- "📝 Files with changes:\\n" +
1029
- changesText + "\\n\\n" +
1030
- "🤔 What would you like to do?"
1031
-
1032
- const options = [
1033
- "🤖 Use Commit UI (interactive)",
1034
- "📝 Quick commit (auto-generated)",
1035
- "⏭️ Skip commit (use as-is)",
1036
- "❌ Cancel release"
1037
- ]
1038
-
1039
- const result = app.chooseFromList(options, {
1040
- withTitle: "🚀 Handle Changes",
1041
- withPrompt: message,
1042
- defaultItems: ["🤖 Use Commit UI (interactive)"]
1043
- })
1044
-
1045
- if (result === false) {
1046
- JSON.stringify({ action: "cancel" })
1047
- } else {
1048
- const selected = result[0]
1049
- if (selected.includes("Commit UI")) {
1050
- JSON.stringify({ action: "commit-ui" })
1051
- } else if (selected.includes("Quick commit")) {
1052
- JSON.stringify({ action: "quick-commit" })
1053
- } else if (selected.includes("Skip")) {
1054
- JSON.stringify({ action: "skip" })
1055
- } else {
1056
- JSON.stringify({ action: "cancel" })
1057
- }
1058
- }
1059
- `
1060
-
1061
- try {
1062
- const result = execSync(`osascript -l JavaScript -e '${script.replace(/'/g, "\\'")}'`, { encoding: 'utf-8' }).trim()
1063
- const choice = JSON.parse(result)
1064
-
1065
- switch (choice.action) {
1066
- case "commit-ui":
1067
- console.log("🚀 Launching interactive commit UI...")
1068
- execSync('bun project-utils/commit-ui.ts', { stdio: 'inherit' })
1069
- // Refresh project status after commit
1070
- const newStatus = this.getProjectStatus()
1071
- return { ...currentState, projectStatus: newStatus }
1072
-
1073
- case "quick-commit":
1074
- console.log("📝 Creating quick commit...")
1075
- execSync('bun project-utils/commit-generator.ts --auto-approve --context "Pre-release changes"', { stdio: 'inherit' })
1076
- const refreshedStatus = this.getProjectStatus()
1077
- return { ...currentState, projectStatus: refreshedStatus }
1078
-
1079
- case "skip":
1080
- console.log("⏭️ Proceeding with uncommitted changes...")
1081
- return currentState
1082
-
1083
- default:
1084
- throw new Error("Cancelled")
1085
- }
1086
- } catch (error) {
1087
- throw new Error("Cancelled")
1088
- }
1089
- }
1090
-
1091
- private async fallbackCommitDialog(currentState: UIState): Promise<UIState> {
1092
- const readline = require('readline').createInterface({
1093
- input: process.stdin,
1094
- output: process.stdout
1095
- })
1096
-
1097
- const question = (prompt: string): Promise<string> => {
1098
- return new Promise((resolve) => {
1099
- readline.question(prompt, resolve)
1100
- })
1101
- }
1102
-
1103
- console.log("\n⚠️ UNCOMMITTED CHANGES DETECTED")
1104
- console.log("=" .repeat(50))
1105
- console.log("Files with changes:")
1106
- console.log(currentState.projectStatus.gitStatus.split('\n').slice(0, 10).join('\n'))
1107
-
1108
- console.log("\nOptions:")
1109
- console.log("1. 🤖 Interactive Commit UI")
1110
- console.log("2. 📝 Quick auto-commit")
1111
- console.log("3. ⏭️ Skip (proceed as-is)")
1112
- console.log("4. ❌ Cancel")
1113
-
1114
- const choice = await question("\nSelect option (1-4): ")
1115
- readline.close()
1116
-
1117
- switch (choice) {
1118
- case "1":
1119
- console.log("🚀 Launching commit UI...")
1120
- execSync('bun project-utils/commit-ui.ts', { stdio: 'inherit' })
1121
- const newStatus = this.getProjectStatus()
1122
- return { ...currentState, projectStatus: newStatus }
1123
-
1124
- case "2":
1125
- console.log("📝 Creating quick commit...")
1126
- execSync('bun project-utils/commit-generator.ts --auto-approve --context "Pre-release changes"', { stdio: 'inherit' })
1127
- const refreshedStatus = this.getProjectStatus()
1128
- return { ...currentState, projectStatus: refreshedStatus }
1129
-
1130
- case "3":
1131
- console.log("⏭️ Proceeding with uncommitted changes...")
1132
- return currentState
1133
-
1134
- default:
1135
- throw new Error("Cancelled")
1136
- }
1137
- }
1138
- }
1139
-
1140
- async function runTypeCheck(): Promise<void> {
1141
- console.log('🔍 Running type check...')
1142
-
1143
- try {
1144
- execSync('npm run type-check', {
1145
- stdio: ['pipe', 'pipe', 'pipe'],
1146
- encoding: 'utf-8'
1147
- })
1148
- console.log('✅ Type check passed')
1149
- } catch (error) {
1150
- console.log('❌ Type check failed:', error)
1151
- process.exit(1)
1152
- }
1153
- }
1154
-
1155
- async function main() {
1156
- const ui = new AutoReleaseUIv2()
1157
-
1158
- // Check for quick mode with presets
1159
- const args = process.argv.slice(2)
1160
-
1161
- if (args.includes("--help") || args.includes("-h")) {
1162
- console.log(`
1163
- 🚀 Interactive Auto-Release UI v2.0
1164
-
1165
- Usage:
1166
- bun project-utils/auto-release-ui.ts [options]
1167
-
1168
- Quick Actions:
1169
- --hotfix 🚨 Critical patch + immediate publish
1170
- --feature ✨ New feature + GitHub release
1171
- --alpha 🧪 Testing release + GitHub packages
1172
- --major 💥 Breaking changes + full release
1173
-
1174
- Options:
1175
- --help, -h Show this help
1176
-
1177
- Features:
1178
- ✅ Smart commit detection & integration with commit-ui
1179
- ✅ Navigation with Back/Forward buttons
1180
- ✅ Comprehensive project status display
1181
- ✅ Preview commands before execution
1182
- ✅ Quick actions for common release types
1183
- ✅ Robust error handling & cancellation
1184
- ✅ Cross-platform support (macOS/Linux/fallback)
1185
-
1186
- Examples:
1187
- bun project-utils/auto-release-ui.ts # Interactive wizard
1188
- npm run release:ui # Via npm script
1189
- npm run release:hotfix # Quick hotfix
1190
- npm run release:alpha # Alpha release
1191
- `)
1192
- process.exit(0)
1193
- }
1194
-
1195
- // Quick mode shortcuts
1196
- let quickOptions: ReleaseOptions | null = null
1197
-
1198
- if (args.includes("--hotfix")) {
1199
- quickOptions = {
1200
- versionType: 'patch',
1201
- versionPrefix: 'stable',
1202
- buildMode: 'full',
1203
- workType: 'fix',
1204
- affectedComponents: ['core'],
1205
- context: 'Critical hotfix release',
1206
- performanceImpact: 'none',
1207
- createGitHubRelease: true,
1208
- publishNpm: true,
1209
- publishGitHub: false,
1210
- useAI: true,
1211
- dryRun: false,
1212
- autoApprove: true,
1213
- autoCommit: true,
1214
- force: false,
1215
- quiet: false,
1216
- selectedModules: [],
1217
- docsOnly: false,
1218
- skipTests: false,
1219
- skipTypeCheck: false,
1220
- keepLocalChanges: false
1221
- }
1222
- } else if (args.includes("--feature")) {
1223
- quickOptions = {
1224
- versionType: 'minor',
1225
- versionPrefix: 'stable',
1226
- buildMode: 'full',
1227
- workType: 'feature',
1228
- affectedComponents: ['core'],
1229
- context: 'Feature release',
1230
- performanceImpact: 'none',
1231
- createGitHubRelease: true,
1232
- publishNpm: false,
1233
- publishGitHub: false,
1234
- useAI: true,
1235
- dryRun: false,
1236
- autoApprove: false,
1237
- autoCommit: false,
1238
- force: false,
1239
- quiet: false,
1240
- selectedModules: [],
1241
- docsOnly: false,
1242
- skipTests: false,
1243
- skipTypeCheck: false,
1244
- keepLocalChanges: false
1245
- }
1246
- } else if (args.includes("--alpha")) {
1247
- quickOptions = {
1248
- versionType: 'minor',
1249
- versionPrefix: 'alpha',
1250
- buildMode: 'full',
1251
- workType: 'feature',
1252
- affectedComponents: ['core'],
1253
- context: 'Alpha testing release',
1254
- performanceImpact: 'none',
1255
- createGitHubRelease: true,
1256
- publishNpm: false,
1257
- publishGitHub: true,
1258
- useAI: true,
1259
- dryRun: false,
1260
- autoApprove: false,
1261
- autoCommit: false,
1262
- force: false,
1263
- quiet: false,
1264
- selectedModules: [],
1265
- docsOnly: false,
1266
- skipTests: false,
1267
- skipTypeCheck: false,
1268
- keepLocalChanges: false
1269
- }
1270
- } else if (args.includes("--major")) {
1271
- quickOptions = {
1272
- versionType: 'major',
1273
- versionPrefix: 'stable',
1274
- buildMode: 'full',
1275
- workType: 'feature',
1276
- affectedComponents: ['core', 'styling', 'exports'],
1277
- context: 'Major version release',
1278
- performanceImpact: 'major',
1279
- createGitHubRelease: true,
1280
- publishNpm: true,
1281
- publishGitHub: false,
1282
- useAI: true,
1283
- dryRun: false,
1284
- autoApprove: false,
1285
- autoCommit: false,
1286
- force: false,
1287
- quiet: false,
1288
- selectedModules: [],
1289
- docsOnly: false,
1290
- skipTests: false,
1291
- skipTypeCheck: false,
1292
- keepLocalChanges: false
1293
- }
1294
- }
1295
-
1296
- try {
1297
- let options: ReleaseOptions
1298
-
1299
- if (quickOptions) {
1300
- console.log("🚀 Using quick mode preset")
1301
- options = quickOptions
1302
- } else {
1303
- // Interactive mode with commit handling
1304
- console.log("🚀 Starting interactive release wizard...")
1305
-
1306
- // First check and handle commits
1307
- let state = ui['navigation'].getCurrentState()
1308
- state = await ui['handleUncommittedChanges'](state)
1309
-
1310
- // Then collect release configuration
1311
- options = await ui.collectReleaseInfo()
1312
- }
1313
-
1314
- // Execute release
1315
- await ui.executeRelease(options)
1316
-
1317
- } catch (error) {
1318
- if (error instanceof Error && error.message === "Cancelled") {
1319
- console.log("❌ Release cancelled by user")
1320
- process.exit(0)
1321
- }
1322
- console.error("❌ Error:", error)
1323
- process.exit(1)
1324
- }
1325
- }
1326
-
1327
- if (import.meta.main) {
1328
- main()
1329
- }