viza 1.7.26 → 1.7.30
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/program.js +2 -0
- package/dist/src/commands/github/register.js +7 -0
- package/dist/src/commands/github/secrets/backup/backup.js +57 -0
- package/dist/src/commands/github/secrets/backup/register.js +17 -0
- package/dist/src/commands/github/secrets/register.js +9 -0
- package/dist/src/commands/github/secrets/restore/register.js +17 -0
- package/dist/src/commands/github/secrets/restore/restore.js +57 -0
- package/package.json +3 -3
package/dist/src/cli/program.js
CHANGED
|
@@ -8,6 +8,7 @@ import { registerAwsCommand } from "../commands/aws/register.js";
|
|
|
8
8
|
import { registerInfraCommand } from "../commands/infra/register.js";
|
|
9
9
|
import { registerAgeCommand } from "../commands/age/register.js";
|
|
10
10
|
import { registerBillingCommand } from "../commands/billing/register.js";
|
|
11
|
+
import { registerGithubCommand } from "../commands/github/register.js";
|
|
11
12
|
export function createProgram() {
|
|
12
13
|
const program = new Command();
|
|
13
14
|
program
|
|
@@ -19,6 +20,7 @@ export function createProgram() {
|
|
|
19
20
|
registerAwsCommand(program);
|
|
20
21
|
registerBillingCommand(program);
|
|
21
22
|
registerBootstrapCommand(program);
|
|
23
|
+
registerGithubCommand(program);
|
|
22
24
|
registerInfraCommand(program);
|
|
23
25
|
registerLoginCommand(program);
|
|
24
26
|
program
|
|
@@ -0,0 +1,57 @@
|
|
|
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-super"
|
|
12
|
+
],
|
|
13
|
+
"prod": [
|
|
14
|
+
"viza-super"
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* viza github secrets backup
|
|
19
|
+
*
|
|
20
|
+
* Flow:
|
|
21
|
+
* 1) Resolve env (deterministic)
|
|
22
|
+
* 2) Resolve user identity (trusted via gh auth)
|
|
23
|
+
* 3) CLI pre-check against target teams (fail-fast UX)
|
|
24
|
+
* 4) Derive ONE valid team (deterministic)
|
|
25
|
+
* 5) Dispatch frozen intent to gateway
|
|
26
|
+
*/
|
|
27
|
+
export async function backupGithubSecretsCommand(options) {
|
|
28
|
+
// 1) Resolve environment
|
|
29
|
+
const env = resolveEnv(options);
|
|
30
|
+
const intent = resolveResourceHubIntent(env);
|
|
31
|
+
// Resolve allowed teams
|
|
32
|
+
// - Dispatch mode: restrict by targetEnv
|
|
33
|
+
// - Status mode: allow union of all env teams (read-only query)
|
|
34
|
+
const allowedTeams = options.status === true && env === "dev"
|
|
35
|
+
? Array.from(new Set([
|
|
36
|
+
...TARGET_TEAMS.dev,
|
|
37
|
+
...TARGET_TEAMS.prod,
|
|
38
|
+
]))
|
|
39
|
+
: TARGET_TEAMS[env];
|
|
40
|
+
// 5) Dispatch intent (freeze)
|
|
41
|
+
await dispatchIntentAndWait({
|
|
42
|
+
intent,
|
|
43
|
+
commandType: "github.secrets.backup",
|
|
44
|
+
infraKey: "core",
|
|
45
|
+
targetEnv: env,
|
|
46
|
+
allowedTeams,
|
|
47
|
+
selfHosted: options.selfHosted === true,
|
|
48
|
+
keepLog: options.removeLog !== true,
|
|
49
|
+
flowGates: {
|
|
50
|
+
secrets: true,
|
|
51
|
+
},
|
|
52
|
+
payload: {}
|
|
53
|
+
}, {
|
|
54
|
+
status: options.status === true,
|
|
55
|
+
log: "show",
|
|
56
|
+
});
|
|
57
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { backupGithubSecretsCommand } from "./backup.js";
|
|
2
|
+
import { getResolvedOptions } from "../../../../cli/resolveOptions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Register:
|
|
5
|
+
* viza github secrets backup
|
|
6
|
+
*/
|
|
7
|
+
export function registerGithubSecretsBackupCommand(program) {
|
|
8
|
+
program
|
|
9
|
+
.command("backup")
|
|
10
|
+
.description("Backup GitHub secrets and environment variables to AWS SSM")
|
|
11
|
+
.option("--prod", "Use production environment")
|
|
12
|
+
.option("--dev", "Use development environment")
|
|
13
|
+
.action(async (_opts, command) => {
|
|
14
|
+
const fullOpts = getResolvedOptions(command);
|
|
15
|
+
await backupGithubSecretsCommand(fullOpts);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerGithubSecretsBackupCommand } from "./backup/register.js";
|
|
2
|
+
import { registerGithubSecretsRestoreCommand } from "./restore/register.js";
|
|
3
|
+
export function registerGithubSecretsCommand(github) {
|
|
4
|
+
const secrets = github
|
|
5
|
+
.command("secrets")
|
|
6
|
+
.description("GitHub secrets management");
|
|
7
|
+
registerGithubSecretsBackupCommand(secrets);
|
|
8
|
+
registerGithubSecretsRestoreCommand(secrets);
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { restoreGithubSecretsCommand } from "./restore.js";
|
|
2
|
+
import { getResolvedOptions } from "../../../../cli/resolveOptions.js";
|
|
3
|
+
/**
|
|
4
|
+
* Register:
|
|
5
|
+
* viza github secrets restore
|
|
6
|
+
*/
|
|
7
|
+
export function registerGithubSecretsRestoreCommand(program) {
|
|
8
|
+
program
|
|
9
|
+
.command("restore")
|
|
10
|
+
.description("Restore GitHub secrets and environment variables to AWS SSM")
|
|
11
|
+
.option("--prod", "Use production environment")
|
|
12
|
+
.option("--dev", "Use development environment")
|
|
13
|
+
.action(async (_opts, command) => {
|
|
14
|
+
const fullOpts = getResolvedOptions(command);
|
|
15
|
+
await restoreGithubSecretsCommand(fullOpts);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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-super"
|
|
12
|
+
],
|
|
13
|
+
"prod": [
|
|
14
|
+
"viza-super"
|
|
15
|
+
]
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* viza github secrets restore
|
|
19
|
+
*
|
|
20
|
+
* Flow:
|
|
21
|
+
* 1) Resolve env (deterministic)
|
|
22
|
+
* 2) Resolve user identity (trusted via gh auth)
|
|
23
|
+
* 3) CLI pre-check against target teams (fail-fast UX)
|
|
24
|
+
* 4) Derive ONE valid team (deterministic)
|
|
25
|
+
* 5) Dispatch frozen intent to gateway
|
|
26
|
+
*/
|
|
27
|
+
export async function restoreGithubSecretsCommand(options) {
|
|
28
|
+
// 1) Resolve environment
|
|
29
|
+
const env = resolveEnv(options);
|
|
30
|
+
const intent = resolveResourceHubIntent(env);
|
|
31
|
+
// Resolve allowed teams
|
|
32
|
+
// - Dispatch mode: restrict by targetEnv
|
|
33
|
+
// - Status mode: allow union of all env teams (read-only query)
|
|
34
|
+
const allowedTeams = options.status === true && env === "dev"
|
|
35
|
+
? Array.from(new Set([
|
|
36
|
+
...TARGET_TEAMS.dev,
|
|
37
|
+
...TARGET_TEAMS.prod,
|
|
38
|
+
]))
|
|
39
|
+
: TARGET_TEAMS[env];
|
|
40
|
+
// 5) Dispatch intent (freeze)
|
|
41
|
+
await dispatchIntentAndWait({
|
|
42
|
+
intent,
|
|
43
|
+
commandType: "github.secrets.restore",
|
|
44
|
+
infraKey: "core",
|
|
45
|
+
targetEnv: env,
|
|
46
|
+
allowedTeams,
|
|
47
|
+
selfHosted: options.selfHosted === true,
|
|
48
|
+
keepLog: options.removeLog !== true,
|
|
49
|
+
flowGates: {
|
|
50
|
+
secrets: true,
|
|
51
|
+
},
|
|
52
|
+
payload: {}
|
|
53
|
+
}, {
|
|
54
|
+
status: options.status === true,
|
|
55
|
+
log: "show",
|
|
56
|
+
});
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viza",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Viza unified command line interface",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"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"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@vizamodo/viza-dispatcher": "^1.5.
|
|
20
|
+
"@vizamodo/viza-dispatcher": "^1.5.19",
|
|
21
21
|
"adm-zip": "^0.5.16",
|
|
22
22
|
"chalk": "^5.6.2",
|
|
23
23
|
"clipboardy": "^5.3.1",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/adm-zip": "^0.5.7",
|
|
31
31
|
"@types/figlet": "^1.7.0",
|
|
32
|
-
"@types/node": "^25.
|
|
32
|
+
"@types/node": "^25.4.0",
|
|
33
33
|
"@types/prompts": "^2.4.9",
|
|
34
34
|
"ts-node": "^10.9.2",
|
|
35
35
|
"typescript": "^5.9.3"
|