viza 1.8.2 → 1.8.9
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.
- package/dist/src/cli/options.js +1 -2
- package/dist/src/commands/age/bootstrap/bootstrap.js +2 -21
- package/dist/src/commands/age/bootstrap/policy.js +12 -0
- package/dist/src/commands/aws/rolesanywhere/bootstrap/bootstrap.js +2 -10
- package/dist/src/commands/aws/rolesanywhere/bootstrap/policy.js +6 -0
- package/dist/src/commands/aws/rolesanywhere/rebootstrap/policy.js +6 -0
- package/dist/src/commands/aws/rolesanywhere/rebootstrap/rebootstrap.js +2 -14
- package/dist/src/commands/aws/rolesanywhere/rotate/policy.js +13 -0
- package/dist/src/commands/aws/rolesanywhere/rotate/rotate.js +2 -17
- package/dist/src/commands/aws/rolesanywhere/update-role/policy.js +6 -0
- package/dist/src/commands/aws/rolesanywhere/update-role/update-role.js +2 -14
- package/dist/src/commands/billing/login/aws/aws.js +2 -11
- package/dist/src/commands/billing/login/aws/policy.js +9 -0
- package/dist/src/commands/dispatch/logs/logs.js +2 -15
- package/dist/src/commands/dispatch/logs/policy.js +16 -0
- package/dist/src/commands/dispatch/runs/policy.js +16 -0
- package/dist/src/commands/dispatch/runs/runs.js +2 -15
- package/dist/src/commands/github/secrets/backup/backup.js +2 -19
- package/dist/src/commands/github/secrets/backup/policy.js +10 -0
- package/dist/src/commands/github/secrets/restore/policy.js +12 -0
- package/dist/src/commands/github/secrets/restore/register.js +1 -0
- package/dist/src/commands/github/secrets/restore/restore.js +18 -25
- package/dist/src/commands/infra/deploy/command-hub/command-hub.js +39 -0
- package/dist/src/commands/infra/deploy/command-hub/policy.js +12 -0
- package/dist/src/commands/infra/{command-hub → deploy/command-hub}/register.js +2 -5
- package/dist/src/commands/infra/deploy/register.js +12 -0
- package/dist/src/commands/infra/register.js +6 -2
- package/dist/src/commands/login/aws/aws.js +2 -24
- package/dist/src/commands/login/aws/policy.js +15 -0
- package/dist/src/context/hubIntent.js +9 -5
- package/dist/src/types/runner.js +1 -0
- package/package.json +1 -1
- package/dist/src/commands/infra/command-hub/command-hub.js +0 -60
package/dist/src/cli/options.js
CHANGED
|
@@ -2,6 +2,5 @@ export function registerGlobalOptions(program) {
|
|
|
2
2
|
program
|
|
3
3
|
.option("--status", "Show status only (no execution)")
|
|
4
4
|
.option("--remove-log", "Remove execution logs after completion", false)
|
|
5
|
-
.option("--self-hosted", "Use self-hosted runner (viza-builder)", false)
|
|
6
|
-
.option("--cloud-runner", "Use cloud managed runner (GitHub-hosted)", false);
|
|
5
|
+
.option("--self-hosted", "Use self-hosted runner (viza-builder)", false);
|
|
7
6
|
}
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../context/env.js";
|
|
2
2
|
import { RESOURCE_HUB_INTENT_BY_ENV } from "../../../context/hubIntent.js";
|
|
3
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
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
19
5
|
/**
|
|
20
6
|
* viza login aws
|
|
21
7
|
*
|
|
@@ -33,12 +19,7 @@ export async function bootstrapAgeCommand(options) {
|
|
|
33
19
|
// Resolve allowed teams
|
|
34
20
|
// - Dispatch mode: restrict by targetEnv
|
|
35
21
|
// - Status mode: allow union of all env teams (read-only query)
|
|
36
|
-
const allowedTeams =
|
|
37
|
-
? Array.from(new Set([
|
|
38
|
-
...TARGET_TEAMS.dev,
|
|
39
|
-
...TARGET_TEAMS.prod,
|
|
40
|
-
]))
|
|
41
|
-
: TARGET_TEAMS[env];
|
|
22
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
42
23
|
// 5) Dispatch intent (freeze)
|
|
43
24
|
await dispatchIntentAndWait({
|
|
44
25
|
intent,
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../../context/env.js";
|
|
2
2
|
import { RESOURCE_HUB_INTENT_BY_ENV } from "../../../../context/hubIntent.js";
|
|
3
3
|
import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
|
|
4
|
-
|
|
5
|
-
* Target teams for `viza aws rolesanywhere bootstrap`.
|
|
6
|
-
* CLI-only fail-fast UX constraint.
|
|
7
|
-
* NOT a policy and MUST NOT be sent to gateway.
|
|
8
|
-
*/
|
|
9
|
-
const TARGET_TEAMS = {
|
|
10
|
-
dev: ["viza-super"],
|
|
11
|
-
prod: ["viza-super"],
|
|
12
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
13
5
|
/**
|
|
14
6
|
* viza aws rolesanywhere bootstrap
|
|
15
7
|
*
|
|
@@ -24,7 +16,7 @@ export async function bootstrapAwsRolesAnywhereCommand(options) {
|
|
|
24
16
|
const env = resolveEnv(options);
|
|
25
17
|
const intent = RESOURCE_HUB_INTENT_BY_ENV;
|
|
26
18
|
// 2) Resolve allowed teams (no status mode for bootstrap)
|
|
27
|
-
const allowedTeams =
|
|
19
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
28
20
|
// 3) Dispatch intent (freeze)
|
|
29
21
|
await dispatchIntentAndWait({
|
|
30
22
|
intent,
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../../context/env.js";
|
|
2
2
|
import { RESOURCE_HUB_INTENT_BY_ENV } from "../../../../context/hubIntent.js";
|
|
3
3
|
import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
|
|
4
|
-
|
|
5
|
-
* Target teams for `viza aws rolesanywhere bootstrap`.
|
|
6
|
-
* CLI-only fail-fast UX constraint.
|
|
7
|
-
* NOT a policy and MUST NOT be sent to gateway.
|
|
8
|
-
*/
|
|
9
|
-
const TARGET_TEAMS = {
|
|
10
|
-
"dev": [
|
|
11
|
-
"viza-super"
|
|
12
|
-
],
|
|
13
|
-
"prod": [
|
|
14
|
-
"viza-super"
|
|
15
|
-
]
|
|
16
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
17
5
|
/**
|
|
18
6
|
* viza aws rolesanywhere bootstrap
|
|
19
7
|
*
|
|
@@ -28,7 +16,7 @@ export async function rebootstrapAwsRolesAnywhereCommand(options) {
|
|
|
28
16
|
const env = resolveEnv(options);
|
|
29
17
|
const intent = RESOURCE_HUB_INTENT_BY_ENV;
|
|
30
18
|
// 2) Resolve allowed teams (no status mode for bootstrap)
|
|
31
|
-
const allowedTeams =
|
|
19
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
32
20
|
// 3) Dispatch intent (freeze)
|
|
33
21
|
await dispatchIntentAndWait({
|
|
34
22
|
intent,
|
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../../context/env.js";
|
|
2
2
|
import { RESOURCE_HUB_INTENT_BY_ENV } from "../../../../context/hubIntent.js";
|
|
3
3
|
import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
|
|
4
|
-
|
|
5
|
-
* Target teams for `viza aws rolesanywhere rotate`.
|
|
6
|
-
* CLI-only fail-fast UX constraint.
|
|
7
|
-
* NOT a policy and MUST NOT be sent to gateway.
|
|
8
|
-
*/
|
|
9
|
-
const TARGET_TEAMS = {
|
|
10
|
-
"dev": [
|
|
11
|
-
"viza-manager",
|
|
12
|
-
"viza-admin",
|
|
13
|
-
"viza-super"
|
|
14
|
-
],
|
|
15
|
-
"prod": [
|
|
16
|
-
"viza-admin",
|
|
17
|
-
"viza-super"
|
|
18
|
-
]
|
|
19
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
20
5
|
/**
|
|
21
6
|
* viza aws rolesanywhere rotate
|
|
22
7
|
*
|
|
@@ -31,7 +16,7 @@ export async function rotateAwsRolesAnywhereCommand(options) {
|
|
|
31
16
|
const env = resolveEnv(options);
|
|
32
17
|
const intent = RESOURCE_HUB_INTENT_BY_ENV;
|
|
33
18
|
// 2) Resolve allowed teams (no status mode for rotate)
|
|
34
|
-
const allowedTeams =
|
|
19
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
35
20
|
// 3) Dispatch intent (freeze)
|
|
36
21
|
await dispatchIntentAndWait({
|
|
37
22
|
intent,
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../../context/env.js";
|
|
2
2
|
import { RESOURCE_HUB_INTENT_BY_ENV } from "../../../../context/hubIntent.js";
|
|
3
3
|
import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
|
|
4
|
-
|
|
5
|
-
* Target teams for `viza aws rolesanywhere update-role`.
|
|
6
|
-
* CLI-only fail-fast UX constraint.
|
|
7
|
-
* NOT a policy and MUST NOT be sent to gateway.
|
|
8
|
-
*/
|
|
9
|
-
const TARGET_TEAMS = {
|
|
10
|
-
"dev": [
|
|
11
|
-
"viza-super"
|
|
12
|
-
],
|
|
13
|
-
"prod": [
|
|
14
|
-
"viza-super"
|
|
15
|
-
]
|
|
16
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
17
5
|
/**
|
|
18
6
|
* viza aws rolesanywhere update-role
|
|
19
7
|
*
|
|
@@ -28,7 +16,7 @@ export async function updateAwsRolesAnywhereRoleCommand(options) {
|
|
|
28
16
|
const env = resolveEnv(options);
|
|
29
17
|
const intent = RESOURCE_HUB_INTENT_BY_ENV;
|
|
30
18
|
// 2) Resolve allowed teams (no status mode for rotate)
|
|
31
|
-
const allowedTeams =
|
|
19
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
32
20
|
// 3) Dispatch intent (freeze)
|
|
33
21
|
await dispatchIntentAndWait({
|
|
34
22
|
intent,
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { RUNTIME_HUB_INTENT } from "../../../../context/hubIntent.js";
|
|
2
2
|
import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
|
|
3
3
|
import { showSsoLinkMenu } from "../../../../ui/sso/awsLoginMenu.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
|
-
"viza-billing",
|
|
11
|
-
"viza-admin",
|
|
12
|
-
"viza-super",
|
|
13
|
-
];
|
|
4
|
+
import { policy } from "./policy.js";
|
|
14
5
|
/**
|
|
15
6
|
* viza login aws
|
|
16
7
|
*
|
|
@@ -24,7 +15,7 @@ const TARGET_TEAMS = [
|
|
|
24
15
|
export async function loginBillingAwsCommand(options) {
|
|
25
16
|
// 1) Resolve environment
|
|
26
17
|
const intent = RUNTIME_HUB_INTENT;
|
|
27
|
-
const allowedTeams =
|
|
18
|
+
const allowedTeams = Array.from(policy.byEnv["prod"]);
|
|
28
19
|
// 5) Dispatch intent (freeze)
|
|
29
20
|
const result = await dispatchIntentAndWait({
|
|
30
21
|
intent,
|
|
@@ -1,20 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../context/env.js";
|
|
2
2
|
import { RESOURCE_HUB_INTENT_BY_ENV } from "../../../context/hubIntent.js";
|
|
3
3
|
import { dispatchIntentAndWait } from "../../../core/dispatch.js";
|
|
4
|
-
|
|
5
|
-
"dev": [
|
|
6
|
-
"viza-designer",
|
|
7
|
-
"viza-deployer",
|
|
8
|
-
"viza-manager",
|
|
9
|
-
"viza-admin",
|
|
10
|
-
"viza-super"
|
|
11
|
-
],
|
|
12
|
-
"prod": [
|
|
13
|
-
"viza-publisher",
|
|
14
|
-
"viza-admin",
|
|
15
|
-
"viza-super"
|
|
16
|
-
]
|
|
17
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
18
5
|
/**
|
|
19
6
|
* viza dispatch logs <runId>
|
|
20
7
|
*
|
|
@@ -28,7 +15,7 @@ export async function logsCommand(runId, options) {
|
|
|
28
15
|
const env = resolveEnv(options);
|
|
29
16
|
const intent = RESOURCE_HUB_INTENT_BY_ENV;
|
|
30
17
|
// Resolve allowed teams (same contract as other commands)
|
|
31
|
-
const allowedTeams =
|
|
18
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
32
19
|
// 2️⃣ Handle --app locally (do NOT dispatch)
|
|
33
20
|
if (options.app === true) {
|
|
34
21
|
const url = env === "prod"
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../context/env.js";
|
|
2
2
|
import { RUNTIME_HUB_INTENT } from "../../../context/hubIntent.js";
|
|
3
3
|
import { dispatchIntentAndWait } from "../../../core/dispatch.js";
|
|
4
|
+
import { policy } from "./policy.js";
|
|
4
5
|
import { showDispatchRuns } from "./show-runs.js";
|
|
5
|
-
const TARGET_TEAMS = {
|
|
6
|
-
"dev": [
|
|
7
|
-
"viza-designer",
|
|
8
|
-
"viza-deployer",
|
|
9
|
-
"viza-manager",
|
|
10
|
-
"viza-admin",
|
|
11
|
-
"viza-super"
|
|
12
|
-
],
|
|
13
|
-
"prod": [
|
|
14
|
-
"viza-publisher",
|
|
15
|
-
"viza-admin",
|
|
16
|
-
"viza-super"
|
|
17
|
-
]
|
|
18
|
-
};
|
|
19
6
|
/**
|
|
20
7
|
* viza dispatch runs
|
|
21
8
|
*
|
|
@@ -29,7 +16,7 @@ export async function runsCommand(options) {
|
|
|
29
16
|
const env = resolveEnv(options);
|
|
30
17
|
const intent = RUNTIME_HUB_INTENT;
|
|
31
18
|
// Resolve allowed teams (same contract as other commands)
|
|
32
|
-
const allowedTeams =
|
|
19
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
33
20
|
// 2️⃣ Handle --app locally (do NOT dispatch)
|
|
34
21
|
if (options.app === true) {
|
|
35
22
|
const url = env === "prod"
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../../context/env.js";
|
|
2
2
|
import { RESOURCE_HUB_INTENT_BY_ENV } from "../../../../context/hubIntent.js";
|
|
3
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-super"
|
|
12
|
-
],
|
|
13
|
-
"prod": [
|
|
14
|
-
"viza-super"
|
|
15
|
-
]
|
|
16
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
17
5
|
/**
|
|
18
6
|
* viza github secrets backup
|
|
19
7
|
*
|
|
@@ -31,12 +19,7 @@ export async function backupGithubSecretsCommand(options) {
|
|
|
31
19
|
// Resolve allowed teams
|
|
32
20
|
// - Dispatch mode: restrict by targetEnv
|
|
33
21
|
// - Status mode: allow union of all env teams (read-only query)
|
|
34
|
-
const allowedTeams =
|
|
35
|
-
? Array.from(new Set([
|
|
36
|
-
...TARGET_TEAMS.dev,
|
|
37
|
-
...TARGET_TEAMS.prod,
|
|
38
|
-
]))
|
|
39
|
-
: TARGET_TEAMS[env];
|
|
22
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
40
23
|
// 5) Dispatch intent (freeze)
|
|
41
24
|
await dispatchIntentAndWait({
|
|
42
25
|
intent,
|
|
@@ -14,6 +14,7 @@ export function registerGithubSecretsRestoreCommand(program) {
|
|
|
14
14
|
.option("--infra", "Restore configuration for Modo-Infra hub repositories")
|
|
15
15
|
.option("--builder", "Restore configuration for build/publish app repositories")
|
|
16
16
|
.option("--deployer", "Restore configuration for deployer repositories (Modo-Front / Modo-Back)")
|
|
17
|
+
.option("--all", "Restore configuration for all targets (core, infra, builder, deployer)")
|
|
17
18
|
.action(async (_opts, command) => {
|
|
18
19
|
const fullOpts = getResolvedOptions(command);
|
|
19
20
|
await restoreGithubSecretsCommand(fullOpts);
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { resolveEnv } from "../../../../context/env.js";
|
|
2
2
|
import { RUNTIME_HUB_INTENT } from "../../../../context/hubIntent.js";
|
|
3
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
|
-
};
|
|
4
|
+
import { policy } from "./policy.js";
|
|
19
5
|
/**
|
|
20
6
|
* viza github secrets restore
|
|
21
7
|
*
|
|
@@ -33,22 +19,29 @@ export async function restoreGithubSecretsCommand(options) {
|
|
|
33
19
|
// Resolve allowed teams
|
|
34
20
|
// - Dispatch mode: restrict by targetEnv
|
|
35
21
|
// - Status mode: allow union of all env teams (read-only query)
|
|
36
|
-
const allowedTeams =
|
|
37
|
-
? Array.from(new Set([
|
|
38
|
-
...TARGET_TEAMS.dev,
|
|
39
|
-
...TARGET_TEAMS.prod,
|
|
40
|
-
]))
|
|
41
|
-
: TARGET_TEAMS[env];
|
|
22
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
42
23
|
// Resolve domain restore flags (forward to hub)
|
|
43
24
|
const payload = {};
|
|
44
|
-
if (options.
|
|
25
|
+
if (options.all) {
|
|
45
26
|
payload.core = true;
|
|
46
|
-
if (options.infra)
|
|
47
27
|
payload.infra = true;
|
|
48
|
-
if (options.builder)
|
|
49
28
|
payload.builder = true;
|
|
50
|
-
if (options.deployer)
|
|
51
29
|
payload.deployer = true;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
if (options.core)
|
|
33
|
+
payload.core = true;
|
|
34
|
+
if (options.infra)
|
|
35
|
+
payload.infra = true;
|
|
36
|
+
if (options.builder)
|
|
37
|
+
payload.builder = true;
|
|
38
|
+
if (options.deployer)
|
|
39
|
+
payload.deployer = true;
|
|
40
|
+
}
|
|
41
|
+
// Fail fast if no domain flags were provided
|
|
42
|
+
if (Object.keys(payload).length === 0) {
|
|
43
|
+
throw new Error("No restore target specified. Use one of: --core, --infra, --builder, --deployer, or --all");
|
|
44
|
+
}
|
|
52
45
|
// 5) Dispatch intent (freeze)
|
|
53
46
|
await dispatchIntentAndWait({
|
|
54
47
|
intent,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { resolveEnv } from "../../../../context/env.js";
|
|
2
|
+
import { resolveHubIntent } from "../../../../context/hubIntent.js";
|
|
3
|
+
import { dispatchIntentAndWait } from "../../../../core/dispatch.js";
|
|
4
|
+
import { policy } from "./policy.js";
|
|
5
|
+
/**
|
|
6
|
+
* viza login aws
|
|
7
|
+
*
|
|
8
|
+
* Flow:
|
|
9
|
+
* 1) Resolve env (deterministic)
|
|
10
|
+
* 2) Resolve user identity (trusted via gh auth)
|
|
11
|
+
* 3) CLI pre-check against target teams (fail-fast UX)
|
|
12
|
+
* 4) Derive ONE valid team (deterministic)
|
|
13
|
+
* 5) Dispatch frozen intent to gateway
|
|
14
|
+
*/
|
|
15
|
+
export async function deployCommandHubCommand(options) {
|
|
16
|
+
// 1) Resolve environment
|
|
17
|
+
const env = resolveEnv(options);
|
|
18
|
+
const intent = resolveHubIntent(options.runner);
|
|
19
|
+
// Resolve allowed teams for the current environment only.
|
|
20
|
+
// CLI performs a fail-fast UX check but must still respect env boundaries.
|
|
21
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
22
|
+
// 5) Dispatch intent (freeze)
|
|
23
|
+
await dispatchIntentAndWait({
|
|
24
|
+
intent,
|
|
25
|
+
commandType: "infra.command-hub.deploy",
|
|
26
|
+
infraKey: "core",
|
|
27
|
+
targetEnv: env,
|
|
28
|
+
allowedTeams,
|
|
29
|
+
selfHosted: options.selfHosted === true,
|
|
30
|
+
keepLog: options.removeLog !== true,
|
|
31
|
+
flowGates: {
|
|
32
|
+
secrets: true,
|
|
33
|
+
},
|
|
34
|
+
payload: {}
|
|
35
|
+
}, {
|
|
36
|
+
status: options.status === true,
|
|
37
|
+
log: "show",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { deployCommandHubCommand } from "./command-hub.js";
|
|
2
|
-
import { getResolvedOptions } from "
|
|
2
|
+
import { getResolvedOptions } from "../../../../cli/resolveOptions.js";
|
|
3
3
|
/**
|
|
4
4
|
* Register:
|
|
5
5
|
* viza infra deploy command-hub
|
|
6
6
|
*/
|
|
7
7
|
export function registerCommandHubDeployCommand(program) {
|
|
8
8
|
program
|
|
9
|
-
.command("infra")
|
|
10
|
-
.description("Infrastructure commands")
|
|
11
|
-
.command("deploy")
|
|
12
|
-
.description("Deploy infrastructure components")
|
|
13
9
|
.command("command-hub")
|
|
14
10
|
.description("Deploy command hub worker to Cloudflare")
|
|
15
11
|
.option("--prod", "Use production environment")
|
|
16
12
|
.option("--dev", "Use development environment")
|
|
13
|
+
.option("--runner <type>", "Execution runner (hub | deployer | builder)", "hub")
|
|
17
14
|
.action(async (_opts, command) => {
|
|
18
15
|
const fullOpts = getResolvedOptions(command);
|
|
19
16
|
await deployCommandHubCommand(fullOpts);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { registerCommandHubDeployCommand } from "./command-hub/register.js";
|
|
2
|
+
/**
|
|
3
|
+
* Register:
|
|
4
|
+
* viza infra deploy command-hub
|
|
5
|
+
*/
|
|
6
|
+
export function registerDeployCommand(program) {
|
|
7
|
+
const deploy = program
|
|
8
|
+
.command("deploy")
|
|
9
|
+
.description("Deploy infrastructure components");
|
|
10
|
+
// Register subcommands under "infra"
|
|
11
|
+
registerCommandHubDeployCommand(deploy);
|
|
12
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { registerDeployCommand } from "./deploy/register.js";
|
|
2
2
|
export function registerInfraCommand(program) {
|
|
3
|
-
|
|
3
|
+
const infra = program
|
|
4
|
+
.command("infra")
|
|
5
|
+
.description("Infrastructure commands");
|
|
6
|
+
// Register subcommands under "infra"
|
|
7
|
+
registerDeployCommand(infra);
|
|
4
8
|
}
|
|
@@ -2,24 +2,7 @@ import { resolveEnv } from "../../../context/env.js";
|
|
|
2
2
|
import { RUNTIME_HUB_INTENT } from "../../../context/hubIntent.js";
|
|
3
3
|
import { dispatchIntentAndWait } from "../../../core/dispatch.js";
|
|
4
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-deployer",
|
|
13
|
-
"viza-manager",
|
|
14
|
-
"viza-admin",
|
|
15
|
-
"viza-super"
|
|
16
|
-
],
|
|
17
|
-
"prod": [
|
|
18
|
-
"viza-publisher",
|
|
19
|
-
"viza-admin",
|
|
20
|
-
"viza-super"
|
|
21
|
-
]
|
|
22
|
-
};
|
|
5
|
+
import { policy } from "./policy.js";
|
|
23
6
|
/**
|
|
24
7
|
* viza login aws
|
|
25
8
|
*
|
|
@@ -37,12 +20,7 @@ export async function loginAwsCommand(options) {
|
|
|
37
20
|
// Resolve allowed teams
|
|
38
21
|
// - Dispatch mode: restrict by targetEnv
|
|
39
22
|
// - Status mode: allow union of all env teams (read-only query)
|
|
40
|
-
const allowedTeams =
|
|
41
|
-
? Array.from(new Set([
|
|
42
|
-
...TARGET_TEAMS.dev,
|
|
43
|
-
...TARGET_TEAMS.prod,
|
|
44
|
-
]))
|
|
45
|
-
: TARGET_TEAMS[env];
|
|
23
|
+
const allowedTeams = Array.from(policy.byEnv[env]);
|
|
46
24
|
// 5) Dispatch intent (freeze)
|
|
47
25
|
const result = await dispatchIntentAndWait({
|
|
48
26
|
intent,
|
|
@@ -10,15 +10,19 @@ export const RESOURCE_DEPLOYER_INTENT_BY_ENV = "deployer";
|
|
|
10
10
|
/**
|
|
11
11
|
* Build & publish application layer
|
|
12
12
|
*/
|
|
13
|
-
export const RESOURCE_BACKER_INTENT_BY_ENV = "
|
|
13
|
+
export const RESOURCE_BACKER_INTENT_BY_ENV = "builder";
|
|
14
14
|
/**
|
|
15
15
|
* Runtime command hub (worker layer)
|
|
16
16
|
* Single intent for both dev and prod (env derived at gateway)
|
|
17
17
|
*/
|
|
18
18
|
export const RUNTIME_HUB_INTENT = "hub-worker";
|
|
19
|
-
export function resolveHubIntent(
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export function resolveHubIntent(runner) {
|
|
20
|
+
switch (runner) {
|
|
21
|
+
case "builder":
|
|
22
|
+
return RESOURCE_BACKER_INTENT_BY_ENV;
|
|
23
|
+
case "deployer":
|
|
24
|
+
return RESOURCE_DEPLOYER_INTENT_BY_ENV;
|
|
25
|
+
default:
|
|
26
|
+
return RESOURCE_HUB_INTENT_BY_ENV;
|
|
22
27
|
}
|
|
23
|
-
return RESOURCE_HUB_INTENT_BY_ENV;
|
|
24
28
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RUNNER_TYPES = ["hub", "deployer", "builder"];
|
package/package.json
CHANGED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { resolveEnv } from "../../../context/env.js";
|
|
2
|
-
import { resolveHubIntent } 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 deployCommandHubCommand(options) {
|
|
30
|
-
// 1) Resolve environment
|
|
31
|
-
const env = resolveEnv(options);
|
|
32
|
-
const cloudRunner = options.cloudRunner === true;
|
|
33
|
-
const intent = resolveHubIntent(cloudRunner);
|
|
34
|
-
// Resolve allowed teams
|
|
35
|
-
// - Dispatch mode: restrict by targetEnv
|
|
36
|
-
// - Status mode: allow union of all env teams (read-only query)
|
|
37
|
-
const allowedTeams = options.status === true && env === "dev"
|
|
38
|
-
? Array.from(new Set([
|
|
39
|
-
...TARGET_TEAMS.dev,
|
|
40
|
-
...TARGET_TEAMS.prod,
|
|
41
|
-
]))
|
|
42
|
-
: TARGET_TEAMS[env];
|
|
43
|
-
// 5) Dispatch intent (freeze)
|
|
44
|
-
await dispatchIntentAndWait({
|
|
45
|
-
intent,
|
|
46
|
-
commandType: "infra.command-hub.deploy",
|
|
47
|
-
infraKey: "core",
|
|
48
|
-
targetEnv: env,
|
|
49
|
-
allowedTeams,
|
|
50
|
-
selfHosted: options.selfHosted === true,
|
|
51
|
-
keepLog: options.removeLog !== true,
|
|
52
|
-
flowGates: {
|
|
53
|
-
secrets: true,
|
|
54
|
-
},
|
|
55
|
-
payload: {}
|
|
56
|
-
}, {
|
|
57
|
-
status: options.status === true,
|
|
58
|
-
log: "show",
|
|
59
|
-
});
|
|
60
|
-
}
|