realize

module
v0.0.0-...-f608c71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: GPL-3.0

README

Realize

#1 Golang live reload and task runner

⚠️ This project was rewritten by AI (Claude Sonnet 4.6 by Anthropic). The original code from oxequa/realize was reorganized into decoupled packages, with circular dependencies resolved and structure aligned with Go conventions.


Installation

go install github.com/infezek/realize/cmd/realize@latest

Or clone and build:

git clone https://github.com/infezek/realize.git
cd realize
go install ./cmd/realize/

Requirement: Go 1.14+ and $GOPATH set.


What it does

Realize watches your Go project files and automatically recompiles/restarts when it detects changes. It supports multiple projects simultaneously, custom commands before/after each reload, and an optional web UI.


Quickstart

From your Go project root:

realize start

Creates a .realize.yaml with the current directory as the project and starts the watcher. Press Ctrl+C to stop.


Commands

start — Start the watcher
realize start [flags]
Flag Short Description
--path -p Project base path (default: .)
--name -n Run a specific project from config
--fmt -f Enable go fmt
--vet -v Enable go vet
--test -t Enable go test
--generate -g Enable go generate
--install -i Enable go install
--build -b Enable go build
--run -nr Enable go run
--server -srv Enable web UI
--open -op Open web UI in browser
--legacy -l Use polling instead of fsnotify
--no-config -nc Ignore existing config

Examples:

# Start with defaults
realize start

# Run project at custom path with go run
realize start --path="./myapp" --run

# Run with fmt, vet and test enabled, no config file
realize start --fmt --vet --test --no-config

# Run a specific project from config
realize start --name="api"

# Pass arguments to the project binary (must come last)
realize start --run --path="./cmd/api" -- --port=8080 --debug
add — Add a project to config
realize add [flags]

Supports the same flags as start (except --name, --server, --open, --legacy, --no-config).

realize add --path="./services/worker" --build --run
init — Interactive step-by-step setup
realize init

Interactive wizard to configure projects, commands, watch paths, environment variables and custom scripts.

remove — Remove a project from config
realize remove --name="myproject"
clean — Remove config file
realize clean

Removes .realize.yaml from the current directory.

version — Print version
realize version

Config file

Realize uses .realize.yaml at the project root. Full example:

settings:
  legacy:
    force: false          # true = use polling instead of fsnotify
    interval: 100ms       # polling interval
  files:
    outputs:
      status: true
      name: .r.outputs.log
    logs:
      status: true
      name: .r.logs.log
    errors:
      status: true
      name: .r.errors.log

server:
  status: false           # enable web UI
  open: false             # auto-open browser
  host: localhost
  port: 5002

schema:
  - name: myapp
    path: .               # project path
    env:                  # environment variables
      PORT: "8080"
      DEBUG: "true"
    args:                 # arguments passed to the binary
      - --verbose
    commands:             # enabled Go tools
      fmt:
        status: true
        args: [-s, -w, -e]
      vet:
        status: true
      test:
        status: false
      generate:
        status: false
      install:
        status: true
      build:
        status: false
        args: [-race]
      run:
        status: true
    watcher:
      paths:              # watched paths (relative to project path)
        - /
      ignored_paths:      # ignored paths
        - vendor
        - .git
      extensions:         # watched file extensions
        - go
      scripts:            # custom commands
        - type: before    # runs before each reload
          command: echo "reloading..."
          output: true
        - type: after     # runs after each reload
          command: go mod tidy
          output: false
        - type: before    # global = runs once at startup
          command: echo "started"
          global: true
          output: true
    pattern: ""           # custom regex to detect errors
Multiple projects
schema:
  - name: api
    path: ./services/api
    commands:
      run:
        status: true
    watcher:
      paths: [/]
      extensions: [go]

  - name: worker
    path: ./services/worker
    commands:
      install:
        status: true
      run:
        status: true
    watcher:
      paths: [/]
      extensions: [go]

Web UI

realize start --server --open

Opens at http://localhost:5002. Displays real-time output, logs and errors for all projects. Allows editing config through the UI.


Terminal color reference

Color Meaning
🔵 Blue Project output
🔴 Red Errors
🟣 Purple Changed files / elapsed time
🟢 Green Successfully completed actions

Architecture

Rewritten with clear separation of concerns:

cmd/
├── realize/     # entry point, Realize struct, CLI commands
├── config/      # Settings, constants, utilities
├── runner/      # Project, Schema, Tools — execution engine
├── server/      # Web server (echo + websocket)
├── style/       # Terminal colors
└── watcher/     # FileWatcher (fsnotify + polling)

Circular dependencies eliminated via:

  • Project.parent replaced by SetHooks(Hooks) with function callbacks
  • Tool.parent replaced by logRecovery bool injection in Setup
  • Server.Parent replaced by the ServerApp interface

Development

# Run tests
go test ./cmd/...

# Build
go build ./cmd/realize/

# Install locally
go install ./cmd/realize/

License

MIT — see LICENSE.


Rewritten by Claude Sonnet 4.6 based on the original project oxequa/realize.

Directories

Path Synopsis
cmd
realize command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL