cadr-cli 2.0.0 → 2.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/adr/adr.d.ts +17 -0
- package/dist/adr/adr.d.ts.map +1 -0
- package/dist/{adr.js → adr/adr.js} +4 -44
- package/dist/adr/adr.js.map +1 -0
- package/dist/adr/adr.test.d.ts +5 -0
- package/dist/{adr.test.d.ts.map → adr/adr.test.d.ts.map} +1 -1
- package/dist/{adr.test.js → adr/adr.test.js} +0 -14
- package/dist/adr/adr.test.js.map +1 -0
- package/dist/adr/index.d.ts +2 -0
- package/dist/adr/index.d.ts.map +1 -0
- package/dist/adr/index.js +18 -0
- package/dist/adr/index.js.map +1 -0
- package/dist/analysis/analysis.orchestrator.d.ts +14 -0
- package/dist/analysis/analysis.orchestrator.d.ts.map +1 -0
- package/dist/analysis/analysis.orchestrator.js +175 -0
- package/dist/analysis/analysis.orchestrator.js.map +1 -0
- package/dist/analysis/analysis.orchestrator.test.d.ts +2 -0
- package/dist/analysis/analysis.orchestrator.test.d.ts.map +1 -0
- package/dist/analysis/analysis.orchestrator.test.js +177 -0
- package/dist/analysis/analysis.orchestrator.test.js.map +1 -0
- package/dist/analysis/strategies/git-strategy.d.ts +22 -0
- package/dist/analysis/strategies/git-strategy.d.ts.map +1 -0
- package/dist/analysis/strategies/git-strategy.js +114 -0
- package/dist/analysis/strategies/git-strategy.js.map +1 -0
- package/dist/analysis/strategies/git-strategy.test.d.ts +2 -0
- package/dist/analysis/strategies/git-strategy.test.d.ts.map +1 -0
- package/dist/analysis/strategies/git-strategy.test.js +147 -0
- package/dist/analysis/strategies/git-strategy.test.js.map +1 -0
- package/dist/commands/analyze.js +3 -3
- package/dist/commands/analyze.js.map +1 -1
- package/dist/commands/analyze.test.d.ts +2 -0
- package/dist/commands/analyze.test.d.ts.map +1 -0
- package/dist/commands/analyze.test.js +70 -0
- package/dist/commands/analyze.test.js.map +1 -0
- package/dist/commands/init.test.js +128 -2
- package/dist/commands/init.test.js.map +1 -1
- package/dist/config.test.js +167 -0
- package/dist/config.test.js.map +1 -1
- package/dist/git/git.errors.d.ts +6 -0
- package/dist/git/git.errors.d.ts.map +1 -0
- package/dist/git/git.errors.js +15 -0
- package/dist/git/git.errors.js.map +1 -0
- package/dist/git/git.errors.test.d.ts +2 -0
- package/dist/git/git.errors.test.d.ts.map +1 -0
- package/dist/git/git.errors.test.js +34 -0
- package/dist/git/git.errors.test.js.map +1 -0
- package/dist/git/git.operations.d.ts +12 -0
- package/dist/git/git.operations.d.ts.map +1 -0
- package/dist/git/git.operations.js +64 -0
- package/dist/git/git.operations.js.map +1 -0
- package/dist/git/git.operations.test.d.ts +2 -0
- package/dist/git/git.operations.test.d.ts.map +1 -0
- package/dist/git/git.operations.test.js +164 -0
- package/dist/git/git.operations.test.js.map +1 -0
- package/dist/git/index.d.ts +4 -0
- package/dist/git/index.d.ts.map +1 -0
- package/dist/git/index.js +19 -0
- package/dist/git/index.js.map +1 -0
- package/dist/llm/index.d.ts +3 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +19 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/llm.d.ts +35 -0
- package/dist/llm/llm.d.ts.map +1 -0
- package/dist/{llm.js → llm/llm.js} +16 -58
- package/dist/llm/llm.js.map +1 -0
- package/dist/{llm.test.d.ts.map → llm/llm.test.d.ts.map} +1 -1
- package/dist/llm/llm.test.js +224 -0
- package/dist/llm/llm.test.js.map +1 -0
- package/dist/{prompts.d.ts → llm/prompts.d.ts} +1 -38
- package/dist/llm/prompts.d.ts.map +1 -0
- package/dist/{prompts.js → llm/prompts.js} +9 -54
- package/dist/llm/prompts.js.map +1 -0
- package/dist/llm/response-parser.d.ts +9 -0
- package/dist/llm/response-parser.d.ts.map +1 -0
- package/dist/llm/response-parser.js +67 -0
- package/dist/llm/response-parser.js.map +1 -0
- package/dist/llm/response-parser.test.d.ts +2 -0
- package/dist/llm/response-parser.test.d.ts.map +1 -0
- package/dist/llm/response-parser.test.js +134 -0
- package/dist/llm/response-parser.test.js.map +1 -0
- package/dist/presenters/console-presenter.d.ts +35 -0
- package/dist/presenters/console-presenter.d.ts.map +1 -0
- package/dist/presenters/console-presenter.js +114 -0
- package/dist/presenters/console-presenter.js.map +1 -0
- package/dist/presenters/console-presenter.test.d.ts +2 -0
- package/dist/presenters/console-presenter.test.d.ts.map +1 -0
- package/dist/presenters/console-presenter.test.js +227 -0
- package/dist/presenters/console-presenter.test.js.map +1 -0
- package/dist/version.test.d.ts +1 -2
- package/dist/version.test.d.ts.map +1 -1
- package/dist/version.test.js +29 -16
- package/dist/version.test.js.map +1 -1
- package/package.json +1 -1
- package/src/{adr.test.ts → adr/adr.test.ts} +10 -23
- package/src/{adr.ts → adr/adr.ts} +7 -48
- package/src/adr/index.ts +1 -0
- package/src/analysis/analysis.orchestrator.test.ts +237 -0
- package/src/analysis/analysis.orchestrator.ts +175 -0
- package/src/analysis/strategies/git-strategy.test.ts +210 -0
- package/src/analysis/strategies/git-strategy.ts +106 -0
- package/src/commands/analyze.test.ts +91 -0
- package/src/commands/analyze.ts +8 -9
- package/src/commands/init.test.ts +200 -5
- package/src/config.test.ts +232 -2
- package/src/git/git.errors.test.ts +43 -0
- package/src/git/git.errors.ts +10 -0
- package/src/git/git.operations.test.ts +222 -0
- package/src/git/git.operations.ts +85 -0
- package/src/git/index.ts +3 -0
- package/src/llm/index.ts +2 -0
- package/src/llm/llm.test.ts +315 -0
- package/src/{llm.ts → llm/llm.ts} +46 -107
- package/src/{prompts.ts → llm/prompts.ts} +30 -72
- package/src/llm/response-parser.test.ts +170 -0
- package/src/llm/response-parser.ts +90 -0
- package/src/presenters/console-presenter.test.ts +259 -0
- package/src/presenters/console-presenter.ts +152 -0
- package/src/version.test.ts +30 -16
- package/dist/adr.d.ts +0 -50
- package/dist/adr.d.ts.map +0 -1
- package/dist/adr.js.map +0 -1
- package/dist/adr.test.d.ts +0 -8
- package/dist/adr.test.js.map +0 -1
- package/dist/analysis.d.ts +0 -24
- package/dist/analysis.d.ts.map +0 -1
- package/dist/analysis.js +0 -281
- package/dist/analysis.js.map +0 -1
- package/dist/analysis.test.d.ts +0 -8
- package/dist/analysis.test.d.ts.map +0 -1
- package/dist/analysis.test.js +0 -351
- package/dist/analysis.test.js.map +0 -1
- package/dist/git.d.ts +0 -54
- package/dist/git.d.ts.map +0 -1
- package/dist/git.js +0 -204
- package/dist/git.js.map +0 -1
- package/dist/llm.d.ts +0 -73
- package/dist/llm.d.ts.map +0 -1
- package/dist/llm.js.map +0 -1
- package/dist/llm.test.js +0 -592
- package/dist/llm.test.js.map +0 -1
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js.map +0 -1
- package/dist/prompts.test.d.ts +0 -2
- package/dist/prompts.test.d.ts.map +0 -1
- package/dist/prompts.test.js +0 -427
- package/dist/prompts.test.js.map +0 -1
- package/src/analysis.test.ts +0 -396
- package/src/analysis.ts +0 -262
- package/src/git.ts +0 -300
- package/src/llm.test.ts +0 -701
- package/src/prompts.test.ts +0 -515
- /package/dist/{llm.test.d.ts → llm/llm.test.d.ts} +0 -0
package/dist/analysis.test.js
DELETED
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Analysis Module Integration Tests
|
|
4
|
-
*
|
|
5
|
-
* Tests for the complete analysis workflow including generation.
|
|
6
|
-
* Following TDD: These tests are written BEFORE implementation.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
/* eslint-disable no-console */
|
|
43
|
-
const analysis_1 = require("./analysis");
|
|
44
|
-
const config = __importStar(require("./config"));
|
|
45
|
-
const git = __importStar(require("./git"));
|
|
46
|
-
const llm = __importStar(require("./llm"));
|
|
47
|
-
const prompts = __importStar(require("./prompts"));
|
|
48
|
-
const adr = __importStar(require("./adr"));
|
|
49
|
-
// Mock all dependencies
|
|
50
|
-
jest.mock('./config');
|
|
51
|
-
jest.mock('./git');
|
|
52
|
-
jest.mock('./llm');
|
|
53
|
-
jest.mock('./prompts');
|
|
54
|
-
jest.mock('./adr');
|
|
55
|
-
describe('Analysis with Generation Integration', () => {
|
|
56
|
-
const mockConfig = {
|
|
57
|
-
provider: 'openai',
|
|
58
|
-
analysis_model: 'gpt-4',
|
|
59
|
-
api_key_env: 'OPENAI_API_KEY',
|
|
60
|
-
timeout_seconds: 15
|
|
61
|
-
};
|
|
62
|
-
const mockDiffOptions = { mode: 'staged' };
|
|
63
|
-
beforeEach(() => {
|
|
64
|
-
jest.clearAllMocks();
|
|
65
|
-
// Mock console methods to silence output during tests
|
|
66
|
-
jest.spyOn(console, 'log').mockImplementation();
|
|
67
|
-
jest.spyOn(console, 'error').mockImplementation();
|
|
68
|
-
// Default mocks
|
|
69
|
-
config.loadConfig.mockResolvedValue(mockConfig);
|
|
70
|
-
git.getChangedFiles.mockResolvedValue([
|
|
71
|
-
'src/database.ts',
|
|
72
|
-
'src/config.ts'
|
|
73
|
-
]);
|
|
74
|
-
git.getDiff.mockResolvedValue(`
|
|
75
|
-
diff --git a/src/database.ts b/src/database.ts
|
|
76
|
-
+import pg from 'pg';
|
|
77
|
-
+export const database = new pg.Pool();
|
|
78
|
-
`);
|
|
79
|
-
});
|
|
80
|
-
afterEach(() => {
|
|
81
|
-
jest.restoreAllMocks();
|
|
82
|
-
});
|
|
83
|
-
describe('runAnalysis without generation', () => {
|
|
84
|
-
test('completes successfully when change is not significant', async () => {
|
|
85
|
-
llm.analyzeChanges.mockResolvedValue({
|
|
86
|
-
result: {
|
|
87
|
-
is_significant: false,
|
|
88
|
-
reason: 'Minor code formatting changes',
|
|
89
|
-
timestamp: new Date().toISOString()
|
|
90
|
-
},
|
|
91
|
-
error: undefined
|
|
92
|
-
});
|
|
93
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
94
|
-
expect(config.loadConfig).toHaveBeenCalled();
|
|
95
|
-
expect(git.getChangedFiles).toHaveBeenCalledWith(mockDiffOptions);
|
|
96
|
-
expect(git.getDiff).toHaveBeenCalledWith(mockDiffOptions);
|
|
97
|
-
expect(llm.analyzeChanges).toHaveBeenCalled();
|
|
98
|
-
// Should not prompt for generation if not significant
|
|
99
|
-
expect(prompts.promptForGeneration).not.toHaveBeenCalled();
|
|
100
|
-
});
|
|
101
|
-
test('handles missing configuration gracefully', async () => {
|
|
102
|
-
config.loadConfig.mockResolvedValue(null);
|
|
103
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
104
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Configuration'));
|
|
105
|
-
expect(git.getChangedFiles).not.toHaveBeenCalled();
|
|
106
|
-
});
|
|
107
|
-
test('handles no changed files gracefully', async () => {
|
|
108
|
-
git.getChangedFiles.mockResolvedValue([]);
|
|
109
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
110
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('No changes'));
|
|
111
|
-
expect(git.getDiff).not.toHaveBeenCalled();
|
|
112
|
-
});
|
|
113
|
-
test('handles git errors gracefully', async () => {
|
|
114
|
-
git.getChangedFiles.mockRejectedValue(new Error('Git error'));
|
|
115
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
116
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Failed'));
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
describe('runAnalysis with generation - user confirms', () => {
|
|
120
|
-
beforeEach(() => {
|
|
121
|
-
llm.analyzeChanges.mockResolvedValue({
|
|
122
|
-
result: {
|
|
123
|
-
is_significant: true,
|
|
124
|
-
reason: 'Introduces PostgreSQL as primary datastore',
|
|
125
|
-
timestamp: new Date().toISOString()
|
|
126
|
-
},
|
|
127
|
-
error: undefined
|
|
128
|
-
});
|
|
129
|
-
prompts.promptForGeneration.mockResolvedValue(true); // User confirms
|
|
130
|
-
});
|
|
131
|
-
test('prompts for generation when change is significant', async () => {
|
|
132
|
-
llm.generateADRContent.mockResolvedValue({
|
|
133
|
-
result: {
|
|
134
|
-
content: '# Use PostgreSQL\n\n* Status: accepted',
|
|
135
|
-
title: 'Use PostgreSQL',
|
|
136
|
-
timestamp: new Date().toISOString()
|
|
137
|
-
},
|
|
138
|
-
error: undefined
|
|
139
|
-
});
|
|
140
|
-
adr.saveADR.mockReturnValue({
|
|
141
|
-
success: true,
|
|
142
|
-
filePath: 'docs/adr/0001-use-postgresql.md'
|
|
143
|
-
});
|
|
144
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
145
|
-
expect(prompts.promptForGeneration).toHaveBeenCalledWith('Introduces PostgreSQL as primary datastore');
|
|
146
|
-
});
|
|
147
|
-
test('generates ADR when user confirms', async () => {
|
|
148
|
-
llm.generateADRContent.mockResolvedValue({
|
|
149
|
-
result: {
|
|
150
|
-
content: '# Use PostgreSQL\n\n* Status: accepted',
|
|
151
|
-
title: 'Use PostgreSQL',
|
|
152
|
-
timestamp: new Date().toISOString()
|
|
153
|
-
},
|
|
154
|
-
error: undefined
|
|
155
|
-
});
|
|
156
|
-
adr.saveADR.mockReturnValue({
|
|
157
|
-
success: true,
|
|
158
|
-
filePath: 'docs/adr/0001-use-postgresql.md'
|
|
159
|
-
});
|
|
160
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
161
|
-
expect(llm.generateADRContent).toHaveBeenCalled();
|
|
162
|
-
const generationCall = llm.generateADRContent.mock.calls[0];
|
|
163
|
-
expect(generationCall[0]).toEqual(mockConfig);
|
|
164
|
-
expect(generationCall[1]).toMatchObject({
|
|
165
|
-
reason: 'Introduces PostgreSQL as primary datastore'
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
test('saves ADR file after successful generation', async () => {
|
|
169
|
-
const mockADRContent = '# Use PostgreSQL\n\n* Status: accepted\n\n## Context\n\nWe need a database.';
|
|
170
|
-
llm.generateADRContent.mockResolvedValue({
|
|
171
|
-
result: {
|
|
172
|
-
content: mockADRContent,
|
|
173
|
-
title: 'Use PostgreSQL',
|
|
174
|
-
timestamp: new Date().toISOString()
|
|
175
|
-
},
|
|
176
|
-
error: undefined
|
|
177
|
-
});
|
|
178
|
-
adr.saveADR.mockReturnValue({
|
|
179
|
-
success: true,
|
|
180
|
-
filePath: 'docs/adr/0001-use-postgresql.md'
|
|
181
|
-
});
|
|
182
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
183
|
-
expect(adr.saveADR).toHaveBeenCalledWith(mockADRContent, 'Use PostgreSQL');
|
|
184
|
-
});
|
|
185
|
-
test('displays success message with file path', async () => {
|
|
186
|
-
const filePath = 'docs/adr/0001-use-postgresql.md';
|
|
187
|
-
llm.generateADRContent.mockResolvedValue({
|
|
188
|
-
result: {
|
|
189
|
-
content: '# Use PostgreSQL\n\n* Status: accepted',
|
|
190
|
-
title: 'Use PostgreSQL',
|
|
191
|
-
timestamp: new Date().toISOString()
|
|
192
|
-
},
|
|
193
|
-
error: undefined
|
|
194
|
-
});
|
|
195
|
-
adr.saveADR.mockReturnValue({
|
|
196
|
-
success: true,
|
|
197
|
-
filePath
|
|
198
|
-
});
|
|
199
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
200
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Success'));
|
|
201
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining(filePath));
|
|
202
|
-
});
|
|
203
|
-
test('displays next steps after successful generation', async () => {
|
|
204
|
-
llm.generateADRContent.mockResolvedValue({
|
|
205
|
-
result: {
|
|
206
|
-
content: '# Use PostgreSQL\n\n* Status: accepted',
|
|
207
|
-
title: 'Use PostgreSQL',
|
|
208
|
-
timestamp: new Date().toISOString()
|
|
209
|
-
},
|
|
210
|
-
error: undefined
|
|
211
|
-
});
|
|
212
|
-
adr.saveADR.mockReturnValue({
|
|
213
|
-
success: true,
|
|
214
|
-
filePath: 'docs/adr/0001-use-postgresql.md'
|
|
215
|
-
});
|
|
216
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
217
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Next steps'));
|
|
218
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Review'));
|
|
219
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Commit'));
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
describe('runAnalysis with generation - user declines', () => {
|
|
223
|
-
beforeEach(() => {
|
|
224
|
-
llm.analyzeChanges.mockResolvedValue({
|
|
225
|
-
result: {
|
|
226
|
-
is_significant: true,
|
|
227
|
-
reason: 'Introduces Redis caching layer',
|
|
228
|
-
timestamp: new Date().toISOString()
|
|
229
|
-
},
|
|
230
|
-
error: undefined
|
|
231
|
-
});
|
|
232
|
-
prompts.promptForGeneration.mockResolvedValue(false); // User declines
|
|
233
|
-
});
|
|
234
|
-
test('skips generation when user declines', async () => {
|
|
235
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
236
|
-
expect(prompts.promptForGeneration).toHaveBeenCalled();
|
|
237
|
-
expect(llm.generateADRContent).not.toHaveBeenCalled();
|
|
238
|
-
expect(adr.saveADR).not.toHaveBeenCalled();
|
|
239
|
-
});
|
|
240
|
-
test('displays skip message when user declines', async () => {
|
|
241
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
242
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Skipping'));
|
|
243
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('manual'));
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
describe('runAnalysis with generation - error handling', () => {
|
|
247
|
-
beforeEach(() => {
|
|
248
|
-
llm.analyzeChanges.mockResolvedValue({
|
|
249
|
-
result: {
|
|
250
|
-
is_significant: true,
|
|
251
|
-
reason: 'Introduces Kafka event streaming',
|
|
252
|
-
timestamp: new Date().toISOString()
|
|
253
|
-
},
|
|
254
|
-
error: undefined
|
|
255
|
-
});
|
|
256
|
-
prompts.promptForGeneration.mockResolvedValue(true);
|
|
257
|
-
});
|
|
258
|
-
test('handles generation errors gracefully', async () => {
|
|
259
|
-
llm.generateADRContent.mockResolvedValue({
|
|
260
|
-
result: null,
|
|
261
|
-
error: 'API rate limit exceeded'
|
|
262
|
-
});
|
|
263
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
264
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('generation failed'));
|
|
265
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('rate limit'));
|
|
266
|
-
expect(adr.saveADR).not.toHaveBeenCalled();
|
|
267
|
-
});
|
|
268
|
-
test('handles file save errors gracefully', async () => {
|
|
269
|
-
llm.generateADRContent.mockResolvedValue({
|
|
270
|
-
result: {
|
|
271
|
-
content: '# Use Kafka\n\n* Status: accepted',
|
|
272
|
-
title: 'Use Kafka',
|
|
273
|
-
timestamp: new Date().toISOString()
|
|
274
|
-
},
|
|
275
|
-
error: undefined
|
|
276
|
-
});
|
|
277
|
-
adr.saveADR.mockReturnValue({
|
|
278
|
-
success: false,
|
|
279
|
-
error: 'Permission denied'
|
|
280
|
-
});
|
|
281
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
282
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Failed to save'));
|
|
283
|
-
expect(console.error).toHaveBeenCalledWith(expect.stringContaining('Permission denied'));
|
|
284
|
-
});
|
|
285
|
-
test('continues workflow on generation error (fail-open)', async () => {
|
|
286
|
-
llm.generateADRContent.mockResolvedValue({
|
|
287
|
-
result: null,
|
|
288
|
-
error: 'Network error'
|
|
289
|
-
});
|
|
290
|
-
// Should complete without throwing
|
|
291
|
-
await expect((0, analysis_1.runAnalysis)(mockDiffOptions)).resolves.not.toThrow();
|
|
292
|
-
});
|
|
293
|
-
test('continues workflow on save error (fail-open)', async () => {
|
|
294
|
-
llm.generateADRContent.mockResolvedValue({
|
|
295
|
-
result: {
|
|
296
|
-
content: '# Decision\n\n* Status: accepted',
|
|
297
|
-
title: 'Decision',
|
|
298
|
-
timestamp: new Date().toISOString()
|
|
299
|
-
},
|
|
300
|
-
error: undefined
|
|
301
|
-
});
|
|
302
|
-
adr.saveADR.mockReturnValue({
|
|
303
|
-
success: false,
|
|
304
|
-
error: 'Disk full'
|
|
305
|
-
});
|
|
306
|
-
// Should complete without throwing
|
|
307
|
-
await expect((0, analysis_1.runAnalysis)(mockDiffOptions)).resolves.not.toThrow();
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
describe('runAnalysis - complete workflow', () => {
|
|
311
|
-
test('completes full happy path workflow', async () => {
|
|
312
|
-
// Analysis detects significance
|
|
313
|
-
llm.analyzeChanges.mockResolvedValue({
|
|
314
|
-
result: {
|
|
315
|
-
is_significant: true,
|
|
316
|
-
reason: 'Introduces GraphQL API layer',
|
|
317
|
-
timestamp: new Date().toISOString()
|
|
318
|
-
},
|
|
319
|
-
error: undefined
|
|
320
|
-
});
|
|
321
|
-
// User confirms
|
|
322
|
-
prompts.promptForGeneration.mockResolvedValue(true);
|
|
323
|
-
// Generation succeeds
|
|
324
|
-
llm.generateADRContent.mockResolvedValue({
|
|
325
|
-
result: {
|
|
326
|
-
content: '# Use GraphQL\n\n* Status: accepted',
|
|
327
|
-
title: 'Use GraphQL',
|
|
328
|
-
timestamp: new Date().toISOString()
|
|
329
|
-
},
|
|
330
|
-
error: undefined
|
|
331
|
-
});
|
|
332
|
-
// Save succeeds
|
|
333
|
-
adr.saveADR.mockReturnValue({
|
|
334
|
-
success: true,
|
|
335
|
-
filePath: 'docs/adr/0001-use-graphql.md'
|
|
336
|
-
});
|
|
337
|
-
await (0, analysis_1.runAnalysis)(mockDiffOptions);
|
|
338
|
-
// Verify complete workflow executed
|
|
339
|
-
expect(config.loadConfig).toHaveBeenCalled();
|
|
340
|
-
expect(git.getChangedFiles).toHaveBeenCalled();
|
|
341
|
-
expect(git.getDiff).toHaveBeenCalled();
|
|
342
|
-
expect(llm.analyzeChanges).toHaveBeenCalled();
|
|
343
|
-
expect(prompts.promptForGeneration).toHaveBeenCalled();
|
|
344
|
-
expect(llm.generateADRContent).toHaveBeenCalled();
|
|
345
|
-
expect(adr.saveADR).toHaveBeenCalled();
|
|
346
|
-
// Verify success output
|
|
347
|
-
expect(console.log).toHaveBeenCalledWith(expect.stringContaining('Success'));
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
//# sourceMappingURL=analysis.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analysis.test.js","sourceRoot":"","sources":["../src/analysis.test.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAA+B;AAE/B,yCAAyC;AACzC,iDAAmC;AACnC,2CAA6B;AAC7B,2CAA6B;AAC7B,mDAAqC;AACrC,2CAA6B;AAG7B,wBAAwB;AACxB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnB,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAEnB,QAAQ,CAAC,sCAAsC,EAAE,GAAG,EAAE;IACpD,MAAM,UAAU,GAA0B;QACxC,QAAQ,EAAE,QAAQ;QAClB,cAAc,EAAE,OAAO;QACvB,WAAW,EAAE,gBAAgB;QAC7B,eAAe,EAAE,EAAE;KACpB,CAAC;IAEF,MAAM,eAAe,GAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAExD,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,sDAAsD;QACtD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAChD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAElD,gBAAgB;QACf,MAAM,CAAC,UAAwB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAC9D,GAAG,CAAC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BAAwB;YACxB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/git.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export declare class GitError extends Error {
|
|
2
|
-
readonly code: 'NOT_GIT_REPO' | 'GIT_NOT_FOUND' | 'GIT_ERROR';
|
|
3
|
-
readonly originalError?: Error | undefined;
|
|
4
|
-
constructor(message: string, code: 'NOT_GIT_REPO' | 'GIT_NOT_FOUND' | 'GIT_ERROR', originalError?: Error | undefined);
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Options for specifying what diff to analyze
|
|
8
|
-
*/
|
|
9
|
-
export interface DiffOptions {
|
|
10
|
-
mode: 'staged' | 'all' | 'branch-diff';
|
|
11
|
-
base?: string;
|
|
12
|
-
head?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Retrieves the list of staged files in the current Git repository
|
|
16
|
-
* @returns Promise<string[]> Array of staged file paths
|
|
17
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
18
|
-
*/
|
|
19
|
-
export declare function getStagedFiles(): Promise<string[]>;
|
|
20
|
-
/**
|
|
21
|
-
* Retrieves the full diff content for staged files
|
|
22
|
-
* Uses minimal context to reduce token usage
|
|
23
|
-
* @returns Promise<string> Full diff content of staged changes
|
|
24
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
25
|
-
*/
|
|
26
|
-
export declare function getStagedDiff(): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves the list of all uncommitted files (staged + unstaged) in the current Git repository
|
|
29
|
-
* @returns Promise<string[]> Array of uncommitted file paths
|
|
30
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
31
|
-
*/
|
|
32
|
-
export declare function getUncommittedFiles(): Promise<string[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves the full diff content for all uncommitted files (staged + unstaged)
|
|
35
|
-
* Uses minimal context to reduce token usage
|
|
36
|
-
* @returns Promise<string> Full diff content of uncommitted changes
|
|
37
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
38
|
-
*/
|
|
39
|
-
export declare function getUncommittedDiff(): Promise<string>;
|
|
40
|
-
/**
|
|
41
|
-
* Generic function to get changed files based on diff options
|
|
42
|
-
* @param options - Diff options specifying which changes to analyze
|
|
43
|
-
* @returns Promise<string[]> Array of changed file paths
|
|
44
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
45
|
-
*/
|
|
46
|
-
export declare function getChangedFiles(options?: DiffOptions): Promise<string[]>;
|
|
47
|
-
/**
|
|
48
|
-
* Generic function to get diff content based on diff options
|
|
49
|
-
* @param options - Diff options specifying which changes to analyze
|
|
50
|
-
* @returns Promise<string> Full diff content
|
|
51
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
52
|
-
*/
|
|
53
|
-
export declare function getDiff(options?: DiffOptions): Promise<string>;
|
|
54
|
-
//# sourceMappingURL=git.d.ts.map
|
package/dist/git.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAKA,qBAAa,QAAS,SAAQ,KAAK;aAGf,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,WAAW;aACpD,aAAa,CAAC,EAAE,KAAK;gBAFrC,OAAO,EAAE,MAAM,EACC,IAAI,EAAE,cAAc,GAAG,eAAe,GAAG,WAAW,EACpD,aAAa,CAAC,EAAE,KAAK,YAAA;CAKxC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,GAAG,KAAK,GAAG,aAAa,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAsCxD;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAiCrD;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAsC7D;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC,CAiC1D;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAE,WAA6B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA+C/F;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,OAAO,GAAE,WAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyCrF"}
|
package/dist/git.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitError = void 0;
|
|
4
|
-
exports.getStagedFiles = getStagedFiles;
|
|
5
|
-
exports.getStagedDiff = getStagedDiff;
|
|
6
|
-
exports.getUncommittedFiles = getUncommittedFiles;
|
|
7
|
-
exports.getUncommittedDiff = getUncommittedDiff;
|
|
8
|
-
exports.getChangedFiles = getChangedFiles;
|
|
9
|
-
exports.getDiff = getDiff;
|
|
10
|
-
const child_process_1 = require("child_process");
|
|
11
|
-
const util_1 = require("util");
|
|
12
|
-
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
13
|
-
class GitError extends Error {
|
|
14
|
-
code;
|
|
15
|
-
originalError;
|
|
16
|
-
constructor(message, code, originalError) {
|
|
17
|
-
super(message);
|
|
18
|
-
this.code = code;
|
|
19
|
-
this.originalError = originalError;
|
|
20
|
-
this.name = 'GitError';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.GitError = GitError;
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves the list of staged files in the current Git repository
|
|
26
|
-
* @returns Promise<string[]> Array of staged file paths
|
|
27
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
28
|
-
*/
|
|
29
|
-
async function getStagedFiles() {
|
|
30
|
-
try {
|
|
31
|
-
const { stdout } = await execAsync('git diff --cached --name-only');
|
|
32
|
-
// Split by newlines and filter out empty strings
|
|
33
|
-
const stagedFiles = stdout
|
|
34
|
-
.split('\n')
|
|
35
|
-
.map(file => file.trim())
|
|
36
|
-
.filter(file => file.length > 0);
|
|
37
|
-
return stagedFiles;
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
// Handle different Git error scenarios
|
|
41
|
-
const errorWithCode = error;
|
|
42
|
-
if (errorWithCode.code === 128) {
|
|
43
|
-
throw new GitError('Not in a Git repository. Please run \'cadr\' from within a Git repository.', 'NOT_GIT_REPO', error instanceof Error ? error : new Error(String(error)));
|
|
44
|
-
}
|
|
45
|
-
if (errorWithCode.code === 127) {
|
|
46
|
-
throw new GitError('Git is not installed. Please install Git and try again.', 'GIT_NOT_FOUND', error instanceof Error ? error : new Error(String(error)));
|
|
47
|
-
}
|
|
48
|
-
// Handle other Git errors (permissions, corruption, etc.)
|
|
49
|
-
throw new GitError('Unable to read Git repository. Please check repository permissions.', 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Retrieves the full diff content for staged files
|
|
54
|
-
* Uses minimal context to reduce token usage
|
|
55
|
-
* @returns Promise<string> Full diff content of staged changes
|
|
56
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
57
|
-
*/
|
|
58
|
-
async function getStagedDiff() {
|
|
59
|
-
try {
|
|
60
|
-
// Use --unified=1 for minimal context (1 line before/after instead of 3)
|
|
61
|
-
// This significantly reduces token usage while maintaining readability
|
|
62
|
-
const { stdout } = await execAsync('git diff --cached --unified=1');
|
|
63
|
-
return stdout;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
// Handle different Git error scenarios (same as getStagedFiles)
|
|
67
|
-
const errorWithCode = error;
|
|
68
|
-
if (errorWithCode.code === 128) {
|
|
69
|
-
throw new GitError('Not in a Git repository. Please run \'cadr\' from within a Git repository.', 'NOT_GIT_REPO', error instanceof Error ? error : new Error(String(error)));
|
|
70
|
-
}
|
|
71
|
-
if (errorWithCode.code === 127) {
|
|
72
|
-
throw new GitError('Git is not installed. Please install Git and try again.', 'GIT_NOT_FOUND', error instanceof Error ? error : new Error(String(error)));
|
|
73
|
-
}
|
|
74
|
-
// Handle other Git errors (permissions, corruption, etc.)
|
|
75
|
-
throw new GitError('Unable to read Git repository. Please check repository permissions.', 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Retrieves the list of all uncommitted files (staged + unstaged) in the current Git repository
|
|
80
|
-
* @returns Promise<string[]> Array of uncommitted file paths
|
|
81
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
82
|
-
*/
|
|
83
|
-
async function getUncommittedFiles() {
|
|
84
|
-
try {
|
|
85
|
-
const { stdout } = await execAsync('git diff HEAD --name-only');
|
|
86
|
-
// Split by newlines and filter out empty strings
|
|
87
|
-
const uncommittedFiles = stdout
|
|
88
|
-
.split('\n')
|
|
89
|
-
.map(file => file.trim())
|
|
90
|
-
.filter(file => file.length > 0);
|
|
91
|
-
return uncommittedFiles;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
// Handle different Git error scenarios
|
|
95
|
-
const errorWithCode = error;
|
|
96
|
-
if (errorWithCode.code === 128) {
|
|
97
|
-
throw new GitError('Not in a Git repository. Please run \'cadr\' from within a Git repository.', 'NOT_GIT_REPO', error instanceof Error ? error : new Error(String(error)));
|
|
98
|
-
}
|
|
99
|
-
if (errorWithCode.code === 127) {
|
|
100
|
-
throw new GitError('Git is not installed. Please install Git and try again.', 'GIT_NOT_FOUND', error instanceof Error ? error : new Error(String(error)));
|
|
101
|
-
}
|
|
102
|
-
// Handle other Git errors (permissions, corruption, etc.)
|
|
103
|
-
throw new GitError('Unable to read Git repository. Please check repository permissions.', 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Retrieves the full diff content for all uncommitted files (staged + unstaged)
|
|
108
|
-
* Uses minimal context to reduce token usage
|
|
109
|
-
* @returns Promise<string> Full diff content of uncommitted changes
|
|
110
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
111
|
-
*/
|
|
112
|
-
async function getUncommittedDiff() {
|
|
113
|
-
try {
|
|
114
|
-
// Use --unified=1 for minimal context (1 line before/after instead of 3)
|
|
115
|
-
// This significantly reduces token usage while maintaining readability
|
|
116
|
-
const { stdout } = await execAsync('git diff HEAD --unified=1');
|
|
117
|
-
return stdout;
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
// Handle different Git error scenarios (same as getUncommittedFiles)
|
|
121
|
-
const errorWithCode = error;
|
|
122
|
-
if (errorWithCode.code === 128) {
|
|
123
|
-
throw new GitError('Not in a Git repository. Please run \'cadr\' from within a Git repository.', 'NOT_GIT_REPO', error instanceof Error ? error : new Error(String(error)));
|
|
124
|
-
}
|
|
125
|
-
if (errorWithCode.code === 127) {
|
|
126
|
-
throw new GitError('Git is not installed. Please install Git and try again.', 'GIT_NOT_FOUND', error instanceof Error ? error : new Error(String(error)));
|
|
127
|
-
}
|
|
128
|
-
// Handle other Git errors (permissions, corruption, etc.)
|
|
129
|
-
throw new GitError('Unable to read Git repository. Please check repository permissions.', 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Generic function to get changed files based on diff options
|
|
134
|
-
* @param options - Diff options specifying which changes to analyze
|
|
135
|
-
* @returns Promise<string[]> Array of changed file paths
|
|
136
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
137
|
-
*/
|
|
138
|
-
async function getChangedFiles(options = { mode: 'all' }) {
|
|
139
|
-
switch (options.mode) {
|
|
140
|
-
case 'staged':
|
|
141
|
-
return getStagedFiles();
|
|
142
|
-
case 'all':
|
|
143
|
-
return getUncommittedFiles();
|
|
144
|
-
case 'branch-diff': {
|
|
145
|
-
const base = options.base || 'origin/main';
|
|
146
|
-
const head = options.head || 'HEAD';
|
|
147
|
-
try {
|
|
148
|
-
// Use triple-dot syntax for merge-base diff (standard in CI/CD)
|
|
149
|
-
const { stdout } = await execAsync(`git diff ${base}...${head} --name-only`);
|
|
150
|
-
const files = stdout
|
|
151
|
-
.split('\n')
|
|
152
|
-
.map(file => file.trim())
|
|
153
|
-
.filter(file => file.length > 0);
|
|
154
|
-
return files;
|
|
155
|
-
}
|
|
156
|
-
catch (error) {
|
|
157
|
-
// Handle different Git error scenarios
|
|
158
|
-
const errorWithCode = error;
|
|
159
|
-
if (errorWithCode.code === 128) {
|
|
160
|
-
throw new GitError(`Invalid git references: ${base}...${head}. Please ensure both references exist.`, 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
161
|
-
}
|
|
162
|
-
if (errorWithCode.code === 127) {
|
|
163
|
-
throw new GitError('Git is not installed. Please install Git and try again.', 'GIT_NOT_FOUND', error instanceof Error ? error : new Error(String(error)));
|
|
164
|
-
}
|
|
165
|
-
throw new GitError('Unable to read Git repository. Please check repository permissions.', 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Generic function to get diff content based on diff options
|
|
172
|
-
* @param options - Diff options specifying which changes to analyze
|
|
173
|
-
* @returns Promise<string> Full diff content
|
|
174
|
-
* @throws GitError When Git is not available or repository is invalid
|
|
175
|
-
*/
|
|
176
|
-
async function getDiff(options = { mode: 'all' }) {
|
|
177
|
-
switch (options.mode) {
|
|
178
|
-
case 'staged':
|
|
179
|
-
return getStagedDiff();
|
|
180
|
-
case 'all':
|
|
181
|
-
return getUncommittedDiff();
|
|
182
|
-
case 'branch-diff': {
|
|
183
|
-
const base = options.base || 'origin/main';
|
|
184
|
-
const head = options.head || 'HEAD';
|
|
185
|
-
try {
|
|
186
|
-
// Use triple-dot syntax for merge-base diff with minimal context
|
|
187
|
-
const { stdout } = await execAsync(`git diff ${base}...${head} --unified=1`);
|
|
188
|
-
return stdout;
|
|
189
|
-
}
|
|
190
|
-
catch (error) {
|
|
191
|
-
// Handle different Git error scenarios
|
|
192
|
-
const errorWithCode = error;
|
|
193
|
-
if (errorWithCode.code === 128) {
|
|
194
|
-
throw new GitError(`Invalid git references: ${base}...${head}. Please ensure both references exist.`, 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
195
|
-
}
|
|
196
|
-
if (errorWithCode.code === 127) {
|
|
197
|
-
throw new GitError('Git is not installed. Please install Git and try again.', 'GIT_NOT_FOUND', error instanceof Error ? error : new Error(String(error)));
|
|
198
|
-
}
|
|
199
|
-
throw new GitError('Unable to read Git repository. Please check repository permissions.', 'GIT_ERROR', error instanceof Error ? error : new Error(String(error)));
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
//# sourceMappingURL=git.js.map
|
package/dist/git.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":";;;AA8BA,wCAsCC;AAQD,sCAiCC;AAOD,kDAsCC;AAQD,gDAiCC;AAQD,0CA+CC;AAQD,0BAyCC;AA3SD,iDAAqC;AACrC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAElC,MAAa,QAAS,SAAQ,KAAK;IAGf;IACA;IAHlB,YACE,OAAe,EACC,IAAoD,EACpD,aAAqB;QAErC,KAAK,CAAC,OAAO,CAAC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