9b3edc0ede4a3ba84c121a1c69fa5c1bd1b9b995
HarborForge.Cli
HarborForge.Cli is the Go-based hf binary for HarborForge.
Build
go build -o ./bin/hf ./cmd/hf
To set the version at build time:
go build -ldflags "-X git.hangman-lab.top/zhi/HarborForge.Cli/internal/commands.Version=1.0.0" -o ./bin/hf ./cmd/hf
Run
# 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
Package Layout
cmd/hf/ CLI entrypoint
internal/
client/ HTTP client wrapper for HarborForge API
commands/ Command implementations
config/ Config file resolution and management (.hf-config.json)
help/ Help and help-brief renderer with detailed leaf help
mode/ Runtime mode detection (padded-cell vs manual)
output/ Output formatting (human-readable, JSON, tables)
passmgr/ pass_mgr integration for secret resolution
Runtime Modes
- Padded-cell mode: When
pass_mgris available, auth tokens are resolved automatically. Manual--tokenflags are rejected. - Manual mode: When
pass_mgris not available,--tokenmust be provided explicitly to authenticated commands.
Current Status
Implemented
Foundation:
- Go module and binary entrypoint
- Config file resolution relative to binary directory
- Runtime mode detection (
pass_mgrpresent/absent) - HTTP client wrapper (GET/POST/PUT/PATCH/DELETE)
- Output formatting (human-readable +
--json) - Auth token resolution (padded-cell + manual)
Help system:
- Top-level and group/leaf help rendering (
--help/--help-brief) - Permission-aware command visibility via
/auth/me/permissions - Detailed leaf help text for all commands, with padded-cell/manual auth flag differences
- Nested help coverage for
config,monitor server, andmonitor api-keysubtrees (not permitted)rendering for unauthorized commands
Core commands:
hf version,hf health,hf config(show /--url/--acc-mgr-token)
Resource commands (all implemented with list/get/create/update/delete + special actions):
hf user— create, list, get, update, activate, deactivate, deletehf role— list, get, create, update, delete, set-permissions, add-permissions, remove-permissionshf permission— listhf project— list, get, create, update, delete, members, add-member, remove-memberhf milestone— list, get, create, update, delete, progresshf task— list, get, create, update, transition, take, delete, searchhf meeting— list, get, create, update, attend, deletehf support— list, get, create, update, take, transition, deletehf propose— list, get, create, update, accept, reject, reopenhf comment— add, listhf worklog— add, listhf monitor— overview, server (list/get/create/delete), api-key (generate/revoke)
Pending
- Backend code-based endpoint support (some commands still use id-based API routes)
- Cross-platform binary packaging / release pipeline
- Integration tests
Description
Languages
Go
99.7%
Makefile
0.3%