Skip to content

Commit af95abf

Browse files
committed
chore(wheelhouse): cascade template@cd65ef7a
Auto-applied by socket-wheelhouse sync-scaffolding into cascade-socket-cli-66133. 14 file(s) touched: - .claude/hooks/fleet/_shared/test/transcript.test.mts - .claude/hooks/fleet/_shared/transcript.mts - .claude/hooks/fleet/minimum-release-age-guard/index.mts - .claude/hooks/fleet/no-fleet-fork-guard/index.mts - .claude/hooks/fleet/no-fleet-fork-guard/test/index.test.mts - .config/oxfmtrc.json - .config/oxlintrc.json - .gitattributes - docs/claude.md/fleet/bypass-phrases.md - pnpm-workspace.yaml - scripts/check-soak-exclude-dates.mts - scripts/soak-bypass.mts - scripts/test/check-soak-exclude-dates.test.mts - scripts/test/soak-bypass.test.mts
1 parent 024542c commit af95abf

14 files changed

Lines changed: 539 additions & 25 deletions

File tree

.claude/hooks/fleet/_shared/test/transcript.test.mts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,23 @@ test('bypassPhrasePresent: finds the phrase', () => {
155155
}
156156
})
157157

158-
test('bypassPhrasePresent: case-sensitive (lowercase does not count)', () => {
158+
test('bypassPhrasePresent: case-insensitive (lowercase counts)', () => {
159159
const f = writeTranscript(
160160
JSON.stringify({ role: 'user', content: 'allow revert bypass please' }),
161161
)
162162
try {
163-
assert.equal(bypassPhrasePresent(f, 'Allow revert bypass'), false)
163+
assert.equal(bypassPhrasePresent(f, 'Allow revert bypass'), true)
164+
} finally {
165+
cleanup(f)
166+
}
167+
})
168+
169+
test('bypassPhrasePresent: uppercase counts', () => {
170+
const f = writeTranscript(
171+
JSON.stringify({ role: 'user', content: 'ALLOW REVERT BYPASS please' }),
172+
)
173+
try {
174+
assert.equal(bypassPhrasePresent(f, 'Allow revert bypass'), true)
164175
} finally {
165176
cleanup(f)
166177
}

.claude/hooks/fleet/_shared/transcript.mts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,17 @@ function normalizeBypassText(text: string): string {
5353
// the bypass phrase only after invisible chars are stripped — nor
5454
// can a user accidentally type a phrase that fails to match because
5555
// an editor inserted a zero-width-space.
56+
// toLowerCase: matching is case-INsensitive — `allow fleet-fork bypass`
57+
// and `ALLOW FLEET-FORK BYPASS` count the same as the canonical mixed
58+
// case. Typing the phrase is already a deliberate act; casing carries no
59+
// extra signal, and requiring exact case just trips up a hurried user.
60+
// Combined with the dash/whitespace fold below, only the words + their
61+
// order are load-bearing.
5662
return text
5763
.normalize('NFKC')
5864
.replace(/\p{Cf}/gu, '')
5965
.replace(/[-\s]+/g, ' ')
66+
.toLowerCase()
6067
}
6168

6269
export function bypassPhrasePresent(

.claude/hooks/fleet/minimum-release-age-guard/index.mts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ async function main(): Promise<void> {
205205
' - Emergency CVE patch published < 7 days ago.',
206206
' - First-party package you control.',
207207
'',
208-
` Bypass: type "${BYPASS_PHRASE}" in a new message, then retry.`,
208+
" Don't hand-edit the exclude list — run the canonical helper, which",
209+
' looks up the npm publish date and writes the dated annotation for you:',
210+
' node scripts/soak-bypass.mts <pkg>@<version>',
211+
' (the daily updating-daily job removes the entry once its soak clears).',
212+
'',
213+
` Bypass (to hand-edit anyway): type "${BYPASS_PHRASE}" in a new message, then retry.`,
209214
'',
210215
].join('\n'),
211216
)

.claude/hooks/fleet/no-fleet-fork-guard/index.mts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ export function findFleetRepoRoot(filePath: string): string | undefined {
148148
return undefined
149149
}
150150

151-
export function isCanonicalRelativePath(rel: string): boolean {
151+
export function isCanonicalRelativePath(
152+
rel: string,
153+
repoRoot?: string | undefined,
154+
): boolean {
152155
const normalized = rel.replace(/\\/g, '/')
153156
// Per-repo carve-outs take precedence over the canonical prefixes
154157
// (they're more specific). Edits under these paths are intentionally
@@ -165,6 +168,19 @@ export function isCanonicalRelativePath(rel: string): boolean {
165168
return true
166169
}
167170
}
171+
// `scripts/<x>` is fleet-canonical when it has a cascaded twin under
172+
// `template/scripts/<x>` (the wheelhouse mirrors root scripts/ from the
173+
// template; sync-scaffolding/ + validate-template.mts etc. are
174+
// wheelhouse-only tooling with no template twin and are NOT canonical).
175+
// A bare `scripts/` prefix would wrongly guard that wheelhouse-only set,
176+
// so probe for the twin instead. `scripts/repo/` is already excluded above.
177+
if (
178+
repoRoot &&
179+
normalized.startsWith('scripts/') &&
180+
existsSync(path.join(repoRoot, 'template', normalized))
181+
) {
182+
return true
183+
}
168184
return CANONICAL_FILES.includes(normalized)
169185
}
170186

@@ -215,7 +231,7 @@ async function main(): Promise<number> {
215231

216232
const relToRepo = path.relative(repoRoot, absPath)
217233

218-
if (!isCanonicalRelativePath(relToRepo)) {
234+
if (!isCanonicalRelativePath(relToRepo, repoRoot)) {
219235
return 0
220236
}
221237

.claude/hooks/fleet/no-fleet-fork-guard/test/index.test.mts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,9 @@ test('bypass phrase variants do NOT count', async () => {
274274
const repo = makeFakeFleetRepo()
275275
try {
276276
const file = makeCanonicalFile(repo, '.git-hooks/pre-push.mts')
277-
// Each of these should NOT bypass — phrase must be exact.
277+
// Each of these should NOT bypass: a word of the phrase is missing.
278+
// (Case + dash/space variants DO count — see the next test.)
278279
for (const variant of [
279-
'allow fleet-fork bypass', // lowercase
280-
'Allow fleet fork bypass', // space instead of hyphen
281280
'Allow fleet-fork', // no "bypass"
282281
'fleet-fork bypass', // no "Allow"
283282
]) {
@@ -299,6 +298,34 @@ test('bypass phrase variants do NOT count', async () => {
299298
}
300299
})
301300

301+
test('case / hyphen / space / dash variants of the phrase all count', async () => {
302+
const repo = makeFakeFleetRepo()
303+
try {
304+
const file = makeCanonicalFile(repo, '.git-hooks/pre-push.mts')
305+
// The normalizer lowercases + folds dash variants + whitespace, so a
306+
// human typing lowercase, spaces, or an em-dash instead of the canonical
307+
// mixed-case hyphenated phrase still bypasses. Only the words + order matter.
308+
for (const variant of [
309+
'Allow fleet-fork bypass', // canonical
310+
'allow fleet-fork bypass', // lowercase
311+
'ALLOW FLEET-FORK BYPASS', // uppercase
312+
'Allow fleet fork bypass', // spaces instead of hyphen
313+
'Allow fleet—fork bypass', // em-dash
314+
]) {
315+
const result = await runHook(
316+
{
317+
tool_input: { file_path: file, new_string: 'x' },
318+
tool_name: 'Edit',
319+
},
320+
userTurn(variant),
321+
)
322+
assert.strictEqual(result.code, 0, `variant should bypass: ${variant}`)
323+
}
324+
} finally {
325+
rmSync(repo, { force: true, recursive: true })
326+
}
327+
})
328+
302329
test('paths under socket-wheelhouse/template/ always pass', async () => {
303330
// Even if Claude tries to spell out a path that would otherwise
304331
// match a canonical prefix, anything under .../socket-wheelhouse/

.config/oxfmtrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,15 @@
122122
"**/scripts/publish-shared.mts",
123123
"**/scripts/publish.mts",
124124
"**/scripts/security.mts",
125+
"**/scripts/soak-bypass.mts",
125126
"**/scripts/socket-wheelhouse-emit-schema.mts",
126127
"**/scripts/socket-wheelhouse-schema.mts",
127128
"**/scripts/test/check-lock-step-header.test.mts",
128129
"**/scripts/test/check-lock-step-refs.test.mts",
130+
"**/scripts/test/check-soak-exclude-dates.test.mts",
129131
"**/scripts/test/install-claude-plugins.test.mts",
130132
"**/scripts/test/install-git-hooks.test.mts",
133+
"**/scripts/test/soak-bypass.test.mts",
131134
"**/scripts/update.mts",
132135
"**/scripts/util/multi-package-publish.mts",
133136
"**/scripts/util/pack-app-triplets.mts",

.config/oxlintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,15 @@
245245
"**/scripts/publish-shared.mts",
246246
"**/scripts/publish.mts",
247247
"**/scripts/security.mts",
248+
"**/scripts/soak-bypass.mts",
248249
"**/scripts/socket-wheelhouse-emit-schema.mts",
249250
"**/scripts/socket-wheelhouse-schema.mts",
250251
"**/scripts/test/check-lock-step-header.test.mts",
251252
"**/scripts/test/check-lock-step-refs.test.mts",
253+
"**/scripts/test/check-soak-exclude-dates.test.mts",
252254
"**/scripts/test/install-claude-plugins.test.mts",
253255
"**/scripts/test/install-git-hooks.test.mts",
256+
"**/scripts/test/soak-bypass.test.mts",
254257
"**/scripts/update.mts",
255258
"**/scripts/util/multi-package-publish.mts",
256259
"**/scripts/util/pack-app-triplets.mts",

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,15 @@ scripts/publish-release.mts linguist-generated=true
321321
scripts/publish-shared.mts linguist-generated=true
322322
scripts/publish.mts linguist-generated=true
323323
scripts/security.mts linguist-generated=true
324+
scripts/soak-bypass.mts linguist-generated=true
324325
scripts/socket-wheelhouse-emit-schema.mts linguist-generated=true
325326
scripts/socket-wheelhouse-schema.mts linguist-generated=true
326327
scripts/test/check-lock-step-header.test.mts linguist-generated=true
327328
scripts/test/check-lock-step-refs.test.mts linguist-generated=true
329+
scripts/test/check-soak-exclude-dates.test.mts linguist-generated=true
328330
scripts/test/install-claude-plugins.test.mts linguist-generated=true
329331
scripts/test/install-git-hooks.test.mts linguist-generated=true
332+
scripts/test/soak-bypass.test.mts linguist-generated=true
330333
scripts/update.mts linguist-generated=true
331334
scripts/util/multi-package-publish.mts linguist-generated=true
332335
scripts/util/pack-app-triplets.mts linguist-generated=true

docs/claude.md/fleet/bypass-phrases.md

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,20 @@ blockExoticSubdeps: true
304304
# in the default `catalog:` block above. This defeats accidental
305305
# local-checkout resolution when a sibling repo is on disk.
306306
overrides:
307+
# Fleet-canonical overrides (managed by socket-wheelhouse sync; do not edit).
308+
'@socketregistry/packageurl-js': 'catalog:'
309+
'@socketsecurity/lib': 'catalog:'
310+
'@socketsecurity/registry': 'catalog:'
311+
'@socketsecurity/sdk': 'catalog:'
312+
'uuid': '11.1.1'
313+
314+
# Repo-specific overrides below.
307315
'@octokit/graphql': 'catalog:'
308316
'@octokit/request-error': 'catalog:'
309317
'@sigstore/sign': '4.1.0'
310-
'@socketregistry/packageurl-js': 'catalog:'
311318
'@socketregistry/packageurl-js-stable': 'catalog:'
312-
'@socketsecurity/lib': 'catalog:'
313319
'@socketsecurity/lib-stable': 'catalog:'
314-
'@socketsecurity/registry': 'catalog:'
315320
'@socketsecurity/registry-stable': 'catalog:'
316-
'@socketsecurity/sdk': 'catalog:'
317321
'@socketsecurity/sdk-stable': 'catalog:'
318322
'aggregate-error': 'catalog:'
319323
'ansi-regex': 'catalog:'
@@ -360,7 +364,6 @@ overrides:
360364
'tiny-colors': 'catalog:'
361365
'typedarray': 'catalog:'
362366
'undici': 'catalog:'
363-
'uuid': '11.1.1'
364367
'vite': 'catalog:'
365368
'wrap-ansi': 'catalog:'
366369
'xml2js': 'catalog:'

0 commit comments

Comments
 (0)