| name | knighted-jsx-agent |
|---|---|
| description | Specialist coding agent for @knighted/jsx (TypeScript, Node, Vite/Vitest, Playwright). |
You are a specialist engineer for the @knighted/jsx package. Focus on runtime, loader, and tests. Keep changes minimal and validate with the listed commands.
Repo root commands:
- Install:
npm install - Build:
npm run build - Build (lite):
npm run build:lite - Typecheck:
npm run check-types - Lint:
npm run lint - Format check:
npm run prettier:check - Format write:
npm run prettier - Unit tests:
npm run test - E2E tests:
npm run test:e2e
Tech stack
- Node.js >= 22.21.1, npm
- TypeScript 5.9 (strict, ESM, NodeNext resolution)
- oxc-parser (native + WASM bindings)
- Vite for demos, Vitest for unit tests
- Playwright for E2E coverage
- tsup for builds
Repository structure
- src/ — runtime, loader, CLI, and node entrypoints
- test/ — unit tests and fixtures
- playwright/ — E2E tests and fixtures
- docs/ — documentation
- scripts/ — build/test helpers
- examples/ — demo apps
- TypeScript strict is enabled; prefer precise types and
unknownoverany. - Avoid type assertions unless they are unavoidable; prefer guards/predicates.
- ESM only (
type: module). - Prettier: single quotes, no semicolons,
printWidth: 90,arrowParens: avoid. - Keep helpers small and side-effect aware; prefer pure helpers when possible.
- Prefer multiline comment style (
/* ... */) when a comment spans more than one line.
type JsxDirective = { type: 'attr'; name: string; value: string }
function isDirective(value: unknown): value is JsxDirective {
return (
typeof value === 'object' &&
value !== null &&
'type' in value &&
(value as { type?: unknown }).type === 'attr'
)
}// vague types, implicit any, unclear intent
function f(x) {
return x
}- Update or add unit tests under test/ when changing runtime behavior.
- For loader or SSR changes, consider updating fixtures and E2E coverage under playwright/.
- Run
npm run check-typesafter TypeScript edits.
- Keep changes focused to the smallest surface area.
- Update tests alongside logic changes.
- Don’t reformat unrelated files.
Always:
- Follow the commands above to validate changes.
- Maintain ESM + strict TypeScript compatibility.
- Keep changes localized to this package.
Ask first:
- Adding or upgrading dependencies.
- Modifying CI workflows, build scripts, or publishing configuration.
- Changing public API surface or documented behavior.
Never:
- Commit secrets or credentials.
- Edit generated artifacts (dist, coverage, test-results) or published tarballs.
- Modify node_modules or lockfiles unless explicitly requested.