@forgeone/cli 1.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.
- package/README.md +67 -0
- package/bin/forge.js +89 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @forgeone/cli
|
|
2
|
+
|
|
3
|
+
> **AI-native developer framework** — scaffold, lint, scan, and ship production-grade services without touching Go.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g @forgeone/cli
|
|
9
|
+
# or run without installing
|
|
10
|
+
npx @forgeone/cli new my-app --template ts-service
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
No Go installation required. The right pre-compiled binary is pulled automatically for your platform.
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
# Scaffold a new TypeScript/NestJS service
|
|
19
|
+
forge new my-app --template ts-service
|
|
20
|
+
cd my-app && npm install && npm run dev
|
|
21
|
+
|
|
22
|
+
# Or initialise the current directory (like git init / npm init)
|
|
23
|
+
mkdir my-app && cd my-app
|
|
24
|
+
forge init
|
|
25
|
+
|
|
26
|
+
# List all available templates
|
|
27
|
+
forge new --list
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Supported platforms
|
|
31
|
+
|
|
32
|
+
| Platform | Package |
|
|
33
|
+
|---|---|
|
|
34
|
+
| Linux x64 | `@forgeone/cli-linux-x64` |
|
|
35
|
+
| Linux arm64 | `@forgeone/cli-linux-arm64` |
|
|
36
|
+
| macOS x64 | `@forgeone/cli-darwin-x64` |
|
|
37
|
+
| macOS arm64 (Apple Silicon) | `@forgeone/cli-darwin-arm64` |
|
|
38
|
+
| Windows x64 | `@forgeone/cli-win32-x64` |
|
|
39
|
+
|
|
40
|
+
## Commands
|
|
41
|
+
|
|
42
|
+
| Command | What it does |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `forge new <template> <name>` | Scaffold a new project in a new directory |
|
|
45
|
+
| `forge init [path]` | Initialise an existing directory as a Forge project |
|
|
46
|
+
| `forge lint` | Run Forge hygiene linting |
|
|
47
|
+
| `forge scan secrets` | Scan for leaked secrets |
|
|
48
|
+
| `forge scan security` | Run SAST security scan |
|
|
49
|
+
| `forge doctor` | Health-check the current project |
|
|
50
|
+
| `forge ship` | Production readiness gate |
|
|
51
|
+
| `forge eval` | Run AI eval scenarios |
|
|
52
|
+
|
|
53
|
+
Run `forge --help` for the full command reference.
|
|
54
|
+
|
|
55
|
+
## Building from source
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
git clone https://github.com/teragrid/forge
|
|
59
|
+
cd forge
|
|
60
|
+
go build -o dist/forge ./cmd/forge
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Requires Go 1.24+.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
Apache-2.0 — see [LICENSE](https://github.com/teragrid/forge/blob/main/LICENSE).
|
package/bin/forge.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// bin/forge.js — @forgeone/cli platform wrapper
|
|
3
|
+
//
|
|
4
|
+
// Resolves the pre-compiled Go binary for the current platform from the
|
|
5
|
+
// matching optional dependency package, then execs it transparently.
|
|
6
|
+
//
|
|
7
|
+
// Pattern used by: esbuild, @biomejs/biome, turbo, prisma, oxc-parser.
|
|
8
|
+
// No Go installation required on the user's machine.
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const { execFileSync } = require("child_process");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
|
|
16
|
+
// ── Platform → optional-dependency mapping ──────────────────────────────────
|
|
17
|
+
|
|
18
|
+
const PLATFORM_PACKAGES = {
|
|
19
|
+
"linux-x64": ["@forgeone/cli-linux-x64", "forge"],
|
|
20
|
+
"linux-arm64": ["@forgeone/cli-linux-arm64", "forge"],
|
|
21
|
+
"darwin-x64": ["@forgeone/cli-darwin-x64", "forge"],
|
|
22
|
+
"darwin-arm64": ["@forgeone/cli-darwin-arm64", "forge"],
|
|
23
|
+
"win32-x64": ["@forgeone/cli-win32-x64", "forge.exe"],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// ── Resolve binary path ──────────────────────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
function resolveBinary() {
|
|
29
|
+
const platform = `${process.platform}-${process.arch}`;
|
|
30
|
+
const entry = PLATFORM_PACKAGES[platform];
|
|
31
|
+
|
|
32
|
+
if (!entry) {
|
|
33
|
+
fatal(
|
|
34
|
+
`Unsupported platform: ${platform}\n` +
|
|
35
|
+
`Supported: ${Object.keys(PLATFORM_PACKAGES).join(", ")}\n` +
|
|
36
|
+
`You can build from source: https://github.com/teragrid/forge#building-from-source`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const [pkgName, binaryName] = entry;
|
|
41
|
+
|
|
42
|
+
// Walk up from this file to find the package inside node_modules.
|
|
43
|
+
// Works whether @forge/cli is installed globally, locally, or via npx.
|
|
44
|
+
let dir = __dirname;
|
|
45
|
+
for (let i = 0; i < 5; i++) {
|
|
46
|
+
dir = path.dirname(dir);
|
|
47
|
+
const candidate = path.join(dir, "node_modules", pkgName, "bin", binaryName);
|
|
48
|
+
if (fs.existsSync(candidate)) {
|
|
49
|
+
return candidate;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
fatal(
|
|
54
|
+
`Could not find the ${pkgName} package.\n` +
|
|
55
|
+
`This usually means the optional dependency was skipped during install.\n` +
|
|
56
|
+
`Try: npm install --include=optional\n` +
|
|
57
|
+
`Or install directly: npm install ${pkgName}`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ── Execute ──────────────────────────────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
function main() {
|
|
64
|
+
const binary = resolveBinary();
|
|
65
|
+
|
|
66
|
+
// Make sure the binary is executable (npm may strip the bit on unpack).
|
|
67
|
+
try {
|
|
68
|
+
fs.chmodSync(binary, 0o755);
|
|
69
|
+
} catch (_) {
|
|
70
|
+
// Best-effort; Windows doesn't need it.
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
execFileSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
75
|
+
} catch (err) {
|
|
76
|
+
// execFileSync throws when the child exits non-zero.
|
|
77
|
+
// Mirror the child's exit code so shell pipelines work correctly.
|
|
78
|
+
process.exit(err.status ?? 1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
function fatal(msg) {
|
|
85
|
+
process.stderr.write(`\n[forge] ERROR: ${msg}\n\n`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forgeone/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Forge CLI — AI-native developer framework. Scaffold, lint, scan, ship.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"forge",
|
|
7
|
+
"scaffold",
|
|
8
|
+
"cli",
|
|
9
|
+
"ai",
|
|
10
|
+
"developer-tools",
|
|
11
|
+
"devex"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://forgeframework.dev",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/teragrid/forge/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/teragrid/forge.git",
|
|
20
|
+
"directory": "packages/cli"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"bin": {
|
|
24
|
+
"forge": "bin/forge.js"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"postinstall": "node bin/forge.js --version 2>/dev/null || true"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin/forge.js",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"optionalDependencies": {
|
|
34
|
+
"@forgeone/cli-linux-x64": "1.0.0",
|
|
35
|
+
"@forgeone/cli-linux-arm64": "1.0.0",
|
|
36
|
+
"@forgeone/cli-darwin-x64": "1.0.0",
|
|
37
|
+
"@forgeone/cli-darwin-arm64": "1.0.0",
|
|
38
|
+
"@forgeone/cli-win32-x64": "1.0.0"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|