Skip to content

effect-analyzer

Turn yields, layers, and pipes into diagrams your team can read in seconds. Catch what text diffs miss when retry policies change, services move, or error paths drift. Without ever running your code.
// Your code transfer-workflow.ts · 18 lines
export const transferWorkflow = (
  fromAccountId: string,
  toAccountId: string,
  amount: number,
) =>
  Effect.gen(function* () {
    const accounts = yield* AccountService
    const audit    = yield* AuditLog

    const balance = yield* accounts.getBalance(fromAccountId)
    if (balance < amount) {
      return yield* Effect.fail(
        new InsufficientFundsError(balance, amount)
      )
    }

    yield* accounts.debit(fromAccountId, amount)
    yield* accounts.credit(toAccountId, amount)
    yield* audit.record(`Transferred ${amount}`)
  })
which services? which errors? how many paths?
// analyzed ✓ 42ms · ast · no runtime
transferWorkflow AccountService AuditLog getBalance balance < amount? InsufficientFunds yes debit no credit audit.record ✓ success
services 2 AccountService, AuditLog
error paths 1 InsufficientFundsError
decision points 1 cyclomatic 2 · cognitive 1
concurrency seq no parallelism

Same function. 5 seconds to grok, not 5 minutes and your CI catches it the moment someone removes AuditLog or swaps sequential for parallel.

PR reviews catch real changes

Text diffs say “3 lines changed”. The semantic diff says “retry removed, DbService added, error path now uncaught”. Stop merging behaviour drift on autopilot.

Onboard without reading every yield

New teammates open the interactive HTML viewer for a function and see services, layers, error paths and concurrency at a glance — instead of tracing generators line-by-line.

Docs that can't lie

Service maps and railway diagrams generated straight from the AST. Refactor freely; the diagrams move with the code, not with a stale Notion page.

Catch hidden complexity in CI

Cyclomatic, cognitive, path count, nesting depth, parallel breadth — fail the build when a function quietly crosses your team’s thresholds.

Prefer the CLI for CI pipelines and local sanity checks? Same analyzer, same IR.

~/effect-analyzer · npx effect-analyze transfer-workflow.ts --format explain
$ npx effect-analyze ./src/transfer-workflow.ts --format explain
transferWorkflow (generator):
  1. Yields accounts <- AccountService
  2. Yields audit    <- AuditLog
  3. Yields balance  <- accounts.getBalance
  4. If balance < amount:
       Returns InsufficientFundsError
  5. Calls accounts.debit
  6. Calls accounts.credit
  7. Calls audit.record
  Services required:  AccountService, AuditLog
  Error paths:        AccountNotFoundError, InsufficientFundsError
  Concurrency:        sequential (no parallelism)
 analyzed in 42ms ·  0 issues  ·  4 services  ·  2 error paths
Terminal window
# Install
npm install effect-analyzer
# Analyze a file
npx effect-analyze ./src/my-program.ts
# Generate a railway diagram
npx effect-analyze ./src/my-program.ts --format mermaid-railway
# Compare versions
npx effect-analyze HEAD:program.ts program.ts --diff