@factorialco/fcode-cli 3.2.0 → 3.3.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/README.md +1 -1
- package/dist/commands/i18n/status.js +9 -0
- package/dist/commands/modules/pull.js +5 -4
- package/dist/commands/modules/push.js +1 -1
- package/dist/commands/modules/status.js +9 -0
- package/dist/commands/processes/pull.js +5 -4
- package/dist/commands/processes/push.js +1 -1
- package/dist/commands/processes/status.js +9 -0
- package/dist/commands/runtime-env.js +2 -2
- package/dist/core/commands/resource-command.d.ts +4 -1
- package/dist/core/commands/resource-command.js +9 -2
- package/dist/core/dependencies/javascript-env-dependencies.js +4 -4
- package/dist/core/dependencies/python-env-dependencies.js +5 -4
- package/dist/core/executors/execution-task.js +1 -1
- package/dist/core/executors/javascript-execution-task.js +21 -17
- package/dist/core/executors/python-execution-task.js +11 -10
- package/dist/core/resource-pusher.js +13 -7
- package/dist/core/types.d.ts +16 -3
- package/dist/core/types.js +31 -6
- package/dist/repositories/locale.js +5 -3
- package/dist/repositories/process.js +4 -2
- package/dist/repositories/script-library.js +3 -2
- package/dist/runtime/libs/python/fcode/datastore.py +3 -1
- package/dist/services/fcode-graphql-client.d.ts +26 -7
- package/dist/services/fcode-graphql-client.js +90 -41
- package/dist/services/skills-installer.js +2 -2
- package/dist/services/version-pull-reporter.d.ts +20 -0
- package/dist/services/version-pull-reporter.js +33 -0
- package/dist/utils/child-process.d.ts +26 -0
- package/dist/utils/child-process.js +60 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commandLineFor = commandLineFor;
|
|
4
|
+
exports.spawnCommand = spawnCommand;
|
|
5
|
+
exports.binShimPath = binShimPath;
|
|
6
|
+
exports.venvExecutablePath = venvExecutablePath;
|
|
7
|
+
exports.venvPythonPath = venvPythonPath;
|
|
8
|
+
exports.childEnv = childEnv;
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const path = require("node:path");
|
|
11
|
+
const quoteForCmd = (part) => (/[\s"]/.test(part) ? `"${part.replace(/"/g, '""')}"` : part);
|
|
12
|
+
/**
|
|
13
|
+
* How to invoke a package-manager executable (`npm`, `npx`, a `node_modules/.bin` shim) on `platform`.
|
|
14
|
+
*
|
|
15
|
+
* On Windows those are `.cmd` batch files, which Node refuses to spawn without a shell, so the
|
|
16
|
+
* command line goes through `cmd.exe` with every part quoted for it.
|
|
17
|
+
*/
|
|
18
|
+
function commandLineFor(command, args, platform = process.platform) {
|
|
19
|
+
if (platform !== 'win32') {
|
|
20
|
+
return { command, args, shell: false };
|
|
21
|
+
}
|
|
22
|
+
return { command: quoteForCmd(command), args: args.map(quoteForCmd), shell: true };
|
|
23
|
+
}
|
|
24
|
+
function spawnCommand(command, args, options = {}) {
|
|
25
|
+
const line = commandLineFor(command, args);
|
|
26
|
+
return (0, node_child_process_1.spawn)(line.command, line.args, { ...options, shell: line.shell });
|
|
27
|
+
}
|
|
28
|
+
/** The `node_modules/.bin` shim `name` resolves to on `platform`. */
|
|
29
|
+
function binShimPath(nodeModulesPath, name, platform = process.platform) {
|
|
30
|
+
return path.join(nodeModulesPath, '.bin', platform === 'win32' ? `${name}.cmd` : name);
|
|
31
|
+
}
|
|
32
|
+
/** The executable `name` a Python virtual environment at `envPath` exposes on `platform`. */
|
|
33
|
+
function venvExecutablePath(envPath, name, platform = process.platform) {
|
|
34
|
+
return platform === 'win32' ? path.join(envPath, 'Scripts', `${name}.exe`) : path.join(envPath, 'bin', name);
|
|
35
|
+
}
|
|
36
|
+
/** The Python interpreter of the virtual environment at `envPath`; Windows venvs ship no `python3` alias. */
|
|
37
|
+
function venvPythonPath(envPath, platform = process.platform) {
|
|
38
|
+
return venvExecutablePath(envPath, platform === 'win32' ? 'python' : 'python3', platform);
|
|
39
|
+
}
|
|
40
|
+
const WINDOWS_SYSTEM_ENV_KEYS = ['SYSTEMROOT', 'SYSTEMDRIVE', 'WINDIR', 'COMSPEC', 'PATHEXT', 'TEMP', 'TMP', 'USERPROFILE', 'APPDATA', 'LOCALAPPDATA'];
|
|
41
|
+
/**
|
|
42
|
+
* An environment for a process run locally: the entries given plus, on Windows, the system
|
|
43
|
+
* variables Node and Python cannot start without (`SYSTEMROOT`, `TEMP`, ...).
|
|
44
|
+
*/
|
|
45
|
+
function childEnv(entries, platform = process.platform, hostEnv = process.env) {
|
|
46
|
+
const env = {};
|
|
47
|
+
if (platform === 'win32') {
|
|
48
|
+
for (const [key, value] of Object.entries(hostEnv)) {
|
|
49
|
+
if (value !== undefined && WINDOWS_SYSTEM_ENV_KEYS.includes(key.toUpperCase())) {
|
|
50
|
+
env[key] = value;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
55
|
+
if (value !== undefined) {
|
|
56
|
+
env[key] = value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return env;
|
|
60
|
+
}
|
package/oclif.manifest.json
CHANGED