Skip to content

Replace hardcoded agent type strings with enum #62

@2witstudios

Description

@2witstudios

Problem

Agent type strings ("claude", "codex", "opencode") are hardcoded as raw string arrays in three separate locations:

  • AgentCreationSheet.swift:17["claude", "codex", "opencode"]
  • PromptCreationSheet.swift:14["", "claude", "codex", "opencode"]
  • AgentsHubView.swift:163["", "claude", "codex", "opencode"]

Adding a new agent type requires finding and updating all three. The two variants (with/without empty string for "Any") add confusion.

Additionally, other stringly-typed patterns exist:

  • PR review decisions in PRRowView.swift:72-85 ("APPROVED", "CHANGES_REQUESTED", "REVIEW_REQUIRED")
  • Diff status codes in DiffCardView.swift:86-110 ("A", "D", "M", "??")
  • Prompt scope wire values checked as prompt.source == "global" in multiple places in AgentsHubView.swift

Suggested approach

  1. Create an AgentTypeKind enum with allCases for pickers
  2. Create a ReviewDecision enum for PR review decisions
  3. Create a DiffStatusCode enum for diff statuses
  4. Make SavedPrompt.source a typed enum instead of raw string

Files

  • apps/purepoint-macos/purepoint-macos/Views/Agents/AgentCreationSheet.swift
  • apps/purepoint-macos/purepoint-macos/Views/Agents/PromptCreationSheet.swift
  • apps/purepoint-macos/purepoint-macos/Views/Agents/AgentsHubView.swift
  • apps/purepoint-macos/purepoint-macos/Views/Detail/PRRowView.swift
  • apps/purepoint-macos/purepoint-macos/Views/Detail/DiffCardView.swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions