This guide covers setting up your development environment, building the library, running tests, and contributing code to the AdGuard Scriptlets and Redirect Resources library.
| Tool | Version | Notes |
|---|---|---|
| Node.js | 22 | Use nvm to manage versions |
| pnpm | 10.7 | Package manager |
| Git | Latest | Version control |
Note: Development is tested on macOS and Linux. Windows users should use WSL or a virtual machine.
git clone https://github.com/AdguardTeam/Scriptlets.git
cd Scriptletspnpm installpnpm buildBuild output goes to dist/.
# All tests (Vitest + smoke + QUnit)
pnpm test
# Vitest only (API, validators, converters)
pnpm test:vitest
# QUnit only (scriptlets)
pnpm test:qunit scriptlets
# QUnit only (redirects)
pnpm test:qunit redirects
# Single scriptlet with rebuild
pnpm test:qunit scriptlets --name <scriptlet-name> --build# All linters
pnpm lint
# Individual linters
pnpm lint:code # ESLint
pnpm lint:types # TypeScript type checking
pnpm lint:md # markdownlint| Command | Description |
|---|---|
pnpm install |
Install dependencies |
pnpm build |
Clean dist/ and build all bundles |
pnpm test |
Run all tests (Vitest + smoke + QUnit) |
pnpm test:vitest |
Run Vitest tests only (API, validators, converters) |
pnpm test:qunit scriptlets |
Run QUnit tests for all scriptlets |
pnpm test:qunit redirects |
Run QUnit tests for all redirects |
pnpm test:qunit helpers |
Run QUnit tests for helpers |
pnpm test:qunit scriptlets --name <name> --build |
Run a single scriptlet test with rebuild |
pnpm lint |
Run all linters |
pnpm lint:code |
Run ESLint |
pnpm lint:types |
Run TypeScript type checking (tsc --noEmit) |
pnpm lint:md |
Run markdownlint |
pnpm wiki:build-table |
Regenerate compatibility table |
pnpm wiki:build-docs |
Regenerate scriptlet/redirect wiki docs from JSDoc |
pnpm increment |
Bump patch version in package.json |
- Create a feature branch from
master - Make your changes
- Ensure all checks pass (see Before Committing below)
- Submit a pull request to
master
Run these checks before every commit:
# Lint all (ESLint + TypeScript + markdownlint)
pnpm lint
# Run the relevant test suite
pnpm test:qunit scriptlets --name <name> --build # for scriptlet changes
pnpm test:vitest # for API/converter/validator changesBoth must pass with no errors.
All non-trivial changes must be guided by a spec authored before implementation begins. SDD slash commands should be available globally (preferred).
| Change type | Flow |
|---|---|
| New scriptlet or redirect resource | Full SDD |
| API surface change | Full SDD |
| Multi-component refactor | Full SDD |
| Bug fix | Quick flow |
| Small config or single-file change | Quick flow |
All specs are stored in specs/.current/ (local-only, contents are gitignored)
and are never committed.
specs/
├── .current/ # local only, gitignored contents
├── ADG-1234-new-scriptlet/
│ ├── spec.md
│ └── plan.md
└── ADG-5678-bugfix/
└── quick.md
- Run
/sdd-spec <scriptlet description>then/sdd-planto create the spec and plan. - Create
src/scriptlets/<name>.tswith a JSDoc@scriptletheader. - Add a QUnit test file at
tests/scriptlets/<name>.test.js. - Update
scripts/compatibility-table.jsonwith the new entry. - Run
pnpm test:qunit scriptlets --name <name> --buildto verify. - Run
pnpm wiki:build-docsto regenerate the wiki documentation.
- Run
/sdd-spec <redirect description>then/sdd-plan. - Create the source file in
src/redirects/and a YAML manifest alongside it. - Add a QUnit test file at
tests/redirects/<name>.test.js. - Update
scripts/compatibility-table.jsonwith the new entry. - Run
pnpm test:qunit redirects --buildto verify. - Run
pnpm wiki:build-docsto regenerate the wiki documentation.
# Regenerate compatibility table
pnpm wiki:build-table
# Regenerate scriptlet/redirect docs from JSDoc
pnpm wiki:build-docsNote: Files in
wiki/are auto-generated. Do not edit them manually.
pnpm incrementThis bumps the patch version in package.json without creating a git tag.
Update CHANGELOG.md accordingly before publishing.
- AGENTS.md — AI agent instructions and code guidelines
- README.md — Project overview and usage documentation
- CHANGELOG.md — Version history
- AdGuard JavaScript Code Guidelines