Skip to content

Commit 22e3d90

Browse files
authored
Merge pull request #24 from andreagrandi/align-go-install-path
Align Go install path with mb-cli binary name
2 parents 1a0c682 + 6191182 commit 22e3d90

8 files changed

Lines changed: 12 additions & 11 deletions

File tree

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ before:
88
- go generate ./...
99

1010
builds:
11-
- main: ./cmd/mb/main.go
11+
- main: ./cmd/mb-cli/main.go
1212
binary: mb-cli
1313
env:
1414
- CGO_ENABLED=0

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Do not start work from an old feature branch unless the user explicitly asks to
1616
mb-cli follows the standard Go project layout:
1717
```
1818
mb-cli/
19-
├── cmd/mb/main.go # Application entry point
19+
├── cmd/mb-cli/main.go # Application entry point
2020
├── internal/
2121
│ ├── cli/ # CLI command implementations (Cobra)
2222
│ ├── client/ # Metabase API client
@@ -29,7 +29,7 @@ mb-cli/
2929

3030
## Build/Test Commands
3131

32-
- `make build` - Build binary to bin/mb
32+
- `make build` - Build binary to bin/mb-cli
3333
- `make test` - Run all tests
3434
- `make test-verbose` - Run tests with verbose output
3535
- `make fmt` - Format code with gofmt

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Add `MB_SESSION_TOKEN` as an alternative authentication method for users without admin access to mint an API key; mutually exclusive with `MB_API_KEY` (#9)
66
- Document changelog update workflow in `AGENTS.md` and add a pull request template prompting contributors to update `CHANGELOG.md` for user-visible changes (#20)
7+
- Move main package to `cmd/mb-cli` so `go install github.com/andreagrandi/mb-cli/cmd/mb-cli@latest` produces an `mb-cli` binary that matches the documented command name (#10)
78

89
## [0.2.0] - 2026-03-12
910

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
BINARY_NAME := mb-cli
44
BUILD_DIR := bin
5-
MAIN_PKG := ./cmd/mb
5+
MAIN_PKG := ./cmd/mb-cli
66
MODULE := github.com/andreagrandi/mb-cli
77

88
all: build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Download the latest release from the [releases page](https://github.com/andreagr
2020
### Go install
2121

2222
```bash
23-
go install github.com/andreagrandi/mb-cli/cmd/mb@latest
23+
go install github.com/andreagrandi/mb-cli/cmd/mb-cli@latest
2424
```
2525

2626
## Configuration
File renamed without changes.

mb-cli-plan.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ All endpoints used by this CLI. Despite some being POST, they are all **read-onl
6262

6363
```
6464
mb-cli/
65-
├── cmd/mb/main.go # Entry point
65+
├── cmd/mb-cli/main.go # Entry point
6666
├── internal/
6767
│ ├── cli/ # Cobra commands
6868
│ │ ├── root.go # Root command, global flags
@@ -139,7 +139,7 @@ Set up Go module, entry point, config loading, root CLI, and version command.
139139

140140
**Files to create:**
141141
- `go.mod` — module `github.com/andreagrandi/mb-cli`, Go 1.25
142-
- `cmd/mb/main.go` — calls `cli.Execute()` (pattern from sentire `cmd/sentire/main.go`)
142+
- `cmd/mb-cli/main.go` — calls `cli.Execute()` (pattern from sentire `cmd/sentire/main.go`)
143143
- `internal/version/version.go``var Version = "dev"` (injected via ldflags at build)
144144
- `internal/config/config.go``LoadConfig()` reads `MB_HOST` and `MB_API_KEY` from env vars; returns error if either is missing (pattern from sentire `internal/config/config.go`)
145145
- `internal/cli/root.go` — Cobra root command with persistent flags: `--format` (json/table, default json), `--verbose`
@@ -386,7 +386,7 @@ Configure multi-platform release builds and homebrew tap.
386386
- `.goreleaser.yaml` (modeled on logbasset `.goreleaser.yaml`):
387387
- Project name: `mb-cli`
388388
- Binary name: `mb-cli`
389-
- Entry: `./cmd/mb/main.go`
389+
- Entry: `./cmd/mb-cli/main.go`
390390
- CGO_ENABLED=0
391391
- Platforms: linux (amd64/arm64), darwin (amd64/arm64), windows (amd64, no arm64)
392392
- ldflags: `-s -w -X github.com/andreagrandi/mb-cli/internal/version.Version={{.Version}}`
@@ -500,7 +500,7 @@ type commandSchema struct {
500500

501501
**Files to modify:**
502502
- `internal/cli/root.go` — add `--error-format` flag, wire it into error handling
503-
- `cmd/mb/main.go` — structured error handler that checks format
503+
- `cmd/mb-cli/main.go` — structured error handler that checks format
504504

505505
**Tests:** `tests/error_format_test.go` — verify JSON error output on stderr for config error, API error
506506

@@ -725,6 +725,6 @@ mb-cli version # Show version
725725
| `context` embedded doc (go:embed) | logbasset PR #33 | `internal/cli/context.go` + `context_embed.md` |
726726
| `schema` JSON introspection | logbasset PR #33 | `internal/cli/schema.go` |
727727
| TTY auto-detection | logbasset PR #33 | `internal/cli/tty.go` |
728-
| `--error-format json` on stderr | logbasset PR #33 | `internal/cli/root.go`, `cmd/mb/main.go` |
728+
| `--error-format json` on stderr | logbasset PR #33 | `internal/cli/root.go`, `cmd/mb-cli/main.go` |
729729
| Input hardening (control chars) | logbasset PR #33 | `internal/validation/validation.go` |
730730
| `--fields` for context window savings | logbasset PR #33 | `internal/cli/query.go`, `internal/formatter/json.go` |

tests/cli_test_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
func runMBCLI(t *testing.T, env map[string]string, args ...string) (string, string, error) {
1111
t.Helper()
1212

13-
cmdArgs := append([]string{"run", "./cmd/mb"}, args...)
13+
cmdArgs := append([]string{"run", "./cmd/mb-cli"}, args...)
1414
cmd := exec.Command("go", cmdArgs...)
1515
cmd.Dir = ".."
1616

0 commit comments

Comments
 (0)