@pkgseer/cli 0.5.1 → 0.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/dist/cli.js +134 -38
- package/dist/index.js +1 -1
- package/dist/shared/{chunk-x6hqsn93.js → chunk-dzjh13qr.js} +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
version
|
|
4
|
-
} from "./shared/chunk-
|
|
4
|
+
} from "./shared/chunk-dzjh13qr.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -2863,6 +2863,14 @@ function handleErrors(errors, json) {
|
|
|
2863
2863
|
const hint = CLI_HINTS[classifyError(combined)];
|
|
2864
2864
|
outputError(`${combined}${hint}`, json);
|
|
2865
2865
|
}
|
|
2866
|
+
function handleIndexingInProgress(data, json) {
|
|
2867
|
+
if (data.indexingStatus === "INDEXING") {
|
|
2868
|
+
const refInfo = data.indexingRef ? ` (ref: ${data.indexingRef})` : "";
|
|
2869
|
+
outputError(`Target is being indexed${refInfo}. Retry with a longer --wait value or try again later.`, json);
|
|
2870
|
+
return true;
|
|
2871
|
+
}
|
|
2872
|
+
return false;
|
|
2873
|
+
}
|
|
2866
2874
|
function formatNumber(num) {
|
|
2867
2875
|
if (num == null)
|
|
2868
2876
|
return "N/A";
|
|
@@ -3077,7 +3085,8 @@ function formatDependencyEntry(entry) {
|
|
|
3077
3085
|
// src/commands/code/callees.ts
|
|
3078
3086
|
function formatCalleesResult(data) {
|
|
3079
3087
|
const lines = [];
|
|
3080
|
-
|
|
3088
|
+
const rootLabel = data.root ? `${data.root.qualifiedPath ?? data.root.name} (ref:${data.root.symbolRef})` : "unknown";
|
|
3089
|
+
lines.push(`Callees of ${rootLabel}`);
|
|
3081
3090
|
lines.push(`${data.total} callee(s)${data.hasMore ? " (more available)" : ""}`);
|
|
3082
3091
|
if (data.externalPackages && data.externalPackages.length > 0) {
|
|
3083
3092
|
lines.push(`External packages: ${data.externalPackages.join(", ")}`);
|
|
@@ -3108,10 +3117,13 @@ async function codeCalleesAction(symbolArg, options, deps) {
|
|
|
3108
3117
|
waitTimeoutMs: parseWaitTimeout(options.wait)
|
|
3109
3118
|
});
|
|
3110
3119
|
handleErrors(result.errors, options.json ?? false);
|
|
3120
|
+
const data = result.data.symbolDependencies;
|
|
3121
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3122
|
+
return;
|
|
3111
3123
|
if (options.json) {
|
|
3112
|
-
output(
|
|
3124
|
+
output(data, true);
|
|
3113
3125
|
} else {
|
|
3114
|
-
console.log(formatCalleesResult(
|
|
3126
|
+
console.log(formatCalleesResult(data));
|
|
3115
3127
|
}
|
|
3116
3128
|
}
|
|
3117
3129
|
var CALLEES_DESCRIPTION = `Find what a symbol calls.
|
|
@@ -3134,7 +3146,8 @@ function registerCodeCalleesCommand(program) {
|
|
|
3134
3146
|
// src/commands/code/callers.ts
|
|
3135
3147
|
function formatCallersResult(data) {
|
|
3136
3148
|
const lines = [];
|
|
3137
|
-
|
|
3149
|
+
const targetLabel = data.target ? `${data.target.qualifiedPath ?? data.target.name} (ref:${data.target.symbolRef})` : "unknown";
|
|
3150
|
+
lines.push(`Callers of ${targetLabel}`);
|
|
3138
3151
|
lines.push(`${data.total} caller(s)${data.hasMore ? " (more available)" : ""}`);
|
|
3139
3152
|
lines.push("");
|
|
3140
3153
|
for (const dep of data.dependents) {
|
|
@@ -3155,10 +3168,13 @@ async function codeCallersAction(symbolArg, options, deps) {
|
|
|
3155
3168
|
waitTimeoutMs: parseWaitTimeout(options.wait)
|
|
3156
3169
|
});
|
|
3157
3170
|
handleErrors(result.errors, options.json ?? false);
|
|
3171
|
+
const data = result.data.symbolDependents;
|
|
3172
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3173
|
+
return;
|
|
3158
3174
|
if (options.json) {
|
|
3159
|
-
output(
|
|
3175
|
+
output(data, true);
|
|
3160
3176
|
} else {
|
|
3161
|
-
console.log(formatCallersResult(
|
|
3177
|
+
console.log(formatCallersResult(data));
|
|
3162
3178
|
}
|
|
3163
3179
|
}
|
|
3164
3180
|
var CALLERS_DESCRIPTION = `Find what calls a symbol.
|
|
@@ -3181,12 +3197,14 @@ function registerCodeCallersCommand(program) {
|
|
|
3181
3197
|
// src/commands/code/diff.ts
|
|
3182
3198
|
function formatDiffResult(data) {
|
|
3183
3199
|
const lines = [];
|
|
3184
|
-
lines.push(`Version diff: ${data.fromVersion} → ${data.toVersion}`);
|
|
3200
|
+
lines.push(`Version diff: ${data.fromVersion ?? "unknown"} → ${data.toVersion ?? "unknown"}`);
|
|
3185
3201
|
lines.push("");
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3202
|
+
if (data.summary) {
|
|
3203
|
+
const s = data.summary;
|
|
3204
|
+
lines.push("Summary:");
|
|
3205
|
+
lines.push(` Added: ${s.added} Removed: ${s.removed} Modified: ${s.modified} Moved: ${s.moved}`);
|
|
3206
|
+
lines.push(` Breaking: ${s.breaking} Behavior changes: ${s.behaviorChange}`);
|
|
3207
|
+
}
|
|
3190
3208
|
if (data.hasMore) {
|
|
3191
3209
|
lines.push(" (more changes available, increase --limit)");
|
|
3192
3210
|
}
|
|
@@ -3223,10 +3241,13 @@ async function codeDiffAction(packageArg, fromVersion, toVersion, options, deps)
|
|
|
3223
3241
|
waitTimeoutMs: parseWaitTimeout(options.wait)
|
|
3224
3242
|
});
|
|
3225
3243
|
handleErrors(result.errors, options.json ?? false);
|
|
3244
|
+
const data = result.data.versionDiff;
|
|
3245
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3246
|
+
return;
|
|
3226
3247
|
if (options.json) {
|
|
3227
|
-
output(
|
|
3248
|
+
output(data, true);
|
|
3228
3249
|
} else {
|
|
3229
|
-
console.log(formatDiffResult(
|
|
3250
|
+
console.log(formatDiffResult(data));
|
|
3230
3251
|
}
|
|
3231
3252
|
}
|
|
3232
3253
|
var DIFF_DESCRIPTION = `Compare symbols between two package versions.
|
|
@@ -3280,6 +3301,8 @@ async function codeFilesAction(packageArg, options, deps) {
|
|
|
3280
3301
|
});
|
|
3281
3302
|
handleErrors(result.errors, options.json ?? false);
|
|
3282
3303
|
const data = result.data.listRepoFiles;
|
|
3304
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3305
|
+
return;
|
|
3283
3306
|
if (options.json) {
|
|
3284
3307
|
output(data, true);
|
|
3285
3308
|
} else {
|
|
@@ -3341,6 +3364,8 @@ async function codeFindAction(packageArg, nameArg, options, deps) {
|
|
|
3341
3364
|
});
|
|
3342
3365
|
handleErrors(result.errors, options.json ?? false);
|
|
3343
3366
|
const data = result.data.findSymbol;
|
|
3367
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3368
|
+
return;
|
|
3344
3369
|
if (options.json) {
|
|
3345
3370
|
output(data, true);
|
|
3346
3371
|
} else {
|
|
@@ -3411,6 +3436,8 @@ async function codeGrepAction(packageArg, filePath, pattern, options, deps) {
|
|
|
3411
3436
|
});
|
|
3412
3437
|
handleErrors(result.errors, options.json ?? false);
|
|
3413
3438
|
const data = result.data.grepRepoFile;
|
|
3439
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3440
|
+
return;
|
|
3414
3441
|
if (options.json) {
|
|
3415
3442
|
output(data, true);
|
|
3416
3443
|
} else {
|
|
@@ -3493,10 +3520,13 @@ async function codeImportsAction(packageArg, options, deps) {
|
|
|
3493
3520
|
waitTimeoutMs: parseWaitTimeout(options.wait)
|
|
3494
3521
|
});
|
|
3495
3522
|
handleErrors(result.errors, options.json ?? false);
|
|
3523
|
+
const data = result.data.packageImports;
|
|
3524
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3525
|
+
return;
|
|
3496
3526
|
if (options.json) {
|
|
3497
|
-
output(
|
|
3527
|
+
output(data, true);
|
|
3498
3528
|
} else {
|
|
3499
|
-
console.log(formatImportsResult(
|
|
3529
|
+
console.log(formatImportsResult(data));
|
|
3500
3530
|
}
|
|
3501
3531
|
}
|
|
3502
3532
|
var IMPORTS_DESCRIPTION = `List import statements in a package.
|
|
@@ -3558,10 +3588,13 @@ async function codeListAction(packageArg, options, deps) {
|
|
|
3558
3588
|
waitTimeoutMs: parseWaitTimeout(options.wait)
|
|
3559
3589
|
});
|
|
3560
3590
|
handleErrors(result.errors, options.json ?? false);
|
|
3591
|
+
const data = result.data.listSymbols;
|
|
3592
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3593
|
+
return;
|
|
3561
3594
|
if (options.json) {
|
|
3562
|
-
output(
|
|
3595
|
+
output(data, true);
|
|
3563
3596
|
} else {
|
|
3564
|
-
console.log(formatListResult(
|
|
3597
|
+
console.log(formatListResult(data));
|
|
3565
3598
|
}
|
|
3566
3599
|
}
|
|
3567
3600
|
var LIST_DESCRIPTION = `Browse symbols in a package.
|
|
@@ -3585,8 +3618,8 @@ function registerCodeListCommand(program) {
|
|
|
3585
3618
|
// src/commands/code/path.ts
|
|
3586
3619
|
function formatPathResult(data) {
|
|
3587
3620
|
const lines = [];
|
|
3588
|
-
const fromName = data.fromSymbol.qualifiedPath ?? data.fromSymbol.name;
|
|
3589
|
-
const toName = data.toSymbol.qualifiedPath ?? data.toSymbol.name;
|
|
3621
|
+
const fromName = data.fromSymbol ? data.fromSymbol.qualifiedPath ?? data.fromSymbol.name : "unknown";
|
|
3622
|
+
const toName = data.toSymbol ? data.toSymbol.qualifiedPath ?? data.toSymbol.name : "unknown";
|
|
3590
3623
|
lines.push(`Call path: ${fromName} -> ${toName}`);
|
|
3591
3624
|
if (!data.pathFound) {
|
|
3592
3625
|
lines.push("No path found between these symbols.");
|
|
@@ -3619,10 +3652,13 @@ async function codePathAction(fromArg, toArg, options, deps) {
|
|
|
3619
3652
|
waitTimeoutMs: parseWaitTimeout(options.wait)
|
|
3620
3653
|
});
|
|
3621
3654
|
handleErrors(result.errors, options.json ?? false);
|
|
3655
|
+
const data = result.data.callPath;
|
|
3656
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3657
|
+
return;
|
|
3622
3658
|
if (options.json) {
|
|
3623
|
-
output(
|
|
3659
|
+
output(data, true);
|
|
3624
3660
|
} else {
|
|
3625
|
-
console.log(formatPathResult(
|
|
3661
|
+
console.log(formatPathResult(data));
|
|
3626
3662
|
}
|
|
3627
3663
|
}
|
|
3628
3664
|
var PATH_DESCRIPTION = `Find call path between two symbols.
|
|
@@ -3696,6 +3732,8 @@ async function codeSearchAction(packageArg, query, options, deps) {
|
|
|
3696
3732
|
});
|
|
3697
3733
|
handleErrors(result.errors, options.json ?? false);
|
|
3698
3734
|
const data = result.data.searchSymbols;
|
|
3735
|
+
if (handleIndexingInProgress(data, options.json ?? false))
|
|
3736
|
+
return;
|
|
3699
3737
|
if (options.json) {
|
|
3700
3738
|
output(data, true);
|
|
3701
3739
|
} else {
|
|
@@ -6845,7 +6883,7 @@ var schemas = {
|
|
|
6845
6883
|
packageName: z2.string().max(255).describe("Name of the package"),
|
|
6846
6884
|
version: z2.string().max(100).optional().describe("Specific version, e.g. '4.18.2' (defaults to latest)"),
|
|
6847
6885
|
navigationMode: z2.enum(["summary", "detailed"]).optional().describe("Response detail level. summary (default) returns core fields; detailed adds all optional fields."),
|
|
6848
|
-
waitTimeoutMs: z2.coerce.number().int().min(0).max(60000).optional().describe("Max milliseconds to wait for indexing (0-60000, default 10000).
|
|
6886
|
+
waitTimeoutMs: z2.coerce.number().int().min(0).max(60000).optional().describe("Max milliseconds to wait for repository indexing (0-60000, default 10000). " + "On first access, unindexed code is auto-indexed — small packages complete within the default 10s. " + "If indexing exceeds this timeout, the response includes an indexingRef — " + "poll progress with indexing_status(ref), then retry when status is INDEXED. " + "Set 0 to skip waiting."),
|
|
6849
6887
|
symbolReference: z2.object({
|
|
6850
6888
|
symbol_ref: z2.string().optional().describe("Compound symbol reference (registry:package:version:id) from find_symbol or list_symbols results. Self-contained — no additional fields needed."),
|
|
6851
6889
|
registry: z2.enum(["npm", "pypi", "hex", "crates", "nuget", "maven", "zig", "vcpkg"]).optional().describe("Package registry. For package-scoped lookup (with package_name + symbol_name)."),
|
|
@@ -6934,7 +6972,7 @@ function buildCodeTargetVars(resolved) {
|
|
|
6934
6972
|
}
|
|
6935
6973
|
var DEFAULT_WAIT_TIMEOUT_MS2 = 1e4;
|
|
6936
6974
|
var MCP_HINTS = {
|
|
6937
|
-
being_indexed: "Hint:
|
|
6975
|
+
being_indexed: "Hint: use indexing_status to poll progress, then retry when status is INDEXED.",
|
|
6938
6976
|
timeout: "Hint: this may be transient — retry the same query. If the issue persists, try simplifying the query."
|
|
6939
6977
|
};
|
|
6940
6978
|
function buildHintedMessage(operation, message) {
|
|
@@ -6964,7 +7002,7 @@ function buildHintedMessage(operation, message) {
|
|
|
6964
7002
|
}
|
|
6965
7003
|
var MCP_GRAPHQL_HINTS = {
|
|
6966
7004
|
not_found: "Hint: verify the package name, registry, or repository URL are correct.",
|
|
6967
|
-
being_indexed: "Hint:
|
|
7005
|
+
being_indexed: "Hint: use indexing_status to poll progress, then retry when status is INDEXED.",
|
|
6968
7006
|
timeout: "Hint: this may be transient — retry the same query. If the issue persists, try simplifying the query."
|
|
6969
7007
|
};
|
|
6970
7008
|
function getExtensionCode(errors) {
|
|
@@ -6987,7 +7025,7 @@ function getExtensionIndexingRef(errors) {
|
|
|
6987
7025
|
return;
|
|
6988
7026
|
}
|
|
6989
7027
|
var EXTENSION_CODE_HINTS = {
|
|
6990
|
-
PACKAGE_INDEXING: "Hint:
|
|
7028
|
+
PACKAGE_INDEXING: "Hint: use indexing_status to poll progress, then retry when status is INDEXED.",
|
|
6991
7029
|
NOT_FOUND: "Hint: verify the package name, registry, or repository URL are correct."
|
|
6992
7030
|
};
|
|
6993
7031
|
function handleGraphQLErrors(errors) {
|
|
@@ -7000,7 +7038,7 @@ function handleGraphQLErrors(errors) {
|
|
|
7000
7038
|
error: combined,
|
|
7001
7039
|
indexingStatus: "INDEXING",
|
|
7002
7040
|
indexingRef,
|
|
7003
|
-
message:
|
|
7041
|
+
message: `Target is being indexed. Poll with indexing_status(ref: "${indexingRef}"), then retry this query when status is INDEXED.`
|
|
7004
7042
|
}));
|
|
7005
7043
|
}
|
|
7006
7044
|
if (extensionCode === "PACKAGE_INDEXING") {
|
|
@@ -7020,6 +7058,22 @@ async function withErrorHandling(operation, fn) {
|
|
|
7020
7058
|
return errorResult(buildHintedMessage(operation, message));
|
|
7021
7059
|
}
|
|
7022
7060
|
}
|
|
7061
|
+
function handleIndexingStatus(data) {
|
|
7062
|
+
if (data.indexingStatus === "INDEXING") {
|
|
7063
|
+
const ref = data.indexingRef;
|
|
7064
|
+
const response = {
|
|
7065
|
+
indexingStatus: "INDEXING"
|
|
7066
|
+
};
|
|
7067
|
+
if (ref) {
|
|
7068
|
+
response.indexingRef = ref;
|
|
7069
|
+
response.message = `Target is being indexed. Poll with indexing_status(ref: "${ref}"), then retry this query when status is INDEXED.`;
|
|
7070
|
+
} else {
|
|
7071
|
+
response.message = "Target is being indexed. Retry this query in a few seconds, or with a longer wait_timeout_ms.";
|
|
7072
|
+
}
|
|
7073
|
+
return errorResult(JSON.stringify(response));
|
|
7074
|
+
}
|
|
7075
|
+
return null;
|
|
7076
|
+
}
|
|
7023
7077
|
function notFoundError(packageName, registry) {
|
|
7024
7078
|
return errorResult(`Package not found: ${packageName} in ${registry}. Verify the package name and registry are correct.`);
|
|
7025
7079
|
}
|
|
@@ -7056,7 +7110,11 @@ function createCallPathTool(pkgseerService) {
|
|
|
7056
7110
|
const graphqlError = handleGraphQLErrors(result.errors);
|
|
7057
7111
|
if (graphqlError)
|
|
7058
7112
|
return graphqlError;
|
|
7059
|
-
|
|
7113
|
+
const data = result.data.callPath;
|
|
7114
|
+
const indexingError = handleIndexingStatus(data);
|
|
7115
|
+
if (indexingError)
|
|
7116
|
+
return indexingError;
|
|
7117
|
+
return textResult(JSON.stringify(data, null, 2));
|
|
7060
7118
|
});
|
|
7061
7119
|
}
|
|
7062
7120
|
};
|
|
@@ -7171,6 +7229,9 @@ function createFindSymbolTool(pkgseerService) {
|
|
|
7171
7229
|
if (graphqlError)
|
|
7172
7230
|
return graphqlError;
|
|
7173
7231
|
const data = result.data.findSymbol;
|
|
7232
|
+
const indexingError = handleIndexingStatus(data);
|
|
7233
|
+
if (indexingError)
|
|
7234
|
+
return indexingError;
|
|
7174
7235
|
if (data.symbols.length === 0 && data.diagnostics?.hint) {
|
|
7175
7236
|
return textResult(JSON.stringify({ ...data, _hint: data.diagnostics.hint }, null, 2));
|
|
7176
7237
|
}
|
|
@@ -7213,6 +7274,9 @@ function createGrepFileTool(pkgseerService) {
|
|
|
7213
7274
|
if (graphqlError)
|
|
7214
7275
|
return graphqlError;
|
|
7215
7276
|
const data = result.data.grepRepoFile;
|
|
7277
|
+
const indexingError = handleIndexingStatus(data);
|
|
7278
|
+
if (indexingError)
|
|
7279
|
+
return indexingError;
|
|
7216
7280
|
if (data.matches.length === 0 && data.diagnostics?.hint) {
|
|
7217
7281
|
return textResult(JSON.stringify({ ...data, _hint: data.diagnostics.hint }, null, 2));
|
|
7218
7282
|
}
|
|
@@ -7256,11 +7320,11 @@ function createIndexingStatusTool(pkgseerService) {
|
|
|
7256
7320
|
response.elapsedMs = progress.elapsedMs;
|
|
7257
7321
|
}
|
|
7258
7322
|
if (progress.status === "INDEXED") {
|
|
7259
|
-
response.message = "Indexing
|
|
7323
|
+
response.message = "Indexing complete. Retry your original query to get results.";
|
|
7260
7324
|
} else if (progress.status === "INDEXING" || progress.status === "PENDING") {
|
|
7261
|
-
response.message =
|
|
7325
|
+
response.message = `Still indexing. Call indexing_status(ref: "${ref}") again to check progress.`;
|
|
7262
7326
|
} else if (progress.status === "FAILED") {
|
|
7263
|
-
response.message = "Indexing failed.";
|
|
7327
|
+
response.message = "Indexing failed. The package may not exist or the repository may be inaccessible.";
|
|
7264
7328
|
} else if (progress.status === "NOT_FOUND") {
|
|
7265
7329
|
response.message = "Indexing reference not found. The ref may be invalid or the session may have expired.";
|
|
7266
7330
|
}
|
|
@@ -7301,6 +7365,9 @@ function createListFilesTool(pkgseerService) {
|
|
|
7301
7365
|
if (graphqlError)
|
|
7302
7366
|
return graphqlError;
|
|
7303
7367
|
const data = result.data.listRepoFiles;
|
|
7368
|
+
const indexingError = handleIndexingStatus(data);
|
|
7369
|
+
if (indexingError)
|
|
7370
|
+
return indexingError;
|
|
7304
7371
|
if (data.files.length === 0 && data.diagnostics?.hint) {
|
|
7305
7372
|
return textResult(JSON.stringify({ ...data, _hint: data.diagnostics.hint }, null, 2));
|
|
7306
7373
|
}
|
|
@@ -7344,7 +7411,11 @@ function createListImportsTool(pkgseerService) {
|
|
|
7344
7411
|
const graphqlError = handleGraphQLErrors(result.errors);
|
|
7345
7412
|
if (graphqlError)
|
|
7346
7413
|
return graphqlError;
|
|
7347
|
-
|
|
7414
|
+
const data = result.data.packageImports;
|
|
7415
|
+
const indexingError = handleIndexingStatus(data);
|
|
7416
|
+
if (indexingError)
|
|
7417
|
+
return indexingError;
|
|
7418
|
+
return textResult(JSON.stringify(data, null, 2));
|
|
7348
7419
|
});
|
|
7349
7420
|
}
|
|
7350
7421
|
};
|
|
@@ -7427,7 +7498,11 @@ function createListSymbolsTool(pkgseerService) {
|
|
|
7427
7498
|
const graphqlError = handleGraphQLErrors(result.errors);
|
|
7428
7499
|
if (graphqlError)
|
|
7429
7500
|
return graphqlError;
|
|
7430
|
-
|
|
7501
|
+
const data = result.data.listSymbols;
|
|
7502
|
+
const indexingError = handleIndexingStatus(data);
|
|
7503
|
+
if (indexingError)
|
|
7504
|
+
return indexingError;
|
|
7505
|
+
return textResult(JSON.stringify(data, null, 2));
|
|
7431
7506
|
});
|
|
7432
7507
|
}
|
|
7433
7508
|
};
|
|
@@ -7666,10 +7741,16 @@ function createReadFileTool(pkgseerService) {
|
|
|
7666
7741
|
const graphqlError = handleGraphQLErrors(result.errors);
|
|
7667
7742
|
if (graphqlError)
|
|
7668
7743
|
return graphqlError;
|
|
7669
|
-
|
|
7744
|
+
const codeContext = result.data?.fetchCodeContext;
|
|
7745
|
+
if (codeContext) {
|
|
7746
|
+
const indexingError = handleIndexingStatus(codeContext);
|
|
7747
|
+
if (indexingError)
|
|
7748
|
+
return indexingError;
|
|
7749
|
+
}
|
|
7750
|
+
if (!codeContext) {
|
|
7670
7751
|
return errorResult(`File not found: ${args.file_path}. ` + "Check that the file path and target are correct. " + "Use list_files to discover available files.");
|
|
7671
7752
|
}
|
|
7672
|
-
return textResult(JSON.stringify(
|
|
7753
|
+
return textResult(JSON.stringify(codeContext, null, 2));
|
|
7673
7754
|
});
|
|
7674
7755
|
}
|
|
7675
7756
|
};
|
|
@@ -7986,6 +8067,9 @@ function createSearchSymbolsTool(pkgseerService) {
|
|
|
7986
8067
|
if (graphqlError)
|
|
7987
8068
|
return graphqlError;
|
|
7988
8069
|
const data = result.data.searchSymbols;
|
|
8070
|
+
const indexingError = handleIndexingStatus(data);
|
|
8071
|
+
if (indexingError)
|
|
8072
|
+
return indexingError;
|
|
7989
8073
|
const extra = {};
|
|
7990
8074
|
if (data.results.length === 0 && data.diagnostics?.hint) {
|
|
7991
8075
|
extra._hint = data.diagnostics.hint;
|
|
@@ -8035,7 +8119,11 @@ function createSymbolCalleesTool(pkgseerService) {
|
|
|
8035
8119
|
const graphqlError = handleGraphQLErrors(result.errors);
|
|
8036
8120
|
if (graphqlError)
|
|
8037
8121
|
return graphqlError;
|
|
8038
|
-
|
|
8122
|
+
const data = result.data.symbolDependencies;
|
|
8123
|
+
const indexingError = handleIndexingStatus(data);
|
|
8124
|
+
if (indexingError)
|
|
8125
|
+
return indexingError;
|
|
8126
|
+
return textResult(JSON.stringify(data, null, 2));
|
|
8039
8127
|
});
|
|
8040
8128
|
}
|
|
8041
8129
|
};
|
|
@@ -8072,7 +8160,11 @@ function createSymbolCallersTool(pkgseerService) {
|
|
|
8072
8160
|
const graphqlError = handleGraphQLErrors(result.errors);
|
|
8073
8161
|
if (graphqlError)
|
|
8074
8162
|
return graphqlError;
|
|
8075
|
-
|
|
8163
|
+
const data = result.data.symbolDependents;
|
|
8164
|
+
const indexingError = handleIndexingStatus(data);
|
|
8165
|
+
if (indexingError)
|
|
8166
|
+
return indexingError;
|
|
8167
|
+
return textResult(JSON.stringify(data, null, 2));
|
|
8076
8168
|
});
|
|
8077
8169
|
}
|
|
8078
8170
|
};
|
|
@@ -8176,7 +8268,11 @@ function createVersionDiffTool(pkgseerService) {
|
|
|
8176
8268
|
const graphqlError = handleGraphQLErrors(result.errors);
|
|
8177
8269
|
if (graphqlError)
|
|
8178
8270
|
return graphqlError;
|
|
8179
|
-
|
|
8271
|
+
const data = result.data.versionDiff;
|
|
8272
|
+
const indexingError = handleIndexingStatus(data);
|
|
8273
|
+
if (indexingError)
|
|
8274
|
+
return indexingError;
|
|
8275
|
+
return textResult(JSON.stringify(data, null, 2));
|
|
8180
8276
|
});
|
|
8181
8277
|
}
|
|
8182
8278
|
};
|
package/dist/index.js
CHANGED