devspy-tool 1.0.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/bin/cli.js ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+
3
+ const os = require("os");
4
+ const path = require("path");
5
+ const { exec } = require("child_process");
6
+
7
+ function getChromePath() {
8
+ const platform = os.platform();
9
+ if (platform === "darwin") {
10
+ return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
11
+ } else if (platform === "win32") {
12
+ // Fallback for Windows
13
+ return "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe";
14
+ } else if (platform === "linux") {
15
+ return "/usr/bin/google-chrome";
16
+ }
17
+ return "";
18
+ }
19
+
20
+ // Auto-detect Chrome if not provided
21
+ if (!process.env.CHROME_PATH) {
22
+ process.env.CHROME_PATH = getChromePath();
23
+ }
24
+
25
+ // Default port for CLI
26
+ process.env.PORT = process.env.PORT || 5001;
27
+
28
+ console.log("[DevSpy] Starting local server...");
29
+
30
+ // Load the server
31
+ require(path.join(__dirname, "../server.js"));
32
+
33
+ // Auto-open browser after a short delay
34
+ setTimeout(() => {
35
+ const url = `http://localhost:${process.env.PORT}`;
36
+ console.log(`[DevSpy] Opening browser at ${url}`);
37
+
38
+ let command = "";
39
+ switch (process.platform) {
40
+ case "darwin":
41
+ command = `open ${url}`;
42
+ break;
43
+ case "win32":
44
+ command = `start ${url}`;
45
+ break;
46
+ default:
47
+ command = `xdg-open ${url}`;
48
+ break;
49
+ }
50
+
51
+ exec(command, (err) => {
52
+ if (err) {
53
+ console.warn(`[DevSpy] Could not auto-open browser. Please manually navigate to: ${url}`);
54
+ }
55
+ });
56
+ }, 1000);
package/config.js ADDED
@@ -0,0 +1,6 @@
1
+ module.exports = {
2
+ CHROME_PATH:
3
+ process.env.CHROME_PATH || "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
4
+ PORT: process.env.PORT || 5001,
5
+ RESPONSE_PREVIEW_LIMIT: 10000, // bytes — increased for authenticated API responses
6
+ };