Part of #14 (delivery step 1). Blocks every other sub-issue: nothing shared-process can land before renders are request-scoped.
Что сделать
- Extract the orchestration inside
renderMultipleLines() into a function that accepts validated input + explicit invocation context (cwd, config path, env snapshot, terminal width, styling state) and returns text. Stdout/exit stays in the entry point.
- Make per-request what are process globals today:
src/utils/config.ts: mutable settingsPath / lastLoadError → resolved per call, module state not mutated;
src/utils/terminal.ts: memoized width → passed in per request;
src/utils/usage-fetch.ts: single in-memory usage result → scoped to request context;
src/ccstatusline.ts: global Chalk/color state → request-local styling, or serialize only the final synchronous formatting section.
- Preserve existing config validation, atomic migrations, warning badges and malformed-file recovery byte-for-byte.
- Parity proof: fixed input + fixed provider results + fixed time → byte-equal output before/after, covering multiline layouts, colors, Powerline, custom commands, warning badges. One-shot entry point unchanged.
Файлы
src/ccstatusline.ts, src/utils/config.ts, src/utils/terminal.ts, src/utils/renderer.ts, src/utils/usage-fetch.ts, src/types/RenderContext.ts; parity tests under src/**/__tests__/.
Эталон
PR #2 (perf refactor + honest before/after discipline), PR #11 (entry-point wiring style).
Оценка
- LOC: ~400–700 (src ~300 / tests ~250)
- Размер: L
- Время (код): ~50–130 мин
- Время (review): ~30–45 мин (чистый рефактор; validation/atomic paths preserved, no security multiplier)
- Время (итого): ~80–175 мин
Priority: high (fundament).
Part of #14 (delivery step 1). Blocks every other sub-issue: nothing shared-process can land before renders are request-scoped.
Что сделать
renderMultipleLines()into a function that accepts validated input + explicit invocation context (cwd, config path, env snapshot, terminal width, styling state) and returns text. Stdout/exit stays in the entry point.src/utils/config.ts: mutablesettingsPath/lastLoadError→ resolved per call, module state not mutated;src/utils/terminal.ts: memoized width → passed in per request;src/utils/usage-fetch.ts: single in-memory usage result → scoped to request context;src/ccstatusline.ts: global Chalk/color state → request-local styling, or serialize only the final synchronous formatting section.Файлы
src/ccstatusline.ts,src/utils/config.ts,src/utils/terminal.ts,src/utils/renderer.ts,src/utils/usage-fetch.ts,src/types/RenderContext.ts; parity tests undersrc/**/__tests__/.Эталон
PR #2 (perf refactor + honest before/after discipline), PR #11 (entry-point wiring style).
Оценка
Priority: high (fundament).