|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Entry Points |
| 4 | +- CLI entrypoint is `cmd/cli/main.go`; it just calls `commands.ExecuteRoot()`. |
| 5 | +- User-facing subcommands live under `cmd/cli/commands/`. |
| 6 | +- Shared behavior is in `internal/`, especially `internal/config`, `internal/git`, `internal/shell`, and `internal/runner`. |
| 7 | + |
| 8 | +## Verified Commands |
| 9 | +- Build everything: `go build ./...` |
| 10 | +- Build the shipped binary: `make build` or `go build -o glock cmd/cli/main.go` |
| 11 | +- Run the CLI locally: `go run ./cmd/cli --help` |
| 12 | +- Do not use `make run`; the target still points at missing root `main.go`. |
| 13 | +- Single package test: `go test ./internal/config` |
| 14 | +- Single test: `go test ./internal/config -run TestNewConfigManagerYaml` |
| 15 | + |
| 16 | +## Verification Baseline |
| 17 | +- CI runs `go build -v ./...` then `go test -v -race -covermode atomic -coverprofile=covprofile ./...`. |
| 18 | +- Current local baseline: `go build ./...` passes. |
| 19 | +- Current local baseline: `go test ./...` passes. |
| 20 | + |
| 21 | +## Config Resolution |
| 22 | +- Config filename is hardcoded to `glock.yml`. |
| 23 | +- Config discovery is: `GLOCK_CONFIG_PATH` if set, otherwise search upward from cwd for the nearest `glock.yml`, up to 20 parent directories. |
| 24 | +- `root_path` overrides the config file directory when resolving repo paths. |
| 25 | +- Per-repo `rel_path` overrides the default repo directory; otherwise the repo key name is used as the directory name. |
| 26 | +- `root_main_stream` sets the default branch for all repos; per-repo `main_stream` overrides it. |
| 27 | + |
| 28 | +## Runtime Quirks |
| 29 | +- `start` loads env files listed in `env_filenames` for repo commands only. |
| 30 | +- `services` commands run from the directory containing `glock.yml`, not from each repo directory. |
| 31 | +- `start` starts configured services first, sleeps 5 seconds, then starts repo `on_start` commands. |
| 32 | +- `start --repos repoA --repos repoB` is the repo filter. |
| 33 | +- `switch` and `reset` refuse dirty repos unless `switch --force` is used. |
| 34 | +- `tag` requires `tag_pattern`; repos with `exclude_tag: true` are skipped. |
| 35 | +- `tag --skip-push` avoids pushing; normal push mode fails when a repo has multiple remotes. |
| 36 | + |
| 37 | +## Update Command |
| 38 | +- `update` is TUI-first by default. |
| 39 | +- For scripting/debugging, use `glock update --disableTui`; `--output` only works together with `--disableTui`. |
| 40 | +- Updater inference is lockfile-based in this order: `yarn.lock`, `package-lock.json`, `pnpm-lock.yaml`, `Gemfile.lock`/`Gemfile`, `go.mod`. |
| 41 | +- Per-repo `updater` can force a backend; `_ignore_` skips updates for that repo. |
| 42 | + |
| 43 | +## Init Command |
| 44 | +- `glock init local` clones repos from the resolved local `glock.yml`. |
| 45 | +- `glock init remote <url> [dir]` downloads the remote config into `<dir>/glock.yml` before cloning. |
0 commit comments