diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e0b8e5..45c5344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.0.1] - 2026-11-03 + +### Fixed + +- `scan` comment masking ran in quadratic time on some hostile files: 400 KB of unclosed `/*` or `', index + 4) - else continue + else { + if (!/\s/.test(char)) previous = char + continue + } for (let at = index; at < end; at++) if (out[at] !== '\n') out[at] = ' ' index = end - 1 } @@ -285,6 +370,8 @@ function selectChecks(root, { skill, all }) { if (all) return true const found = resolvePackage(root, manifest, check.packages) if (!found) return false + // A check the project config rules out is neither skipped nor unknown: it never applies. + if (check.onlyIf && !projectFileMatches(check.onlyIf, root, rootFiles)) return false if (check.since !== undefined && found.major === undefined) { unknown++ return false @@ -293,7 +380,7 @@ function selectChecks(root, { skill, all }) { skipped++ return false } - return !check.onlyIf || projectFileMatches(check.onlyIf, root, rootFiles) + return true }) return { checks, skipped, unknown } } diff --git a/mcp/package-lock.json b/mcp/package-lock.json index 60a0d6d..092d8d7 100644 --- a/mcp/package-lock.json +++ b/mcp/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pymodel/react-frontend-skills-mcp", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pymodel/react-frontend-skills-mcp", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.32.2", diff --git a/mcp/package.json b/mcp/package.json index 88b28e1..88f1323 100644 --- a/mcp/package.json +++ b/mcp/package.json @@ -1,6 +1,6 @@ { "name": "@pymodel/react-frontend-skills-mcp", - "version": "2.0.0", + "version": "2.0.1", "description": "Read-only MCP server for 18 production-grade React frontend agent skills.", "type": "module", "license": "MIT", diff --git a/mcp/scripts/package-smoke.mjs b/mcp/scripts/package-smoke.mjs index ff08a89..c4c1bff 100644 --- a/mcp/scripts/package-smoke.mjs +++ b/mcp/scripts/package-smoke.mjs @@ -1,5 +1,5 @@ import { execFile } from 'node:child_process' -import { mkdtemp, readFile, rm, stat, writeFile } from 'node:fs/promises' +import { mkdtemp, rm, stat, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { dirname, resolve } from 'node:path' import { promisify } from 'node:util' @@ -30,20 +30,16 @@ async function pathExists(path) { async function main() { const source = await loadCatalog({ skillsDir: resolve(packageRoot, '..', 'skills') }) const installationRoot = await mkdtemp(joinTempPath()) - const { name, version } = JSON.parse(await readFile(resolve(packageRoot, 'package.json'), 'utf8')) - // npm pack's deterministic file name; removed on exit only if this run created it. - const expectedTarball = resolve(packageRoot, `${name.replace(/^@/, '').replace('/', '-')}-${version}.tgz`) - const preexisting = await pathExists(expectedTarball) - let tarballPath let client try { - const { stdout } = await npm(['pack', '--json', '--silent'], { cwd: packageRoot }) + // Pack into the temp dir, so a tarball already sitting in the package root is never touched. + const { stdout } = await npm(['pack', '--json', '--silent', '--pack-destination', installationRoot], { cwd: packageRoot }) // npm 10/11 print an array of results; npm 12 prints an object keyed by package name. const packResult = JSON.parse(stdout) const [packed] = Array.isArray(packResult) ? packResult : Object.values(packResult) if (!packed?.filename) throw new Error(`Unexpected npm pack --json output: ${stdout.slice(0, 200)}`) - tarballPath = resolve(packageRoot, packed.filename) + const tarballPath = resolve(installationRoot, packed.filename) const dotfiles = packed.files.map((file) => file.path).filter((path) => /(^|\/)\./.test(path)) if (dotfiles.length) throw new Error(`Tarball ships dotfiles: ${dotfiles.join(', ')}`) @@ -92,9 +88,6 @@ async function main() { process.stdout.write('installed tarball MCP smoke: PASS\n') } finally { await client?.close().catch(() => undefined) - // Also covers a pack whose output could not be parsed; never deletes a tarball that was there before. - if (tarballPath) await rm(tarballPath, { force: true }) - if (!preexisting) await rm(expectedTarball, { force: true }) await rm(installationRoot, { recursive: true, force: true }) await rm(generatedData, { recursive: true, force: true }) } diff --git a/package.json b/package.json index 7d5d8e6..5828671 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pymodel/react-frontend-skills", - "version": "3.0.0", + "version": "3.0.1", "description": "18 production-grade AI agent skills for React 19, Next.js 16, TypeScript 7, testing, data, UI, and frontend architecture.", "license": "MIT", "author": "Mohamed Elkholy (PyModel)", diff --git a/skills/msw/references/debug-common-issues.md b/skills/msw/references/debug-common-issues.md index 82e09f7..ae71e53 100644 --- a/skills/msw/references/debug-common-issues.md +++ b/skills/msw/references/debug-common-issues.md @@ -45,7 +45,7 @@ export const handlers = [ ## Common Issues Quick Reference **Issue: "fetch is not defined"** -- Fix: Upgrade Node.js to 22+ for MSW 3 (18+ for MSW 2) +- Fix: Upgrade Node.js to 22.12+ for MSW 3 (18+ for MSW 2) **Issue: Body parsing hangs with fake timers** ```typescript diff --git a/skills/msw/references/setup-node-version.md b/skills/msw/references/setup-node-version.md index ed82109..97cf837 100644 --- a/skills/msw/references/setup-node-version.md +++ b/skills/msw/references/setup-node-version.md @@ -43,8 +43,8 @@ $ npm install msw@3 ``` ```yaml -# .nvmrc -22 +# .nvmrc (Node 22 LTS, latest release) +lts/jod ``` ```yaml diff --git a/skills/msw/references/setup-typescript-config.md b/skills/msw/references/setup-typescript-config.md index 8f2a2e4..3c5a2f8 100644 --- a/skills/msw/references/setup-typescript-config.md +++ b/skills/msw/references/setup-typescript-config.md @@ -7,7 +7,7 @@ tags: setup, typescript, configuration, types, compiler ## Configure TypeScript for MSW v3 -MSW v3 requires TypeScript 5.9+ (optional peer dependency `typescript: >=5.9.x`) for proper type inference. Its subpath entrypoints (`msw/http`, `msw/graphql`, …) resolve only through package `exports`, so `moduleResolution` must be `bundler`, `node16` or `nodenext`. +MSW v3 requires TypeScript 5.9+ (optional peer dependency `typescript: >=5.9.x`) for proper type inference. Its subpath entrypoints (`msw/http`, `msw/graphql`, …) resolve only through package `exports`, so `moduleResolution` must be `bundler` (with `module: "ESNext"` or `"preserve"`), or `node16`/`nodenext` with the matching `module` value (`node16` with `node16`, `nodenext` with `nodenext`). On MSW 2.x: TypeScript 4.8+ and `import { http, HttpResponse } from 'msw'`. diff --git a/skills/playwright/references/debug-screenshots-videos.md b/skills/playwright/references/debug-screenshots-videos.md index 32fe125..c8e7f70 100644 --- a/skills/playwright/references/debug-screenshots-videos.md +++ b/skills/playwright/references/debug-screenshots-videos.md @@ -74,6 +74,7 @@ export default defineConfig({ name: test-artifacts path: | test-results/**/*.png + test-results/**/*.webp test-results/**/*.webm retention-days: 7 ``` diff --git a/skills/playwright/references/perf-browser-selection.md b/skills/playwright/references/perf-browser-selection.md index 2fb6fd1..ecc87f5 100644 --- a/skills/playwright/references/perf-browser-selection.md +++ b/skills/playwright/references/perf-browser-selection.md @@ -76,7 +76,7 @@ jobs: steps: - uses: actions/checkout@v4 - run: npm ci - - run: npx playwright test + - run: npx playwright test --project="*" env: FULL_TEST: true ``` @@ -109,8 +109,8 @@ This replaces the `isMainBranch ? [...] : []` project array above when the only # Quick test on Chromium only npx playwright test --project=chromium -# Full cross-browser test -npx playwright test +# Full cross-browser test (every project, including default: false ones) +npx playwright test --project="*" # Test specific browser npx playwright test --project=firefox diff --git a/skills/tailwind/references/resp-custom-breakpoints.md b/skills/tailwind/references/resp-custom-breakpoints.md index 9574581..ec9d7cb 100644 --- a/skills/tailwind/references/resp-custom-breakpoints.md +++ b/skills/tailwind/references/resp-custom-breakpoints.md @@ -45,7 +45,7 @@ Add custom breakpoints using the `@theme` directive. This is useful for project- } ``` -**Canonicalization (Tailwind 4.3.4+):** `tailwindcss canonicalize` now converts arbitrary breakpoint and container-query variants to their named equivalents (for example `max-[64rem]:flex` becomes `max-lg:flex`), so arbitrary values that match a theme breakpoint should be written by name. +**Canonicalization (Tailwind 4.3.4+):** `tailwindcss canonicalize` now converts arbitrary breakpoint and container-query variants to their named equivalents in the active theme (with the default theme, `max-[64rem]:flex` becomes `max-lg:flex`; with `--breakpoint-lg: 992px` above, the two are not equivalent), so arbitrary values that match a theme breakpoint should be written by name. **Benefits:** - Consistent breakpoint values across codebase diff --git a/test/cli.test.mjs b/test/cli.test.mjs index 9a82bf0..27e2a6c 100644 --- a/test/cli.test.mjs +++ b/test/cli.test.mjs @@ -250,6 +250,7 @@ test('check patterns match the removed API and leave current code alone', () => ['tw4-leading-important-modifier', 'clsx("a", cond && "!mt-0 b")', true], ['tw4-leading-important-modifier', 'cn("a", !open && "b")', false], ['tw4-leading-important-modifier', 'cn("flex!")', false], + ['tw4-leading-important-modifier', "cn(getBase(foo(bar)), '!flex')", true], ['tw4-opacity-utilities-removed', 'class="border-opacity-50 ring-opacity-25"', true], ['tw4-opacity-utilities-removed', 'class="divide-opacity-50"', true], ['tw4-opacity-utilities-removed', 'class="placeholder-opacity-50"', true], @@ -333,6 +334,56 @@ test('an ancestor package-lock.json counts only when it lists the project as a w assert.deepEqual([detect(join(root, 'app'))[0].installed, detect(join(root, 'app'))[0].status], ['19.3.1', 'ok']) }) +test('npm 6 lockfiles resolve versions from the root dependencies tree', (context) => { + const root = fixture(context, { + 'package.json': { dependencies: { zod: 'latest' } }, + 'package-lock.json': { lockfileVersion: 1, dependencies: { zod: { version: '4.6.7' } } }, + }) + assert.deepEqual([detect(root)[0].installed, detect(root)[0].status], ['4.6.7', 'ok']) +}) + +test('checks ruled out by a project config flag are not counted as unknown', (context) => { + const files = { 'package.json': { dependencies: { next: 'latest' } } } + const without = scan(fixture(context, files)).unknown + const withFlag = scan(fixture(context, { ...files, 'next.config.ts': 'export default { cacheComponents: true }' })).unknown + assert.equal(withFlag - without, 1, 'only the config-enabled check adds to the unknown count') +}) + +test('comment masking handles regex literals, template expressions and CSS url()', () => { + const masked = (text, file = 'a.ts') => maskComments(text, file) + assert.equal(masked('const r = /[//]/; z.nativeEnum(R)'), 'const r = /[//]/; z.nativeEnum(R)') + assert.equal(masked('const half = a / 2 // z.nativeEnum(R)').trimEnd(), 'const half = a / 2') + assert.equal(masked("x = 'a' / 2 // drop").trimEnd(), "x = 'a' / 2") + assert.equal(masked('`a ${x // z.nativeEnum(R)\n} b` // drop').includes('nativeEnum'), false) + assert.equal(masked('`${ {a: 1}.a } // keep`'), '`${ {a: 1}.a } // keep`') + assert.equal(masked('a { b: url(http://x.dev/a.png) } // drop', 'a.scss').trimEnd(), 'a { b: url(http://x.dev/a.png) }') + // A slash after JSX or template braces is markup, not a regex, so the comment after it still masks. + assert.equal(masked(' {/*\n z.nativeEnum(R)\n*/}\nconst ok = 1', 'a.tsx').includes('nativeEnum'), false) + assert.equal(masked('return // z.nativeEnum(R)', 'a.jsx').includes('nativeEnum'), false) + assert.equal(masked('

{done}/{total} {/* z.nativeEnum(R) */}

', 'a.tsx').includes('nativeEnum'), false) + assert.equal(masked('{{a}}/{{b}} ', 'a.vue').includes('nativeEnum'), false) + assert.equal(masked('', 'a.vue').includes('!flex'), false) + assert.equal(masked('x = /a/* 2 // z.nativeEnum(R)').includes('nativeEnum'), false) + assert.equal(masked('return /[/*]/\nz.nativeEnum(R)\n// */').split('\n')[1], 'z.nativeEnum(R)') + assert.equal(masked('const total = sum.return / 2 // drop').trimEnd(), 'const total = sum.return / 2') + for (const text of ['/', 'x = /', '`${', '`${ /[ ', 'url(', 'a { b: url(http:// }']) { + for (const file of ['a.ts', 'a.scss']) assert.equal(masked(text, file).length, text.length, `${file}: ${text}`) + } +}) + +test('comment masking stays linear on hostile input', () => { + const inputs = [ + ['x /*\n', 'a.ts'], ['