[Architecture] Decompose CLI workflow composition root
Labels: enhancement, architecture, cli
Priority: P2 (architecture triage)
Subject: codeclone/surfaces/cli/workflow.py
Signal: responsibility_overload
Triage run: e28867ed (health 91/A)
Summary
codeclone/surfaces/cli/workflow.py is the CLI composition root that combines pipeline orchestration, gating, controller queries, and subsystem dispatch (memory, analytics, observability) in one overloaded module.
Environment
- Product/Service: CodeClone
- Version: 2.1.0a1 (run
e28867ed)
- Area: CLI (
codeclone.surfaces.cli)
Current State
- Fan-out 29, overloaded score 0.950, unwind:
chain_bottleneck, high_instability.
_main_impl spans lines 424–760 and imports core pipeline, cache, baseline, HTML, observability, audit, blast-radius, patch-verify.
- Dispatches memory/analytics/observability subcommands inline (lines 810–818).
- Impact blast: high (entry via
codeclone/main.py).
Expected Behavior
workflow.py should orchestrate CLI lifecycle only. Controller query routing, subsystem CLIs, and analysis staging should live in dedicated modules with narrow imports — matching the thin main.py entry pattern described in AGENTS.md.
Actual Behavior
One module owns bootstrap → analysis → gating → report writes → controller terminal queries → subsystem CLI delegation. UX, controller flags, and pipeline bootstrap evolve on different cadences but share a single bottleneck.
Impact
Medium — CLI remains functional; change risk and review surface are high for any controller or subsystem CLI work touching the main path.
Proposed Direction
- Peel
--blast-radius, --patch-verify, --session-stats, --audit routing into existing or new surfaces/cli/* orchestrators.
- Keep
_main_impl focused on parse → bootstrap → pipeline → reports → exit routing.
- Avoid duplicating core semantics; delegate to
codeclone.core, codeclone.analysis, and controller helpers as blast-radius CLI already does.
Additional Context
- Architecture triage score: C+D+E → 30 (P2).
- Related hotspots: duplicated branch findings at
workflow.py:810–818 (production triage).
- Tests:
tests/test_cli_inprocess.py, tests/test_cli_unit.py, tests/test_observability_cli_pipeline.py.
[Architecture] Decompose CLI workflow composition root
Labels:
enhancement,architecture,cliPriority: P2 (architecture triage)
Subject:
codeclone/surfaces/cli/workflow.pySignal:
responsibility_overloadTriage run:
e28867ed(health 91/A)Summary
codeclone/surfaces/cli/workflow.pyis the CLI composition root that combines pipeline orchestration, gating, controller queries, and subsystem dispatch (memory, analytics, observability) in one overloaded module.Environment
e28867ed)codeclone.surfaces.cli)Current State
chain_bottleneck,high_instability._main_implspans lines 424–760 and imports core pipeline, cache, baseline, HTML, observability, audit, blast-radius, patch-verify.codeclone/main.py).Expected Behavior
workflow.pyshould orchestrate CLI lifecycle only. Controller query routing, subsystem CLIs, and analysis staging should live in dedicated modules with narrow imports — matching the thinmain.pyentry pattern described in AGENTS.md.Actual Behavior
One module owns bootstrap → analysis → gating → report writes → controller terminal queries → subsystem CLI delegation. UX, controller flags, and pipeline bootstrap evolve on different cadences but share a single bottleneck.
Impact
Medium — CLI remains functional; change risk and review surface are high for any controller or subsystem CLI work touching the main path.
Proposed Direction
--blast-radius,--patch-verify,--session-stats,--auditrouting into existing or newsurfaces/cli/*orchestrators._main_implfocused on parse → bootstrap → pipeline → reports → exit routing.codeclone.core,codeclone.analysis, and controller helpers as blast-radius CLI already does.Additional Context
workflow.py:810–818(production triage).tests/test_cli_inprocess.py,tests/test_cli_unit.py,tests/test_observability_cli_pipeline.py.