Skip to content

Refactor createAgent(): extract input prep and DB insert#740

Merged
selfcontained merged 2 commits into
mainfrom
agt_e4c606a67a80/job-debt-collector-eb120b47
Jul 9, 2026
Merged

Refactor createAgent(): extract input prep and DB insert#740
selfcontained merged 2 commits into
mainfrom
agt_e4c606a67a80/job-debt-collector-eb120b47

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

Summary

  • Extracted prepareCreateInputs() from createAgent() — moves ~94 lines of input normalization (type defaults, full-access args, ref name validation, worktree params, CLI session ID) into a focused private method returning a typed PreparedCreateInputs object.
  • Extracted insertAgentRecord() — moves the 30-line DB INSERT into its own method, separating persistence from orchestration.
  • createAgent() drops from 206 lines to ~82 lines and reads as a clear sequence: prepare → insert → notify → seed media → launch.

This is tech debt cleanup — no behavior change.

Next up: Extract UnifiedDiffView component from changes-tab.tsx (1127-line file).

Test plan

  • pnpm run check — TypeScript type checking passes
  • pnpm run test — all 188 unit tests pass
  • pnpm run test:e2e — all 172 E2E tests pass

🤖 Generated with Claude Code

selfcontained and others added 2 commits July 9, 2026 03:11
Extract prepareCreateInputs() and insertAgentRecord() from the 206-line
createAgent() method. The main method now reads as a clear sequence of
steps (prepare → insert → notify → seed media → launch) while the
normalization and DB logic live in focused private methods.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@selfcontained
selfcontained merged commit 89139bc into main Jul 9, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_e4c606a67a80/job-debt-collector-eb120b47 branch July 9, 2026 09:18
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