Defer sort seed checks until adjust-order startup

This commit is contained in:
2026-05-22 22:44:56 +08:00
parent e438386e68
commit 4b2eff1c7e
146 changed files with 20067 additions and 65 deletions

View File

@@ -1,67 +1,21 @@
# AGENTS.md
<!-- TRELLIS:START -->
# Trellis Instructions
This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
These instructions are for AI assistants working in this project.
## Project Overview
This project is managed by Trellis. The working knowledge you need lives under `.trellis/`:
DrillTools (钻带处理工具) is a Windows desktop application for processing PCB drill tape files. It parses drill tape data, displays tool information (tool number, diameter, hole count, parameters), and supports reordering tools with various sorting methods.
- `.trellis/workflow.md` — development phases, when to create tasks, skill routing
- `.trellis/spec/` — package- and layer-scoped coding guidelines (read before writing code in a given layer)
- `.trellis/workspace/` — per-developer journals and session traces
- `.trellis/tasks/` — active and archived tasks (PRDs, research, jsonl context)
## Build & Run
If a Trellis command is available on your platform (e.g. `/trellis:finish-work`, `/trellis:continue`), prefer it over manual steps. Not every platform exposes every command.
```bash
dotnet build # Build the project
dotnet build -c Release # Build in Release mode
dotnet publish # Publish as single-file exe (win-x86)
```
If you're using Codex or another agent-capable tool, additional project-scoped helpers may live in:
- `.agents/skills/` — reusable Trellis skills
- `.codex/agents/` — optional custom subagents
Target: .NET 6.0, WPF, x86 only. No external NuGet dependencies.
Managed by Trellis. Edits outside this block are preserved; edits inside may be overwritten by a future `trellis update`.
No test framework is configured. Do not write unit tests for this project.
## Architecture
**MVVM pattern** with three windows:
- **MainWindow** — primary UI for loading, viewing, and reordering drill tape tools
- **ToolDetailWindow** — displays detailed tool parameters
- **ToolReorderConfirmationWindow** — confirmation dialog for reorder operations
**Key files:**
| File | Role |
|---|---|
| `MainWindowViewModel.cs` (~2400 lines) | Central business logic: tool management, drill tape parsing/generation, sort seed management, reference tape comparison |
| `DrillTapeProcessor.cs` | Core drill tape parsing engine (`DrillTools.Integration` namespace) |
| `ToolItem.cs` | Data model for drill tools (implements `INotifyPropertyChanged`) |
| `SlotHoleCalculator.cs` | Geometry calculations for slot hole counts and positions |
| `DragDropHelper.cs` | WPF ListView drag-drop with visual insertion indicator |
**Namespaces:** `DrillTools` (UI/models), `DrillTools.Integration` (parsing logic).
## Drill Tape Format
The app parses a specific PCB drill tape format:
```
M48 ← Header start
T01C0.799H05000Z+0.000S060.00 ← Tool definitions (Txx=tool#, C=diameter, rest=machine params)
T02C0.656H01500Z+0.150S070.00
% ← Header end / data start
T01 ← Active tool
X-167525Y013500 ← Hole coordinates
X-069659Y016450G85X-094159Y016450 ← Slot hole (start G85 end)
M30 ← End of file
```
Supported file extensions: `.txt`, `.drl`, `.dr2`, `.dpin`
**Tool types by diameter suffix digit:** 0/8/9=Drill, 1=Slot, 2/6=EA Slot, 3=Dust Slot, 4=Deburr, 5=NonStandard, 7=Special.
## Important Technical Details
- **File encoding**: ANSI/GB2312 (code page 936) — drill tape files use this encoding, not UTF-8
- **Encrypted file reading**: Uses `cmd.exe /c type` to read drill tape files (some files are "encrypted" and cannot be read directly via standard file I/O)
- **Slot hole calculation**: Uses CAM350 standard tolerance (0.0127mm) for computing hole counts along slot paths
- **Backup strategy**: Creates `.bak` files when saving modified drill tape data
- **Command-line support**: App accepts a file path argument to auto-load a drill tape file on startup
- **Documentation**: All docs under `Docs/` are in Chinese (Simplified). The UI is also in Chinese.
<!-- TRELLIS:END -->