refactor(cli): extract tinyagi.mjs into modular TypeScript modules#263
Merged
refactor(cli): extract tinyagi.mjs into modular TypeScript modules#263
Conversation
Move inline daemon, channel, install, logs, and version logic from the monolithic tinyagi.mjs entrypoint into dedicated TypeScript modules under packages/cli/src/. The entrypoint is now a thin dispatcher that delegates to compiled modules via runCliScript(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Description
Extract inline logic from the monolithic
tinyagi.mjsentrypoint (847 lines) into dedicated TypeScript modules underpackages/cli/src/, reducing it to a thin ~336-line dispatcher. This improves maintainability and aligns with the existing pattern where agent, team, provider, and other commands already live in separate TypeScript modules.Changes
src/daemon.ts— daemon lifecycle:startDaemon,stopDaemon,statusDaemon,isRunning,openOfficesrc/channel.ts— channel start/stop/restart via HTTP API, delegates setup/reset to messaging modulesrc/install.ts— installation, prerequisites, onboarding (run), CLI symlink setupsrc/logs.ts— log file tailingsrc/version.ts— version display from package.jsonbin/tinyagi.mjs— rewritten as pure dispatcher usingrunCliScript()callssrc/messaging.ts— exportedchannelSetup()andchannelsReset()for use by channel moduleTesting
tinyagi --help,version,status,agent list,channel stop,logsall dispatch correctly@types/nodeissues)dist/successfullyChecklist
type(scope): description)