@cdot65/prisma-airs-cli 6.1.0 → 6.1.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/cli/index.js +16 -7
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -4733,7 +4733,7 @@ function registerIntegrations(root) {
4733
4733
  );
4734
4734
  create.action(
4735
4735
  (opts) => runWrite(create, opts, async (client) => {
4736
- const prepared = await prepareIntegrationOptions(opts, client);
4736
+ const prepared = await prepareIntegrationOptions(opts, client, { promptWhenMissing: true });
4737
4737
  const body = await buildStructuredRequest(
4738
4738
  prepared,
4739
4739
  GatewayIntegrationCreateRequestSchema,
@@ -4741,7 +4741,7 @@ function registerIntegrations(root) {
4741
4741
  );
4742
4742
  if (!body.key && !(Array.isArray(body.secret_mappings) && body.secret_mappings.length)) {
4743
4743
  throw new CliUsageError(
4744
- "A provider credential is required: pass --key-stdin, --key-file, --secret-mappings, or --key (the gateway rejects a credential-less integration with a generic AB01)"
4744
+ "A provider credential is required: run in a terminal to be prompted, or pass --key-file, --key-stdin (piped), --secret-mappings, or --key (the gateway rejects a credential-less integration with a generic AB01)"
4745
4745
  );
4746
4746
  }
4747
4747
  return client.integrations.create(body);
@@ -5093,7 +5093,7 @@ function registerPlugins(root) {
5093
5093
  )
5094
5094
  );
5095
5095
  }
5096
- async function prepareIntegrationOptions(opts, client) {
5096
+ async function prepareIntegrationOptions(opts, client, settings = {}) {
5097
5097
  const sources = [opts.key !== void 0, Boolean(opts.keyStdin), opts.keyFile !== void 0];
5098
5098
  if (sources.filter(Boolean).length > 1) {
5099
5099
  throw new CliUsageError("Use only one of --key, --key-stdin, or --key-file");
@@ -5104,11 +5104,18 @@ async function prepareIntegrationOptions(opts, client) {
5104
5104
  delete prepared.baseUrl;
5105
5105
  delete prepared.header;
5106
5106
  delete prepared.aiProvider;
5107
+ const interactive = Boolean(process.stdin.isTTY && process.stderr.isTTY);
5107
5108
  if (opts.keyStdin) {
5108
- try {
5109
- prepared.key = await readTenantStdin();
5110
- } catch {
5111
- throw new CliUsageError("--key-stdin requires one nonempty credential on piped stdin");
5109
+ if (interactive) {
5110
+ prepared.key = await promptTenantValue("Provider API key:", true);
5111
+ } else {
5112
+ try {
5113
+ prepared.key = await readTenantStdin();
5114
+ } catch {
5115
+ throw new CliUsageError(
5116
+ "--key-stdin reads one credential from piped stdin, e.g. `airs aigateway integrations create ... --key-stdin < provider.key`; in a terminal, omit every key flag to be prompted"
5117
+ );
5118
+ }
5112
5119
  }
5113
5120
  } else if (opts.keyFile !== void 0) {
5114
5121
  let raw;
@@ -5126,6 +5133,8 @@ async function prepareIntegrationOptions(opts, client) {
5126
5133
  ui.warning(
5127
5134
  "Inline --key is visible in shell history and process listings; prefer --key-stdin, --key-file, or --secret-mappings"
5128
5135
  );
5136
+ } else if (settings.promptWhenMissing && interactive && opts.secretMappings === void 0 && opts.file === void 0) {
5137
+ prepared.key = await promptTenantValue("Provider API key:", true);
5129
5138
  }
5130
5139
  if (opts.aiProvider !== void 0 && opts.aiProviderId !== void 0) {
5131
5140
  throw new CliUsageError("Use --ai-provider or --ai-provider-id, not both");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cdot65/prisma-airs-cli",
3
3
  "packageManager": "pnpm@10.6.5",
4
- "version": "6.1.0",
4
+ "version": "6.1.1",
5
5
  "description": "CLI and library for Palo Alto Prisma AIRS — guardrail refinement, AI red teaming, model security scanning, profile audits",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",