Skip to content

feat(cli): turn the front door into a cobra CLI - #6

Merged
joaorufino merged 2 commits into
mainfrom
feat/cobra-cli
Jul 25, 2026
Merged

feat(cli): turn the front door into a cobra CLI#6
joaorufino merged 2 commits into
mainfrom
feat/cobra-cli

Conversation

@joaorufino

Copy link
Copy Markdown
Contributor

Summary

Turns the front door into a small cobra CLI. Running with no subcommand still serves, so the published quickstart (go run github.com/septagon-oss/platformkit@latest) is unchanged.

  • serve (or no subcommand): --addr, -p/--port, -c/--config, --env, --db-dsn, --admin-email, --admin-password; precedence defaults → config.yaml → environment → flags
  • version [--json]: release version from build info + API contract version, single-sourced
  • modules [--json] / openapi: compose the real app against a throwaway in-memory database — no ./pk.db side effects
  • config init: commented, fail-closed production config.yaml template that round-trips the strict parser (test-enforced; admin_password ships commented out on purpose)
  • New env vars PK_ADMIN_EMAIL / PK_ADMIN_PASSWORD seed the administrator without a config file

Verification

  • make release-check passes end to end (fmt, vet, staticcheck, tests, race, 84% coverage vs 40% floor, govulncheck, gosec clean)
  • Live smoke: serve -p 18101 answered /healthz 200 and shut down cleanly on SIGTERM
  • Zero-config boot, config-file discovery, and fail-closed production semantics all covered by tests

🤖 Generated with Claude Code

jprufino and others added 2 commits July 25, 2026 18:58
Running with no subcommand still serves, so the published quickstart
(go run github.com/septagon-oss/platformkit@latest) is unchanged.

- serve: --addr/--port/--config/--env/--db-dsn/--admin-email/--admin-password
  flags; precedence defaults → config.yaml → environment → flags
- version [--json]: release + API contract version from the build info
- modules [--json] / openapi: compose the real app against a throwaway
  in-memory database — no ./pk.db side effects
- config init: commented, fail-closed production config.yaml template that
  round-trips the strict parser (test-enforced)
- new env vars PK_ADMIN_EMAIL / PK_ADMIN_PASSWORD seed the administrator
  without a config file

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Keeps pk-apps v0.10.0 from the 0.9.0 release, adds cobra, and files the
CLI changelog entry under 0.10.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joaorufino
joaorufino merged commit af62049 into main Jul 25, 2026
5 checks passed
@joaorufino
joaorufino deleted the feat/cobra-cli branch July 25, 2026 19:46
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.

2 participants