briff-scan 0.1.0 → 0.1.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 +12 -3
- package/dist/cli.mjs +31 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,9 +35,12 @@ jobs:
|
|
|
35
35
|
scan:
|
|
36
36
|
runs-on: ubuntu-latest
|
|
37
37
|
steps:
|
|
38
|
-
- uses: actions/checkout@
|
|
39
|
-
- uses: actions/setup-node@
|
|
40
|
-
with:
|
|
38
|
+
- uses: actions/checkout@v5
|
|
39
|
+
- uses: actions/setup-node@v5
|
|
40
|
+
with:
|
|
41
|
+
node-version: 22
|
|
42
|
+
check-latest: true # newest 22.x, not the runner's cached one
|
|
43
|
+
package-manager-cache: false
|
|
41
44
|
- run: npx briff-scan@0
|
|
42
45
|
env:
|
|
43
46
|
BRIFF_API_URL: https://app.briff.dev
|
|
@@ -66,11 +69,17 @@ BRIFF_TOKEN=brf_... npx briff-scan@0 --all-repos --root ~/code # every git rep
|
|
|
66
69
|
| `--repo-name <name>` | | `GITHUB_REPOSITORY` in Actions, else the folder name |
|
|
67
70
|
| `--all-repos` | | off: the root is one repo |
|
|
68
71
|
| `--include-worktrees` | | off (with `--all-repos`) |
|
|
72
|
+
| `--exclude <name>` | | none; repeatable or comma-separated |
|
|
69
73
|
| `--max-depth <n>` | | 6 |
|
|
70
74
|
| `--chunk <n>` | | 10 repos per upload (with `--all-repos`) |
|
|
71
75
|
| `--dry-run` | | off |
|
|
72
76
|
| `--json` | | off: machine-readable output |
|
|
73
77
|
|
|
78
|
+
`--exclude` skips a repo by the exact name Briff would get: its path under `--root` with
|
|
79
|
+
`--all-repos` (`--exclude work/site,old-app`), else the `--repo-name` / folder name. Use it on a
|
|
80
|
+
machine that scans a folder of repos when one of them already runs the GitHub Action, so it is
|
|
81
|
+
not uploaded twice.
|
|
82
|
+
|
|
74
83
|
Exit codes: 0 done, 1 the scan or upload failed, 2 bad options.
|
|
75
84
|
|
|
76
85
|
## Licence
|
package/dist/cli.mjs
CHANGED
|
@@ -7387,6 +7387,9 @@ Options:
|
|
|
7387
7387
|
--all-repos Scan every git repo under --root as its own repo, named by
|
|
7388
7388
|
its path relative to the root (a folder like ~/code)
|
|
7389
7389
|
--include-worktrees With --all-repos: also scan linked git worktrees
|
|
7390
|
+
--exclude <name> Skip the repo with this name, exactly as Briff would get it
|
|
7391
|
+
(the path under --root with --all-repos, else --repo-name);
|
|
7392
|
+
repeatable, or comma-separated: --exclude a,b
|
|
7390
7393
|
--max-depth <n> How deep to look for files (default 6)
|
|
7391
7394
|
--chunk <n> With --all-repos: repos per upload (default 10)
|
|
7392
7395
|
--dry-run Print what would be sent; send nothing
|
|
@@ -7402,6 +7405,10 @@ function positiveInt(value, flag, min) {
|
|
|
7402
7405
|
const n = Number(value);
|
|
7403
7406
|
return Number.isInteger(n) && n >= min ? n : `${flag} must be an integer >= ${min}`;
|
|
7404
7407
|
}
|
|
7408
|
+
function parseExclude(values) {
|
|
7409
|
+
const names = (values ?? []).flatMap((v) => v.split(",")).map((v) => v.trim().replace(/\/+$/, "")).filter((v) => v.length > 0);
|
|
7410
|
+
return [...new Set(names)];
|
|
7411
|
+
}
|
|
7405
7412
|
function resolveRepoName(flag, env, root) {
|
|
7406
7413
|
const explicit = flag?.trim();
|
|
7407
7414
|
if (explicit) return explicit;
|
|
@@ -7423,6 +7430,7 @@ function parseCliArgs(argv, env, cwd) {
|
|
|
7423
7430
|
"repo-name": { type: "string" },
|
|
7424
7431
|
"all-repos": { type: "boolean", default: false },
|
|
7425
7432
|
"include-worktrees": { type: "boolean", default: false },
|
|
7433
|
+
exclude: { type: "string", multiple: true },
|
|
7426
7434
|
"max-depth": { type: "string" },
|
|
7427
7435
|
chunk: { type: "string" },
|
|
7428
7436
|
"dry-run": { type: "boolean", default: false },
|
|
@@ -7472,6 +7480,7 @@ function parseCliArgs(argv, env, cwd) {
|
|
|
7472
7480
|
token,
|
|
7473
7481
|
root,
|
|
7474
7482
|
mode: allRepos ? { kind: "all", includeWorktrees: values["include-worktrees"] } : { kind: "single", repoName: resolveRepoName(values["repo-name"], env, root) },
|
|
7483
|
+
exclude: parseExclude(values.exclude),
|
|
7475
7484
|
source: env.GITHUB_ACTIONS === "true" ? "github" : "local",
|
|
7476
7485
|
dryRun: values["dry-run"],
|
|
7477
7486
|
json: values.json,
|
|
@@ -8225,6 +8234,12 @@ async function readGroup(group, root, warn) {
|
|
|
8225
8234
|
return { name: group.name, path: group.name, ecosystem: "npm", dependencies, runtimes };
|
|
8226
8235
|
}
|
|
8227
8236
|
async function collectRepos(root, mode, options) {
|
|
8237
|
+
const exclude = new Set(options.exclude ?? []);
|
|
8238
|
+
const skip = (name) => options.warn(`skip ${name}: excluded with --exclude`);
|
|
8239
|
+
if (mode.kind === "single" && exclude.has(mode.repoName)) {
|
|
8240
|
+
skip(mode.repoName);
|
|
8241
|
+
return [];
|
|
8242
|
+
}
|
|
8228
8243
|
const discovered = await discoverRepos(root, {
|
|
8229
8244
|
includeWorktrees: mode.kind === "single" || mode.includeWorktrees,
|
|
8230
8245
|
maxDepth: options.maxDepth
|
|
@@ -8236,7 +8251,18 @@ async function collectRepos(root, mode, options) {
|
|
|
8236
8251
|
lockfiles: discovered.flatMap((r) => r.lockfiles),
|
|
8237
8252
|
runtimeFiles: discovered.flatMap((r) => r.runtimeFiles)
|
|
8238
8253
|
}
|
|
8239
|
-
] : discovered
|
|
8254
|
+
] : discovered.filter((group) => {
|
|
8255
|
+
if (!exclude.has(group.name)) return true;
|
|
8256
|
+
skip(group.name);
|
|
8257
|
+
return false;
|
|
8258
|
+
});
|
|
8259
|
+
if (mode.kind === "all") {
|
|
8260
|
+
const found = new Set(discovered.map((group) => group.name));
|
|
8261
|
+
for (const name of exclude) {
|
|
8262
|
+
if (!found.has(name))
|
|
8263
|
+
options.warn(`--exclude ${name}: no repo with a lockfile or runtime file has that name`);
|
|
8264
|
+
}
|
|
8265
|
+
}
|
|
8240
8266
|
const payloads = [];
|
|
8241
8267
|
for (const group of groups) {
|
|
8242
8268
|
const payload = await readGroup(group, root, options.warn);
|
|
@@ -8251,7 +8277,7 @@ import { randomUUID } from "node:crypto";
|
|
|
8251
8277
|
// package.json
|
|
8252
8278
|
var package_default = {
|
|
8253
8279
|
name: "briff-scan",
|
|
8254
|
-
version: "0.1.
|
|
8280
|
+
version: "0.1.1",
|
|
8255
8281
|
description: "Briff scanner: reads lockfiles and runtime files and sends package names, installed versions and runtimes to Briff. No source code leaves the machine.",
|
|
8256
8282
|
keywords: [
|
|
8257
8283
|
"briff",
|
|
@@ -8347,6 +8373,7 @@ async function run(argv, env, io) {
|
|
|
8347
8373
|
try {
|
|
8348
8374
|
const payloads = await collectRepos(options.root, options.mode, {
|
|
8349
8375
|
maxDepth: options.maxDepth,
|
|
8376
|
+
exclude: options.exclude,
|
|
8350
8377
|
warn: io.err
|
|
8351
8378
|
});
|
|
8352
8379
|
if (options.dryRun) {
|
|
@@ -8370,6 +8397,8 @@ async function run(argv, env, io) {
|
|
|
8370
8397
|
if (!options.json) io.out(summary(options.root, payloads));
|
|
8371
8398
|
if (payloads.length === 0) {
|
|
8372
8399
|
if (options.json) io.out(JSON.stringify({ root: options.root, uploaded: [] }, null, 2));
|
|
8400
|
+
else if (options.mode.kind === "single" && options.exclude.includes(options.mode.repoName))
|
|
8401
|
+
io.out("nothing to upload");
|
|
8373
8402
|
else io.out("no lockfile or runtime file found; nothing to upload");
|
|
8374
8403
|
return 0;
|
|
8375
8404
|
}
|
package/package.json
CHANGED