specli 0.0.28 → 0.0.30

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/main.js CHANGED
@@ -168,13 +168,8 @@ export async function main(argv, options = {}) {
168
168
  process.stdout.write(`Fingerprint: ${ctx.schema.spec.fingerprint}\n`);
169
169
  process.stdout.write(`Servers: ${ctx.schema.servers.length}\n`);
170
170
  process.stdout.write(`Auth Schemes: ${ctx.schema.authSchemes.length}\n`);
171
- process.stdout.write(`Operations: ${ctx.schema.operations.length}\n`);
172
- for (const op of ctx.schema.operations) {
173
- const id = op.operationId ? ` (${op.operationId})` : "";
174
- process.stdout.write(`- ${op.method} ${op.path}${id}\n`);
175
- }
176
171
  if (ctx.schema.planned?.length) {
177
- process.stdout.write("\nPlanned commands:\n");
172
+ process.stdout.write(`\nCommands: ${ctx.schema.planned.length}\n\n`);
178
173
  for (const op of ctx.schema.planned) {
179
174
  const args = op.pathArgs.length
180
175
  ? ` ${op.pathArgs.map((a) => `<${a}>`).join(" ")}`
@@ -264,7 +264,8 @@ export async function buildRequest(input) {
264
264
  function buildCurl(req, body) {
265
265
  const parts = ["curl", "-sS", "-X", req.method];
266
266
  for (const [k, v] of req.headers.entries()) {
267
- parts.push("-H", shellQuote(`${k}: ${v}`));
267
+ const value = k.toLowerCase() === "authorization" ? maskAuthHeader(v) : v;
268
+ parts.push("-H", shellQuote(`${k}: ${value}`));
268
269
  }
269
270
  if (typeof body === "string") {
270
271
  parts.push("--data", shellQuote(body));
@@ -272,6 +273,25 @@ function buildCurl(req, body) {
272
273
  parts.push(shellQuote(req.url));
273
274
  return parts.join(" ");
274
275
  }
276
+ function maskAuthHeader(value) {
277
+ // Mask token in authorization header, preserving scheme (e.g., "Bearer")
278
+ // "Bearer abc123xyz" -> "Bearer abc...xyz"
279
+ const parts = value.split(" ");
280
+ if (parts.length === 2) {
281
+ const [scheme, token] = parts;
282
+ return `${scheme} ${maskToken(token)}`;
283
+ }
284
+ // No scheme, just mask the whole value
285
+ return maskToken(value);
286
+ }
287
+ function maskToken(token) {
288
+ if (token.length <= 6) {
289
+ return "***";
290
+ }
291
+ const prefix = token.slice(0, 3);
292
+ const suffix = token.slice(-3);
293
+ return `${prefix}...${suffix}`;
294
+ }
275
295
  function shellQuote(value) {
276
296
  return `'${value.replace(/'/g, `'\\''`)}'`;
277
297
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specli",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Run any OpenAPI spec as a CLI. Built for Agents.",
5
5
  "repository": {
6
6
  "type": "git",