You've already forked OrthoRoute
mirror of
https://github.com/bbenchoff/OrthoRoute.git
synced 2026-08-23 06:27:01 +00:00
2.7 KiB
2.7 KiB
name, description, argument-hint, agent, tools
| name | description | argument-hint | agent | tools | ||||
|---|---|---|---|---|---|---|---|---|
| pathfinder-extract | Safely extract one cohesive chunk from unified_pathfinder.py using the test-first refactor workflow | Name the chunk to extract (e.g. 'CostMatrixBuilder', 'KeepoutObstacleApplier') or describe the behavior | agent |
|
Perform a single, safe extraction from orthoroute/algorithms/manhattan/unified_pathfinder.py following the rules in .github/instructions/refactor-pathfinder.instructions.md.
Inputs
- chunk: The chunk name or behavior description to extract (from the argument, or ask if not provided)
Workflow — do NOT skip or reorder steps
-
Identify the chunk
- Locate the specific lines in
unified_pathfinder.pythat form the cohesive unit. - Confirm it is ≤200 lines with a single clear responsibility.
- If it exceeds 200 lines, report back and stop — do not proceed.
- Locate the specific lines in
-
Write the test first
- Create
tests/algorithms/manhattan/pathfinder/test_<chunk_snake_case>.py(create__init__.pyfiles as needed). - Test the current behavior against the original code in
unified_pathfinder.py. - Use
pytest.fixturefor shared setup;@pytest.mark.parametrizefor input tables. - Mock only I/O boundaries (KiCad IPC, file system, GPU VRAM allocation).
- Create
-
Run the test — must pass green before extraction
pytest tests/algorithms/manhattan/pathfinder/test_<chunk>.py -vStop and report if any test fails before extraction.
-
Extract the chunk
- Create
orthoroute/algorithms/manhattan/pathfinder/<ChunkName>.py. - Move the identified lines there as a standalone class or function.
- Update
orthoroute/algorithms/manhattan/pathfinder/__init__.pyexports. - In
unified_pathfinder.pyreplace the original code with a call to the new class — do not change any logic.
- Create
-
Run the test again — must still pass
pytest tests/algorithms/manhattan/pathfinder/test_<chunk>.py -v -
Stop here. Do not extract a second chunk in the same session. Report:
- Lines extracted
- New file path
- Test file path
- Before/after line count of
unified_pathfinder.py
Pre-identified chunks (from refactor-pathfinder.instructions.md)
| Chunk name | Approx. lines | Suggested class |
|---|---|---|
| Cost matrix initialization | ~150 | CostMatrixBuilder |
| Keepout obstacle marking | ~120 | KeepoutObstacleApplier |
| Pad-to-lattice mapping | ~180 | PadLatticeMapper |
| Batch net scheduling | ~200 | NetBatchScheduler |