# Development Workflow

## 1. Clarify Scope

Define whether the task affects scanner capture, OCR parsing, recommendations, UI, documentation, or packaging. Scanner and automation work require extra safety review.

## 2. Inspect Existing Code

Use `rg` and read the relevant files before editing. For this project, likely starting points are:

- `electron/main.ts`
- `electron/preload.cjs`
- `src/App.tsx`
- `src/lib/artifactOcrParser.ts`
- `src/lib/scoring.ts`
- `src/styles/global.css`

## 3. Implement Small Changes

Keep edits focused. Avoid mixing UI redesign, scanner logic, parser logic, and documentation unless the request explicitly spans them.

## 4. Validate

Default validation:

```powershell
npm run lint
npm test
npm run build
```

For scanner changes, restart Electron after build or after changing `electron/main.ts`, because the main process does not hot reload reliably.

## 5. Manual Smoke Test

For Smart Capture:

1. Open Genshin in borderless/windowed mode.
2. Open the artifact inventory detail view.
3. Click `Sources` and confirm Genshin is selected or available.
4. Click `Smart Capture`.
5. Confirm the preview shows the artifact detail panel.
6. Open `Details` and inspect crops/OCR.

## 6. Review Outcome

Document important scanner heuristics, accepted limitations, and future fixes in `docs/DECISIONS.md` or this workflow when they become durable.
