feat: implement core CLI packages and Phase 3 commands
- config: resolve binary dir, load/save .hf-config.json - mode: detect padded-cell vs manual mode via pass_mgr - client: HTTP client wrapper with auth header support - passmgr: pass_mgr integration (get-secret, set, generate) - output: human-readable + JSON output formatting with tables - help: help and help-brief renderer for groups/commands - commands: version, health, config (--url, --acc-mgr-token, show) - auth: token resolution helper (padded-cell auto / manual explicit) - main: command dispatcher with --json global flag support - README: updated with current package layout and status
This commit is contained in:
77
README.md
77
README.md
@@ -1,15 +1,6 @@
|
||||
# HarborForge.Cli
|
||||
|
||||
`HarborForge.Cli` is the home of the new Go-based `hf` binary for HarborForge.
|
||||
|
||||
## Current status
|
||||
|
||||
This repository now contains the initial Go scaffold required by the cross-project plan:
|
||||
|
||||
- Go module initialization
|
||||
- binary entrypoint at `cmd/hf/main.go`
|
||||
- placeholder internal package layout for future implementation
|
||||
- basic build instructions
|
||||
`HarborForge.Cli` is the Go-based `hf` binary for HarborForge.
|
||||
|
||||
## Build
|
||||
|
||||
@@ -17,24 +8,68 @@ This repository now contains the initial Go scaffold required by the cross-proje
|
||||
go build -o ./bin/hf ./cmd/hf
|
||||
```
|
||||
|
||||
To set the version at build time:
|
||||
|
||||
```bash
|
||||
go build -ldflags "-X git.hangman-lab.top/zhi/HarborForge.Cli/internal/commands.Version=1.0.0" -o ./bin/hf ./cmd/hf
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
go run ./cmd/hf --help
|
||||
go run ./cmd/hf version
|
||||
# Show help
|
||||
./bin/hf --help
|
||||
|
||||
# Show only permitted commands
|
||||
./bin/hf --help-brief
|
||||
|
||||
# Show version
|
||||
./bin/hf version
|
||||
|
||||
# Check API health
|
||||
./bin/hf health
|
||||
|
||||
# Configure API URL
|
||||
./bin/hf config --url http://your-harborforge:8000
|
||||
|
||||
# View current config
|
||||
./bin/hf config
|
||||
|
||||
# JSON output
|
||||
./bin/hf version --json
|
||||
```
|
||||
|
||||
## Planned package layout
|
||||
## Package Layout
|
||||
|
||||
```text
|
||||
cmd/hf/
|
||||
cmd/hf/ CLI entrypoint
|
||||
internal/
|
||||
client/
|
||||
commands/
|
||||
config/
|
||||
help/
|
||||
mode/
|
||||
passmgr/
|
||||
client/ HTTP client wrapper for HarborForge API
|
||||
commands/ Command implementations (version, health, config, auth helpers)
|
||||
config/ Config file resolution and management (.hf-config.json)
|
||||
help/ Help and help-brief renderer
|
||||
mode/ Runtime mode detection (padded-cell vs manual)
|
||||
output/ Output formatting (human-readable, JSON, tables)
|
||||
passmgr/ pass_mgr integration for secret resolution
|
||||
```
|
||||
|
||||
The scaffold is intentionally minimal so follow-up work can implement config loading, mode detection, help rendering, auth, and API command groups incrementally.
|
||||
## Runtime Modes
|
||||
|
||||
- **Padded-cell mode**: When `pass_mgr` is available, auth tokens are resolved automatically. Manual `--token` flags are rejected.
|
||||
- **Manual mode**: When `pass_mgr` is not available, `--token` must be provided explicitly to authenticated commands.
|
||||
|
||||
## Current Status
|
||||
|
||||
Implemented:
|
||||
- Go module and binary entrypoint
|
||||
- Config file resolution relative to binary directory
|
||||
- Runtime mode detection (`pass_mgr` present/absent)
|
||||
- Help and help-brief rendering system
|
||||
- HTTP client wrapper
|
||||
- Output formatting (human-readable + `--json`)
|
||||
- `hf version`, `hf health`, `hf config`
|
||||
- Auth token resolution (padded-cell + manual)
|
||||
|
||||
Planned:
|
||||
- User, role, project, task, milestone, meeting, support, propose, monitor commands
|
||||
- Permission-aware help rendering
|
||||
|
||||
Reference in New Issue
Block a user