refactor: expand uses of effect and remove unused utils #66
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.

Greptile Overview
Greptile Summary
Overview
This PR performs a comprehensive refactor to expand the use of Effect throughout the codebase and remove unused utility functions. The changes are well-structured and maintain consistency across the monorepo.
Key Changes
1. CLI Migration to Effect (Major Enhancement)
init-nowCLI fromconsolato@effect/clifor better composability and error handlingsetup,add,update,check,renamescripts/templateto the CLI packageOperationCancelled,GitInitFailed, etc.)2. Removed Unused Utilities
Successfully removed 5 unused utility modules from
@init/utils:cache.ts- Caching wrapper (no longer used)duration.ts- Custom duration parser (replaced with Effect.Duration)encryption.ts- AES-256-GCM encryption utils (no longer used)proxy.ts- Recursive proxy creator (no longer used)serialize.ts- Stable serialization (no longer used)Also removed unused type utilities:
StrictOmit,UnionToIntersection3. Duration API Migration
Consistently migrated from custom
@init/utils/durationto Effect'sDurationmodule:packages/email/src/client.ts- Email scheduling withDuration.decode()andDuration.toMillis()packages/kv/src/client.ts- TTL configuration withDuration.toSeconds()apps/api/src/shared/middleware.ts- Rate limiting intervalsapps/api/src/routes/health.tsfrom"1m"to more readable"1 minute"formatEffect's Duration API supports multiple formats including strings ("1 minute", "5 seconds"), numbers (milliseconds), and Duration objects.
4. Error Handling Improvements
packages/error/src/fault.ts(removed separateauth.tsandindex.ts)@init/errorto@init/error/fault5. Database Scripts Simplification
reset.tsandseed.tsconsolawith standardconsole.logfor simpler output6. Dependency Updates
@effect/cli,@effect/platform,@effect/platform-bunconsola,yargs,@types/yargseffectto catalog dependencies for consistencyArchitecture Improvements
The migration to Effect brings several benefits:
Testing Coverage
The PR includes:
cli/src/__tests__/workspaces.test.tsdescribe.skip)Breaking Changes
Import path changes (affects consumers):
@init/error→@init/error/faultDuration format changes:
"1m"→"1 minute"(both work with Effect.Duration)Documentation Updates
Added comprehensive CLI command documentation to README.md with command table showing all available operations.
Confidence Score: 5/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant User participant CLI as init-now CLI participant Effect as Effect Runtime participant FS as FileSystem participant Git as Git Commands participant Packages as @init Packages Note over User,Packages: Main refactor: Effect adoption & CLI expansion User->>CLI: bunx init-now@latest CLI->>Effect: Command.run(main) Effect->>User: Prompt for project name User->>Effect: Provides name Effect->>FS: Check directory exists Effect->>User: Confirm overwrite (if needed) Effect->>Git: downloadTemplate Effect->>FS: Create project structure Effect->>User: Prompt install deps Effect->>Effect: bun install (if confirmed) Effect->>User: Success message Note over User,Packages: New CLI commands (moved from scripts/template) User->>CLI: init-now setup CLI->>Effect: setupCommand.handler Effect->>User: Prompt workspace selection Effect->>FS: Remove unselected workspaces Effect->>FS: Update package.json Effect->>FS: Setup .env files Effect->>Git: Initialize git repo User->>CLI: init-now update CLI->>Effect: updateCommand.handler Effect->>Git: Clone template repo Effect->>Git: Compare local vs template Effect->>FS: Copy updated files Effect->>Git: Stage changes Note over Packages: Duration & Error handling migration User->>Packages: Use @init/email Packages->>Effect: Duration.decode("1 minute") Effect->>Packages: Duration object Packages->>Packages: Duration.toMillis() Packages->>Packages: Fault.wrap(error) on failure User->>Packages: Use @init/kv with TTL Packages->>Effect: Duration.decode(config.ttl) Effect->>Packages: Duration object Packages->>Packages: Duration.toSeconds() User->>Packages: API rate limiting Packages->>Effect: Duration.decode("1 minute") Effect->>Packages: Duration object Packages->>Packages: Duration.toMillis()