commit-analyzer 1.1.4 → 1.1.6

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 (55) hide show
  1. package/README.md +164 -82
  2. package/dist/main.ts +0 -0
  3. package/package.json +2 -1
  4. package/.claude/settings.local.json +0 -23
  5. package/commits.csv +0 -2
  6. package/csv-to-report-prompt.md +0 -97
  7. package/eslint.config.mts +0 -45
  8. package/prompt.md +0 -69
  9. package/src/1.domain/analysis.ts +0 -93
  10. package/src/1.domain/analyzed-commit.ts +0 -97
  11. package/src/1.domain/application-error.ts +0 -32
  12. package/src/1.domain/category.ts +0 -52
  13. package/src/1.domain/commit-analysis-service.ts +0 -92
  14. package/src/1.domain/commit-hash.ts +0 -40
  15. package/src/1.domain/commit.ts +0 -99
  16. package/src/1.domain/date-formatting-service.ts +0 -81
  17. package/src/1.domain/date-range.ts +0 -76
  18. package/src/1.domain/report-generation-service.ts +0 -443
  19. package/src/2.application/analyze-commits.usecase.ts +0 -307
  20. package/src/2.application/generate-report.usecase.ts +0 -209
  21. package/src/2.application/llm-service.ts +0 -54
  22. package/src/2.application/resume-analysis.usecase.ts +0 -123
  23. package/src/3.presentation/analysis-repository.interface.ts +0 -27
  24. package/src/3.presentation/analyze-command.ts +0 -128
  25. package/src/3.presentation/cli-application.ts +0 -278
  26. package/src/3.presentation/command-handler.interface.ts +0 -4
  27. package/src/3.presentation/commit-analysis-controller.ts +0 -101
  28. package/src/3.presentation/commit-repository.interface.ts +0 -47
  29. package/src/3.presentation/console-formatter.ts +0 -129
  30. package/src/3.presentation/progress-repository.interface.ts +0 -49
  31. package/src/3.presentation/report-command.ts +0 -50
  32. package/src/3.presentation/resume-command.ts +0 -59
  33. package/src/3.presentation/storage-repository.interface.ts +0 -33
  34. package/src/3.presentation/storage-service.interface.ts +0 -32
  35. package/src/3.presentation/version-control-service.interface.ts +0 -46
  36. package/src/4.infrastructure/cache-service.ts +0 -271
  37. package/src/4.infrastructure/cached-analysis-repository.ts +0 -46
  38. package/src/4.infrastructure/claude-llm-adapter.ts +0 -124
  39. package/src/4.infrastructure/csv-service.ts +0 -252
  40. package/src/4.infrastructure/file-storage-repository.ts +0 -108
  41. package/src/4.infrastructure/file-system-storage-adapter.ts +0 -87
  42. package/src/4.infrastructure/gemini-llm-adapter.ts +0 -46
  43. package/src/4.infrastructure/git-adapter.ts +0 -143
  44. package/src/4.infrastructure/git-commit-repository.ts +0 -85
  45. package/src/4.infrastructure/json-progress-tracker.ts +0 -182
  46. package/src/4.infrastructure/llm-adapter-factory.ts +0 -26
  47. package/src/4.infrastructure/llm-adapter.ts +0 -485
  48. package/src/4.infrastructure/llm-analysis-repository.ts +0 -38
  49. package/src/4.infrastructure/openai-llm-adapter.ts +0 -57
  50. package/src/di.ts +0 -109
  51. package/src/main.ts +0 -63
  52. package/src/utils/app-paths.ts +0 -36
  53. package/src/utils/concurrency.ts +0 -81
  54. package/src/utils.ts +0 -77
  55. package/tsconfig.json +0 -25
package/src/main.ts DELETED
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env bun
2
-
3
- import { ApplicationError } from "@domain/application-error"
4
-
5
- import { ConsoleFormatter } from "@presentation/console-formatter"
6
-
7
- import { DIContainer } from "./di"
8
-
9
- async function main(): Promise<void> {
10
- try {
11
- // Extract options from command line args before creating container
12
- const llmOption = extractLLMOption(process.argv)
13
- const noCacheOption = extractNoCacheOption(process.argv)
14
- const container = new DIContainer({
15
- llm: llmOption,
16
- noCache: noCacheOption
17
- })
18
- const app = container.getApplication()
19
-
20
- await app.run(process.argv)
21
- } catch (error) {
22
- if (error instanceof ApplicationError) {
23
- ConsoleFormatter.logError(`[${error.code}]: ${error.message}`)
24
- process.exit(1)
25
- }
26
-
27
- if (error instanceof Error) {
28
- ConsoleFormatter.logError(`Unexpected error: ${error.message}`)
29
- process.exit(1)
30
- }
31
-
32
- ConsoleFormatter.logError("Unknown error occurred")
33
- process.exit(1)
34
- }
35
- }
36
-
37
- /**
38
- * Extract the --llm option from command line arguments
39
- * This is needed before creating the DI container
40
- */
41
- function extractLLMOption(args: string[]): string | undefined {
42
- const llmIndex = args.findIndex(arg => arg === '--llm')
43
- if (llmIndex !== -1 && llmIndex + 1 < args.length) {
44
- return args[llmIndex + 1]
45
- }
46
- return undefined
47
- }
48
-
49
- /**
50
- * Extract the --no-cache option from command line arguments
51
- * This is needed before creating the DI container
52
- */
53
- function extractNoCacheOption(args: string[]): boolean {
54
- return args.includes('--no-cache')
55
- }
56
-
57
- // Run the application if this file is executed directly
58
- if (require.main === module) {
59
- main().catch((error) => {
60
- ConsoleFormatter.logError(`Failed to bootstrap application: ${error}`)
61
- process.exit(1)
62
- })
63
- }
@@ -1,36 +0,0 @@
1
- import path from "path"
2
-
3
- /**
4
- * Utility for managing application data directory paths
5
- */
6
- export class AppPaths {
7
- private static readonly APP_DATA_DIR = ".commit-analyzer"
8
-
9
- /**
10
- * Get the application data directory path
11
- */
12
- static getAppDataDir(baseDir: string = process.cwd()): string {
13
- return path.join(baseDir, AppPaths.APP_DATA_DIR)
14
- }
15
-
16
- /**
17
- * Get the cache directory path
18
- */
19
- static getCacheDir(baseDir: string = process.cwd()): string {
20
- return path.join(AppPaths.getAppDataDir(baseDir), "cache")
21
- }
22
-
23
- /**
24
- * Get the progress file path
25
- */
26
- static getProgressFilePath(baseDir: string = process.cwd()): string {
27
- return path.join(AppPaths.getAppDataDir(baseDir), "progress.json")
28
- }
29
-
30
- /**
31
- * Get any file path within the app data directory
32
- */
33
- static getAppDataFilePath(fileName: string, baseDir: string = process.cwd()): string {
34
- return path.join(AppPaths.getAppDataDir(baseDir), fileName)
35
- }
36
- }
@@ -1,81 +0,0 @@
1
- /**
2
- * Utility for managing concurrent operations with semaphore-like behavior
3
- */
4
- export class ConcurrencyManager {
5
- private running = 0
6
- private queue: (() => void)[] = []
7
-
8
- constructor(private readonly maxConcurrency: number) {}
9
-
10
- /**
11
- * Execute a function with concurrency control
12
- */
13
- async execute<T>(fn: () => Promise<T>): Promise<T> {
14
- return new Promise((resolve, reject) => {
15
- const runTask = async () => {
16
- this.running++
17
- try {
18
- const result = await fn()
19
- resolve(result)
20
- } catch (error) {
21
- reject(error)
22
- } finally {
23
- this.running--
24
- this.processQueue()
25
- }
26
- }
27
-
28
- if (this.running < this.maxConcurrency) {
29
- runTask()
30
- } else {
31
- this.queue.push(runTask)
32
- }
33
- })
34
- }
35
-
36
- private processQueue(): void {
37
- if (this.queue.length > 0 && this.running < this.maxConcurrency) {
38
- const nextTask = this.queue.shift()!
39
- nextTask()
40
- }
41
- }
42
- }
43
-
44
- /**
45
- * Process items in parallel with controlled concurrency
46
- */
47
- export async function processInParallel<T, R>(
48
- items: T[],
49
- processor: (item: T, index: number) => Promise<R>,
50
- maxConcurrency: number = 5
51
- ): Promise<R[]> {
52
- const manager = new ConcurrencyManager(maxConcurrency)
53
- const promises = items.map((item, index) =>
54
- manager.execute(() => processor(item, index))
55
- )
56
- return Promise.all(promises)
57
- }
58
-
59
- /**
60
- * Process items in batches with parallel processing within each batch
61
- */
62
- export async function processInBatches<T, R>(
63
- items: T[],
64
- processor: (item: T, index: number) => Promise<R>,
65
- batchSize: number = 10,
66
- maxConcurrencyPerBatch: number = 5
67
- ): Promise<R[]> {
68
- const results: R[] = []
69
-
70
- for (let i = 0; i < items.length; i += batchSize) {
71
- const batch = items.slice(i, i + batchSize)
72
- const batchResults = await processInParallel(
73
- batch,
74
- (item, batchIndex) => processor(item, i + batchIndex),
75
- maxConcurrencyPerBatch
76
- )
77
- results.push(...batchResults)
78
- }
79
-
80
- return results
81
- }
package/src/utils.ts DELETED
@@ -1,77 +0,0 @@
1
- import readline from "readline"
2
-
3
- /**
4
- * Common utility functions used across the application
5
- */
6
-
7
- /**
8
- * Extracts error message from unknown error type
9
- */
10
- export function getErrorMessage(error: unknown): string {
11
- return error instanceof Error ? error.message : "Unknown error"
12
- }
13
-
14
- /**
15
- * Creates a promise-based readline interface for user input
16
- */
17
- export function createPromiseReadline(): {
18
- question: (prompt: string) => Promise<string>
19
- close: () => void
20
- } {
21
- const rl = readline.createInterface({
22
- input: process.stdin,
23
- output: process.stdout,
24
- })
25
-
26
- return {
27
- question: (prompt: string): Promise<string> => {
28
- return new Promise((resolve) => {
29
- rl.question(prompt, (answer: string) => {
30
- resolve(answer.trim())
31
- })
32
- })
33
- },
34
- close: () => rl.close(),
35
- }
36
- }
37
-
38
- /**
39
- * Sleep utility for async delays
40
- */
41
- export function sleep(ms: number): Promise<void> {
42
- return new Promise((resolve) => setTimeout(resolve, ms))
43
- }
44
-
45
- /**
46
- * Formats file size in human readable format
47
- */
48
- export function formatFileSize(bytes: number): string {
49
- const units = ["B", "KB", "MB", "GB"]
50
- let size = bytes
51
- let unitIndex = 0
52
-
53
- while (size >= 1024 && unitIndex < units.length - 1) {
54
- size /= 1024
55
- unitIndex++
56
- }
57
-
58
- return `${size.toFixed(1)} ${units[unitIndex]}`
59
- }
60
-
61
- /**
62
- * Truncates text to specified length with ellipsis
63
- */
64
- export function truncateText(text: string, maxLength: number): string {
65
- if (text.length <= maxLength) {
66
- return text
67
- }
68
- return text.substring(0, maxLength - 3) + "..."
69
- }
70
-
71
- /**
72
- * Calculates percentage with proper rounding
73
- */
74
- export function calculatePercentage(part: number, total: number): number {
75
- if (total === 0) return 0
76
- return Math.round((part / total) * 100)
77
- }
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "lib": ["ES2020"],
5
- "module": "commonjs",
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "resolveJsonModule": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "sourceMap": true,
16
- "paths": {
17
- "@domain/*": ["./src/1.domain/*"],
18
- "@app/*": ["./src/2.application/*"],
19
- "@presentation/*": ["./src/3.presentation/*"],
20
- "@infra/*": ["./src/4.infrastructure/*"]
21
- }
22
- },
23
- "include": ["src/**/*"],
24
- "exclude": ["node_modules", "dist"]
25
- }