Skip to content

feat: add CLI commands for managing sites and services - #30

Merged
andybarilla merged 9 commits into
mainfrom
task/cli-commands
Mar 8, 2026
Merged

andybarilla merged 9 commits into
mainfrom
task/cli-commands

Conversation

@andybarilla

Copy link
Copy Markdown
Owner

Summary

  • Adds CLI subcommands to the flock binary: list, add, remove, status, start, stop
  • Auto-detects TTY for human-readable tables vs JSON output; --json flag to force JSON
  • File locking on registry for safe concurrent access between CLI and GUI
  • Single binary dispatch: no args = GUI, subcommands = CLI

Design

See docs/plans/2026-03-08-flock-cli-design.md

Test plan

  • 16 unit tests covering output formatting, command rendering, core factory
  • Concurrent registry write test (file locking)
  • Manual smoke test: flock list, flock status, flock --help, flock list --json

🤖 Generated with Claude Code

andybarilla and others added 9 commits March 8, 2026 14:28
Add Cobra dependency and CLI skeleton with root command that includes
a --json persistent flag. CLI dispatch in main.go routes to Cobra when
arguments are provided, otherwise launches the GUI as before.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap Load, Add, Remove, Update with advisory file locking (syscall.Flock)
so concurrent CLI and GUI processes don't corrupt sites.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract withFileLock into platform-specific files:
- lock_unix.go: syscall.Flock advisory locking (Linux/macOS)
- lock_windows.go: no-op stub (locking to be added later)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@andybarilla
andybarilla merged commit 94a053d into main Mar 8, 2026
3 checks passed
@andybarilla
andybarilla deleted the task/cli-commands branch March 8, 2026 20:45
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