Files
headquarter/openspec/changes/repo-restructure/apply-1.1-report.md
T
Developer ee1fa6bee5 refactor: centralize types and extract seed data (Task 1.1)
- Create types/ directory with centralized domain types:
  session, tool-instance, tool-type, git-repository, config-folder,
  tool-config, project, user, api-response
- Remove inline type definitions from API modules;
  re-export from types/ for backward compatibility
- Update state/sessions.tsx to import Session from types/session.ts
- Update all consumer components/pages to import from types/
- Extract seed_builtin_tool_types from main.py to
  seeds/builtin_tool_types.py
- Create types/index.ts barrel export

Quality gates: tsc (pass), eslint (pass), Python syntax (pass)
2026-06-02 18:56:54 +00:00

54 lines
3.7 KiB
Markdown

# Task 1.1 Apply Report: Centralize Types and Extract Seed Data
**Status:** Success
**Files Created (13):**
- `apps/web/src/types/session.ts` — Canonical Session interface
- `apps/web/src/types/tool-instance.ts` — Canonical ToolInstance interface
- `apps/web/src/types/tool-type.ts` — ToolType + ReadinessProbe + request types
- `apps/web/src/types/git-repository.ts` — GitRepository + related types (GitStatus, CommitDetail, etc.)
- `apps/web/src/types/config-folder.ts` — ConfigFolder + request types
- `apps/web/src/types/tool-config.ts` — ToolConfig + request types
- `apps/web/src/types/project.ts` — Project type
- `apps/web/src/types/user.ts` — SessionUser + SessionPayload
- `apps/web/src/types/api-response.ts` — Generic ApiResponse<T> + PaginatedResponse<T>
- `apps/web/src/types/index.ts` — Barrel export for all domain types
- `apps/api/src/seeds/__init__.py` — Package marker
- `apps/api/src/seeds/builtin_tool_types.py` — Extracted seed data + seed function
**Files Modified (17):**
- `apps/web/src/api/sessions.ts` — Removed inline Session/ToolInstance, import + re-export from types/
- `apps/web/src/api/tool_types.ts` — Removed inline ToolType/ReadinessProbe/requests, import + re-export from types/
- `apps/web/src/api/git_repositories.ts` — Removed inline GitRepository + related types, import + re-export from types/
- `apps/web/src/api/config_folders.ts` — Removed inline ConfigFolder + requests, import + re-export from types/
- `apps/web/src/api/tool_configs.ts` — Removed inline ToolConfig + requests, import + re-export from types/
- `apps/web/src/state/sessions.tsx` — Removed inline Session, imports from types/session.ts
- `apps/web/src/types.ts` — Removed Project/User/SessionPayload (now re-export from types/)
- `apps/web/src/components/app-shell.tsx` — Updated Session import to types/session.ts
- `apps/web/src/components/instance-list.tsx` — Updated ToolInstance/ToolType imports to types/
- `apps/web/src/components/repositories-settings-tab.tsx` — Updated GitRepository import to types/
- `apps/web/src/components/repository-create-dialog.tsx` — Updated GitRepositoryCreate/URLParseResult imports to types/
- `apps/web/src/pages/dashboard.tsx` — Updated SessionApi/GitRepository/ToolType/Project imports to types/
- `apps/web/src/pages/sessions.tsx` — Updated Session/GitRepository/ToolType/Project imports to types/
- `apps/web/src/pages/repo-workspace.tsx` — Updated GitRepository/ToolType imports to types/
- `apps/web/src/pages/tool-types.tsx` — Updated ToolType/CreateToolTypeRequest/UpdateToolTypeRequest imports to types/
- `apps/web/src/pages/tool-configs.tsx` — Updated ToolType/ToolConfig imports to types/
- `apps/web/src/pages/git-repositories.tsx` — Updated GitRepository import to types/
- `apps/api/src/main.py` — Removed inline seed_builtin_tool_types, imports from seeds.builtin_tool_types
**Files Deleted:** None
**Quality Gate Results:**
- `npm run typecheck` (frontend): **PASS** — zero errors
- `npm run lint` (frontend): **PASS** — zero warnings
- Python syntax check (backend main.py + seeds): **PASS** — exit code 0
- Type uniqueness verification:
- `interface Session` appears exactly once (in types/session.ts)
- `interface ToolInstance` appears exactly once (in types/tool-instance.ts)
- `interface ToolType` appears exactly once (in types/tool-type.ts)
- `interface GitRepository` appears exactly once (in types/git-repository.ts)
**Blockers/Deviations:**
- None. All types successfully centralized with backward-compatible re-exports from API modules.
- The `types.ts` file at `apps/web/src/types.ts` still exists as a legacy re-export file to avoid breaking any remaining consumers. It will be removed in a later phase once all imports are confirmed migrated.