@safetech/inheriti-cli 0.0.15 → 0.0.17-dev.0

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.
@@ -1 +1 @@
1
- {"deployment":"prod"}
1
+ {"deployment":"dev"}
package/dist/main.js CHANGED
@@ -60135,8 +60135,8 @@ var init_deployment = __esm({
60135
60135
  prod: false
60136
60136
  };
60137
60137
  HOST_FEATURE_FLAGS = {
60138
- local: { planCreation: false, automation: false },
60139
- dev: { planCreation: false, automation: false },
60138
+ local: { planCreation: false, automation: true },
60139
+ dev: { planCreation: false, automation: true },
60140
60140
  stg: { planCreation: false, automation: false },
60141
60141
  prod: { planCreation: false, automation: false }
60142
60142
  };
@@ -77666,6 +77666,18 @@ var init_automation_provider = __esm({
77666
77666
 
77667
77667
  // ../../packages/core/dist/automation-setup.js
77668
77668
  import { randomUUID as randomUUID2 } from "node:crypto";
77669
+ function automationRuntimeInstallInstructions(release2) {
77670
+ if (!VERIFIED_CLI_VERSION.test(release2.cliVersion))
77671
+ throw new Error("Invalid verified CLI version");
77672
+ const packageSpec = `@safetech/inheriti-cli@${release2.cliVersion}`;
77673
+ return {
77674
+ packageSpec,
77675
+ prerequisite: "Add to your application's Dockerfile. The build needs npm, and the final image needs a Node.js runtime. npm checks the published package's engines metadata:",
77676
+ dockerfile: `RUN npm install --engine-strict --global ${packageSpec} \\
77677
+ && test "$(inheriti --version)" = '${release2.cliVersion}'`,
77678
+ instruction: "Build and publish the container, then pass its IMAGE@sha256:DIGEST reference to inheriti automations setup --apply. The image must provide /usr/local/bin/inheriti, or use --cli-path for another absolute path."
77679
+ };
77680
+ }
77669
77681
  function createAutomationSetupOperations(options) {
77670
77682
  const base = new URL("v1/", options.apiUrl).toString().replace(/\/$/, "");
77671
77683
  const connections = `${base}/automation-connections`;
@@ -77810,7 +77822,7 @@ var init_automation_setup = __esm({
77810
77822
  init_node_base();
77811
77823
  init_vanilla2();
77812
77824
  init_automation_provider();
77813
- VERIFIED_CLI_VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-dev\.(0|[1-9]\d*))?$/;
77825
+ VERIFIED_CLI_VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:dev|stg)\.(0|[1-9]\d*))?$/;
77814
77826
  }
77815
77827
  });
77816
77828
 
@@ -78325,17 +78337,18 @@ async function applyEcsAutomation(input, run3 = runAws) {
78325
78337
  if (alreadyWrapped) {
78326
78338
  if (environmentNames.some((name2) => mappedNames.includes(name2)))
78327
78339
  throw new Error("automation_ecs_environment_conflict");
78328
- if (entryPoint.slice(0, prefix.length).join("\0") !== prefix.join("\0") || container.image !== input.image || addedEnvironment.some((item) => !environment.some((existing) => existing.name === item.name && existing.value === item.value))) {
78340
+ if (entryPoint.slice(0, prefix.length).join("\0") !== prefix.join("\0") || addedEnvironment.some((item) => !environment.some((existing) => existing.name === item.name && existing.value === item.value))) {
78329
78341
  throw new Error("automation_ecs_existing_setup_conflict");
78330
78342
  }
78331
- return { previousRevision, revision: previousRevision, image: input.image, status: "unchanged" };
78343
+ if (container.image === input.image)
78344
+ return { previousRevision, revision: previousRevision, image: input.image, status: "unchanged" };
78332
78345
  }
78333
78346
  if (environmentNames.some((name2) => mappedNames.includes(name2)))
78334
78347
  throw new Error("automation_ecs_environment_conflict");
78335
78348
  const updatedContainer = {
78336
78349
  ...container,
78337
78350
  image: input.image,
78338
- entryPoint: [...prefix, ...entryPoint],
78351
+ entryPoint: alreadyWrapped ? entryPoint : [...prefix, ...entryPoint],
78339
78352
  environment: [...environment, ...addedEnvironment.filter((item) => !environment.some((existing) => existing.name === item.name))]
78340
78353
  };
78341
78354
  const registration = {};
@@ -124858,6 +124871,7 @@ __export(node_base_exports2, {
124858
124871
  applyCloudRunAutomation: () => applyCloudRunAutomation,
124859
124872
  applyCloudRunServiceAutomation: () => applyCloudRunServiceAutomation,
124860
124873
  applyEcsAutomation: () => applyEcsAutomation,
124874
+ automationRuntimeInstallInstructions: () => automationRuntimeInstallInstructions,
124861
124875
  businessDeployment: () => businessDeployment,
124862
124876
  businessUiRpId: () => businessUiRpId,
124863
124877
  chooseInheritiFile: () => chooseInheritiFile,
@@ -163795,8 +163809,8 @@ var CliConfigurationInvalid = class extends Error {
163795
163809
  }
163796
163810
  code;
163797
163811
  };
163798
- var IS_DEVELOPMENT_BUILD = false;
163799
- var BUILD_DEPLOYMENT = true ? businessDeployment("prod") : void 0;
163812
+ var IS_DEVELOPMENT_BUILD = true;
163813
+ var BUILD_DEPLOYMENT = true ? businessDeployment("dev") : void 0;
163800
163814
  var DEFAULT_SCOPES = ["openid", "plan:list", "plan:read", "plan:reveal", "asset:copy"];
163801
163815
  function defaultConfigurationPath(environmentVariables) {
163802
163816
  if (environmentVariables.INHERITI_ELEMENTS_CONFIG) return environmentVariables.INHERITI_ELEMENTS_CONFIG;
@@ -164303,6 +164317,21 @@ async function login(context, terminal) {
164303
164317
  if (await context.sessions.load()) await context.keyVault?.clear();
164304
164318
  const callbackUrl = await waitForCallback(context, terminal);
164305
164319
  await context.core.auth.completeAuthorizationCode(callbackUrl);
164320
+ if (context.keyOwner === "Organisation") {
164321
+ try {
164322
+ await context.core.listOrganizations();
164323
+ } catch (error2) {
164324
+ if (error2?.status === 403 && error2.code === "integration_tester_required") {
164325
+ try {
164326
+ await context.core.auth.clear();
164327
+ } finally {
164328
+ await context.sessions.clear();
164329
+ }
164330
+ throw new Error("integration_tester_required");
164331
+ }
164332
+ throw error2;
164333
+ }
164334
+ }
164306
164335
  if (!await context.sessions.load()) throw new SessionStoreUnreadable("session_file_unreadable");
164307
164336
  terminal.write("Signed in.");
164308
164337
  return 0;
@@ -173793,6 +173822,7 @@ var RECONSTRUCTION_MESSAGES = {
173793
173822
  unexpected_ssdp_v2_worker_response: "The local SSDP+ reconstruction worker returned an invalid response."
173794
173823
  };
173795
173824
  var MESSAGES = {
173825
+ integration_tester_required: "You are not an integration tester. Contact developer support.",
173796
173826
  operator_not_signed_in: "Not signed in. Run `inheriti login` first.",
173797
173827
  business_context_required: "Set business: true in the CLI configuration to use organizations.",
173798
173828
  automation_disabled: "Automation is unavailable.",
@@ -174021,7 +174051,7 @@ var PLANS = candidates(
174021
174051
  );
174022
174052
  var SECRETS = candidates(["exec", "Run a command with Inheriti secrets"], ["resolve", "Resolve one field"], ["publish", "Optional one-time copy to cloud secret stores"]);
174023
174053
  var ORGANIZATIONS = candidates(["list", "List organisations"], ["use", "Select an organisation"]);
174024
- var AUTOMATIONS = candidates(["list", "List connections"], ["grants", "List plan grants"], ["create", "Create connection"], ["verify", "Verify identity"], ["trust", "Change trust"], ["disable", "Disable connection"], ["usage", "Print GitHub workflow"], ["setup", "Prepare workload launcher"], ["pair", "Verify workload identity"], ["grant", "Manage plan grant"]);
174054
+ var AUTOMATIONS = candidates(["list", "List connections"], ["grants", "List plan grants"], ["create", "Create connection"], ["verify", "Verify identity"], ["trust", "Change trust"], ["disable", "Disable connection"], ["usage", "Print GitHub workflow"], ["runtime", "Show verified runtime installation"], ["setup", "Prepare workload launcher"], ["pair", "Verify workload identity"], ["grant", "Manage plan grant"]);
174025
174055
  function printCompletionScript(terminal, shell) {
174026
174056
  if (!shell || !COMPLETION_SHELLS.includes(shell)) {
174027
174057
  terminal.writeError(`Usage: inheriti completion <${COMPLETION_SHELLS.join("|")}>`);
@@ -174082,6 +174112,7 @@ function completionFor(context, words) {
174082
174112
  }
174083
174113
  if (command7 === "automations") {
174084
174114
  if (words.length === 2) return { kind: "static", candidates: AUTOMATIONS };
174115
+ if (subcommand === "runtime" && words.length === 3) return { kind: "static", candidates: [{ value: "install-instructions" }] };
174085
174116
  if (subcommand === "grant" && words.length === 3) return { kind: "static", candidates: ["create", "activate", "member", "revoke"].map((value2) => ({ value: value2 })) };
174086
174117
  if (subcommand === "grant") return { kind: "static", candidates: ["--plan", "--grant", "--connection", "--member", "--id", "--help"].map((value2) => ({ value: value2 })) };
174087
174118
  if (subcommand === "create" || subcommand === "trust") return { kind: "static", candidates: ["--name", "--provider", "--deployment-environment", "--repository", "--environment", "--workflow", "--audience-base", "--subject", "--role-arn", "--region", "--instance", "--key-id", "--public-key", "--connection", "--id", "--help"].map((value2) => ({ value: value2 })) };
@@ -174482,10 +174513,11 @@ async function automationManage(context, configuration, terminal, signal, argv)
174482
174513
  const [verb, maybeAction, ...tail] = argv;
174483
174514
  const grant = verb === "grant";
174484
174515
  const pair = verb === "pair";
174485
- const action = grant || pair ? maybeAction : verb;
174486
- const options = flags(grant || pair ? tail : argv.slice(1));
174487
- const usage7 = "Usage: inheriti automations create|verify|trust|disable|usage|pair start|grant create|activate|member|revoke [nonsecret flags]";
174488
- const actions = grant ? ["create", "activate", "member", "revoke"] : pair ? ["start"] : ["create", "verify", "trust", "disable", "usage"];
174516
+ const runtime = verb === "runtime";
174517
+ const action = grant || pair || runtime ? maybeAction : verb;
174518
+ const options = flags(grant || pair || runtime ? tail : argv.slice(1));
174519
+ const usage7 = "Usage: inheriti automations create|verify|trust|disable|usage|runtime install-instructions|pair start|grant create|activate|member|revoke [nonsecret flags]";
174520
+ const actions = grant ? ["create", "activate", "member", "revoke"] : pair ? ["start"] : runtime ? ["install-instructions"] : ["create", "verify", "trust", "disable", "usage"];
174489
174521
  if (!options || !action || !actions.includes(action)) {
174490
174522
  terminal.writeError(usage7);
174491
174523
  return 1;
@@ -174499,6 +174531,18 @@ async function automationManage(context, configuration, terminal, signal, argv)
174499
174531
  organizationId: context.organization.id,
174500
174532
  getBearerToken: () => context.core.getAccessToken()
174501
174533
  });
174534
+ if (runtime) {
174535
+ if (Object.keys(options).length) {
174536
+ terminal.writeError(usage7);
174537
+ return 1;
174538
+ }
174539
+ const instructions = automationRuntimeInstallInstructions(await operations.getVerifiedGithubRelease());
174540
+ terminal.write(`Verified Inheriti CLI runtime: ${instructions.packageSpec}`);
174541
+ terminal.write(`${instructions.prerequisite}
174542
+ ${instructions.dockerfile}`);
174543
+ terminal.write(instructions.instruction);
174544
+ return 0;
174545
+ }
174502
174546
  if (pair) {
174503
174547
  if (Object.keys(options).some((key) => key !== "--connection")) {
174504
174548
  terminal.writeError(usage7);
@@ -175910,7 +175954,7 @@ inheriti <command>
175910
175954
  organizations use [id] Select a Business organisation
175911
175955
  ${automationEnabled ? "automations list List safe connection metadata" : ""}
175912
175956
  ${automationEnabled ? "automations grants PLAN_ID List safe grant metadata for one plan" : ""}
175913
- ${automationEnabled ? "automations create|verify|trust|disable|usage Manage a connection or print GitHub YAML" : ""}
175957
+ ${automationEnabled ? "automations create|verify|trust|disable|usage|runtime Manage connections and runtime guidance" : ""}
175914
175958
  ${automationEnabled ? "automations pair start|redeem|aws|google Verify a workload without copying its proof" : ""}
175915
175959
  ${automationEnabled ? "secrets publish aws|google Copy approved plan fields to cloud secret stores (optional)" : ""}
175916
175960
  ${automationEnabled ? "automations grant create|activate|member|revoke Manage a plan grant" : ""}
@@ -175967,7 +176011,7 @@ Clear the locally stored operator session. This does not delete plans or plan da
175967
176011
  organizations: `Usage: inheriti organizations <list|use [ID]>
175968
176012
 
175969
176013
  List eligible Business organisations or select one for this account.`,
175970
- automations: `Usage: inheriti automations <list|grants PLAN_ID|create|verify|trust|disable|usage|setup|pair|grant create|activate|member|revoke>
176014
+ automations: `Usage: inheriti automations <list|grants PLAN_ID|create|verify|trust|disable|usage|runtime install-instructions|setup|pair|grant create|activate|member|revoke>
175971
176015
 
175972
176016
  Manage Business automation connections and grants locally. Run inheriti help automations create, usage or grant for flags. Requires sign-in and a selected Organisation.`,
175973
176017
  "automations list": `Usage: inheriti automations list
@@ -176004,6 +176048,12 @@ Replace nonsecret trust fields using the same provider fields as create. Reverif
176004
176048
  "automations usage": `Usage: inheriti automations usage [--plan PLAN_ID] [--connection CONNECTION_ID] --field ASSET.FIELD
176005
176049
 
176006
176050
  Print copyable GitHub Actions YAML for an active plan grant and verified GitHub connection. Find ASSET.FIELD in the plan Data tab. The generated command only checks that the injected value is present. The Action reference and CLI version come from Business's verified release; if unavailable, no workflow is printed.`,
176051
+ "automations runtime": `Usage: inheriti automations runtime install-instructions
176052
+
176053
+ Print the exact verified CLI package version and Dockerfile instruction for an ECS or Cloud Run container. The version comes from the configured Business API. Prompts for sign-in and Organisation selection when needed; fails if no verified release is available.`,
176054
+ "automations runtime install-instructions": `Usage: inheriti automations runtime install-instructions
176055
+
176056
+ Print the exact verified CLI package version and Dockerfile instruction for an ECS or Cloud Run container. The version comes from the configured Business API. Prompts for sign-in and Organisation selection when needed; fails if no verified release is available.`,
176007
176057
  "secrets publish": `Usage: inheriti secrets publish <aws|google> [OPTIONS]
176008
176058
 
176009
176059
  Optional one-time copy for existing cloud-store consumers; use secrets exec for direct Inheriti runtime access. After publication, reads use provider IAM. Plan changes or revocation do not update or delete the copy; there is no automatic synchronization or rotation. Preview cloud destinations by default. Use inheriti help secrets publish aws or inheriti help secrets publish google for provider options.`,
@@ -176625,7 +176675,7 @@ async function run2(argv, environmentVariables, terminal) {
176625
176675
  return await organizationCommand(context, configuration, defaultConfigurationPath(environmentVariables), terminal, rest);
176626
176676
  }
176627
176677
  if (command7 === "automations") {
176628
- if (!["list", "grants", "create", "verify", "trust", "disable", "usage", "grant", "setup", "publish", "pair"].includes(rest[0] ?? "")) {
176678
+ if (!["list", "grants", "create", "verify", "trust", "disable", "usage", "runtime", "grant", "setup", "publish", "pair"].includes(rest[0] ?? "")) {
176629
176679
  terminal.writeError(commandUsage(["automations"], environmentVariables));
176630
176680
  return 1;
176631
176681
  }
@@ -176642,6 +176692,7 @@ async function run2(argv, environmentVariables, terminal) {
176642
176692
  terminal.writeError(commandUsage(["automations", rest[0]], environmentVariables));
176643
176693
  return 1;
176644
176694
  }
176695
+ if (rest[0] === "runtime" && rest[1] === "install-instructions" && rest.length === 2 && !await context.core.getAccessToken()) await login(context, terminal);
176645
176696
  const organization = await selectedOrganization(context, configuration, defaultConfigurationPath(environmentVariables), terminal);
176646
176697
  const scoped = createCliContext(configuration, defaultSessionPath(environmentVariables), organization.id);
176647
176698
  scoped.organization = organization;