@kite-copilot/cli 1.0.1 → 1.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/index.js +22 -101
- package/dist/remote-analyzer.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -204,136 +204,57 @@ program
|
|
|
204
204
|
.option("-v, --verbose", "Show verbose debug output")
|
|
205
205
|
.option("--timeout <seconds>", "Analysis timeout in seconds", "300")
|
|
206
206
|
.option("--no-prompt", "Skip confirmation prompt and save locally")
|
|
207
|
-
.option("--
|
|
208
|
-
.option("--remote", "Force use of remote analysis server")
|
|
209
|
-
.option("--api-endpoint <url>", "Remote analysis API endpoint (or set KITE_API_ENDPOINT)")
|
|
207
|
+
.option("--api-endpoint <url>", "Override default API endpoint (for development)")
|
|
210
208
|
.option("--ssh-key <path>", "SSH private key for remote server authentication")
|
|
211
209
|
.action(async (codebasePath, options) => {
|
|
212
210
|
const quiet = options.quiet || false;
|
|
213
211
|
const verbose = options.verbose || false;
|
|
214
212
|
const skipPrompt = options.prompt === false;
|
|
215
|
-
const forceLocal = options.local || false;
|
|
216
|
-
const forceRemote = options.remote || false;
|
|
217
213
|
const apiEndpoint = options.apiEndpoint || process.env.KITE_API_ENDPOINT;
|
|
218
214
|
const spinner = (0, ora_1.default)();
|
|
219
|
-
//
|
|
215
|
+
// Verify remote analysis is configured
|
|
220
216
|
const remoteAvailable = (0, remote_analyzer_js_1.isRemoteAnalysisAvailable)() || !!apiEndpoint;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
console.log(chalk_1.default.
|
|
224
|
-
console.log(chalk_1.default.gray(" Set KITE_API_ENDPOINT or deploy the infrastructure first.\n"));
|
|
217
|
+
if (!remoteAvailable) {
|
|
218
|
+
console.log(chalk_1.default.red("\n✗ Remote analysis not available.\n"));
|
|
219
|
+
console.log(chalk_1.default.gray(" Unable to connect to analysis server.\n"));
|
|
225
220
|
process.exit(1);
|
|
226
221
|
}
|
|
227
|
-
|
|
228
|
-
useRemote = true;
|
|
229
|
-
}
|
|
230
|
-
if (useRemote) {
|
|
231
|
-
// Remote analysis mode
|
|
232
|
-
if (!quiet) {
|
|
233
|
-
spinner.start("Preparing remote analysis...");
|
|
234
|
-
}
|
|
235
|
-
if (verbose) {
|
|
236
|
-
console.log(chalk_1.default.gray(`[DEBUG] Using remote analysis`));
|
|
237
|
-
console.log(chalk_1.default.gray(`[DEBUG] API endpoint: ${apiEndpoint || "(from env)"}`));
|
|
238
|
-
console.log(chalk_1.default.gray(`[DEBUG] Path: ${codebasePath}`));
|
|
239
|
-
console.log(chalk_1.default.gray(`[DEBUG] Timeout: ${options.timeout}s`));
|
|
240
|
-
}
|
|
241
|
-
try {
|
|
242
|
-
const result = await (0, remote_analyzer_js_1.analyzeWithRemoteClaude)(codebasePath, {
|
|
243
|
-
timeout: parseInt(options.timeout, 10),
|
|
244
|
-
verbose,
|
|
245
|
-
apiEndpoint,
|
|
246
|
-
sshKeyPath: options.sshKey,
|
|
247
|
-
}, (message) => {
|
|
248
|
-
if (!quiet) {
|
|
249
|
-
spinner.text = message;
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
if (!quiet) {
|
|
253
|
-
spinner.succeed("Remote analysis complete");
|
|
254
|
-
}
|
|
255
|
-
// Continue with result handling (shared with local)
|
|
256
|
-
await handleAnalysisResult(result, options, quiet, verbose, spinner, skipPrompt);
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
catch (error) {
|
|
260
|
-
if (!quiet)
|
|
261
|
-
spinner.fail("Remote analysis failed");
|
|
262
|
-
if (error instanceof remote_analyzer_js_1.EC2StartError) {
|
|
263
|
-
console.log(chalk_1.default.red(`\n✗ Failed to start remote server: ${error.message}\n`));
|
|
264
|
-
}
|
|
265
|
-
else if (error instanceof remote_analyzer_js_1.SSHTunnelError) {
|
|
266
|
-
console.log(chalk_1.default.red(`\n✗ SSH connection failed: ${error.message}\n`));
|
|
267
|
-
}
|
|
268
|
-
else if (error instanceof remote_analyzer_js_1.RemoteAnalyzerError) {
|
|
269
|
-
console.log(chalk_1.default.red(`\n✗ ${error.message}\n`));
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
console.log(chalk_1.default.red(`\n✗ ${error.message}\n`));
|
|
273
|
-
}
|
|
274
|
-
// Offer to fall back to local if not forced remote
|
|
275
|
-
if (!forceRemote) {
|
|
276
|
-
console.log(chalk_1.default.yellow("Falling back to local analysis...\n"));
|
|
277
|
-
useRemote = false;
|
|
278
|
-
// Continue to local analysis below
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
process.exit(1);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
// Local analysis mode (or fallback)
|
|
286
|
-
if (!quiet) {
|
|
287
|
-
spinner.start("Checking Claude CLI...");
|
|
288
|
-
}
|
|
289
|
-
const claudeAvailable = await (0, analyzer_js_1.checkClaudeAvailable)();
|
|
290
|
-
if (!claudeAvailable) {
|
|
291
|
-
if (!quiet)
|
|
292
|
-
spinner.fail("Claude CLI not found");
|
|
293
|
-
console.log(chalk_1.default.red("\n✗ Claude CLI is required for local analysis.\n"));
|
|
294
|
-
console.log(chalk_1.default.gray(" Install it with: npm install -g @anthropic-ai/claude-cli\n"));
|
|
295
|
-
console.log(chalk_1.default.gray(" Or configure remote analysis with KITE_API_ENDPOINT\n"));
|
|
296
|
-
process.exit(1);
|
|
297
|
-
}
|
|
298
|
-
if (!quiet)
|
|
299
|
-
spinner.succeed("Claude CLI found");
|
|
300
|
-
// Run analysis
|
|
222
|
+
// Remote analysis mode (only mode available)
|
|
301
223
|
if (!quiet) {
|
|
302
|
-
spinner.start(
|
|
224
|
+
spinner.start("Preparing remote analysis...");
|
|
303
225
|
}
|
|
304
226
|
if (verbose) {
|
|
305
|
-
console.log(chalk_1.default.gray(`[DEBUG] Using
|
|
227
|
+
console.log(chalk_1.default.gray(`[DEBUG] Using remote analysis`));
|
|
228
|
+
console.log(chalk_1.default.gray(`[DEBUG] API endpoint: ${apiEndpoint || "(from env)"}`));
|
|
306
229
|
console.log(chalk_1.default.gray(`[DEBUG] Path: ${codebasePath}`));
|
|
307
230
|
console.log(chalk_1.default.gray(`[DEBUG] Timeout: ${options.timeout}s`));
|
|
308
231
|
}
|
|
309
232
|
try {
|
|
310
|
-
const result = await (0,
|
|
233
|
+
const result = await (0, remote_analyzer_js_1.analyzeWithRemoteClaude)(codebasePath, {
|
|
311
234
|
timeout: parseInt(options.timeout, 10),
|
|
312
235
|
verbose,
|
|
236
|
+
apiEndpoint,
|
|
237
|
+
sshKeyPath: options.sshKey,
|
|
238
|
+
}, (message) => {
|
|
239
|
+
if (!quiet) {
|
|
240
|
+
spinner.text = message;
|
|
241
|
+
}
|
|
313
242
|
});
|
|
314
243
|
if (!quiet) {
|
|
315
|
-
spinner.succeed("
|
|
244
|
+
spinner.succeed("Remote analysis complete");
|
|
316
245
|
}
|
|
317
246
|
await handleAnalysisResult(result, options, quiet, verbose, spinner, skipPrompt);
|
|
318
247
|
}
|
|
319
248
|
catch (error) {
|
|
320
249
|
if (!quiet)
|
|
321
250
|
spinner.fail("Analysis failed");
|
|
322
|
-
if (error instanceof
|
|
323
|
-
console.log(chalk_1.default.red(`\n✗ ${error.message}\n`));
|
|
324
|
-
console.log(chalk_1.default.gray(" Install Claude CLI: npm install -g @anthropic-ai/claude-cli\n"));
|
|
251
|
+
if (error instanceof remote_analyzer_js_1.EC2StartError) {
|
|
252
|
+
console.log(chalk_1.default.red(`\n✗ Failed to start remote server: ${error.message}\n`));
|
|
325
253
|
}
|
|
326
|
-
else if (error instanceof
|
|
327
|
-
console.log(chalk_1.default.red(`\n✗ ${error.message}\n`));
|
|
328
|
-
console.log(chalk_1.default.gray(" Try increasing the timeout with --timeout\n"));
|
|
329
|
-
}
|
|
330
|
-
else if (error instanceof analyzer_js_1.ClaudeParseError) {
|
|
331
|
-
console.log(chalk_1.default.red(`\n✗ Failed to parse Claude response\n`));
|
|
332
|
-
if (verbose) {
|
|
333
|
-
console.log(chalk_1.default.gray(` ${error.message}\n`));
|
|
334
|
-
}
|
|
254
|
+
else if (error instanceof remote_analyzer_js_1.SSHTunnelError) {
|
|
255
|
+
console.log(chalk_1.default.red(`\n✗ SSH connection failed: ${error.message}\n`));
|
|
335
256
|
}
|
|
336
|
-
else if (error instanceof
|
|
257
|
+
else if (error instanceof remote_analyzer_js_1.RemoteAnalyzerError) {
|
|
337
258
|
console.log(chalk_1.default.red(`\n✗ ${error.message}\n`));
|
|
338
259
|
}
|
|
339
260
|
else {
|
package/dist/remote-analyzer.js
CHANGED
|
@@ -49,8 +49,8 @@ const path = __importStar(require("node:path"));
|
|
|
49
49
|
const os = __importStar(require("node:os"));
|
|
50
50
|
const net = __importStar(require("node:net"));
|
|
51
51
|
const analyzer_js_1 = require("./analyzer.js");
|
|
52
|
-
//
|
|
53
|
-
const DEFAULT_API_ENDPOINT = process.env.KITE_API_ENDPOINT || "";
|
|
52
|
+
// Production API Gateway endpoint (env var override for development only)
|
|
53
|
+
const DEFAULT_API_ENDPOINT = process.env.KITE_API_ENDPOINT || "https://shmxocfur1.execute-api.us-east-1.amazonaws.com";
|
|
54
54
|
class RemoteAnalyzerError extends Error {
|
|
55
55
|
constructor(message) {
|
|
56
56
|
super(message);
|
|
@@ -351,7 +351,7 @@ function cleanupSSHKey(privateKeyPath) {
|
|
|
351
351
|
async function analyzeWithRemoteClaude(codebasePath, options = {}, onProgress) {
|
|
352
352
|
const { timeout = 300, apiEndpoint = DEFAULT_API_ENDPOINT, } = options;
|
|
353
353
|
if (!apiEndpoint) {
|
|
354
|
-
throw new RemoteAnalyzerError("API endpoint not
|
|
354
|
+
throw new RemoteAnalyzerError("API endpoint not available. Please check your network connection or try again later.");
|
|
355
355
|
}
|
|
356
356
|
// Validate local path
|
|
357
357
|
(0, analyzer_js_1.validateCodebasePath)(codebasePath);
|