@safetech/inheriti-cli 0.0.15 → 0.0.16-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;
@@ -174021,7 +174035,7 @@ var PLANS = candidates(
174021
174035
  );
174022
174036
  var SECRETS = candidates(["exec", "Run a command with Inheriti secrets"], ["resolve", "Resolve one field"], ["publish", "Optional one-time copy to cloud secret stores"]);
174023
174037
  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"]);
174038
+ 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
174039
  function printCompletionScript(terminal, shell) {
174026
174040
  if (!shell || !COMPLETION_SHELLS.includes(shell)) {
174027
174041
  terminal.writeError(`Usage: inheriti completion <${COMPLETION_SHELLS.join("|")}>`);
@@ -174082,6 +174096,7 @@ function completionFor(context, words) {
174082
174096
  }
174083
174097
  if (command7 === "automations") {
174084
174098
  if (words.length === 2) return { kind: "static", candidates: AUTOMATIONS };
174099
+ if (subcommand === "runtime" && words.length === 3) return { kind: "static", candidates: [{ value: "install-instructions" }] };
174085
174100
  if (subcommand === "grant" && words.length === 3) return { kind: "static", candidates: ["create", "activate", "member", "revoke"].map((value2) => ({ value: value2 })) };
174086
174101
  if (subcommand === "grant") return { kind: "static", candidates: ["--plan", "--grant", "--connection", "--member", "--id", "--help"].map((value2) => ({ value: value2 })) };
174087
174102
  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 +174497,11 @@ async function automationManage(context, configuration, terminal, signal, argv)
174482
174497
  const [verb, maybeAction, ...tail] = argv;
174483
174498
  const grant = verb === "grant";
174484
174499
  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"];
174500
+ const runtime = verb === "runtime";
174501
+ const action = grant || pair || runtime ? maybeAction : verb;
174502
+ const options = flags(grant || pair || runtime ? tail : argv.slice(1));
174503
+ const usage7 = "Usage: inheriti automations create|verify|trust|disable|usage|runtime install-instructions|pair start|grant create|activate|member|revoke [nonsecret flags]";
174504
+ const actions = grant ? ["create", "activate", "member", "revoke"] : pair ? ["start"] : runtime ? ["install-instructions"] : ["create", "verify", "trust", "disable", "usage"];
174489
174505
  if (!options || !action || !actions.includes(action)) {
174490
174506
  terminal.writeError(usage7);
174491
174507
  return 1;
@@ -174499,6 +174515,18 @@ async function automationManage(context, configuration, terminal, signal, argv)
174499
174515
  organizationId: context.organization.id,
174500
174516
  getBearerToken: () => context.core.getAccessToken()
174501
174517
  });
174518
+ if (runtime) {
174519
+ if (Object.keys(options).length) {
174520
+ terminal.writeError(usage7);
174521
+ return 1;
174522
+ }
174523
+ const instructions = automationRuntimeInstallInstructions(await operations.getVerifiedGithubRelease());
174524
+ terminal.write(`Verified Inheriti CLI runtime: ${instructions.packageSpec}`);
174525
+ terminal.write(`${instructions.prerequisite}
174526
+ ${instructions.dockerfile}`);
174527
+ terminal.write(instructions.instruction);
174528
+ return 0;
174529
+ }
174502
174530
  if (pair) {
174503
174531
  if (Object.keys(options).some((key) => key !== "--connection")) {
174504
174532
  terminal.writeError(usage7);
@@ -175910,7 +175938,7 @@ inheriti <command>
175910
175938
  organizations use [id] Select a Business organisation
175911
175939
  ${automationEnabled ? "automations list List safe connection metadata" : ""}
175912
175940
  ${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" : ""}
175941
+ ${automationEnabled ? "automations create|verify|trust|disable|usage|runtime Manage connections and runtime guidance" : ""}
175914
175942
  ${automationEnabled ? "automations pair start|redeem|aws|google Verify a workload without copying its proof" : ""}
175915
175943
  ${automationEnabled ? "secrets publish aws|google Copy approved plan fields to cloud secret stores (optional)" : ""}
175916
175944
  ${automationEnabled ? "automations grant create|activate|member|revoke Manage a plan grant" : ""}
@@ -175967,7 +175995,7 @@ Clear the locally stored operator session. This does not delete plans or plan da
175967
175995
  organizations: `Usage: inheriti organizations <list|use [ID]>
175968
175996
 
175969
175997
  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>
175998
+ automations: `Usage: inheriti automations <list|grants PLAN_ID|create|verify|trust|disable|usage|runtime install-instructions|setup|pair|grant create|activate|member|revoke>
175971
175999
 
175972
176000
  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
176001
  "automations list": `Usage: inheriti automations list
@@ -176004,6 +176032,12 @@ Replace nonsecret trust fields using the same provider fields as create. Reverif
176004
176032
  "automations usage": `Usage: inheriti automations usage [--plan PLAN_ID] [--connection CONNECTION_ID] --field ASSET.FIELD
176005
176033
 
176006
176034
  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.`,
176035
+ "automations runtime": `Usage: inheriti automations runtime install-instructions
176036
+
176037
+ 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.`,
176038
+ "automations runtime install-instructions": `Usage: inheriti automations runtime install-instructions
176039
+
176040
+ 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
176041
  "secrets publish": `Usage: inheriti secrets publish <aws|google> [OPTIONS]
176008
176042
 
176009
176043
  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 +176659,7 @@ async function run2(argv, environmentVariables, terminal) {
176625
176659
  return await organizationCommand(context, configuration, defaultConfigurationPath(environmentVariables), terminal, rest);
176626
176660
  }
176627
176661
  if (command7 === "automations") {
176628
- if (!["list", "grants", "create", "verify", "trust", "disable", "usage", "grant", "setup", "publish", "pair"].includes(rest[0] ?? "")) {
176662
+ if (!["list", "grants", "create", "verify", "trust", "disable", "usage", "runtime", "grant", "setup", "publish", "pair"].includes(rest[0] ?? "")) {
176629
176663
  terminal.writeError(commandUsage(["automations"], environmentVariables));
176630
176664
  return 1;
176631
176665
  }
@@ -176642,6 +176676,7 @@ async function run2(argv, environmentVariables, terminal) {
176642
176676
  terminal.writeError(commandUsage(["automations", rest[0]], environmentVariables));
176643
176677
  return 1;
176644
176678
  }
176679
+ if (rest[0] === "runtime" && rest[1] === "install-instructions" && rest.length === 2 && !await context.core.getAccessToken()) await login(context, terminal);
176645
176680
  const organization = await selectedOrganization(context, configuration, defaultConfigurationPath(environmentVariables), terminal);
176646
176681
  const scoped = createCliContext(configuration, defaultSessionPath(environmentVariables), organization.id);
176647
176682
  scoped.organization = organization;