Skip to content

feat: add expected patterns, pnpm migration, docs & CI overhaul#151

Merged
jaysin586 merged 4 commits intomainfrom
feature-initial
Feb 20, 2026
Merged

feat: add expected patterns, pnpm migration, docs & CI overhaul#151
jaysin586 merged 4 commits intomainfrom
feature-initial

Conversation

@jaysin586
Copy link
Contributor

Summary

  • Expected Patterns: New feature allowing named regex capture groups (?<name>pattern) in originalText to mark dynamic regions (dates, names, versions) with distinct "expected" styling instead of insert/remove colors
  • pnpm Migration: Migrated from npm to pnpm with workspace support
  • JSDoc Documentation: Comprehensive JSDoc on all public types, interfaces, props, and the component block for VSCode intellisense
  • CI/CD: Updated all workflows for pnpm, improved security hardening, trunk tooling updates
  • Docs Site: Updated shadcn-svelte components, homepage, and dependencies

Changes

  • ✨ Implement gap-flexible expected pattern matching algorithm with per-line context-anchored regexes
  • ✨ Add expected snippet renderer and rendererClasses.expected CSS class support
  • ✨ Export CaptureRange, DisplayDiff, PatternMatchResult types
  • ✨ Pass captures as 3rd argument to onProcessing callback
  • 📦 Migrate to pnpm with workspace configuration
  • 📚 Add comprehensive JSDoc for all public-facing APIs (VSCode hover docs)
  • 📚 Add expected patterns section to README with MIT license example
  • 🧪 Add unit tests for extractCaptures, tagExpectedRegions, cleanTemplate
  • 🧪 Add Playwright e2e tests for expected patterns across 5 browsers
  • 🔄 Update all CI workflows for pnpm and improve validation
  • 🔧 Add husky pre-commit hooks with trunk fmt/check
  • 🔧 Tune CodeRabbit config for TypeScript/Svelte project
  • 🔧 Ignore eslint on .svelte.ts files (ESLint 10 / svelte-eslint-parser incompatibility)

Commits

  • bf85395 chore(trunk): ignore eslint on .svelte.ts files
  • 39724c2 fix(test): use \w+ instead of .+ in e2e capture pattern
  • c932be5 chore: tune coderabbit config for TypeScript/Svelte project
  • 65116e2 docs: add comprehensive JSDoc for all public types, interfaces, and component
  • cc94ec8 docs: update CLAUDE.md to use pnpm commands
  • 80f5f02 ci: rename trunk-check workflow and add security hardening
  • d5706c7 ci: remove unused www and workers install steps from setup-ci
  • 6dfe16d docs: add expected patterns section to README
  • b57ca4f fix(expected-patterns): replace anchored regex with gap-flexible matching
  • 2f03924 build: migrate to pnpm and update all dependencies

Test plan

  • npx vitest run src/lib/ — 41 unit tests pass
  • npx playwright test tests/expected-patterns.test.ts — 25 e2e tests pass (5 browsers × 5 tests)
  • trunk check passes on all source files

🤖 Generated with Claude Code

jaysin586 and others added 2 commits February 20, 2026 16:38
The greedy .+ pattern captured the entire text2 string, so there
were no insert segments to assert. Constraining to \w+ captures
only "Jason", leaving "coding" vs "hacking" as a real deviation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
svelte-eslint-parser does not implement scopeManager.addGlobals()
required by ESLint 10. Only affects .svelte.ts runes modules;
regular .ts and .svelte files lint fine.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jaysin586 jaysin586 added the minor This is a minor release label Feb 20, 2026
@blacksmith-sh
Copy link

blacksmith-sh bot commented Feb 20, 2026

Found 5 test failures on Blacksmith runners:

Failures

Test View Logs
expected-patterns.test.ts/
Expected Patterns › non-captured deviations still show as insert/remove
View Logs
expected-patterns.test.ts/
Expected Patterns › non-captured deviations still show as insert/remove
View Logs
expected-patterns.test.ts/
Expected Patterns › non-captured deviations still show as insert/remove
View Logs
expected-patterns.test.ts/
Expected Patterns › non-captured deviations still show as insert/remove
View Logs
expected-patterns.test.ts/
Expected Patterns › non-captured deviations still show as insert/remove
View Logs

Fix in Cursor

@coderabbitai
Copy link

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Updates include: (1) .trunk/trunk.yaml adds ESLint to lint.ignore for files matching **/*.svelte.ts. (2) tests/expected-patterns.test.ts tightens a capture from .+ to \w+, adjusts the test input and expected deviation comments. (3) A new GitHub Actions workflow (.github/workflows/run-tests.yml) named "Run tests" is added with two jobs: unit-tests and e2e-tests (Node 24, pnpm, caching, Playwright install, sharded e2e runs, artifact uploads, concurrency and path filters). (4) tests/default.test.ts and (5) tests/snippets.test.ts switch Playwright selectors to use page.getByTestId(...) instead of CSS [data-testid="..."] selectors.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed Title summarizes the main changes: expected patterns feature, pnpm migration, documentation, and CI overhaul. It's specific and reflects the primary objectives.
Description check ✅ Passed Description comprehensively documents the changeset with feature summaries, implementation details, test results, and commit references. It clearly relates to all aspects of the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Runs on pull requests to main when src/tests change. Unit tests
run first, then sharded Playwright e2e tests across 2 shards.
Uses pnpm, caches build/vitest/playwright artifacts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/run-tests.yml:
- Around line 12-22: The workflow's path filters under the paths: list are
missing pnpm-lock.yaml so changes to the pnpm lockfile won't trigger the job;
update the paths: entries to include "pnpm-lock.yaml" alongside package.json and
package-lock.json so lockfile-only changes kick off the workflow (modify the
paths: section in the run-tests.yml workflow to add pnpm-lock.yaml).
- Around line 115-136: The workflow is missing the build step required by the
Playwright webServer in playwright.config.ts; add a step that runs "pnpm build"
(before the "Run e2e tests (sharded)" step) so the dist directory exists for
tests, and ensure the webServer command in playwright.config.ts is consistent
with the package manager by changing its startup command from "npm run build &&
npm run preview" to "pnpm build && pnpm preview" (or equivalent) so builds and
previews use the same package manager.

Comment on lines +12 to +22
paths:
- src/**
- tests/**
- '!docs/**'
- package.json
- package-lock.json
- svelte.config.*
- vite.config.*
- playwright.config.*
- tsconfig*.json
- .github/workflows/run-tests.yml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add pnpm-lock.yaml to the workflow path filters.
Dependency-only changes to the pnpm lockfile won’t trigger this workflow, so tests can be skipped.

🔧 Proposed fix
         paths:
             - src/**
             - tests/**
             - '!docs/**'
             - package.json
+            - pnpm-lock.yaml
             - package-lock.json
             - svelte.config.*
             - vite.config.*
             - playwright.config.*
             - tsconfig*.json
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
paths:
- src/**
- tests/**
- '!docs/**'
- package.json
- package-lock.json
- svelte.config.*
- vite.config.*
- playwright.config.*
- tsconfig*.json
- .github/workflows/run-tests.yml
paths:
- src/**
- tests/**
- '!docs/**'
- package.json
- pnpm-lock.yaml
- package-lock.json
- svelte.config.*
- vite.config.*
- playwright.config.*
- tsconfig*.json
- .github/workflows/run-tests.yml
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/run-tests.yml around lines 12 - 22, The workflow's path
filters under the paths: list are missing pnpm-lock.yaml so changes to the pnpm
lockfile won't trigger the job; update the paths: entries to include
"pnpm-lock.yaml" alongside package.json and package-lock.json so lockfile-only
changes kick off the workflow (modify the paths: section in the run-tests.yml
workflow to add pnpm-lock.yaml).

Comment on lines +115 to +136
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Cache Playwright browsers
uses: actions/cache@v5 # zizmor: ignore[unpinned-uses]
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-

- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps

- name: Sanity check - list discovered tests
run: pnpm exec playwright test --list | head -n 50 | cat

- name: Run e2e tests (sharded)
env:
CI: true
run: pnpm exec playwright test --config=playwright.config.ts --shard=${{ matrix.shard }} --reporter=line

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find . -name "playwright.config.ts" -o -name "playwright.config.js" | head -5

Repository: humanspeak/svelte-diff-match-patch

Length of output: 100


🏁 Script executed:

find . -name "package.json" | head -3

Repository: humanspeak/svelte-diff-match-patch

Length of output: 112


🏁 Script executed:

cat -n playwright.config.ts

Repository: humanspeak/svelte-diff-match-patch

Length of output: 1395


🏁 Script executed:

cat -n package.json

Repository: humanspeak/svelte-diff-match-patch

Length of output: 5017


Build step is required and missing.
The playwright.config.ts webServer runs npm run build && npm run preview on startup. Without a build step in the workflow, the dist directory won't exist and tests will fail. Add pnpm build before the e2e tests.

Additionally, playwright.config.ts uses npm run but the workflow uses pnpm—consider updating the webServer command to pnpm build && pnpm preview for consistency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/run-tests.yml around lines 115 - 136, The workflow is
missing the build step required by the Playwright webServer in
playwright.config.ts; add a step that runs "pnpm build" (before the "Run e2e
tests (sharded)" step) so the dist directory exists for tests, and ensure the
webServer command in playwright.config.ts is consistent with the package manager
by changing its startup command from "npm run build && npm run preview" to "pnpm
build && pnpm preview" (or equivalent) so builds and previews use the same
package manager.

Replace page.fill('[data-testid=...]') with page.getByTestId().fill()
to fix webkit race condition where CSS selector fills didn't update
Svelte reactive state before assertions fired.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jaysin586 jaysin586 merged commit 776e66f into main Feb 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor This is a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant