pax8-cta 0.1.0
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/LICENSE +200 -0
- package/README.md +659 -0
- package/demo-data/solutions/ProductQADemo_1_0_0_2_managed.zip +0 -0
- package/dist/commands/analyze.d.ts +28 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +571 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/auth.d.ts +18 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +171 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/config.d.ts +34 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +299 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/demo.d.ts +33 -0
- package/dist/commands/demo.d.ts.map +1 -0
- package/dist/commands/demo.js +362 -0
- package/dist/commands/demo.js.map +1 -0
- package/dist/commands/deploy.d.ts +18 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +1186 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/deployments/helpers.d.ts +68 -0
- package/dist/commands/deployments/helpers.d.ts.map +1 -0
- package/dist/commands/deployments/helpers.js +414 -0
- package/dist/commands/deployments/helpers.js.map +1 -0
- package/dist/commands/deployments/index.d.ts +24 -0
- package/dist/commands/deployments/index.d.ts.map +1 -0
- package/dist/commands/deployments/index.js +47 -0
- package/dist/commands/deployments/index.js.map +1 -0
- package/dist/commands/deployments/list.d.ts +18 -0
- package/dist/commands/deployments/list.d.ts.map +1 -0
- package/dist/commands/deployments/list.js +97 -0
- package/dist/commands/deployments/list.js.map +1 -0
- package/dist/commands/deployments/show.d.ts +18 -0
- package/dist/commands/deployments/show.d.ts.map +1 -0
- package/dist/commands/deployments/show.js +81 -0
- package/dist/commands/deployments/show.js.map +1 -0
- package/dist/commands/deployments/undo.d.ts +18 -0
- package/dist/commands/deployments/undo.d.ts.map +1 -0
- package/dist/commands/deployments/undo.js +295 -0
- package/dist/commands/deployments/undo.js.map +1 -0
- package/dist/commands/export.d.ts +18 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +133 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/import.d.ts +18 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +129 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init-config.d.ts +26 -0
- package/dist/commands/init-config.d.ts.map +1 -0
- package/dist/commands/init-config.js +123 -0
- package/dist/commands/init-config.js.map +1 -0
- package/dist/commands/init-validation.d.ts +47 -0
- package/dist/commands/init-validation.d.ts.map +1 -0
- package/dist/commands/init-validation.js +339 -0
- package/dist/commands/init-validation.js.map +1 -0
- package/dist/commands/init-wizard.d.ts +25 -0
- package/dist/commands/init-wizard.d.ts.map +1 -0
- package/dist/commands/init-wizard.js +433 -0
- package/dist/commands/init-wizard.js.map +1 -0
- package/dist/commands/init.d.ts +18 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +46 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/resolve-url.d.ts +18 -0
- package/dist/commands/resolve-url.d.ts.map +1 -0
- package/dist/commands/resolve-url.js +126 -0
- package/dist/commands/resolve-url.js.map +1 -0
- package/dist/commands/setup.d.ts +18 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +239 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/solutions/drift-analysis.d.ts +73 -0
- package/dist/commands/solutions/drift-analysis.d.ts.map +1 -0
- package/dist/commands/solutions/drift-analysis.js +416 -0
- package/dist/commands/solutions/drift-analysis.js.map +1 -0
- package/dist/commands/solutions/drift.d.ts +32 -0
- package/dist/commands/solutions/drift.d.ts.map +1 -0
- package/dist/commands/solutions/drift.js +641 -0
- package/dist/commands/solutions/drift.js.map +1 -0
- package/dist/commands/solutions/fix-planner.d.ts +48 -0
- package/dist/commands/solutions/fix-planner.d.ts.map +1 -0
- package/dist/commands/solutions/fix-planner.js +43 -0
- package/dist/commands/solutions/fix-planner.js.map +1 -0
- package/dist/commands/solutions/helpers.d.ts +35 -0
- package/dist/commands/solutions/helpers.d.ts.map +1 -0
- package/dist/commands/solutions/helpers.js +54 -0
- package/dist/commands/solutions/helpers.js.map +1 -0
- package/dist/commands/solutions/index.d.ts +18 -0
- package/dist/commands/solutions/index.d.ts.map +1 -0
- package/dist/commands/solutions/index.js +30 -0
- package/dist/commands/solutions/index.js.map +1 -0
- package/dist/commands/solutions/list.d.ts +18 -0
- package/dist/commands/solutions/list.d.ts.map +1 -0
- package/dist/commands/solutions/list.js +174 -0
- package/dist/commands/solutions/list.js.map +1 -0
- package/dist/commands/solutions/remove.d.ts +18 -0
- package/dist/commands/solutions/remove.d.ts.map +1 -0
- package/dist/commands/solutions/remove.js +137 -0
- package/dist/commands/solutions/remove.js.map +1 -0
- package/dist/commands/solutions/risk-calculator.d.ts +33 -0
- package/dist/commands/solutions/risk-calculator.d.ts.map +1 -0
- package/dist/commands/solutions/risk-calculator.js +79 -0
- package/dist/commands/solutions/risk-calculator.js.map +1 -0
- package/dist/commands/solutions/show.d.ts +18 -0
- package/dist/commands/solutions/show.d.ts.map +1 -0
- package/dist/commands/solutions/show.js +165 -0
- package/dist/commands/solutions/show.js.map +1 -0
- package/dist/commands/status.d.ts +18 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +573 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/telemetry.d.ts +18 -0
- package/dist/commands/telemetry.d.ts.map +1 -0
- package/dist/commands/telemetry.js +85 -0
- package/dist/commands/telemetry.js.map +1 -0
- package/dist/commands/tenants/health.d.ts +18 -0
- package/dist/commands/tenants/health.d.ts.map +1 -0
- package/dist/commands/tenants/health.js +172 -0
- package/dist/commands/tenants/health.js.map +1 -0
- package/dist/commands/tenants/helpers.d.ts +44 -0
- package/dist/commands/tenants/helpers.d.ts.map +1 -0
- package/dist/commands/tenants/helpers.js +72 -0
- package/dist/commands/tenants/helpers.js.map +1 -0
- package/dist/commands/tenants/index.d.ts +19 -0
- package/dist/commands/tenants/index.d.ts.map +1 -0
- package/dist/commands/tenants/index.js +39 -0
- package/dist/commands/tenants/index.js.map +1 -0
- package/dist/commands/tenants/inspect.d.ts +18 -0
- package/dist/commands/tenants/inspect.d.ts.map +1 -0
- package/dist/commands/tenants/inspect.js +176 -0
- package/dist/commands/tenants/inspect.js.map +1 -0
- package/dist/commands/tenants/list.d.ts +18 -0
- package/dist/commands/tenants/list.d.ts.map +1 -0
- package/dist/commands/tenants/list.js +144 -0
- package/dist/commands/tenants/list.js.map +1 -0
- package/dist/commands/tenants/manage.d.ts +20 -0
- package/dist/commands/tenants/manage.d.ts.map +1 -0
- package/dist/commands/tenants/manage.js +206 -0
- package/dist/commands/tenants/manage.js.map +1 -0
- package/dist/commands/tenants/show.d.ts +18 -0
- package/dist/commands/tenants/show.d.ts.map +1 -0
- package/dist/commands/tenants/show.js +191 -0
- package/dist/commands/tenants/show.js.map +1 -0
- package/dist/commands/validate.d.ts +18 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +536 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +258 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/auth.d.ts +51 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +153 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/banner.d.ts +19 -0
- package/dist/lib/banner.d.ts.map +1 -0
- package/dist/lib/banner.js +78 -0
- package/dist/lib/banner.js.map +1 -0
- package/dist/lib/command-wrapper.d.ts +56 -0
- package/dist/lib/command-wrapper.d.ts.map +1 -0
- package/dist/lib/command-wrapper.js +71 -0
- package/dist/lib/command-wrapper.js.map +1 -0
- package/dist/lib/credentials.d.ts +56 -0
- package/dist/lib/credentials.d.ts.map +1 -0
- package/dist/lib/credentials.js +146 -0
- package/dist/lib/credentials.js.map +1 -0
- package/dist/lib/demo-banner.d.ts +15 -0
- package/dist/lib/demo-banner.d.ts.map +1 -0
- package/dist/lib/demo-banner.js +33 -0
- package/dist/lib/demo-banner.js.map +1 -0
- package/dist/lib/error-handler.d.ts +51 -0
- package/dist/lib/error-handler.d.ts.map +1 -0
- package/dist/lib/error-handler.js +458 -0
- package/dist/lib/error-handler.js.map +1 -0
- package/dist/lib/errors.d.ts +61 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +168 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/formatters.d.ts +55 -0
- package/dist/lib/formatters.d.ts.map +1 -0
- package/dist/lib/formatters.js +163 -0
- package/dist/lib/formatters.js.map +1 -0
- package/dist/lib/graph-client.d.ts +74 -0
- package/dist/lib/graph-client.d.ts.map +1 -0
- package/dist/lib/graph-client.js +231 -0
- package/dist/lib/graph-client.js.map +1 -0
- package/dist/lib/input.d.ts +22 -0
- package/dist/lib/input.d.ts.map +1 -0
- package/dist/lib/input.js +120 -0
- package/dist/lib/input.js.map +1 -0
- package/dist/lib/interactive-wizard.d.ts +26 -0
- package/dist/lib/interactive-wizard.d.ts.map +1 -0
- package/dist/lib/interactive-wizard.js +550 -0
- package/dist/lib/interactive-wizard.js.map +1 -0
- package/dist/lib/oss-surface.d.ts +21 -0
- package/dist/lib/oss-surface.d.ts.map +1 -0
- package/dist/lib/oss-surface.js +29 -0
- package/dist/lib/oss-surface.js.map +1 -0
- package/dist/lib/output.d.ts +74 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +156 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/picker.d.ts +75 -0
- package/dist/lib/picker.d.ts.map +1 -0
- package/dist/lib/picker.js +115 -0
- package/dist/lib/picker.js.map +1 -0
- package/dist/lib/repl.d.ts +19 -0
- package/dist/lib/repl.d.ts.map +1 -0
- package/dist/lib/repl.js +158 -0
- package/dist/lib/repl.js.map +1 -0
- package/dist/lib/spinner.d.ts +41 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/dist/lib/spinner.js +126 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/telemetry.d.ts +96 -0
- package/dist/lib/telemetry.d.ts.map +1 -0
- package/dist/lib/telemetry.js +367 -0
- package/dist/lib/telemetry.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024 Pax8, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Command } from "commander";
|
|
17
|
+
import chalk from "chalk";
|
|
18
|
+
import inquirer from "inquirer";
|
|
19
|
+
import { storeSecret, deleteSecret, getStoredSecret } from "../lib/credentials.js";
|
|
20
|
+
import { handleCommandError } from "../lib/errors.js";
|
|
21
|
+
export const authCommand = new Command("auth")
|
|
22
|
+
.description("Store or remove your client secret in the OS keychain")
|
|
23
|
+
.addHelpText("after", `
|
|
24
|
+
Examples:
|
|
25
|
+
auth login Store client secret in OS keychain
|
|
26
|
+
auth logout Remove stored credentials
|
|
27
|
+
auth status Check authentication status
|
|
28
|
+
`);
|
|
29
|
+
// Login subcommand
|
|
30
|
+
authCommand
|
|
31
|
+
.command("login")
|
|
32
|
+
.description("Store client secret securely in OS keychain")
|
|
33
|
+
.action(async () => {
|
|
34
|
+
console.log(chalk.cyan.bold("\n🔐 Pax8 CTA Login\n"));
|
|
35
|
+
console.log(chalk.gray("Your client secret will be stored securely in your OS keychain.\n"));
|
|
36
|
+
try {
|
|
37
|
+
const answers = await inquirer.prompt([
|
|
38
|
+
{
|
|
39
|
+
type: "password",
|
|
40
|
+
name: "secret",
|
|
41
|
+
message: "Enter your client secret:",
|
|
42
|
+
mask: "*",
|
|
43
|
+
validate: (input) => {
|
|
44
|
+
if (!input || input.trim().length === 0) {
|
|
45
|
+
return "Client secret cannot be empty";
|
|
46
|
+
}
|
|
47
|
+
if (input.trim().length < 10) {
|
|
48
|
+
return "Client secret seems too short. Please verify.";
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
type: "confirm",
|
|
55
|
+
name: "confirm",
|
|
56
|
+
message: "Save this secret to your OS keychain?",
|
|
57
|
+
default: true,
|
|
58
|
+
},
|
|
59
|
+
]);
|
|
60
|
+
if (!answers.confirm) {
|
|
61
|
+
console.log(chalk.yellow("\n✖ Login cancelled"));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
await storeSecret(answers.secret.trim());
|
|
65
|
+
console.log(chalk.green("\n✓ Client secret stored securely!"));
|
|
66
|
+
console.log();
|
|
67
|
+
console.log(chalk.gray("Your secret is now stored in your OS keychain and will be"));
|
|
68
|
+
console.log(chalk.gray("used automatically by Pax8 CTA commands."));
|
|
69
|
+
console.log();
|
|
70
|
+
console.log(chalk.cyan("Next steps:"));
|
|
71
|
+
console.log(chalk.white(" auth status ") + chalk.dim("# Verify credentials"));
|
|
72
|
+
console.log(chalk.white(" tenants list ") + chalk.dim("# Test authentication"));
|
|
73
|
+
console.log();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
handleCommandError(error, null, "Failed to store secret");
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
// Logout subcommand
|
|
80
|
+
authCommand
|
|
81
|
+
.command("logout")
|
|
82
|
+
.description("Remove stored credentials from OS keychain")
|
|
83
|
+
.action(async () => {
|
|
84
|
+
console.log(chalk.cyan.bold("\n🔓 Pax8 CTA Logout\n"));
|
|
85
|
+
try {
|
|
86
|
+
const existingSecret = await getStoredSecret();
|
|
87
|
+
if (!existingSecret) {
|
|
88
|
+
console.log(chalk.yellow("No credentials found in keychain."));
|
|
89
|
+
console.log();
|
|
90
|
+
console.log(chalk.gray("To store credentials, use: auth login"));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const answers = await inquirer.prompt([
|
|
94
|
+
{
|
|
95
|
+
type: "confirm",
|
|
96
|
+
name: "confirm",
|
|
97
|
+
message: "Remove stored credentials from keychain?",
|
|
98
|
+
default: false,
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
if (!answers.confirm) {
|
|
102
|
+
console.log(chalk.yellow("\n✖ Logout cancelled"));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
await deleteSecret();
|
|
106
|
+
console.log(chalk.green("\n✓ Credentials removed from keychain"));
|
|
107
|
+
console.log();
|
|
108
|
+
console.log(chalk.gray("You can still use environment variables for authentication:"));
|
|
109
|
+
console.log(chalk.white(' export PARTNER_CLIENT_SECRET="your-secret"'));
|
|
110
|
+
console.log();
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
handleCommandError(error, null, "Failed to remove credentials");
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
// Status subcommand
|
|
117
|
+
authCommand
|
|
118
|
+
.command("status")
|
|
119
|
+
.description("Show authentication status")
|
|
120
|
+
.action(async () => {
|
|
121
|
+
console.log(chalk.cyan.bold("\n🔍 Authentication Status\n"));
|
|
122
|
+
try {
|
|
123
|
+
// Check both possible environment variable names
|
|
124
|
+
const envVars = ["PARTNER_CLIENT_SECRET", "PAX8_CTA_CLIENT_SECRET"];
|
|
125
|
+
const foundEnvVars = envVars.filter((v) => !!process.env[v]);
|
|
126
|
+
const hasEnvVar = foundEnvVars.length > 0;
|
|
127
|
+
const keychainSecret = await getStoredSecret();
|
|
128
|
+
const hasKeychain = !!keychainSecret;
|
|
129
|
+
if (hasEnvVar) {
|
|
130
|
+
console.log(chalk.green("✓ Environment Variable"));
|
|
131
|
+
for (const envVar of foundEnvVars) {
|
|
132
|
+
console.log(chalk.gray(` ${envVar} is set`));
|
|
133
|
+
}
|
|
134
|
+
console.log(chalk.gray(" Priority: PRIMARY (environment variables take precedence)"));
|
|
135
|
+
console.log();
|
|
136
|
+
}
|
|
137
|
+
if (hasKeychain) {
|
|
138
|
+
console.log(chalk.green("✓ OS Keychain"));
|
|
139
|
+
console.log(chalk.gray(" Client secret stored in secure keychain"));
|
|
140
|
+
if (hasEnvVar) {
|
|
141
|
+
console.log(chalk.gray(" Priority: SECONDARY (used as fallback)"));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
console.log(chalk.gray(" Priority: PRIMARY (will be used for authentication)"));
|
|
145
|
+
}
|
|
146
|
+
console.log();
|
|
147
|
+
}
|
|
148
|
+
if (!hasEnvVar && !hasKeychain) {
|
|
149
|
+
console.log(chalk.yellow("⚠ No Credentials Found"));
|
|
150
|
+
console.log();
|
|
151
|
+
console.log(chalk.gray("You can authenticate using either method:"));
|
|
152
|
+
console.log();
|
|
153
|
+
console.log(chalk.cyan("Option 1: OS Keychain (Recommended)"));
|
|
154
|
+
console.log(chalk.white(" auth login"));
|
|
155
|
+
console.log();
|
|
156
|
+
console.log(chalk.cyan("Option 2: Environment Variable"));
|
|
157
|
+
console.log(chalk.white(' export PARTNER_CLIENT_SECRET="your-secret"'));
|
|
158
|
+
console.log();
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
console.log(chalk.gray("Authentication method priority:"));
|
|
162
|
+
console.log(chalk.gray(" 1. Environment variable (PARTNER_CLIENT_SECRET or PAX8_CTA_CLIENT_SECRET)"));
|
|
163
|
+
console.log(chalk.gray(" 2. OS keychain (fallback)"));
|
|
164
|
+
console.log();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
handleCommandError(error, null, "Failed to check authentication status");
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,uDAAuD,CAAC;KACpE,WAAW,CACV,OAAO,EACP;;;;;CAKH,CACE,CAAC;AAEJ,mBAAmB;AACnB,WAAW;KACR,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,6CAA6C,CAAC;KAC1D,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC,CAAC;IAE7F,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YACpC;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,2BAA2B;gBACpC,IAAI,EAAE,GAAG;gBACT,QAAQ,EAAE,CAAC,KAAa,EAAE,EAA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ACzE,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAC1F,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,CAAC;YACvD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,uCAAuC,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024 Pax8, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* `pax8-cta config` — print a structured report of the CLI's effective
|
|
18
|
+
* settings without ever revealing secret values. Probes:
|
|
19
|
+
* - demo mode (env vs config file)
|
|
20
|
+
* - default output format (TTY / piped / forced)
|
|
21
|
+
* - quiet mode
|
|
22
|
+
* - credential presence (env vars + OS keychain) — never the value
|
|
23
|
+
* - telemetry status and where the disabled signal comes from
|
|
24
|
+
* - tenants config file path, parse status, and counts
|
|
25
|
+
* - filesystem paths the CLI reads/writes
|
|
26
|
+
*
|
|
27
|
+
* Honors `--quiet`, `--json`, and the TTY-default-JSON convention via
|
|
28
|
+
* `resolveFormat()` so it composes with the rest of the CLI.
|
|
29
|
+
*
|
|
30
|
+
* See issue #309 for context.
|
|
31
|
+
*/
|
|
32
|
+
import { Command } from "commander";
|
|
33
|
+
export declare const configCommand: Command;
|
|
34
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyTpC,eAAO,MAAM,aAAa,SAmDtB,CAAC"}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024 Pax8, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* `pax8-cta config` — print a structured report of the CLI's effective
|
|
18
|
+
* settings without ever revealing secret values. Probes:
|
|
19
|
+
* - demo mode (env vs config file)
|
|
20
|
+
* - default output format (TTY / piped / forced)
|
|
21
|
+
* - quiet mode
|
|
22
|
+
* - credential presence (env vars + OS keychain) — never the value
|
|
23
|
+
* - telemetry status and where the disabled signal comes from
|
|
24
|
+
* - tenants config file path, parse status, and counts
|
|
25
|
+
* - filesystem paths the CLI reads/writes
|
|
26
|
+
*
|
|
27
|
+
* Honors `--quiet`, `--json`, and the TTY-default-JSON convention via
|
|
28
|
+
* `resolveFormat()` so it composes with the rest of the CLI.
|
|
29
|
+
*
|
|
30
|
+
* See issue #309 for context.
|
|
31
|
+
*/
|
|
32
|
+
import { Command } from "commander";
|
|
33
|
+
import chalk from "chalk";
|
|
34
|
+
import { resolve } from "node:path";
|
|
35
|
+
import { existsSync } from "node:fs";
|
|
36
|
+
import { homedir } from "node:os";
|
|
37
|
+
import { join } from "node:path";
|
|
38
|
+
import { loadConfig } from "@pax8-cta/core";
|
|
39
|
+
import { resolveFormat } from "../lib/output.js";
|
|
40
|
+
import { isDemoModeEnabled } from "./demo.js";
|
|
41
|
+
import { probeStoredSecret } from "../lib/credentials.js";
|
|
42
|
+
import { isTelemetryEnabled, getTelemetryConfigPath, getTelemetryDisabledSource, } from "../lib/telemetry.js";
|
|
43
|
+
import { handleCommandError } from "../lib/errors.js";
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// Probes
|
|
46
|
+
// ============================================================================
|
|
47
|
+
function probeDemoMode() {
|
|
48
|
+
const envVar = process.env.DEMO_MODE;
|
|
49
|
+
if (envVar === "true" || envVar === "1") {
|
|
50
|
+
return { enabled: true, source: "env" };
|
|
51
|
+
}
|
|
52
|
+
if (envVar === "false" || envVar === "0" || envVar === "") {
|
|
53
|
+
return { enabled: false, source: "env" };
|
|
54
|
+
}
|
|
55
|
+
// No env override: read the persisted config-file state via the canonical helper.
|
|
56
|
+
const enabled = isDemoModeEnabled();
|
|
57
|
+
return { enabled, source: enabled ? "config" : "default" };
|
|
58
|
+
}
|
|
59
|
+
function probeDefaultFormat() {
|
|
60
|
+
// The CLI entry point sets PAX8_CTA_DEFAULT_FORMAT based on isTTY when invoked
|
|
61
|
+
// as a subprocess. If a user has set it explicitly in their shell, treat that
|
|
62
|
+
// as the source.
|
|
63
|
+
const envForced = process.env.PAX8_CTA_DEFAULT_FORMAT;
|
|
64
|
+
if (envForced === "table" || envForced === "json") {
|
|
65
|
+
// Distinguish "the CLI entry set this from isTTY" vs "user set this explicitly"
|
|
66
|
+
// by checking process.stdout.isTTY against the value. If they agree, attribute
|
|
67
|
+
// to TTY/piped; if they disagree, attribute to env.
|
|
68
|
+
const ttyExpected = process.stdout.isTTY ? "table" : "json";
|
|
69
|
+
if (envForced !== ttyExpected) {
|
|
70
|
+
return { effective: envForced, source: "env" };
|
|
71
|
+
}
|
|
72
|
+
return { effective: envForced, source: process.stdout.isTTY ? "tty" : "piped" };
|
|
73
|
+
}
|
|
74
|
+
// Fallback (ran in-process / odd env): default to table.
|
|
75
|
+
return { effective: "table", source: process.stdout.isTTY ? "tty" : "piped" };
|
|
76
|
+
}
|
|
77
|
+
function probeQuietMode(opts) {
|
|
78
|
+
if (opts.quiet)
|
|
79
|
+
return { enabled: true, source: "flag" };
|
|
80
|
+
if (process.env.PAX8_CTA_QUIET === "1" || process.env.PAX8_CTA_QUIET === "true") {
|
|
81
|
+
return { enabled: true, source: "env" };
|
|
82
|
+
}
|
|
83
|
+
return { enabled: false, source: null };
|
|
84
|
+
}
|
|
85
|
+
async function probeCredentials() {
|
|
86
|
+
const partnerEnv = process.env.PARTNER_CLIENT_SECRET ? "set" : "not-set";
|
|
87
|
+
const pax8CtaEnv = process.env.PAX8_CTA_CLIENT_SECRET ? "set" : "not-set";
|
|
88
|
+
const keychain = await probeStoredSecret();
|
|
89
|
+
let effectiveSource;
|
|
90
|
+
if (partnerEnv === "set" || pax8CtaEnv === "set") {
|
|
91
|
+
effectiveSource = "env";
|
|
92
|
+
}
|
|
93
|
+
else if (keychain === "set") {
|
|
94
|
+
effectiveSource = "keychain";
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
effectiveSource = "none";
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
partnerClientSecretEnv: partnerEnv,
|
|
101
|
+
pax8CtaClientSecretEnv: pax8CtaEnv,
|
|
102
|
+
osKeychain: keychain,
|
|
103
|
+
effectiveSource,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function probeTelemetry() {
|
|
107
|
+
return {
|
|
108
|
+
enabled: isTelemetryEnabled(),
|
|
109
|
+
disabledSource: getTelemetryDisabledSource(),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
async function probeTenantsConfig(configPath) {
|
|
113
|
+
const absolute = resolve(process.cwd(), configPath);
|
|
114
|
+
if (!existsSync(absolute)) {
|
|
115
|
+
return {
|
|
116
|
+
path: absolute,
|
|
117
|
+
status: "not-found",
|
|
118
|
+
sourceEnvironmentUrl: null,
|
|
119
|
+
total: 0,
|
|
120
|
+
enabled: 0,
|
|
121
|
+
disabled: 0,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const cfg = await loadConfig(absolute);
|
|
126
|
+
const total = cfg.tenants.length;
|
|
127
|
+
const enabled = cfg.tenants.filter((t) => t.enabled).length;
|
|
128
|
+
return {
|
|
129
|
+
path: absolute,
|
|
130
|
+
status: "found",
|
|
131
|
+
sourceEnvironmentUrl: cfg.source?.environmentUrl ?? null,
|
|
132
|
+
total,
|
|
133
|
+
enabled,
|
|
134
|
+
disabled: total - enabled,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
return {
|
|
139
|
+
path: absolute,
|
|
140
|
+
status: "parse-error",
|
|
141
|
+
sourceEnvironmentUrl: null,
|
|
142
|
+
total: 0,
|
|
143
|
+
enabled: 0,
|
|
144
|
+
disabled: 0,
|
|
145
|
+
parseError: err instanceof Error ? err.message : String(err),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function probePaths(configPath) {
|
|
150
|
+
return {
|
|
151
|
+
cliConfig: join(homedir(), ".pax8-cta", "cli-config.json"),
|
|
152
|
+
telemetryConfig: getTelemetryConfigPath(),
|
|
153
|
+
projectConfig: resolve(process.cwd(), configPath),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
// ============================================================================
|
|
157
|
+
// Renderers
|
|
158
|
+
// ============================================================================
|
|
159
|
+
function describeFormat(f) {
|
|
160
|
+
const sourceText = f.source === "tty"
|
|
161
|
+
? "TTY"
|
|
162
|
+
: f.source === "piped"
|
|
163
|
+
? "piped (non-TTY)"
|
|
164
|
+
: "PAX8_CTA_DEFAULT_FORMAT env";
|
|
165
|
+
return `${f.effective} (${sourceText})`;
|
|
166
|
+
}
|
|
167
|
+
function describeDemo(d) {
|
|
168
|
+
const state = d.enabled ? chalk.green("ENABLED") : chalk.gray("DISABLED");
|
|
169
|
+
const sourceText = d.source === "env" ? "DEMO_MODE env" : d.source === "config" ? "config file" : "default";
|
|
170
|
+
return `${state} (${sourceText})`;
|
|
171
|
+
}
|
|
172
|
+
function describeQuiet(q) {
|
|
173
|
+
if (!q.enabled)
|
|
174
|
+
return chalk.gray("off");
|
|
175
|
+
return `${chalk.yellow("on")} (${q.source === "flag" ? "--quiet" : "PAX8_CTA_QUIET env"})`;
|
|
176
|
+
}
|
|
177
|
+
function describeKeychain(s) {
|
|
178
|
+
if (s === "set")
|
|
179
|
+
return chalk.green("set");
|
|
180
|
+
if (s === "not-set")
|
|
181
|
+
return chalk.gray("not set");
|
|
182
|
+
return chalk.gray("unavailable");
|
|
183
|
+
}
|
|
184
|
+
function describeEffectiveCredSource(s) {
|
|
185
|
+
if (s === "env")
|
|
186
|
+
return chalk.green("env");
|
|
187
|
+
if (s === "keychain")
|
|
188
|
+
return chalk.green("keychain");
|
|
189
|
+
return chalk.yellow("none");
|
|
190
|
+
}
|
|
191
|
+
function describeTelemetry(t) {
|
|
192
|
+
if (t.enabled)
|
|
193
|
+
return chalk.green("enabled");
|
|
194
|
+
const reason = t.disabledSource ?? "config";
|
|
195
|
+
const reasonText = reason === "env"
|
|
196
|
+
? "PAX8_CTA_TELEMETRY_DISABLED"
|
|
197
|
+
: reason === "do-not-track"
|
|
198
|
+
? "DO_NOT_TRACK"
|
|
199
|
+
: reason === "ci"
|
|
200
|
+
? "CI env"
|
|
201
|
+
: reason === "no-key"
|
|
202
|
+
? "no PostHog key"
|
|
203
|
+
: "config";
|
|
204
|
+
return `${chalk.yellow("disabled")} (source: ${reasonText})`;
|
|
205
|
+
}
|
|
206
|
+
function describeTenantsStatus(t) {
|
|
207
|
+
if (t.status === "found") {
|
|
208
|
+
return chalk.green(`found (${t.total} tenants)`);
|
|
209
|
+
}
|
|
210
|
+
if (t.status === "not-found") {
|
|
211
|
+
return chalk.yellow("not found");
|
|
212
|
+
}
|
|
213
|
+
return chalk.red(`parse error: ${t.parseError ?? "unknown"}`);
|
|
214
|
+
}
|
|
215
|
+
function renderHumanReadable(report) {
|
|
216
|
+
console.log();
|
|
217
|
+
console.log(chalk.bold("Pax8 CTA Configuration"));
|
|
218
|
+
console.log();
|
|
219
|
+
console.log(` Demo mode: ${describeDemo(report.demoMode)}`);
|
|
220
|
+
console.log(` Default format: ${describeFormat(report.defaultFormat)}`);
|
|
221
|
+
console.log(` Quiet mode: ${describeQuiet(report.quietMode)}`);
|
|
222
|
+
console.log();
|
|
223
|
+
console.log(chalk.bold(" Credentials:"));
|
|
224
|
+
console.log(` PARTNER_CLIENT_SECRET (env): ${report.credentials.partnerClientSecretEnv === "set"
|
|
225
|
+
? chalk.green("set")
|
|
226
|
+
: chalk.gray("not set")}`);
|
|
227
|
+
console.log(` PAX8_CTA_CLIENT_SECRET (env): ${report.credentials.pax8CtaClientSecretEnv === "set"
|
|
228
|
+
? chalk.green("set")
|
|
229
|
+
: chalk.gray("not set")}`);
|
|
230
|
+
console.log(` OS keychain: ${describeKeychain(report.credentials.osKeychain)}`);
|
|
231
|
+
console.log(` Effective source: ${describeEffectiveCredSource(report.credentials.effectiveSource)}`);
|
|
232
|
+
console.log(` Telemetry: ${describeTelemetry(report.telemetry)}`);
|
|
233
|
+
console.log();
|
|
234
|
+
console.log(chalk.bold(" Config file:"));
|
|
235
|
+
console.log(` Path: ${report.tenantsConfig.path}`);
|
|
236
|
+
console.log(` Status: ${describeTenantsStatus(report.tenantsConfig)}`);
|
|
237
|
+
if (report.tenantsConfig.status === "found") {
|
|
238
|
+
const url = report.tenantsConfig.sourceEnvironmentUrl ?? chalk.gray("not set");
|
|
239
|
+
console.log(` Source env URL: ${url}`);
|
|
240
|
+
console.log(` Tenants: ${report.tenantsConfig.total} total, ${report.tenantsConfig.enabled} enabled, ${report.tenantsConfig.disabled} disabled`);
|
|
241
|
+
}
|
|
242
|
+
console.log();
|
|
243
|
+
console.log(chalk.bold(" Paths:"));
|
|
244
|
+
console.log(` CLI config: ${report.paths.cliConfig}`);
|
|
245
|
+
console.log(` Telemetry: ${report.paths.telemetryConfig}`);
|
|
246
|
+
console.log(` Project config: ${report.paths.projectConfig}`);
|
|
247
|
+
console.log();
|
|
248
|
+
}
|
|
249
|
+
// ============================================================================
|
|
250
|
+
// Command
|
|
251
|
+
// ============================================================================
|
|
252
|
+
export const configCommand = new Command("config")
|
|
253
|
+
.description("Show effective CLI configuration (demo mode, credentials, telemetry, paths)")
|
|
254
|
+
.option("-c, --config <path>", "Path to tenants config file", "./config/tenants.yaml")
|
|
255
|
+
.option("--json", "Output as JSON")
|
|
256
|
+
.option("--quiet", "Suppress all output")
|
|
257
|
+
.addHelpText("after", `
|
|
258
|
+
Examples:
|
|
259
|
+
config Human-readable report of effective settings
|
|
260
|
+
config --json Structured JSON for parsing/automation
|
|
261
|
+
config --json | jq .credentials Inspect a single section
|
|
262
|
+
|
|
263
|
+
Notes:
|
|
264
|
+
Secret values are NEVER printed — only "set" / "not set" status indicators.
|
|
265
|
+
`)
|
|
266
|
+
.action(async (options, cmd) => {
|
|
267
|
+
try {
|
|
268
|
+
const opts = { ...options, ...cmd.optsWithGlobals() };
|
|
269
|
+
const fmt = resolveFormat(opts);
|
|
270
|
+
const configPath = opts.config ?? "./config/tenants.yaml";
|
|
271
|
+
const [credentials, tenantsConfig] = await Promise.all([
|
|
272
|
+
probeCredentials(),
|
|
273
|
+
probeTenantsConfig(configPath),
|
|
274
|
+
]);
|
|
275
|
+
const report = {
|
|
276
|
+
demoMode: probeDemoMode(),
|
|
277
|
+
defaultFormat: probeDefaultFormat(),
|
|
278
|
+
quietMode: probeQuietMode(opts),
|
|
279
|
+
credentials,
|
|
280
|
+
telemetry: probeTelemetry(),
|
|
281
|
+
tenantsConfig,
|
|
282
|
+
paths: probePaths(configPath),
|
|
283
|
+
};
|
|
284
|
+
if (fmt === "quiet")
|
|
285
|
+
return;
|
|
286
|
+
if (fmt === "json") {
|
|
287
|
+
console.log(JSON.stringify(report, null, 2));
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
// table is the only remaining sensible format here; --ids-only is not
|
|
291
|
+
// meaningful for a single configuration record, so we render the human
|
|
292
|
+
// report for both "table" and any unexpected fallback.
|
|
293
|
+
renderHumanReadable(report);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
handleCommandError(error, null, "Failed to gather configuration");
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,O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;QACtD,MAAM,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAEhC,MAAM,UAAU,GAAW,IAAI,CAAC,MAAM,IAAI,uBAAuB,CAAC;QAElE,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACrD,gBAAgB,EAAE;YAClB,kBAAkB,CAAC,UAAU,CAAC;SAC/B,CAAC,CAAC;QAEH,MAAM,MAAM,GAAiB;YAC3B,QAAQ,EAAE,aAAa,EAAE;YACzB,aAAa,EAAE,kBAAkB,EAAE;YACnC,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC;YAC/B,WAAW;YACX,SAAS,EAAE,cAAc,EAAE;YAC3B,aAAa;YACb,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC;SAC9B,CAAC;QAEF,IAAI,GAAG,KAAK,OAAO;YAAE,OAAO;QAC5B,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAC7C,OAAO;QACT,CAAC;QACD,sEAAsE;QACtE,uEAAuE;QACvE,uDAAuD;QACvD,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,gCAAgC,CAAC,CAAC;IACpE,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2024 Pax8, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Command } from "commander";
|
|
17
|
+
import { type TenantConfig } from "@pax8-cta/core";
|
|
18
|
+
interface CliConfig {
|
|
19
|
+
demoMode?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function saveCliConfig(config: CliConfig): void;
|
|
22
|
+
export declare const demoCommand: Command;
|
|
23
|
+
export declare function isDemoModeEnabled(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get filtered demo tenants based on command options.
|
|
26
|
+
* Shared across analyze, deploy, and other commands that operate on tenant sets.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getDemoTenants(options: {
|
|
29
|
+
all?: boolean;
|
|
30
|
+
tag?: string[];
|
|
31
|
+
}): TenantConfig[];
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=demo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/commands/demo.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAoEjE,UAAU,SAAS;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAaD,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAKrD;AAED,eAAO,MAAM,WAAW,SAgGpB,CAAC;AAGL,wBAAgB,iBAAiB,IAAI,OAAO,CAiB3C;AAMD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,YAAY,EAAE,CAQzF"}
|