Skip to content

Commit 0ed1c79

Browse files
authored
Merge pull request #1 from AzraelSec/chore/add-agents-and-vet-fix
Improve agent guidance and enforce clean Go CI
2 parents bea4672 + aa2af1a commit 0ed1c79

File tree

5 files changed

+54
-4
lines changed

5 files changed

+54
-4
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ jobs:
1111
- name: Setup
1212
uses: actions/setup-go@v4
1313
with:
14-
go-version: '1.21'
14+
go-version: '1.26'
15+
16+
- name: Verify go fix is clean
17+
run: |
18+
go fix ./...
19+
git diff --exit-code
1520
1621
- name: Build
1722
run: go build -v ./...

AGENTS.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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.

cmd/cli/commands/init_cmd/local.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func localCommand(dm *dependency.Manager) *cobra.Command {
4343
for i, res := range results {
4444
logger := log.NewRepoLogger(os.Stdout, cm.Repos[i].Name)
4545
if res.Error != nil {
46-
logger.Error(res.Error.Error())
46+
logger.Error("%s", res.Error)
4747
} else {
4848
logger.Success("successfully cloned")
4949
}

cmd/cli/commands/init_cmd/remote.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func remoteCommand(dm *dependency.Manager) *cobra.Command {
8383
for i, res := range results {
8484
logger := log.NewRepoLogger(os.Stdout, cm.Repos[i].Name)
8585
if res.Error != nil {
86-
logger.Error(res.Error.Error())
86+
logger.Error("%s", res.Error)
8787
} else {
8888
logger.Success("successfully cloned")
8989
}

cmd/cli/commands/reset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func resetFactory(dm *dependency.Manager) *cobra.Command {
7878
for i, res := range results {
7979
logger := log.NewRepoLogger(os.Stdout, cm.Repos[i].Name)
8080
if res.Error != nil {
81-
logger.Error(res.Error.Error())
81+
logger.Error("%s", res.Error)
8282
} else {
8383
logger.Success("Came back home 🏠")
8484
}

0 commit comments

Comments
 (0)