@forgedesk/cli 2.0.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.
Files changed (3) hide show
  1. package/README.md +27 -0
  2. package/bin/forge.js +57 -0
  3. package/package.json +35 -0
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @forgedesk/cli
2
+
3
+ Node wrapper for the Forge Python CLI.
4
+
5
+ ## Requirements
6
+
7
+ - Python 3.14+ free-threaded runtime (`forge-framework`)
8
+ - Node.js 18+
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install -D @forgedesk/cli
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ npx forge create my-app --template react
20
+ npx forge dev
21
+ npx forge build
22
+ npx forge package --result-format json
23
+ npx forge sign --result-format json
24
+ ```
25
+
26
+ If the Python Forge package is missing, the wrapper attempts to install `forge-framework` with `pip` unless `FORGE_SKIP_AUTO_INSTALL=1` is set.
27
+ The wrapper is intended to run against the same free-threaded Forge runtime used by the main framework.
package/bin/forge.js ADDED
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+
4
+ function pythonLaunchers() {
5
+ if (process.platform === "win32") {
6
+ return [
7
+ { command: "py", args: ["-3"] },
8
+ { command: "python", args: [] },
9
+ ];
10
+ }
11
+ return [
12
+ { command: process.env.FORGE_PYTHON || "python3", args: [] },
13
+ { command: "python", args: [] },
14
+ ];
15
+ }
16
+
17
+ function run(command, args) {
18
+ const child = spawnSync(command, args, { stdio: "inherit" });
19
+ return child.status ?? 1;
20
+ }
21
+
22
+ function ensurePythonForge() {
23
+ for (const launcher of pythonLaunchers()) {
24
+ const probe = spawnSync(launcher.command, [...launcher.args, "-m", "forge_cli.main", "--help"], {
25
+ stdio: "ignore",
26
+ });
27
+ if (probe.status === 0) {
28
+ return launcher;
29
+ }
30
+ }
31
+
32
+ if (process.env.FORGE_SKIP_AUTO_INSTALL === "1") {
33
+ return null;
34
+ }
35
+
36
+ for (const launcher of pythonLaunchers()) {
37
+ const install = spawnSync(
38
+ launcher.command,
39
+ [...launcher.args, "-m", "pip", "install", "forge-framework"],
40
+ { stdio: "inherit" },
41
+ );
42
+ if (install.status === 0) {
43
+ return launcher;
44
+ }
45
+ }
46
+ return null;
47
+ }
48
+
49
+ const argv = process.argv.slice(2);
50
+
51
+ const launcher = ensurePythonForge();
52
+ if (!launcher) {
53
+ console.error("\x1b[1;31m✖\x1b[0m \x1b[1mForge CLI is unavailable.\x1b[0m\n\x1b[33mInstall Python 3.14+ and run:\x1b[0m \x1b[36mpython -m pip install forge-framework\x1b[0m");
54
+ process.exit(1);
55
+ }
56
+
57
+ process.exit(run(launcher.command, [...launcher.args, "-m", "forge_cli.main", ...argv]));
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@forgedesk/cli",
3
+ "version": "2.0.0",
4
+ "description": "Node wrapper for the Forge Python CLI",
5
+ "license": "MIT",
6
+ "homepage": "https://forge-framework.dev",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/swadhinbiswas/Forge.git",
10
+ "directory": "packages/cli"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/swadhinbiswas/Forge/issues"
14
+ },
15
+ "type": "module",
16
+ "bin": {
17
+ "forge": "./bin/forge.js"
18
+ },
19
+ "files": [
20
+ "bin/forge.js",
21
+ "README.md"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "engines": {
27
+ "node": ">=18"
28
+ },
29
+ "keywords": [
30
+ "forge",
31
+ "cli",
32
+ "desktop",
33
+ "python"
34
+ ]
35
+ }