@kosuke-ai/cli 0.0.11 → 0.0.13
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/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -6
- package/dist/index.js.map +1 -1
- package/dist/kosuke/commands/build.d.ts +22 -0
- package/dist/kosuke/commands/build.d.ts.map +1 -0
- package/dist/kosuke/commands/build.js +135 -0
- package/dist/kosuke/commands/build.js.map +1 -0
- package/dist/kosuke/commands/lint.d.ts +9 -4
- package/dist/kosuke/commands/lint.d.ts.map +1 -1
- package/dist/kosuke/commands/lint.js +181 -68
- package/dist/kosuke/commands/lint.js.map +1 -1
- package/dist/kosuke/commands/review.d.ts +21 -0
- package/dist/kosuke/commands/review.d.ts.map +1 -0
- package/dist/kosuke/commands/review.js +185 -0
- package/dist/kosuke/commands/review.js.map +1 -0
- package/dist/kosuke/commands/ship.d.ts +23 -0
- package/dist/kosuke/commands/ship.d.ts.map +1 -0
- package/dist/kosuke/commands/ship.js +419 -0
- package/dist/kosuke/commands/ship.js.map +1 -0
- package/dist/kosuke/types.d.ts +45 -1
- package/dist/kosuke/types.d.ts.map +1 -1
- package/dist/kosuke/utils/git.d.ts +12 -0
- package/dist/kosuke/utils/git.d.ts.map +1 -1
- package/dist/kosuke/utils/git.js +39 -0
- package/dist/kosuke/utils/git.js.map +1 -1
- package/dist/kosuke/utils/validator.d.ts +11 -0
- package/dist/kosuke/utils/validator.d.ts.map +1 -1
- package/dist/kosuke/utils/validator.js +100 -0
- package/dist/kosuke/utils/validator.js.map +1 -1
- package/dist/lib.d.ts +6 -3
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +5 -2
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,36 +1,98 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Lint command -
|
|
2
|
+
* Lint command - Comprehensive code quality validation and fixing
|
|
3
3
|
*
|
|
4
|
-
* Strategy: Run
|
|
4
|
+
* Strategy: Run all validation steps (format, lint, typecheck, test, knip),
|
|
5
|
+
* give errors to Claude, let it fix them
|
|
5
6
|
*/
|
|
6
|
-
import { runLint } from '../utils/validator.js';
|
|
7
|
+
import { runLint, runFormat, runTypecheck } from '../utils/validator.js';
|
|
7
8
|
import { runWithPR } from '../utils/pr-orchestrator.js';
|
|
8
9
|
import { runAgent } from '../utils/claude-agent.js';
|
|
10
|
+
import { execSync } from 'child_process';
|
|
9
11
|
/**
|
|
10
|
-
* Run
|
|
12
|
+
* Run tests using package.json test script
|
|
13
|
+
*/
|
|
14
|
+
async function runTests() {
|
|
15
|
+
const { readPackageJsonScripts, detectPackageManager } = await import('../utils/validator.js');
|
|
16
|
+
const scripts = readPackageJsonScripts();
|
|
17
|
+
if (!scripts || !scripts.test) {
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
warning: '⚠️ No test script found in package.json. Skipping tests.',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const packageManager = detectPackageManager();
|
|
24
|
+
const command = `${packageManager} run test`;
|
|
25
|
+
try {
|
|
26
|
+
const output = execSync(command, {
|
|
27
|
+
cwd: process.cwd(),
|
|
28
|
+
encoding: 'utf-8',
|
|
29
|
+
stdio: 'pipe',
|
|
30
|
+
});
|
|
31
|
+
return { success: true, output };
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const err = error;
|
|
35
|
+
return {
|
|
36
|
+
success: false,
|
|
37
|
+
error: `$ ${command}\n\n${err.stdout || err.stderr || err.message}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Run knip to check for unused exports
|
|
43
|
+
*/
|
|
44
|
+
async function runKnip() {
|
|
45
|
+
const { readPackageJsonScripts, detectPackageManager } = await import('../utils/validator.js');
|
|
46
|
+
const scripts = readPackageJsonScripts();
|
|
47
|
+
if (!scripts || !scripts.knip) {
|
|
48
|
+
return {
|
|
49
|
+
success: true,
|
|
50
|
+
warning: '⚠️ No knip script found in package.json. Skipping knip check.',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const packageManager = detectPackageManager();
|
|
54
|
+
const command = `${packageManager} run knip`;
|
|
55
|
+
try {
|
|
56
|
+
const output = execSync(command, {
|
|
57
|
+
cwd: process.cwd(),
|
|
58
|
+
encoding: 'utf-8',
|
|
59
|
+
stdio: 'pipe',
|
|
60
|
+
});
|
|
61
|
+
return { success: true, output };
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const err = error;
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
error: `$ ${command}\n\n${err.stdout || err.stderr || err.message}`,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Run Claude to fix code quality errors
|
|
11
73
|
* Exported so other commands can use it
|
|
12
74
|
*/
|
|
13
|
-
export async function
|
|
14
|
-
console.log(
|
|
75
|
+
export async function fixCodeQualityErrors(stepName, errors) {
|
|
76
|
+
console.log(`\n🤖 Using Claude to fix ${stepName} errors...\n`);
|
|
15
77
|
const workspaceRoot = process.cwd();
|
|
16
78
|
// System prompt
|
|
17
|
-
const systemPrompt = `You are a code quality expert specialized in fixing
|
|
79
|
+
const systemPrompt = `You are a code quality expert specialized in fixing ${stepName} errors.
|
|
18
80
|
|
|
19
|
-
Your task is to analyze
|
|
81
|
+
Your task is to analyze errors and fix them according to the project's quality standards.
|
|
20
82
|
|
|
21
83
|
CRITICAL REQUIREMENTS:
|
|
22
|
-
- You MUST use the search_replace or write tools to fix ALL
|
|
84
|
+
- You MUST use the search_replace or write tools to fix ALL errors
|
|
23
85
|
- Simply identifying issues without fixing them is NOT acceptable
|
|
24
|
-
- Focus ONLY on fixing the specific
|
|
86
|
+
- Focus ONLY on fixing the specific errors provided. Do not make unnecessary changes.`;
|
|
25
87
|
// User prompt
|
|
26
|
-
const promptText = `The following
|
|
88
|
+
const promptText = `The following ${stepName} errors need to be fixed:
|
|
27
89
|
|
|
28
90
|
\`\`\`
|
|
29
|
-
${
|
|
91
|
+
${errors}
|
|
30
92
|
\`\`\`
|
|
31
93
|
|
|
32
94
|
**Your task:**
|
|
33
|
-
1. Analyze each
|
|
95
|
+
1. Analyze each error carefully
|
|
34
96
|
2. Read the files that have errors
|
|
35
97
|
3. **IMMEDIATELY FIX each error using search_replace or write tools**
|
|
36
98
|
4. Make minimal changes - only fix what's broken
|
|
@@ -57,63 +119,104 @@ Start by reading the files with errors and fixing them one by one.`;
|
|
|
57
119
|
}
|
|
58
120
|
}
|
|
59
121
|
/**
|
|
60
|
-
*
|
|
122
|
+
* Legacy export for backward compatibility
|
|
123
|
+
*/
|
|
124
|
+
export async function fixLintErrors(lintErrors) {
|
|
125
|
+
return fixCodeQualityErrors('linting', lintErrors);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Core comprehensive validation and fixing logic (git-agnostic)
|
|
61
129
|
* Used internally by lintCommand
|
|
62
130
|
*/
|
|
63
131
|
async function fixLintErrorsCore() {
|
|
64
|
-
console.log('🔍 Running
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
132
|
+
console.log('🔍 Running comprehensive code quality checks...\n');
|
|
133
|
+
// Define all validation steps
|
|
134
|
+
const validationSteps = [
|
|
135
|
+
{ name: '🎨 Format', run: runFormat, fixable: true },
|
|
136
|
+
{ name: '🔍 Lint', run: runLint, fixable: true },
|
|
137
|
+
{ name: '🔎 TypeCheck', run: runTypecheck, fixable: true },
|
|
138
|
+
{ name: '🧪 Tests', run: runTests, fixable: true },
|
|
139
|
+
{ name: '🔪 Knip', run: runKnip, fixable: true },
|
|
140
|
+
];
|
|
141
|
+
const stepsFixed = [];
|
|
142
|
+
let totalAttempts = 0;
|
|
75
143
|
let totalFixes = 0;
|
|
76
|
-
|
|
77
|
-
|
|
144
|
+
// Run each validation step
|
|
145
|
+
for (const step of validationSteps) {
|
|
78
146
|
console.log(`\n${'='.repeat(60)}`);
|
|
79
|
-
console.log(
|
|
80
|
-
console.log(`${'='.repeat(60)}`);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
147
|
+
console.log(`Running: ${step.name}`);
|
|
148
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
149
|
+
let result = await step.run();
|
|
150
|
+
// Handle warnings (non-blocking)
|
|
151
|
+
if (result.warning) {
|
|
152
|
+
console.log(result.warning);
|
|
153
|
+
console.log(`✅ ${step.name} - SKIPPED\n`);
|
|
154
|
+
continue;
|
|
85
155
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (lintResult.success) {
|
|
91
|
-
console.log('✅ All linting errors fixed!\n');
|
|
92
|
-
break;
|
|
156
|
+
// Handle success
|
|
157
|
+
if (result.success) {
|
|
158
|
+
console.log(`✅ ${step.name} - PASSED\n`);
|
|
159
|
+
continue;
|
|
93
160
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
161
|
+
// Handle errors
|
|
162
|
+
console.log(`❌ ${step.name} - FAILED:\n`);
|
|
163
|
+
console.log(result.error);
|
|
164
|
+
if (!step.fixable) {
|
|
165
|
+
console.log(`\n⚠️ ${step.name} errors cannot be auto-fixed by Claude`);
|
|
166
|
+
throw new Error(`${step.name} validation failed`);
|
|
167
|
+
}
|
|
168
|
+
// Attempt to fix errors with Claude (max 3 attempts per step)
|
|
169
|
+
let attemptCount = 0;
|
|
170
|
+
const maxAttempts = 3;
|
|
171
|
+
while (!result.success && attemptCount < maxAttempts) {
|
|
172
|
+
attemptCount++;
|
|
173
|
+
totalAttempts++;
|
|
174
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
175
|
+
console.log(`🔄 ${step.name} Fix Attempt ${attemptCount}/${maxAttempts}`);
|
|
176
|
+
console.log(`${'='.repeat(60)}`);
|
|
177
|
+
const fixApplied = await fixCodeQualityErrors(step.name, result.error || '');
|
|
178
|
+
if (!fixApplied) {
|
|
179
|
+
console.log(`\n⚠️ No fixes were applied by Claude for ${step.name}`);
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
totalFixes++;
|
|
183
|
+
// Verify fixes by running validation again
|
|
184
|
+
console.log(`\n🔍 Verifying ${step.name} fixes...\n`);
|
|
185
|
+
result = await step.run();
|
|
186
|
+
if (result.success) {
|
|
187
|
+
console.log(`✅ ${step.name} - All errors fixed!\n`);
|
|
188
|
+
stepsFixed.push(step.name);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
const errorLines = result.error?.split('\n').length || 0;
|
|
193
|
+
console.log(`\n⚠️ Some ${step.name} errors remain (${errorLines} lines):`);
|
|
194
|
+
console.log(result.error);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Check if step still has errors after attempts
|
|
198
|
+
if (!result.success) {
|
|
199
|
+
console.error(`\n❌ Could not fix all ${step.name} errors after ${maxAttempts} attempts`);
|
|
200
|
+
console.log('\nRemaining errors:');
|
|
201
|
+
console.log(result.error);
|
|
202
|
+
throw new Error(`${step.name} errors remain after maximum attempts`);
|
|
97
203
|
}
|
|
98
204
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
console.log('\nRemaining errors:');
|
|
103
|
-
console.log(lintResult.error);
|
|
104
|
-
throw new Error('Linting errors remain after maximum attempts');
|
|
105
|
-
}
|
|
205
|
+
console.log('\n' + '='.repeat(60));
|
|
206
|
+
console.log('✅ All validation steps passed!');
|
|
207
|
+
console.log('='.repeat(60));
|
|
106
208
|
return {
|
|
107
209
|
success: true,
|
|
108
|
-
attempts:
|
|
210
|
+
attempts: totalAttempts,
|
|
109
211
|
fixesApplied: totalFixes,
|
|
212
|
+
stepsFixed,
|
|
110
213
|
};
|
|
111
214
|
}
|
|
112
215
|
/**
|
|
113
|
-
* Main lint command
|
|
216
|
+
* Main lint command (now runs comprehensive validation)
|
|
114
217
|
*/
|
|
115
218
|
export async function lintCommand(options = {}) {
|
|
116
|
-
console.log('🚀 Starting Kosuke
|
|
219
|
+
console.log('🚀 Starting Kosuke Code Quality Check & Fix...\n');
|
|
117
220
|
try {
|
|
118
221
|
// Validate environment
|
|
119
222
|
if (!process.env.ANTHROPIC_API_KEY) {
|
|
@@ -121,41 +224,51 @@ export async function lintCommand(options = {}) {
|
|
|
121
224
|
}
|
|
122
225
|
// If --pr flag is provided, wrap with PR workflow
|
|
123
226
|
if (options.pr) {
|
|
124
|
-
const { result, prInfo } = await runWithPR({
|
|
125
|
-
branchPrefix: 'fix/kosuke-
|
|
227
|
+
const { result: fixResult, prInfo } = await runWithPR({
|
|
228
|
+
branchPrefix: 'fix/kosuke-quality',
|
|
126
229
|
baseBranch: options.baseBranch,
|
|
127
|
-
commitMessage: 'chore: fix
|
|
128
|
-
prTitle: 'chore: Fix
|
|
129
|
-
prBody: `## 🔧 Automated
|
|
230
|
+
commitMessage: 'chore: fix code quality issues',
|
|
231
|
+
prTitle: 'chore: Fix code quality issues',
|
|
232
|
+
prBody: `## 🔧 Automated Code Quality Fixes
|
|
130
233
|
|
|
131
|
-
This PR contains automated fixes for
|
|
234
|
+
This PR contains automated fixes for code quality issues detected by comprehensive validation.
|
|
132
235
|
|
|
133
|
-
###
|
|
134
|
-
- **
|
|
236
|
+
### 📋 Validation Steps Performed
|
|
237
|
+
- 🎨 **Format**: Code formatting check
|
|
238
|
+
- 🔍 **Lint**: ESLint validation
|
|
239
|
+
- 🔎 **TypeCheck**: TypeScript type checking
|
|
240
|
+
- 🧪 **Tests**: Unit/integration tests
|
|
241
|
+
- 🔪 **Knip**: Unused exports detection
|
|
135
242
|
|
|
136
|
-
### ✅
|
|
137
|
-
|
|
243
|
+
### ✅ Result
|
|
244
|
+
All validation steps passed! Code quality issues have been automatically fixed by Claude.
|
|
138
245
|
|
|
139
246
|
---
|
|
140
247
|
|
|
141
248
|
🤖 *Generated by Kosuke CLI (\`kosuke lint --pr\`)*`,
|
|
142
249
|
}, fixLintErrorsCore);
|
|
143
|
-
console.log('\n✅
|
|
144
|
-
console.log(`📊 Attempts: ${
|
|
145
|
-
console.log(`🔧 Fixes applied: ${
|
|
250
|
+
console.log('\n✅ Code quality check complete!');
|
|
251
|
+
console.log(`📊 Attempts: ${fixResult.attempts}`);
|
|
252
|
+
console.log(`🔧 Fixes applied: ${fixResult.fixesApplied}`);
|
|
253
|
+
if (fixResult.stepsFixed.length > 0) {
|
|
254
|
+
console.log(`🎯 Steps fixed: ${fixResult.stepsFixed.join(', ')}`);
|
|
255
|
+
}
|
|
146
256
|
console.log(`🔗 PR: ${prInfo.prUrl}`);
|
|
147
257
|
}
|
|
148
258
|
else {
|
|
149
259
|
// Run core logic without PR
|
|
150
260
|
const result = await fixLintErrorsCore();
|
|
151
|
-
console.log('\n✅
|
|
261
|
+
console.log('\n✅ Code quality check complete!');
|
|
152
262
|
console.log(`📊 Attempts: ${result.attempts}`);
|
|
153
263
|
console.log(`🔧 Fixes applied: ${result.fixesApplied}`);
|
|
264
|
+
if (result.stepsFixed.length > 0) {
|
|
265
|
+
console.log(`🎯 Steps fixed: ${result.stepsFixed.join(', ')}`);
|
|
266
|
+
}
|
|
154
267
|
console.log('\nℹ️ Changes applied locally. Use --pr flag to create a pull request.');
|
|
155
268
|
}
|
|
156
269
|
}
|
|
157
270
|
catch (error) {
|
|
158
|
-
console.error('\n❌
|
|
271
|
+
console.error('\n❌ Code quality check failed:', error);
|
|
159
272
|
throw error;
|
|
160
273
|
}
|
|
161
274
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../kosuke/commands/lint.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../kosuke/commands/lint.ts"],"names":[],"mappings":"AAAA;;;;;GA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AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review command - Review git diff against CLAUDE.md rules
|
|
3
|
+
*
|
|
4
|
+
* This command reviews only the current git diff (uncommitted changes)
|
|
5
|
+
* for compliance with CLAUDE.md rules, fixes any issues found,
|
|
6
|
+
* and runs comprehensive linting afterwards.
|
|
7
|
+
* Note: This command does NOT support --pr flag (changes applied locally only).
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* kosuke review # Review current git diff
|
|
11
|
+
*/
|
|
12
|
+
import type { ReviewOptions, ReviewResult } from '../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Core review logic - reviews git diff only
|
|
15
|
+
*/
|
|
16
|
+
export declare function reviewCore(options?: ReviewOptions): Promise<ReviewResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Main review command
|
|
19
|
+
*/
|
|
20
|
+
export declare function reviewCommand(options?: ReviewOptions): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../../kosuke/commands/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAmE/D;;GAEG;AACH,wBAAsB,UAAU,CAE9B,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CA0FvB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+B9E"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review command - Review git diff against CLAUDE.md rules
|
|
3
|
+
*
|
|
4
|
+
* This command reviews only the current git diff (uncommitted changes)
|
|
5
|
+
* for compliance with CLAUDE.md rules, fixes any issues found,
|
|
6
|
+
* and runs comprehensive linting afterwards.
|
|
7
|
+
* Note: This command does NOT support --pr flag (changes applied locally only).
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* kosuke review # Review current git diff
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync, existsSync } from 'fs';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
import { runAgent, formatCostBreakdown } from '../utils/claude-agent.js';
|
|
15
|
+
import { getGitDiff, hasUncommittedChanges } from '../utils/git.js';
|
|
16
|
+
import { runComprehensiveLinting } from '../utils/validator.js';
|
|
17
|
+
/**
|
|
18
|
+
* Load CLAUDE.md rules
|
|
19
|
+
*/
|
|
20
|
+
function loadClaudeRules(cwd = process.cwd()) {
|
|
21
|
+
const claudePath = join(cwd, 'CLAUDE.md');
|
|
22
|
+
if (!existsSync(claudePath)) {
|
|
23
|
+
throw new Error(`CLAUDE.md not found in workspace root.\n` +
|
|
24
|
+
`Please ensure CLAUDE.md exists at: ${claudePath}`);
|
|
25
|
+
}
|
|
26
|
+
return readFileSync(claudePath, 'utf-8');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build system prompt for code review (git diff only)
|
|
30
|
+
*/
|
|
31
|
+
function buildReviewSystemPrompt(claudeRules, gitDiff) {
|
|
32
|
+
return `You are a senior code reviewer conducting a code quality review of recent changes.
|
|
33
|
+
|
|
34
|
+
**Your Task:**
|
|
35
|
+
Review the git diff below for compliance with the project's CLAUDE.md rules and best practices.
|
|
36
|
+
|
|
37
|
+
**Project Rules (CLAUDE.md):**
|
|
38
|
+
${claudeRules}
|
|
39
|
+
|
|
40
|
+
**Git Diff to Review:**
|
|
41
|
+
\`\`\`diff
|
|
42
|
+
${gitDiff}
|
|
43
|
+
\`\`\`
|
|
44
|
+
|
|
45
|
+
**Review Scope:**
|
|
46
|
+
1. **Code Quality**: Check for violations of CLAUDE.md guidelines
|
|
47
|
+
2. **Type Safety**: Ensure proper TypeScript usage
|
|
48
|
+
3. **Best Practices**: Verify coding patterns and conventions
|
|
49
|
+
4. **Error Handling**: Ensure proper error handling
|
|
50
|
+
5. **Documentation**: Check for adequate comments and docs
|
|
51
|
+
6. **Security**: Identify potential security issues
|
|
52
|
+
7. **Performance**: Look for obvious performance issues
|
|
53
|
+
|
|
54
|
+
**Critical Instructions:**
|
|
55
|
+
- Focus ONLY on the files and changes shown in the git diff above
|
|
56
|
+
- Identify ALL violations of CLAUDE.md rules in the changed code
|
|
57
|
+
- For EACH issue found, FIX it immediately using search_replace or write tools
|
|
58
|
+
- Don't just report issues - FIX them!
|
|
59
|
+
- Make minimal necessary changes
|
|
60
|
+
- Ensure fixes don't break functionality
|
|
61
|
+
- If you need to see more context from a file, use the read_file tool
|
|
62
|
+
|
|
63
|
+
**What to Look For in the Changes:**
|
|
64
|
+
- Use of \`any\` type (should be avoided)
|
|
65
|
+
- Missing error handling
|
|
66
|
+
- Inconsistent naming conventions
|
|
67
|
+
- Poor code organization
|
|
68
|
+
- Missing JSDoc comments on exported functions
|
|
69
|
+
- Improper use of dependencies
|
|
70
|
+
- Code duplication
|
|
71
|
+
- Overly complex functions
|
|
72
|
+
- Missing type exports
|
|
73
|
+
|
|
74
|
+
Review the changes shown in the diff and fix any issues you find.`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Core review logic - reviews git diff only
|
|
78
|
+
*/
|
|
79
|
+
export async function reviewCore(
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
81
|
+
options = {}) {
|
|
82
|
+
const cwd = process.cwd();
|
|
83
|
+
// 1. Check for uncommitted changes
|
|
84
|
+
console.log('🔍 Checking for uncommitted changes...');
|
|
85
|
+
const hasChanges = await hasUncommittedChanges();
|
|
86
|
+
if (!hasChanges) {
|
|
87
|
+
console.log(' ℹ️ No uncommitted changes found. Nothing to review.\n');
|
|
88
|
+
return {
|
|
89
|
+
success: true,
|
|
90
|
+
issuesFound: 0,
|
|
91
|
+
fixesApplied: 0,
|
|
92
|
+
tokensUsed: {
|
|
93
|
+
input: 0,
|
|
94
|
+
output: 0,
|
|
95
|
+
cacheCreation: 0,
|
|
96
|
+
cacheRead: 0,
|
|
97
|
+
},
|
|
98
|
+
cost: 0,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
console.log(' ✅ Found uncommitted changes\n');
|
|
102
|
+
// 2. Get git diff
|
|
103
|
+
console.log('📝 Getting git diff...');
|
|
104
|
+
const gitDiff = await getGitDiff();
|
|
105
|
+
if (!gitDiff || gitDiff.trim().length === 0) {
|
|
106
|
+
console.log(' ℹ️ No diff available. Nothing to review.\n');
|
|
107
|
+
return {
|
|
108
|
+
success: true,
|
|
109
|
+
issuesFound: 0,
|
|
110
|
+
fixesApplied: 0,
|
|
111
|
+
tokensUsed: {
|
|
112
|
+
input: 0,
|
|
113
|
+
output: 0,
|
|
114
|
+
cacheCreation: 0,
|
|
115
|
+
cacheRead: 0,
|
|
116
|
+
},
|
|
117
|
+
cost: 0,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
console.log(` ✅ Got diff (${gitDiff.length} characters)\n`);
|
|
121
|
+
// 3. Load CLAUDE.md rules
|
|
122
|
+
console.log('📖 Loading CLAUDE.md rules...');
|
|
123
|
+
const claudeRules = loadClaudeRules(cwd);
|
|
124
|
+
console.log(` ✅ Loaded rules (${claudeRules.length} characters)\n`);
|
|
125
|
+
// 4. Review phase
|
|
126
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
127
|
+
console.log(`🔍 Phase 1: Code Review of Git Diff`);
|
|
128
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
129
|
+
const systemPrompt = buildReviewSystemPrompt(claudeRules, gitDiff);
|
|
130
|
+
const reviewResult = await runAgent('Review the git diff for compliance with CLAUDE.md rules and fix all issues found', {
|
|
131
|
+
systemPrompt,
|
|
132
|
+
cwd,
|
|
133
|
+
maxTurns: 30,
|
|
134
|
+
verbosity: 'normal',
|
|
135
|
+
});
|
|
136
|
+
const issuesFound = reviewResult.fixCount;
|
|
137
|
+
console.log(`\n✨ Review completed`);
|
|
138
|
+
console.log(` 🔍 Issues found and fixed: ${issuesFound}`);
|
|
139
|
+
console.log(` 💰 Review cost: ${formatCostBreakdown(reviewResult)}`);
|
|
140
|
+
// 5. Linting phase
|
|
141
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
142
|
+
console.log(`🔧 Phase 2: Linting & Quality Checks`);
|
|
143
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
144
|
+
const lintResult = await runComprehensiveLinting();
|
|
145
|
+
console.log(`\n✅ Linting completed (${lintResult.fixCount} additional fixes applied)`);
|
|
146
|
+
return {
|
|
147
|
+
success: true,
|
|
148
|
+
issuesFound,
|
|
149
|
+
fixesApplied: issuesFound + lintResult.fixCount,
|
|
150
|
+
tokensUsed: reviewResult.tokensUsed,
|
|
151
|
+
cost: reviewResult.cost,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Main review command
|
|
156
|
+
*/
|
|
157
|
+
export async function reviewCommand(options = {}) {
|
|
158
|
+
console.log('🔍 Starting Code Review (Git Diff)...\n');
|
|
159
|
+
try {
|
|
160
|
+
// Validate environment
|
|
161
|
+
if (!process.env.ANTHROPIC_API_KEY) {
|
|
162
|
+
throw new Error('ANTHROPIC_API_KEY environment variable is required');
|
|
163
|
+
}
|
|
164
|
+
// Execute core logic (no PR support for review command)
|
|
165
|
+
const result = await reviewCore(options);
|
|
166
|
+
if (result.issuesFound === 0 && result.fixesApplied === 0) {
|
|
167
|
+
console.log('\n✅ Review completed - no issues found!');
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
console.log('\n' + '='.repeat(60));
|
|
171
|
+
console.log('📊 Review Summary');
|
|
172
|
+
console.log('='.repeat(60));
|
|
173
|
+
console.log(`🔍 Issues found: ${result.issuesFound}`);
|
|
174
|
+
console.log(`🔧 Total fixes applied: ${result.fixesApplied}`);
|
|
175
|
+
console.log(`💰 Total cost: $${result.cost.toFixed(4)}`);
|
|
176
|
+
console.log('='.repeat(60));
|
|
177
|
+
console.log('\n✅ Review completed successfully!');
|
|
178
|
+
console.log('ℹ️ All changes applied locally.');
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
console.error('\n❌ Review failed:', error);
|
|
182
|
+
throw error;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.js","sourceRoot":"","sources":["../../../kosuke/commands/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGhE;;GAEG;AACH,SAAS,eAAe,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAClD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAE1C,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,0CAA0C;YACxC,sCAAsC,UAAU,EAAE,CACrD,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAAC,WAAmB,EAAE,OAAe;IACnE,OAAO;;;;;;EAMP,WAAW;;;;EAIX,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAgCyD,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU;AAC9B,6DAA6D;A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CAAC;QAE5B,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC3C,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ship command - Implement a ticket from tickets.json
|
|
3
|
+
*
|
|
4
|
+
* This command takes a ticket ID, implements it following CLAUDE.md rules,
|
|
5
|
+
* runs linting and fixing, and optionally performs a review step.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* kosuke ship --ticket=SCHEMA-1 # Implement ticket (local only)
|
|
9
|
+
* kosuke ship --ticket=BACKEND-2 --review # Implement with review
|
|
10
|
+
* kosuke ship --ticket=FRONTEND-1 --commit # Implement and commit to current branch
|
|
11
|
+
* kosuke ship --ticket=BACKEND-3 --pr # Implement and create PR (new branch)
|
|
12
|
+
* kosuke ship --ticket=SCHEMA-1 --tickets=path/to/tickets.json
|
|
13
|
+
*/
|
|
14
|
+
import type { ShipOptions, ShipResult } from '../types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Core ship logic (git-agnostic, reusable)
|
|
17
|
+
*/
|
|
18
|
+
export declare function shipCore(options: ShipOptions): Promise<ShipResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Main ship command
|
|
21
|
+
*/
|
|
22
|
+
export declare function shipCommand(options: ShipOptions): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=ship.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship.d.ts","sourceRoot":"","sources":["../../../kosuke/commands/ship.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAU,MAAM,aAAa,CAAC;AAuKnE;;GAEG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAwKxE;AA4BD;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAwHrE"}
|