commit-analyzer 1.1.1 → 1.1.3

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.
@@ -14,7 +14,8 @@
14
14
  "Bash(git checkout:*)",
15
15
  "Bash(npx ts-node:*)",
16
16
  "Bash(node:*)",
17
- "Bash(npm start:*)"
17
+ "Bash(npm start:*)",
18
+ "Bash(bun:*)"
18
19
  ],
19
20
  "deny": [],
20
21
  "ask": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commit-analyzer",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Analyze git commits and generate categories, summaries, and descriptions for each commit. Optionally generate a yearly breakdown report of your commit history.",
5
5
  "main": "dist/main.ts",
6
6
  "bin": {
@@ -24,7 +24,7 @@ export interface CLIOptions {
24
24
  }
25
25
 
26
26
  export class CLIApplication {
27
- private static readonly VERSION = "1.1.1"
27
+ private static readonly VERSION = "1.1.3"
28
28
  private static readonly DEFAULT_COMMITS_OUTPUT_FILE = "results/commits.csv"
29
29
  private static readonly DEFAULT_REPORT_OUTPUT_FILE = "results/report.md"
30
30
 
@@ -156,9 +156,11 @@ export class CLIApplication {
156
156
 
157
157
  // Handle input CSV mode (report generation only)
158
158
  if (options.inputCsv) {
159
+ const reportOutputPath = this.determineReportOutputPath(options)
160
+
159
161
  await this.controller.handleReportGeneration({
160
162
  inputCsv: options.inputCsv,
161
- output: options.output || CLIApplication.DEFAULT_REPORT_OUTPUT_FILE,
163
+ output: reportOutputPath,
162
164
  sourceInfo: { type: "csv", value: options.inputCsv },
163
165
  })
164
166
  return
@@ -252,4 +254,25 @@ export class CLIApplication {
252
254
  }
253
255
  return csvPath + ".md"
254
256
  }
257
+
258
+ private determineReportOutputPath(options: CLIOptions): string {
259
+ // Check if explicit output or outputDir was provided in raw options
260
+ // We need to check raw options to distinguish between user-provided and default values
261
+ const hasExplicitOutput =
262
+ process.argv.includes("--output") || process.argv.includes("-o")
263
+ const hasExplicitOutputDir = process.argv.includes("--output-dir")
264
+
265
+ if (hasExplicitOutput || hasExplicitOutputDir) {
266
+ return options.output || CLIApplication.DEFAULT_REPORT_OUTPUT_FILE
267
+ }
268
+
269
+ // Default: generate report in same directory as CSV with .md extension
270
+ return this.getReportPathFromCsv(options.inputCsv!)
271
+ }
272
+
273
+ private getReportPathFromCsv(csvPath: string): string {
274
+ const lastSlash = csvPath.lastIndexOf("/")
275
+ const directory = lastSlash >= 0 ? csvPath.substring(0, lastSlash + 1) : ""
276
+ return directory + "report.md"
277
+ }
255
278
  }