Skip to content

refactor(app): introduce commands/ module with layered bootstrap for subcommands#283

Merged
tcp404 merged 3 commits into
mainfrom
boii/feat-subcmd
May 16, 2026
Merged

refactor(app): introduce commands/ module with layered bootstrap for subcommands#283
tcp404 merged 3 commits into
mainfrom
boii/feat-subcmd

Conversation

@tcp404

@tcp404 tcp404 commented May 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Extract CLI definitions to cli.rs, subcommand implementations to src/commands/ directory
  • Introduce layered bootstrap (init_environmentinit_data_layerAppServices) so future subcommands can compose only the initialization they need
  • Move bridge, team_guide, team_stdio from lib.rs public modules to binary-private commands/ module
  • Refactor idle_scanner to accept configurable scan interval and use seconds-based timeout

Motivation

Preparing for upcoming CLI subcommands (e.g. agent add) that need database access but not the full HTTP server stack. The layered bootstrap pattern allows each subcommand to opt into only the initialization layers it requires.

Structure

src/
├── main.rs           # tracing setup + main() + async_main() routing
├── cli.rs            # clap definitions
├── commands/
│   ├── mod.rs        # shared bootstrap: init_environment, init_data_layer
│   ├── server.rs     # HTTP server (run_server + shutdown_signal)
│   ├── bridge.rs     # mcp-bridge
│   ├── team_guide.rs # mcp-guide-stdio
│   └── team_stdio.rs # mcp-team-stdio

tcp404 added 3 commits May 16, 2026 16:00
Extract three helpers so async_main reads as a thin dispatcher:
- resolve_work_dir: --work-dir > AIONUI_WORK_DIR env > --data-dir
- materialize_builtin_skills: builtin-skills corpus + stale dir cleanup
- run_server: full HTTP server startup/shutdown loop

async_main now matches on the parsed subcommand and delegates. No
behavioral change.
…otstrap

- Relocate bridge, team_guide, team_stdio into src/commands/ directory
- Extract init_environment (logging + config) and init_data_layer (materialize + db) as reusable bootstrap layers
- Isolate HTTP server logic into commands/server.rs
- Remove pub mod exports from lib.rs (these are binary-private modules)
- Refactor idle_scanner to accept configurable scan interval and use seconds-based timeout
`default_idle_timeout_is_5_minutes` and `scan_interval_is_60_seconds`
just asserted that two constants equal their literal definitions, so they
had no value beyond restating the source. The 5-minute test was also
already broken (asserted 300_000 against `DEFAULT_IDLE_TIMEOUT_SECS`).
@tcp404 tcp404 force-pushed the boii/feat-subcmd branch from 23df748 to eaddc5a Compare May 16, 2026 08:01
@tcp404 tcp404 enabled auto-merge (squash) May 16, 2026 08:04
@tcp404 tcp404 merged commit 1216597 into main May 16, 2026
5 checks passed
@tcp404 tcp404 deleted the boii/feat-subcmd branch May 16, 2026 08:10
This was referenced May 16, 2026
piorpua pushed a commit that referenced this pull request May 16, 2026
🤖 I have created a release *beep* *boop*
---


## [0.1.4](v0.1.3...v0.1.4)
(2026-05-16)


### Features

* **ai-agent:** log every CLI detection + add doctor subcommand
([#285](#285))
([5ef6d0a](5ef6d0a))
* **runtime:** full shell-style command in spawn logs
([#278](#278))
([dd51616](dd51616))


### Bug Fixes

* **ai-agent:** negotiate OpenClaw protocol v3..v4
([#288](#288))
([dfeece0](dfeece0))
* **team:** model routing + schema unification + lazy warm mode
persistence ([#286](#286))
([199a392](199a392))


### Performance Improvements

* **team:** lazy warm — only start agent processes on first message
([#282](#282))
([6281f31](6281f31))


### Code Refactoring

* **app:** extract CLI definitions to cli.rs
([#280](#280))
([5685d52](5685d52))
* **app:** introduce commands/ module with layered bootstrap for
subcommands ([#283](#283))
([1216597](1216597))
* **app:** replace argv sniffing with clap Subcommand for mcp-* helpers
([#277](#277))
([c3d137c](c3d137c))
* **app:** split monolithic lib.rs/main.rs into per-module files
([#284](#284))
([f3462cb](f3462cb))
* rename binary from aionui-backend to aioncli
([#289](#289))
([30eeca3](30eeca3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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