Skip to content

Commit afb4525

Browse files
committed
fix(ai): address PR #217 review comments — commands, rules, gitignore, templates
- Add .agents/commands/sdd-full-bootstrap.md and sdd-lite-bootstrap.md with repo-specific workflow notes, verified commands, approval gates and quality checklists (resolves Lurian's comment on .agents/commands/) - Add .agents/rules/00-baseline.md (applyTo: **/*) and 10-react.md (applyTo: react/**/*) with valid YAML frontmatter so rules are auto-injected into every agent conversation without manual AGENTS.md reads (resolves Lurian's comment on .agents/rules/) - Tighten .gitignore: replace blanket /specs with granular patterns (specs/**/plan.md, tasks.md, analysis.md) so spec.md is committed; add .specify/cache/ and .specify/.tmp/ (resolves lucvysk's comment) - Remove .specify/templates/ — pulled from spec-kit tool, not the repo (resolves huandrey's comment)
1 parent 8337b6d commit afb4525

12 files changed

Lines changed: 224 additions & 212 deletions

.agents/commands/.gitkeep

Whitespace-only changes.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SDD Full Bootstrap — pickup-points-modal
2+
3+
Use this command when starting a **new feature** on this repo that requires the Full SDD flow.
4+
5+
## When to use Full SDD
6+
7+
- Any new user-facing feature or behavioral change in `react/`.
8+
- Changes to the public component API (`PickupPointsModal.js` props, events, `orderForm` shape).
9+
- Changes that touch `manifest.json`, `package.json`, or CI pipelines.
10+
- All work on `main`-targeted branches (not hotfix branches).
11+
12+
**Lite-only is allowed** for hotfixes on `fix/*` or `chk-*` branches. See `sdd-lite-bootstrap.md`.
13+
14+
## Pipeline
15+
16+
```
17+
/speckit-specify → generates specs/<feature>/spec.md
18+
/speckit-plan → generates specs/<feature>/plan.md
19+
/speckit-tasks → generates specs/<feature>/tasks.md
20+
/speckit-implement → executes tasks in code
21+
/speckit-analyze → audits consistency between spec/plan/tasks/code
22+
```
23+
24+
Or use the higher-level skill aliases:
25+
26+
```
27+
/specification → Business Context + Arch Decisions + Technical Contract (spec.md)
28+
/implementing → Implement from an approved spec up to the PR
29+
```
30+
31+
## Before starting
32+
33+
1. Read `AGENTS.md` — verified commands, autonomy limits, sources of truth.
34+
2. Read `.specify/memory/constitution.md` — binding principles.
35+
3. Confirm the Jira/GitHub issue exists and acceptance criteria are clear.
36+
4. Run `yarn install` from repo root.
37+
38+
## Verified commands
39+
40+
```bash
41+
yarn lint # ESLint over js,jsx,ts,tsx
42+
yarn lint:ts # tsc --noEmit
43+
yarn lint:locales # intl-equalizer (i18n key parity)
44+
yarn test # Jest on react/
45+
yarn test:coverage # Jest with coverage report
46+
yarn build # Production build (lib/ + locales)
47+
```
48+
49+
## Files that require human approval before touching
50+
51+
- `manifest.json` — version, dependencies, builders.
52+
- `package.json` — dependencies, scripts, engines.
53+
- `react/PickupPointsModal.js` — root component (public API).
54+
- `react/ModalState.js` — root state manager.
55+
- `.travis.yml`, `.github/**`, `.vtex/deployment.yaml` — CI/CD.
56+
- `CHANGELOG.md` bumps and `vtex publish` / `npm publish`.
57+
58+
## Quality gates before opening PR
59+
60+
- [ ] `yarn lint` passes (0 errors).
61+
- [ ] `yarn lint:ts` passes (0 type errors).
62+
- [ ] `yarn lint:locales` passes (all locale files in sync).
63+
- [ ] `yarn test` passes (all existing tests green).
64+
- [ ] New behavior covered by at least one Jest test.
65+
- [ ] `spec.md` approved before implementation starts.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SDD Lite Bootstrap — pickup-points-modal
2+
3+
Use this command for **hotfixes** on `fix/*` or `chk-*` branches where Full SDD would be excessive overhead.
4+
5+
## When Lite is allowed
6+
7+
- Bug fixes with a clear, contained scope (no public API change).
8+
- Branch name starts with `fix/` or `chk-`.
9+
- Change touches fewer than 3 files in `react/components/` or `react/utils/`.
10+
- No changes to `manifest.json`, root components, or CI.
11+
12+
For everything else, use the Full SDD flow (`sdd-full-bootstrap.md`).
13+
14+
## Pipeline
15+
16+
```
17+
/specification → creates a lightweight spec.md (Business Context + Technical Contract)
18+
/implementing → implements from the approved spec up to the PR
19+
```
20+
21+
## Before starting
22+
23+
1. Read `AGENTS.md` — verified commands, autonomy limits, sources of truth.
24+
2. Confirm the bug is reproducible and the fix scope is clear.
25+
3. Run `yarn install` from repo root.
26+
27+
## Verified commands
28+
29+
```bash
30+
yarn lint # ESLint over js,jsx,ts,tsx
31+
yarn lint:ts # tsc --noEmit
32+
yarn lint:locales # intl-equalizer (i18n key parity)
33+
yarn test # Jest on react/
34+
yarn test:coverage # Jest with coverage report
35+
```
36+
37+
## Files that require human approval even on hotfix branches
38+
39+
- `manifest.json` — version bump.
40+
- `react/PickupPointsModal.js` — public API surface.
41+
- `react/ModalState.js` — root state manager.
42+
- `.travis.yml`, `.github/**` — CI/CD.
43+
44+
## Quality gates before opening PR
45+
46+
- [ ] `yarn lint` passes (0 errors).
47+
- [ ] `yarn lint:ts` passes (0 type errors).
48+
- [ ] `yarn test` passes (all tests green).
49+
- [ ] Reproducing test added (failing before fix, green after).

.agents/rules/.gitkeep

Whitespace-only changes.

.agents/rules/00-baseline.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: pickup-points-modal-baseline
3+
description: Baseline rules every agent must follow when editing this repo.
4+
applyTo: "**/*"
5+
---
6+
7+
# Baseline Rules — pickup-points-modal
8+
9+
## Stack
10+
11+
- **App:** `vtex.pickup-points-modal` — VTEX IO React component for checkout.
12+
- **Source:** `react/` (no `node/` builder). Legacy JS + TypeScript coexist.
13+
- **Test runner:** Jest via `vtex-test-tools` (`yarn test` from repo root).
14+
- **Linter:** ESLint with `eslint-config-vtex` (root) and `eslint-config-vtex-react` (`react/`).
15+
- **Formatter:** Prettier with `@vtex/prettier-config`.
16+
- **Type checker:** `tsc --noEmit -p react/tsconfig.json`.
17+
18+
## Verified commands (always run from repo root)
19+
20+
```bash
21+
yarn install # install all dependencies first
22+
yarn lint # ESLint — must pass before any PR
23+
yarn lint:ts # TypeScript check — must pass before any PR
24+
yarn lint:locales # i18n key parity check — must pass before any PR
25+
yarn test # Jest test suite — must pass before any PR
26+
yarn test:coverage # Jest with coverage
27+
yarn format # Prettier auto-fix
28+
yarn build # production build
29+
```
30+
31+
## Autonomy limits
32+
33+
**May modify freely:**
34+
- `react/components/`, `react/containers/`, `react/utils/`, `react/fetchers/`, `react/types/`
35+
- Tests: `react/**/__tests__/`, `react/**/*.test.{js,ts,tsx}`
36+
- Messages: `messages/` — add keys to ALL locale files in the same PR
37+
38+
**Must ask for human approval:**
39+
- `manifest.json` (version, dependencies, builders)
40+
- `package.json` (dependencies, scripts, engines)
41+
- `.travis.yml`, `.github/**`, `.vtex/deployment.yaml` (CI/CD)
42+
- `react/PickupPointsModal.js` or `react/ModalState.js` (root/public API)
43+
- Any publish action: `vtex publish`, `npm publish`, `CHANGELOG.md` bump
44+
45+
**Must never:**
46+
- Run `git push --force` on `main` or skip hooks with `--no-verify`
47+
- Commit secrets, `.env*` files, or Google Maps keys
48+
- Remove tests to unblock a build
49+
- Mock `orderForm` in integration tests — use `react/__mocks__/` fixtures
50+
51+
## SDD flow
52+
53+
- **Default:** Full SDD for all features (see `.agents/commands/sdd-full-bootstrap.md`)
54+
- **Lite-only:** hotfixes on `fix/*` or `chk-*` branches (see `.agents/commands/sdd-lite-bootstrap.md`)
55+
56+
## Sources of truth (priority order)
57+
58+
1. `.specify/memory/constitution.md` — binding principles
59+
2. `README.md` — public API and props
60+
3. `CONTRIBUTING.md` — PR flow and changelog rules
61+
4. `manifest.json` — published version and VTEX IO dependencies

.agents/rules/10-react.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: pickup-points-modal-react
3+
description: Rules scoped to the React source in react/ — component conventions, testing, i18n, and public API gate.
4+
applyTo: "react/**/*"
5+
---
6+
7+
# React Source Rules — pickup-points-modal
8+
9+
## Component conventions
10+
11+
- **Class components** are legacy — prefer functional components with hooks for new code.
12+
- **PropTypes** are required on all new components alongside TypeScript types (dual-declaration pattern already used in the codebase).
13+
- Container components live in `react/containers/`; pure UI in `react/components/`.
14+
- Side effects and I/O belong in `react/fetchers/` or `react/containers/`, never inside utility functions in `react/utils/`.
15+
- Utility functions must be pure (no I/O, no singletons). Name I/O functions explicitly: `fetchX`, `saveY`, or suffix with `Event` for telemetry (see `react/utils/metrics.js`).
16+
17+
## Testing expectations
18+
19+
- Test files live in `react/**/__tests__/` or next to source as `*.test.{js,ts,tsx}`.
20+
- Every behavioral change must be accompanied by at least one Jest test covering the new behavior.
21+
- Use `react/__mocks__/` fixtures for `orderForm` and VTEX IO module mocks — do not create new inline mocks for these.
22+
- Snapshot tests (`.snap`) are in `react/components/__tests__/__snapshots__/` — update them intentionally, never blindly.
23+
24+
## Internationalization (non-negotiable)
25+
26+
- Every user-facing string must use `react-intl` (`<FormattedMessage>` or `intl.formatMessage`).
27+
- New i18n keys must be added to **all** locale files in `messages/` in the same PR.
28+
- `messages/context.json` is the English master — new keys go here first.
29+
- Run `yarn lint:locales` before opening any PR that touches `messages/`.
30+
31+
## Public API gate
32+
33+
`react/PickupPointsModal.js` is the public contract consumed by production VTEX stores.
34+
35+
- Any prop addition, removal, or shape change is **breaking** and requires a major version bump in `manifest.json`.
36+
- Changes to this file require human approval and an explicit `CHANGELOG.md` entry.
37+
- The Google Maps gated load in `react/containers/withGoogleMaps.js` must not be bypassed.
38+
39+
## Performance rules
40+
41+
- No unconditional network requests on initial render without cache or debounce.
42+
- No heavy library imports in the main bundle without justification in the PR description.
43+
- PRs that increase bundle size must explain the cost and loading strategy.

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ yarn-error.log*
3131
package-lock.json
3232
src/
3333

34-
# SpecKit feature directories (local development)
35-
/specs
34+
# SpecKit — commit spec.md; ignore ephemeral plan/tasks/analysis and local cache
35+
specs/**/plan.md
36+
specs/**/tasks.md
37+
specs/**/analysis.md
38+
.specify/cache/
39+
.specify/.tmp/
3640
.specify/feature.json

.specify/templates/checklist-template.md

Lines changed: 0 additions & 38 deletions
This file was deleted.

.specify/templates/constitution-template.md

Lines changed: 0 additions & 30 deletions
This file was deleted.

.specify/templates/plan-template.md

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)