cursor-local-remote 0.1.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/.next/BUILD_ID +1 -0
- package/.next/app-build-manifest.json +98 -0
- package/.next/app-path-routes-manifest.json +16 -0
- package/.next/build-manifest.json +33 -0
- package/.next/export-marker.json +6 -0
- package/.next/images-manifest.json +58 -0
- package/.next/next-minimal-server.js.nft.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +148 -0
- package/.next/react-loadable-manifest.json +8 -0
- package/.next/required-server-files.json +325 -0
- package/.next/routes-manifest.json +94 -0
- package/.next/server/app/_not-found/page.js +2 -0
- package/.next/server/app/_not-found/page.js.nft.json +1 -0
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -0
- package/.next/server/app/_not-found.html +1 -0
- package/.next/server/app/_not-found.meta +8 -0
- package/.next/server/app/_not-found.rsc +18 -0
- package/.next/server/app/api/chat/route.js +19 -0
- package/.next/server/app/api/chat/route.js.nft.json +1 -0
- package/.next/server/app/api/chat/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/info/route.js +1 -0
- package/.next/server/app/api/info/route.js.nft.json +1 -0
- package/.next/server/app/api/info/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/models/route.js +1 -0
- package/.next/server/app/api/models/route.js.nft.json +1 -0
- package/.next/server/app/api/models/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/push/subscribe/route.js +19 -0
- package/.next/server/app/api/push/subscribe/route.js.nft.json +1 -0
- package/.next/server/app/api/push/subscribe/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/push/vapid-key/route.js +19 -0
- package/.next/server/app/api/push/vapid-key/route.js.nft.json +1 -0
- package/.next/server/app/api/push/vapid-key/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/active/route.js +1 -0
- package/.next/server/app/api/sessions/active/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/active/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/history/route.js +1 -0
- package/.next/server/app/api/sessions/history/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/history/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/route.js +19 -0
- package/.next/server/app/api/sessions/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/sessions/watch/route.js +4 -0
- package/.next/server/app/api/sessions/watch/route.js.nft.json +1 -0
- package/.next/server/app/api/sessions/watch/route_client-reference-manifest.js +1 -0
- package/.next/server/app/apple-icon.png/route.js +1 -0
- package/.next/server/app/apple-icon.png/route.js.nft.json +1 -0
- package/.next/server/app/apple-icon.png.body +0 -0
- package/.next/server/app/apple-icon.png.meta +1 -0
- package/.next/server/app/icon.png/route.js +1 -0
- package/.next/server/app/icon.png/route.js.nft.json +1 -0
- package/.next/server/app/icon.png.body +0 -0
- package/.next/server/app/icon.png.meta +1 -0
- package/.next/server/app/index.html +1 -0
- package/.next/server/app/index.meta +7 -0
- package/.next/server/app/index.rsc +21 -0
- package/.next/server/app/manifest.webmanifest/route.js +16 -0
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -0
- package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -0
- package/.next/server/app/manifest.webmanifest.body +1 -0
- package/.next/server/app/manifest.webmanifest.meta +1 -0
- package/.next/server/app/page.js +2 -0
- package/.next/server/app/page.js.nft.json +1 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +16 -0
- package/.next/server/chunks/267.js +9 -0
- package/.next/server/chunks/369.js +19 -0
- package/.next/server/chunks/407.js +1 -0
- package/.next/server/chunks/519.js +19 -0
- package/.next/server/chunks/540.js +184 -0
- package/.next/server/chunks/611.js +6 -0
- package/.next/server/chunks/692.js +1 -0
- package/.next/server/chunks/848.js +1 -0
- package/.next/server/chunks/873.js +22 -0
- package/.next/server/chunks/878.js +37 -0
- package/.next/server/edge-instrumentation.js +2 -0
- package/.next/server/edge-runtime-webpack.js +2 -0
- package/.next/server/functions-config-manifest.json +4 -0
- package/.next/server/instrumentation.js +1 -0
- package/.next/server/instrumentation.js.nft.json +1 -0
- package/.next/server/interception-route-rewrite-manifest.js +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +33 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages/404.html +1 -0
- package/.next/server/pages/500.html +1 -0
- package/.next/server/pages/_app.js +1 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +1 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +19 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +6 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +1 -0
- package/.next/server/src/middleware.js +135 -0
- package/.next/server/webpack-runtime.js +1 -0
- package/.next/static/chunks/255-ebd51be49873d76c.js +1 -0
- package/.next/static/chunks/391-727d95bcfba987c2.js +1 -0
- package/.next/static/chunks/4bd1b696-c023c6e3521b1417.js +1 -0
- package/.next/static/chunks/561.0dd3adbeaf3ef161.js +184 -0
- package/.next/static/chunks/app/_not-found/page-52dbda1443b2ae8f.js +1 -0
- package/.next/static/chunks/app/api/chat/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/info/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/models/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/push/subscribe/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/push/vapid-key/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/sessions/active/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/sessions/history/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/sessions/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/api/sessions/watch/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/layout-11d8cab0ea5a792e.js +1 -0
- package/.next/static/chunks/app/manifest.webmanifest/route-05d013d09b933dec.js +1 -0
- package/.next/static/chunks/app/page-9b8c5cfa3bc0cd37.js +1 -0
- package/.next/static/chunks/framework-7c18bae94415732c.js +1 -0
- package/.next/static/chunks/main-app-14a04931699eb2a2.js +1 -0
- package/.next/static/chunks/main-d9f723dc0fb9d113.js +1 -0
- package/.next/static/chunks/pages/_app-79e662cab09aea11.js +1 -0
- package/.next/static/chunks/pages/_error-89cd7530328c75d9.js +1 -0
- package/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- package/.next/static/chunks/webpack-d434b6449a9cd8f3.js +1 -0
- package/.next/static/css/491f5e1d36eb62fc.css +1 -0
- package/.next/static/css/5eacd01f773eed7f.css +11 -0
- package/.next/static/qH3fSSOUNLq_-dFHc2iUI/_buildManifest.js +1 -0
- package/.next/static/qH3fSSOUNLq_-dFHc2iUI/_ssgManifest.js +1 -0
- package/LICENSE +21 -0
- package/README.md +120 -0
- package/bin/cursor-remote.mjs +250 -0
- package/next.config.ts +26 -0
- package/package.json +79 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/sw.js +68 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn, execFileSync } from "child_process";
|
|
4
|
+
import { resolve, dirname } from "path";
|
|
5
|
+
import { fileURLToPath } from "url";
|
|
6
|
+
import { networkInterfaces } from "os";
|
|
7
|
+
import { existsSync } from "fs";
|
|
8
|
+
import { randomInt } from "crypto";
|
|
9
|
+
import { createServer } from "net";
|
|
10
|
+
import qrcode from "qrcode-terminal";
|
|
11
|
+
|
|
12
|
+
const WORDS = [
|
|
13
|
+
"alpha","amber","anvil","apple","arrow","atlas","azure","badge","baker","beach",
|
|
14
|
+
"berry","blade","blaze","bloom","board","bonus","brave","brick","brook","brush",
|
|
15
|
+
"cabin","cable","camel","candy","cedar","chain","chalk","charm","chase","chief",
|
|
16
|
+
"cider","clamp","cliff","climb","clock","cloud","cobra","coral","crane","creek",
|
|
17
|
+
"crest","cross","crown","crush","curve","delta","depth","diary","disco","dodge",
|
|
18
|
+
"dozen","draft","dream","drift","drive","eagle","ember","equal","extra","fable",
|
|
19
|
+
"fancy","feast","fiber","field","flame","flask","flint","flora","forge","frost",
|
|
20
|
+
"fruit","gamma","ghost","giant","glade","gleam","globe","grace","grain","grape",
|
|
21
|
+
"grasp","green","grove","guard","guide","haven","heart","hedge","honey","hover",
|
|
22
|
+
"ivory","jewel","jolly","karma","kiosk","knack","label","lance","latch","lemon",
|
|
23
|
+
"level","light","lilac","linen","logic","lotus","lunar","major","mango","maple",
|
|
24
|
+
"marsh","match","medal","melon","might","minor","mixer","mocha","morse","mount",
|
|
25
|
+
"noble","north","novel","ocean","olive","onion","orbit","omega","otter","oxide",
|
|
26
|
+
"panel","patch","peach","pearl","pedal","penny","pilot","pixel","plant","plaza",
|
|
27
|
+
"plume","plush","polar","pound","power","prism","proxy","pulse","quake","queen",
|
|
28
|
+
"quest","quota","radar","raven","relay","ridge","river","robin","rodeo","royal",
|
|
29
|
+
"ruler","salad","scale","scout","shade","shark","shell","shine","sigma","silk",
|
|
30
|
+
"slate","slope","smoke","solar","sonic","south","spark","spice","spray","squad",
|
|
31
|
+
"stack","stamp","steel","stern","stone","storm","sugar","surge","swift","tango",
|
|
32
|
+
"tempo","theta","thorn","tiger","toast","topaz","torch","tower","trace","trail",
|
|
33
|
+
"trend","trick","trout","tulip","ultra","umbra","unity","upper","urban","vault",
|
|
34
|
+
"verse","vigor","vinyl","viola","viper","vivid","wagon","watch","wheat","whirl",
|
|
35
|
+
"width","wired","yacht","zebra","zephyr",
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
function generateToken() {
|
|
39
|
+
const a = WORDS[randomInt(WORDS.length)];
|
|
40
|
+
const b = WORDS[randomInt(WORDS.length)];
|
|
41
|
+
return `${a}-${b}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
45
|
+
const projectRoot = resolve(__dirname, "..");
|
|
46
|
+
|
|
47
|
+
const args = process.argv.slice(2);
|
|
48
|
+
|
|
49
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
50
|
+
console.log(`
|
|
51
|
+
Cursor Local Remote - Control Cursor IDE from any device on your network
|
|
52
|
+
|
|
53
|
+
Usage:
|
|
54
|
+
clr [workspace] [options]
|
|
55
|
+
|
|
56
|
+
Arguments:
|
|
57
|
+
workspace Path to your project folder (defaults to current directory)
|
|
58
|
+
|
|
59
|
+
Options:
|
|
60
|
+
-p, --port Port to run on (default: 3100)
|
|
61
|
+
--no-open Don't auto-open the browser
|
|
62
|
+
--no-qr Don't show QR code in terminal
|
|
63
|
+
-h, --help Show this help
|
|
64
|
+
|
|
65
|
+
Examples:
|
|
66
|
+
clr # Start in current folder
|
|
67
|
+
clr ~/projects/my-app # Start for a specific project
|
|
68
|
+
clr . --port 8080 # Use a different port
|
|
69
|
+
`);
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const positional = [];
|
|
74
|
+
let rawPort = process.env.PORT || "3100";
|
|
75
|
+
let noOpen = false;
|
|
76
|
+
let noQr = false;
|
|
77
|
+
|
|
78
|
+
for (let i = 0; i < args.length; i++) {
|
|
79
|
+
const a = args[i];
|
|
80
|
+
if (a === "--port" || a === "-p") {
|
|
81
|
+
rawPort = args[++i] || rawPort;
|
|
82
|
+
} else if (a === "--no-open") {
|
|
83
|
+
noOpen = true;
|
|
84
|
+
} else if (a === "--no-qr") {
|
|
85
|
+
noQr = true;
|
|
86
|
+
} else if (!a.startsWith("-")) {
|
|
87
|
+
positional.push(a);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const portNum = parseInt(rawPort, 10);
|
|
92
|
+
if (isNaN(portNum) || portNum < 1 || portNum > 65535) {
|
|
93
|
+
console.error(` Error: invalid port: ${rawPort}`);
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
const workspace = positional[0] ? resolve(positional[0]) : process.cwd();
|
|
97
|
+
|
|
98
|
+
if (!existsSync(workspace)) {
|
|
99
|
+
console.error(` Error: workspace path does not exist: ${workspace}`);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const MAX_PORT_ATTEMPTS = 20;
|
|
104
|
+
|
|
105
|
+
function isPortAvailable(port) {
|
|
106
|
+
return new Promise((resolve) => {
|
|
107
|
+
const srv = createServer();
|
|
108
|
+
srv.once("error", () => resolve(false));
|
|
109
|
+
srv.listen(port, "0.0.0.0", () => {
|
|
110
|
+
srv.close(() => resolve(true));
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function findAvailablePort(startPort) {
|
|
116
|
+
for (let i = 0; i < MAX_PORT_ATTEMPTS; i++) {
|
|
117
|
+
const candidate = startPort + i;
|
|
118
|
+
if (candidate > 65535) break;
|
|
119
|
+
if (await isPortAvailable(candidate)) return candidate;
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function getLanIp() {
|
|
125
|
+
const interfaces = networkInterfaces();
|
|
126
|
+
for (const name of Object.keys(interfaces)) {
|
|
127
|
+
const addrs = interfaces[name];
|
|
128
|
+
if (!addrs) continue;
|
|
129
|
+
for (const addr of addrs) {
|
|
130
|
+
if (addr.family === "IPv4" && !addr.internal) return addr.address;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const availablePort = await findAvailablePort(portNum);
|
|
137
|
+
if (availablePort === null) {
|
|
138
|
+
console.error(` Error: no available port found starting from ${portNum}`);
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
if (availablePort !== portNum) {
|
|
142
|
+
console.log(` \x1b[33mPort ${portNum} in use, using ${availablePort}\x1b[0m`);
|
|
143
|
+
}
|
|
144
|
+
const port = String(availablePort);
|
|
145
|
+
|
|
146
|
+
const lanIp = getLanIp();
|
|
147
|
+
const localUrl = `http://localhost:${port}`;
|
|
148
|
+
const networkUrl = lanIp ? `http://${lanIp}:${port}` : null;
|
|
149
|
+
|
|
150
|
+
const authToken = process.env.AUTH_TOKEN || generateToken();
|
|
151
|
+
|
|
152
|
+
const authUrl = `${localUrl}?token=${authToken}`;
|
|
153
|
+
|
|
154
|
+
console.log("");
|
|
155
|
+
console.log("\x1b[97m ██████╗██╗ ██████╗ ");
|
|
156
|
+
console.log("██╔════╝██║ ██╔══██╗");
|
|
157
|
+
console.log("██║ ██║ ██████╔╝");
|
|
158
|
+
console.log("██║ ██║ ██╔══██╗");
|
|
159
|
+
console.log("╚██████╗███████╗██║ ██║");
|
|
160
|
+
console.log(" ╚═════╝╚══════╝╚═╝ ╚═╝\x1b[0m");
|
|
161
|
+
console.log(` \x1b[2mWorkspace:\x1b[0m ${workspace}`);
|
|
162
|
+
console.log(` \x1b[2mLocal:\x1b[0m ${localUrl}`);
|
|
163
|
+
if (networkUrl) {
|
|
164
|
+
console.log(` \x1b[2mNetwork:\x1b[0m \x1b[97m${networkUrl}\x1b[0m`);
|
|
165
|
+
}
|
|
166
|
+
console.log(` \x1b[2mAuth token:\x1b[0m \x1b[97m${authToken}\x1b[0m`);
|
|
167
|
+
console.log(` \x1b[2mAuth link:\x1b[0m \x1b[4m\x1b[97m${authUrl}\x1b[0m`);
|
|
168
|
+
console.log("");
|
|
169
|
+
|
|
170
|
+
const qrUrl = networkUrl ? `${networkUrl}?token=${authToken}` : null;
|
|
171
|
+
|
|
172
|
+
if (!noQr && qrUrl) {
|
|
173
|
+
console.log(" \x1b[2mScan to connect from your phone:\x1b[0m");
|
|
174
|
+
console.log("");
|
|
175
|
+
qrcode.generate(qrUrl, { small: true }, (code) => {
|
|
176
|
+
const indented = code.split("\n").map((l) => " " + l).join("\n");
|
|
177
|
+
console.log(indented);
|
|
178
|
+
console.log("");
|
|
179
|
+
console.log(" \x1b[2mPress Ctrl+C to stop\x1b[0m");
|
|
180
|
+
console.log("");
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (!noOpen) {
|
|
185
|
+
try {
|
|
186
|
+
const openCmd = process.platform === "darwin"
|
|
187
|
+
? "open"
|
|
188
|
+
: process.platform === "win32"
|
|
189
|
+
? "start"
|
|
190
|
+
: "xdg-open";
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
execFileSync(openCmd, [`${localUrl}?token=${authToken}`], { stdio: "ignore" });
|
|
193
|
+
}, 2000);
|
|
194
|
+
} catch {
|
|
195
|
+
// silently fail if browser can't open
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const nextBin = resolve(projectRoot, "node_modules", ".bin", "next");
|
|
200
|
+
const isBuilt = existsSync(resolve(projectRoot, ".next", "BUILD_ID"));
|
|
201
|
+
|
|
202
|
+
const nextArgs = isBuilt
|
|
203
|
+
? ["start", "--hostname", "0.0.0.0", "--port", port]
|
|
204
|
+
: ["dev", "--hostname", "0.0.0.0", "--port", port];
|
|
205
|
+
|
|
206
|
+
const child = spawn(nextBin, nextArgs, {
|
|
207
|
+
cwd: projectRoot,
|
|
208
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
209
|
+
env: {
|
|
210
|
+
...process.env,
|
|
211
|
+
CURSOR_WORKSPACE: workspace,
|
|
212
|
+
PORT: port,
|
|
213
|
+
AUTH_TOKEN: authToken,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
let ready = false;
|
|
218
|
+
child.stdout.on("data", (data) => {
|
|
219
|
+
if (ready) return;
|
|
220
|
+
const text = data.toString();
|
|
221
|
+
if (text.includes("Ready") || text.includes("ready")) {
|
|
222
|
+
console.log(" \x1b[32m✓ Ready\x1b[0m");
|
|
223
|
+
ready = true;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
child.stderr.on("data", (data) => {
|
|
228
|
+
const text = data.toString();
|
|
229
|
+
if (text.includes("Error") || text.includes("error")) {
|
|
230
|
+
process.stderr.write(" " + text);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
child.on("close", (code) => {
|
|
235
|
+
process.exit(code ?? 0);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
let exiting = false;
|
|
239
|
+
|
|
240
|
+
function shutdown(signal) {
|
|
241
|
+
if (exiting) {
|
|
242
|
+
process.exit(1);
|
|
243
|
+
}
|
|
244
|
+
exiting = true;
|
|
245
|
+
child.kill(signal);
|
|
246
|
+
setTimeout(() => process.exit(0), 3000);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
process.on("SIGINT", () => shutdown("SIGTERM"));
|
|
250
|
+
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
package/next.config.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
|
|
3
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
4
|
+
|
|
5
|
+
const csp = isDev
|
|
6
|
+
? "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' ws:; worker-src 'self'"
|
|
7
|
+
: "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self'; worker-src 'self'";
|
|
8
|
+
|
|
9
|
+
const nextConfig: NextConfig = {
|
|
10
|
+
serverExternalPackages: ["better-sqlite3", "web-push"],
|
|
11
|
+
async headers() {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
source: "/:path*",
|
|
15
|
+
headers: [
|
|
16
|
+
{ key: "X-Content-Type-Options", value: "nosniff" },
|
|
17
|
+
{ key: "X-Frame-Options", value: "DENY" },
|
|
18
|
+
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
|
|
19
|
+
{ key: "Content-Security-Policy", value: csp },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default nextConfig;
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cursor-local-remote",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Control Cursor IDE from any device on your local network",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/jon-makinen/cursor-local-remote.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"cursor",
|
|
13
|
+
"cursor-ide",
|
|
14
|
+
"remote",
|
|
15
|
+
"ai",
|
|
16
|
+
"agent",
|
|
17
|
+
"cli",
|
|
18
|
+
"mobile"
|
|
19
|
+
],
|
|
20
|
+
"bin": {
|
|
21
|
+
"cursor-local-remote": "./bin/cursor-remote.mjs",
|
|
22
|
+
"clr": "./bin/cursor-remote.mjs"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"bin/",
|
|
26
|
+
"public/",
|
|
27
|
+
".next/server/",
|
|
28
|
+
".next/static/",
|
|
29
|
+
".next/*.json",
|
|
30
|
+
".next/BUILD_ID",
|
|
31
|
+
".next/package.json",
|
|
32
|
+
"next.config.ts"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"dev": "next dev --hostname 0.0.0.0 --port 3100",
|
|
36
|
+
"build": "next build",
|
|
37
|
+
"start": "next start --hostname 0.0.0.0 --port 3100",
|
|
38
|
+
"lint": "eslint .",
|
|
39
|
+
"lint:fix": "eslint . --fix",
|
|
40
|
+
"format": "prettier --write .",
|
|
41
|
+
"format:check": "prettier --check .",
|
|
42
|
+
"prepublishOnly": "npm run build && find .next -name '*.map' -delete"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@khmyznikov/pwa-install": "^0.6.3",
|
|
46
|
+
"better-sqlite3": "^12.6.2",
|
|
47
|
+
"highlight.js": "^11.11.1",
|
|
48
|
+
"next": "^15.5.12",
|
|
49
|
+
"qrcode-terminal": "^0.12.0",
|
|
50
|
+
"qrcode.react": "^4.2.0",
|
|
51
|
+
"react": "^19.1.0",
|
|
52
|
+
"react-dom": "^19.1.0",
|
|
53
|
+
"react-markdown": "^10.1.0",
|
|
54
|
+
"rehype-highlight": "^7.0.2",
|
|
55
|
+
"remark-gfm": "^4.0.1",
|
|
56
|
+
"web-haptics": "^0.0.6",
|
|
57
|
+
"web-push": "^3.6.7",
|
|
58
|
+
"zod": "^4.3.6"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@eslint/js": "^9.39.4",
|
|
62
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
63
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
64
|
+
"@types/node": "^25.5.0",
|
|
65
|
+
"@types/react": "^19.2.14",
|
|
66
|
+
"@types/react-dom": "^19.2.3",
|
|
67
|
+
"@types/web-push": "^3.6.4",
|
|
68
|
+
"eslint": "^9.39.4",
|
|
69
|
+
"eslint-config-next": "^16.1.6",
|
|
70
|
+
"eslint-config-prettier": "^10.1.8",
|
|
71
|
+
"prettier": "^3.8.1",
|
|
72
|
+
"tailwindcss": "^4.2.1",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"typescript-eslint": "^8.57.0"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=20"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/public/sw.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const CACHE_NAME = "clr-v3";
|
|
2
|
+
const SHELL_URLS = ["/"];
|
|
3
|
+
|
|
4
|
+
self.addEventListener("install", (event) => {
|
|
5
|
+
event.waitUntil(
|
|
6
|
+
caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL_URLS)),
|
|
7
|
+
);
|
|
8
|
+
self.skipWaiting();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
self.addEventListener("activate", (event) => {
|
|
12
|
+
event.waitUntil(
|
|
13
|
+
caches.keys().then((keys) =>
|
|
14
|
+
Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k))),
|
|
15
|
+
),
|
|
16
|
+
);
|
|
17
|
+
self.clients.claim();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
self.addEventListener("push", (event) => {
|
|
21
|
+
const data = event.data?.json() ?? {};
|
|
22
|
+
const title = data.title || "Agent finished";
|
|
23
|
+
const options = {
|
|
24
|
+
body: data.body || "Response complete",
|
|
25
|
+
icon: "/icon-192.png",
|
|
26
|
+
};
|
|
27
|
+
event.waitUntil(self.registration.showNotification(title, options));
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
self.addEventListener("message", (event) => {
|
|
31
|
+
if (event.data?.type === "SHOW_NOTIFICATION") {
|
|
32
|
+
const { title, options } = event.data;
|
|
33
|
+
event.waitUntil(self.registration.showNotification(title, options));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
self.addEventListener("notificationclick", (event) => {
|
|
38
|
+
event.notification.close();
|
|
39
|
+
event.waitUntil(
|
|
40
|
+
clients.matchAll({ type: "window", includeUncontrolled: true }).then((windowClients) => {
|
|
41
|
+
if (windowClients.length > 0) {
|
|
42
|
+
return windowClients[0].focus();
|
|
43
|
+
}
|
|
44
|
+
return clients.openWindow("/");
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
self.addEventListener("fetch", (event) => {
|
|
50
|
+
if (event.request.method !== "GET") return;
|
|
51
|
+
|
|
52
|
+
const url = new URL(event.request.url);
|
|
53
|
+
|
|
54
|
+
// Never cache API calls or SSE streams
|
|
55
|
+
if (url.pathname.startsWith("/api/")) return;
|
|
56
|
+
|
|
57
|
+
event.respondWith(
|
|
58
|
+
fetch(event.request)
|
|
59
|
+
.then((response) => {
|
|
60
|
+
if (response.ok && url.origin === self.location.origin) {
|
|
61
|
+
const clone = response.clone();
|
|
62
|
+
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
|
|
63
|
+
}
|
|
64
|
+
return response;
|
|
65
|
+
})
|
|
66
|
+
.catch(() => caches.match(event.request)),
|
|
67
|
+
);
|
|
68
|
+
});
|