---
name: angular-react-parity
description: Compare legacy Angular behavior with React implementation, extract business logic, and produce parity verification artifacts.
---

## discover
role: explorer
output: parity-context.md

Discover relevant Angular and React code for: {goal}

Treat `ClientApp/` as the Angular reference and `src/` as the React implementation. Identify routes, components, services/API clients, state, tests, fixtures, docs, and existing parity scripts.

Tool policy: do not call `glob` or any unavailable abstract discovery tool. Use bash discovery only: `rg --files`, `rg -n`, `find`, `sed`, `nl`, and `git grep`. If a tool returns `Tool <name> not found`, stop using it immediately; if the same tool error repeats twice, stop the task and report the blocker. Do not repeat failed tool calls or shell commands. If a command exits non-zero with no useful output, do not retry it unchanged; inspect source/tests or change the hypothesis first. If a focused test fails, use the failure location to inspect and fix code/tests; do not repeatedly grep test output for unrelated terms. After two failed verification attempts without a code or test change, stop and report the blocker. Do not continue after five consecutive calls that add no new information. Treat semantically equivalent commands as repeats even when numeric limits or filters change; do not widen `sed`, `head`, `tail`, or `git diff | grep` ranges step by step.

## analyze-parity
role: parity
dependsOn: discover
reads: parity-context.md
output: parity-analysis.md

Analyze the Angular reference and React implementation for the requested feature. Extract business rules, map Angular file:line references to React file:line references, identify parity gaps, and propose verification evidence.

## browser-verification
role: e2e
dependsOn: analyze-parity
parallelGroup: verify
reads: parity-analysis.md
verify: true

Use project commands and Playwright MCP when useful to verify behavior:

- `pnpm compare:visual`
- `pnpm compare:gap`
- `pnpm compare:behavior`
- `pnpm compare:all`
- `pnpm test:e2e`
- `pnpm test:e2e:angular`

Run only the relevant subset when the full suite is too expensive; document anything not run.

## critique
role: critic
dependsOn: analyze-parity, browser-verification
reads: parity-analysis.md
verify: true

Challenge the parity analysis. Look for missing business rules, weak evidence, untested gaps, false equivalence, and intentional differences that need product confirmation.

## write-spec
role: docs
dependsOn: critique
reads: parity-analysis.md
output: parity-docs.md

Write or update these artifacts for the feature slug:

- `docs/parity/<feature-slug>-business-logic-spec.md`
- `docs/parity/<feature-slug>-parity-matrix.md`
- `docs/parity/<feature-slug>-verification-report.md`

Use file:line citations and classify each parity item as `match`, `partial`, `missing`, `intentional-difference`, or `unknown`.

## gitops
role: gitops
dependsOn: write-spec
verify: true

If artifacts changed and verification is sufficient, commit them on a feature branch and push. Do not commit production code changes from this workflow.
