This document is the project-specific operating manual for AI coding agents working in govard.
Govard is a Go-based local development orchestrator for PHP and web projects (Magento, Laravel, Symfony, WordPress, etc.), with:
- CLI orchestration (
govard ...) - Container runtime automation (Docker)
- Blueprint/template rendering
- Remote environment tooling
- SSL/proxy utilities
- Wails-based Desktop GUI Application (
govard desktop)
Primary goals for contributions:
- Preserve CLI stability and predictable behavior.
- Keep workflows fast for local developers.
- Avoid regressions in core command families (bootstrap/proxy/db/sync/remote/lock/domain/desktop).
- Maintain UI reliability and backend bridge logic for the Desktop App.
- Maintain release quality (GoReleaser, checksums, install paths).
- Go:
1.25+(module usesgo 1.25.0) - Node.js:
20(for frontend UI and frontend tests) - Wails:
v2.11+(for desktop app development) - Docker: required for integration tests and runtime orchestration
- GitHub CLI (
gh): useful for release inspection (optional)
Local sanity checks:
go version # If not in PATH, check /home/$USER/go_dist/go/bin/go
node --version
wails version
docker --versioncmd/govard/main.go: CLI entrypointcmd/govard-desktop/: Desktop app entrypoint (built by Wails)desktop/: Wails desktop app codebase (Go backend bridge + HTML/vanilla JS frontend indesktop/frontend/)wiki/: Project documentation (GitHub Wiki source files, synced automatically on push)internal/cmd/: Cobra command implementationsinternal/engine/: orchestration, config, blueprint logicinternal/engine/bootstrap/: framework bootstrap workflowsinternal/engine/remote/: remote sync/deploy/ssh helpersinternal/proxy/: caddy/proxy route and TLS helpersinternal/updater/: update-check notification logicinternal/ui/: terminal rendering helperstests/: unit/contract tests (default location for tests)tests/integration/: integration tests (tagged and heavier)tests/frontend/: Node test runner suite for frontend piecesinstall.sh: unified installer (release binary by default,--sourcefor source build)scripts/build-macos-pkg.sh: helper script to build macOS.pkginstaller artifacts.goreleaser.yml: release artifact config.github/workflows/: CI/release/security automation
Preferred commands:
make test # lint + fmt-check + vet + frontend + unit + integration tests
make test-unit # unit tests only
make test-integration # integration tests (requires build + docker)
make vet # go vet
make fmt # go fmt ./...
make build # build Govard for the current platformUseful direct commands:
go test ./...
go test ./tests/... -v
go test -tags integration ./tests/integration/... -v -timeout 30mKey workflows:
ci-pipeline.yml: vet + gofmt check + fast tests + integration + binary buildrelease.yml: triggered by tagv*.*.*, runs GoReleaser and uploads macOS.pkginstallerscodeql.yml: code scanninggovulncheck.yml: weekly vulnerability scan
Do not assume local success if you skipped:
- formatting (
gofmt -s -w/make fmt) - tests relevant to changed surface
- at least one command-level smoke check for CLI behavior changes
Project convention is to keep most tests in tests/ package tests.
Test isolation and fixture hygiene rules:
- Keep tests hermetic: do not rely on the user's real projects, real containers, or machine-specific state.
- Do not use real/legacy project fixture names (for example
magento2-test-instance); use neutral fixtures such assample-project. - Prefer mocks/fakes over live network dependencies in unit tests (for HTTP, inject client/transport and use a mock
RoundTripper). - Ensure test suites isolate state via temporary
GOVARD_HOME_DIR(useTestMainsetup where appropriate). - If an integration test must touch external services, gate it with explicit env checks and clear skip reasons.
When you need to test internal logic from internal/cmd (or other internal packages):
- keep production helpers unexported where possible
- add narrow exported wrappers suffixed with
ForTest(example:BuildLocalDBResetScriptForTest) - consume those wrappers from test files in
tests/
Example pattern:
- production function:
buildThing(...) - test wrapper:
BuildThingForTest(...) - test location:
tests/thing_test.go
Avoid broad export of internals just for tests.
internal/cmd/root.go owns root registration and Version binding.
When adding/modifying a command:
- define command in
internal/cmd/<area>.go - register with
rootCmd.AddCommand(...)(or relevant subcommand group) - ensure flags are explicit and help text is actionable
- return errors with context (
fmt.Errorf("operation: %w", err)) - add/adjust tests in
tests/ - update docs for user-visible command/flag changes
For update/release-sensitive commands:
- confirm asset naming matches
.goreleaser.yml - verify checksums where possible
- avoid assuming
sudoavailability
Current release artifacts include:
- CLI archives from GoReleaser:
- non-Windows:
govard_<version>_<OS>_<arch>.tar.gz - Windows:
govard_<version>_<OS>_<arch>.zip
- non-Windows:
- Linux installer (GoReleaser nfpm):
govard_<version>_linux_<arch>.deb- includes both
govardandgovard-desktop
- includes both
- macOS installer (release workflow):
govard_<version>_Darwin_<arch>.pkg- includes both
govardandgovard-desktop
- includes both
- Checksum file:
checksums.txt
install.sh: unified installer (download release binary by default,--sourcefor source build)scripts/build-macos-pkg.sh: macOS package artifact builder used by release workflow
govard self-update should:
- resolve target version (explicit or latest)
- resolve platform-specific artifact name
- download archive and checksum
- verify SHA-256
- extract binary
- atomically replace executable (or fail with clear permissions guidance)
- Always run
gofmtafter Go edits. - Keep code ASCII unless file already requires Unicode.
- Prefer small pure helpers for parsing/formatting logic.
- Keep platform branching explicit (
runtime.GOOS,runtime.GOARCH). - Do not swallow errors silently for critical flows (network, file, process).
- Preserve existing UX tone from
ptermoutput and command help strings.
- Avoid adding dependencies unless required by measurable benefit.
- Prefer Go stdlib for HTTP, archive, hash, file operations.
- Never log secrets, tokens, private keys, or DB passwords.
- For remote/ssh/db commands, keep safe defaults and explicit opt-in for write ops.
Update README.md when changes affect:
- installation
- upgrade/update flow
- command names/flags
- release consumption
Update the canonical wiki pages in wiki/ when changes affect:
- command names, aliases, or flags
- configuration behavior or layering
- remote/sync/db workflows
- framework support or runtime defaults
- desktop behavior or desktop testing workflow
If behavior changed and wiki is stale, treat as incomplete work.
When documenting commands that accept remote filesystem paths:
- prefer absolute remote paths in shell examples (for example
/var/www/app) - if using remote-home shorthand, quote it (
'~/public_html') so the local shell does not expand it before Govard receives the flag
- Keep commits focused by concern (installer, command logic, tests, docs).
- Do not revert unrelated working-tree changes.
- Avoid destructive git operations unless explicitly requested.
- Include test evidence in PR/hand-off notes.
- Read impacted files and nearby tests.
- Identify minimal change set.
- Implement with small helpers and clear errors.
- Add/adjust tests in
tests/. - Run formatting and targeted tests.
- Run broader suite as needed (
make testorgo test ./...). - Update
README.mdand the relevant canonicalwiki/*.mdfiles if user-facing behavior changed. - Summarize file-level changes and verification evidence.
Before declaring done:
go teston affected scope passes.- No formatting drift (
gofmt -s -l .should be empty for changed Go files). - Command help/flags still coherent.
README.mdand relevant canonicalwiki/*.mdfiles updated for user-visible changes.git statusreviewed for unintended file changes.
- CI tracks
main,master, anddevelop. - Default branch currently appears as
masterin this repo. - Release tags follow semantic style
vX.Y.Z. - Integration tests rely on built binary (
bin/govard-test) and Docker.
When uncertain, prefer compatibility and least-surprise behavior over broad refactors.
To launch the desktop app with the real Go backend connecting to local Docker projects, run Wails dev mode. Critically, in AI headless environments, provide a display server to prevent Wails from crashing:
DISPLAY=:1 govard desktop --devThis uses wails dev -tags desktop under the hood, compiling the backend and serving the frontend.
When the dev server is successfully running (it may take 10-20 seconds to compile), it exposes the frontend at:
http://localhost:34115
This is the mandatory approach for agents to test the real desktop UI.
- Navigate to
http://localhost:34115in the browser tool. - You will see live, actual projects from the user's Docker environment, not dummy templates.
| Path | Purpose |
|---|---|
desktop/frontend/index.html |
Main HTML entry |
desktop/frontend/main.js |
Bootstrap, event wiring, tab/state mgmt |
desktop/frontend/services/bridge.js |
Wails Go backend RPC bridge |
desktop/frontend/state/store.js |
UI state (selected project, filters) |
desktop/frontend/modules/ |
Feature modules (dashboard, logs, etc) |
desktop/frontend/ui/toast.js |
Toast notification system |
desktop/frontend/utils/dom.js |
Shared DOM helpers |
- When accessed via Wails dev (
localhost:34115): full backend bridge is active, real project data is loaded. - When opened directly as a file (no backend): the bridge is unavailable and fallback mock data (
safeDashboardinmain.js) is used. A warning toast appears.
Desktop UI test plans and results should be stored in wiki/Desktop-App.md or a dedicated wiki/desktop-testing.md file.
When performing a new release, ensure the version string is updated in the following locations:
- CLI Version:
internal/cmd/root.go(var Version) - Desktop Backend Version:
internal/desktop/app.go(var Version) - Desktop Frontend Version:
desktop/frontend/package.json("version") - Wails Config Version:
desktop/wails.json("info": { "productVersion" }) - Changelog:
CHANGELOG.md(Add new version section with date and changes)
Verification before release:
- Run
make testto ensure all tests pass. - Build and check version:
make build && ./bin/govard version.