Skip to content

refactor(cli): replace shell scripts with Node.js entrypoint#260

Merged
jlia0 merged 3 commits intomainfrom
jlia0/railway-template
Mar 25, 2026
Merged

refactor(cli): replace shell scripts with Node.js entrypoint#260
jlia0 merged 3 commits intomainfrom
jlia0/railway-template

Conversation

@jlia0
Copy link
Copy Markdown
Collaborator

@jlia0 jlia0 commented Mar 25, 2026

Description

Replace all bash shell scripts (lib/) with pure Node.js modules, centralizing process management into packages/main/src/index.ts. This eliminates runtime dependencies on tmux, jq, curl, and bash, and adds Docker support with a multi-stage Dockerfile.

Changes

  • Add packages/main/src/heartbeat.ts — heartbeat as setInterval + fetch(), replacing lib/heartbeat-cron.sh
  • Add packages/main/src/channels.ts — channel spawner using child_process.fork(), replacing logic from lib/daemon.sh
  • Wire both into packages/main/src/index.ts startup/shutdown lifecycle
  • Rewrite packages/cli/bin/tinyagi.mjs — replace delegateToBash() with native PID-file process management for start/stop/restart/status
  • Add Dockerfile (multi-stage), docker-compose.yml, .dockerignore for container deployment
  • Update scripts/bundle.sh and scripts/install.sh to remove lib/ references
  • Update README.md — remove tmux/jq prerequisites, remove attach command, update directory structure
  • Delete lib/ directory (tinyagi.sh, daemon.sh, heartbeat-cron.sh, common.sh, update.sh)

Testing

  • npm run build compiles successfully with no errors
  • All CLI commands preserved: start, stop, restart, status, agent, team, channel, provider, logs, etc.

Checklist

  • PR title follows conventional commit format (type(scope): description)
  • I have tested these changes locally
  • My changes don't introduce new warnings or errors
  • I have updated documentation if needed

jlia0 and others added 3 commits March 25, 2026 22:16
Centralize all process management into packages/main/src/index.ts,
eliminating the dependency on tmux, jq, curl, and bash shell scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
scripts/bundle.sh was deleted on main; accept deletion since our
lib/ reference cleanup is no longer needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add /api/status endpoint returning server uptime, channel status, and
heartbeat info. Add /api/services/channel/:id/start|stop|restart for
managing individual channels via API. CLI start now shows all services,
status queries live system state (queue, channels, heartbeat), and
channel start/stop/restart commands work via the API. Print ASCII banner
on every CLI command.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jlia0 jlia0 merged commit 39d0e18 into main Mar 25, 2026
@jlia0 jlia0 deleted the jlia0/railway-template branch March 25, 2026 19:26
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