@spardutti/claude-skills 2.29.0 → 2.30.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/lib/github.mjs +12 -2
- package/lib/setup-hook.mjs +32 -0
- package/package.json +1 -1
package/lib/github.mjs
CHANGED
|
@@ -34,6 +34,16 @@ function getAuthHeaders() {
|
|
|
34
34
|
return headers;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
// raw.githubusercontent.com is not the API and does not take an API token. Sent
|
|
38
|
+
// one, it answers 503 — measured: the same URL returns 200 without the header
|
|
39
|
+
// and 503 with it. The CLI passed its API headers to every raw fetch, so a
|
|
40
|
+
// machine with `gh auth token` set lost most skill files to "Warning: Failed to
|
|
41
|
+
// fetch ..., skipping" and installed a partial set, while a machine without gh
|
|
42
|
+
// worked fine. Raw needs the User-Agent and nothing else.
|
|
43
|
+
function getRawHeaders() {
|
|
44
|
+
return { "User-Agent": "claude-skills-cli" };
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
async function fetchListing({ apiUrl, label, entryFilter, buildRawUrl, mapEntry, allow404 = false }) {
|
|
38
48
|
const headers = getAuthHeaders();
|
|
39
49
|
const res = await fetch(apiUrl, { headers });
|
|
@@ -51,7 +61,7 @@ async function fetchListing({ apiUrl, label, entryFilter, buildRawUrl, mapEntry,
|
|
|
51
61
|
const results = await Promise.all(
|
|
52
62
|
entries.map(async (entry) => {
|
|
53
63
|
try {
|
|
54
|
-
const r = await fetch(buildRawUrl(entry), { headers });
|
|
64
|
+
const r = await fetch(buildRawUrl(entry), { headers: getRawHeaders() });
|
|
55
65
|
if (!r.ok) {
|
|
56
66
|
console.warn(` Warning: Failed to fetch ${label} ${entry.name}, skipping`);
|
|
57
67
|
return null;
|
|
@@ -92,7 +102,7 @@ export async function fetchSkills() {
|
|
|
92
102
|
|
|
93
103
|
const fetched = await Promise.all(
|
|
94
104
|
files.map(async (f) => {
|
|
95
|
-
const r = await fetch(`${RAW_BASE}/${dir.name}/${f.name}`, { headers });
|
|
105
|
+
const r = await fetch(`${RAW_BASE}/${dir.name}/${f.name}`, { headers: getRawHeaders() });
|
|
96
106
|
if (!r.ok) {
|
|
97
107
|
console.warn(` Warning: Failed to fetch ${dir.name}/${f.name}, skipping`);
|
|
98
108
|
return null;
|
package/lib/setup-hook.mjs
CHANGED
|
@@ -454,6 +454,18 @@ const GAUNTLET_SCRIPT = `#!/usr/bin/env bash
|
|
|
454
454
|
# Setting either command switches the whole repo to explicit mode — auto-detection
|
|
455
455
|
# is off, and only what you set runs.
|
|
456
456
|
#
|
|
457
|
+
# Per-project runners, for tests that cannot run on the host at all:
|
|
458
|
+
# <project>/.gauntlet-test executable; run instead of the detected test
|
|
459
|
+
# command, with $FILES as its arguments
|
|
460
|
+
# <project>/.gauntlet-typecheck executable; run instead of the detected
|
|
461
|
+
# typecheck command
|
|
462
|
+
#
|
|
463
|
+
# <project> is any directory holding a package.json or pyproject.toml, so one
|
|
464
|
+
# half of a monorepo can run on the host while the other runs in a container.
|
|
465
|
+
# Unlike GAUNTLET_TEST these do not disable detection anywhere else. Typically a
|
|
466
|
+
# two-line \`docker compose run --rm -T api pytest "$@"\`. Same shape as
|
|
467
|
+
# ship-gate's .mutmut-run.
|
|
468
|
+
#
|
|
457
469
|
# Every run records why it ended in /tmp/claude-gauntlet-<session>.why, so a green
|
|
458
470
|
# run and a skipped one are told apart without re-running the hook.
|
|
459
471
|
|
|
@@ -551,6 +563,26 @@ add_dir_gates() {
|
|
|
551
563
|
[ -n "$d" ] && [ -n "\${ROOT_TC:-}" ] && have_tc="skip"
|
|
552
564
|
[ -n "$d" ] && [ -n "\${ROOT_TEST:-}" ] && have_test="skip"
|
|
553
565
|
|
|
566
|
+
# A project whose tests need a database, a queue, or any other service cannot
|
|
567
|
+
# run them on the host, and detection here finds the host runner every time.
|
|
568
|
+
# An executable runner in the project directory says where they DO run —
|
|
569
|
+
# usually \`docker compose run\` against the app container — and wins over
|
|
570
|
+
# everything detected below.
|
|
571
|
+
#
|
|
572
|
+
# Per project, not per repo: GAUNTLET_TEST switches the WHOLE repo to explicit
|
|
573
|
+
# mode, so a monorepo needing a container for one stack had to hand-write
|
|
574
|
+
# commands for all of them. These let one half run on the host and the other
|
|
575
|
+
# in a container. Same shape as ship-gate's .mutmut-run, deliberately.
|
|
576
|
+
RUNNER_EXT="($JS_EXT|py)"
|
|
577
|
+
if [ -z "$have_tc" ] && [ -x "$d\${d:+/}.gauntlet-typecheck" ]; then
|
|
578
|
+
add_gate typecheck "$pre$RUNNER_EXT\\$" "\${run}./.gauntlet-typecheck"
|
|
579
|
+
have_tc="skip"
|
|
580
|
+
fi
|
|
581
|
+
if [ -z "$have_test" ] && [ -x "$d\${d:+/}.gauntlet-test" ]; then
|
|
582
|
+
add_gate tests "$pre$RUNNER_EXT\\$" "\${run}./.gauntlet-test \\$FILES"
|
|
583
|
+
have_test="skip"
|
|
584
|
+
fi
|
|
585
|
+
|
|
554
586
|
if [ -f "$d\${d:+/}package.json" ]; then
|
|
555
587
|
pkg="$d\${d:+/}package.json"
|
|
556
588
|
if [ -z "$have_tc" ]; then
|