Skip to content

♻️ Organize CLI code by domain - #387

Merged
Robdel12 merged 2 commits into
mainfrom
rd/domain-organization
Nov 1, 2026
Merged

Robdel12 merged 2 commits into
mainfrom
rd/domain-organization

Conversation

@Robdel12

@Robdel12 Robdel12 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Why

Finding one feature currently means moving between commands, API endpoints, services, and utilities. That spreads ownership across technical folders and makes it easy to put the next change in the wrong place.

Approach

Group CLI behavior and tests by domain, with explicit files for commands, local routes, data operations, validation, rules, normalization, and serialization. Give the reporter the same ownership pattern inside its browser build. Keep shared capabilities narrow and preserve published CLI, SDK, and plugin contracts.

Remove the old internal barrels and paths, centralize packaged resource lookup, and document the ownership rules. Lint now checks imports, module cycles, pure-file I/O boundaries, and browser/server separation without adding a runtime framework.

Evidence

All 2,058 Node tests pass with six existing skips; 96 reporter browser tests pass with two existing skips. Build, lint, formatting, and published type checks pass. Reporter CSS and four rendered HTML fixtures are byte-identical to the previous layout.

A packed-package check imports all four public entrypoints without source files, installs the bundled agent skill, captures through a real local daemon, and generates a static report. Source and compiled HTTP asset delivery also pass. An independent simplification review found no remaining move-related behavior issues.

Final review

Architecture checks now resolve compiled imports to their source owners, so lint works in a clean checkout before a build. Direct clean-checkout architecture and lint validation pass. The complete stack also passed the final Node 22/24, desktop/mobile browser, and installed-package manual QA pass described in #388.

@vizzly-testing

This comment has been minimized.

@vizzly-testing

This comment has been minimized.

Keep feature commands, routes, contracts, and data operations with their domain. Preserve public package and plugin behavior while making ownership and browser boundaries explicit.
Resolve package build imports to their source owners during architecture checks so lint works in a clean checkout without skipping missing targets.
@Robdel12
Robdel12 force-pushed the rd/domain-organization branch from 11dd2bd to 3a87b54 Compare November 1, 2026 18:35
@vizzly-testing

vizzly-testing Bot commented Nov 1, 2026

Copy link
Copy Markdown

Vizzly - Visual Test Results

CLI Reporter - Waiting for build

No builds received yet for this pull request.

CLI TUI - Approved

5 comparisons, no changes detected.

View build


rd/domain-organization · 3a87b549

@Robdel12
Robdel12 merged commit 85351b7 into main Nov 1, 2026
35 of 36 checks passed
@Robdel12
Robdel12 deleted the rd/domain-organization branch November 1, 2026 18:39
Robdel12 added a commit that referenced this pull request Nov 1, 2026
Builds on #387, which is now merged into main.

## Why

Domain folders still competed with separate client, SDK, server,
service, and error roots. Following ownership through those folders also
exposed repeated workflows and tests that replaced the code they meant
to verify. Real boundary tests found failures those fakes concealed.

## Approach

- Organize source around `domains/`, `adapters/`, `shared/`, and the
separately built `reporter/`. Move product HTTP routes to their domains,
keep hosting and cross-domain wiring in adapters, and colocate
declarations and focused tests. Preserve public package specifiers,
exports, and plugin contracts.
- Give Reports ownership of state, lightweight/heavy persistence, and
snapshots consumed by capture, dashboard, SSE, health, and static
rendering. Share baseline writes, screenshot request serialization,
report-image deletion, and the SDK class declaration. Split Context
validation, serialization, presentation, and orchestration.
- Fix SDK initialization, shutdown/workspace handling, and cloud build
finalization after setup failure. Preserve test exit status when visual
setup/finalization fails, propagate report-write failures, serve images
from the configured workspace, and reexecute CLI updates through the
published executable.
- Refresh only matching saved credentials, preserve HTTP status for
preview/screenshot errors, and return an empty project list when logged
out. Roll back only failed optimistic review actions, preserving newer
server fields, unrelated decisions, and SSE-added captures.
- Replace copied implementations and internal mocks with real HTTP,
filesystem, image, SDK, CLI, SSE, and packed-package workflows. Remove
redundant cases and unused fixtures, share normal/watch discovery, and
enforce pure contract dependencies and shared-code boundaries.

## Evidence

The full Node suite passes 1,909 tests with six existing skips on both
Node 22 and Node 24: 149 fewer cases than the base. All 98
desktop/mobile browser cases pass with two existing skips at the normal
limits. Build, architecture, lint, formatting, and published types pass.

Test-first regressions reproduced stale rollback losing a new capture,
refresh using an unrelated saved session, unfinished builds after setup
failure, success after failed report writes, missing workspace images,
and a logged-out cloud route returning 500. The package workflow checks
all four public entrypoints, errors/output, bundled guidance, daemon
capture/assets, and static HTML without source files. Interactive
setup/update workflows verify executable paths through a simulated
installation.

The final six-area simplifier review found no remaining verified
behavior regressions. Manual QA used the packed package without source:
interactive/quick setup, captures/matches/diffs, offline review, local
Context, daemon lifecycle/assets, child exit codes, controlled
cloud-command/device-login workflows, SDK lifecycle and CommonJS/ESM
imports, and real configured plugins under Node 22 and 24.

The architecture check's clean-checkout failure is fixed in merged #387.
This branch is rebased onto main with the Dependabot-only policy from
#389; the tested source tree is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant