lockpicks 0.7.0 → 0.7.1

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.
Files changed (2) hide show
  1. package/dist/lockpick.mjs +266 -59
  2. package/package.json +1 -1
package/dist/lockpick.mjs CHANGED
@@ -2819,8 +2819,8 @@ var require_validate = __commonJS({
2819
2819
  return data;
2820
2820
  }
2821
2821
  let expr = data;
2822
- const segments = jsonPointer.split("/");
2823
- for (const segment2 of segments) {
2822
+ const segments2 = jsonPointer.split("/");
2823
+ for (const segment2 of segments2) {
2824
2824
  if (segment2) {
2825
2825
  data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment2))}`;
2826
2826
  expr = (0, codegen_1._)`${expr} && ${data}`;
@@ -2992,7 +2992,7 @@ var require_compile = __commonJS({
2992
2992
  const schOrFunc = root.refs[ref];
2993
2993
  if (schOrFunc)
2994
2994
  return schOrFunc;
2995
- let _sch = resolve8.call(this, root, ref);
2995
+ let _sch = resolve9.call(this, root, ref);
2996
2996
  if (_sch === void 0) {
2997
2997
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
2998
2998
  const { schemaId } = this.opts;
@@ -3019,7 +3019,7 @@ var require_compile = __commonJS({
3019
3019
  function sameSchemaEnv(s1, s2) {
3020
3020
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3021
3021
  }
3022
- function resolve8(root, ref) {
3022
+ function resolve9(root, ref) {
3023
3023
  let sch;
3024
3024
  while (typeof (sch = this.refs[ref]) == "string")
3025
3025
  ref = sch;
@@ -3849,7 +3849,7 @@ var require_fast_uri = __commonJS({
3849
3849
  }
3850
3850
  return uri;
3851
3851
  }
3852
- function resolve8(baseURI, relativeURI, options) {
3852
+ function resolve9(baseURI, relativeURI, options) {
3853
3853
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3854
3854
  const {
3855
3855
  parsed: baseParsed,
@@ -4218,7 +4218,7 @@ var require_fast_uri = __commonJS({
4218
4218
  var fastUri = {
4219
4219
  SCHEMES,
4220
4220
  normalize,
4221
- resolve: resolve8,
4221
+ resolve: resolve9,
4222
4222
  resolveComponent,
4223
4223
  equal,
4224
4224
  serialize,
@@ -4639,9 +4639,9 @@ var require_core = __commonJS({
4639
4639
  const rules2 = this.RULES.all;
4640
4640
  metaSchema = JSON.parse(JSON.stringify(metaSchema));
4641
4641
  for (const jsonPointer of keywordsJsonPointers) {
4642
- const segments = jsonPointer.split("/").slice(1);
4642
+ const segments2 = jsonPointer.split("/").slice(1);
4643
4643
  let keywords = metaSchema;
4644
- for (const seg of segments)
4644
+ for (const seg of segments2)
4645
4645
  keywords = keywords[seg];
4646
4646
  for (const key in rules2) {
4647
4647
  const rule = rules2[key];
@@ -39155,7 +39155,7 @@ var require_resolve_uri_umd = __commonJS({
39155
39155
  }
39156
39156
  url3.path = path;
39157
39157
  }
39158
- function resolve8(input, base) {
39158
+ function resolve9(input, base) {
39159
39159
  if (!input && !base)
39160
39160
  return "";
39161
39161
  const url3 = parseUrl(input);
@@ -39208,7 +39208,7 @@ var require_resolve_uri_umd = __commonJS({
39208
39208
  return url3.scheme + "//" + url3.user + url3.host + url3.port + url3.path + queryHash;
39209
39209
  }
39210
39210
  }
39211
- return resolve8;
39211
+ return resolve9;
39212
39212
  }));
39213
39213
  }
39214
39214
  });
@@ -39546,8 +39546,8 @@ var require_trace_mapping_umd = __commonJS({
39546
39546
  this.sources = sources;
39547
39547
  this.sourcesContent = sourcesContent;
39548
39548
  this.ignoreList = parsed2.ignoreList || parsed2.x_google_ignoreList || void 0;
39549
- const resolve8 = resolver(mapUrl, sourceRoot);
39550
- this.resolvedSources = sources.map(resolve8);
39549
+ const resolve9 = resolver(mapUrl, sourceRoot);
39550
+ this.resolvedSources = sources.map(resolve9);
39551
39551
  const { mappings } = parsed2;
39552
39552
  if (typeof mappings === "string") {
39553
39553
  this._encoded = mappings;
@@ -39579,15 +39579,15 @@ var require_trace_mapping_umd = __commonJS({
39579
39579
  function traceSegment(map2, line, column) {
39580
39580
  const decoded = decodedMappings(map2);
39581
39581
  if (line >= decoded.length) return null;
39582
- const segments = decoded[line];
39582
+ const segments2 = decoded[line];
39583
39583
  const index = traceSegmentInternal(
39584
- segments,
39584
+ segments2,
39585
39585
  cast(map2)._decodedMemo,
39586
39586
  line,
39587
39587
  column,
39588
39588
  GREATEST_LOWER_BOUND
39589
39589
  );
39590
- return index === -1 ? null : segments[index];
39590
+ return index === -1 ? null : segments2[index];
39591
39591
  }
39592
39592
  function originalPositionFor(map2, needle) {
39593
39593
  let { line, column, bias } = needle;
@@ -39596,16 +39596,16 @@ var require_trace_mapping_umd = __commonJS({
39596
39596
  if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
39597
39597
  const decoded = decodedMappings(map2);
39598
39598
  if (line >= decoded.length) return OMapping(null, null, null, null);
39599
- const segments = decoded[line];
39599
+ const segments2 = decoded[line];
39600
39600
  const index = traceSegmentInternal(
39601
- segments,
39601
+ segments2,
39602
39602
  cast(map2)._decodedMemo,
39603
39603
  line,
39604
39604
  column,
39605
39605
  bias || GREATEST_LOWER_BOUND
39606
39606
  );
39607
39607
  if (index === -1) return OMapping(null, null, null, null);
39608
- const segment2 = segments[index];
39608
+ const segment2 = segments2[index];
39609
39609
  if (segment2.length === 1) return OMapping(null, null, null, null);
39610
39610
  const { names, resolvedSources } = map2;
39611
39611
  return OMapping(
@@ -39700,24 +39700,24 @@ var require_trace_mapping_umd = __commonJS({
39700
39700
  function GMapping(line, column) {
39701
39701
  return { line, column };
39702
39702
  }
39703
- function traceSegmentInternal(segments, memo, line, column, bias) {
39704
- let index = memoizedBinarySearch(segments, column, memo, line);
39703
+ function traceSegmentInternal(segments2, memo, line, column, bias) {
39704
+ let index = memoizedBinarySearch(segments2, column, memo, line);
39705
39705
  if (found) {
39706
- index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
39706
+ index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments2, column, index);
39707
39707
  } else if (bias === LEAST_UPPER_BOUND) index++;
39708
- if (index === -1 || index === segments.length) return -1;
39708
+ if (index === -1 || index === segments2.length) return -1;
39709
39709
  return index;
39710
39710
  }
39711
- function sliceGeneratedPositions(segments, memo, line, column, bias) {
39712
- let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
39711
+ function sliceGeneratedPositions(segments2, memo, line, column, bias) {
39712
+ let min = traceSegmentInternal(segments2, memo, line, column, GREATEST_LOWER_BOUND);
39713
39713
  if (!found && bias === LEAST_UPPER_BOUND) min++;
39714
- if (min === -1 || min === segments.length) return [];
39715
- const matchedColumn = found ? column : segments[min][COLUMN];
39716
- if (!found) min = lowerBound(segments, matchedColumn, min);
39717
- const max = upperBound(segments, matchedColumn, min);
39714
+ if (min === -1 || min === segments2.length) return [];
39715
+ const matchedColumn = found ? column : segments2[min][COLUMN];
39716
+ if (!found) min = lowerBound(segments2, matchedColumn, min);
39717
+ const max = upperBound(segments2, matchedColumn, min);
39718
39718
  const result = [];
39719
39719
  for (; min <= max; min++) {
39720
- const segment2 = segments[min];
39720
+ const segment2 = segments2[min];
39721
39721
  result.push(GMapping(segment2[REV_GENERATED_LINE] + 1, segment2[REV_GENERATED_COLUMN]));
39722
39722
  }
39723
39723
  return result;
@@ -39735,13 +39735,13 @@ var require_trace_mapping_umd = __commonJS({
39735
39735
  decodedMappings(map2),
39736
39736
  cast(map2)._bySourceMemos = sources.map(memoizedState)
39737
39737
  ));
39738
- const segments = generated[sourceIndex2][line];
39739
- if (segments == null) return all ? [] : GMapping(null, null);
39738
+ const segments2 = generated[sourceIndex2][line];
39739
+ if (segments2 == null) return all ? [] : GMapping(null, null);
39740
39740
  const memo = cast(map2)._bySourceMemos[sourceIndex2];
39741
- if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);
39742
- const index = traceSegmentInternal(segments, memo, line, column, bias);
39741
+ if (all) return sliceGeneratedPositions(segments2, memo, line, column, bias);
39742
+ const index = traceSegmentInternal(segments2, memo, line, column, bias);
39743
39743
  if (index === -1) return GMapping(null, null);
39744
- const segment2 = segments[index];
39744
+ const segment2 = segments2[index];
39745
39745
  return GMapping(segment2[REV_GENERATED_LINE] + 1, segment2[REV_GENERATED_COLUMN]);
39746
39746
  }
39747
39747
  }));
@@ -63629,7 +63629,7 @@ var require_introspection = __commonJS({
63629
63629
  exports.isStatic = isStatic;
63630
63630
  exports.matchesPattern = matchesPattern;
63631
63631
  exports.referencesImport = referencesImport;
63632
- exports.resolve = resolve8;
63632
+ exports.resolve = resolve9;
63633
63633
  exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore;
63634
63634
  var _t = require_lib4();
63635
63635
  var {
@@ -63887,7 +63887,7 @@ var require_introspection = __commonJS({
63887
63887
  nodeMap.set(target.node, result);
63888
63888
  return result;
63889
63889
  }
63890
- function resolve8(dangerous, resolved) {
63890
+ function resolve9(dangerous, resolved) {
63891
63891
  return _resolve.call(this, dangerous, resolved) || this;
63892
63892
  }
63893
63893
  function _resolve(dangerous, resolved) {
@@ -65651,9 +65651,9 @@ async function renderUsage(cmd, parent) {
65651
65651
  return usageLines.filter((l) => typeof l === "string").join("\n");
65652
65652
  }
65653
65653
  function renderValueHint(arg) {
65654
- const valueHint = arg.valueHint ? `=<${arg.valueHint}>` : "";
65655
- const fallbackValueHint = valueHint || `=<${snakeCase(arg.name)}>`;
65656
- if (!arg.type || arg.type === "positional" || arg.type === "boolean") return valueHint;
65654
+ const valueHint2 = arg.valueHint ? `=<${arg.valueHint}>` : "";
65655
+ const fallbackValueHint = valueHint2 || `=<${snakeCase(arg.name)}>`;
65656
+ if (!arg.type || arg.type === "positional" || arg.type === "boolean") return valueHint2;
65657
65657
  if (arg.type === "enum" && arg.options?.length) return `=<${arg.options.join("|")}>`;
65658
65658
  return fallbackValueHint;
65659
65659
  }
@@ -98040,12 +98040,12 @@ var StdioServerTransport = class {
98040
98040
  this.onclose?.();
98041
98041
  }
98042
98042
  send(message) {
98043
- return new Promise((resolve8) => {
98043
+ return new Promise((resolve9) => {
98044
98044
  const json3 = serializeMessage(message);
98045
98045
  if (this._stdout.write(json3)) {
98046
- resolve8();
98046
+ resolve9();
98047
98047
  } else {
98048
- this._stdout.once("drain", resolve8);
98048
+ this._stdout.once("drain", resolve9);
98049
98049
  }
98050
98050
  });
98051
98051
  }
@@ -99011,16 +99011,16 @@ var LockpickAgentClient = class extends AgentHttpBackend {
99011
99011
  import { spawn } from "node:child_process";
99012
99012
  function openBrowser(url3) {
99013
99013
  const [command, args] = process.platform === "darwin" ? ["open", [url3]] : process.platform === "win32" ? ["cmd", ["/c", "start", '""', url3.replace(/&/g, "^&")]] : ["xdg-open", [url3]];
99014
- return new Promise((resolve8) => {
99014
+ return new Promise((resolve9) => {
99015
99015
  try {
99016
99016
  const child = spawn(command, args, { stdio: "ignore", detached: true });
99017
- child.once("error", () => resolve8(false));
99017
+ child.once("error", () => resolve9(false));
99018
99018
  child.once("spawn", () => {
99019
99019
  child.unref();
99020
- resolve8(true);
99020
+ resolve9(true);
99021
99021
  });
99022
99022
  } catch {
99023
- resolve8(false);
99023
+ resolve9(false);
99024
99024
  }
99025
99025
  });
99026
99026
  }
@@ -100635,7 +100635,7 @@ import { delimiter, join as join3, sep } from "node:path";
100635
100635
  import { createInterface } from "node:readline/promises";
100636
100636
 
100637
100637
  // src/version.ts
100638
- var CLI_VERSION = true ? "0.7.0" : "0.0.0-dev";
100638
+ var CLI_VERSION = true ? "0.7.1" : "0.0.0-dev";
100639
100639
  var CLI_PACKAGE = true ? "lockpicks" : "lockpicks";
100640
100640
 
100641
100641
  // src/install.ts
@@ -106723,7 +106723,7 @@ var Protocol = class {
106723
106723
  return;
106724
106724
  }
106725
106725
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
106726
- await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
106726
+ await new Promise((resolve9) => setTimeout(resolve9, pollInterval));
106727
106727
  options?.signal?.throwIfAborted();
106728
106728
  }
106729
106729
  } catch (error51) {
@@ -106740,7 +106740,7 @@ var Protocol = class {
106740
106740
  */
106741
106741
  request(request, resultSchema, options) {
106742
106742
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
106743
- return new Promise((resolve8, reject) => {
106743
+ return new Promise((resolve9, reject) => {
106744
106744
  const earlyReject = (error51) => {
106745
106745
  reject(error51);
106746
106746
  };
@@ -106818,7 +106818,7 @@ var Protocol = class {
106818
106818
  if (!parseResult.success) {
106819
106819
  reject(parseResult.error);
106820
106820
  } else {
106821
- resolve8(parseResult.data);
106821
+ resolve9(parseResult.data);
106822
106822
  }
106823
106823
  } catch (error51) {
106824
106824
  reject(error51);
@@ -107079,12 +107079,12 @@ var Protocol = class {
107079
107079
  }
107080
107080
  } catch {
107081
107081
  }
107082
- return new Promise((resolve8, reject) => {
107082
+ return new Promise((resolve9, reject) => {
107083
107083
  if (signal.aborted) {
107084
107084
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
107085
107085
  return;
107086
107086
  }
107087
- const timeoutId = setTimeout(resolve8, interval);
107087
+ const timeoutId = setTimeout(resolve9, interval);
107088
107088
  signal.addEventListener("abort", () => {
107089
107089
  clearTimeout(timeoutId);
107090
107090
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -108397,7 +108397,7 @@ var McpServer = class {
108397
108397
  let task = createTaskResult.task;
108398
108398
  const pollInterval = task.pollInterval ?? 5e3;
108399
108399
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
108400
- await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
108400
+ await new Promise((resolve9) => setTimeout(resolve9, pollInterval));
108401
108401
  const updatedTask = await extra.taskStore.getTask(taskId);
108402
108402
  if (!updatedTask) {
108403
108403
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -109390,7 +109390,7 @@ function renderComparison(comparison, t3 = toolTranslator()) {
109390
109390
 
109391
109391
  // ../../packages/mcp-tools/src/wait.ts
109392
109392
  async function waitForRun(api, runId, options = {}) {
109393
- const sleep2 = options.sleep ?? ((ms) => new Promise((resolve8) => setTimeout(resolve8, ms)));
109393
+ const sleep2 = options.sleep ?? ((ms) => new Promise((resolve9) => setTimeout(resolve9, ms)));
109394
109394
  const now = options.now ?? Date.now;
109395
109395
  const deadline = options.timeoutMs === void 0 ? Infinity : now() + options.timeoutMs;
109396
109396
  let delay = Math.max(2e3, options.intervalMs ?? 5e3);
@@ -112148,7 +112148,7 @@ async function supervise(input, admission, dependencies) {
112148
112148
  } catch {
112149
112149
  return interruptedReport(input, admission, "worker-failure");
112150
112150
  }
112151
- return new Promise((resolve8, reject) => {
112151
+ return new Promise((resolve9, reject) => {
112152
112152
  let settled = false;
112153
112153
  let diagnosticBytes = 0;
112154
112154
  const finish = async (report2, error51) => {
@@ -112158,7 +112158,7 @@ async function supervise(input, admission, dependencies) {
112158
112158
  dependencies.signal?.removeEventListener("abort", abort);
112159
112159
  await worker.terminate().catch(() => void 0);
112160
112160
  if (error51) reject(error51);
112161
- else resolve8(report2);
112161
+ else resolve9(report2);
112162
112162
  };
112163
112163
  const fail = (reason) => void finish(interruptedReport(input, admission, reason));
112164
112164
  const abort = () => fail("interrupted");
@@ -112633,7 +112633,7 @@ function progressLine(run2, withPercent = true) {
112633
112633
  // src/verify.ts
112634
112634
  var VERIFY_WAIT_SCHEDULE = [30, 60, 60, 120];
112635
112635
  async function waitForProof(check3, options = {}) {
112636
- const sleep2 = options.sleep ?? ((seconds) => new Promise((resolve8) => setTimeout(resolve8, seconds * 1e3)));
112636
+ const sleep2 = options.sleep ?? ((seconds) => new Promise((resolve9) => setTimeout(resolve9, seconds * 1e3)));
112637
112637
  let verification = await check3();
112638
112638
  for (const planned of VERIFY_WAIT_SCHEDULE) {
112639
112639
  if (verification.state !== "pending" || verification.attemptsRemaining <= 0)
@@ -112960,7 +112960,7 @@ var out = (text3) => void process.stdout.write(`${terminalSafe(text3)}
112960
112960
  var err = (text3) => void process.stderr.write(`${terminalSafe(text3)}
112961
112961
  `);
112962
112962
  var width = () => terminalWidth(process.stdout);
112963
- var sleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
112963
+ var sleep = (ms) => new Promise((resolve9) => setTimeout(resolve9, ms));
112964
112964
  process.stdout.on("error", (error51) => {
112965
112965
  if (error51.code === "EPIPE") process.exit(EXIT.ok);
112966
112966
  throw error51;
@@ -115248,6 +115248,208 @@ function supportsNode(version3 = process.versions.node) {
115248
115248
  return Number.isInteger(major) && Number.isInteger(minor) && (major > 20 || major === 20 && minor >= 9);
115249
115249
  }
115250
115250
 
115251
+ // src/usage.ts
115252
+ function helpWidth(stream = process.stdout, env = process.env) {
115253
+ const declared = Number.parseInt(env.COLUMNS ?? "", 10);
115254
+ const raw = terminalWidth(stream) ?? (Number.isFinite(declared) && declared > 0 ? declared : 80);
115255
+ return Math.max(40, Math.min(raw, 100));
115256
+ }
115257
+ var WIDE = /[\u1100-\u115f\u2e80-\ua4cf\uac00-\ud7a3\uf900-\ufaff\ufe30-\ufe4f\uff00-\uff60\uffe0-\uffe6]/;
115258
+ var NO_LINE_START = /[。、,.!?;:)]}」』〉》”’・ー]/;
115259
+ function segments(word) {
115260
+ if (!WIDE.test(word)) return [word];
115261
+ const pieces = [];
115262
+ let latin = "";
115263
+ for (const char of word) {
115264
+ if (!WIDE.test(char) && !NO_LINE_START.test(char)) {
115265
+ latin += char;
115266
+ continue;
115267
+ }
115268
+ if (latin) {
115269
+ pieces.push(latin);
115270
+ latin = "";
115271
+ }
115272
+ if (NO_LINE_START.test(char) && pieces.length > 0)
115273
+ pieces[pieces.length - 1] += char;
115274
+ else pieces.push(char);
115275
+ }
115276
+ if (latin) pieces.push(latin);
115277
+ return pieces;
115278
+ }
115279
+ function wrap(text3, width2) {
115280
+ const lines = [];
115281
+ for (const paragraph of text3.split("\n")) {
115282
+ let line = "";
115283
+ for (const word of paragraph.split(/ +/).filter(Boolean))
115284
+ for (const [index, piece] of segments(word).entries()) {
115285
+ if (!line) {
115286
+ line = piece;
115287
+ continue;
115288
+ }
115289
+ const separator = index === 0 ? " " : "";
115290
+ if (displayWidth(line + separator + piece) <= width2)
115291
+ line += separator + piece;
115292
+ else {
115293
+ lines.push(line);
115294
+ line = piece;
115295
+ }
115296
+ }
115297
+ lines.push(line);
115298
+ }
115299
+ return lines;
115300
+ }
115301
+ function columns(rows, width2) {
115302
+ const names = Math.max(...rows.map((row) => displayWidth(row.plainName)));
115303
+ const indent = 2;
115304
+ const gap = 2;
115305
+ const descriptionStart = indent + names + gap;
115306
+ const room = width2 - descriptionStart;
115307
+ const out2 = [];
115308
+ if (room < 24) {
115309
+ for (const row of rows) {
115310
+ out2.push(" ".repeat(indent) + row.name);
115311
+ for (const line of wrap(row.description, width2 - indent - 2))
115312
+ if (line) out2.push(" ".repeat(indent + 2) + line);
115313
+ }
115314
+ return out2;
115315
+ }
115316
+ for (const row of rows) {
115317
+ const pad = " ".repeat(
115318
+ Math.max(0, names - displayWidth(row.plainName)) + indent
115319
+ );
115320
+ const [first = "", ...rest] = wrap(row.description, room);
115321
+ out2.push(`${pad}${row.name}${" ".repeat(gap)}${first}`.trimEnd());
115322
+ for (const line of rest) out2.push(" ".repeat(descriptionStart) + line);
115323
+ }
115324
+ return out2;
115325
+ }
115326
+ var resolve8 = async (value) => typeof value === "function" ? await value() : await value;
115327
+ var snake = (name) => name.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
115328
+ function valueHint(arg) {
115329
+ const hint = arg.valueHint ? `=<${arg.valueHint}>` : "";
115330
+ if (!arg.type || arg.type === "positional" || arg.type === "boolean")
115331
+ return hint;
115332
+ if (arg.type === "enum" && arg.options?.length)
115333
+ return `=<${arg.options.join("|")}>`;
115334
+ return hint || `=<${snake(arg.name)}>`;
115335
+ }
115336
+ function describe3(arg, required2) {
115337
+ return [
115338
+ arg.description,
115339
+ required2 ? "(Required)" : "",
115340
+ arg.default === void 0 ? "" : `(Default: ${String(arg.default)})`
115341
+ ].filter(Boolean).join(" ");
115342
+ }
115343
+ async function renderUsage2(cmd, parent, width2 = helpWidth(), paint2 = painter()) {
115344
+ const meta3 = await resolve8(cmd.meta) ?? {};
115345
+ const parentMeta = await resolve8(parent?.meta) ?? {};
115346
+ const name = (parentMeta.name ? `${parentMeta.name} ` : "") + (meta3.name || process.argv[1]);
115347
+ const defs = await resolve8(cmd.args) ?? {};
115348
+ const args = Object.entries(defs).map(([key, def]) => ({
115349
+ ...def,
115350
+ name: key
115351
+ }));
115352
+ const positionals = [];
115353
+ const options = [];
115354
+ const usage = [];
115355
+ for (const arg of args) {
115356
+ if (arg.type === "positional") {
115357
+ const plain3 = arg.name.toUpperCase() + valueHint(arg);
115358
+ const required3 = arg.required !== false && arg.default === void 0;
115359
+ positionals.push({
115360
+ name: paint2("cyan", plain3),
115361
+ plainName: plain3,
115362
+ description: describe3(arg, required3)
115363
+ });
115364
+ usage.push(
115365
+ required3 ? `<${arg.name.toUpperCase()}>` : `[${arg.name.toUpperCase()}]`
115366
+ );
115367
+ continue;
115368
+ }
115369
+ const required2 = arg.required === true && arg.default === void 0;
115370
+ const aliases = (Array.isArray(arg.alias) ? arg.alias : arg.alias ? [arg.alias] : []).map((alias2) => `-${alias2}`);
115371
+ const plain2 = [...aliases, `--${arg.name}`].join(", ") + valueHint(arg);
115372
+ options.push({
115373
+ name: paint2("cyan", plain2),
115374
+ plainName: plain2,
115375
+ description: describe3(arg, required2)
115376
+ });
115377
+ if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !/^no[-A-Z]/.test(arg.name)) {
115378
+ const negative = [
115379
+ ...aliases.map((alias2) => `--no-${alias2.slice(1)}`),
115380
+ `--no-${arg.name}`
115381
+ ].join(", ");
115382
+ options.push({
115383
+ name: paint2("cyan", negative),
115384
+ plainName: negative,
115385
+ description: [arg.negativeDescription, required2 ? "(Required)" : ""].filter(Boolean).join(" ")
115386
+ });
115387
+ }
115388
+ if (required2) usage.push(`--${arg.name}${valueHint(arg)}`);
115389
+ }
115390
+ const commands = [];
115391
+ if (cmd.subCommands) {
115392
+ const subCommands = await resolve8(cmd.subCommands);
115393
+ const names = [];
115394
+ for (const [key, sub] of Object.entries(subCommands)) {
115395
+ const subMeta = await resolve8((await resolve8(sub))?.meta) ?? {};
115396
+ if (subMeta.hidden) continue;
115397
+ const aliases = subMeta.alias ? Array.isArray(subMeta.alias) ? subMeta.alias : [subMeta.alias] : [];
115398
+ const plain2 = [key, ...aliases].join(", ");
115399
+ commands.push({
115400
+ name: paint2("cyan", plain2),
115401
+ plainName: plain2,
115402
+ description: subMeta.description || ""
115403
+ });
115404
+ names.push(key, ...aliases);
115405
+ }
115406
+ usage.push(names.length > 4 ? "<command>" : names.join("|"));
115407
+ }
115408
+ const lines = [];
115409
+ const version3 = meta3.version || parentMeta.version;
115410
+ const title = `${meta3.description ?? ""} (${name}${version3 ? ` v${version3}` : ""})`;
115411
+ for (const line of wrap(title, width2)) lines.push(paint2("dim", line));
115412
+ lines.push("");
115413
+ const head = "USAGE ";
115414
+ const invocation = `${name}${options.length || positionals.length ? " [OPTIONS]" : ""} ${usage.join(" ")}`;
115415
+ const [firstUsage = "", ...restUsage] = wrap(
115416
+ invocation,
115417
+ Math.max(20, width2 - head.length)
115418
+ );
115419
+ lines.push(`${paint2("bold", "USAGE")} ${paint2("cyan", firstUsage)}`);
115420
+ for (const line of restUsage)
115421
+ lines.push(" ".repeat(head.length) + paint2("cyan", line));
115422
+ lines.push("");
115423
+ for (const [heading, rows] of [
115424
+ ["ARGUMENTS", positionals],
115425
+ ["OPTIONS", options],
115426
+ ["COMMANDS", commands]
115427
+ ]) {
115428
+ if (rows.length === 0) continue;
115429
+ lines.push(paint2("bold", heading), "");
115430
+ lines.push(...columns(rows, width2));
115431
+ lines.push("");
115432
+ }
115433
+ if (commands.length > 0)
115434
+ lines.push(
115435
+ ...wrap(
115436
+ `Use ${name} <command> --help for more information about a command.`,
115437
+ width2
115438
+ )
115439
+ );
115440
+ return lines.join("\n").replace(/\n+$/, "");
115441
+ }
115442
+ async function showUsage2(cmd, parent) {
115443
+ try {
115444
+ process.stdout.write(`${await renderUsage2(cmd, parent)}
115445
+
115446
+ `);
115447
+ } catch (error51) {
115448
+ process.stderr.write(`${String(error51)}
115449
+ `);
115450
+ }
115451
+ }
115452
+
115251
115453
  // src/index.ts
115252
115454
  if (!supportsNode()) {
115253
115455
  const error51 = "lockpicks requires Node.js 20.9 or newer.";
@@ -115257,5 +115459,10 @@ if (!supportsNode()) {
115257
115459
  );
115258
115460
  process.exitCode = EXIT.validation;
115259
115461
  } else {
115260
- void runMain(main, { rawArgs: withoutLangFlag(process.argv.slice(2)) });
115462
+ void runMain(main, {
115463
+ rawArgs: withoutLangFlag(process.argv.slice(2)),
115464
+ // Our own help: citty writes one line per command, however narrow the
115465
+ // terminal is.
115466
+ showUsage: showUsage2
115467
+ });
115261
115468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lockpicks",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Lockpick from the terminal: device login, project status, findings, repair briefs, Pulse scans and an MCP server for coding agents",
5
5
  "keywords": [
6
6
  "lockpick",