-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcreate.mjs
More file actions
executable file
·52 lines (38 loc) · 1.34 KB
/
create.mjs
File metadata and controls
executable file
·52 lines (38 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env node
import { execSync } from "node:child_process";
import { existsSync, copyFileSync } from "node:fs";
import { resolve, basename } from "node:path";
const REPO = "https://github.com/ofershap/cursor-usage-tracker.git";
const dirName = process.argv[2] || "cursor-usage-tracker";
const targetDir = resolve(process.cwd(), dirName);
function run(cmd, opts = {}) {
execSync(cmd, { stdio: "inherit", ...opts });
}
function log(msg) {
console.log(`\n\x1b[36m${msg}\x1b[0m`);
}
if (existsSync(targetDir)) {
console.error(`\x1b[31mDirectory "${dirName}" already exists.\x1b[0m`);
process.exit(1);
}
log(`Cloning cursor-usage-tracker into ${dirName}...`);
run(`git clone --depth 1 ${REPO} "${targetDir}"`);
log("Installing dependencies...");
run("npm install", { cwd: targetDir });
const envExample = resolve(targetDir, ".env.example");
const envFile = resolve(targetDir, ".env");
if (existsSync(envExample) && !existsSync(envFile)) {
copyFileSync(envExample, envFile);
}
log("Done! Next steps:");
console.log(`
cd ${dirName}
1. Edit .env and add your CURSOR_ADMIN_API_KEY
Get it from: Cursor dashboard → Settings → Advanced → Admin API Keys
2. Start the dashboard:
npm run dev
3. Collect your first data:
npm run collect
4. Open http://localhost:3000
Docs: https://github.com/ofershap/cursor-usage-tracker
`);