|
| 1 | +--- |
| 2 | +alwaysApply: true |
| 3 | +description: End-to-end flow for implementing features and bug fixes using AI. Enforces playground demos, strict type-safety, tests, successful builds, and documentation updates. |
| 4 | +--- |
| 5 | + |
| 6 | +## Implementing Features & Fixes (AI Playbook) |
| 7 | + |
| 8 | +Use this checklist for every feature or bug fix. Do not skip steps. Commands assume npm. |
| 9 | + |
| 10 | +### 1. Write or update tests first |
| 11 | +- **Where**: colocate tests in `src/*.spec.ts` (see existing examples like `src/Select.spec.ts`). |
| 12 | +- **Run tests**: `npm run test` |
| 13 | + - Uses JSDOM and coverage settings from [vitest.config.ts](mdc:vitest.config.ts). |
| 14 | +- **Adapt existing tests** when changing behavior; add new tests for new props/events/slots. |
| 15 | + |
| 16 | +### 2. Enforce type-safety (no ts-ignore) |
| 17 | +- **Run type-check**: `npm run type-check` |
| 18 | +- **Rule**: no `@ts-ignore` or `// @ts-expect-error`. Fix types instead. |
| 19 | +- **Types locations**: update when needed |
| 20 | + - Props: [src/types/props.ts](mdc:src/types/props.ts) |
| 21 | + - Options: [src/types/option.ts](mdc:src/types/option.ts) |
| 22 | + - Slots: [src/types/slots.ts](mdc:src/types/slots.ts) |
| 23 | +- Prefer extracting complex logic into helpers (see [src/lib/*](mdc:src/lib)) to keep components scannable. |
| 24 | + |
| 25 | +### 3. Add a Playground demo (for new features) |
| 26 | +- **Create demo component** under `playground/demos/YourFeature.vue`. |
| 27 | +- **Register route** in [playground/main.ts](mdc:playground/main.ts) |
| 28 | + - Import your demo and add a `{ path: "/your-feature", component: YourFeature }` route. |
| 29 | +- **Add navigation link** in [playground/PlaygroundLayout.vue](mdc:playground/PlaygroundLayout.vue) |
| 30 | + - Append to `links`: `{ value: "/your-feature", label: "Your Feature" }`. |
| 31 | +- **Run playground**: `npm run dev:playground` and manually verify the UX. |
| 32 | + |
| 33 | +### 4. Build must pass (no early exits) |
| 34 | +- **Run build**: `npm run build` |
| 35 | + - This runs `type-check` and then `vite build` via `build-only`. |
| 36 | + - Fix all errors; do not bypass checks. Do not introduce build-time warnings that indicate type holes. |
| 37 | +- Output is generated in `dist/` (do not edit `dist/` by hand). |
| 38 | + |
| 39 | +### 5. Documentation (new features or behavior changes) |
| 40 | +- **Add a docs page** under `docs/demo/*.md` when showcasing a new capability (see existing demos in `docs/demo/`). |
| 41 | +- **Update reference docs** if applicable: |
| 42 | + - Getting started: [docs/getting-started.md](mdc:docs/getting-started.md) |
| 43 | + - Props: [docs/props.md](mdc:docs/props.md) |
| 44 | + - Events: [docs/events.md](mdc:docs/events.md) |
| 45 | + - Slots: [docs/slots.md](mdc:docs/slots.md) |
| 46 | + - Options: [docs/options.md](mdc:docs/options.md) |
| 47 | + - Styling: [docs/styling.md](mdc:docs/styling.md) |
| 48 | + - TypeScript: [docs/typescript.md](mdc:docs/typescript.md) |
| 49 | +- **Preview docs**: `npm run docs:dev` and ensure navigation from [docs/index.md](mdc:docs/index.md) remains coherent. |
| 50 | +- **Validate docs build**: `npm run docs:build`. |
| 51 | + |
| 52 | +### 6. Linting |
| 53 | +- **Run**: `npm run lint` |
| 54 | +- **Auto-fix**: `npm run lint:fix` (then re-run `npm run lint`). |
| 55 | + |
| 56 | +### 7. PR readiness checklist |
| 57 | +- Tests added/updated and `npm run test` passes. |
| 58 | +- `npm run type-check` passes with zero `@ts-ignore`. |
| 59 | +- New demo added in `playground/` (if new feature) and manually verified via `npm run dev:playground`. |
| 60 | +- `npm run build` completes without errors (no early exit). |
| 61 | +- Docs added/updated and `npm run docs:build` passes. |
| 62 | +- Code is scannable: complex logic extracted into helpers under `src/lib/` and meaningful names used. |
| 63 | + |
| 64 | +### Useful references |
| 65 | +- Package scripts: [package.json](mdc:package.json) |
| 66 | +- Test config: [vitest.config.ts](mdc:vitest.config.ts) |
| 67 | +- Playground router: [playground/main.ts](mdc:playground/main.ts) |
| 68 | +- Playground layout links: [playground/PlaygroundLayout.vue](mdc:playground/PlaygroundLayout.vue) |
0 commit comments