@pkgseer/cli 0.5.1 → 0.5.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/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  version
4
- } from "./shared/chunk-x6hqsn93.js";
4
+ } from "./shared/chunk-a0vv3x03.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
- lines.push(`Callees of ${data.root.qualifiedPath ?? data.root.name} (ref:${data.root.symbolRef})`);
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(result.data.symbolDependencies, true);
3124
+ output(data, true);
3113
3125
  } else {
3114
- console.log(formatCalleesResult(result.data.symbolDependencies));
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
- lines.push(`Callers of ${data.target.qualifiedPath ?? data.target.name} (ref:${data.target.symbolRef})`);
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(result.data.symbolDependents, true);
3175
+ output(data, true);
3160
3176
  } else {
3161
- console.log(formatCallersResult(result.data.symbolDependents));
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
- const s = data.summary;
3187
- lines.push("Summary:");
3188
- lines.push(` Added: ${s.added} Removed: ${s.removed} Modified: ${s.modified} Moved: ${s.moved}`);
3189
- lines.push(` Breaking: ${s.breaking} Behavior changes: ${s.behaviorChange}`);
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(result.data.versionDiff, true);
3248
+ output(data, true);
3228
3249
  } else {
3229
- console.log(formatDiffResult(result.data.versionDiff));
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(result.data.packageImports, true);
3527
+ output(data, true);
3498
3528
  } else {
3499
- console.log(formatImportsResult(result.data.packageImports));
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(result.data.listSymbols, true);
3595
+ output(data, true);
3563
3596
  } else {
3564
- console.log(formatListResult(result.data.listSymbols));
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(result.data.callPath, true);
3659
+ output(data, true);
3624
3660
  } else {
3625
- console.log(formatPathResult(result.data.callPath));
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 {
@@ -7020,6 +7058,19 @@ 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 response = {
7064
+ indexingStatus: "INDEXING",
7065
+ message: "Target is being indexed. Use indexing_status tool with this indexingRef to poll progress, " + "or retry the original query after indexing completes."
7066
+ };
7067
+ if (data.indexingRef) {
7068
+ response.indexingRef = data.indexingRef;
7069
+ }
7070
+ return errorResult(JSON.stringify(response));
7071
+ }
7072
+ return null;
7073
+ }
7023
7074
  function notFoundError(packageName, registry) {
7024
7075
  return errorResult(`Package not found: ${packageName} in ${registry}. Verify the package name and registry are correct.`);
7025
7076
  }
@@ -7056,7 +7107,11 @@ function createCallPathTool(pkgseerService) {
7056
7107
  const graphqlError = handleGraphQLErrors(result.errors);
7057
7108
  if (graphqlError)
7058
7109
  return graphqlError;
7059
- return textResult(JSON.stringify(result.data.callPath, null, 2));
7110
+ const data = result.data.callPath;
7111
+ const indexingError = handleIndexingStatus(data);
7112
+ if (indexingError)
7113
+ return indexingError;
7114
+ return textResult(JSON.stringify(data, null, 2));
7060
7115
  });
7061
7116
  }
7062
7117
  };
@@ -7171,6 +7226,9 @@ function createFindSymbolTool(pkgseerService) {
7171
7226
  if (graphqlError)
7172
7227
  return graphqlError;
7173
7228
  const data = result.data.findSymbol;
7229
+ const indexingError = handleIndexingStatus(data);
7230
+ if (indexingError)
7231
+ return indexingError;
7174
7232
  if (data.symbols.length === 0 && data.diagnostics?.hint) {
7175
7233
  return textResult(JSON.stringify({ ...data, _hint: data.diagnostics.hint }, null, 2));
7176
7234
  }
@@ -7213,6 +7271,9 @@ function createGrepFileTool(pkgseerService) {
7213
7271
  if (graphqlError)
7214
7272
  return graphqlError;
7215
7273
  const data = result.data.grepRepoFile;
7274
+ const indexingError = handleIndexingStatus(data);
7275
+ if (indexingError)
7276
+ return indexingError;
7216
7277
  if (data.matches.length === 0 && data.diagnostics?.hint) {
7217
7278
  return textResult(JSON.stringify({ ...data, _hint: data.diagnostics.hint }, null, 2));
7218
7279
  }
@@ -7301,6 +7362,9 @@ function createListFilesTool(pkgseerService) {
7301
7362
  if (graphqlError)
7302
7363
  return graphqlError;
7303
7364
  const data = result.data.listRepoFiles;
7365
+ const indexingError = handleIndexingStatus(data);
7366
+ if (indexingError)
7367
+ return indexingError;
7304
7368
  if (data.files.length === 0 && data.diagnostics?.hint) {
7305
7369
  return textResult(JSON.stringify({ ...data, _hint: data.diagnostics.hint }, null, 2));
7306
7370
  }
@@ -7344,7 +7408,11 @@ function createListImportsTool(pkgseerService) {
7344
7408
  const graphqlError = handleGraphQLErrors(result.errors);
7345
7409
  if (graphqlError)
7346
7410
  return graphqlError;
7347
- return textResult(JSON.stringify(result.data.packageImports, null, 2));
7411
+ const data = result.data.packageImports;
7412
+ const indexingError = handleIndexingStatus(data);
7413
+ if (indexingError)
7414
+ return indexingError;
7415
+ return textResult(JSON.stringify(data, null, 2));
7348
7416
  });
7349
7417
  }
7350
7418
  };
@@ -7427,7 +7495,11 @@ function createListSymbolsTool(pkgseerService) {
7427
7495
  const graphqlError = handleGraphQLErrors(result.errors);
7428
7496
  if (graphqlError)
7429
7497
  return graphqlError;
7430
- return textResult(JSON.stringify(result.data.listSymbols, null, 2));
7498
+ const data = result.data.listSymbols;
7499
+ const indexingError = handleIndexingStatus(data);
7500
+ if (indexingError)
7501
+ return indexingError;
7502
+ return textResult(JSON.stringify(data, null, 2));
7431
7503
  });
7432
7504
  }
7433
7505
  };
@@ -7666,10 +7738,16 @@ function createReadFileTool(pkgseerService) {
7666
7738
  const graphqlError = handleGraphQLErrors(result.errors);
7667
7739
  if (graphqlError)
7668
7740
  return graphqlError;
7669
- if (!result.data?.fetchCodeContext) {
7741
+ const codeContext = result.data?.fetchCodeContext;
7742
+ if (codeContext) {
7743
+ const indexingError = handleIndexingStatus(codeContext);
7744
+ if (indexingError)
7745
+ return indexingError;
7746
+ }
7747
+ if (!codeContext) {
7670
7748
  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
7749
  }
7672
- return textResult(JSON.stringify(result.data.fetchCodeContext, null, 2));
7750
+ return textResult(JSON.stringify(codeContext, null, 2));
7673
7751
  });
7674
7752
  }
7675
7753
  };
@@ -7986,6 +8064,9 @@ function createSearchSymbolsTool(pkgseerService) {
7986
8064
  if (graphqlError)
7987
8065
  return graphqlError;
7988
8066
  const data = result.data.searchSymbols;
8067
+ const indexingError = handleIndexingStatus(data);
8068
+ if (indexingError)
8069
+ return indexingError;
7989
8070
  const extra = {};
7990
8071
  if (data.results.length === 0 && data.diagnostics?.hint) {
7991
8072
  extra._hint = data.diagnostics.hint;
@@ -8035,7 +8116,11 @@ function createSymbolCalleesTool(pkgseerService) {
8035
8116
  const graphqlError = handleGraphQLErrors(result.errors);
8036
8117
  if (graphqlError)
8037
8118
  return graphqlError;
8038
- return textResult(JSON.stringify(result.data.symbolDependencies, null, 2));
8119
+ const data = result.data.symbolDependencies;
8120
+ const indexingError = handleIndexingStatus(data);
8121
+ if (indexingError)
8122
+ return indexingError;
8123
+ return textResult(JSON.stringify(data, null, 2));
8039
8124
  });
8040
8125
  }
8041
8126
  };
@@ -8072,7 +8157,11 @@ function createSymbolCallersTool(pkgseerService) {
8072
8157
  const graphqlError = handleGraphQLErrors(result.errors);
8073
8158
  if (graphqlError)
8074
8159
  return graphqlError;
8075
- return textResult(JSON.stringify(result.data.symbolDependents, null, 2));
8160
+ const data = result.data.symbolDependents;
8161
+ const indexingError = handleIndexingStatus(data);
8162
+ if (indexingError)
8163
+ return indexingError;
8164
+ return textResult(JSON.stringify(data, null, 2));
8076
8165
  });
8077
8166
  }
8078
8167
  };
@@ -8176,7 +8265,11 @@ function createVersionDiffTool(pkgseerService) {
8176
8265
  const graphqlError = handleGraphQLErrors(result.errors);
8177
8266
  if (graphqlError)
8178
8267
  return graphqlError;
8179
- return textResult(JSON.stringify(result.data.versionDiff, null, 2));
8268
+ const data = result.data.versionDiff;
8269
+ const indexingError = handleIndexingStatus(data);
8270
+ if (indexingError)
8271
+ return indexingError;
8272
+ return textResult(JSON.stringify(data, null, 2));
8180
8273
  });
8181
8274
  }
8182
8275
  };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  version
3
- } from "./shared/chunk-x6hqsn93.js";
3
+ } from "./shared/chunk-a0vv3x03.js";
4
4
  export {
5
5
  version
6
6
  };
@@ -1,4 +1,4 @@
1
1
  // package.json
2
- var version = "0.5.1";
2
+ var version = "0.5.2";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pkgseer/cli",
3
3
  "description": "CLI companion for PkgSeer - package intelligence for developers and AI assistants",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",