Skip to content

refactor: split CLI/runtime internals and add internal libatch.a build target#31

Open
daywiss wants to merge 8 commits intomobydeck:mainfrom
daywiss:feature/lib-refactor
Open

refactor: split CLI/runtime internals and add internal libatch.a build target#31
daywiss wants to merge 8 commits intomobydeck:mainfrom
daywiss:feature/lib-refactor

Conversation

@daywiss
Copy link
Copy Markdown

@daywiss daywiss commented Mar 26, 2026

Motivation

This PR modularizes internals without changing user-visible behavior, so future work can be safer and more incremental.
The goal is to improve maintainability and unlock richer session-management capabilities without compromising atch’s core design (single binary, transparent byte-stream passthrough, no terminal emulation changes).

What this enables next

By extracting reusable internal modules (paths/session resolution, command resolution, option parsing, command runtime), follow-up features can be built with lower risk and clearer boundaries, for example:

• out-of-band control primitives (switch, client targeting, etc.)
• richer session-management frontends on top of the same core behavior
• easier testing of individual subsystems
• cleaner evolution toward companion tools while keeping main atch UX stable

Scope of this PR

This PR is intentionally behavior-preserving:

• no new user-facing features
• no protocol changes
• no change to single-binary distribution (atch remains the main artifact)

libatch.a is introduced as an internal build artifact to support modularization, not as a stable public API commitment.

Summary

This PR is an internal refactor only (no intended behavior changes).

It breaks up atch.c into smaller internal modules and keeps atch as the same single binary output.
The goal is to reduce coupling and make future changes easier to reason about/test.

What changed

• Added thin entrypoint:
• main.c -> atch_cli_main(...)
• Added internal modules:
• atch_paths (session/path helpers)
• atch_session (session name expansion)
• atch_cmd (command alias resolution)
• atch_cli_opts (option parsing)
• atch_cli_runtime (command handlers/runtime helpers)
• Added internal static artifact:
• make libatch.a
• Updated Makefile/object layout accordingly.
• README note: libatch.a is internal, not a stable public API.

What did not change

• No new CLI features or flags.
• No protocol changes.
• make still produces the same atch binary for normal use/distribution.

Validation

• make passes
• smoke checks (--version, list, current) pass
• integration tests match current baseline result (same single known failure reproduced on main)

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