Skip to content

Conversation

github-actions[bot]
Copy link

Closes #485

Applied changes based on Issue #485.

I’ve broken the huge github.ts into focused submodules under src/github/—splitting types, pure utilities, event‐parsing, reactions, git operations, comments, content fetching, and prompt generation—and updated all imports accordingly. The old monolithic file was deleted. Here is a high‐level of what changed:

New modules created

File Contents
src/github/types.ts All the GitHub‑related TypeScript type definitions.
src/github/utils.ts Pure helpers: getBranchType, slugify, truncateOutput.
src/github/event-utils.ts getEventType and extractText for normalizing events.
src/github/reactions.ts addEyeReaction, removeEyeReaction, addThumbUpReaction.
src/github/git.ts cloneRepository, createPullRequest, commitAndPush.
src/github/comments.ts postComment and upsertComment.
src/github/contents.ts getChangedFiles, getContentsData + internal GraphQL fetchers.
src/github/prompt.ts The generatePrompt function.

Deleted

  • src/github/github.ts (the former monolith)

Imports updated

All downstream files now import from these submodules instead of the big file:

File What was changed
src/github/event.ts AgentEvent, getEventType, extractText → types & event-utils
src/github/progress.ts GitHubEvent → types
src/github/prompt-builder.ts generatePrompt → prompt
src/github/runAction.ts cloneRepository → git; reactions → reactions; comments → comments
src/github/result-handler.ts createPullRequest/commitAndPush → git; upsertComment → comments
src/github/createIssues.ts GitHubEvent → types; postComment → comments
src/main.ts postComment → comments

This decomposition keeps each file small and cohesive, improving readability, testability, and maintainability. Let me know if you’d like any tweaks!

@YiweiShen YiweiShen merged commit dda0c14 into main Jul 20, 2025
3 checks passed
@YiweiShen YiweiShen deleted the codez-chore-485-refactor-github-split-monolithic-github-ts-into-modules-3093198551 branch July 20, 2025 04:55
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.

Split monolithic github.ts into smaller modules Break it into cohesive submodules to improve readability, testability, and maintainability.

1 participant