@biffo/cli 0.324.2 → 0.324.4
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/_skeletons/plugin-template/scripts/py-dependency-audit-classification.test.sh +196 -0
- package/_skeletons/plugin-template/scripts/py-dependency-audit.sh +53 -3
- package/_skeletons/sibling-template/scripts/py-dependency-audit-classification.test.sh +196 -0
- package/_skeletons/sibling-template/scripts/py-dependency-audit.sh +53 -3
- package/dist/index.js +74 -20
- package/package.json +1 -1
|
@@ -274,6 +274,202 @@ _stage_clean
|
|
|
274
274
|
_run dev
|
|
275
275
|
_assert_exit "clean run unaffected" 0
|
|
276
276
|
|
|
277
|
+
# ============================================================================
|
|
278
|
+
# uv WORKSPACE MEMBERS (#2120). The export and the classification must read
|
|
279
|
+
# the SAME lockfile. `uv export` run inside a workspace member resolves the
|
|
280
|
+
# WORKSPACE ROOT's uv.lock, not <member>/uv.lock; the classifier then compared
|
|
281
|
+
# that root-lock version against the member's own lock on the base branch, so a
|
|
282
|
+
# pre-existing root-lock advisory read as "introduced by this diff" for every
|
|
283
|
+
# member tree, and the member's own lock was never audited at all. Observed in
|
|
284
|
+
# biffo-platform PR 197 (anyio 4.14.1 in the root lock, 4.14.2 in both member
|
|
285
|
+
# locks).
|
|
286
|
+
#
|
|
287
|
+
# These cases use the REAL `uv export` (offline, --frozen, hand-written locks)
|
|
288
|
+
# because the defect lives in uv's workspace discovery -- a stubbed export
|
|
289
|
+
# would test nothing. Only `uv run pip-audit` is stubbed: for `-r <file>` it
|
|
290
|
+
# reports an advisory on anyio==4.14.1 (fixed in 4.14.2) found in THAT file,
|
|
291
|
+
# and it records the file so the test can assert which lock was audited.
|
|
292
|
+
# ============================================================================
|
|
293
|
+
REAL_UV=$(command -v uv 2>/dev/null || true)
|
|
294
|
+
if [ -z "$REAL_UV" ]; then
|
|
295
|
+
echo "FAIL: workspace-member cases need a real uv on PATH (they exercise uv's workspace discovery) -- not skipping, a skipped case reads as a pass"
|
|
296
|
+
FAILURES=$((FAILURES + 1))
|
|
297
|
+
else
|
|
298
|
+
cat > "$STUB_DIR/uv" <<STUB
|
|
299
|
+
#!/usr/bin/env sh
|
|
300
|
+
if [ "\$1" = "run" ] && [ "\$2" = "pip-audit" ]; then
|
|
301
|
+
reqs=""
|
|
302
|
+
while [ \$# -gt 0 ]; do
|
|
303
|
+
if [ "\$1" = "-r" ]; then reqs="\$2"; fi
|
|
304
|
+
shift
|
|
305
|
+
done
|
|
306
|
+
if [ -z "\$reqs" ]; then
|
|
307
|
+
cat "\$PIPAUDIT_STUB_OUTPUT"
|
|
308
|
+
exit 0
|
|
309
|
+
fi
|
|
310
|
+
cat "\$reqs" >> "\$AUDITED_LOG"
|
|
311
|
+
printf '{"dependencies": ['
|
|
312
|
+
sep=""
|
|
313
|
+
grep -E '^[A-Za-z0-9_.-]+==' "\$reqs" | sed 's/ .*//' | while IFS='=' read -r n _ v; do
|
|
314
|
+
vulns='[]'
|
|
315
|
+
if [ "\$n" = anyio ] && [ "\$v" = 4.14.1 ]; then vulns='[{"id":"GHSA-test-anyio"}]'; fi
|
|
316
|
+
printf '%s{"name":"%s","version":"%s","vulns":%s}' "\$sep" "\$n" "\$v" "\$vulns"
|
|
317
|
+
sep=","
|
|
318
|
+
done
|
|
319
|
+
printf ']}\n'
|
|
320
|
+
exit 0
|
|
321
|
+
fi
|
|
322
|
+
exec "$REAL_UV" "\$@"
|
|
323
|
+
STUB
|
|
324
|
+
chmod +x "$STUB_DIR/uv"
|
|
325
|
+
AUDITED_LOG="$STUB_DIR/audited.log"
|
|
326
|
+
export AUDITED_LOG
|
|
327
|
+
|
|
328
|
+
_ws_lock() {
|
|
329
|
+
# $1 = dest, $2 = anyio version. Member locks (uv resolves a lone member
|
|
330
|
+
# as its own project) hold only that member; the workspace ROOT lock holds
|
|
331
|
+
# the root and every member, exactly as `uv lock` writes them.
|
|
332
|
+
# $3 = "root" for the workspace root lock, "member" for a member's own.
|
|
333
|
+
cat > "$1" <<LOCK
|
|
334
|
+
version = 1
|
|
335
|
+
revision = 3
|
|
336
|
+
requires-python = ">=3.12"
|
|
337
|
+
LOCK
|
|
338
|
+
if [ "$3" = root ]; then
|
|
339
|
+
cat >> "$1" <<'LOCK'
|
|
340
|
+
|
|
341
|
+
[manifest]
|
|
342
|
+
members = ["m", "root"]
|
|
343
|
+
LOCK
|
|
344
|
+
fi
|
|
345
|
+
cat >> "$1" <<LOCK
|
|
346
|
+
|
|
347
|
+
[[package]]
|
|
348
|
+
name = "anyio"
|
|
349
|
+
version = "$2"
|
|
350
|
+
source = { registry = "https://pypi.org/simple" }
|
|
351
|
+
|
|
352
|
+
[[package]]
|
|
353
|
+
name = "m"
|
|
354
|
+
version = "0.1.0"
|
|
355
|
+
source = { virtual = "$([ "$3" = root ] && echo services/m || echo .)" }
|
|
356
|
+
dependencies = [{ name = "anyio" }]
|
|
357
|
+
LOCK
|
|
358
|
+
if [ "$3" = root ]; then
|
|
359
|
+
cat >> "$1" <<'LOCK'
|
|
360
|
+
|
|
361
|
+
[[package]]
|
|
362
|
+
name = "root"
|
|
363
|
+
version = "0.1.0"
|
|
364
|
+
source = { virtual = "." }
|
|
365
|
+
dependencies = [{ name = "anyio" }]
|
|
366
|
+
LOCK
|
|
367
|
+
fi
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
_ws_repo() {
|
|
371
|
+
# $1 = root-lock anyio, $2 = member-lock anyio ON BASE,
|
|
372
|
+
# $3 = member-lock anyio on the PR head (== $2 when the PR leaves it alone)
|
|
373
|
+
rm -rf "$REPO_DIR"
|
|
374
|
+
mkdir -p "$REPO_DIR/services/m"
|
|
375
|
+
( cd "$REPO_DIR" \
|
|
376
|
+
&& git init -q -b trunk \
|
|
377
|
+
&& git config user.email test@example.com \
|
|
378
|
+
&& git config user.name "Test" )
|
|
379
|
+
cat > "$REPO_DIR/pyproject.toml" <<'PYP'
|
|
380
|
+
[project]
|
|
381
|
+
name = "root"
|
|
382
|
+
version = "0.1.0"
|
|
383
|
+
requires-python = ">=3.12"
|
|
384
|
+
dependencies = ["anyio"]
|
|
385
|
+
[tool.uv.workspace]
|
|
386
|
+
members = ["services/*"]
|
|
387
|
+
PYP
|
|
388
|
+
cat > "$REPO_DIR/services/m/pyproject.toml" <<'PYP'
|
|
389
|
+
[project]
|
|
390
|
+
name = "m"
|
|
391
|
+
version = "0.1.0"
|
|
392
|
+
requires-python = ">=3.12"
|
|
393
|
+
dependencies = ["anyio"]
|
|
394
|
+
PYP
|
|
395
|
+
_ws_lock "$REPO_DIR/uv.lock" "$1" root
|
|
396
|
+
_ws_lock "$REPO_DIR/services/m/uv.lock" "$2" member
|
|
397
|
+
( cd "$REPO_DIR" && git add -A && git commit -q -m base && git branch -q origin/dev )
|
|
398
|
+
if [ "$3" != "$2" ]; then
|
|
399
|
+
_ws_lock "$REPO_DIR/services/m/uv.lock" "$3" member
|
|
400
|
+
( cd "$REPO_DIR" && git add -A && git commit -q -m "pr bumps member lock" )
|
|
401
|
+
fi
|
|
402
|
+
: > "$AUDITED_LOG"
|
|
403
|
+
_stage_clean
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
_assert_audited() {
|
|
407
|
+
# $1 = name, $2 = requirement line the MEMBER audit must have received
|
|
408
|
+
if grep -qxF "$2" "$AUDITED_LOG"; then
|
|
409
|
+
echo "PASS: $1 audited '$2'"
|
|
410
|
+
else
|
|
411
|
+
echo "FAIL: $1 -- expected the member tree's OWN lock to be audited ('$2'); pip-audit was given:"
|
|
412
|
+
cat "$AUDITED_LOG"
|
|
413
|
+
FAILURES=$((FAILURES + 1))
|
|
414
|
+
fi
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
_assert_not_audited() {
|
|
418
|
+
if grep -qxF "$2" "$AUDITED_LOG"; then
|
|
419
|
+
echo "FAIL: $1 -- pip-audit was given '$2', i.e. the ROOT lock's version, not the member's own"
|
|
420
|
+
FAILURES=$((FAILURES + 1))
|
|
421
|
+
else
|
|
422
|
+
echo "PASS: $1 did not audit '$2'"
|
|
423
|
+
fi
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
# 8. The reported shape. Root lock has the vulnerable anyio 4.14.1; the
|
|
427
|
+
# member's own lock is already fixed (4.14.2); the PR touches neither.
|
|
428
|
+
# The member's audit must read ITS lock (4.14.2, clean) -- before #2120 it
|
|
429
|
+
# read the root lock (4.14.1), classified that against the member's base
|
|
430
|
+
# lock (4.14.2) and blocked on a finding the diff did not introduce.
|
|
431
|
+
_ws_repo "4.14.1" "4.14.2" "4.14.2"
|
|
432
|
+
_run dev
|
|
433
|
+
_assert_exit "workspace member: root-lock advisory not blamed on the diff" 0
|
|
434
|
+
_assert_audited "workspace member (own lock fixed)" "anyio==4.14.2"
|
|
435
|
+
_assert_not_audited "workspace member (own lock fixed)" "anyio==4.14.1"
|
|
436
|
+
|
|
437
|
+
# 9. Inverse: the MEMBER's own lock carries the advisory (unchanged from
|
|
438
|
+
# base), the root is fine. Before #2120 the member lock was never audited,
|
|
439
|
+
# so this read as a clean pass. It must be audited, and reported as
|
|
440
|
+
# pre-existing rather than silently skipped or blamed on the diff.
|
|
441
|
+
_ws_repo "4.14.2" "4.14.1" "4.14.1"
|
|
442
|
+
_run dev
|
|
443
|
+
_assert_exit "workspace member: own-lock pre-existing advisory does not block" 0
|
|
444
|
+
_assert_audited "workspace member (own lock vulnerable)" "anyio==4.14.1"
|
|
445
|
+
_assert_output_contains "workspace member: own-lock advisory named pre-existing" "pre-existing"
|
|
446
|
+
|
|
447
|
+
# 10. The PR itself bumps the member's own lock INTO the advisory: a real
|
|
448
|
+
# regression in the file that was previously never looked at. Must block.
|
|
449
|
+
_ws_repo "4.14.2" "4.14.2" "4.14.1"
|
|
450
|
+
_run dev
|
|
451
|
+
_assert_exit "workspace member: PR bumping own lock into an advisory blocks" 1
|
|
452
|
+
_assert_output_contains "workspace member: regression named as introduced" "introduced"
|
|
453
|
+
|
|
454
|
+
# 11. A scratch directory INSIDE the repository would put the workspace root
|
|
455
|
+
# back above the staged copy and silently restore the wrong-lock export.
|
|
456
|
+
# TMPDIR pointed under the repo must fail closed (INCONCLUSIVE, exit 2),
|
|
457
|
+
# never fall back to exporting in place.
|
|
458
|
+
_ws_repo "4.14.1" "4.14.2" "4.14.2"
|
|
459
|
+
mkdir -p "$REPO_DIR/scratch"
|
|
460
|
+
(
|
|
461
|
+
cd "$REPO_DIR" || exit 97
|
|
462
|
+
PATH="$STUB_DIR:$PATH"; export PATH
|
|
463
|
+
PIPAUDIT_STUB_OUTPUT="$STUB_DIR/pip-audit-output.json"; export PIPAUDIT_STUB_OUTPUT
|
|
464
|
+
TMPDIR="$REPO_DIR/scratch"; export TMPDIR
|
|
465
|
+
GITHUB_BASE_REF=dev; export GITHUB_BASE_REF
|
|
466
|
+
sh "$TARGET"
|
|
467
|
+
) >"$OUT_FILE" 2>&1
|
|
468
|
+
LAST_RC=$?
|
|
469
|
+
_assert_exit "scratch dir inside the repo fails closed" 2
|
|
470
|
+
_assert_output_contains "scratch-inside-repo names the tree as unaudited" "INCONCLUSIVE"
|
|
471
|
+
fi
|
|
472
|
+
|
|
277
473
|
echo
|
|
278
474
|
if [ "$FAILURES" -eq 0 ]; then
|
|
279
475
|
echo "py-dependency-audit-classification.test.sh: all checks passed."
|
|
@@ -171,7 +171,14 @@ _classify_finding() {
|
|
|
171
171
|
return
|
|
172
172
|
fi
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
# Read from a regular file, not a pipe: `_lockfile_version_for`'s awk `exit`s
|
|
175
|
+
# on its first match and closes its stdin, so a pipe with `printf` still
|
|
176
|
+
# writing into it gets SIGPIPE and dash reports a stray "printf: I/O error"
|
|
177
|
+
# into the log (#2120 -- the same mechanism #1995 removed from the dump path).
|
|
178
|
+
base_lock_file="$(mktemp)"
|
|
179
|
+
printf '%s\n' "$base_lock_content" > "$base_lock_file"
|
|
180
|
+
base_version="$(_lockfile_version_for "$finding_name" < "$base_lock_file")"
|
|
181
|
+
rm -f "$base_lock_file"
|
|
175
182
|
if [ -n "$base_version" ] && [ "$base_version" = "$finding_version" ]; then
|
|
176
183
|
printf 'pre-existing'
|
|
177
184
|
else
|
|
@@ -340,6 +347,49 @@ for lock in $ALL_LOCKS; do
|
|
|
340
347
|
fi
|
|
341
348
|
done
|
|
342
349
|
|
|
350
|
+
# ## Export the lockfile that is classified (#2120)
|
|
351
|
+
#
|
|
352
|
+
# `_classify_finding` compares a flagged version against `<tree>/uv.lock` on
|
|
353
|
+
# the base branch, so the export MUST read `<tree>/uv.lock` too. It did not for
|
|
354
|
+
# a tree that is a uv WORKSPACE MEMBER: `uv export` run inside a member walks
|
|
355
|
+
# up to the workspace root and exports the ROOT's `uv.lock`. The audit then
|
|
356
|
+
# scanned one lockfile and classified against another -- a pre-existing root
|
|
357
|
+
# advisory read as "introduced by this diff" for every member tree, and the
|
|
358
|
+
# member's own lock was never audited at all (biffo-platform PR 197).
|
|
359
|
+
#
|
|
360
|
+
# The cause is removed rather than detected: the tree's `pyproject.toml` and
|
|
361
|
+
# `uv.lock` are staged ALONE in a scratch directory outside the repository, so
|
|
362
|
+
# there is no workspace above them for uv to find. The bytes exported are then
|
|
363
|
+
# the bytes at the path the classifier reads, by construction -- no membership
|
|
364
|
+
# detection, no second lookup that could disagree. `--frozen` reads the lock
|
|
365
|
+
# without re-resolving, so `[tool.uv.sources]` entries (path, workspace) need
|
|
366
|
+
# not resolve from the scratch directory; verified against uv 0.11.
|
|
367
|
+
#
|
|
368
|
+
# `$1` is the tree directory, the remaining arguments are `uv export` flags.
|
|
369
|
+
# Returns non-zero -- never a partial success -- if the tree has no
|
|
370
|
+
# pyproject.toml/uv.lock to stage or the scratch directory cannot be made or
|
|
371
|
+
# sits inside the repository (a TMPDIR under the repo would put the workspace
|
|
372
|
+
# back above the copy and silently restore the defect).
|
|
373
|
+
_export_own_lock() {
|
|
374
|
+
eo_dir="$1"
|
|
375
|
+
shift
|
|
376
|
+
eo_scratch="$(mktemp -d)" || return 1
|
|
377
|
+
case "$(cd "$eo_scratch" && pwd -P)/" in
|
|
378
|
+
"${REPO_ROOT}"/*)
|
|
379
|
+
rm -rf "$eo_scratch"
|
|
380
|
+
return 1
|
|
381
|
+
;;
|
|
382
|
+
esac
|
|
383
|
+
if ! cp "$eo_dir/pyproject.toml" "$eo_dir/uv.lock" "$eo_scratch/" 2>/dev/null; then
|
|
384
|
+
rm -rf "$eo_scratch"
|
|
385
|
+
return 1
|
|
386
|
+
fi
|
|
387
|
+
(cd "$eo_scratch" && uv export --frozen "$@")
|
|
388
|
+
eo_rc=$?
|
|
389
|
+
rm -rf "$eo_scratch"
|
|
390
|
+
return "$eo_rc"
|
|
391
|
+
}
|
|
392
|
+
|
|
343
393
|
# Audit each discovered tree. The workspace's own lockfile is audited via the
|
|
344
394
|
# INSTALLED environment `uv sync` already produced (unchanged from before —
|
|
345
395
|
# `uv run pip-audit` with no `-r`). Every other discovered lockfile is not an
|
|
@@ -383,13 +433,13 @@ for lock in $ALL_LOCKS; do
|
|
|
383
433
|
# audited -- verified on `services/ideation`, where the export keeps 25
|
|
384
434
|
# packages including three carried `via biffo-plugin-sdk`. So the answer this
|
|
385
435
|
# gate gives is unchanged for every package an advisory can actually be about.
|
|
386
|
-
if
|
|
436
|
+
if _export_own_lock "$dir" --no-dev --no-emit-project --no-emit-local >"$reqs" 2>/dev/null && [ -s "$reqs" ]; then
|
|
387
437
|
# Report what was skipped rather than skipping it quietly: "audited
|
|
388
438
|
# everything except the bits we could not" must never read the same as
|
|
389
439
|
# "audited everything", which is the failure this whole file exists to
|
|
390
440
|
# fight. Counted from the same lockfile, so the number is the tree's, not
|
|
391
441
|
# a guess.
|
|
392
|
-
local_deps=$(
|
|
442
|
+
local_deps=$(_export_own_lock "$dir" --no-dev --no-emit-project 2>/dev/null \
|
|
393
443
|
| grep -cE '^-e |@ file://' || true )
|
|
394
444
|
if [ "${local_deps:-0}" -gt 0 ]; then
|
|
395
445
|
echo " (${rel}: ${local_deps} local path dependenc$([ "$local_deps" -eq 1 ] && echo y || echo ies) excluded -- first-party, audited in their own repo; their transitive dependencies are still scanned)"
|
|
@@ -274,6 +274,202 @@ _stage_clean
|
|
|
274
274
|
_run dev
|
|
275
275
|
_assert_exit "clean run unaffected" 0
|
|
276
276
|
|
|
277
|
+
# ============================================================================
|
|
278
|
+
# uv WORKSPACE MEMBERS (#2120). The export and the classification must read
|
|
279
|
+
# the SAME lockfile. `uv export` run inside a workspace member resolves the
|
|
280
|
+
# WORKSPACE ROOT's uv.lock, not <member>/uv.lock; the classifier then compared
|
|
281
|
+
# that root-lock version against the member's own lock on the base branch, so a
|
|
282
|
+
# pre-existing root-lock advisory read as "introduced by this diff" for every
|
|
283
|
+
# member tree, and the member's own lock was never audited at all. Observed in
|
|
284
|
+
# biffo-platform PR 197 (anyio 4.14.1 in the root lock, 4.14.2 in both member
|
|
285
|
+
# locks).
|
|
286
|
+
#
|
|
287
|
+
# These cases use the REAL `uv export` (offline, --frozen, hand-written locks)
|
|
288
|
+
# because the defect lives in uv's workspace discovery -- a stubbed export
|
|
289
|
+
# would test nothing. Only `uv run pip-audit` is stubbed: for `-r <file>` it
|
|
290
|
+
# reports an advisory on anyio==4.14.1 (fixed in 4.14.2) found in THAT file,
|
|
291
|
+
# and it records the file so the test can assert which lock was audited.
|
|
292
|
+
# ============================================================================
|
|
293
|
+
REAL_UV=$(command -v uv 2>/dev/null || true)
|
|
294
|
+
if [ -z "$REAL_UV" ]; then
|
|
295
|
+
echo "FAIL: workspace-member cases need a real uv on PATH (they exercise uv's workspace discovery) -- not skipping, a skipped case reads as a pass"
|
|
296
|
+
FAILURES=$((FAILURES + 1))
|
|
297
|
+
else
|
|
298
|
+
cat > "$STUB_DIR/uv" <<STUB
|
|
299
|
+
#!/usr/bin/env sh
|
|
300
|
+
if [ "\$1" = "run" ] && [ "\$2" = "pip-audit" ]; then
|
|
301
|
+
reqs=""
|
|
302
|
+
while [ \$# -gt 0 ]; do
|
|
303
|
+
if [ "\$1" = "-r" ]; then reqs="\$2"; fi
|
|
304
|
+
shift
|
|
305
|
+
done
|
|
306
|
+
if [ -z "\$reqs" ]; then
|
|
307
|
+
cat "\$PIPAUDIT_STUB_OUTPUT"
|
|
308
|
+
exit 0
|
|
309
|
+
fi
|
|
310
|
+
cat "\$reqs" >> "\$AUDITED_LOG"
|
|
311
|
+
printf '{"dependencies": ['
|
|
312
|
+
sep=""
|
|
313
|
+
grep -E '^[A-Za-z0-9_.-]+==' "\$reqs" | sed 's/ .*//' | while IFS='=' read -r n _ v; do
|
|
314
|
+
vulns='[]'
|
|
315
|
+
if [ "\$n" = anyio ] && [ "\$v" = 4.14.1 ]; then vulns='[{"id":"GHSA-test-anyio"}]'; fi
|
|
316
|
+
printf '%s{"name":"%s","version":"%s","vulns":%s}' "\$sep" "\$n" "\$v" "\$vulns"
|
|
317
|
+
sep=","
|
|
318
|
+
done
|
|
319
|
+
printf ']}\n'
|
|
320
|
+
exit 0
|
|
321
|
+
fi
|
|
322
|
+
exec "$REAL_UV" "\$@"
|
|
323
|
+
STUB
|
|
324
|
+
chmod +x "$STUB_DIR/uv"
|
|
325
|
+
AUDITED_LOG="$STUB_DIR/audited.log"
|
|
326
|
+
export AUDITED_LOG
|
|
327
|
+
|
|
328
|
+
_ws_lock() {
|
|
329
|
+
# $1 = dest, $2 = anyio version. Member locks (uv resolves a lone member
|
|
330
|
+
# as its own project) hold only that member; the workspace ROOT lock holds
|
|
331
|
+
# the root and every member, exactly as `uv lock` writes them.
|
|
332
|
+
# $3 = "root" for the workspace root lock, "member" for a member's own.
|
|
333
|
+
cat > "$1" <<LOCK
|
|
334
|
+
version = 1
|
|
335
|
+
revision = 3
|
|
336
|
+
requires-python = ">=3.12"
|
|
337
|
+
LOCK
|
|
338
|
+
if [ "$3" = root ]; then
|
|
339
|
+
cat >> "$1" <<'LOCK'
|
|
340
|
+
|
|
341
|
+
[manifest]
|
|
342
|
+
members = ["m", "root"]
|
|
343
|
+
LOCK
|
|
344
|
+
fi
|
|
345
|
+
cat >> "$1" <<LOCK
|
|
346
|
+
|
|
347
|
+
[[package]]
|
|
348
|
+
name = "anyio"
|
|
349
|
+
version = "$2"
|
|
350
|
+
source = { registry = "https://pypi.org/simple" }
|
|
351
|
+
|
|
352
|
+
[[package]]
|
|
353
|
+
name = "m"
|
|
354
|
+
version = "0.1.0"
|
|
355
|
+
source = { virtual = "$([ "$3" = root ] && echo services/m || echo .)" }
|
|
356
|
+
dependencies = [{ name = "anyio" }]
|
|
357
|
+
LOCK
|
|
358
|
+
if [ "$3" = root ]; then
|
|
359
|
+
cat >> "$1" <<'LOCK'
|
|
360
|
+
|
|
361
|
+
[[package]]
|
|
362
|
+
name = "root"
|
|
363
|
+
version = "0.1.0"
|
|
364
|
+
source = { virtual = "." }
|
|
365
|
+
dependencies = [{ name = "anyio" }]
|
|
366
|
+
LOCK
|
|
367
|
+
fi
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
_ws_repo() {
|
|
371
|
+
# $1 = root-lock anyio, $2 = member-lock anyio ON BASE,
|
|
372
|
+
# $3 = member-lock anyio on the PR head (== $2 when the PR leaves it alone)
|
|
373
|
+
rm -rf "$REPO_DIR"
|
|
374
|
+
mkdir -p "$REPO_DIR/services/m"
|
|
375
|
+
( cd "$REPO_DIR" \
|
|
376
|
+
&& git init -q -b trunk \
|
|
377
|
+
&& git config user.email test@example.com \
|
|
378
|
+
&& git config user.name "Test" )
|
|
379
|
+
cat > "$REPO_DIR/pyproject.toml" <<'PYP'
|
|
380
|
+
[project]
|
|
381
|
+
name = "root"
|
|
382
|
+
version = "0.1.0"
|
|
383
|
+
requires-python = ">=3.12"
|
|
384
|
+
dependencies = ["anyio"]
|
|
385
|
+
[tool.uv.workspace]
|
|
386
|
+
members = ["services/*"]
|
|
387
|
+
PYP
|
|
388
|
+
cat > "$REPO_DIR/services/m/pyproject.toml" <<'PYP'
|
|
389
|
+
[project]
|
|
390
|
+
name = "m"
|
|
391
|
+
version = "0.1.0"
|
|
392
|
+
requires-python = ">=3.12"
|
|
393
|
+
dependencies = ["anyio"]
|
|
394
|
+
PYP
|
|
395
|
+
_ws_lock "$REPO_DIR/uv.lock" "$1" root
|
|
396
|
+
_ws_lock "$REPO_DIR/services/m/uv.lock" "$2" member
|
|
397
|
+
( cd "$REPO_DIR" && git add -A && git commit -q -m base && git branch -q origin/dev )
|
|
398
|
+
if [ "$3" != "$2" ]; then
|
|
399
|
+
_ws_lock "$REPO_DIR/services/m/uv.lock" "$3" member
|
|
400
|
+
( cd "$REPO_DIR" && git add -A && git commit -q -m "pr bumps member lock" )
|
|
401
|
+
fi
|
|
402
|
+
: > "$AUDITED_LOG"
|
|
403
|
+
_stage_clean
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
_assert_audited() {
|
|
407
|
+
# $1 = name, $2 = requirement line the MEMBER audit must have received
|
|
408
|
+
if grep -qxF "$2" "$AUDITED_LOG"; then
|
|
409
|
+
echo "PASS: $1 audited '$2'"
|
|
410
|
+
else
|
|
411
|
+
echo "FAIL: $1 -- expected the member tree's OWN lock to be audited ('$2'); pip-audit was given:"
|
|
412
|
+
cat "$AUDITED_LOG"
|
|
413
|
+
FAILURES=$((FAILURES + 1))
|
|
414
|
+
fi
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
_assert_not_audited() {
|
|
418
|
+
if grep -qxF "$2" "$AUDITED_LOG"; then
|
|
419
|
+
echo "FAIL: $1 -- pip-audit was given '$2', i.e. the ROOT lock's version, not the member's own"
|
|
420
|
+
FAILURES=$((FAILURES + 1))
|
|
421
|
+
else
|
|
422
|
+
echo "PASS: $1 did not audit '$2'"
|
|
423
|
+
fi
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
# 8. The reported shape. Root lock has the vulnerable anyio 4.14.1; the
|
|
427
|
+
# member's own lock is already fixed (4.14.2); the PR touches neither.
|
|
428
|
+
# The member's audit must read ITS lock (4.14.2, clean) -- before #2120 it
|
|
429
|
+
# read the root lock (4.14.1), classified that against the member's base
|
|
430
|
+
# lock (4.14.2) and blocked on a finding the diff did not introduce.
|
|
431
|
+
_ws_repo "4.14.1" "4.14.2" "4.14.2"
|
|
432
|
+
_run dev
|
|
433
|
+
_assert_exit "workspace member: root-lock advisory not blamed on the diff" 0
|
|
434
|
+
_assert_audited "workspace member (own lock fixed)" "anyio==4.14.2"
|
|
435
|
+
_assert_not_audited "workspace member (own lock fixed)" "anyio==4.14.1"
|
|
436
|
+
|
|
437
|
+
# 9. Inverse: the MEMBER's own lock carries the advisory (unchanged from
|
|
438
|
+
# base), the root is fine. Before #2120 the member lock was never audited,
|
|
439
|
+
# so this read as a clean pass. It must be audited, and reported as
|
|
440
|
+
# pre-existing rather than silently skipped or blamed on the diff.
|
|
441
|
+
_ws_repo "4.14.2" "4.14.1" "4.14.1"
|
|
442
|
+
_run dev
|
|
443
|
+
_assert_exit "workspace member: own-lock pre-existing advisory does not block" 0
|
|
444
|
+
_assert_audited "workspace member (own lock vulnerable)" "anyio==4.14.1"
|
|
445
|
+
_assert_output_contains "workspace member: own-lock advisory named pre-existing" "pre-existing"
|
|
446
|
+
|
|
447
|
+
# 10. The PR itself bumps the member's own lock INTO the advisory: a real
|
|
448
|
+
# regression in the file that was previously never looked at. Must block.
|
|
449
|
+
_ws_repo "4.14.2" "4.14.2" "4.14.1"
|
|
450
|
+
_run dev
|
|
451
|
+
_assert_exit "workspace member: PR bumping own lock into an advisory blocks" 1
|
|
452
|
+
_assert_output_contains "workspace member: regression named as introduced" "introduced"
|
|
453
|
+
|
|
454
|
+
# 11. A scratch directory INSIDE the repository would put the workspace root
|
|
455
|
+
# back above the staged copy and silently restore the wrong-lock export.
|
|
456
|
+
# TMPDIR pointed under the repo must fail closed (INCONCLUSIVE, exit 2),
|
|
457
|
+
# never fall back to exporting in place.
|
|
458
|
+
_ws_repo "4.14.1" "4.14.2" "4.14.2"
|
|
459
|
+
mkdir -p "$REPO_DIR/scratch"
|
|
460
|
+
(
|
|
461
|
+
cd "$REPO_DIR" || exit 97
|
|
462
|
+
PATH="$STUB_DIR:$PATH"; export PATH
|
|
463
|
+
PIPAUDIT_STUB_OUTPUT="$STUB_DIR/pip-audit-output.json"; export PIPAUDIT_STUB_OUTPUT
|
|
464
|
+
TMPDIR="$REPO_DIR/scratch"; export TMPDIR
|
|
465
|
+
GITHUB_BASE_REF=dev; export GITHUB_BASE_REF
|
|
466
|
+
sh "$TARGET"
|
|
467
|
+
) >"$OUT_FILE" 2>&1
|
|
468
|
+
LAST_RC=$?
|
|
469
|
+
_assert_exit "scratch dir inside the repo fails closed" 2
|
|
470
|
+
_assert_output_contains "scratch-inside-repo names the tree as unaudited" "INCONCLUSIVE"
|
|
471
|
+
fi
|
|
472
|
+
|
|
277
473
|
echo
|
|
278
474
|
if [ "$FAILURES" -eq 0 ]; then
|
|
279
475
|
echo "py-dependency-audit-classification.test.sh: all checks passed."
|
|
@@ -171,7 +171,14 @@ _classify_finding() {
|
|
|
171
171
|
return
|
|
172
172
|
fi
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
# Read from a regular file, not a pipe: `_lockfile_version_for`'s awk `exit`s
|
|
175
|
+
# on its first match and closes its stdin, so a pipe with `printf` still
|
|
176
|
+
# writing into it gets SIGPIPE and dash reports a stray "printf: I/O error"
|
|
177
|
+
# into the log (#2120 -- the same mechanism #1995 removed from the dump path).
|
|
178
|
+
base_lock_file="$(mktemp)"
|
|
179
|
+
printf '%s\n' "$base_lock_content" > "$base_lock_file"
|
|
180
|
+
base_version="$(_lockfile_version_for "$finding_name" < "$base_lock_file")"
|
|
181
|
+
rm -f "$base_lock_file"
|
|
175
182
|
if [ -n "$base_version" ] && [ "$base_version" = "$finding_version" ]; then
|
|
176
183
|
printf 'pre-existing'
|
|
177
184
|
else
|
|
@@ -340,6 +347,49 @@ for lock in $ALL_LOCKS; do
|
|
|
340
347
|
fi
|
|
341
348
|
done
|
|
342
349
|
|
|
350
|
+
# ## Export the lockfile that is classified (#2120)
|
|
351
|
+
#
|
|
352
|
+
# `_classify_finding` compares a flagged version against `<tree>/uv.lock` on
|
|
353
|
+
# the base branch, so the export MUST read `<tree>/uv.lock` too. It did not for
|
|
354
|
+
# a tree that is a uv WORKSPACE MEMBER: `uv export` run inside a member walks
|
|
355
|
+
# up to the workspace root and exports the ROOT's `uv.lock`. The audit then
|
|
356
|
+
# scanned one lockfile and classified against another -- a pre-existing root
|
|
357
|
+
# advisory read as "introduced by this diff" for every member tree, and the
|
|
358
|
+
# member's own lock was never audited at all (biffo-platform PR 197).
|
|
359
|
+
#
|
|
360
|
+
# The cause is removed rather than detected: the tree's `pyproject.toml` and
|
|
361
|
+
# `uv.lock` are staged ALONE in a scratch directory outside the repository, so
|
|
362
|
+
# there is no workspace above them for uv to find. The bytes exported are then
|
|
363
|
+
# the bytes at the path the classifier reads, by construction -- no membership
|
|
364
|
+
# detection, no second lookup that could disagree. `--frozen` reads the lock
|
|
365
|
+
# without re-resolving, so `[tool.uv.sources]` entries (path, workspace) need
|
|
366
|
+
# not resolve from the scratch directory; verified against uv 0.11.
|
|
367
|
+
#
|
|
368
|
+
# `$1` is the tree directory, the remaining arguments are `uv export` flags.
|
|
369
|
+
# Returns non-zero -- never a partial success -- if the tree has no
|
|
370
|
+
# pyproject.toml/uv.lock to stage or the scratch directory cannot be made or
|
|
371
|
+
# sits inside the repository (a TMPDIR under the repo would put the workspace
|
|
372
|
+
# back above the copy and silently restore the defect).
|
|
373
|
+
_export_own_lock() {
|
|
374
|
+
eo_dir="$1"
|
|
375
|
+
shift
|
|
376
|
+
eo_scratch="$(mktemp -d)" || return 1
|
|
377
|
+
case "$(cd "$eo_scratch" && pwd -P)/" in
|
|
378
|
+
"${REPO_ROOT}"/*)
|
|
379
|
+
rm -rf "$eo_scratch"
|
|
380
|
+
return 1
|
|
381
|
+
;;
|
|
382
|
+
esac
|
|
383
|
+
if ! cp "$eo_dir/pyproject.toml" "$eo_dir/uv.lock" "$eo_scratch/" 2>/dev/null; then
|
|
384
|
+
rm -rf "$eo_scratch"
|
|
385
|
+
return 1
|
|
386
|
+
fi
|
|
387
|
+
(cd "$eo_scratch" && uv export --frozen "$@")
|
|
388
|
+
eo_rc=$?
|
|
389
|
+
rm -rf "$eo_scratch"
|
|
390
|
+
return "$eo_rc"
|
|
391
|
+
}
|
|
392
|
+
|
|
343
393
|
# Audit each discovered tree. The workspace's own lockfile is audited via the
|
|
344
394
|
# INSTALLED environment `uv sync` already produced (unchanged from before —
|
|
345
395
|
# `uv run pip-audit` with no `-r`). Every other discovered lockfile is not an
|
|
@@ -383,13 +433,13 @@ for lock in $ALL_LOCKS; do
|
|
|
383
433
|
# audited -- verified on `services/ideation`, where the export keeps 25
|
|
384
434
|
# packages including three carried `via biffo-plugin-sdk`. So the answer this
|
|
385
435
|
# gate gives is unchanged for every package an advisory can actually be about.
|
|
386
|
-
if
|
|
436
|
+
if _export_own_lock "$dir" --no-dev --no-emit-project --no-emit-local >"$reqs" 2>/dev/null && [ -s "$reqs" ]; then
|
|
387
437
|
# Report what was skipped rather than skipping it quietly: "audited
|
|
388
438
|
# everything except the bits we could not" must never read the same as
|
|
389
439
|
# "audited everything", which is the failure this whole file exists to
|
|
390
440
|
# fight. Counted from the same lockfile, so the number is the tree's, not
|
|
391
441
|
# a guess.
|
|
392
|
-
local_deps=$(
|
|
442
|
+
local_deps=$(_export_own_lock "$dir" --no-dev --no-emit-project 2>/dev/null \
|
|
393
443
|
| grep -cE '^-e |@ file://' || true )
|
|
394
444
|
if [ "${local_deps:-0}" -gt 0 ]; then
|
|
395
445
|
echo " (${rel}: ${local_deps} local path dependenc$([ "$local_deps" -eq 1 ] && echo y || echo ies) excluded -- first-party, audited in their own repo; their transitive dependencies are still scanned)"
|
package/dist/index.js
CHANGED
|
@@ -1104,6 +1104,7 @@ function classifyUpgradeBranches(refs, currentBranch) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
|
|
1106
1106
|
// src/adapters/git/index.ts
|
|
1107
|
+
var LITERAL = "--literal-pathspecs";
|
|
1107
1108
|
var GitAdapter = class {
|
|
1108
1109
|
/** True if `cwd` is inside a git working tree. */
|
|
1109
1110
|
/**
|
|
@@ -1210,19 +1211,68 @@ var GitAdapter = class {
|
|
|
1210
1211
|
await execa("git", ["remote", "add", name, url], { cwd });
|
|
1211
1212
|
}
|
|
1212
1213
|
async add(cwd, paths) {
|
|
1213
|
-
await execa("git", ["add", ...paths], { cwd });
|
|
1214
|
+
await execa("git", [LITERAL, "add", ...paths], { cwd });
|
|
1214
1215
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1216
|
+
/**
|
|
1217
|
+
* Commits `paths` and nothing else (#2113).
|
|
1218
|
+
*
|
|
1219
|
+
* `paths` is required, and a bare `git commit -m` is unrepresentable here:
|
|
1220
|
+
* without a pathspec git commits the *whole index*, so anything the operator
|
|
1221
|
+
* had already staged for unrelated work (in `--cwd`, or in someone else's
|
|
1222
|
+
* `--frontend-cwd` checkout) was swept into the plugin commit. With a
|
|
1223
|
+
* pathspec git commits only those paths' working-tree state — their changes
|
|
1224
|
+
* were staged by the preceding `add`, so they are all included — and leaves
|
|
1225
|
+
* every other staged file staged, untouched, for the operator.
|
|
1226
|
+
*
|
|
1227
|
+
* Pass exactly what the same command handed to `add`. Throws on an empty
|
|
1228
|
+
* list rather than degrading to a bare commit (`git commit -- ` with no
|
|
1229
|
+
* paths is a bare commit).
|
|
1230
|
+
*
|
|
1231
|
+
* ## Two properties the pathspec form needs handled here (#2113 review)
|
|
1232
|
+
*
|
|
1233
|
+
* **The real index is reconciled afterwards.** `git commit -- <paths>` (git's
|
|
1234
|
+
* `--only` mode) commits via a *temporary* index, which is exactly what stops
|
|
1235
|
+
* the operator's other staged files being swept in. But a pre-commit hook that
|
|
1236
|
+
* rewrites files (the estate's lint-staged: prettier / eslint --fix / ruff
|
|
1237
|
+
* format) re-stages its output into that temporary index only — the real index
|
|
1238
|
+
* keeps the pre-hook content, so a successful commit left `MM <file>` and a
|
|
1239
|
+
* staged revert of the formatting for the operator's next commit to pick up. A
|
|
1240
|
+
* bare commit never had this, because it commits the real index. After the
|
|
1241
|
+
* commit, `paths` are therefore reset in the real index to HEAD, which is what
|
|
1242
|
+
* was just committed. Only `paths` are touched, so every other staged file
|
|
1243
|
+
* stays staged. If the commit itself fails nothing is reconciled and the
|
|
1244
|
+
* paths stay staged, as before.
|
|
1245
|
+
*
|
|
1246
|
+
* **Paths are literal, not pathspecs** (`--literal-pathspecs`). Otherwise
|
|
1247
|
+
* `[a].txt` also matches `a.txt`, and the commit widens to an unrelated
|
|
1248
|
+
* staged file.
|
|
1249
|
+
*/
|
|
1250
|
+
async commit(cwd, message, paths) {
|
|
1251
|
+
if (paths.length === 0) {
|
|
1252
|
+
throw new Error(
|
|
1253
|
+
"GitAdapter.commit requires at least one path: a commit with no pathspec would sweep in whatever else is staged."
|
|
1254
|
+
);
|
|
1255
|
+
}
|
|
1256
|
+
await execa("git", [LITERAL, "commit", "-m", message, "--", ...paths], { cwd });
|
|
1257
|
+
await execa("git", [LITERAL, "reset", "-q", "--", ...paths], { cwd });
|
|
1217
1258
|
}
|
|
1218
1259
|
/** The current branch name (e.g. "dev"). */
|
|
1219
1260
|
async currentBranch(cwd) {
|
|
1220
1261
|
const { stdout } = await execa("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd });
|
|
1221
1262
|
return stdout.trim();
|
|
1222
1263
|
}
|
|
1223
|
-
/**
|
|
1224
|
-
|
|
1225
|
-
|
|
1264
|
+
/**
|
|
1265
|
+
* True if the working tree or index has uncommitted changes — restricted to
|
|
1266
|
+
* `paths` when given (#2113: a pathspec commit only commits those, so "is
|
|
1267
|
+
* there anything for *me* to commit" must not be answered by an unrelated
|
|
1268
|
+
* staged file).
|
|
1269
|
+
*/
|
|
1270
|
+
async hasUncommittedChanges(cwd, paths) {
|
|
1271
|
+
const { stdout } = await execa(
|
|
1272
|
+
"git",
|
|
1273
|
+
[LITERAL, "status", "--porcelain", ...paths && paths.length > 0 ? ["--", ...paths] : []],
|
|
1274
|
+
{ cwd }
|
|
1275
|
+
);
|
|
1226
1276
|
return stdout.trim().length > 0;
|
|
1227
1277
|
}
|
|
1228
1278
|
/**
|
|
@@ -4305,7 +4355,7 @@ async function buildCommitAndOpenPr(options, deps, plan, migrations, fromVersion
|
|
|
4305
4355
|
const lockfiles = await refreshInstanceLockfiles(options.cwd, applied, deps);
|
|
4306
4356
|
const carriedPrs = readCarriedPrs(options.templateRepo, fromVersion, toVersion);
|
|
4307
4357
|
await git.add(options.cwd, ["-A"]);
|
|
4308
|
-
await git.commit(options.cwd, buildCommitMessage(fromVersion, toVersion, carriedPrs));
|
|
4358
|
+
await git.commit(options.cwd, buildCommitMessage(fromVersion, toVersion, carriedPrs), ["."]);
|
|
4309
4359
|
const run = deps.runCommand ?? defaultRunCommand;
|
|
4310
4360
|
const installOutcomes = await installInstanceDependencies(options.cwd, run);
|
|
4311
4361
|
const installFailures = describeInstallFailures(installOutcomes);
|
|
@@ -5696,7 +5746,7 @@ async function runDataImport(name, options, deps) {
|
|
|
5696
5746
|
log.success(`Imported ${String(sqlFiles.length)} .sql file(s) to db/imports/${name}/`);
|
|
5697
5747
|
const commitMessage = `feat(data): import ${name} (${String(sqlFiles.length)} SQL file(s))`;
|
|
5698
5748
|
await deps.git.add(options.cwd, [`db/imports/${name}`]);
|
|
5699
|
-
await deps.git.commit(options.cwd, commitMessage);
|
|
5749
|
+
await deps.git.commit(options.cwd, commitMessage, [`db/imports/${name}`]);
|
|
5700
5750
|
log.success(`Committed: ${commitMessage}`);
|
|
5701
5751
|
console.log(chalk6.bold("\n Data import staged!\n"));
|
|
5702
5752
|
console.log(
|
|
@@ -8817,7 +8867,8 @@ async function pushSkeleton(git, skeletonRoot, cloneUrl, config, coreConfig, git
|
|
|
8817
8867
|
workDir,
|
|
8818
8868
|
`feat: scaffold ${config.project.name} sibling app (ADR-0007)
|
|
8819
8869
|
|
|
8820
|
-
[skip ci]
|
|
8870
|
+
[skip ci]`,
|
|
8871
|
+
["."]
|
|
8821
8872
|
);
|
|
8822
8873
|
await git.push(workDir, "dev", { token: githubToken });
|
|
8823
8874
|
} finally {
|
|
@@ -9028,7 +9079,8 @@ async function registerWithCore(git, github, config, coreConfig, pathPrefix, git
|
|
|
9028
9079
|
await git.add(cloneDir, touchedFiles);
|
|
9029
9080
|
await git.commit(
|
|
9030
9081
|
cloneDir,
|
|
9031
|
-
isRootPathPrefix(pathPrefix) ? `infra(cdn): register root application sibling "${name}" at / (ADR-0007)` : `infra(cdn): register sibling "${name}" for path-based routing (ADR-0007)
|
|
9082
|
+
isRootPathPrefix(pathPrefix) ? `infra(cdn): register root application sibling "${name}" at / (ADR-0007)` : `infra(cdn): register sibling "${name}" for path-based routing (ADR-0007)`,
|
|
9083
|
+
touchedFiles
|
|
9032
9084
|
);
|
|
9033
9085
|
await git.push(cloneDir, branch, { token: githubToken });
|
|
9034
9086
|
const remoteUrl = await git.getRemoteUrl(cloneDir);
|
|
@@ -10137,7 +10189,7 @@ async function runPluginCreate(name, options, deps) {
|
|
|
10137
10189
|
}
|
|
10138
10190
|
const commitMessage = `feat(plugins): scaffold ${names.slug} plugin`;
|
|
10139
10191
|
await deps.git.add(options.cwd, [relDir]);
|
|
10140
|
-
await deps.git.commit(options.cwd, commitMessage);
|
|
10192
|
+
await deps.git.commit(options.cwd, commitMessage, [relDir]);
|
|
10141
10193
|
log.success(`Committed: ${commitMessage}`);
|
|
10142
10194
|
}
|
|
10143
10195
|
printNextSteps(names, relDir, channel);
|
|
@@ -10185,7 +10237,7 @@ async function runStandaloneCreate(names, options, deps) {
|
|
|
10185
10237
|
}
|
|
10186
10238
|
await deps.git.init(destDir);
|
|
10187
10239
|
await deps.git.add(destDir, ["."]);
|
|
10188
|
-
await deps.git.commit(destDir, `feat: scaffold ${names.slug} plugin
|
|
10240
|
+
await deps.git.commit(destDir, `feat: scaffold ${names.slug} plugin`, ["."]);
|
|
10189
10241
|
log.success(`Initialised a git repo on dev with an initial commit`);
|
|
10190
10242
|
}
|
|
10191
10243
|
if (options.org !== void 0 && options.org !== "") {
|
|
@@ -10255,7 +10307,9 @@ async function registerInRegistrySources(names, cloneUrl, token, deps) {
|
|
|
10255
10307
|
}
|
|
10256
10308
|
writeFileSync11(path, serialiseSources(next));
|
|
10257
10309
|
await deps.git.add(dir, ["sources.json"]);
|
|
10258
|
-
await deps.git.commit(dir, `feat(registry): track ${names.slug} in sources.json
|
|
10310
|
+
await deps.git.commit(dir, `feat(registry): track ${names.slug} in sources.json`, [
|
|
10311
|
+
"sources.json"
|
|
10312
|
+
]);
|
|
10259
10313
|
await deps.git.push(dir, "main", { token });
|
|
10260
10314
|
log.success(`Registered ${names.slug} in the plugin registry's sources.json`);
|
|
10261
10315
|
} catch (err) {
|
|
@@ -11220,7 +11274,7 @@ async function runPluginInstall(target, options, deps) {
|
|
|
11220
11274
|
await deps.git.add(registryCwd, [PLUGIN_REGISTRY_RELATIVE_PATH]);
|
|
11221
11275
|
left.dashboard.stage = "staged";
|
|
11222
11276
|
left.dashboard.staged = [PLUGIN_REGISTRY_RELATIVE_PATH];
|
|
11223
|
-
await deps.git.commit(registryCwd, dashboardCommitMessage);
|
|
11277
|
+
await deps.git.commit(registryCwd, dashboardCommitMessage, [PLUGIN_REGISTRY_RELATIVE_PATH]);
|
|
11224
11278
|
left.dashboard.stage = "committed";
|
|
11225
11279
|
left.dashboard.committed = dashboardCommitMessage;
|
|
11226
11280
|
log.success(
|
|
@@ -11236,7 +11290,7 @@ async function runPluginInstall(target, options, deps) {
|
|
|
11236
11290
|
await deps.git.add(options.cwd, stagePaths);
|
|
11237
11291
|
left.core.stage = "staged";
|
|
11238
11292
|
left.core.staged = stagePaths;
|
|
11239
|
-
await deps.git.commit(options.cwd, commitMessage);
|
|
11293
|
+
await deps.git.commit(options.cwd, commitMessage, stagePaths);
|
|
11240
11294
|
log.success(`Committed: ${commitMessage}`);
|
|
11241
11295
|
console.log(chalk15.bold("\n Plugin installed!\n"));
|
|
11242
11296
|
console.log(` ${pluginName}@${source.version} is committed at ${relTargetDir}/`);
|
|
@@ -11779,7 +11833,7 @@ async function runPluginSyncMigrations(name, options, deps) {
|
|
|
11779
11833
|
await deps.git.add(options.cwd, relativePaths);
|
|
11780
11834
|
const label = name ?? `${String(generated.length)} plugin(s)`;
|
|
11781
11835
|
const commitMessage = `chore(plugins): sync migration(s) for ${label}`;
|
|
11782
|
-
await deps.git.commit(options.cwd, commitMessage);
|
|
11836
|
+
await deps.git.commit(options.cwd, commitMessage, relativePaths);
|
|
11783
11837
|
log.success(`Committed: ${commitMessage}`);
|
|
11784
11838
|
} else {
|
|
11785
11839
|
log.warn("--no-commit: generated file(s) are on disk but not staged/committed.");
|
|
@@ -11900,7 +11954,7 @@ Remove the reference(s) above first, then re-run uninstall.`
|
|
|
11900
11954
|
const label = version ? `${name}@${version}` : name;
|
|
11901
11955
|
const commitMessage = `chore(plugins): uninstall ${label}`;
|
|
11902
11956
|
await deps.git.add(options.cwd, stagePaths);
|
|
11903
|
-
await deps.git.commit(options.cwd, commitMessage);
|
|
11957
|
+
await deps.git.commit(options.cwd, commitMessage, stagePaths);
|
|
11904
11958
|
log.success(`Committed: ${commitMessage}`);
|
|
11905
11959
|
console.log(chalk18.bold("\n Plugin uninstalled!\n"));
|
|
11906
11960
|
console.log(` services/${name}/ has been removed and committed.`);
|
|
@@ -12129,7 +12183,7 @@ async function runPluginUpgrade(target, options, deps) {
|
|
|
12129
12183
|
const label = currentVersion ? `${entry.name} ${currentVersion} -> ${entry.version}` : `${entry.name} to ${entry.version}`;
|
|
12130
12184
|
const commitMessage = `feat(plugins): upgrade ${label}`;
|
|
12131
12185
|
await deps.git.add(options.cwd, stagePaths);
|
|
12132
|
-
await deps.git.commit(options.cwd, commitMessage);
|
|
12186
|
+
await deps.git.commit(options.cwd, commitMessage, stagePaths);
|
|
12133
12187
|
log.success(`Committed: ${commitMessage}`);
|
|
12134
12188
|
const lockFailures = describeFailures(lockOutcomes);
|
|
12135
12189
|
if (lockFailures.length > 0) {
|
|
@@ -12250,12 +12304,12 @@ async function runLocalPluginRefresh(localPath, options, deps) {
|
|
|
12250
12304
|
if (outcome.ok) stagePaths.push(outcome.trigger.lockfile);
|
|
12251
12305
|
}
|
|
12252
12306
|
await deps.git.add(options.cwd, stagePaths);
|
|
12253
|
-
if (!await deps.git.hasUncommittedChanges(options.cwd)) {
|
|
12307
|
+
if (!await deps.git.hasUncommittedChanges(options.cwd, stagePaths)) {
|
|
12254
12308
|
log.warn(`services/${source.name}/ already matches ${source.origin} \u2014 nothing to commit.`);
|
|
12255
12309
|
return;
|
|
12256
12310
|
}
|
|
12257
12311
|
const commitMessage = `chore(plugins): refresh ${source.name} from local checkout`;
|
|
12258
|
-
await deps.git.commit(options.cwd, commitMessage);
|
|
12312
|
+
await deps.git.commit(options.cwd, commitMessage, stagePaths);
|
|
12259
12313
|
log.success(`Committed: ${commitMessage}`);
|
|
12260
12314
|
const lockFailures = describeFailures(lockOutcomes);
|
|
12261
12315
|
if (lockFailures.length > 0) {
|