Skip to content

cli: improve maintainability of baudbot dispatcher#108

Merged
benvinegar merged 1 commit into
mainfrom
bentlegen/cli-maintainability-refactor
Feb 21, 2026
Merged

cli: improve maintainability of baudbot dispatcher#108
benvinegar merged 1 commit into
mainfrom
bentlegen/cli-maintainability-refactor

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • split bin/baudbot into a lean dispatcher + extracted runtime helper module (bin/lib/baudbot-runtime.sh)
  • keep bootstrap compatibility by handling missing runtime helper with explicit fallback error stubs
  • add focused CLI tests in bin/baudbot.test.sh and wire them into test/shell-scripts.test.mjs
  • document bin/lib/ layout updates in AGENTS.md

Validation

  • npm run test:shell
  • bash bin/update-release.test.sh
  • bash bin/rollback-release.test.sh

Notes

  • bin/baudbot reduced from 958 LOC to 492 LOC
  • command/help behavior remains backward compatible

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Feb 21, 2026

Greptile Summary

Refactored the bin/baudbot CLI dispatcher by extracting 466 LOC of runtime/status/session/attach helpers into a separate module (bin/lib/baudbot-runtime.sh), reducing the main dispatcher from 958 to 492 LOC. The changes improve maintainability while preserving backward compatibility through fallback stubs when the runtime helper is missing.

Key improvements:

  • Extracted runtime helpers (cmd_status, cmd_logs, cmd_sessions, cmd_attach) and supporting functions to dedicated module
  • Added comprehensive CLI test suite (bin/baudbot.test.sh) with 4 focused tests
  • Updated documentation (AGENTS.md) to reflect new bin/lib/ directory structure
  • Maintained graceful degradation with explicit error messages for missing runtime helper

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • Clean refactoring that extracts runtime helpers into a separate module without changing behavior. All dependencies (color variables, require_root, JSON helpers) are properly available before the runtime module is sourced. Includes comprehensive test coverage and maintains backward compatibility with fallback stubs.
  • No files require special attention

Important Files Changed

Filename Overview
AGENTS.md Documentation updated to reflect new bin/lib/ directory structure with runtime/release/JSON helper modules
bin/baudbot Refactored from 958 to 492 LOC by extracting runtime helpers to separate module with graceful fallback stubs
bin/baudbot.test.sh New focused CLI test suite covering version reading, runtime module dispatch, and root requirement enforcement
bin/lib/baudbot-runtime.sh Extracted 493 LOC of runtime/status/session/attach helpers from main dispatcher with proper function exports
test/shell-scripts.test.mjs Wired new CLI tests into unified test suite via Vitest

Last reviewed commit: 9c75e8c

@benvinegar benvinegar force-pushed the bentlegen/cli-maintainability-refactor branch from 9c75e8c to 56573fa Compare February 21, 2026 23:42
@benvinegar benvinegar merged commit ff9c90a into main Feb 21, 2026
9 checks passed
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