## 1. Database Migration

- [x] 1.1 Create Alembic migration to add `interface_type` string column and `requires_port` boolean column to `tool_types` table
- [x] 1.2 Write migration logic to populate `interface_type` from `interfaces[0]` and set `requires_port` based on value
- [x] 1.3 Drop `interfaces` JSON column and make `interface_type` non-nullable

## 2. Backend Model & API Updates

- [x] 2.1 Update SQLAlchemy model (`apps/api/src/models/tool_type.py`) — replace `interfaces` list with `interface_type` string and add `requires_port` boolean
- [x] 2.2 Update Pydantic schemas (`apps/api/src/api/tool_types.py`) — `ToolTypeCreate`, `ToolTypeUpdate`, `ToolTypeResponse`
- [x] 2.3 Add validation for `interface_type` (must be "web" or "terminal")
- [x] 2.4 Update default values and built-in tool type seeding logic
- [x] 2.5 Update API tests for new schema

## 3. Frontend Type & API Updates

- [x] 3.1 Update TypeScript interfaces (`apps/web/src/api/tool_types.ts`) — replace `interfaces: string[]` with `interface_type: string` and add `requires_port: boolean`
- [x] 3.2 Update API request/response types (`CreateToolTypeRequest`, `UpdateToolTypeRequest`)

## 4. Tool Workshop UI Updates

- [x] 4.1 Replace interface checkboxes with dropdown (single-select) in tool editor
- [x] 4.2 Add conditional rendering for port field based on `requires_port` / `interface_type`
- [x] 4.3 Update tool list to show `interface_type` instead of interfaces array
- [x] 4.4 Update form state management for new fields
- [x] 4.5 Update dirty state tracking

## 5. Test Updates

- [x] 5.1 Update backend API tests (`test_tool_types_api.py`) for new schema
- [x] 5.2 Update frontend tests (`tool-workshop.test.tsx`) for dropdown and conditional fields
- [x] 5.3 Update mock data fixtures

## 6. Verification & Cleanup

- [x] 6.1 Run backend tests: `pytest apps/api/tests/`
- [x] 6.2 Run frontend typecheck: `npm run typecheck`
- [x] 6.3 Run frontend tests: `npm run test`
- [x] 6.4 Run lint: `npm run lint`
- [x] 6.5 Verify migration applies cleanly to existing database
- [x] 6.6 Update documentation if needed