@mks2508/better-logger 5.0.1 → 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.
- package/dist/Logger.d.ts +976 -0
- package/dist/Logger.d.ts.map +1 -0
- package/dist/ScopedLogger.d.ts +74 -0
- package/dist/ScopedLogger.d.ts.map +1 -0
- package/dist/chunks/Logger-CKqzXDh3.js +2 -0
- package/dist/chunks/Logger-CKqzXDh3.js.map +1 -0
- package/dist/chunks/Logger-D_vuKP4l.js +4511 -0
- package/dist/chunks/Logger-D_vuKP4l.js.map +1 -0
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js +33 -0
- package/dist/chunks/RemoteLogHandler-CjWpWZGl.js.map +1 -0
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js +2 -0
- package/dist/chunks/RemoteLogHandler-ymkQ97xl.js.map +1 -0
- package/dist/chunks/cli-module-B-njrTWb.js +2 -0
- package/dist/chunks/cli-module-B-njrTWb.js.map +1 -0
- package/dist/chunks/cli-module-Cx7qotPY.js +390 -0
- package/dist/chunks/cli-module-Cx7qotPY.js.map +1 -0
- package/dist/chunks/color-converter-CCSQRztd.js +2 -0
- package/dist/chunks/color-converter-CCSQRztd.js.map +1 -0
- package/dist/chunks/color-converter-_Xdmsy7E.js +462 -0
- package/dist/chunks/color-converter-_Xdmsy7E.js.map +1 -0
- package/dist/chunks/environment-C1xxvc8l.js +1127 -0
- package/dist/chunks/environment-C1xxvc8l.js.map +1 -0
- package/dist/chunks/environment-Cprkw3g9.js +4 -0
- package/dist/chunks/environment-Cprkw3g9.js.map +1 -0
- package/dist/chunks/formatting-DMJxYq9o.js +380 -0
- package/dist/chunks/formatting-DMJxYq9o.js.map +1 -0
- package/dist/chunks/formatting-DpKxCsXq.js +2 -0
- package/dist/chunks/formatting-DpKxCsXq.js.map +1 -0
- package/dist/cli/CommandProcessor.d.ts +100 -0
- package/dist/cli/CommandProcessor.d.ts.map +1 -0
- package/dist/cli/commands/ConfigCommand.d.ts +14 -0
- package/dist/cli/commands/ConfigCommand.d.ts.map +1 -0
- package/dist/cli/commands/ExportCommand.d.ts +48 -0
- package/dist/cli/commands/ExportCommand.d.ts.map +1 -0
- package/dist/cli/commands/HistoryCommand.d.ts +47 -0
- package/dist/cli/commands/HistoryCommand.d.ts.map +1 -0
- package/dist/cli/commands/StatusCommand.d.ts +30 -0
- package/dist/cli/commands/StatusCommand.d.ts.map +1 -0
- package/dist/cli/commands/ThemeCommand.d.ts +30 -0
- package/dist/cli/commands/ThemeCommand.d.ts.map +1 -0
- package/dist/cli/help.d.ts +12 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/{src/cli-module.ts → dist/cli-module.d.ts} +2 -8
- package/dist/cli-module.d.ts.map +1 -0
- package/dist/cli-primitives/box.d.ts +11 -0
- package/dist/cli-primitives/box.d.ts.map +1 -0
- package/dist/cli-primitives/cli-table.d.ts +11 -0
- package/dist/cli-primitives/cli-table.d.ts.map +1 -0
- package/dist/cli-primitives/divider.d.ts +11 -0
- package/dist/cli-primitives/divider.d.ts.map +1 -0
- package/dist/cli-primitives/header.d.ts +12 -0
- package/dist/cli-primitives/header.d.ts.map +1 -0
- package/{src/cli-primitives/index.ts → dist/cli-primitives/index.d.ts} +1 -1
- package/dist/cli-primitives/index.d.ts.map +1 -0
- package/dist/cli-primitives/server-fallback.d.ts +25 -0
- package/dist/cli-primitives/server-fallback.d.ts.map +1 -0
- package/dist/cli-primitives/spinner.d.ts +47 -0
- package/dist/cli-primitives/spinner.d.ts.map +1 -0
- package/dist/cli-primitives/step.d.ts +11 -0
- package/dist/cli-primitives/step.d.ts.map +1 -0
- package/dist/cli.cjs +2 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.d.ts +235 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.ts +127 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +291 -0
- package/dist/core.js.map +1 -0
- package/dist/example.d.ts +18 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/exports-module.d.ts +196 -0
- package/dist/exports-module.d.ts.map +1 -0
- package/dist/exports.cjs +2 -0
- package/dist/exports.cjs.map +1 -0
- package/dist/exports.js +238 -0
- package/dist/exports.js.map +1 -0
- package/dist/handlers/AnalyticsLogHandler.d.ts +8 -0
- package/dist/handlers/AnalyticsLogHandler.d.ts.map +1 -0
- package/dist/handlers/ExportLogHandler.d.ts +100 -0
- package/dist/handlers/ExportLogHandler.d.ts.map +1 -0
- package/dist/handlers/FileLogHandler.d.ts +33 -0
- package/dist/handlers/FileLogHandler.d.ts.map +1 -0
- package/dist/handlers/RemoteLogHandler.d.ts +11 -0
- package/dist/handlers/RemoteLogHandler.d.ts.map +1 -0
- package/{src/handlers/index.ts → dist/handlers/index.d.ts} +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/hooks/HookManager.d.ts +21 -0
- package/dist/hooks/HookManager.d.ts.map +1 -0
- package/{src/hooks/index.ts → dist/hooks/index.d.ts} +1 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +161 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +627 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/serializers/SerializerRegistry.d.ts +16 -0
- package/dist/serializers/SerializerRegistry.d.ts.map +1 -0
- package/{src/serializers/index.ts → dist/serializers/index.d.ts} +1 -0
- package/dist/serializers/index.d.ts.map +1 -0
- package/dist/styling/LogStyleBuilder.d.ts +146 -0
- package/dist/styling/LogStyleBuilder.d.ts.map +1 -0
- package/dist/styling/SemanticStyles.d.ts +178 -0
- package/dist/styling/SemanticStyles.d.ts.map +1 -0
- package/dist/styling/SmartPresets.d.ts +22 -0
- package/dist/styling/SmartPresets.d.ts.map +1 -0
- package/dist/styling/StyleBuilder.d.ts +140 -0
- package/dist/styling/StyleBuilder.d.ts.map +1 -0
- package/dist/styling/StyleCache.d.ts +42 -0
- package/dist/styling/StyleCache.d.ts.map +1 -0
- package/dist/styling/banners.d.ts +42 -0
- package/dist/styling/banners.d.ts.map +1 -0
- package/dist/styling/index.d.ts +10 -0
- package/dist/styling/index.d.ts.map +1 -0
- package/dist/styling/themes.d.ts +7 -0
- package/dist/styling/themes.d.ts.map +1 -0
- package/dist/styling-module.d.ts +178 -0
- package/dist/styling-module.d.ts.map +1 -0
- package/dist/styling.cjs +2 -0
- package/dist/styling.cjs.map +1 -0
- package/dist/styling.js +146 -0
- package/dist/styling.js.map +1 -0
- package/dist/terminal/color-converter.d.ts +73 -0
- package/dist/terminal/color-converter.d.ts.map +1 -0
- package/dist/terminal/formatter.d.ts +20 -0
- package/dist/terminal/formatter.d.ts.map +1 -0
- package/dist/terminal/terminal-renderer.d.ts +77 -0
- package/dist/terminal/terminal-renderer.d.ts.map +1 -0
- package/dist/transports/ConsoleTransport.d.ts +9 -0
- package/dist/transports/ConsoleTransport.d.ts.map +1 -0
- package/dist/transports/FileTransport.d.ts +15 -0
- package/dist/transports/FileTransport.d.ts.map +1 -0
- package/dist/transports/HttpTransport.d.ts +16 -0
- package/dist/transports/HttpTransport.d.ts.map +1 -0
- package/dist/transports/TransportManager.d.ts +14 -0
- package/dist/transports/TransportManager.d.ts.map +1 -0
- package/{src/transports/index.ts → dist/transports/index.d.ts} +1 -0
- package/dist/transports/index.d.ts.map +1 -0
- package/{src/types/core.ts → dist/types/core.d.ts} +25 -62
- package/dist/types/core.d.ts.map +1 -0
- package/{src/types/handlers.ts → dist/types/handlers.d.ts} +5 -15
- package/dist/types/handlers.d.ts.map +1 -0
- package/{src/types/hooks.ts → dist/types/hooks.d.ts} +3 -12
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/{src/types/serializers.ts → dist/types/serializers.d.ts} +1 -6
- package/dist/types/serializers.d.ts.map +1 -0
- package/{src/types/transports.ts → dist/types/transports.d.ts} +2 -7
- package/dist/types/transports.d.ts.map +1 -0
- package/dist/utils/adapter.d.ts +48 -0
- package/dist/utils/adapter.d.ts.map +1 -0
- package/dist/utils/ansi-colors.d.ts +156 -0
- package/dist/utils/ansi-colors.d.ts.map +1 -0
- package/dist/utils/environment-detector.d.ts +45 -0
- package/dist/utils/environment-detector.d.ts.map +1 -0
- package/dist/utils/environment.d.ts +47 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/formatting.d.ts +58 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/opentui-detection.d.ts +34 -0
- package/dist/utils/opentui-detection.d.ts.map +1 -0
- package/dist/utils/output.d.ts +46 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/stackTrace.d.ts +6 -0
- package/dist/utils/stackTrace.d.ts.map +1 -0
- package/dist/utils/timestamps.d.ts +20 -0
- package/dist/utils/timestamps.d.ts.map +1 -0
- package/{src/writers/BufferWriter.ts → dist/writers/BufferWriter.d.ts} +16 -77
- package/dist/writers/BufferWriter.d.ts.map +1 -0
- package/{src/writers/index.ts → dist/writers/index.d.ts} +1 -1
- package/dist/writers/index.d.ts.map +1 -0
- package/package.json +5 -1
- package/.claude/settings.local.json +0 -48
- package/.github/workflows/ci-quality.yml +0 -357
- package/.github/workflows/docs-demo.yml +0 -119
- package/.github/workflows/releases-core.yml +0 -512
- package/.github/workflows/releases-full.yml +0 -582
- package/.github/workflows-backup/ci.yml +0 -221
- package/.github/workflows-backup/nightly.yml +0 -196
- package/.github/workflows-backup/release-optimized.yml +0 -373
- package/.github/workflows-backup/release.yml +0 -269
- package/.release-notes-0.2.0.md +0 -129
- package/.yamllint +0 -28
- package/CHANGELOG.json +0 -1120
- package/CHANGELOG.md +0 -209
- package/CLAUDE.md +0 -217
- package/demo.html +0 -847
- package/docs/API.md +0 -918
- package/docs/CORE.md +0 -264
- package/docs/DEVELOPMENT.md +0 -731
- package/docs/EXPORTS.md +0 -467
- package/docs/PACKAGES.md +0 -244
- package/docs/STYLING.md +0 -405
- package/docs/_config.yml +0 -36
- package/docs/index.md +0 -179
- package/examples/README.md +0 -208
- package/examples/basic-logging.js +0 -75
- package/examples/data-export.js +0 -234
- package/examples/package.json +0 -16
- package/examples/performance-timing.js +0 -170
- package/examples/simplified-api.js +0 -124
- package/examples/styling-themes.js +0 -207
- package/index.html +0 -358
- package/packages/core/package.json +0 -57
- package/packages/exports/package.json +0 -41
- package/packages/nodejs-opentui/README.md +0 -232
- package/packages/nodejs-opentui/package.json +0 -72
- package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
- package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
- package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
- package/packages/nodejs-opentui/src/index.ts +0 -133
- package/packages/nodejs-opentui/src/types.ts +0 -158
- package/packages/nodejs-opentui/tsconfig.json +0 -20
- package/packages/styling/package.json +0 -41
- package/playground/demo-all.ts +0 -95
- package/playground/demo-box.ts +0 -85
- package/playground/demo-levels.ts +0 -56
- package/playground/demo-real-world.ts +0 -98
- package/playground/demo-spinner.ts +0 -77
- package/playground/demo-steps.ts +0 -72
- package/playground/demo-table.ts +0 -83
- package/project-utils/README.md +0 -172
- package/project-utils/auto-release-gemini.ts +0 -1193
- package/project-utils/auto-release-ui.ts +0 -1329
- package/project-utils/commit-generator.ts +0 -1385
- package/project-utils/commit-ui.ts +0 -264
- package/project-utils/git-utils.ts +0 -199
- package/project-utils/github-release-manager.ts +0 -466
- package/project-utils/project-config.ts +0 -260
- package/project-utils/prompt-templates.js +0 -345
- package/project-utils/prompt-templates.ts +0 -422
- package/project-utils/version-manager.ts +0 -1078
- package/src/Logger.ts +0 -1858
- package/src/ScopedLogger.ts +0 -256
- package/src/cli/CommandProcessor.ts +0 -248
- package/src/cli/commands/ConfigCommand.ts +0 -93
- package/src/cli/commands/ExportCommand.ts +0 -276
- package/src/cli/commands/HistoryCommand.ts +0 -117
- package/src/cli/commands/StatusCommand.ts +0 -112
- package/src/cli/commands/ThemeCommand.ts +0 -88
- package/src/cli/help.ts +0 -127
- package/src/cli/index.ts +0 -71
- package/src/cli-primitives/box.ts +0 -86
- package/src/cli-primitives/cli-table.ts +0 -62
- package/src/cli-primitives/divider.ts +0 -17
- package/src/cli-primitives/header.ts +0 -18
- package/src/cli-primitives/server-fallback.ts +0 -54
- package/src/cli-primitives/spinner.ts +0 -133
- package/src/cli-primitives/step.ts +0 -22
- package/src/constants.ts +0 -313
- package/src/core.ts +0 -397
- package/src/example.ts +0 -210
- package/src/exports-module.ts +0 -311
- package/src/handlers/AnalyticsLogHandler.ts +0 -22
- package/src/handlers/ExportLogHandler.ts +0 -610
- package/src/handlers/FileLogHandler.ts +0 -169
- package/src/handlers/RemoteLogHandler.ts +0 -42
- package/src/hooks/HookManager.ts +0 -177
- package/src/index.ts +0 -395
- package/src/main.ts +0 -196
- package/src/serializers/SerializerRegistry.ts +0 -173
- package/src/style.css +0 -96
- package/src/styling/LogStyleBuilder.ts +0 -355
- package/src/styling/SemanticStyles.ts +0 -380
- package/src/styling/SmartPresets.ts +0 -288
- package/src/styling/StyleBuilder.ts +0 -319
- package/src/styling/StyleCache.ts +0 -131
- package/src/styling/banners.ts +0 -168
- package/src/styling/index.ts +0 -27
- package/src/styling/themes.ts +0 -235
- package/src/styling-module.ts +0 -244
- package/src/terminal/color-converter.ts +0 -315
- package/src/terminal/formatter.ts +0 -242
- package/src/terminal/terminal-renderer.ts +0 -342
- package/src/transports/ConsoleTransport.ts +0 -28
- package/src/transports/FileTransport.ts +0 -53
- package/src/transports/HttpTransport.ts +0 -56
- package/src/transports/TransportManager.ts +0 -130
- package/src/types/index.ts +0 -83
- package/src/typescript.svg +0 -1
- package/src/utils/adapter.ts +0 -291
- package/src/utils/ansi-colors.ts +0 -333
- package/src/utils/environment-detector.ts +0 -170
- package/src/utils/environment.ts +0 -94
- package/src/utils/formatting.ts +0 -332
- package/src/utils/index.ts +0 -33
- package/src/utils/opentui-detection.ts +0 -138
- package/src/utils/output.ts +0 -227
- package/src/utils/stackTrace.ts +0 -144
- package/src/utils/timestamps.ts +0 -80
- package/src/vite-env.d.ts +0 -1
- package/test-core-browser.html +0 -237
- package/test-core-node.js +0 -63
- package/tests/test-conflict-resolution.ts +0 -391
- package/tests/validate-workflows.sh +0 -131
- package/tests/yaml-autofix.sh +0 -146
- package/tsconfig.json +0 -50
- package/vite.config.ts +0 -256
- /package/{public → dist}/vite.svg +0 -0
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { execSync } from "child_process"
|
|
4
|
-
import { platform } from "os"
|
|
5
|
-
|
|
6
|
-
interface CommitOptions {
|
|
7
|
-
context: string
|
|
8
|
-
workType: string
|
|
9
|
-
affectedComponents: string[]
|
|
10
|
-
scope?: string
|
|
11
|
-
breakingChange?: boolean
|
|
12
|
-
performanceImpact?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class CommitUI {
|
|
16
|
-
private platform = platform()
|
|
17
|
-
|
|
18
|
-
async collectCommitInfo(): Promise<CommitOptions> {
|
|
19
|
-
console.log("🚀 Interactive Commit Generator")
|
|
20
|
-
console.log("================================")
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
if (this.platform === "darwin") {
|
|
24
|
-
return await this.macOSDialog()
|
|
25
|
-
} else if (this.platform === "linux") {
|
|
26
|
-
return await this.linuxDialog()
|
|
27
|
-
} else {
|
|
28
|
-
return await this.fallbackDialog()
|
|
29
|
-
}
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.log("⚠️ GUI not available, falling back to text input")
|
|
32
|
-
return await this.fallbackDialog()
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
private async macOSDialog(): Promise<CommitOptions> {
|
|
37
|
-
// Create a unified form using AppleScript
|
|
38
|
-
const formScript = `
|
|
39
|
-
const app = Application.currentApplication()
|
|
40
|
-
app.includeStandardAdditions = true
|
|
41
|
-
|
|
42
|
-
// First get the context text
|
|
43
|
-
const contextResult = app.displayDialog("📝 Commit Generator\\n\\nDescribe what you implemented/fixed:", {
|
|
44
|
-
defaultAnswer: "",
|
|
45
|
-
withTitle: "🚀 Interactive Commit",
|
|
46
|
-
buttons: ["Cancel", "Next →"],
|
|
47
|
-
defaultButton: "Next →"
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const context = contextResult.textReturned
|
|
51
|
-
|
|
52
|
-
// Then get work type
|
|
53
|
-
const workTypes = ["feature", "fix", "refactor", "docs", "test"]
|
|
54
|
-
const workTypeResult = app.chooseFromList(workTypes, {
|
|
55
|
-
withTitle: "🚀 Interactive Commit - Work Type",
|
|
56
|
-
withPrompt: "Context: " + context + "\\n\\nSelect work type:",
|
|
57
|
-
defaultItems: ["feature"]
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
if (workTypeResult === false) {
|
|
61
|
-
throw new Error("Cancelled")
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const workType = workTypeResult[0]
|
|
65
|
-
|
|
66
|
-
// Then get components
|
|
67
|
-
const components = ["core", "styling", "exports", "cli", "docs", "tests", "examples"]
|
|
68
|
-
const componentsResult = app.chooseFromList(components, {
|
|
69
|
-
withTitle: "🚀 Interactive Commit - Components",
|
|
70
|
-
withPrompt: "Context: " + context + "\\nType: " + workType + "\\n\\nSelect affected components:",
|
|
71
|
-
multipleSelectionsAllowed: true,
|
|
72
|
-
defaultItems: ["core"]
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
if (componentsResult === false) {
|
|
76
|
-
throw new Error("Cancelled")
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const affectedComponents = componentsResult.join(",")
|
|
80
|
-
|
|
81
|
-
// Finally get performance impact
|
|
82
|
-
const impacts = ["none", "minor", "major"]
|
|
83
|
-
const performanceResult = app.chooseFromList(impacts, {
|
|
84
|
-
withTitle: "🚀 Interactive Commit - Performance",
|
|
85
|
-
withPrompt: "Context: " + context + "\\nType: " + workType + "\\nComponents: " + affectedComponents + "\\n\\nPerformance impact:",
|
|
86
|
-
defaultItems: ["none"]
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
const performanceImpact = performanceResult === false ? "none" : performanceResult[0]
|
|
90
|
-
|
|
91
|
-
// Return all values as JSON
|
|
92
|
-
JSON.stringify({
|
|
93
|
-
context: context,
|
|
94
|
-
workType: workType,
|
|
95
|
-
affectedComponents: affectedComponents,
|
|
96
|
-
performanceImpact: performanceImpact
|
|
97
|
-
})
|
|
98
|
-
`
|
|
99
|
-
|
|
100
|
-
const result = execSync(`osascript -l JavaScript -e '${formScript}'`, { encoding: 'utf-8' }).trim()
|
|
101
|
-
const parsed = JSON.parse(result)
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
context: parsed.context,
|
|
105
|
-
workType: parsed.workType,
|
|
106
|
-
affectedComponents: parsed.affectedComponents.split(","),
|
|
107
|
-
performanceImpact: parsed.performanceImpact
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
private async linuxDialog(): Promise<CommitOptions> {
|
|
112
|
-
// Check if zenity is available
|
|
113
|
-
try {
|
|
114
|
-
execSync("which zenity", { stdio: 'ignore' })
|
|
115
|
-
} catch {
|
|
116
|
-
throw new Error("zenity not available")
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Context Input first
|
|
120
|
-
const context = execSync(`zenity --entry --title="🚀 Interactive Commit" --text="📝 Describe what you implemented/fixed:" --width=400`, { encoding: 'utf-8' }).trim()
|
|
121
|
-
|
|
122
|
-
// Work Type Selection with context shown
|
|
123
|
-
const workType = execSync(`zenity --list --title="🚀 Interactive Commit - Work Type" --text="Context: ${context}\\n\\nSelect work type:" --radiolist --column="Select" --column="Type" --column="Description" --width=450 --height=300 \\
|
|
124
|
-
TRUE "feature" "New functionality" \\
|
|
125
|
-
FALSE "fix" "Bug fixes" \\
|
|
126
|
-
FALSE "refactor" "Code refactoring" \\
|
|
127
|
-
FALSE "docs" "Documentation" \\
|
|
128
|
-
FALSE "test" "Tests"`, { encoding: 'utf-8' }).trim()
|
|
129
|
-
|
|
130
|
-
// Components Selection with previous values shown
|
|
131
|
-
const componentsResult = execSync(`zenity --list --title="🚀 Interactive Commit - Components" --text="Context: ${context}\\nType: ${workType}\\n\\nSelect affected components:" --checklist --column="Select" --column="Component" --width=450 --height=300 \\
|
|
132
|
-
TRUE "core" \\
|
|
133
|
-
FALSE "styling" \\
|
|
134
|
-
FALSE "exports" \\
|
|
135
|
-
FALSE "cli" \\
|
|
136
|
-
FALSE "docs" \\
|
|
137
|
-
FALSE "tests" \\
|
|
138
|
-
FALSE "examples"`, { encoding: 'utf-8' }).trim()
|
|
139
|
-
|
|
140
|
-
const affectedComponents = componentsResult.split("|").filter(Boolean)
|
|
141
|
-
|
|
142
|
-
// Performance Impact with summary
|
|
143
|
-
const performanceImpact = execSync(`zenity --list --title="🚀 Interactive Commit - Performance" --text="Context: ${context}\\nType: ${workType}\\nComponents: ${affectedComponents.join(', ')}\\n\\nSelect performance impact:" --radiolist --column="Select" --column="Impact" --width=450 --height=250 \\
|
|
144
|
-
TRUE "none" \\
|
|
145
|
-
FALSE "minor" \\
|
|
146
|
-
FALSE "major"`, { encoding: 'utf-8' }).trim()
|
|
147
|
-
|
|
148
|
-
return {
|
|
149
|
-
context,
|
|
150
|
-
workType,
|
|
151
|
-
affectedComponents,
|
|
152
|
-
performanceImpact
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
private async fallbackDialog(): Promise<CommitOptions> {
|
|
157
|
-
const readline = require('readline').createInterface({
|
|
158
|
-
input: process.stdin,
|
|
159
|
-
output: process.stdout
|
|
160
|
-
})
|
|
161
|
-
|
|
162
|
-
const question = (prompt: string): Promise<string> => {
|
|
163
|
-
return new Promise((resolve) => {
|
|
164
|
-
readline.question(prompt, resolve)
|
|
165
|
-
})
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
console.log("\n📝 Text-based commit input")
|
|
169
|
-
|
|
170
|
-
const workType = await question("Work type (feature/fix/refactor/docs/test): ") || "feature"
|
|
171
|
-
const context = await question("Describe what you implemented/fixed: ")
|
|
172
|
-
const componentsInput = await question("Components changed (core,styling,exports,cli,docs,tests,examples): ") || "core"
|
|
173
|
-
const affectedComponents = componentsInput.split(",").map(c => c.trim())
|
|
174
|
-
const performanceImpact = await question("Performance impact (none/minor/major): ") || "none"
|
|
175
|
-
|
|
176
|
-
readline.close()
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
context,
|
|
180
|
-
workType,
|
|
181
|
-
affectedComponents,
|
|
182
|
-
performanceImpact
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
async generateCommit(options: CommitOptions): Promise<void> {
|
|
187
|
-
const args = [
|
|
188
|
-
"--context", `"${options.context}"`,
|
|
189
|
-
"--work-type", options.workType,
|
|
190
|
-
"--affected-components", options.affectedComponents.join(",")
|
|
191
|
-
]
|
|
192
|
-
|
|
193
|
-
if (options.performanceImpact && options.performanceImpact !== "none") {
|
|
194
|
-
args.push("--performance-impact", options.performanceImpact)
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
console.log("\n🔄 Generating commit...")
|
|
198
|
-
console.log(`📋 Context: ${options.context}`)
|
|
199
|
-
console.log(`🏷️ Type: ${options.workType}`)
|
|
200
|
-
console.log(`📦 Components: ${options.affectedComponents.join(", ")}`)
|
|
201
|
-
console.log(`⚡ Performance: ${options.performanceImpact}`)
|
|
202
|
-
|
|
203
|
-
const command = `bun project-utils/commit-generator.ts ${args.join(" ")} --auto-approve`
|
|
204
|
-
console.log(`\n🚀 Running: ${command}`)
|
|
205
|
-
|
|
206
|
-
try {
|
|
207
|
-
execSync(command, { stdio: 'inherit' })
|
|
208
|
-
console.log("✅ Commits executed successfully!")
|
|
209
|
-
} catch (error) {
|
|
210
|
-
console.error("❌ Error executing commits:", error)
|
|
211
|
-
process.exit(1)
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
async function runTypeCheck(): Promise<void> {
|
|
217
|
-
console.log('🔍 Ejecutando typecheck...')
|
|
218
|
-
|
|
219
|
-
try {
|
|
220
|
-
execSync('npm run type-check', {
|
|
221
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
222
|
-
encoding: 'utf-8'
|
|
223
|
-
})
|
|
224
|
-
console.log('✅ Typecheck completado correctamente')
|
|
225
|
-
} catch (error) {
|
|
226
|
-
console.log('❌ Typecheck falló:', error)
|
|
227
|
-
process.exit(1)
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async function main() {
|
|
232
|
-
// Ejecutar typecheck antes de continuar
|
|
233
|
-
await runTypeCheck()
|
|
234
|
-
|
|
235
|
-
const ui = new CommitUI()
|
|
236
|
-
|
|
237
|
-
// Check for quick mode
|
|
238
|
-
if (process.argv.includes("--quick")) {
|
|
239
|
-
const quickOptions: CommitOptions = {
|
|
240
|
-
context: "Quick commit via UI",
|
|
241
|
-
workType: "feature",
|
|
242
|
-
affectedComponents: ["core"],
|
|
243
|
-
performanceImpact: "none"
|
|
244
|
-
}
|
|
245
|
-
await ui.generateCommit(quickOptions)
|
|
246
|
-
return
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
try {
|
|
250
|
-
const options = await ui.collectCommitInfo()
|
|
251
|
-
await ui.generateCommit(options)
|
|
252
|
-
} catch (error) {
|
|
253
|
-
if (error instanceof Error && error.message === "Cancelled") {
|
|
254
|
-
console.log("❌ Commit cancelled by user")
|
|
255
|
-
process.exit(0)
|
|
256
|
-
}
|
|
257
|
-
console.error("❌ Error:", error)
|
|
258
|
-
process.exit(1)
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (import.meta.main) {
|
|
263
|
-
main()
|
|
264
|
-
}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilidades para manejo de Git
|
|
3
|
-
* Funciones auxiliares para el generador de commits
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface GitFileStatus {
|
|
7
|
-
path: string;
|
|
8
|
-
staged: boolean;
|
|
9
|
-
unstaged: boolean;
|
|
10
|
-
untracked: boolean;
|
|
11
|
-
deleted: boolean;
|
|
12
|
-
renamed?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface CommitInfo {
|
|
16
|
-
hash: string;
|
|
17
|
-
message: string;
|
|
18
|
-
author: string;
|
|
19
|
-
date: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Parsea la salida de git status --porcelain
|
|
24
|
-
*/
|
|
25
|
-
export function parseGitStatus(statusOutput: string): GitFileStatus[] {
|
|
26
|
-
const files: GitFileStatus[] = [];
|
|
27
|
-
|
|
28
|
-
for (const line of statusOutput.split('\n').filter(l => l.trim())) {
|
|
29
|
-
const staged = line[0];
|
|
30
|
-
const unstaged = line[1];
|
|
31
|
-
const filePath = line.substring(3);
|
|
32
|
-
|
|
33
|
-
files.push({
|
|
34
|
-
path: filePath,
|
|
35
|
-
staged: staged !== ' ' && staged !== '?',
|
|
36
|
-
unstaged: unstaged !== ' ',
|
|
37
|
-
untracked: staged === '?' && unstaged === '?',
|
|
38
|
-
deleted: staged === 'D' || unstaged === 'D',
|
|
39
|
-
renamed: staged === 'R' ? filePath.split(' -> ')[1] : undefined,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return files;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Determina el área funcional de un archivo basado en su ruta
|
|
48
|
-
*/
|
|
49
|
-
export function getFileArea(filePath: string): string {
|
|
50
|
-
const areas = [
|
|
51
|
-
{ pattern: /^src\/components\/|^src\/layouts\//, area: 'ui' },
|
|
52
|
-
{ pattern: /^src-tauri\//, area: 'backend' },
|
|
53
|
-
{ pattern: /^src\/models\/|types|interfaces/, area: 'types' },
|
|
54
|
-
{ pattern: /^src\/stores\/|state/, area: 'state' },
|
|
55
|
-
{ pattern: /^src\/pages\/|routing|navigation/, area: 'navigation' },
|
|
56
|
-
{ pattern: /^src\/styles\/|\.css$|theme/, area: 'theme' },
|
|
57
|
-
{ pattern: /config|\.json$|\.toml$|package\.json/, area: 'config' },
|
|
58
|
-
{ pattern: /^project-utils\/|tools|scripts/, area: 'tools' },
|
|
59
|
-
{ pattern: /database|migration|sql/, area: 'database' },
|
|
60
|
-
{ pattern: /test|spec|\.test\.|\.spec\./, area: 'testing' },
|
|
61
|
-
{ pattern: /doc|readme|\.md$/, area: 'docs' },
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
for (const { pattern, area } of areas) {
|
|
65
|
-
if (pattern.test(filePath.toLowerCase())) {
|
|
66
|
-
return area;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return 'misc';
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Determina si los archivos están relacionados funcionalmente
|
|
75
|
-
*/
|
|
76
|
-
export function areFilesRelated(files: string[]): boolean {
|
|
77
|
-
if (files.length <= 1) return true;
|
|
78
|
-
|
|
79
|
-
const areas = files.map(getFileArea);
|
|
80
|
-
const uniqueAreas = [...new Set(areas)];
|
|
81
|
-
|
|
82
|
-
// Si todos están en la misma área, están relacionados
|
|
83
|
-
if (uniqueAreas.length === 1) return true;
|
|
84
|
-
|
|
85
|
-
// Áreas que suelen ir juntas
|
|
86
|
-
const relatedAreas = [
|
|
87
|
-
['ui', 'theme', 'navigation'],
|
|
88
|
-
['backend', 'database', 'types'],
|
|
89
|
-
['config', 'tools', 'docs'],
|
|
90
|
-
['types', 'state'],
|
|
91
|
-
];
|
|
92
|
-
|
|
93
|
-
for (const group of relatedAreas) {
|
|
94
|
-
if (uniqueAreas.every(area => group.includes(area))) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Sugiere el tipo de commit basado en los cambios
|
|
104
|
-
*/
|
|
105
|
-
export function suggestCommitType(files: GitFileStatus[]): 'feat' | 'fix' | 'refactor' | 'feat-phase' {
|
|
106
|
-
const hasNewFiles = files.some(f => f.untracked);
|
|
107
|
-
const hasDeletedFiles = files.some(f => f.deleted);
|
|
108
|
-
const modifiedFiles = files.filter(f => f.staged || f.unstaged);
|
|
109
|
-
|
|
110
|
-
// Si hay muchos archivos nuevos, probablemente es una feature
|
|
111
|
-
if (hasNewFiles && files.length > 3) {
|
|
112
|
-
return 'feat-phase';
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Si hay archivos nuevos pero pocos, es feature completa
|
|
116
|
-
if (hasNewFiles) {
|
|
117
|
-
return 'feat';
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Si solo se modificaron archivos existentes, probablemente es fix o refactor
|
|
121
|
-
if (modifiedFiles.length > 0 && !hasNewFiles) {
|
|
122
|
-
// Si los cambios son grandes, es refactor
|
|
123
|
-
if (modifiedFiles.length > 5) {
|
|
124
|
-
return 'refactor';
|
|
125
|
-
}
|
|
126
|
-
// Si son pocos cambios, probablemente es fix
|
|
127
|
-
return 'fix';
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return 'feat';
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Extrae información relevante del diff de un archivo
|
|
135
|
-
*/
|
|
136
|
-
export function analyzeDiff(diff: string): {
|
|
137
|
-
addedLines: number;
|
|
138
|
-
removedLines: number;
|
|
139
|
-
hasNewFunctions: boolean;
|
|
140
|
-
hasNewTypes: boolean;
|
|
141
|
-
hasNewImports: boolean;
|
|
142
|
-
hasFixes: boolean;
|
|
143
|
-
} {
|
|
144
|
-
const lines = diff.split('\n');
|
|
145
|
-
const addedLines = lines.filter(l => l.startsWith('+')).length;
|
|
146
|
-
const removedLines = lines.filter(l => l.startsWith('-')).length;
|
|
147
|
-
|
|
148
|
-
const addedCode = lines.filter(l => l.startsWith('+')).join('\n');
|
|
149
|
-
const removedCode = lines.filter(l => l.startsWith('-')).join('\n');
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
addedLines,
|
|
153
|
-
removedLines,
|
|
154
|
-
hasNewFunctions: /function\s+\w+|const\s+\w+\s*=|async\s+function/.test(addedCode),
|
|
155
|
-
hasNewTypes: /interface\s+\w+|type\s+\w+|enum\s+\w+/.test(addedCode),
|
|
156
|
-
hasNewImports: /import\s+.*from/.test(addedCode),
|
|
157
|
-
hasFixes: /fix|error|bug|issue|problem/i.test(addedCode) || removedCode.includes('TODO') || removedCode.includes('FIXME'),
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Genera un resumen técnico basado en los archivos modificados
|
|
163
|
-
*/
|
|
164
|
-
export function generateTechnicalSummary(files: GitFileStatus[], diffs: Record<string, string>): string {
|
|
165
|
-
const summary: string[] = [];
|
|
166
|
-
|
|
167
|
-
for (const file of files) {
|
|
168
|
-
const area = getFileArea(file.path);
|
|
169
|
-
const diff = diffs[file.path];
|
|
170
|
-
|
|
171
|
-
if (!diff) continue;
|
|
172
|
-
|
|
173
|
-
const analysis = analyzeDiff(diff);
|
|
174
|
-
const changes: string[] = [];
|
|
175
|
-
|
|
176
|
-
if (file.untracked) {
|
|
177
|
-
changes.push(`Creado ${file.path}`);
|
|
178
|
-
} else if (file.deleted) {
|
|
179
|
-
changes.push(`Eliminado ${file.path}`);
|
|
180
|
-
} else {
|
|
181
|
-
if (analysis.hasNewFunctions) changes.push('nuevas funciones');
|
|
182
|
-
if (analysis.hasNewTypes) changes.push('nuevos tipos');
|
|
183
|
-
if (analysis.hasNewImports) changes.push('nuevas dependencias');
|
|
184
|
-
if (analysis.hasFixes) changes.push('correcciones');
|
|
185
|
-
|
|
186
|
-
if (changes.length > 0) {
|
|
187
|
-
changes.unshift(`Modificado ${file.path} con`);
|
|
188
|
-
} else {
|
|
189
|
-
changes.push(`Actualizado ${file.path}`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (changes.length > 0) {
|
|
194
|
-
summary.push(`- ${changes.join(' ')}`);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return summary.join('\n');
|
|
199
|
-
}
|