From cb0b7669b3aeb0c34307d22ce93fc4fe7c3e557d Mon Sep 17 00:00:00 2001 From: zhi Date: Sat, 21 Mar 2026 13:34:41 +0000 Subject: [PATCH] feat: scaffold Go-based hf CLI --- .gitignore | 11 ++++++----- README.md | 40 +++++++++++++++++++++++++++++++++++--- cmd/hf/main.go | 24 +++++++++++++++++++++++ go.mod | 3 +++ internal/client/.gitkeep | 0 internal/client/doc.go | 3 +++ internal/commands/.gitkeep | 0 internal/commands/doc.go | 3 +++ internal/config/.gitkeep | 0 internal/config/doc.go | 3 +++ internal/help/.gitkeep | 0 internal/help/doc.go | 3 +++ internal/mode/.gitkeep | 0 internal/mode/doc.go | 3 +++ internal/passmgr/.gitkeep | 0 internal/passmgr/doc.go | 3 +++ 16 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 cmd/hf/main.go create mode 100644 go.mod create mode 100644 internal/client/.gitkeep create mode 100644 internal/client/doc.go create mode 100644 internal/commands/.gitkeep create mode 100644 internal/commands/doc.go create mode 100644 internal/config/.gitkeep create mode 100644 internal/config/doc.go create mode 100644 internal/help/.gitkeep create mode 100644 internal/help/doc.go create mode 100644 internal/mode/.gitkeep create mode 100644 internal/mode/doc.go create mode 100644 internal/passmgr/.gitkeep create mode 100644 internal/passmgr/doc.go diff --git a/.gitignore b/.gitignore index 8b998a8..7f840a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ -dist/ bin/ -node_modules/ -*.log -.env -.env.* +dist/ +coverage.out +*.test +*.exe +*.out +vendor/ diff --git a/README.md b/README.md index b866f9e..6230347 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,40 @@ # HarborForge.Cli -CLI tools for HarborForge. +`HarborForge.Cli` is the home of the new Go-based `hf` binary for HarborForge. -This repository is intentionally initialized with a minimal scaffold. -Future commands and packaging can be added here. +## 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 + +## Build + +```bash +go build -o ./bin/hf ./cmd/hf +``` + +## Run + +```bash +go run ./cmd/hf --help +go run ./cmd/hf version +``` + +## Planned package layout + +```text +cmd/hf/ +internal/ + client/ + commands/ + config/ + help/ + mode/ + passmgr/ +``` + +The scaffold is intentionally minimal so follow-up work can implement config loading, mode detection, help rendering, auth, and API command groups incrementally. diff --git a/cmd/hf/main.go b/cmd/hf/main.go new file mode 100644 index 0000000..7176e8d --- /dev/null +++ b/cmd/hf/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "os" +) + +func main() { + if len(os.Args) > 1 { + switch os.Args[1] { + case "--help", "-h": + fmt.Println("hf - HarborForge CLI") + fmt.Println() + fmt.Println("This is the initial Go scaffold for the HarborForge CLI.") + fmt.Println("More command groups will be added in follow-up tasks.") + return + case "version": + fmt.Println("hf dev") + return + } + } + + fmt.Println("hf - HarborForge CLI scaffold") +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a97452f --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.hangman-lab.top/zhi/HarborForge.Cli + +go 1.22 diff --git a/internal/client/.gitkeep b/internal/client/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/internal/client/doc.go b/internal/client/doc.go new file mode 100644 index 0000000..054e459 --- /dev/null +++ b/internal/client/doc.go @@ -0,0 +1,3 @@ +package client + +// Package client will host HarborForge HTTP client helpers. diff --git a/internal/commands/.gitkeep b/internal/commands/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/internal/commands/doc.go b/internal/commands/doc.go new file mode 100644 index 0000000..745b171 --- /dev/null +++ b/internal/commands/doc.go @@ -0,0 +1,3 @@ +package commands + +// Package commands will define the hf command tree. diff --git a/internal/config/.gitkeep b/internal/config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/internal/config/doc.go b/internal/config/doc.go new file mode 100644 index 0000000..3706e51 --- /dev/null +++ b/internal/config/doc.go @@ -0,0 +1,3 @@ +package config + +// Package config will resolve and manage .hf-config.json. diff --git a/internal/help/.gitkeep b/internal/help/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/internal/help/doc.go b/internal/help/doc.go new file mode 100644 index 0000000..c9259ff --- /dev/null +++ b/internal/help/doc.go @@ -0,0 +1,3 @@ +package help + +// Package help will render help and help-brief output. diff --git a/internal/mode/.gitkeep b/internal/mode/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/internal/mode/doc.go b/internal/mode/doc.go new file mode 100644 index 0000000..5bd3ec0 --- /dev/null +++ b/internal/mode/doc.go @@ -0,0 +1,3 @@ +package mode + +// Package mode will detect padded-cell/manual runtime behavior. diff --git a/internal/passmgr/.gitkeep b/internal/passmgr/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/internal/passmgr/doc.go b/internal/passmgr/doc.go new file mode 100644 index 0000000..89ef8f8 --- /dev/null +++ b/internal/passmgr/doc.go @@ -0,0 +1,3 @@ +package passmgr + +// Package passmgr will integrate with pass_mgr when available.