# Contributing

<!-- AUTO-GENERATED -->
<!-- SOURCES: package.json, tsconfig.json, tests/*.test.ts -->

## Development Setup

### Prerequisites

- Node.js `>=20.6.0`
- npm

The Pi coding agent package is a peer dependency and is installed as a development dependency for local type checking and tests.

### Install

```bash
git clone <repository-url>
cd rinco-pi-rule
npm install
```

This checkout does not currently contain repository URL metadata. Replace `<repository-url>` with the canonical URL after the project is hosted.

## Available Commands

| Command | Description |
|---|---|
| `npm test` | Run all tests with Vitest. |
| `npm run test:watch` | Start Vitest in watch mode for development. |
| `npm run test:coverage` | Run all tests with V8 coverage (80% minimum threshold). |
| `npm run typecheck` | Type-check the project without emitting JavaScript. |
| `npm run check` | Run type checking, tests, and the package dry run. |
| `npm run pack:dry-run` | Preview the npm package contents without publishing. |

Use the full verification command before submitting a change:

```bash
npm run check
```

## Testing

Tests live in `tests/` and use [Vitest](https://vitest.dev) with `expect` for assertions.

- Name test files `*.test.ts` so the configured test command includes them.
- Add focused tests for project detection, managed `AGENTS.md` merging, rule transformations, or extension behavior as appropriate.
- Use temporary directories for filesystem behavior and remove them in `afterEach`.
- Keep tests deterministic and offline; use the vendored ECC snapshot rather than fetching remote rules.
- Maintain a reviewed Pi derivative under `rules/pi/` for every ECC Markdown rule, using the same relative path; do not edit the upstream snapshot for Pi-specific changes.
- Run `npm test` while developing and `npm run test:coverage` before submission.
- Maintain at least 80% line, function, and branch coverage.

## Type and Code-Style Checks

TypeScript runs in strict mode with `noUncheckedIndexedAccess` and `exactOptionalPropertyTypes` enabled. Run:

```bash
npm run typecheck
```

No linter, formatter, staged-file checker, or pre-commit hook is currently configured. Do not claim a style check passed unless the repository adds an authoritative tool and script for it.

## Pull Request Checklist

- [ ] The change is focused and documented.
- [ ] New or changed behavior has tests.
- [ ] `npm run check` passes.
- [ ] Generated documentation still matches its named source files.
- [ ] User-authored content outside managed `AGENTS.md` markers remains preserved.
- [ ] Vendored ECC content is unchanged unless intentionally refreshing the pinned snapshot.
- [ ] Every ECC Markdown rule has a matching reviewed `rules/pi/` derivative, and effective generated guidance is tested for native Pi compatibility.
- [ ] Any ECC snapshot refresh updates the commit, checksums, README, and third-party notice together.
- [ ] No secrets, generated `.test-dist` output, or package tarballs are committed.

<!-- END AUTO-GENERATED -->
