Skip to content

refactor: fix bugs, remove dead code, improve architecture - #1

Merged
IchenDEV merged 1 commit into
mainfrom
refactor/code-quality-fixes
Apr 11, 2026
Merged

IchenDEV merged 1 commit into
mainfrom
refactor/code-quality-fixes

Conversation

@IchenDEV

Copy link
Copy Markdown
Owner

Summary

  • Bug fixes: detectAgentLinks had wrong paths for Cline and Warp (both mapped to .agents/skills) and was missing 5 agents entirely; refactored to derive from allAgents and store agent IDs. addSkill/removeSkill never checked process.terminationStatus, silently dropping failures. AddSkillSheet read shared manager.errorMessage to detect success — replaced with proper throws.
  • Dead code removed: swift-markdown dependency (never imported — cuts ~35s from clean builds), checkForUpdates() (never called), expandedSources state, groupedBySource property, MarketplaceSkill.installCommand and .authorAvatar.
  • Architecture: Consolidated duplicate skillIcon/skillColor if-chains onto Skill model (skillColor in a Skill+UI.swift extension to keep Skill.swift Foundation-only). Skill.body stored at scan time to avoid re-parsing on every render. MarketplaceView search state replaced 3 booleans with a SearchState enum. Remove and install errors now surface via alerts. Added CLAUDE.md.

Test plan

  • Build succeeds: swift build
  • Installed tab loads skills and sidebar groups them correctly
  • Cline and Warp skills show as installed for those agents (if present)
  • Add skill from a GitHub source — success dismisses sheet, failure shows error message
  • Remove skill — success navigates away, failure shows "Remove Failed" alert
  • Marketplace search: idle → searching → results/error states all render correctly
  • Install from marketplace — failure shows "Install Failed" alert
  • Add to Agents sheet shows correct "Installed" badges by agent ID

🤖 Generated with Claude Code

Bugs fixed:
- detectAgentLinks had wrong paths for Cline (.agents/skills → .cline/skills)
  and Warp (.agents/skills → .warp/skills), and was missing 5 agents entirely.
  Refactored to derive paths from allAgents (single source of truth), store
  agent IDs instead of display names, and cover all 20 supported agents.
- addSkill/removeSkill never checked process.terminationStatus, so failed
  installs/removals were silently swallowed. Both now throw CommandError on
  non-zero exit.
- AddSkillSheet read manager.errorMessage to detect success/failure — fragile
  shared state. Now catches errors thrown directly from addSkill.

Dead code removed:
- swift-markdown dependency declared in Package.swift but never imported;
  markdown rendering uses SwiftUI's built-in AttributedString(markdown:).
  Removing it cuts ~35s from clean builds.
- checkForUpdates() was never called from any view.
- expandedSources state in SkillsSidebar was never read or written.
- groupedBySource on SkillsManager was unused (SkillsSidebar reimplemented it).
- MarketplaceSkill.installCommand and .authorAvatar were never used.

Architecture improvements:
- skillIcon/skillColor logic was duplicated across SkillRow and SkillDetailView;
  consolidated onto Skill model. skillColor moved to Skill+UI.swift extension
  so Skill.swift stays Foundation-only.
- Skill.body stored at load time; SkillDetailView no longer re-parses
  SKILL.md frontmatter on every render.
- Skill.agents now stores agent IDs; display names resolved via allAgents.
  AddToAgentsSheet compares agent.id instead of agent.name.
- MarketplaceView search state replaced three booleans (isSearching,
  hasSearched, errorMessage) with a SearchState enum.
- Remove errors and marketplace install errors now surface to the user
  via alerts instead of being silently dropped.
- Added CLAUDE.md with build commands and architecture overview.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@IchenDEV
IchenDEV merged commit 294555f into main Apr 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant