Build slug CLI foundation #37

Closed
opened 2026-05-19 19:51:45 -05:00 by erik · 2 comments
Owner

Goal

Create the runnable slug CLI foundation that later command groups can build on.

Spec: docs/cli-specs/00-cli-foundation.md

Requirements

  • Implement the slug executable entry point.
  • Provide help and version output.
  • Add local CLI configuration storage that can grow to multiple site profiles without a breaking migration.
  • Support storing a default site profile with API base URL and API key value or API key reference.
  • Redact secrets in config display and error output.
  • Provide shared command/output utilities for human output and JSON output.
  • Provide shared HTTP client behavior for later API-backed commands.
  • Return predictable non-zero exit codes on invalid usage, network errors, authentication errors, and API errors.
  • Follow docs/CONTRIBUTING.md and docs/CODE_STANDARDS.md.

Acceptance criteria

  • slug --help prints useful help.
  • slug --version prints the package version.
  • CLI config can store and read a default profile.
  • Secret values are redacted when config is displayed.
  • JSON output mode is available for commands that support it.
  • Invalid usage returns a non-zero exit and clear message.
  • Tests cover config read/write, secret redaction, help/version behavior, and exit behavior.
  • Relevant lint/test checks pass.

Dependencies

  • None
## Goal Create the runnable `slug` CLI foundation that later command groups can build on. Spec: `docs/cli-specs/00-cli-foundation.md` ## Requirements - Implement the `slug` executable entry point. - Provide help and version output. - Add local CLI configuration storage that can grow to multiple site profiles without a breaking migration. - Support storing a default site profile with API base URL and API key value or API key reference. - Redact secrets in config display and error output. - Provide shared command/output utilities for human output and JSON output. - Provide shared HTTP client behavior for later API-backed commands. - Return predictable non-zero exit codes on invalid usage, network errors, authentication errors, and API errors. - Follow `docs/CONTRIBUTING.md` and `docs/CODE_STANDARDS.md`. ## Acceptance criteria - [ ] `slug --help` prints useful help. - [ ] `slug --version` prints the package version. - [ ] CLI config can store and read a default profile. - [ ] Secret values are redacted when config is displayed. - [ ] JSON output mode is available for commands that support it. - [ ] Invalid usage returns a non-zero exit and clear message. - [ ] Tests cover config read/write, secret redaction, help/version behavior, and exit behavior. - [ ] Relevant lint/test checks pass. ## Dependencies - None
Author
Owner

Synced from todu comment by @todu on 2026-05-20T03:56:57.199Z

Closing Summary

PR #41 merged: #41

Acceptance criteria evidence:

  • slug --help prints useful help: met — implemented in cli/src/commands.ts, covered by tests and manual smoke.
  • slug --version prints the package version: met — implemented in cli/src/commands.ts, covered by tests and manual smoke.
  • CLI config can store and read a default profile: met — implemented in cli/src/config.ts, covered by config and command tests.
  • Secret values are redacted when config is displayed: met — config show reports apiKeyConfigured and does not print the stored API key, covered by tests.
  • JSON output mode is available for commands that support it: met — version --json and config show --json implemented and tested.
  • Invalid usage returns a non-zero exit and clear message: met — invalid usage returns exit code 2, covered by tests and manual smoke.
  • Tests cover config read/write, secret redaction, help/version behavior, and exit behavior: met — CLI test suite covers these areas.
  • Relevant lint/test checks pass: met — make check, ./scripts/pre-pr.sh, PR CI, and main push CI passed.

Readiness: READY

_Synced from todu comment by @todu on 2026-05-20T03:56:57.199Z_ ## Closing Summary PR #41 merged: https://forge.caradoc.com/erik/slugkit/pulls/41 Acceptance criteria evidence: - `slug --help` prints useful help: met — implemented in `cli/src/commands.ts`, covered by tests and manual smoke. - `slug --version` prints the package version: met — implemented in `cli/src/commands.ts`, covered by tests and manual smoke. - CLI config can store and read a default profile: met — implemented in `cli/src/config.ts`, covered by config and command tests. - Secret values are redacted when config is displayed: met — `config show` reports `apiKeyConfigured` and does not print the stored API key, covered by tests. - JSON output mode is available for commands that support it: met — `version --json` and `config show --json` implemented and tested. - Invalid usage returns a non-zero exit and clear message: met — invalid usage returns exit code `2`, covered by tests and manual smoke. - Tests cover config read/write, secret redaction, help/version behavior, and exit behavior: met — CLI test suite covers these areas. - Relevant lint/test checks pass: met — `make check`, `./scripts/pre-pr.sh`, PR CI, and main push CI passed. Readiness: READY
Author
Owner

Synced from todu comment by @todu on 2026-05-20T03:55:11.380Z

PR Review: Approved

PR: #41

Summary

Reviewed PR #41 at commit 757658f. The PR adds the @slugkit/cli workspace, wires the slug executable, implements help/version/config commands, adds future-ready profile config storage, redacts configured API keys from displayed config, adds JSON output support, defines shared CLI exit codes/errors/output helpers, adds an HTTP client scaffold, updates workspace scripts to include the CLI, and updates contribution workflow requirements.

Acceptance Criteria

  • slug --help prints useful help.
  • slug --version prints the package version.
  • CLI config can store and read a default profile.
  • Secret values are redacted when config is displayed.
  • JSON output mode is available for commands that support it.
  • Invalid usage returns a non-zero exit and clear message.
  • Tests cover config read/write, secret redaction, help/version behavior, and exit behavior.
  • Relevant lint/test checks pass: Forgejo CI succeeded on the latest commit; local make check and ./scripts/pre-pr.sh passed before PR creation.

Blocking Issues

None.

Warnings

None.

Verdict

Approved for merge.

_Synced from todu comment by @todu on 2026-05-20T03:55:11.380Z_ ## PR Review: Approved PR: https://forge.caradoc.com/erik/slugkit/pulls/41 ### Summary Reviewed PR #41 at commit `757658f`. The PR adds the `@slugkit/cli` workspace, wires the `slug` executable, implements help/version/config commands, adds future-ready profile config storage, redacts configured API keys from displayed config, adds JSON output support, defines shared CLI exit codes/errors/output helpers, adds an HTTP client scaffold, updates workspace scripts to include the CLI, and updates contribution workflow requirements. ### Acceptance Criteria - [x] `slug --help` prints useful help. - [x] `slug --version` prints the package version. - [x] CLI config can store and read a default profile. - [x] Secret values are redacted when config is displayed. - [x] JSON output mode is available for commands that support it. - [x] Invalid usage returns a non-zero exit and clear message. - [x] Tests cover config read/write, secret redaction, help/version behavior, and exit behavior. - [x] Relevant lint/test checks pass: Forgejo CI succeeded on the latest commit; local `make check` and `./scripts/pre-pr.sh` passed before PR creation. ### Blocking Issues None. ### Warnings None. ### Verdict Approved for merge.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
erik/slugkit#37
No description provided.