llmignore-cli 0.1.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 +14 -0
- package/bin/cli.js +30 -0
- package/bin/install.js +87 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# llmignore
|
|
2
|
+
|
|
3
|
+
Like `.gitignore`, but it tells AI tools (Claude Code, Cursor, Copilot, ...) what **not** to read.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx llmignore-cli init # write a .llmignore with strong defaults
|
|
7
|
+
npx llmignore-cli scan # any secrets currently exposed to AI? (exit 1 if yes)
|
|
8
|
+
npx llmignore-cli sync # mirror it into .cursorignore, .aiexclude, ...
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This package (`llmignore-cli`) installs a small native binary (built in Rust) for your
|
|
12
|
+
platform on first use. The installed command is `llmignore`.
|
|
13
|
+
|
|
14
|
+
Full docs: https://github.com/horiastanxd/llmignore
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Thin launcher: ensures the native binary exists (downloading it on first run if a
|
|
5
|
+
// postinstall was skipped), then forwards all arguments to it and mirrors its exit code.
|
|
6
|
+
|
|
7
|
+
const fs = require("fs");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const { spawnSync } = require("child_process");
|
|
10
|
+
|
|
11
|
+
const bin = path.join(
|
|
12
|
+
__dirname,
|
|
13
|
+
process.platform === "win32" ? "llmignore.exe" : "llmignore"
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(bin)) {
|
|
17
|
+
const install = spawnSync(process.execPath, [path.join(__dirname, "install.js")], {
|
|
18
|
+
stdio: "inherit",
|
|
19
|
+
});
|
|
20
|
+
if (install.status !== 0) {
|
|
21
|
+
process.exit(install.status || 1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const run = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
26
|
+
if (run.error) {
|
|
27
|
+
console.error(`[llmignore] failed to run binary: ${run.error.message}`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
process.exit(run.status === null ? 1 : run.status);
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// Downloads the correct prebuilt llmignore binary from GitHub Releases and places
|
|
5
|
+
// it next to this script. Runs on `npm install` (postinstall) and, as a fallback,
|
|
6
|
+
// is invoked by cli.js the first time the binary is missing.
|
|
7
|
+
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const https = require("https");
|
|
11
|
+
const { execFileSync } = require("child_process");
|
|
12
|
+
|
|
13
|
+
const pkg = require("../package.json");
|
|
14
|
+
const REPO = "horiastanxd/llmignore";
|
|
15
|
+
const VERSION = pkg.version;
|
|
16
|
+
|
|
17
|
+
const TARGETS = {
|
|
18
|
+
"linux-x64": "x86_64-unknown-linux-musl",
|
|
19
|
+
"linux-arm64": "aarch64-unknown-linux-musl",
|
|
20
|
+
"darwin-x64": "x86_64-apple-darwin",
|
|
21
|
+
"darwin-arm64": "aarch64-apple-darwin",
|
|
22
|
+
"win32-x64": "x86_64-pc-windows-msvc",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function resolveTarget() {
|
|
26
|
+
const key = `${process.platform}-${process.arch}`;
|
|
27
|
+
const target = TARGETS[key];
|
|
28
|
+
if (!target) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`unsupported platform "${key}". Install with: cargo install llmignore`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function binName() {
|
|
37
|
+
return process.platform === "win32" ? "llmignore.exe" : "llmignore";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function download(url, dest) {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
https
|
|
43
|
+
.get(url, { headers: { "User-Agent": "llmignore-installer" } }, (res) => {
|
|
44
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
45
|
+
res.resume();
|
|
46
|
+
return download(res.headers.location, dest).then(resolve, reject);
|
|
47
|
+
}
|
|
48
|
+
if (res.statusCode !== 200) {
|
|
49
|
+
res.resume();
|
|
50
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
51
|
+
}
|
|
52
|
+
const file = fs.createWriteStream(dest);
|
|
53
|
+
res.pipe(file);
|
|
54
|
+
file.on("finish", () => file.close(() => resolve()));
|
|
55
|
+
file.on("error", reject);
|
|
56
|
+
})
|
|
57
|
+
.on("error", reject);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function main() {
|
|
62
|
+
const target = resolveTarget();
|
|
63
|
+
const ext = process.platform === "win32" ? "zip" : "tar.gz";
|
|
64
|
+
const asset = `llmignore-${target}.${ext}`;
|
|
65
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`;
|
|
66
|
+
const dir = __dirname;
|
|
67
|
+
const archive = path.join(dir, asset);
|
|
68
|
+
|
|
69
|
+
await download(url, archive);
|
|
70
|
+
// bsdtar (default `tar` on Linux, macOS and Windows 10+) extracts both .tar.gz and .zip.
|
|
71
|
+
execFileSync("tar", ["-xf", archive, "-C", dir], { stdio: "inherit" });
|
|
72
|
+
fs.unlinkSync(archive);
|
|
73
|
+
|
|
74
|
+
const bin = path.join(dir, binName());
|
|
75
|
+
if (!fs.existsSync(bin)) {
|
|
76
|
+
throw new Error("binary not found in archive after extraction");
|
|
77
|
+
}
|
|
78
|
+
if (process.platform !== "win32") {
|
|
79
|
+
fs.chmodSync(bin, 0o755);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
main().catch((err) => {
|
|
84
|
+
console.error(`[llmignore] could not install the prebuilt binary: ${err.message}`);
|
|
85
|
+
console.error("[llmignore] alternative: cargo install llmignore");
|
|
86
|
+
process.exit(1);
|
|
87
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "llmignore-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Like .gitignore, but tells AI tools what NOT to read. Fast native scanner for .llmignore files.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"llm",
|
|
8
|
+
"gitignore",
|
|
9
|
+
"llmignore",
|
|
10
|
+
"cursor",
|
|
11
|
+
"claude",
|
|
12
|
+
"copilot",
|
|
13
|
+
"cli",
|
|
14
|
+
"secrets",
|
|
15
|
+
"context"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/horiastanxd/llmignore#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/horiastanxd/llmignore/issues"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/horiastanxd/llmignore.git"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"author": "horiastanxd",
|
|
27
|
+
"bin": {
|
|
28
|
+
"llmignore": "bin/cli.js"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"postinstall": "node bin/install.js"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"bin/cli.js",
|
|
35
|
+
"bin/install.js"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=16"
|
|
39
|
+
},
|
|
40
|
+
"os": [
|
|
41
|
+
"linux",
|
|
42
|
+
"darwin",
|
|
43
|
+
"win32"
|
|
44
|
+
],
|
|
45
|
+
"cpu": [
|
|
46
|
+
"x64",
|
|
47
|
+
"arm64"
|
|
48
|
+
]
|
|
49
|
+
}
|