Skip to content

feat: automatic development hot reload watcher - #22

Merged
HMH-3080 merged 1 commit into
Arab-Open-Source:mainfrom
HMH-3080:issue-3-development-hot-reload
Oct 24, 2026
Merged

HMH-3080 merged 1 commit into
Arab-Open-Source:mainfrom
HMH-3080:issue-3-development-hot-reload

Conversation

@HMH-3080

Copy link
Copy Markdown
Contributor

Summary

Implements a built-in Development Hot Reload system (Altair::CLI::Watcher) for Altair applications, directly resolving #3.

Features

  • Automatic file watching: Monitors src/, views/ and config/ by default.
  • Smart debouncing: Gathers rapid successive file modifications within a configurable delay window (200ms default) before triggering a single rebuild.
  • Fail-safe compilation recovery: Builds to isolated binary targets (.altair/bin/server_a and server_b). If compilation fails, the previous server process continues running without interruption, and formatted diagnostics are rendered inline.
  • Seamless restart: Gracefully restarts the server only after a successful compilation, verifying socket readiness before printing ready status.
  • CLI options:
    • -p, --port PORT
    • -b, --bind HOST / -h, --host HOST
    • -e, --env ENV
    • -w, --watch (enabled by default in development)
    • --no-watch (disables watcher, runs server in-process)
    • --delay DURATION (e.g. 200ms, 500ms, 1s)
    • --entry PATH (explicit entrypoint)
  • Configuration: Fully configurable via config.reload as well as file-based config/altair.yml or config/watch.yml.
  • Ignore list: Excludes .git/, lib/, bin/, tmp/, log/, node_modules/, .altair/, sqlite database files (.db, .sqlite3, .db-wal, .db-shm, .db-journal), and editor swap files.

Verification

  • crystal spec: 1049 examples passing (0 failures, 0 errors, 36 pending).
  • crystal tool format --check src spec examples: Clean.
  • Ameba linter: Silent on framework sources and specs.

Closes #3

Implements automatic source code reloading in development mode.
Watches source directories, debounces rapid edits, rebuilds the
application into isolated binary targets, and restarts the server
only after a successful build. Keeps the previous server running
uninterrupted on compilation failures while rendering compiler
diagnostics. Adds CLI flags (-p, -b, -e, -w, --no-watch, --delay,
--entry) and config.reload settings.

Closes Arab-Open-Source#3
@HMH-3080
HMH-3080 merged commit 8ae023d into Arab-Open-Source:main Oct 24, 2026
2 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.

Automatic Code Reloading in Development

1 participant