@robot-resources/cli-core 0.1.0 → 0.1.2

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/auth.mjs CHANGED
@@ -1,8 +1,13 @@
1
1
  import { createHash, randomBytes } from 'node:crypto';
2
2
  import { createServer } from 'node:http';
3
3
 
4
- const SUPABASE_URL = 'https://tbnliojrqmcagojtvqpe.supabase.co';
4
+ // Supabase anon key is a public client key (like Stripe's publishable key).
5
+ // Security is enforced by Row Level Security policies, not key secrecy.
6
+ // Override via env vars for alternative Supabase instances.
7
+ const SUPABASE_URL =
8
+ process.env.SUPABASE_URL || 'https://tbnliojrqmcagojtvqpe.supabase.co';
5
9
  const SUPABASE_ANON_KEY =
10
+ process.env.SUPABASE_ANON_KEY ||
6
11
  'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRibmxpb2pycW1jYWdvanR2cXBlIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzMyNjIxNzAsImV4cCI6MjA4ODgzODE3MH0.GKlpbVFgBbcV0OwxFZuOb-LfqtOu95ZiR33KNOONPI0';
7
12
 
8
13
  const PREFERRED_PORT = 54321;
@@ -214,14 +219,15 @@ export async function authenticate() {
214
219
 
215
220
  console.log(`\n Auth URL: ${authUrl}\n`);
216
221
 
217
- // Open browser
218
- const { exec } = await import('node:child_process');
219
- const openCmd =
220
- process.platform === 'darwin' ? 'open' :
221
- process.platform === 'win32' ? 'start' :
222
- 'xdg-open';
223
-
224
- exec(`${openCmd} "${authUrl}"`);
222
+ // Open browser (use execFile to avoid shell injection)
223
+ const { execFile } = await import('node:child_process');
224
+ if (process.platform === 'win32') {
225
+ // 'start' is a cmd.exe builtin, not an executable — must invoke via cmd.exe
226
+ execFile('cmd.exe', ['/c', 'start', '""', authUrl]);
227
+ } else {
228
+ const openCmd = process.platform === 'darwin' ? 'open' : 'xdg-open';
229
+ execFile(openCmd, [authUrl]);
230
+ }
225
231
 
226
232
  console.log(' Waiting for GitHub authorization...\n');
227
233
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robot-resources/cli-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Shared CLI utilities — auth, config, login (internal)",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
@@ -21,6 +21,17 @@
21
21
  "devDependencies": {
22
22
  "vitest": "^1.2.0"
23
23
  },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/robot-resources/robot-resources.git",
27
+ "directory": "packages/cli-core"
28
+ },
29
+ "homepage": "https://robotresources.ai",
30
+ "bugs": {
31
+ "url": "https://github.com/robot-resources/robot-resources/issues"
32
+ },
33
+ "license": "MIT",
34
+ "author": "Robot Resources Team",
24
35
  "publishConfig": {
25
36
  "access": "public"
26
37
  },
package/python-bridge.mjs CHANGED
@@ -69,6 +69,18 @@ export function ensureVenv(pythonBin) {
69
69
  }
70
70
  }
71
71
 
72
+ // Pre-check: verify the venv module is available (missing on some Debian/Ubuntu systems)
73
+ try {
74
+ execSync(`"${pythonBin}" -c "import ensurepip; import venv"`, { stdio: 'pipe' });
75
+ } catch {
76
+ const version = execSync(`"${pythonBin}" --version`, { encoding: 'utf-8' }).trim().match(/\d+\.\d+/)?.[0] || '3.x';
77
+ throw new Error(
78
+ `Python venv module is not installed.\n` +
79
+ ` Fix: sudo apt install python${version}-venv (Debian/Ubuntu)\n` +
80
+ ` Then re-run: npx robot-resources`
81
+ );
82
+ }
83
+
72
84
  mkdirSync(join(homedir(), '.robot-resources'), { recursive: true });
73
85
  execSync(`"${pythonBin}" -m venv "${VENV_DIR}"`, { stdio: 'pipe' });
74
86
  return venvPython;