refactor: split CLI/runtime internals and add internal libatch.a build target#31
Open
daywiss wants to merge 8 commits intomobydeck:mainfrom
Open
refactor: split CLI/runtime internals and add internal libatch.a build target#31daywiss wants to merge 8 commits intomobydeck:mainfrom
daywiss wants to merge 8 commits intomobydeck:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)