octocode-cli 1.5.1 → 1.5.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.
- package/README.md +28 -9
- package/out/chunks/chunk-375ZNU3A.js +317 -0
- package/out/chunks/{chunk-V64AXUWB.js → chunk-AYILFPX4.js} +1 -1
- package/out/chunks/chunk-BRHVQB64.js +10 -0
- package/out/chunks/{command-help-specs-JZXVSLZ5.js → chunk-KWJUBVXJ.js} +1 -1
- package/out/chunks/chunk-OMXWZJBJ.js +100 -0
- package/out/chunks/command-help-specs-RVJK6V6M.js +8 -0
- package/out/chunks/commands-JFDCC4Q7.js +8 -0
- package/out/chunks/{help-P7TCOYAJ.js → help-H3WGUJO7.js} +1 -1
- package/out/chunks/main-help-BUTDD4IR.js +10 -0
- package/out/chunks/{spinner-URV2OX6O.js → spinner-DXD4JQIU.js} +1 -1
- package/out/chunks/tool-command-L6PVHUNS.js +8 -0
- package/out/octocode-cli.js +1 -1
- package/package.json +2 -2
- package/skills/octocode-brainstorming/scripts/tavily-search.mjs +1 -10
- package/skills/octocode-chrome-devtools/scripts/cdp-runner.mjs +0 -2
- package/skills/octocode-chrome-devtools/scripts/cdp-sandbox.mjs +1 -5
- package/skills/octocode-chrome-devtools/scripts/cdp-template.mjs +1 -10
- package/skills/octocode-chrome-devtools/scripts/open-browser.mjs +0 -3
- package/skills/octocode-chrome-devtools/scripts/sourcemap-resolver.mjs +1 -4
- package/skills/octocode-chrome-devtools/scripts/undercover.mjs +0 -2
- package/skills/octocode-engineer/SKILL.md +7 -33
- package/skills/octocode-engineer/references/cli-reference.md +5 -11
- package/skills/octocode-engineer/references/externals.md +0 -4
- package/skills/octocode-engineer/references/quality-indicators.md +10 -50
- package/skills/octocode-engineer/references/tool-workflows.md +10 -13
- package/skills/octocode-engineer/src/analysis/dependency-summary.test.ts +2 -2
- package/skills/octocode-engineer/src/ast/metrics.test.ts +2 -2
- package/skills/octocode-engineer/src/ast/search-main.ts +2 -15
- package/skills/octocode-engineer/src/ast/search.ts +1 -7
- package/skills/octocode-engineer/src/ast/tree-sitter.test.ts +4 -4
- package/skills/octocode-engineer/src/ast/tree-sitter.ts +2 -2
- package/skills/octocode-engineer/src/collectors/chains.ts +3 -10
- package/skills/octocode-engineer/src/collectors/prototype-pollution.ts +3 -3
- package/skills/octocode-engineer/src/collectors/security.ts +3 -3
- package/skills/octocode-engineer/src/common/ensure-deps.ts +3 -20
- package/skills/octocode-engineer/src/detectors/code-quality.ts +0 -1
- package/skills/octocode-engineer/src/index.test.ts +1 -1
- package/skills/octocode-engineer/src/index.ts +1 -11
- package/skills/octocode-engineer/src/pipeline/affected.ts +2 -7
- package/skills/octocode-engineer/src/pipeline/baseline.ts +2 -8
- package/skills/octocode-engineer/src/pipeline/cache.ts +2 -2
- package/skills/octocode-engineer/src/pipeline/config-loader.test.ts +1 -2
- package/skills/octocode-engineer/src/pipeline/config-loader.ts +0 -9
- package/skills/octocode-engineer/src/pipeline/create-options.ts +2 -15
- package/skills/octocode-engineer/src/pipeline/reporters.ts +2 -12
- package/skills/octocode-engineer/src/reporting/summary-md.test.ts +2 -2
- package/skills/octocode-engineer/src/run.ts +1 -7
- package/skills/octocode-engineer/src/types/constants.ts +0 -5
- package/skills/octocode-engineer/src/types/core.ts +0 -5
- package/skills/octocode-news/eslint.config.mjs +1 -6
- package/skills/octocode-news/src/rss-core.ts +2 -4
- package/skills/octocode-research/ecosystem.config.cjs +0 -31
- package/skills/octocode-research/package.json +1 -1
- package/skills/octocode-research/scripts/server.js +272 -230
- package/skills/octocode-research/src/__tests__/integration/circuitBreaker.test.ts +0 -24
- package/skills/octocode-research/src/__tests__/integration/routes.test.ts +0 -10
- package/skills/octocode-research/src/__tests__/integration/serverLifecycle.test.ts +5 -22
- package/skills/octocode-research/src/__tests__/integration/toolsRoutes.test.ts +0 -27
- package/skills/octocode-research/src/__tests__/unit/circuitBreaker.test.ts +0 -29
- package/skills/octocode-research/src/__tests__/unit/errorHandler.test.ts +1 -12
- package/skills/octocode-research/src/__tests__/unit/httpPreprocess.test.ts +1 -9
- package/skills/octocode-research/src/__tests__/unit/logger.test.ts +0 -7
- package/skills/octocode-research/src/__tests__/unit/queryParser.test.ts +1 -7
- package/skills/octocode-research/src/__tests__/unit/responseBuilder.test.ts +0 -11
- package/skills/octocode-research/src/__tests__/unit/retry.test.ts +1 -18
- package/skills/octocode-research/src/__tests__/unit/schemas.test.ts +2 -25
- package/skills/octocode-research/src/index.ts +0 -27
- package/skills/octocode-research/src/mcpCache.ts +3 -18
- package/skills/octocode-research/src/middleware/errorHandler.ts +1 -4
- package/skills/octocode-research/src/middleware/logger.ts +1 -6
- package/skills/octocode-research/src/middleware/queryParser.ts +3 -22
- package/skills/octocode-research/src/routes/github.ts +0 -11
- package/skills/octocode-research/src/routes/local.ts +0 -12
- package/skills/octocode-research/src/routes/lsp.ts +1 -10
- package/skills/octocode-research/src/routes/package.ts +0 -2
- package/skills/octocode-research/src/routes/prompts.ts +2 -32
- package/skills/octocode-research/src/routes/tools.ts +12 -177
- package/skills/octocode-research/src/server-init.ts +0 -32
- package/skills/octocode-research/src/server.ts +8 -37
- package/skills/octocode-research/src/types/errorGuards.ts +0 -15
- package/skills/octocode-research/src/types/guards.ts +6 -27
- package/skills/octocode-research/src/types/mcp.ts +1 -8
- package/skills/octocode-research/src/types/responses.ts +0 -15
- package/skills/octocode-research/src/utils/asyncTimeout.ts +1 -63
- package/skills/octocode-research/src/utils/circuitBreaker.ts +43 -166
- package/skills/octocode-research/src/utils/colors.ts +3 -17
- package/skills/octocode-research/src/utils/errorQueue.ts +6 -28
- package/skills/octocode-research/src/utils/logger.ts +11 -93
- package/skills/octocode-research/src/utils/resilience.ts +22 -77
- package/skills/octocode-research/src/utils/responseBuilder.ts +26 -78
- package/skills/octocode-research/src/utils/responseFactory.ts +0 -7
- package/skills/octocode-research/src/utils/responseParser.ts +11 -59
- package/skills/octocode-research/src/utils/retry.ts +12 -75
- package/skills/octocode-research/src/utils/routeFactory.ts +10 -61
- package/skills/octocode-research/src/utils/url.ts +0 -5
- package/skills/octocode-research/src/validation/httpPreprocess.ts +15 -61
- package/skills/octocode-research/src/validation/schemas.ts +14 -101
- package/skills/octocode-research/src/validation/toolCallSchema.ts +5 -65
- package/skills/octocode-research/tsdown.config.ts +2 -7
- package/skills/octocode-search-skill/SKILL.md +9 -2
- package/skills/octocode-search-skill/references/discovery-surfaces.md +2 -1
- package/skills/octocode-slides/scripts/navbridge.js +1 -14
- package/skills/octocode-slides/scripts/presenter.js +2 -61
- package/skills/octocode-stats/scripts/build_dashboard.mjs +1 -19
- package/out/chunks/chunk-7476PETK.js +0 -309
- package/out/chunks/chunk-OQBJTZWK.js +0 -60
- package/out/chunks/chunk-UCZCF3BQ.js +0 -9
- package/out/chunks/commands-XBFPLHSQ.js +0 -8
- package/out/chunks/main-help-ULF5PAQY.js +0 -10
- package/out/chunks/tool-command-M6VA7P2F.js +0 -8
- package/skills/octocode-research/AGENTS.md +0 -349
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for HTTP-compatible Zod schemas.
|
|
3
|
-
*
|
|
4
|
-
* Tests the composed schemas in validation/schemas.ts:
|
|
5
|
-
* - Preprocessing transforms (string → number/boolean/array)
|
|
6
|
-
* - Alias mappings (context → contextLines, maxResults → limit)
|
|
7
|
-
* - Research defaults injection (id, mainResearchGoal, etc.)
|
|
8
|
-
* - Required field validation
|
|
9
|
-
* - Refinement checks
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
1
|
import { describe, it, expect } from 'vitest';
|
|
13
2
|
import {
|
|
14
3
|
localSearchSchema,
|
|
@@ -26,9 +15,6 @@ import {
|
|
|
26
15
|
packageSearchSchema,
|
|
27
16
|
} from '../../validation/schemas.js';
|
|
28
17
|
|
|
29
|
-
// =============================================================================
|
|
30
|
-
// Local Schemas
|
|
31
|
-
// =============================================================================
|
|
32
18
|
|
|
33
19
|
describe('localSearchSchema', () => {
|
|
34
20
|
it('parses minimal valid input', () => {
|
|
@@ -253,9 +239,6 @@ describe('localStructureSchema', () => {
|
|
|
253
239
|
});
|
|
254
240
|
});
|
|
255
241
|
|
|
256
|
-
// =============================================================================
|
|
257
|
-
// LSP Schemas
|
|
258
|
-
// =============================================================================
|
|
259
242
|
|
|
260
243
|
describe('lspDefinitionSchema', () => {
|
|
261
244
|
it('parses valid input with string numbers', () => {
|
|
@@ -267,8 +250,8 @@ describe('lspDefinitionSchema', () => {
|
|
|
267
250
|
expect(result.success).toBe(true);
|
|
268
251
|
if (result.success) {
|
|
269
252
|
expect(result.data.lineHint).toBe(42);
|
|
270
|
-
expect(result.data.contextLines).toBe(5);
|
|
271
|
-
expect(result.data.orderHint).toBe(0);
|
|
253
|
+
expect(result.data.contextLines).toBe(5);
|
|
254
|
+
expect(result.data.orderHint).toBe(0);
|
|
272
255
|
}
|
|
273
256
|
});
|
|
274
257
|
|
|
@@ -369,9 +352,6 @@ describe('lspCallsSchema', () => {
|
|
|
369
352
|
});
|
|
370
353
|
});
|
|
371
354
|
|
|
372
|
-
// =============================================================================
|
|
373
|
-
// GitHub Schemas
|
|
374
|
-
// =============================================================================
|
|
375
355
|
|
|
376
356
|
describe('githubSearchSchema', () => {
|
|
377
357
|
it('parses comma-separated keywords', () => {
|
|
@@ -469,9 +449,6 @@ describe('githubPRsSchema', () => {
|
|
|
469
449
|
});
|
|
470
450
|
});
|
|
471
451
|
|
|
472
|
-
// =============================================================================
|
|
473
|
-
// Package Schema
|
|
474
|
-
// =============================================================================
|
|
475
452
|
|
|
476
453
|
describe('packageSearchSchema', () => {
|
|
477
454
|
it('parses minimal input with defaults', () => {
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Octocode Research Skill
|
|
3
|
-
*
|
|
4
|
-
* Re-exports octocode tools with skill-friendly names.
|
|
5
|
-
* Only exports symbols that are actually consumed within this package.
|
|
6
|
-
*
|
|
7
|
-
* For types or additional utilities, import directly from 'octocode-mcp/public'.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// GitHub Tools (Remote Repository Research)
|
|
12
|
-
// ============================================================================
|
|
13
1
|
|
|
14
2
|
export {
|
|
15
3
|
fetchMultipleGitHubFileContents as githubGetFileContent,
|
|
@@ -19,9 +7,6 @@ export {
|
|
|
19
7
|
exploreMultipleRepositoryStructures as githubViewRepoStructure,
|
|
20
8
|
} from 'octocode-mcp/public';
|
|
21
9
|
|
|
22
|
-
// ============================================================================
|
|
23
|
-
// Local Tools (Local Codebase Research)
|
|
24
|
-
// ============================================================================
|
|
25
10
|
|
|
26
11
|
export {
|
|
27
12
|
executeFetchContent as localGetFileContent,
|
|
@@ -30,9 +15,6 @@ export {
|
|
|
30
15
|
executeViewStructure as localViewStructure,
|
|
31
16
|
} from 'octocode-mcp/public';
|
|
32
17
|
|
|
33
|
-
// ============================================================================
|
|
34
|
-
// LSP Tools (Semantic Code Analysis)
|
|
35
|
-
// ============================================================================
|
|
36
18
|
|
|
37
19
|
export {
|
|
38
20
|
executeGotoDefinition as lspGotoDefinition,
|
|
@@ -40,21 +22,12 @@ export {
|
|
|
40
22
|
executeCallHierarchy as lspCallHierarchy,
|
|
41
23
|
} from 'octocode-mcp/public';
|
|
42
24
|
|
|
43
|
-
// ============================================================================
|
|
44
|
-
// Package Search Tools
|
|
45
|
-
// ============================================================================
|
|
46
25
|
|
|
47
26
|
export { searchPackages as packageSearch } from 'octocode-mcp/public';
|
|
48
27
|
|
|
49
|
-
// ============================================================================
|
|
50
|
-
// Token Management (for GitHub API authentication)
|
|
51
|
-
// ============================================================================
|
|
52
28
|
|
|
53
29
|
export { initializeProviders } from 'octocode-mcp/public';
|
|
54
30
|
|
|
55
|
-
// ============================================================================
|
|
56
|
-
// Session Management (for tracking usage and telemetry)
|
|
57
|
-
// ============================================================================
|
|
58
31
|
|
|
59
32
|
export {
|
|
60
33
|
initializeSession,
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Content Cache Module
|
|
3
|
-
*
|
|
4
|
-
* Loads mcpContent ONCE at server startup and provides cached access.
|
|
5
|
-
* Routes should use getMcpContent() instead of calling loadToolContent() on each request.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
1
|
import type { CompleteMetadata } from 'octocode-mcp/public';
|
|
9
2
|
import { initialize, loadToolContent } from 'octocode-mcp/public';
|
|
10
3
|
|
|
11
4
|
let mcpContent: CompleteMetadata | null = null;
|
|
12
5
|
let initPromise: Promise<CompleteMetadata> | null = null;
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
* Initialize mcpContent - call ONCE at server startup
|
|
16
|
-
* Safe to call multiple times (idempotent)
|
|
17
|
-
*/
|
|
7
|
+
|
|
18
8
|
export async function initializeMcpContent(): Promise<CompleteMetadata> {
|
|
19
9
|
if (mcpContent) return mcpContent;
|
|
20
10
|
|
|
@@ -30,10 +20,7 @@ export async function initializeMcpContent(): Promise<CompleteMetadata> {
|
|
|
30
20
|
return initPromise;
|
|
31
21
|
}
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
* Get cached mcpContent - use in routes
|
|
35
|
-
* Throws if not initialized (indicates server startup failed)
|
|
36
|
-
*/
|
|
23
|
+
|
|
37
24
|
export function getMcpContent(): CompleteMetadata {
|
|
38
25
|
if (!mcpContent) {
|
|
39
26
|
throw new Error('mcpContent not initialized. Call initializeMcpContent() at server startup.');
|
|
@@ -41,9 +28,7 @@ export function getMcpContent(): CompleteMetadata {
|
|
|
41
28
|
return mcpContent;
|
|
42
29
|
}
|
|
43
30
|
|
|
44
|
-
|
|
45
|
-
* Check if mcpContent is initialized (for health checks)
|
|
46
|
-
*/
|
|
31
|
+
|
|
47
32
|
export function isMcpInitialized(): boolean {
|
|
48
33
|
return mcpContent !== null;
|
|
49
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Request, Response, NextFunction } from 'express';
|
|
2
|
-
import type { z } from 'zod
|
|
2
|
+
import type { z } from 'zod';
|
|
3
3
|
import { logError, logWarn, sanitizeQueryParams } from '../utils/logger.js';
|
|
4
4
|
import { logSessionError } from '../index.js';
|
|
5
5
|
import { fireAndForgetWithTimeout } from '../utils/asyncTimeout.js';
|
|
@@ -21,7 +21,6 @@ export function errorHandler(
|
|
|
21
21
|
const statusCode = error.statusCode ?? 500;
|
|
22
22
|
const isValidationError = statusCode === 400;
|
|
23
23
|
|
|
24
|
-
// Log with appropriate level - now persisted to ~/.octocode/logs/errors.log
|
|
25
24
|
if (isValidationError) {
|
|
26
25
|
logWarn(`[VALIDATION] ${req.method} ${req.path}: ${error.message}`, {
|
|
27
26
|
path: req.path,
|
|
@@ -32,7 +31,6 @@ export function errorHandler(
|
|
|
32
31
|
logError(`[SERVER] ${req.method} ${req.path}: ${error.message}`, error);
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
// Log error to session telemetry
|
|
36
34
|
const toolName = extractToolName(req.path);
|
|
37
35
|
const errorCode = error.code ?? (isValidationError ? 'VALIDATION_ERROR' : 'INTERNAL_ERROR');
|
|
38
36
|
fireAndForgetWithTimeout(
|
|
@@ -56,7 +54,6 @@ export function errorHandler(
|
|
|
56
54
|
},
|
|
57
55
|
};
|
|
58
56
|
|
|
59
|
-
// Include validation details for 400 errors
|
|
60
57
|
if (isValidationError && error.details) {
|
|
61
58
|
response.error.details = error.details;
|
|
62
59
|
}
|
|
@@ -4,10 +4,7 @@ import { logToolCall, sanitizeQueryParams } from '../utils/logger.js';
|
|
|
4
4
|
import { resultLog, errorLog } from '../utils/colors.js';
|
|
5
5
|
import { extractToolName } from '../utils/url.js';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
* Generate or retrieve request ID for log correlation.
|
|
9
|
-
* Uses X-Request-ID header if provided, otherwise generates a new UUID.
|
|
10
|
-
*/
|
|
7
|
+
|
|
11
8
|
function getRequestId(req: Request): string {
|
|
12
9
|
const existingId = req.headers['x-request-id'];
|
|
13
10
|
if (typeof existingId === 'string' && existingId.length > 0) {
|
|
@@ -24,7 +21,6 @@ export function requestLogger(
|
|
|
24
21
|
const start = Date.now();
|
|
25
22
|
const requestId = getRequestId(req);
|
|
26
23
|
|
|
27
|
-
// Set request ID on response header for correlation
|
|
28
24
|
res.setHeader('x-request-id', requestId);
|
|
29
25
|
|
|
30
26
|
res.on('finish', () => {
|
|
@@ -33,7 +29,6 @@ export function requestLogger(
|
|
|
33
29
|
const statusIcon = status >= 400 ? '❌' : '✅';
|
|
34
30
|
const success = status < 400;
|
|
35
31
|
|
|
36
|
-
// Results output in BLUE for success, RED for error
|
|
37
32
|
const resultMessage = `${statusIcon} ${req.method} ${req.path} ${status} ${duration}ms`;
|
|
38
33
|
|
|
39
34
|
if (success) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
2
3
|
|
|
3
|
-
/**
|
|
4
|
-
* Custom error class for validation failures.
|
|
5
|
-
* Carries HTTP status code for proper error responses.
|
|
6
|
-
*/
|
|
7
4
|
class ValidationError extends Error {
|
|
8
5
|
statusCode: number;
|
|
9
6
|
code: string;
|
|
@@ -18,25 +15,14 @@ class ValidationError extends Error {
|
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
/**
|
|
22
|
-
* Parse and validate query parameters using a Zod schema.
|
|
23
|
-
* Returns the validated data wrapped in an array (for tool compatibility).
|
|
24
|
-
*
|
|
25
|
-
* @param query - Express request query object
|
|
26
|
-
* @param schema - Zod schema for validation
|
|
27
|
-
* @returns Array containing the validated query object
|
|
28
|
-
* @throws ValidationError if validation fails
|
|
29
|
-
*/
|
|
30
18
|
export function parseAndValidate<T>(
|
|
31
19
|
query: Record<string, unknown>,
|
|
32
20
|
schema: z.ZodType<T>
|
|
33
21
|
): T[] {
|
|
34
|
-
// Check for JSON-encoded queries array (batch mode)
|
|
35
22
|
if (query.queries && typeof query.queries === 'string') {
|
|
36
23
|
try {
|
|
37
24
|
const parsed = JSON.parse(query.queries);
|
|
38
25
|
if (Array.isArray(parsed)) {
|
|
39
|
-
// Validate each item in the array
|
|
40
26
|
const validated = parsed.map((item, index) => {
|
|
41
27
|
const result = schema.safeParse(item);
|
|
42
28
|
if (!result.success) {
|
|
@@ -51,12 +37,9 @@ export function parseAndValidate<T>(
|
|
|
51
37
|
}
|
|
52
38
|
} catch (e) {
|
|
53
39
|
if (e instanceof ValidationError) throw e;
|
|
54
|
-
// JSON.parse failed - fall through to single query mode silently
|
|
55
|
-
// (avoid logging untrusted input in production)
|
|
56
40
|
}
|
|
57
41
|
}
|
|
58
42
|
|
|
59
|
-
// Parse flat query params (single query mode)
|
|
60
43
|
const cleanedQuery: Record<string, unknown> = {};
|
|
61
44
|
for (const [key, value] of Object.entries(query)) {
|
|
62
45
|
if (key !== 'queries') {
|
|
@@ -75,9 +58,7 @@ export function parseAndValidate<T>(
|
|
|
75
58
|
return [result.data];
|
|
76
59
|
}
|
|
77
60
|
|
|
78
|
-
|
|
79
|
-
* Format Zod error into a human-readable string.
|
|
80
|
-
*/
|
|
61
|
+
|
|
81
62
|
function formatZodError(error: z.ZodError): string {
|
|
82
63
|
return error.issues
|
|
83
64
|
.map((issue) => {
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GitHub routes using route factory pattern.
|
|
3
|
-
*
|
|
4
|
-
* @module routes/github
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import { Router } from 'express';
|
|
8
2
|
import {
|
|
9
3
|
githubSearchCode,
|
|
@@ -33,7 +27,6 @@ import { isObject, hasProperty, hasNumberProperty } from '../types/guards.js';
|
|
|
33
27
|
|
|
34
28
|
export const githubRoutes = Router();
|
|
35
29
|
|
|
36
|
-
// GET /githubSearchCode - Search code on GitHub
|
|
37
30
|
githubRoutes.get(
|
|
38
31
|
'/githubSearchCode',
|
|
39
32
|
createRouteHandler({
|
|
@@ -68,7 +61,6 @@ githubRoutes.get(
|
|
|
68
61
|
})
|
|
69
62
|
);
|
|
70
63
|
|
|
71
|
-
// GET /githubGetFileContent - Read file from GitHub
|
|
72
64
|
githubRoutes.get(
|
|
73
65
|
'/githubGetFileContent',
|
|
74
66
|
createRouteHandler({
|
|
@@ -80,7 +72,6 @@ githubRoutes.get(
|
|
|
80
72
|
})
|
|
81
73
|
);
|
|
82
74
|
|
|
83
|
-
// GET /githubSearchRepositories - Search repositories
|
|
84
75
|
githubRoutes.get(
|
|
85
76
|
'/githubSearchRepositories',
|
|
86
77
|
createRouteHandler({
|
|
@@ -116,7 +107,6 @@ githubRoutes.get(
|
|
|
116
107
|
})
|
|
117
108
|
);
|
|
118
109
|
|
|
119
|
-
// GET /githubViewRepoStructure - View repository structure
|
|
120
110
|
githubRoutes.get(
|
|
121
111
|
'/githubViewRepoStructure',
|
|
122
112
|
createRouteHandler({
|
|
@@ -148,7 +138,6 @@ githubRoutes.get(
|
|
|
148
138
|
})
|
|
149
139
|
);
|
|
150
140
|
|
|
151
|
-
// GET /githubSearchPullRequests - Search pull requests
|
|
152
141
|
githubRoutes.get(
|
|
153
142
|
'/githubSearchPullRequests',
|
|
154
143
|
createRouteHandler({
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Local filesystem routes using route factory pattern.
|
|
3
|
-
*
|
|
4
|
-
* @module routes/local
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import { Router } from 'express';
|
|
8
2
|
import {
|
|
9
3
|
localSearchCode,
|
|
@@ -32,7 +26,6 @@ import { isObject, hasNumberProperty } from '../types/guards.js';
|
|
|
32
26
|
|
|
33
27
|
export const localRoutes = Router();
|
|
34
28
|
|
|
35
|
-
// GET /localSearchCode - Search code with ripgrep
|
|
36
29
|
localRoutes.get(
|
|
37
30
|
'/localSearchCode',
|
|
38
31
|
createRouteHandler({
|
|
@@ -67,7 +60,6 @@ localRoutes.get(
|
|
|
67
60
|
})
|
|
68
61
|
);
|
|
69
62
|
|
|
70
|
-
// GET /localGetFileContent - Read file contents
|
|
71
63
|
localRoutes.get(
|
|
72
64
|
'/localGetFileContent',
|
|
73
65
|
createRouteHandler({
|
|
@@ -79,7 +71,6 @@ localRoutes.get(
|
|
|
79
71
|
})
|
|
80
72
|
);
|
|
81
73
|
|
|
82
|
-
// GET /localFindFiles - Find files by metadata
|
|
83
74
|
localRoutes.get(
|
|
84
75
|
'/localFindFiles',
|
|
85
76
|
createRouteHandler({
|
|
@@ -111,7 +102,6 @@ localRoutes.get(
|
|
|
111
102
|
})
|
|
112
103
|
);
|
|
113
104
|
|
|
114
|
-
// GET /localViewStructure - View directory structure
|
|
115
105
|
localRoutes.get(
|
|
116
106
|
'/localViewStructure',
|
|
117
107
|
createRouteHandler({
|
|
@@ -125,7 +115,6 @@ localRoutes.get(
|
|
|
125
115
|
const files: string[] = [];
|
|
126
116
|
const folders: string[] = [];
|
|
127
117
|
|
|
128
|
-
// Extract files and folders from output
|
|
129
118
|
const lines = structuredOutput.split('\n');
|
|
130
119
|
for (const line of lines) {
|
|
131
120
|
if (line.includes('[FILE]')) {
|
|
@@ -150,7 +139,6 @@ localRoutes.get(
|
|
|
150
139
|
})
|
|
151
140
|
);
|
|
152
141
|
|
|
153
|
-
// Helper: Format file size
|
|
154
142
|
function formatSize(bytes: number): string {
|
|
155
143
|
if (bytes < 1024) return `${bytes}B`;
|
|
156
144
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LSP routes using route factory pattern.
|
|
3
|
-
*
|
|
4
|
-
* @module routes/lsp
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import { Router } from 'express';
|
|
8
2
|
import {
|
|
9
3
|
lspGotoDefinition,
|
|
@@ -23,7 +17,6 @@ import { isObject, hasProperty, hasNumberProperty, hasStringProperty } from '../
|
|
|
23
17
|
|
|
24
18
|
export const lspRoutes = Router();
|
|
25
19
|
|
|
26
|
-
// GET /lspGotoDefinition - Go to symbol definition
|
|
27
20
|
lspRoutes.get(
|
|
28
21
|
'/lspGotoDefinition',
|
|
29
22
|
createRouteHandler({
|
|
@@ -46,7 +39,6 @@ lspRoutes.get(
|
|
|
46
39
|
})
|
|
47
40
|
);
|
|
48
41
|
|
|
49
|
-
// GET /lspFindReferences - Find all references to a symbol
|
|
50
42
|
lspRoutes.get(
|
|
51
43
|
'/lspFindReferences',
|
|
52
44
|
createRouteHandler({
|
|
@@ -69,7 +61,6 @@ lspRoutes.get(
|
|
|
69
61
|
})
|
|
70
62
|
);
|
|
71
63
|
|
|
72
|
-
// GET /lspCallHierarchy - Get call hierarchy (incoming/outgoing)
|
|
73
64
|
lspRoutes.get(
|
|
74
65
|
'/lspCallHierarchy',
|
|
75
66
|
createRouteHandler({
|
|
@@ -164,7 +155,7 @@ function extractCallHierarchyLocations(
|
|
|
164
155
|
const item = isObject(call.from) ? call.from : isObject(call.to) ? call.to : call;
|
|
165
156
|
const itemObj = isObject(item) ? item as Record<string, unknown> : {};
|
|
166
157
|
|
|
167
|
-
const lineFromRange = extractStartLine(itemObj) - 1;
|
|
158
|
+
const lineFromRange = extractStartLine(itemObj) - 1;
|
|
168
159
|
const lineFromItem = hasNumberProperty(itemObj, 'line') ? itemObj.line : 0;
|
|
169
160
|
|
|
170
161
|
return {
|
|
@@ -11,7 +11,6 @@ import { isObject, hasProperty, hasStringProperty } from '../types/guards.js';
|
|
|
11
11
|
|
|
12
12
|
export const packageRoutes = Router();
|
|
13
13
|
|
|
14
|
-
// GET /packageSearch - Search npm/pypi packages
|
|
15
14
|
packageRoutes.get(
|
|
16
15
|
'/packageSearch',
|
|
17
16
|
async (req: Request, res: Response, next: NextFunction) => {
|
|
@@ -27,7 +26,6 @@ packageRoutes.get(
|
|
|
27
26
|
);
|
|
28
27
|
const { data, isError, hints, research } = parseToolResponse(rawResult);
|
|
29
28
|
|
|
30
|
-
// Extract packages from result
|
|
31
29
|
const packages = extractPackages(data);
|
|
32
30
|
const query = queries[0] as Record<string, unknown>;
|
|
33
31
|
const registry = query.ecosystem === 'python' ? 'pypi' : 'npm';
|
|
@@ -6,7 +6,6 @@ import { checkReadiness } from '../middleware/readiness.js';
|
|
|
6
6
|
|
|
7
7
|
export const promptsRoutes = Router();
|
|
8
8
|
|
|
9
|
-
// Apply readiness check middleware to all prompts routes
|
|
10
9
|
promptsRoutes.use(checkReadiness);
|
|
11
10
|
|
|
12
11
|
declare const __PACKAGE_VERSION__: string;
|
|
@@ -24,28 +23,6 @@ interface PromptInfo {
|
|
|
24
23
|
arguments?: PromptArg[];
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
/**
|
|
28
|
-
* GET /prompts/list - List all prompts (MCP-compatible format)
|
|
29
|
-
*
|
|
30
|
-
* Returns prompt names, descriptions, and arguments following MCP protocol.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* GET /prompts/list
|
|
34
|
-
*
|
|
35
|
-
* Response:
|
|
36
|
-
* {
|
|
37
|
-
* "prompts": [
|
|
38
|
-
* {
|
|
39
|
-
* "name": "research",
|
|
40
|
-
* "description": "Start a code research session",
|
|
41
|
-
* "arguments": [
|
|
42
|
-
* { "name": "goal", "description": "The research goal", "required": true }
|
|
43
|
-
* ]
|
|
44
|
-
* }
|
|
45
|
-
* ],
|
|
46
|
-
* "_meta": { "totalCount": 5, "version": "2.2.0" }
|
|
47
|
-
* }
|
|
48
|
-
*/
|
|
49
26
|
promptsRoutes.get('/list', async (
|
|
50
27
|
_req: Request,
|
|
51
28
|
res: Response,
|
|
@@ -54,10 +31,8 @@ promptsRoutes.get('/list', async (
|
|
|
54
31
|
try {
|
|
55
32
|
const content = getMcpContent();
|
|
56
33
|
|
|
57
|
-
// Use Object.entries to get both key and prompt
|
|
58
|
-
// The key is what's used for lookup in /prompts/info/:promptName
|
|
59
34
|
const prompts: PromptInfo[] = Object.entries(content.prompts).map(([key, prompt]) => ({
|
|
60
|
-
name: key,
|
|
35
|
+
name: key,
|
|
61
36
|
description: prompt.description,
|
|
62
37
|
arguments: prompt.args?.map(arg => ({
|
|
63
38
|
name: arg.name,
|
|
@@ -80,11 +55,7 @@ promptsRoutes.get('/list', async (
|
|
|
80
55
|
}
|
|
81
56
|
});
|
|
82
57
|
|
|
83
|
-
|
|
84
|
-
* GET /prompts/info/:promptName - Get specific prompt details
|
|
85
|
-
*
|
|
86
|
-
* Returns detailed information about a specific prompt.
|
|
87
|
-
*/
|
|
58
|
+
|
|
88
59
|
promptsRoutes.get('/info/:promptName', async (
|
|
89
60
|
req: Request,
|
|
90
61
|
res: Response,
|
|
@@ -111,7 +82,6 @@ promptsRoutes.get('/info/:promptName', async (
|
|
|
111
82
|
return;
|
|
112
83
|
}
|
|
113
84
|
|
|
114
|
-
// Log prompt call for session telemetry
|
|
115
85
|
fireAndForgetWithTimeout(
|
|
116
86
|
() => logPromptCall(promptName),
|
|
117
87
|
5000,
|