@factorialco/fcode-cli 3.1.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 +24 -2
- package/dist/commands/app/push.d.ts +13 -0
- package/dist/commands/app/push.js +147 -0
- package/dist/commands/i18n/status.js +9 -0
- package/dist/commands/login.js +2 -1
- 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/commands/team/clone.js +1 -1
- package/dist/commands/team/pull.js +3 -2
- package/dist/commands/team/status.d.ts +2 -0
- package/dist/commands/team/status.js +44 -2
- package/dist/config/dev-team.d.ts +15 -0
- package/dist/config/dev-team.js +54 -1
- package/dist/config/settings.d.ts +1 -0
- package/dist/config/settings.js +6 -0
- 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/hooks/init/auth.d.ts +19 -0
- package/dist/hooks/init/auth.js +40 -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/app-metadata-files.d.ts +98 -0
- package/dist/services/app-metadata-files.js +363 -0
- package/dist/services/dashboard-client.d.ts +59 -0
- package/dist/services/dashboard-client.js +116 -10
- package/dist/services/dev-team-service.d.ts +4 -1
- package/dist/services/dev-team-service.js +31 -17
- 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 +35 -2
- package/package.json +4 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** One resource's version pull, named so a failure can say which resource it belongs to. */
|
|
2
|
+
export interface VersionPull {
|
|
3
|
+
slug: string;
|
|
4
|
+
failure: Promise<string | undefined>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Starts tracking one resource's version pull.
|
|
8
|
+
*
|
|
9
|
+
* The outcome is captured here rather than where it is reported, because the pulls are started in
|
|
10
|
+
* a loop that waits between them: a rejection would otherwise sit unhandled until the loop ends.
|
|
11
|
+
*/
|
|
12
|
+
export declare function trackVersionPull(slug: string, done: Promise<void>): VersionPull;
|
|
13
|
+
/**
|
|
14
|
+
* Awaits every version pull and reports the ones that failed.
|
|
15
|
+
*
|
|
16
|
+
* The pulls run in parallel and must not take each other down — one resource the cloud refuses is
|
|
17
|
+
* not a reason to abandon the rest — but a swallowed rejection leaves `versions/` silently empty,
|
|
18
|
+
* which reads exactly like a resource that has no versions. This is what tells the two apart.
|
|
19
|
+
*/
|
|
20
|
+
export declare function reportFailedVersionPulls(pulls: Array<VersionPull>, resourceName: string): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackVersionPull = trackVersionPull;
|
|
4
|
+
exports.reportFailedVersionPulls = reportFailedVersionPulls;
|
|
5
|
+
const color_1 = require("@oclif/color");
|
|
6
|
+
const cli_1 = require("../utils/cli");
|
|
7
|
+
/**
|
|
8
|
+
* Starts tracking one resource's version pull.
|
|
9
|
+
*
|
|
10
|
+
* The outcome is captured here rather than where it is reported, because the pulls are started in
|
|
11
|
+
* a loop that waits between them: a rejection would otherwise sit unhandled until the loop ends.
|
|
12
|
+
*/
|
|
13
|
+
function trackVersionPull(slug, done) {
|
|
14
|
+
return {
|
|
15
|
+
slug,
|
|
16
|
+
failure: done.then(() => undefined, (reason) => (reason instanceof Error ? reason.message : String(reason))),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Awaits every version pull and reports the ones that failed.
|
|
21
|
+
*
|
|
22
|
+
* The pulls run in parallel and must not take each other down — one resource the cloud refuses is
|
|
23
|
+
* not a reason to abandon the rest — but a swallowed rejection leaves `versions/` silently empty,
|
|
24
|
+
* which reads exactly like a resource that has no versions. This is what tells the two apart.
|
|
25
|
+
*/
|
|
26
|
+
async function reportFailedVersionPulls(pulls, resourceName) {
|
|
27
|
+
for (const { slug, failure } of pulls) {
|
|
28
|
+
const reason = await failure;
|
|
29
|
+
if (reason !== undefined) {
|
|
30
|
+
cli_1.default.log(color_1.default.yellow(`⚠️ could not pull the versions of ${resourceName} '${slug}': ${reason}`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ChildProcess, type SpawnOptions } from 'node:child_process';
|
|
2
|
+
export type Platform = NodeJS.Platform;
|
|
3
|
+
export interface CommandLine {
|
|
4
|
+
command: string;
|
|
5
|
+
args: string[];
|
|
6
|
+
shell: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* How to invoke a package-manager executable (`npm`, `npx`, a `node_modules/.bin` shim) on `platform`.
|
|
10
|
+
*
|
|
11
|
+
* On Windows those are `.cmd` batch files, which Node refuses to spawn without a shell, so the
|
|
12
|
+
* command line goes through `cmd.exe` with every part quoted for it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function commandLineFor(command: string, args: string[], platform?: Platform): CommandLine;
|
|
15
|
+
export declare function spawnCommand(command: string, args: string[], options?: SpawnOptions): ChildProcess;
|
|
16
|
+
/** The `node_modules/.bin` shim `name` resolves to on `platform`. */
|
|
17
|
+
export declare function binShimPath(nodeModulesPath: string, name: string, platform?: Platform): string;
|
|
18
|
+
/** The executable `name` a Python virtual environment at `envPath` exposes on `platform`. */
|
|
19
|
+
export declare function venvExecutablePath(envPath: string, name: string, platform?: Platform): string;
|
|
20
|
+
/** The Python interpreter of the virtual environment at `envPath`; Windows venvs ship no `python3` alias. */
|
|
21
|
+
export declare function venvPythonPath(envPath: string, platform?: Platform): string;
|
|
22
|
+
/**
|
|
23
|
+
* An environment for a process run locally: the entries given plus, on Windows, the system
|
|
24
|
+
* variables Node and Python cannot start without (`SYSTEMROOT`, `TEMP`, ...).
|
|
25
|
+
*/
|
|
26
|
+
export declare function childEnv(entries: Record<string, string | undefined>, platform?: Platform, hostEnv?: NodeJS.ProcessEnv): Record<string, string>;
|
|
@@ -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
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
},
|
|
221
221
|
"prompt": {
|
|
222
222
|
"char": "x",
|
|
223
|
-
"description": "Prompt for email and password (instead of opening browser)",
|
|
223
|
+
"description": "Prompt for email and password (instead of opening browser). Make it the default with 'fcode config:set disableBrowserLogin true' or FCODE_DISABLE_BROWSER_LOGIN=true",
|
|
224
224
|
"name": "prompt",
|
|
225
225
|
"allowNo": false,
|
|
226
226
|
"type": "boolean"
|
|
@@ -701,6 +701,39 @@
|
|
|
701
701
|
"test.js"
|
|
702
702
|
]
|
|
703
703
|
},
|
|
704
|
+
"app:push": {
|
|
705
|
+
"aliases": [],
|
|
706
|
+
"args": {},
|
|
707
|
+
"description": "Upload the App folder's README.md and MARKETPLACE.md to the dashboard",
|
|
708
|
+
"examples": [
|
|
709
|
+
"$ fcode app:push",
|
|
710
|
+
"$ fcode app:push --force"
|
|
711
|
+
],
|
|
712
|
+
"flags": {
|
|
713
|
+
"force": {
|
|
714
|
+
"char": "f",
|
|
715
|
+
"description": "Force command",
|
|
716
|
+
"name": "force",
|
|
717
|
+
"allowNo": false,
|
|
718
|
+
"type": "boolean"
|
|
719
|
+
}
|
|
720
|
+
},
|
|
721
|
+
"hasDynamicHelp": false,
|
|
722
|
+
"hiddenAliases": [],
|
|
723
|
+
"id": "app:push",
|
|
724
|
+
"pluginAlias": "@factorialco/fcode-cli",
|
|
725
|
+
"pluginName": "@factorialco/fcode-cli",
|
|
726
|
+
"pluginType": "core",
|
|
727
|
+
"strict": true,
|
|
728
|
+
"enableJsonFlag": false,
|
|
729
|
+
"isESM": false,
|
|
730
|
+
"relativePath": [
|
|
731
|
+
"dist",
|
|
732
|
+
"commands",
|
|
733
|
+
"app",
|
|
734
|
+
"push.js"
|
|
735
|
+
]
|
|
736
|
+
},
|
|
704
737
|
"config:get": {
|
|
705
738
|
"aliases": [],
|
|
706
739
|
"args": {
|
|
@@ -2483,5 +2516,5 @@
|
|
|
2483
2516
|
]
|
|
2484
2517
|
}
|
|
2485
2518
|
},
|
|
2486
|
-
"version": "3.
|
|
2519
|
+
"version": "3.3.0"
|
|
2487
2520
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorialco/fcode-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"packageManager": "pnpm@11.7.0",
|
|
5
5
|
"description": "Factorial Code Command Line Interface",
|
|
6
6
|
"homepage": "https://code.factorialhr.com/docs/cli/",
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
},
|
|
128
128
|
"team": {
|
|
129
129
|
"description": "Work with every App your development team owns, in one folder"
|
|
130
|
+
},
|
|
131
|
+
"app": {
|
|
132
|
+
"description": "Work on the App folder around a workspace: its README, marketplace listing and changelog"
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
},
|