viza 1.6.32 → 1.6.35

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.
@@ -6,6 +6,7 @@ import { registerBootstrapCommand } from "../commands/bootstrap/register.js";
6
6
  import { whoamiCommand } from "../commands/whoami/index.js";
7
7
  import { registerAwsCommand } from "../commands/aws/register.js";
8
8
  import { registerInfraCommand } from "../commands/infra/register.js";
9
+ import { registerAgeCommand } from "../commands/age/register.js";
9
10
  export function createProgram() {
10
11
  const program = new Command();
11
12
  program
@@ -17,6 +18,7 @@ export function createProgram() {
17
18
  registerLoginCommand(program);
18
19
  registerAwsCommand(program);
19
20
  registerInfraCommand(program);
21
+ registerAgeCommand(program);
20
22
  program
21
23
  .command("whoami")
22
24
  .description("Show current GitHub identity and Viza team memberships (local only)")
@@ -0,0 +1,59 @@
1
+ import { resolveEnv } from "../../../context/env.js";
2
+ import { resolveResourceHubIntent } from "../../../context/hubIntent.js";
3
+ import { dispatchIntentAndWait } from "../../../core/dispatch.js";
4
+ /**
5
+ * Target teams for `viza login aws`.
6
+ * This is a CLI-only UX constraint for fail-fast validation.
7
+ * NOT a policy and MUST NOT be sent to gateway.
8
+ */
9
+ const TARGET_TEAMS = {
10
+ "dev": [
11
+ "viza-admin",
12
+ "viza-super"
13
+ ],
14
+ "prod": [
15
+ "viza-admin",
16
+ "viza-super"
17
+ ]
18
+ };
19
+ /**
20
+ * viza login aws
21
+ *
22
+ * Flow:
23
+ * 1) Resolve env (deterministic)
24
+ * 2) Resolve user identity (trusted via gh auth)
25
+ * 3) CLI pre-check against target teams (fail-fast UX)
26
+ * 4) Derive ONE valid team (deterministic)
27
+ * 5) Dispatch frozen intent to gateway
28
+ */
29
+ export async function bootstrapAgeCommand(options) {
30
+ // 1) Resolve environment
31
+ const env = resolveEnv(options);
32
+ const intent = resolveResourceHubIntent(env);
33
+ // Resolve allowed teams
34
+ // - Dispatch mode: restrict by targetEnv
35
+ // - Status mode: allow union of all env teams (read-only query)
36
+ const allowedTeams = options.status === true && env === "dev"
37
+ ? Array.from(new Set([
38
+ ...TARGET_TEAMS.dev,
39
+ ...TARGET_TEAMS.prod,
40
+ ]))
41
+ : TARGET_TEAMS[env];
42
+ // 5) Dispatch intent (freeze)
43
+ await dispatchIntentAndWait({
44
+ intent,
45
+ commandType: "age.bootstrap",
46
+ infraKey: "core",
47
+ targetEnv: env,
48
+ allowedTeams,
49
+ selfHosted: options.selfHosted === true,
50
+ keepLog: options.removeLog !== true,
51
+ flowGates: {
52
+ secrets: true,
53
+ },
54
+ payload: {}
55
+ }, {
56
+ status: options.status === true,
57
+ log: "show",
58
+ });
59
+ }
@@ -0,0 +1,19 @@
1
+ import { bootstrapAgeCommand } from "./bootstrap.js";
2
+ import { getResolvedOptions } from "../../../cli/resolveOptions.js";
3
+ /**
4
+ * Register:
5
+ * viza age bootstrap
6
+ */
7
+ export function registerAgeBootstrapCommand(program) {
8
+ program
9
+ .command("age")
10
+ .description("Age (encryption) related commands")
11
+ .command("bootstrap")
12
+ .description("Bootstrap MASTER HUB age keypair")
13
+ .option("--prod", "Use production environment")
14
+ .option("--dev", "Use development environment")
15
+ .action(async (_opts, command) => {
16
+ const fullOpts = getResolvedOptions(command);
17
+ await bootstrapAgeCommand(fullOpts);
18
+ });
19
+ }
@@ -0,0 +1,4 @@
1
+ import { registerAgeBootstrapCommand } from "./bootstrap/register.js";
2
+ export function registerAgeCommand(program) {
3
+ registerAgeBootstrapCommand(program);
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viza",
3
- "version": "1.6.32",
3
+ "version": "1.6.35",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {