Compare commits
2 Commits
8ea4b6e990
...
7dfe181b97
| Author | SHA1 | Date | |
|---|---|---|---|
| 7dfe181b97 | |||
| 2bb9d18f57 |
+19
-16
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
> **Purpose**: Enable seamless continuation of development by any agent/LLM across sessions
|
> **Purpose**: Enable seamless continuation of development by any agent/LLM across sessions
|
||||||
>
|
>
|
||||||
> **Last Updated**: 2024-06-22 (Session 2)
|
> **Last Updated**: 2024-06-22 (Session 3)
|
||||||
> **Current Status**: Implementation In Progress - Tasks 1-5 Complete
|
> **Current Status**: Implementation In Progress - Tasks 1-6 Complete
|
||||||
> **Phase**: MVP Development (Phase 1)
|
> **Phase**: MVP Development (Phase 1)
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -27,9 +27,10 @@
|
|||||||
✅ **Task 3**: Configuration management (`pkg/config/config.go`)
|
✅ **Task 3**: Configuration management (`pkg/config/config.go`)
|
||||||
✅ **Task 4**: Error handling framework (`internal/errors/`) + tests passing
|
✅ **Task 4**: Error handling framework (`internal/errors/`) + tests passing
|
||||||
✅ **Task 5**: SSH client (`pkg/ssh/`) + tests passing
|
✅ **Task 5**: SSH client (`pkg/ssh/`) + tests passing
|
||||||
|
✅ **Task 6**: CLI Framework Setup - Cobra root, version, completion (`cmd/hostkeeper/`)
|
||||||
|
|
||||||
### What Needs to Happen Next
|
### What Needs to Happen Next
|
||||||
🔄 **Task 6**: CLI Framework Setup (Cobra commands in `cmd/hostkeeper/`)
|
🔄 **Task 7+**: CLI commands (add, list, connect, etc.)
|
||||||
🔄 Build and test core features
|
🔄 Build and test core features
|
||||||
🔄 Prepare MVP release
|
🔄 Prepare MVP release
|
||||||
|
|
||||||
@@ -47,12 +48,13 @@
|
|||||||
| **Config** | ✅ 100% | Cross-platform config management |
|
| **Config** | ✅ 100% | Cross-platform config management |
|
||||||
| **Errors** | ✅ 100% | AppError + ConnectionError + SSH error handler |
|
| **Errors** | ✅ 100% | AppError + ConnectionError + SSH error handler |
|
||||||
| **SSH Client** | ✅ 100% | Password + key auth, Execute, Connect/Close |
|
| **SSH Client** | ✅ 100% | Password + key auth, Execute, Connect/Close |
|
||||||
| **CLI Commands** | 🔲 0% | User interface commands |
|
| **CLI Framework** | ✅ 100% | Cobra root, version, completion commands |
|
||||||
|
| **CLI Commands** | 🔲 0% | add, list, connect subcommands |
|
||||||
| **TUI** | 🔲 0% | Terminal user interface |
|
| **TUI** | 🔲 0% | Terminal user interface |
|
||||||
| **Testing** | 🔲 0% | Test suite and integration |
|
| **Testing** | 🟡 30% | Error + SSH tests passing |
|
||||||
| **Documentation** | 🔲 0% | Usage guides and API docs |
|
| **Documentation** | 🔲 0% | Usage guides and API docs |
|
||||||
|
|
||||||
### Overall Progress: **~40% Complete** (Tasks 1-5 done)
|
### Overall Progress: **~45% Complete** (Tasks 1-6 done)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -103,14 +105,15 @@
|
|||||||
- `pkg/ssh/auth.go` — Password/key/both auth, default key discovery
|
- `pkg/ssh/auth.go` — Password/key/both auth, default key discovery
|
||||||
- `test/ssh/ssh_test.go` — 4 test functions, all passing
|
- `test/ssh/ssh_test.go` — 4 test functions, all passing
|
||||||
|
|
||||||
#### 🔲 Task 6: CLI Framework Setup
|
#### ✅ Task 6: CLI Framework Setup
|
||||||
- **Status**: Not Started
|
- **Status**: ✅ Completed
|
||||||
- **Priority**: CRITICAL
|
- **Priority**: CRITICAL
|
||||||
- **Estimated Time**: 1-2 hours
|
|
||||||
- **Dependencies**: Task 1 complete
|
|
||||||
- **Deliverables**: Cobra framework, basic commands
|
- **Deliverables**: Cobra framework, basic commands
|
||||||
- **Files to Create**:
|
- **Files Created**:
|
||||||
- `cmd/hostkeeper/*.go`
|
- `cmd/hostkeeper/main.go` — Entry point with Execute() function
|
||||||
|
- `cmd/hostkeeper/root.go` — Root command with PersistentPreRunE config init
|
||||||
|
- `cmd/hostkeeper/completion.go` — Shell completion (bash/zsh/fish/powershell)
|
||||||
|
- Includes `version` subcommand and `-v/--verbose`, `--debug` flags
|
||||||
|
|
||||||
#### 🔲 Task 7-14: Remaining Tasks
|
#### 🔲 Task 7-14: Remaining Tasks
|
||||||
- **Status**: Not Started
|
- **Status**: Not Started
|
||||||
@@ -121,7 +124,7 @@
|
|||||||
## 🗺️ Development Roadmap
|
## 🗺️ Development Roadmap
|
||||||
|
|
||||||
### Current Week Focus
|
### Current Week Focus
|
||||||
**Target**: Complete Tasks 1-6 (Foundation + Core Features)
|
**Target**: Complete Tasks 7+ (Core CLI Commands)
|
||||||
|
|
||||||
### This Sprint
|
### This Sprint
|
||||||
- [x] Project setup and dependencies
|
- [x] Project setup and dependencies
|
||||||
@@ -129,7 +132,7 @@
|
|||||||
- [x] Configuration management
|
- [x] Configuration management
|
||||||
- [x] Error handling framework
|
- [x] Error handling framework
|
||||||
- [x] SSH client implementation
|
- [x] SSH client implementation
|
||||||
- [ ] CLI framework setup
|
- [x] CLI framework setup
|
||||||
|
|
||||||
### Next Sprint
|
### Next Sprint
|
||||||
- [ ] CLI commands (add, list, connect)
|
- [ ] CLI commands (add, list, connect)
|
||||||
@@ -285,7 +288,7 @@ go test ./... -watch
|
|||||||
|
|
||||||
### Current Test Coverage
|
### Current Test Coverage
|
||||||
- **Target**: 80%+ coverage
|
- **Target**: 80%+ coverage
|
||||||
- **Current**: 0% (no tests yet)
|
- **Current**: ~30% (error handling + SSH client tests passing)
|
||||||
- **Priority**: Write tests first (TDD approach)
|
- **Priority**: Write tests first (TDD approach)
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -493,7 +496,7 @@ cat go.mod
|
|||||||
- **Current Phase**: Implementation
|
- **Current Phase**: Implementation
|
||||||
|
|
||||||
### Milestone Tracking
|
### Milestone Tracking
|
||||||
- [~] Milestone 1: Foundation (Tasks 1-6) - Week 1 (Tasks 1-3 done)
|
- [x] Milestone 1: Foundation (Tasks 1-6) - Week 1 ✅ COMPLETE
|
||||||
- [ ] Milestone 2: Core Features (Tasks 7-10) - Week 2-3
|
- [ ] Milestone 2: Core Features (Tasks 7-10) - Week 2-3
|
||||||
- [ ] Milestone 3: Polish & Release (Tasks 11-14) - Week 4
|
- [ ] Milestone 3: Polish & Release (Tasks 11-14) - Week 4
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var completionCmd = &cobra.Command{
|
||||||
|
Use: "completion [bash|zsh|fish|powershell]",
|
||||||
|
Short: "Generate shell completion script",
|
||||||
|
Long: `Generate shell completion script for hostkeeper.
|
||||||
|
|
||||||
|
To load completions:
|
||||||
|
|
||||||
|
Bash:
|
||||||
|
$ source <(hostkeeper completion bash)
|
||||||
|
|
||||||
|
# To load completions for each session, execute once:
|
||||||
|
# Linux:
|
||||||
|
$ hostkeeper completion bash > /etc/bash_completion.d/hostkeeper
|
||||||
|
# macOS:
|
||||||
|
$ hostkeeper completion bash > /usr/local/etc/bash_completion.d/hostkeeper
|
||||||
|
|
||||||
|
Zsh:
|
||||||
|
# If shell completion is not already enabled in your environment,
|
||||||
|
# you will need to enable it. You can execute the following once:
|
||||||
|
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
|
||||||
|
|
||||||
|
# To load completions for each session, execute once:
|
||||||
|
$ hostkeeper completion zsh > "${fpath[1]}/_hostkeeper"
|
||||||
|
|
||||||
|
# You will need to start a new shell for this setup to take effect.
|
||||||
|
|
||||||
|
fish:
|
||||||
|
$ hostkeeper completion fish | source
|
||||||
|
|
||||||
|
# To load completions for each session, execute once:
|
||||||
|
$ hostkeeper completion fish > ~/.config/fish/completions/hostkeeper.fish
|
||||||
|
|
||||||
|
PowerShell:
|
||||||
|
PS> hostkeeper completion powershell | Out-String | Invoke-Expression
|
||||||
|
|
||||||
|
# To load completions for every new session, run:
|
||||||
|
PS> hostkeeper completion powershell > hostkeeper.ps1
|
||||||
|
# and source this file from your PowerShell profile.
|
||||||
|
`,
|
||||||
|
DisableFlagsInUseLine: true,
|
||||||
|
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
|
||||||
|
Args: cobra.ExactValidArgs(1),
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
switch args[0] {
|
||||||
|
case "bash":
|
||||||
|
_ = cmd.Root().GenBashCompletion(os.Stdout)
|
||||||
|
case "zsh":
|
||||||
|
_ = cmd.Root().GenZshCompletion(os.Stdout)
|
||||||
|
case "fish":
|
||||||
|
_ = cmd.Root().GenFishCompletion(os.Stdout, true)
|
||||||
|
case "powershell":
|
||||||
|
_ = cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(completionCmd)
|
||||||
|
}
|
||||||
@@ -11,11 +11,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) > 1 && os.Args[1] == "--version" {
|
if err := Execute(); err != nil {
|
||||||
fmt.Printf("hostkeeper %s (built: %s)\n", version, buildTime)
|
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||||
return
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("HostKeeper - SSH/SFTP Management Tool")
|
|
||||||
fmt.Println("Run 'hostkeeper --help' for usage.")
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
|
"git.tukangketik.id/swanadiva/hostkeeper/pkg/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
cfgFile string
|
||||||
|
appCfg *config.Config
|
||||||
|
verbose int
|
||||||
|
debug bool
|
||||||
|
)
|
||||||
|
|
||||||
|
var rootCmd = &cobra.Command{
|
||||||
|
Use: "hostkeeper",
|
||||||
|
Short: "Cross-platform SSH/SFTP management tool",
|
||||||
|
Long: `Hostkeeper - Cross-platform SSH/SFTP Management Tool
|
||||||
|
|
||||||
|
A comprehensive SSH/SFTP management tool with secure credential storage,
|
||||||
|
host management, and cross-device sync capabilities.
|
||||||
|
|
||||||
|
Quick Start:
|
||||||
|
hostkeeper add myserver --host 192.168.1.10 --user admin
|
||||||
|
hostkeeper list
|
||||||
|
hostkeeper connect myserver
|
||||||
|
|
||||||
|
For more information, visit the project repository.`,
|
||||||
|
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
// Initialize configuration
|
||||||
|
cfg, err := config.New()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to initialize config: %w", err)
|
||||||
|
}
|
||||||
|
appCfg = cfg
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
cobra.OnInitialize(initConfig)
|
||||||
|
|
||||||
|
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is platform-specific app dir)")
|
||||||
|
rootCmd.PersistentFlags().CountVarP(&verbose, "verbose", "v", "verbose output (-v for info, -vv for debug)")
|
||||||
|
rootCmd.PersistentFlags().BoolVar(&debug, "debug", false, "enable debug mode")
|
||||||
|
|
||||||
|
rootCmd.AddCommand(versionCmd)
|
||||||
|
}
|
||||||
|
|
||||||
|
// initConfig reads in config file and ENV variables if set
|
||||||
|
func initConfig() {
|
||||||
|
if cfgFile != "" {
|
||||||
|
viper.SetConfigFile(cfgFile)
|
||||||
|
} else {
|
||||||
|
// Use platform-specific config directory
|
||||||
|
cfg, err := config.New()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
viper.AddConfigPath(cfg.GetConfigDir())
|
||||||
|
viper.SetConfigType("json")
|
||||||
|
viper.SetConfigName("config")
|
||||||
|
}
|
||||||
|
|
||||||
|
viper.AutomaticEnv()
|
||||||
|
|
||||||
|
// Read config file (ignore if not found for first run)
|
||||||
|
_ = viper.ReadInConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
var versionCmd = &cobra.Command{
|
||||||
|
Use: "version",
|
||||||
|
Short: "Print the version number",
|
||||||
|
Long: `Print the version and build information for HostKeeper.`,
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
fmt.Printf("hostkeeper %s (built: %s)\n", version, buildTime)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute runs the root command
|
||||||
|
func Execute() error {
|
||||||
|
return rootCmd.Execute()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user