fundamentum-cli 0.1.6 → 0.2.1
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 +15 -1
- package/install.js +11 -3
- package/package.json +6 -6
- package/run.js +24 -0
package/README.md
CHANGED
|
@@ -27,6 +27,13 @@ npx fundamentum-cli apply OWNER/REPO
|
|
|
27
27
|
|
|
28
28
|
Works on **macOS** and **Linux** (`x64` and `arm64`) and **Windows** (`x64`). Postinstall downloads the matching prebuilt binary from GitHub Releases with embedded SHA-256 verification.
|
|
29
29
|
|
|
30
|
+
A git checkout keeps `package.json` at `0.0.0` and will not download a binary. Build it locally instead:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
go build -o npm/bin/fundamentum .
|
|
34
|
+
# Windows: go build -o npm/bin/fundamentum.exe .
|
|
35
|
+
```
|
|
36
|
+
|
|
30
37
|
> **npm 9+ / Ubuntu 26+ note:** npm's `allow-scripts` security policy may block the postinstall
|
|
31
38
|
> script, so the binary won't be downloaded at install time. No worries — if `fundamentum` is invoked
|
|
32
39
|
> without a binary present it detects this and downloads automatically. You can also trigger it
|
|
@@ -79,10 +86,17 @@ Built for solo devs and small teams who want their repos to feel like they were
|
|
|
79
86
|
|---------|---------|
|
|
80
87
|
| `apply OWNER/REPO` | Harden an existing repo |
|
|
81
88
|
| `init OWNER/REPO` | Create a new repo, then harden it |
|
|
89
|
+
| `audit OWNER/REPO` | Verify the repo matches the harden baseline |
|
|
90
|
+
| `export` | Write a portable JSON baseline (`-o` for a file) |
|
|
82
91
|
| `--dry-run` | Preview the full plan without applying |
|
|
83
|
-
| `--pr` | Batch file changes into a
|
|
92
|
+
| `--pr` | Batch file changes into a PR; settings/security/protection still apply live |
|
|
84
93
|
| `--no-overwrite` | Only add missing files, never touch existing ones |
|
|
85
94
|
| `--advanced-security` | Enable GHAS (secret scanning, push protection) on private/internal repos (paid) |
|
|
95
|
+
| `--strict` | Fail the run when any core harden step fails, including optional tag/security items |
|
|
96
|
+
| `--require-checks` | Required status-check contexts for protect-main (comma-separated; default: jobs for the resolved `--ci` pack) |
|
|
97
|
+
| `--ci` | CI pack: `auto` (detect go/node/python/rust, else generic), `go`, `node`, `python`, `rust`, `generic`, or `none` |
|
|
98
|
+
| `--preset` | Named baseline: `oss` (no prompts), `private` (solo, no GHAS prompt), `strict` (`--strict` + GHAS) |
|
|
99
|
+
| `--from` | Load a portable JSON baseline from `export` |
|
|
86
100
|
|
|
87
101
|
## Prerequisites
|
|
88
102
|
|
package/install.js
CHANGED
|
@@ -18,6 +18,8 @@ const RELEASE_HOSTS = new Set([
|
|
|
18
18
|
"github-releases.githubusercontent.com",
|
|
19
19
|
]);
|
|
20
20
|
|
|
21
|
+
const binaryName = process.platform === "win32" ? "fundamentum.exe" : "fundamentum";
|
|
22
|
+
|
|
21
23
|
const PLATFORM_MAP = {
|
|
22
24
|
linux: "linux",
|
|
23
25
|
darwin: "darwin",
|
|
@@ -171,8 +173,6 @@ function extract(buffer, archiveName, binDir) {
|
|
|
171
173
|
spawnOrFail("tar", ["-xzf", archivePath, "-C", tmpDir], "tar");
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
// Find the binary in the extracted files
|
|
175
|
-
const binaryName = process.platform === "win32" ? "fundamentum.exe" : "fundamentum";
|
|
176
176
|
const extractedBinary = path.join(tmpDir, binaryName);
|
|
177
177
|
|
|
178
178
|
if (!fs.existsSync(extractedBinary)) {
|
|
@@ -197,7 +197,15 @@ async function main() {
|
|
|
197
197
|
);
|
|
198
198
|
const version = getPackageVersion(pkg);
|
|
199
199
|
if (version === "0.0.0") {
|
|
200
|
-
console.error(
|
|
200
|
+
console.error(
|
|
201
|
+
"fundamentum: package version is 0.0.0 (git checkout / unpublished).\n" +
|
|
202
|
+
"The release installer will not download a binary from here.\n" +
|
|
203
|
+
"Build locally instead:\n" +
|
|
204
|
+
" go build -o npm/bin/" +
|
|
205
|
+
binaryName +
|
|
206
|
+
" .\n" +
|
|
207
|
+
"Or install a published release: npm install -g fundamentum-cli"
|
|
208
|
+
);
|
|
201
209
|
return;
|
|
202
210
|
}
|
|
203
211
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fundamentum-cli",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Bootstrap and harden GitHub repos for OSS collaboration — community files, branch protection, security features, and starter workflows in one command.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"bin/"
|
|
58
58
|
],
|
|
59
59
|
"binaryChecksums": {
|
|
60
|
-
"fundamentum_0.
|
|
61
|
-
"fundamentum_0.
|
|
62
|
-
"fundamentum_0.
|
|
63
|
-
"fundamentum_0.
|
|
64
|
-
"fundamentum_0.
|
|
60
|
+
"fundamentum_0.2.1_darwin_amd64.tar.gz": "9b2e7663d4cc1ecb4a68dbebffd3c767163e8c4b3e289664a57b580a3c83038c",
|
|
61
|
+
"fundamentum_0.2.1_darwin_arm64.tar.gz": "2c3f781edda93765b1bd497cdb8ae96d0a33defff85402803fb3ba48988cfe90",
|
|
62
|
+
"fundamentum_0.2.1_linux_amd64.tar.gz": "0bbc0b978b416963bb0fe1a708b8b441ea48906cb7b9877e6469006fe27177cf",
|
|
63
|
+
"fundamentum_0.2.1_linux_arm64.tar.gz": "4eac1f23e17429da60d7689a366aadab53d6cdb251de0571c87ca9968fa10030",
|
|
64
|
+
"fundamentum_0.2.1_windows_amd64.zip": "4f0f645f2f03d9a59853aff9cc86f9de44458715cf35c94571be56178df30318"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/run.js
CHANGED
|
@@ -37,10 +37,34 @@ function runBinary() {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function isDevCheckout() {
|
|
41
|
+
try {
|
|
42
|
+
const pkg = JSON.parse(
|
|
43
|
+
fs.readFileSync(path.join(__dirname, "package.json"), "utf8")
|
|
44
|
+
);
|
|
45
|
+
return pkg.version === "0.0.0";
|
|
46
|
+
} catch (_) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
40
51
|
// If the binary is missing, postinstall was likely blocked by npm's allow-scripts
|
|
41
52
|
// security policy. Attempt a lazy download, but the package dir may be root-owned
|
|
42
53
|
// (e.g. sudo npm install -g). In that case, surface a clear recovery message.
|
|
43
54
|
if (!fs.existsSync(binaryPath)) {
|
|
55
|
+
if (isDevCheckout()) {
|
|
56
|
+
console.error(
|
|
57
|
+
"fundamentum: binary not found and package version is 0.0.0 (git checkout).\n" +
|
|
58
|
+
"install.js will not download a release binary in this state.\n" +
|
|
59
|
+
"Build locally:\n" +
|
|
60
|
+
" go build -o npm/bin/" +
|
|
61
|
+
binaryName +
|
|
62
|
+
" .\n" +
|
|
63
|
+
"Or install a published release: npm install -g fundamentum-cli"
|
|
64
|
+
);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
const installScript = path.join(__dirname, "install.js");
|
|
45
69
|
|
|
46
70
|
// Check if we can write to the package dir before attempting the download.
|