Skip to content

[Refactoring] Split src/types.ts into domain-scoped type modules #2475

@github-actions

Description

@github-actions

Refactoring Opportunity

Summary

  • File: src/types.ts
  • Current size: 1,810 lines
  • Responsibilities identified: 6 distinct domain groups

Evidence

The file is a monolithic type barrel with no internal grouping markers. Distinct type domains found:

Lines (approx.) Domain
1–90 Port constants (API_PROXY_PORTS, CLI_PROXY_PORT), forward declarations
91–1034 Core firewall config (WrapperConfig, UpstreamProxyConfig, RateLimitConfig) — WrapperConfig interface alone spans lines 91–1034 (~943 lines) with 60+ fields
1035–1260 Squid proxy types (SquidConfig) and policy types (PolicyRule, PolicyManifest)
1273–1673 Docker Compose types (DockerComposeConfig, DockerService)
1674–1809 Logging types (BlockedTarget, ParsedLogEntry, EnhancedLogEntry, LogSource, OutputFormat, LogStatsFormat)
1782–1810 PID tracking types (PidTrackResult)

WrapperConfig at ~943 lines is especially notable — it has grown to encompass every CLI option and likely needs to be decomposed into nested sub-configs (e.g., ApiProxyConfig, RateLimitConfig, NetworkConfig).

Proposed Split

  • src/types/config.tsWrapperConfig and its sub-configs (consider splitting into nested interfaces like ApiProxyOptions, NetworkOptions, SecurityOptions)
  • src/types/docker.tsDockerComposeConfig, DockerService, DockerNetwork, SquidConfig
  • src/types/policy.tsPolicyRule, PolicyManifest
  • src/types/logging.tsParsedLogEntry, EnhancedLogEntry, BlockedTarget, LogSource, OutputFormat, LogStatsFormat
  • src/types/index.ts — re-exports all of the above for backwards compatibility

Affected Callers

Virtually every TypeScript file in src/ imports from ./types. A barrel src/types/index.ts preserves all import paths.

Effort Estimate

Medium — purely additive; barrel re-export means no callers need to change.

Benefits

  • WrapperConfig is the most-edited interface; isolating it reduces noise in PRs touching other type domains
  • Docker Compose types (frequently regenerated) separated from logging types (frequently extended)
  • Easier to find the right type when onboarding

Detected by Refactoring Scanner workflow. Run date: 2026-05-04

Generated by Refactoring Opportunity Scanner · ● 233.7K ·

  • expires on Jul 3, 2026, 6:39 AM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions