periderm-cli 0.1.46 → 0.1.48

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.
Files changed (2) hide show
  1. package/dist/index.js +34 -32
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -380,6 +380,11 @@ program
380
380
  console.info(chalk.white(" 3. Log out ") + chalk.hex("#FF4D00")("$ periderm logout"));
381
381
  console.info("");
382
382
  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 */ }
383
388
  server.close();
384
389
  process.exit(0);
385
390
  }
@@ -473,43 +478,40 @@ program
473
478
  console.info(chalk.bold.white("Quota : ") + chalk.yellow(`${formatQuota} scans`));
474
479
  console.info(chalk.bold.white("API : ") + chalk.cyan(cfg.apiUrl));
475
480
  });
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
+ }
476
509
  program
477
510
  .command("register")
478
511
  .description("Register the periderm:// URI handler for web dashboard integration (Cross-Platform)")
479
512
  .action(async () => {
480
513
  try {
481
- if (os.platform() === "linux") {
482
- const desktopFilePath = path.join(os.homedir(), ".local", "share", "applications", "periderm.desktop");
483
- const desktopFileContent = `[Desktop Entry]\nName=Periderm CLI\nExec=bash -l -c 'periderm "%u"'\nType=Application\nTerminal=true\nMimeType=x-scheme-handler/periderm;\n`;
484
- await fs.mkdir(path.dirname(desktopFilePath), { recursive: true });
485
- await fs.writeFile(desktopFilePath, desktopFileContent, { mode: 0o755 });
486
- execSync("update-desktop-database ~/.local/share/applications", { stdio: "ignore" });
487
- execSync("xdg-mime default periderm.desktop x-scheme-handler/periderm", { stdio: "ignore" });
488
- }
489
- else if (os.platform() === "win32") {
490
- // Windows Registry
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
- // macOS app bundle using osacompile
496
- const appPath = path.join(os.homedir(), "Applications", "PeridermHandler.app");
497
- // Create AppleScript app
498
- 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}"`);
499
- // Add URL scheme to Info.plist
500
- const plistPath = path.join(appPath, "Contents", "Info.plist");
501
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes array" "${plistPath}"`);
502
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0 dict" "${plistPath}"`);
503
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0:CFBundleURLName string 'Periderm CLI'" "${plistPath}"`);
504
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0:CFBundleURLSchemes array" "${plistPath}"`);
505
- execSync(`/usr/libexec/PlistBuddy -c "Add :CFBundleURLTypes:0:CFBundleURLSchemes:0 string 'periderm'" "${plistPath}"`);
506
- // Refresh LaunchServices
507
- execSync(`/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f "${appPath}"`, { stdio: "ignore" });
508
- }
509
- else {
510
- console.info(chalk.red(`Unsupported platform: ${os.platform()}`));
511
- process.exit(1);
512
- }
514
+ await registerUriHandler();
513
515
  console.info(chalk.bold.green("✓ Successfully registered the periderm:// URI scheme."));
514
516
  console.info(chalk.white("You can now trigger Lighthouse audits directly from the web dashboard."));
515
517
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "Periderm CLI: The Local-First Security & Performance Code Scanner",
5
5
  "type": "module",
6
6
  "preferGlobal": true,
@@ -37,11 +37,11 @@
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",
@@ -60,7 +60,7 @@
60
60
  "chrome-launcher": "^1.2.1",
61
61
  "commander": "^12.1.0",
62
62
  "fast-glob": "^3.3.2",
63
- "lighthouse": "^13.4.0",
63
+ "lighthouse": "^12.8.2",
64
64
  "open": "^10.1.0",
65
65
  "ora": "^9.4.1"
66
66
  },