viza 1.6.47 → 1.7.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.
@@ -1,4 +1,3 @@
1
- import { resolveEnv } from "../../../../context/env.js";
2
1
  import { resolveRuntimeHubIntent } from "../../../../context/hubIntent.js";
3
2
  import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
4
3
  import { showSsoLinkMenu } from "../../../../ui/sso/awsLoginMenu.js";
@@ -7,19 +6,11 @@ import { showSsoLinkMenu } from "../../../../ui/sso/awsLoginMenu.js";
7
6
  * This is a CLI-only UX constraint for fail-fast validation.
8
7
  * NOT a policy and MUST NOT be sent to gateway.
9
8
  */
10
- const TARGET_TEAMS = {
11
- dev: [
12
- "viza-billing",
13
- "viza-manager",
14
- "viza-admin",
15
- "viza-super",
16
- ],
17
- prod: [
18
- "viza-billing",
19
- "viza-admin",
20
- "viza-super",
21
- ]
22
- };
9
+ const TARGET_TEAMS = [
10
+ "viza-billing",
11
+ "viza-admin",
12
+ "viza-super",
13
+ ];
23
14
  /**
24
15
  * viza login aws
25
16
  *
@@ -32,22 +23,23 @@ const TARGET_TEAMS = {
32
23
  */
33
24
  export async function loginBillingAwsCommand(options) {
34
25
  // 1) Resolve environment
35
- const env = resolveEnv(options, "prod");
36
26
  const intent = resolveRuntimeHubIntent();
37
- const allowedTeams = TARGET_TEAMS[env];
27
+ const allowedTeams = TARGET_TEAMS;
38
28
  // 5) Dispatch intent (freeze)
39
29
  const result = await dispatchIntentAndWait({
40
30
  intent,
41
31
  commandType: "billing.login.aws",
42
32
  infraKey: "aws",
43
- targetEnv: env,
33
+ targetEnv: "prod",
44
34
  allowedTeams,
45
35
  selfHosted: options.selfHosted === true,
46
36
  keepLog: options.removeLog !== true,
47
37
  flowGates: {
48
38
  secrets: false,
49
39
  },
50
- payload: {}
40
+ payload: {
41
+ admin: options.admin === true
42
+ }
51
43
  }, {
52
44
  log: "hide",
53
45
  });
@@ -5,8 +5,7 @@ export function registerAwsUnderBillingLogin(parent) {
5
5
  // billing login aws
6
6
  const awsCommand = new Command("aws")
7
7
  .description("Login to AWS billing console")
8
- .option("--prod", "Use production environment")
9
- .option("--dev", "Use development environment")
8
+ .option("--admin", "Login as billing admin")
10
9
  .action(async (_opts, command) => {
11
10
  const fullOpts = getResolvedOptions(command);
12
11
  await loginBillingAwsCommand(fullOpts);
@@ -1,13 +1,11 @@
1
1
  import { Command } from "commander";
2
2
  import { registerBillingLoginCommand } from "./login/register.js";
3
- import { registerBillingLoginAdminCommand } from "./login-admin/register.js";
4
3
  export function registerBillingCommand(program) {
5
4
  // Create top-level `billing` command
6
5
  const billingCommand = new Command("billing")
7
6
  .description("Billing related commands");
8
7
  // Attach subcommands under `billing`
9
8
  registerBillingLoginCommand(billingCommand);
10
- registerBillingLoginAdminCommand(billingCommand);
11
9
  // Attach `billing` to root program
12
10
  program.addCommand(billingCommand);
13
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viza",
3
- "version": "1.6.47",
3
+ "version": "1.7.1",
4
4
  "type": "module",
5
5
  "description": "Viza unified command line interface",
6
6
  "bin": {
@@ -1,71 +0,0 @@
1
- import { resolveEnv } from "../../../../context/env.js";
2
- import { resolveRuntimeHubIntent } from "../../../../context/hubIntent.js";
3
- import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
4
- import { showSsoLinkMenu } from "../../../../ui/sso/awsLoginMenu.js";
5
- /**
6
- * Target teams for `viza login aws`.
7
- * This is a CLI-only UX constraint for fail-fast validation.
8
- * NOT a policy and MUST NOT be sent to gateway.
9
- */
10
- const TARGET_TEAMS = {
11
- dev: [
12
- "viza-billing",
13
- "viza-admin",
14
- "viza-super",
15
- ],
16
- prod: [
17
- "viza-billing",
18
- "viza-admin",
19
- "viza-super",
20
- ]
21
- };
22
- /**
23
- * viza login aws
24
- *
25
- * Flow:
26
- * 1) Resolve env (deterministic)
27
- * 2) Resolve user identity (trusted via gh auth)
28
- * 3) CLI pre-check against target teams (fail-fast UX)
29
- * 4) Derive ONE valid team (deterministic)
30
- * 5) Dispatch frozen intent to gateway
31
- */
32
- export async function loginBillingAdminAwsCommand(options) {
33
- // 1) Resolve environment
34
- const env = resolveEnv(options, "prod");
35
- const intent = resolveRuntimeHubIntent();
36
- const allowedTeams = TARGET_TEAMS[env];
37
- // 5) Dispatch intent (freeze)
38
- const result = await dispatchIntentAndWait({
39
- intent,
40
- commandType: "billing.login-admin.aws",
41
- infraKey: "aws",
42
- targetEnv: env,
43
- allowedTeams,
44
- selfHosted: options.selfHosted === true,
45
- keepLog: options.removeLog !== true,
46
- flowGates: {
47
- secrets: false,
48
- },
49
- payload: {}
50
- }, {
51
- log: "hide",
52
- });
53
- if (!result)
54
- return;
55
- if (result.status !== "success") {
56
- return;
57
- }
58
- if (result.kind !== "runtime") {
59
- return;
60
- }
61
- if (!result.data) {
62
- return;
63
- }
64
- const awsResult = result.data;
65
- if (typeof awsResult.loginUrl !== "string" ||
66
- typeof awsResult.shortUrl !== "string" ||
67
- typeof awsResult.ttlHours !== "number") {
68
- throw new Error("invalid_runtime_aws_login_result_shape");
69
- }
70
- await showSsoLinkMenu(awsResult.loginUrl, awsResult.shortUrl, awsResult.ttlHours);
71
- }
@@ -1,15 +0,0 @@
1
- import { Command } from "commander";
2
- import { loginBillingAdminAwsCommand } from "./aws.js";
3
- import { getResolvedOptions } from "../../../../cli/resolveOptions.js";
4
- export function registerBillingLoginAdminAwsCommand(parent) {
5
- // billing login-admin aws
6
- const awsCommand = new Command("aws")
7
- .description("Login to AWS billing console (admin)")
8
- .option("--prod", "Use production environment")
9
- .option("--dev", "Use development environment")
10
- .action(async (_opts, command) => {
11
- const fullOpts = getResolvedOptions(command);
12
- await loginBillingAdminAwsCommand(fullOpts);
13
- });
14
- parent.addCommand(awsCommand);
15
- }
@@ -1,10 +0,0 @@
1
- import { Command } from "commander";
2
- import { registerBillingLoginAdminAwsCommand } from "./aws/register.js";
3
- export function registerBillingLoginAdminCommand(parent) {
4
- // billing login-admin
5
- const loginAdminCommand = new Command("login-admin")
6
- .description("Login to billing services with admin privileges");
7
- // attach provider-level commands (e.g. aws)
8
- registerBillingLoginAdminAwsCommand(loginAdminCommand);
9
- parent.addCommand(loginAdminCommand);
10
- }