viza 1.9.11 → 1.9.12

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,7 +1,7 @@
1
1
  export function getGlobalOptions() {
2
2
  return [
3
3
  { flags: "--status", description: "Show status only (no execution)" },
4
- { flags: "--remove-log", description: "Remove execution logs after completion", defaultValue: true },
4
+ { flags: "--keep-log", description: "Keep execution logs after completion", defaultValue: false },
5
5
  { flags: "--self-hosted", description: "Use self-hosted runner (viza-builder)" }
6
6
  ];
7
7
  }
@@ -25,10 +25,11 @@ export async function bootstrapAgeCommand(options) {
25
25
  intent,
26
26
  commandType: "age.bootstrap",
27
27
  infraKey: "core",
28
+ runType: "infra",
28
29
  targetEnv: env,
29
30
  allowedTeams,
30
31
  selfHosted: options.selfHosted === true,
31
- keepLog: options.removeLog !== true,
32
+ keepLog: options.keepLog === true,
32
33
  flowGates: {
33
34
  secrets: true,
34
35
  },
@@ -22,11 +22,12 @@ export async function bootstrapAwsRolesAnywhereCommand(options) {
22
22
  intent,
23
23
  commandType: "aws.rolesanywhere.bootstrap",
24
24
  infraKey: "core",
25
+ runType: "infra",
25
26
  targetEnv: env,
26
27
  allowedTeams,
27
28
  // Canonical CLI contract (explicit, non-magical)
28
29
  selfHosted: options.selfHosted === true,
29
- keepLog: options.removeLog !== true,
30
+ keepLog: options.keepLog === true,
30
31
  flowGates: {
31
32
  secrets: true,
32
33
  },
@@ -22,11 +22,12 @@ export async function rebootstrapAwsRolesAnywhereCommand(options) {
22
22
  intent,
23
23
  commandType: "aws.rolesanywhere.rebootstrap",
24
24
  infraKey: "core",
25
+ runType: "infra",
25
26
  targetEnv: env,
26
27
  allowedTeams,
27
28
  // Canonical CLI contract (explicit, non-magical)
28
29
  selfHosted: options.selfHosted === true,
29
- keepLog: options.removeLog !== true,
30
+ keepLog: options.keepLog === true,
30
31
  flowGates: {
31
32
  secrets: true,
32
33
  },
@@ -22,11 +22,12 @@ export async function rotateAwsRolesAnywhereCommand(options) {
22
22
  intent,
23
23
  commandType: "aws.rolesanywhere.rotate",
24
24
  infraKey: "core",
25
+ runType: "infra",
25
26
  targetEnv: env,
26
27
  allowedTeams,
27
28
  // Canonical CLI contract (explicit, non-magical)
28
29
  selfHosted: options.selfHosted === true,
29
- keepLog: options.removeLog !== true,
30
+ keepLog: options.keepLog === true,
30
31
  flowGates: {
31
32
  secrets: true,
32
33
  },
@@ -22,11 +22,12 @@ export async function updateAwsRolesAnywhereRoleCommand(options) {
22
22
  intent,
23
23
  commandType: "aws.rolesanywhere.update-role",
24
24
  infraKey: "core",
25
+ runType: "infra",
25
26
  targetEnv: env,
26
27
  allowedTeams,
27
28
  // Canonical CLI contract (explicit, non-magical)
28
29
  selfHosted: options.selfHosted === true,
29
- keepLog: options.removeLog !== true,
30
+ keepLog: options.keepLog === true,
30
31
  flowGates: {
31
32
  secrets: true,
32
33
  },
@@ -1,4 +1,4 @@
1
- import { resolveHubWorkerIntent } from "../../../../context/hubIntent.js";
1
+ import { RUNTIME_WORKER_CONTROL_INTENT } from "../../../../context/hubIntent.js";
2
2
  import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
3
3
  import { showSsoLinkMenu } from "../../../../ui/sso/awsLoginMenu.js";
4
4
  import { policy } from "./policy.js";
@@ -14,17 +14,18 @@ import { policy } from "./policy.js";
14
14
  */
15
15
  export async function loginBillingAwsCommand(options) {
16
16
  // 1) Resolve environment
17
- const intent = resolveHubWorkerIntent();
17
+ const intent = RUNTIME_WORKER_CONTROL_INTENT;
18
18
  const allowedTeams = Array.from(policy.byEnv["prod"]);
19
19
  // 5) Dispatch intent (freeze)
20
20
  const result = await dispatchIntentAndWait({
21
21
  intent,
22
22
  commandType: "billing.login.aws",
23
23
  infraKey: "aws",
24
+ runType: "runtime",
24
25
  targetEnv: "prod",
25
26
  allowedTeams,
26
27
  selfHosted: options.selfHosted === true,
27
- keepLog: options.removeLog !== true,
28
+ keepLog: options.keepLog === true,
28
29
  flowGates: {
29
30
  secrets: false,
30
31
  },
@@ -21,10 +21,11 @@ export async function logsCommand(runId, options) {
21
21
  intent,
22
22
  commandType: "dispatch.logs",
23
23
  infraKey: "core",
24
+ runType: "infra",
24
25
  targetEnv: env,
25
26
  allowedTeams,
26
27
  selfHosted: options.selfHosted === true,
27
- keepLog: options.removeLog !== true,
28
+ keepLog: options.keepLog === true,
28
29
  flowGates: {
29
30
  secrets: false,
30
31
  },
@@ -31,10 +31,11 @@ export async function runsCommand(options) {
31
31
  intent,
32
32
  commandType: "dispatch.runs",
33
33
  infraKey: "core",
34
+ runType: "infra",
34
35
  targetEnv: env,
35
36
  allowedTeams,
36
37
  selfHosted: options.selfHosted === true,
37
- keepLog: options.removeLog !== true,
38
+ keepLog: options.keepLog === true,
38
39
  flowGates: {
39
40
  secrets: false,
40
41
  },
@@ -25,10 +25,11 @@ export async function backupGithubSecretsCommand(options) {
25
25
  intent,
26
26
  commandType: "github.secrets.backup",
27
27
  infraKey: "core",
28
+ runType: "infra",
28
29
  targetEnv: env,
29
30
  allowedTeams,
30
31
  selfHosted: options.selfHosted === true,
31
- keepLog: options.removeLog !== true,
32
+ keepLog: options.keepLog === true,
32
33
  flowGates: {
33
34
  secrets: true,
34
35
  },
@@ -47,10 +47,11 @@ export async function restoreGithubSecretsCommand(options) {
47
47
  intent,
48
48
  commandType: "github.secrets.restore",
49
49
  infraKey: "core",
50
+ runType: "infra",
50
51
  targetEnv: env,
51
52
  allowedTeams,
52
53
  selfHosted: options.selfHosted === true,
53
- keepLog: options.removeLog !== true,
54
+ keepLog: options.keepLog === true,
54
55
  flowGates: {
55
56
  secrets: true,
56
57
  },
@@ -1,5 +1,5 @@
1
1
  import { getEnv } from "../../../../context/env.js";
2
- import { resolveHubIntent } from "../../../../context/hubIntent.js";
2
+ import { resolveHubIntent, RUNTIME_WORKER_BIZ_INTENT, RUNTIME_WORKER_CONTROL_INTENT, RUNTIME_WORKER_INFRA_INTENT } from "../../../../context/hubIntent.js";
3
3
  import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
4
4
  import { policy } from "./policy.js";
5
5
  /**
@@ -26,20 +26,21 @@ export async function deployCommandHubCommand(options) {
26
26
  }
27
27
  let workerIntent;
28
28
  if (options.control)
29
- workerIntent = "control";
29
+ workerIntent = RUNTIME_WORKER_CONTROL_INTENT;
30
30
  else if (options.infra)
31
- workerIntent = "infra";
31
+ workerIntent = RUNTIME_WORKER_INFRA_INTENT;
32
32
  else
33
- workerIntent = "biz";
33
+ workerIntent = RUNTIME_WORKER_BIZ_INTENT;
34
34
  // 5) Dispatch intent (freeze)
35
35
  await dispatchIntentAndWait({
36
36
  intent,
37
37
  commandType: "infra.command-hub.deploy",
38
38
  infraKey: "core",
39
+ runType: "infra",
39
40
  targetEnv: env,
40
41
  allowedTeams,
41
42
  selfHosted: options.selfHosted === true,
42
- keepLog: options.removeLog !== true,
43
+ keepLog: options.keepLog === true,
43
44
  flowGates: {
44
45
  secrets: true,
45
46
  },
@@ -1,5 +1,5 @@
1
1
  import { getEnv } from "../../../context/env.js";
2
- import { resolveHubWorkerIntent } from "../../../context/hubIntent.js";
2
+ import { RUNTIME_WORKER_CONTROL_INTENT } from "../../../context/hubIntent.js";
3
3
  import { dispatchIntentAndWait } from "../../../core/dispatch.js";
4
4
  import { showSsoLinkMenu } from "../../../ui/sso/awsLoginMenu.js";
5
5
  import { policy } from "./policy.js";
@@ -16,7 +16,7 @@ import { policy } from "./policy.js";
16
16
  export async function loginAwsCommand(options) {
17
17
  // 1) Resolve environment
18
18
  const env = getEnv();
19
- const intent = resolveHubWorkerIntent();
19
+ const intent = RUNTIME_WORKER_CONTROL_INTENT;
20
20
  // Resolve allowed teams
21
21
  // - Dispatch mode: restrict by targetEnv
22
22
  // - Status mode: allow union of all env teams (read-only query)
@@ -26,10 +26,11 @@ export async function loginAwsCommand(options) {
26
26
  intent,
27
27
  commandType: "aws.login",
28
28
  infraKey: "aws",
29
+ runType: "runtime",
29
30
  targetEnv: env,
30
31
  allowedTeams,
31
32
  selfHosted: options.selfHosted === true,
32
- keepLog: options.removeLog !== true,
33
+ keepLog: options.keepLog === true,
33
34
  flowGates: {
34
35
  secrets: false,
35
36
  },
@@ -17,12 +17,18 @@ const RESOURCE_DEPLOYER_INTENT_BY_ENV = "deployer";
17
17
  /**
18
18
  * Build & publish application layer
19
19
  */
20
- const RESOURCE_BUILDER_INTENT_BY_ENV = "builder";
20
+ export const RESOURCE_BUILDER_INTENT_BY_ENV = "builder";
21
21
  /**
22
22
  * Runtime command hub (worker layer)
23
23
  * Single intent for both dev and prod (env derived at gateway)
24
24
  */
25
25
  const RUNTIME_HUB_INTENT = "hub-worker";
26
+ /**
27
+ * Runtime worker intents (explicit, no mapping guess)
28
+ */
29
+ export const RUNTIME_WORKER_CONTROL_INTENT = "control";
30
+ export const RUNTIME_WORKER_INFRA_INTENT = "infra";
31
+ export const RUNTIME_WORKER_BIZ_INTENT = "biz";
26
32
  export function resolveHubIntent(selfHosted) {
27
33
  if (selfHosted) {
28
34
  return RESOURCE_HUB_INTENT_BY_ENV;
@@ -64,6 +64,10 @@ function assertDispatchInputStrict(input) {
64
64
  if (!input.infraKey || typeof input.infraKey !== "string") {
65
65
  throw new Error("dispatch_input_missing_infraKey");
66
66
  }
67
+ // runType must be explicit and valid
68
+ if (!input.runType || (input.runType !== "infra" && input.runType !== "runtime")) {
69
+ throw new Error("dispatch_input_invalid_runType");
70
+ }
67
71
  if (!("payload" in input)) {
68
72
  throw new Error("dispatch_input_missing_payload");
69
73
  }
@@ -108,6 +112,7 @@ async function dispatchIntent(input, mode = "dispatch") {
108
112
  intent: input.intent,
109
113
  commandType: input.commandType,
110
114
  infraKey: input.infraKey,
115
+ runType: input.runType,
111
116
  payload: input.payload,
112
117
  runnerLabel: input.selfHosted ? "selfhosted" : "native",
113
118
  ...(input.keepLog !== undefined ? { keepLog: input.keepLog } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viza",
3
- "version": "1.9.11",
3
+ "version": "1.9.12",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  "release:full": "rm -rf dist && npx npm-check-updates -u && npm install && git add package.json package-lock.json && git commit -m 'chore(deps): auto update dependencies before release' || echo 'No changes' && node versioning.js && npm login && npm publish --tag latest --access public && git push"
23
23
  },
24
24
  "dependencies": {
25
- "@vizamodo/viza-dispatcher": "^1.5.46",
25
+ "@vizamodo/viza-dispatcher": "^1.5.51",
26
26
  "adm-zip": "^0.5.16",
27
27
  "chalk": "^5.6.2",
28
28
  "clipboardy": "^5.3.1",