Skip to content

feat(cli): What's New banner and task-grouped menu#21

Merged
alxxjohn merged 2 commits into
mainfrom
whats-new
Jul 1, 2026
Merged

feat(cli): What's New banner and task-grouped menu#21
alxxjohn merged 2 commits into
mainfrom
whats-new

Conversation

@alxxjohn

@alxxjohn alxxjohn commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What & why

Running codeguard with no args (or help) previously printed a plain wall of flag signatures. This adds a What's New banner and reformats the command list into a task-grouped menu, both styled in codeguard's devr blue.

What's New banner

  • Current version + a "update available" notice when a newer GitHub release exists.
  • A few highlights parsed from the latest CHANGELOG.md section (stays in sync with release-please automatically).
  • Update check is cached + opt-out: at most once per 24h (cached under os.UserCacheDir()/codeguard/update-check.json), disabled when CODEGUARD_NO_UPDATE_CHECK is set or $CI is present, uses the SSRF-guarded ai/safehttp client with a 1.5s timeout, and fails silent when offline.

Menu

  • Commands grouped by task (Get started / Scan & baseline / Fix & report / Rules & policy / Serve & diagnose), aligned columns, one-line descriptions.
  • Dense per-command flag signatures moved to codeguard <command> -h; a compact "Common flags" block remains.

Styling

  • devr blue (RGB 37,169,255, matching report/text_banner.go) via shared whatsnew.Blue/BlueBold/Faint helpers.
  • Color only on a real terminal; honors NO_COLOR / TERM=dumb and stays plain text when piped or redirected (cleaner than the report package, which always emits ANSI).

Bug fix (separate commit)

internal/version.Number was a const, but the linker's -X flag only sets vars — so .goreleaser.yaml's version injection was a silent no-op and every released binary reported 0.1.0. Changed to var; codeguard version and the banner now report the injected tag.

Tooling

  • make menu previews the banner + menu with the real release version (from .release-please-manifest.json), and shows how to disable the update check.

Preview

╭────────────────────────────────────────────────────────────╮
  codeguard v0.6.1 (latest)
  What's new in v0.6.1 (2026-07-01):
    • security: harden untrusted-input handling and wire lint cleanup
╰────────────────────────────────────────────────────────────╯
codeguard — code quality, design, security, CI, and prompt-safety checks for your repository.

Usage: codeguard <command> [flags]

  GET STARTED
    init            Create a codeguard config file
    ...
  Common flags
    -config         Path to a config file or directory
    ...
Run codeguard <command> -h to see all flags for a command.

Knowledge captured

  • .claude/knowledge/architecture-boundaries.md: notes that the usage menu makes one cached, opt-out outbound call, and the module-root go:embed constraint for CHANGELOG.md.

Testing

  • go build ./..., go vet ./..., gofmt -l — clean
  • golangci-lint run — 0 issues
  • go test ./... — all pass (added parsing, semver, cache, GitHub fetcher (httptest), color, and menu-structure tests)

🤖 Generated with Claude Code

alxxjohn and others added 2 commits July 1, 2026 12:03
The linker's -X flag only sets string vars, not consts, so
.goreleaser.yaml's version injection was a silent no-op and released
binaries always reported 0.1.0. Switching const -> var restores the
version stamp for `codeguard version` and the new banner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Running `codeguard` with no args (or `help`) now shows a devr-blue
banner with the current version, an upstream update notice, and the
latest CHANGELOG highlights, followed by a task-grouped, aligned command
menu that replaces the previous flag-signature dump.

- internal/whatsnew: parse latest CHANGELOG section, semver compare,
  banner render, and a cached (24h) opt-out GitHub release check using
  the SSRF-guarded safehttp client; disabled under CI / NO_COLOR-aware
  styling that stays plain when output is redirected.
- CHANGELOG.md is embedded via a module-root package (go:embed cannot
  reach up a directory).
- internal/cli/menu.go: grouped command menu; per-command flags moved to
  `codeguard <command> -h`.
- make menu: preview the banner + menu with the real release version.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alxxjohn alxxjohn merged commit 45e56f7 into main Jul 1, 2026
11 checks passed
@alxxjohn alxxjohn deleted the whats-new branch July 1, 2026 17:25
alxxjohn added a commit that referenced this pull request Jul 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.7.0](v0.6.1...v0.7.0)
(2026-07-02)


### Features

* **cli:** add What's New banner and task-grouped menu
([c1df999](c1df999))
* **cli:** What's New banner and task-grouped menu
([#21](#21))
([45e56f7](45e56f7))
* execute checks-improvement plan tiers 1-6
([733862f](733862f))
* **parsers:** tree-sitter TypeScript engine behind parsers.treesitter
flag
([5d09161](5d09161))


### Bug Fixes

* **ci:** extract version from var Number in homebrew validation
([01d7a24](01d7a24))
* **ci:** extract version from var Number in homebrew validation
([#23](#23))
([ec21f3b](ec21f3b))
* **version:** make Number a var so ldflags injection works
([6b1ccad](6b1ccad))


### Performance Improvements

* **scan:** parse/read files once, parallelize sections, scope cache
([d181a4f](d181a4f))
* **scan:** parse/read files once, parallelize sections, scope cache
([#24](#24))
([c79d9ec](c79d9ec))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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