@robot-resources/cli-core 0.1.1 → 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 +9 -8
- package/package.json +12 -1
- package/python-bridge.mjs +12 -0
package/auth.mjs
CHANGED
|
@@ -219,14 +219,15 @@ export async function authenticate() {
|
|
|
219
219
|
|
|
220
220
|
console.log(`\n Auth URL: ${authUrl}\n`);
|
|
221
221
|
|
|
222
|
-
// Open browser
|
|
223
|
-
const {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
+
}
|
|
230
231
|
|
|
231
232
|
console.log(' Waiting for GitHub authorization...\n');
|
|
232
233
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robot-resources/cli-core",
|
|
3
|
-
"version": "0.1.
|
|
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;
|