@aikidosec/safe-chain 1.4.3 → 1.4.4
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/bin/safe-chain.js +1 -81
- package/package.json +1 -1
package/bin/safe-chain.js
CHANGED
|
@@ -16,14 +16,6 @@ import path from "path";
|
|
|
16
16
|
import { fileURLToPath } from "url";
|
|
17
17
|
import fs from "fs";
|
|
18
18
|
import { knownAikidoTools } from "../src/shell-integration/helpers.js";
|
|
19
|
-
import {
|
|
20
|
-
installUltimate,
|
|
21
|
-
uninstallUltimate,
|
|
22
|
-
} from "../src/installation/installUltimate.js";
|
|
23
|
-
import {
|
|
24
|
-
printUltimateLogs,
|
|
25
|
-
troubleshootingExport,
|
|
26
|
-
} from "../src/ultimate/ultimateTroubleshooting.js";
|
|
27
19
|
|
|
28
20
|
/** @type {string} */
|
|
29
21
|
// This checks the current file's dirname in a way that's compatible with:
|
|
@@ -70,39 +62,6 @@ if (tool) {
|
|
|
70
62
|
process.exit(0);
|
|
71
63
|
} else if (command === "setup") {
|
|
72
64
|
setup();
|
|
73
|
-
} else if (command === "ultimate") {
|
|
74
|
-
const cliArgs = initializeCliArguments(process.argv.slice(2));
|
|
75
|
-
const subCommand = cliArgs[1];
|
|
76
|
-
if (subCommand === "uninstall") {
|
|
77
|
-
guardCliArgsMaxLenght(2, cliArgs, "safe-chain ultimate uninstall");
|
|
78
|
-
(async () => {
|
|
79
|
-
await uninstallUltimate();
|
|
80
|
-
})();
|
|
81
|
-
} else if (subCommand === "troubleshooting-logs") {
|
|
82
|
-
guardCliArgsMaxLenght(
|
|
83
|
-
2,
|
|
84
|
-
cliArgs,
|
|
85
|
-
"safe-chain ultimate troubleshooting-logs",
|
|
86
|
-
);
|
|
87
|
-
(async () => {
|
|
88
|
-
await printUltimateLogs();
|
|
89
|
-
})();
|
|
90
|
-
} else if (subCommand === "troubleshooting-export") {
|
|
91
|
-
guardCliArgsMaxLenght(
|
|
92
|
-
2,
|
|
93
|
-
cliArgs,
|
|
94
|
-
"safe-chain ultimate troubleshooting-export",
|
|
95
|
-
);
|
|
96
|
-
(async () => {
|
|
97
|
-
await troubleshootingExport();
|
|
98
|
-
})();
|
|
99
|
-
} else {
|
|
100
|
-
guardCliArgsMaxLenght(1, cliArgs, "safe-chain ultimate");
|
|
101
|
-
// Install command = when no subcommand is provided (safe-chain ultimate)
|
|
102
|
-
(async () => {
|
|
103
|
-
await installUltimate();
|
|
104
|
-
})();
|
|
105
|
-
}
|
|
106
65
|
} else if (command === "teardown") {
|
|
107
66
|
teardown();
|
|
108
67
|
teardownDirectories();
|
|
@@ -121,22 +80,6 @@ if (tool) {
|
|
|
121
80
|
process.exit(1);
|
|
122
81
|
}
|
|
123
82
|
|
|
124
|
-
/**
|
|
125
|
-
* @param {Number} maxLength
|
|
126
|
-
* @param {String[]} args
|
|
127
|
-
* @param {String} command
|
|
128
|
-
*/
|
|
129
|
-
function guardCliArgsMaxLenght(maxLength, args, command) {
|
|
130
|
-
if (args.length > maxLength) {
|
|
131
|
-
ui.writeError(`Unexpected number of arguments for command ${command}.`);
|
|
132
|
-
ui.emptyLine();
|
|
133
|
-
|
|
134
|
-
writeHelp();
|
|
135
|
-
|
|
136
|
-
process.exit(1);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
83
|
function writeHelp() {
|
|
141
84
|
ui.writeInformation(
|
|
142
85
|
chalk.bold("Usage: ") + chalk.cyan("safe-chain <command>"),
|
|
@@ -145,7 +88,7 @@ function writeHelp() {
|
|
|
145
88
|
ui.writeInformation(
|
|
146
89
|
`Available commands: ${chalk.cyan("setup")}, ${chalk.cyan(
|
|
147
90
|
"teardown",
|
|
148
|
-
)}, ${chalk.cyan("setup-ci")}, ${chalk.cyan("
|
|
91
|
+
)}, ${chalk.cyan("setup-ci")}, ${chalk.cyan("help")}, ${chalk.cyan(
|
|
149
92
|
"--version",
|
|
150
93
|
)}`,
|
|
151
94
|
);
|
|
@@ -171,29 +114,6 @@ function writeHelp() {
|
|
|
171
114
|
)}): Display the current version of safe-chain.`,
|
|
172
115
|
);
|
|
173
116
|
ui.emptyLine();
|
|
174
|
-
ui.writeInformation(chalk.bold("Ultimate commands:"));
|
|
175
|
-
ui.emptyLine();
|
|
176
|
-
ui.writeInformation(
|
|
177
|
-
`- ${chalk.cyan(
|
|
178
|
-
"safe-chain ultimate",
|
|
179
|
-
)}: Install the ultimate version of safe-chain, enabling protection for more eco-systems.`,
|
|
180
|
-
);
|
|
181
|
-
ui.writeInformation(
|
|
182
|
-
`- ${chalk.cyan(
|
|
183
|
-
"safe-chain ultimate troubleshooting-logs",
|
|
184
|
-
)}: Prints standard and error logs for safe-chain ultimate and it's proxy.`,
|
|
185
|
-
);
|
|
186
|
-
ui.writeInformation(
|
|
187
|
-
`- ${chalk.cyan(
|
|
188
|
-
"safe-chain ultimate troubleshooting-export",
|
|
189
|
-
)}: Creates a zip archive of useful data for troubleshooting safe-chain ultimate, that can be shared with our support team.`,
|
|
190
|
-
);
|
|
191
|
-
ui.writeInformation(
|
|
192
|
-
`- ${chalk.cyan(
|
|
193
|
-
"safe-chain ultimate uninstall",
|
|
194
|
-
)}: Uninstall the ultimate version of safe-chain.`,
|
|
195
|
-
);
|
|
196
|
-
ui.emptyLine();
|
|
197
117
|
}
|
|
198
118
|
|
|
199
119
|
async function getVersion() {
|
package/package.json
CHANGED