periderm-cli 0.1.19 → 0.1.20
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/index.js +31 -6
- package/dist/update-notifier.js +16 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -175,13 +175,38 @@ program
|
|
|
175
175
|
}
|
|
176
176
|
else {
|
|
177
177
|
uploadSpinner.succeed(`Uploaded! View it at: ${chalk.underline.blue(`${cfg.apiUrl}/dashboard/scans/${res.id ?? ""}`)}`);
|
|
178
|
+
const username = os.userInfo().username;
|
|
179
|
+
const hostname = os.hostname();
|
|
180
|
+
const header = `${username}@${hostname}`;
|
|
181
|
+
const formatEmail = v.email || v.user_id || "Unknown";
|
|
182
|
+
const formatPlan = v.plan || "starter";
|
|
183
|
+
let formatQuota = "Unlimited";
|
|
184
|
+
let remainingNum = Infinity;
|
|
178
185
|
if (v.plan !== "unlimited" && v.scans_remaining !== undefined) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
186
|
+
remainingNum = Math.max(0, v.scans_remaining - 1);
|
|
187
|
+
formatQuota = `${remainingNum} scans`;
|
|
188
|
+
}
|
|
189
|
+
const actualLogoLines = PERIDERM_ASCII.split("\n");
|
|
190
|
+
console.info("");
|
|
191
|
+
for (const line of actualLogoLines) {
|
|
192
|
+
console.info(chalk.hex("#FF4D00")(line));
|
|
193
|
+
}
|
|
194
|
+
console.info("");
|
|
195
|
+
console.info(chalk.bold.cyan(header));
|
|
196
|
+
console.info(chalk.white("─".repeat(header.length)));
|
|
197
|
+
console.info("");
|
|
198
|
+
console.info(chalk.bold.white("Account : ") + chalk.white(formatEmail));
|
|
199
|
+
console.info(chalk.bold.white("Plan : ") + chalk.magenta(formatPlan));
|
|
200
|
+
console.info(chalk.bold.white("Quota : ") + chalk.yellow(formatQuota));
|
|
201
|
+
console.info("");
|
|
202
|
+
console.info(chalk.bold.white("[Next Steps]"));
|
|
203
|
+
console.info(chalk.white(" 1. Run AI Review ") + chalk.hex("#FF4D00")("$ periderm review --deep"));
|
|
204
|
+
console.info(chalk.white(" 2. Local only ") + chalk.hex("#FF4D00")("$ periderm scan --local-only"));
|
|
205
|
+
console.info(chalk.white(" 3. Log out ") + chalk.hex("#FF4D00")("$ periderm logout"));
|
|
206
|
+
console.info("");
|
|
207
|
+
console.info(chalk.white("Need help? Visit ") + chalk.underline.cyan(`${cfg.apiUrl}/docs`) + chalk.white("\n"));
|
|
208
|
+
if (remainingNum <= 3 && v.plan !== "unlimited") {
|
|
209
|
+
console.info(chalk.yellow(`⚠ Almost exhausted! Renew or upgrade at `) + chalk.underline.cyan(`${cfg.apiUrl}/dashboard/billing`));
|
|
185
210
|
}
|
|
186
211
|
}
|
|
187
212
|
}
|
package/dist/update-notifier.js
CHANGED
|
@@ -3,7 +3,6 @@ import fs from "node:fs";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { readConfig } from "./config.js";
|
|
6
|
-
import { PERIDERM_ASCII } from "./constants.js";
|
|
7
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
7
|
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
9
8
|
export async function checkUpdate() {
|
|
@@ -28,19 +27,22 @@ export async function checkUpdate() {
|
|
|
28
27
|
const isUnix = process.platform !== "win32" && process.platform !== "android";
|
|
29
28
|
const npmCmd = isUnix ? `sudo npm install -g ${name}` : `npm install -g ${name}`;
|
|
30
29
|
const curlCmd = `curl -fsSL ${apiUrl}/install.sh | bash`;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
const title = `A new version of Periderm CLI is available: ${currentVersion} → ${latestVersion}`;
|
|
31
|
+
const textNpm = `Update via npm: ${npmCmd}`;
|
|
32
|
+
const textCurl = `Update via curl: ${curlCmd}`;
|
|
33
|
+
const width = Math.max(title.length, textNpm.length, textCurl.length) + 4;
|
|
34
|
+
const pad = (rawLen) => " ".repeat(Math.max(0, width - rawLen - 2));
|
|
35
|
+
const box = `
|
|
36
|
+
╭${"─".repeat(width)}╮
|
|
37
|
+
│${" ".repeat(width)}│
|
|
38
|
+
│ A new version of Periderm CLI is available: ${chalk.dim(currentVersion)} → ${chalk.green(latestVersion)}${pad(title.length)}│
|
|
39
|
+
│${" ".repeat(width)}│
|
|
40
|
+
│ Update via npm: ${chalk.cyan(npmCmd)}${pad(textNpm.length)}│
|
|
41
|
+
│ Update via curl: ${chalk.cyan(curlCmd)}${pad(textCurl.length)}│
|
|
42
|
+
│${" ".repeat(width)}│
|
|
43
|
+
╰${"─".repeat(width)}╯
|
|
44
|
+
`;
|
|
45
|
+
console.log(box);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
catch (e) {
|