|
| 1 | +--- |
| 2 | +description: "Core development workflow and TDD patterns - always applied" |
| 3 | +globs: ["**/*.ts", "**/*.js", "**/*.json"] |
| 4 | +alwaysApply: true |
| 5 | +--- |
| 6 | + |
| 7 | +# Development Workflow |
| 8 | + |
| 9 | +## Quick Reference |
| 10 | + |
| 11 | +For detailed patterns, see project skills: |
| 12 | + |
| 13 | +- `@skills/testing` — Testing and TDD |
| 14 | +- `@skills/contentstack-cli` — Export command, utilities, and API usage |
| 15 | +- `@skills/framework` — Config, logging, and shared patterns |
| 16 | +- `@skills/code-review` — PR review checklist |
| 17 | + |
| 18 | +## TDD workflow (recommended) |
| 19 | + |
| 20 | +For **new behavior or bug fixes**, prefer working in three steps: |
| 21 | + |
| 22 | +1. **RED** → Write a failing test (or extend an existing one) |
| 23 | +2. **GREEN** → Minimal code to pass |
| 24 | +3. **REFACTOR** → Clean up while tests stay green |
| 25 | + |
| 26 | +**Exceptions (no new test required when behavior is unchanged):** pure refactors, documentation-only edits, comments/config-only tweaks, trivial typos. |
| 27 | + |
| 28 | +## Guidelines |
| 29 | + |
| 30 | +- **Coverage:** aim high; **~80%** (lines/branches/functions) is an **aspirational target**, not a CI gate in this repo |
| 31 | +- **TypeScript** — explicit return types where practical; avoid `any` |
| 32 | +- **NO test.skip or .only** in commits |
| 33 | + |
| 34 | +## File structure (this repo) |
| 35 | + |
| 36 | +- **Command**: `src/commands/cm/stacks/export-query.ts` |
| 37 | +- **Core**: `src/core/` — `QueryExporter`, `ModuleExporter` |
| 38 | +- **Utils**: `src/utils/` — query parsing, config, dependencies, assets, branches, file helpers |
| 39 | +- **Types**: `src/types/index.ts` |
| 40 | +- **Config**: `src/config/` (copied to `lib/` on build) |
| 41 | +- **Messages**: `messages/index.json` |
| 42 | +- **Tests**: `test/unit/*.test.ts` (grouped by module under test) |
| 43 | + |
| 44 | +## Naming conventions |
| 45 | + |
| 46 | +- Files: `kebab-case.ts` / `kebab-case.test.ts` |
| 47 | +- Classes: `PascalCase` |
| 48 | +- Functions: `camelCase` |
| 49 | +- Tests: `should [behavior] when [condition]` |
| 50 | + |
| 51 | +## Before coding |
| 52 | + |
| 53 | +1. Read relevant `@skills/*` references |
| 54 | +2. For behavior changes: prefer a failing test first, then implement |
| 55 | +3. Refactor and run tests |
| 56 | + |
| 57 | +## Validation commands |
| 58 | + |
| 59 | +- `npm run lint` — ESLint on `src/**/*.ts` |
| 60 | +- `npm run test` — All tests with nyc |
| 61 | +- `npm run test:report` — LCOV coverage report |
| 62 | +- `npm run test:unit` — Unit tests only |
| 63 | +- `npm run format` — ESLint `--fix` |
| 64 | + |
| 65 | +## Commit suggestions |
| 66 | + |
| 67 | +- Conventional commits are helpful but optional: `feat(scope): description` |
| 68 | +- Tests passing before merge |
| 69 | +- No lint errors |
| 70 | +- No stray `console.log` / `debugger` |
0 commit comments