refactor(github): split monolithic github.ts into modules #486
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #485
Applied changes based on Issue #485.
I’ve broken the huge
github.ts
into focused submodules undersrc/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
src/github/types.ts
src/github/utils.ts
getBranchType
,slugify
,truncateOutput
.src/github/event-utils.ts
getEventType
andextractText
for normalizing events.src/github/reactions.ts
addEyeReaction
,removeEyeReaction
,addThumbUpReaction
.src/github/git.ts
cloneRepository
,createPullRequest
,commitAndPush
.src/github/comments.ts
postComment
andupsertComment
.src/github/contents.ts
getChangedFiles
,getContentsData
+ internal GraphQL fetchers.src/github/prompt.ts
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:
src/github/event.ts
AgentEvent
,getEventType
,extractText
→ types & event-utilssrc/github/progress.ts
GitHubEvent
→ typessrc/github/prompt-builder.ts
generatePrompt
→ promptsrc/github/runAction.ts
cloneRepository
→ git; reactions → reactions; comments → commentssrc/github/result-handler.ts
createPullRequest
/commitAndPush
→ git;upsertComment
→ commentssrc/github/createIssues.ts
GitHubEvent
→ types;postComment
→ commentssrc/main.ts
postComment
→ commentsThis decomposition keeps each file small and cohesive, improving readability, testability, and maintainability. Let me know if you’d like any tweaks!