periderm-cli 0.1.47 → 0.1.49

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/api.js CHANGED
@@ -58,33 +58,6 @@ export async function uploadScan(token, result) {
58
58
  return { error: e.message || "Network error: failed to reach server" };
59
59
  }
60
60
  }
61
- export async function uploadLighthouseScan(token, result) {
62
- const { apiUrl } = readConfig();
63
- try {
64
- const res = await fetch(`${apiUrl}/api/public/lighthouse`, {
65
- method: "POST",
66
- headers: {
67
- "Content-Type": "application/json",
68
- "x-periderm-token": token,
69
- },
70
- body: JSON.stringify({
71
- url: result.url,
72
- performance_score: result.performance_score,
73
- accessibility_score: result.accessibility_score,
74
- best_practices_score: result.best_practices_score,
75
- seo_score: result.seo_score,
76
- metrics: result.metrics
77
- }),
78
- });
79
- if (!res.ok) {
80
- return { error: `${res.status} ${await res.text()}` };
81
- }
82
- return (await res.json());
83
- }
84
- catch (e) {
85
- return { error: e.message || "Network error: failed to reach server" };
86
- }
87
- }
88
61
  export async function fetchCloudPolicies(token) {
89
62
  const { apiUrl } = readConfig();
90
63
  try {
package/dist/index.js CHANGED
@@ -9,15 +9,13 @@ import { runDeepReview } from "./review/deep.js";
9
9
  import { printTerminal } from "./report/terminal.js";
10
10
  import { getAiInstructions } from "./report/ai-instructions.js";
11
11
  import { readConfig, writeConfig } from "./config.js";
12
- import { verifyToken, uploadScan, uploadLighthouseScan, fetchCloudPolicies } from "./api.js";
12
+ import { verifyToken, uploadScan, fetchCloudPolicies } from "./api.js";
13
13
  import http from "node:http";
14
- import { execSync } from "node:child_process";
15
14
  import ora from "ora";
16
15
  import { PERIDERM_ASCII } from "./constants.js";
17
16
  import { PRE_SCAN_MESSAGES, UPLOAD_MESSAGES, startRotatingMessages, finishRotatingMessages } from "./loading-messages.js";
18
17
  import { formatScanPath } from "./scanner/progress.js";
19
18
  import { reportCliError } from "./error-report.js";
20
- import { runLocalLighthouse } from "./lighthouse.js";
21
19
  function requireAuth() {
22
20
  console.info("");
23
21
  console.info(chalk.bold.hex("#FF4D00")("▸_ Periderm CLI"));
@@ -380,11 +378,6 @@ program
380
378
  console.info(chalk.white(" 3. Log out ") + chalk.hex("#FF4D00")("$ periderm logout"));
381
379
  console.info("");
382
380
  console.info(chalk.white("Need help? Visit ") + chalk.underline.cyan(`${apiUrl}/docs`) + chalk.white("\n"));
383
- // Auto-register the URI scheme natively in case postinstall failed
384
- try {
385
- await registerUriHandler();
386
- }
387
- catch (e) { /* silent fail */ }
388
381
  server.close();
389
382
  process.exit(0);
390
383
  }
@@ -410,47 +403,6 @@ program
410
403
  }
411
404
  });
412
405
  });
413
- program
414
- .command("lighthouse")
415
- .description("Run a local Lighthouse audit using Headless Chrome")
416
- .argument("<url>", "The URL to scan (e.g. http://localhost:3000)")
417
- .action(async (url) => {
418
- try {
419
- const result = await runLocalLighthouse(url);
420
- console.info("");
421
- console.info(chalk.bold.cyan("▸_ Lighthouse Scan Complete"));
422
- console.info(chalk.white("──────────────────────────────────────────"));
423
- console.info(chalk.bold.white("Performance : ") + chalk.yellow(`${result.performance_score}/100`));
424
- console.info(chalk.bold.white("Accessibility : ") + chalk.yellow(`${result.accessibility_score}/100`));
425
- console.info(chalk.bold.white("Best Practices : ") + chalk.yellow(`${result.best_practices_score}/100`));
426
- console.info(chalk.bold.white("SEO : ") + chalk.yellow(`${result.seo_score}/100`));
427
- console.info("");
428
- console.info(chalk.bold.white("First Contentful Paint : ") + chalk.gray(result.metrics.fcp));
429
- console.info(chalk.bold.white("Largest Contentful Paint : ") + chalk.gray(result.metrics.lcp));
430
- console.info(chalk.bold.white("Total Blocking Time : ") + chalk.gray(result.metrics.tbt));
431
- console.info(chalk.bold.white("Speed Index : ") + chalk.gray(result.metrics.si));
432
- console.info("");
433
- const cfg = readConfig();
434
- if (!cfg.token) {
435
- console.info(chalk.yellow("no token configured — run `periderm login` first to sync to dashboard."));
436
- }
437
- else {
438
- const uploadSpinner = ora({ text: "Uploading scan...", color: "cyan" }).start();
439
- const uploadPayload = { ...result, url };
440
- const res = await uploadLighthouseScan(cfg.token, uploadPayload);
441
- if (res.error) {
442
- uploadSpinner.fail(`upload failed: ${res.error}`);
443
- }
444
- else {
445
- uploadSpinner.succeed(`Uploaded! View it at: ${chalk.underline.cyan(`${cfg.apiUrl}/dashboard/lighthouse`)}`);
446
- }
447
- }
448
- }
449
- catch (e) {
450
- console.error(chalk.red(e.message));
451
- process.exit(1);
452
- }
453
- });
454
406
  program
455
407
  .command("whoami")
456
408
  .description("Verify the current token.")
@@ -478,48 +430,6 @@ program
478
430
  console.info(chalk.bold.white("Quota : ") + chalk.yellow(`${formatQuota} scans`));
479
431
  console.info(chalk.bold.white("API : ") + chalk.cyan(cfg.apiUrl));
480
432
  });
481
- async function registerUriHandler() {
482
- if (os.platform() === "linux") {
483
- const desktopFilePath = path.join(os.homedir(), ".local", "share", "applications", "periderm.desktop");
484
- const desktopFileContent = `[Desktop Entry]\nName=Periderm CLI\nExec=bash -l -c 'periderm "%u"'\nType=Application\nTerminal=true\nMimeType=x-scheme-handler/periderm;\n`;
485
- await fs.mkdir(path.dirname(desktopFilePath), { recursive: true });
486
- await fs.writeFile(desktopFilePath, desktopFileContent, { mode: 0o755 });
487
- execSync("update-desktop-database ~/.local/share/applications", { stdio: "ignore" });
488
- execSync("xdg-mime default periderm.desktop x-scheme-handler/periderm", { stdio: "ignore" });
489
- }
490
- else if (os.platform() === "win32") {
491
- execSync('reg add "HKCU\\Software\\Classes\\periderm" /v "URL Protocol" /t REG_SZ /d "" /f', { stdio: "ignore" });
492
- execSync('reg add "HKCU\\Software\\Classes\\periderm\\shell\\open\\command" /ve /t REG_SZ /d "\\"cmd\\" /c periderm \\"%1\\"" /f', { stdio: "ignore" });
493
- }
494
- else if (os.platform() === "darwin") {
495
- const appPath = path.join(os.homedir(), "Applications", "PeridermHandler.app");
496
- execSync(`osacompile -e 'on open location this_URL' -e 'do shell script "PATH=/usr/local/bin:/opt/homebrew/bin:$PATH periderm " & quoted form of this_URL' -e 'end open location' -o "${appPath}"`);
497
- const plistPath = path.join(appPath, "Contents", "Info.plist");
498
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes array" "${plistPath}"`);
499
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0 dict" "${plistPath}"`);
500
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0:CFBundleURLName string 'Periderm CLI'" "${plistPath}"`);
501
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0:CFBundleURLSchemes array" "${plistPath}"`);
502
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0:CFBundleURLSchemes:0 string 'periderm'" "${plistPath}"`);
503
- execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f "${appPath}"`, { stdio: "ignore" });
504
- }
505
- else {
506
- throw new Error(`Unsupported platform: ${os.platform()}`);
507
- }
508
- }
509
- program
510
- .command("register")
511
- .description("Register the periderm:// URI handler for web dashboard integration (Cross-Platform)")
512
- .action(async () => {
513
- try {
514
- await registerUriHandler();
515
- console.info(chalk.bold.green("✓ Successfully registered the periderm:// URI scheme."));
516
- console.info(chalk.white("You can now trigger Lighthouse audits directly from the web dashboard."));
517
- }
518
- catch (e) {
519
- console.error(chalk.red("Failed to register URI scheme: " + e.message));
520
- process.exit(1);
521
- }
522
- });
523
433
  program
524
434
  .command("logout")
525
435
  .description("Log out of the CLI by clearing your token.")
@@ -547,11 +457,6 @@ if (process.argv.length === 2) {
547
457
  }
548
458
  else {
549
459
  let args = process.argv;
550
- // Intercept OS-level custom URI scheme triggers
551
- if (args.length === 3 && args[2].startsWith("periderm://lighthouse?url=")) {
552
- const url = decodeURIComponent(args[2].split("url=")[1]);
553
- args = [args[0], args[1], "lighthouse", url];
554
- }
555
460
  mainDone = program.parseAsync(args).catch(async (e) => {
556
461
  console.error(e);
557
462
  const err = e instanceof Error ? e : new Error(String(e));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "Periderm CLI: The Local-First Security & Performance Code Scanner",
5
5
  "type": "module",
6
6
  "preferGlobal": true,
@@ -37,17 +37,16 @@
37
37
  "homepage": "https://periderm-cli.vercel.app",
38
38
  "repository": {
39
39
  "type": "git",
40
- "url": "git+https://github.com/Prince-Japheth/LaunchGuard.git",
40
+ "url": "https://periderm-cli.vercel.app/dashboard/support",
41
41
  "directory": "packages/cli"
42
42
  },
43
43
  "bugs": {
44
- "url": "https://github.com/Prince-Japheth/LaunchGuard/issues"
44
+ "url": "https://periderm-cli.vercel.app/dashboard/support"
45
45
  },
46
46
  "author": "Periderm",
47
47
  "license": "MIT",
48
48
  "scripts": {
49
49
  "build": "tsc -p tsconfig.json && chmod +x dist/bin.js",
50
- "postinstall": "node dist/bin.js register || true",
51
50
  "postpublish": "cd ../../ && tsx --env-file=.env scripts/broadcast-update.ts",
52
51
  "dev": "tsx src/index.ts",
53
52
  "start": "node dist/index.js"
@@ -57,10 +56,8 @@
57
56
  "@babel/traverse": "^7.25.0",
58
57
  "@babel/types": "^7.25.0",
59
58
  "chalk": "^5.3.0",
60
- "chrome-launcher": "^1.2.1",
61
59
  "commander": "^12.1.0",
62
60
  "fast-glob": "^3.3.2",
63
- "lighthouse": "^13.4.0",
64
61
  "open": "^10.1.0",
65
62
  "ora": "^9.4.1"
66
63
  },