feat: add persistent profile storage to ~/.kvs/config.json

Implemented roadmap #1: Configuration file for persistent profiles.

Features:
- Auto-saves profiles to ~/.kvs/config.json on add/use/remove
- Auto-loads profiles on shell startup
- File created with 0600 permissions for token security
- Shows active profile in welcome message
- Added 'profile save' and 'profile load' commands for manual control

Technical details:
- Created config.go with LoadConfig/SaveConfig functions
- Profile changes automatically trigger persistence
- ~/.kvs directory created with 0700 permissions if missing
- Gracefully handles missing config file on first run

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-05 23:47:13 +03:00
parent 0c9e314d7c
commit 39a1d4482a
5 changed files with 159 additions and 1 deletions

View File

@@ -11,6 +11,11 @@ import (
func main() {
client := NewKVSClient("http://localhost:8090")
// Load saved profiles
if config, err := LoadConfig(); err == nil {
client.syncConfigToClient(config)
}
// Setup readline
rl, err := readline.NewEx(&readline.Config{
Prompt: cyan("kvs> "),
@@ -26,6 +31,9 @@ func main() {
fmt.Println(magenta("KVS Interactive Shell"))
fmt.Println("Type 'help' for available commands")
if client.activeProfile != "" {
fmt.Println(green("Active profile:"), client.activeProfile)
}
fmt.Println()
for {