Effect.fn Refactor Checklist
Generated from a repo scan for non-test wrapper-style candidates matching either => Effect.gen(function* ...) or return Effect.gen(function* ...).
Refactor Method:
// Old
function old () {
return Effect.gen(function* () {
...
});
}
const old2 = () => Effect.gen(function* () {
...
});
// New
const new = Effect.fn('functionName')(function* () {
...
})
-
Use
Effect.fn('name')(function* (input: Input): Effect.fn.Return<A, E, R> {})to annotate the return type of the function if needed. -
The 2nd argument works as a pipe, and it gets the effect and input as arguments:
Effect.fn("name")(
function* (input: Input): Effect.fn.Return<A, E, R> {},
(effect, input) => Effect.catch(effect, (reason) => Effect.logWarning("Err", { input, reason })),
);
Summary
- Total non-test candidates:
322
Suggested Order
-
apps/server/src/provider/Layers/ProviderService.ts -
apps/server/src/provider/Layers/ClaudeAdapter.ts -
apps/server/src/provider/Layers/CodexAdapter.ts -
apps/server/src/git/Layers/GitCore.ts -
apps/server/src/git/Layers/GitManager.ts -
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts -
apps/server/src/orchestration/Layers/ProjectionPipeline.ts -
apps/server/src/orchestration/Layers/OrchestrationEngine.ts -
apps/server/src/provider/Layers/EventNdjsonLogger.ts -
Everything else
Checklist
apps/server/src/provider/Layers/ClaudeAdapter.ts (62)
- buildUserMessageEffect
- makeClaudeAdapter
- startSession
- sendTurn
- interruptTurn
- readThread
- rollbackThread
- stopSession
- Internal helpers and callback wrappers in this file
apps/server/src/git/Layers/GitCore.ts (58)
- makeGitCore
- handleTraceLine
- emitCompleteLines
- commit
- pushCurrentBranch
- pullCurrentBranch
- checkoutBranch
- Service methods and callback wrappers in this file
apps/server/src/git/Layers/GitManager.ts (28)
- configurePullRequestHeadUpstream
- materializePullRequestHeadBranch
- findOpenPr
- findLatestPr
- runCommitStep
- runPrStep
- runFeatureBranchStep
- Remaining helpers and nested callback wrappers in this file
apps/server/src/orchestration/Layers/ProjectionPipeline.ts (25)
- runProjectorForEvent
- applyProjectsProjection
- applyThreadsProjection
-
Effect.forEach(..., threadId => Effect.gen(...))callbacks aroundL250 -
Effect.forEach(..., entry => Effect.gen(...))callbacks aroundL264 -
Effect.forEach(..., entry => Effect.gen(...))callbacks aroundL305 - Remaining apply helpers in this file
apps/server/src/provider/Layers/ProviderService.ts (24)
- makeProviderService
- recoverSessionForThread
- resolveRoutableSession
- startSession
- sendTurn
- interruptTurn
- respondToRequest
- respondToUserInput
- stopSession
- listSessions
- rollbackConversation
- runStopAll
apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts (14)
- finalizeAssistantMessage
- upsertProposedPlan
- finalizeBufferedProposedPlan
- clearTurnStateForSession
- processRuntimeEvent
- Nested callback wrappers in this file
apps/server/src/provider/Layers/CodexAdapter.ts (12)
- makeCodexAdapter
- sendTurn
- writeNativeEvent
- listener
- Remaining nested callback wrappers in this file
apps/server/src/checkpointing/Layers/CheckpointStore.ts (10)
- captureCheckpoint
- restoreCheckpoint
- diffCheckpoints
- deleteCheckpointRefs
- Nested callback wrappers in this file
apps/server/src/provider/Layers/EventNdjsonLogger.ts (9)
- toLogMessage
- makeThreadWriter
- makeEventNdjsonLogger
- write
- close
- Flush and writer-resolution callback wrappers in this file
apps/server/scripts/cli.ts (8)
- Command handlers around cli.ts
- Command handlers around cli.ts
- Resource callbacks around cli.ts
- Resource callbacks around cli.ts
apps/server/src/orchestration/Layers/OrchestrationEngine.ts (7)
- processEnvelope
- dispatch
- Catch/stream callback wrappers around OrchestrationEngine.ts
- Catch/stream callback wrappers around OrchestrationEngine.ts
apps/server/src/orchestration/projector.ts (5)
-
switchbranch wrapper at projector.ts -
switchbranch wrapper at projector.ts -
switchbranch wrapper at projector.ts -
switchbranch wrapper at projector.ts -
switchbranch wrapper at projector.ts
Smaller clusters
- packages/shared/src/DrainableWorker.ts (
4) - apps/server/src/wsServer/pushBus.ts (
4) - apps/server/src/wsServer.ts (
4) - apps/server/src/provider/Layers/ProviderRegistry.ts (
4) - apps/server/src/persistence/Layers/Sqlite.ts (
4) - apps/server/src/orchestration/Layers/ProviderCommandReactor.ts (
4) - apps/server/src/main.ts (
4) - apps/server/src/keybindings.ts (
4) - apps/server/src/git/Layers/CodexTextGeneration.ts (
4) - apps/server/src/serverLayers.ts (
3) - apps/server/src/telemetry/Layers/AnalyticsService.ts (
2) - apps/server/src/telemetry/Identify.ts (
2) - apps/server/src/provider/Layers/ProviderAdapterRegistry.ts (
2) - apps/server/src/provider/Layers/CodexProvider.ts (
2) - apps/server/src/provider/Layers/ClaudeProvider.ts (
2) - apps/server/src/persistence/NodeSqliteClient.ts (
2) - apps/server/src/persistence/Migrations.ts (
2) - apps/server/src/open.ts (
2) - apps/server/src/git/Layers/ClaudeTextGeneration.ts (
2) - apps/server/src/checkpointing/Layers/CheckpointDiffQuery.ts (
2) - apps/server/src/provider/makeManagedServerProvider.ts (
1)