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.ts — WrapperConfig and its sub-configs (consider splitting into nested interfaces like ApiProxyOptions, NetworkOptions, SecurityOptions)
src/types/docker.ts — DockerComposeConfig, DockerService, DockerNetwork, SquidConfig
src/types/policy.ts — PolicyRule, PolicyManifest
src/types/logging.ts — ParsedLogEntry, 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 · ◷
Refactoring Opportunity
Summary
src/types.tsEvidence
The file is a monolithic type barrel with no internal grouping markers. Distinct type domains found:
API_PROXY_PORTS,CLI_PROXY_PORT), forward declarationsWrapperConfig,UpstreamProxyConfig,RateLimitConfig) — WrapperConfig interface alone spans lines 91–1034 (~943 lines) with 60+ fieldsSquidConfig) and policy types (PolicyRule,PolicyManifest)DockerComposeConfig,DockerService)BlockedTarget,ParsedLogEntry,EnhancedLogEntry,LogSource,OutputFormat,LogStatsFormat)PidTrackResult)WrapperConfigat ~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.ts—WrapperConfigand its sub-configs (consider splitting into nested interfaces likeApiProxyOptions,NetworkOptions,SecurityOptions)src/types/docker.ts—DockerComposeConfig,DockerService,DockerNetwork,SquidConfigsrc/types/policy.ts—PolicyRule,PolicyManifestsrc/types/logging.ts—ParsedLogEntry,EnhancedLogEntry,BlockedTarget,LogSource,OutputFormat,LogStatsFormatsrc/types/index.ts— re-exports all of the above for backwards compatibilityAffected Callers
Virtually every TypeScript file in
src/imports from./types. A barrelsrc/types/index.tspreserves all import paths.Effort Estimate
Medium — purely additive; barrel re-export means no callers need to change.
Benefits
WrapperConfigis the most-edited interface; isolating it reduces noise in PRs touching other type domainsDetected by Refactoring Scanner workflow. Run date: 2026-05-04