Commit Graph

16 Commits

Author SHA1 Message Date
efaa5cdcc9 feat: add shell scripting with variables
Implemented roadmap #9: Shell scripts execution with variables.

Features:
- set <name> <value> - Set shell variable
- unset <name> - Remove variable
- vars - List all variables
- Variable substitution in all commands

Variable syntax:
- $VAR or ${VAR} - Shell variables
- $ENV:VARNAME - Environment variables

Variables expand before command execution, enabling:
- Dynamic key paths: put $BASE/$ID '{"data":"value"}'
- Reusable values: set TOKEN xyz && auth $TOKEN
- Script parameterization in batch files

Example batch script:
  set USER alice
  set KEY_PREFIX users
  put $KEY_PREFIX/$USER '{"name":"$USER"}'
  get $KEY_PREFIX/$USER

Variables are session-scoped and work in both interactive
and batch modes. Environment variables can be injected using
$ENV:HOME syntax.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-06 00:01:36 +03:00
bd73a1c477 feat: add export/import functionality for backup and migration
Implemented roadmap #4: Export/import functionality.

Features:
- export <file> <key1> [key2...] - Export specified keys to JSON
- export-list <keyfile> <output> - Bulk export from key list file
- import <file> - Import keys from JSON file
  --skip-existing (default) - Skip keys that already exist
  --overwrite - Overwrite existing keys

Export file format (v1.0):
{
  "version": "1.0",
  "entries": [
    {
      "key": "users/alice",
      "uuid": "...",
      "timestamp": 1234567890,
      "data": {...}
    }
  ]
}

The format preserves UUIDs and timestamps for audit trails.
Export shows progress with ✓/✗/⊘ symbols for success/fail/not-found.
Import checks for existing keys and respects skip/overwrite flags.

Use cases:
- Backup: export-list keys.txt backup.json
- Migration: import backup.json --overwrite
- Selective sync: export dest.json key1 key2

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 23:57:25 +03:00
2f77c0a825 feat: add batch command execution from files
Implemented roadmap #3: Batch operations from file.

Features:
- batch <file> or source <file> - Execute commands from script file
- Skips empty lines and comments (lines starting with #)
- Shows line numbers during execution for easy debugging
- Blocks exit/quit commands in batch mode (won't exit shell)
- Displays execution summary with counts

Implementation:
- Refactored main loop to extract executeCommand() method
- Created cmd_batch.go with batch file processor
- Reads file line by line, processes each command
- Summary shows total lines, executed count, and skipped count

Example batch file:
  # Connect and setup
  connect http://localhost:8080
  auth <token>

  # Batch insert
  put key1 '{"data":"value1"}'
  put key2 '{"data":"value2"}'

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 23:54:47 +03:00
33201227ca feat: add group management commands
Implemented roadmap #5: Group management commands with full CRUD.

Features:
- group create <name> [members] - Create new group with optional initial members
- group get <uuid> - Display group details (uuid, name_hash, members, timestamps)
- group update <uuid> <members> - Replace entire member list
- group delete <uuid> - Delete group
- group add-member <uuid> <user-uuid> - Add single member (incremental)
- group remove-member <uuid> <user-uuid> - Remove single member (incremental)

The add-member and remove-member commands fetch current members, modify the list,
and update atomically - providing a better UX than replacing the entire list.

Backend API endpoints used:
- POST /api/groups - Create group
- GET /api/groups/{uuid} - Get group details
- PUT /api/groups/{uuid} - Update members
- DELETE /api/groups/{uuid} - Delete group

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 23:50:27 +03:00
39a1d4482a 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>
2025-10-05 23:47:13 +03:00
0c9e314d7c refactor: split monolithic main.go into modular structure
Refactored 800+ line main.go into clean, domain-separated files:
- main.go (96 lines) - Entry point and command router only
- types.go - Type definitions and data structures
- client.go - HTTP client and request handling
- cmd_kv.go - Key-value operations (get/put/delete)
- cmd_meta.go - Resource metadata commands
- cmd_user.go - User management commands
- cmd_profile.go - Profile management
- cmd_cluster.go - Cluster operations (members/health)
- cmd_system.go - System commands (connect/auth/help)
- utils.go - Shared utilities (parsing, colors, completion)

No functional changes, pure reorganization for maintainability.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 23:34:18 +03:00
fcd27dee97 chore: update documentation 2025-10-05 23:19:09 +03:00
Kalzu Rekku
3287c38836 Fix merge left overs. 2025-10-05 22:53:20 +03:00
Kalzu Rekku
f7f956de47 Merge remote-tracking branch 'origin/risto' 2025-10-05 22:45:26 +03:00
Kalzu Rekku
fe45fa5254 Added commands to set meta data, like owner, group and permissions of key. 2025-10-05 22:38:25 +03:00
999deccb74 fix: JSON quote parsing 2025-10-05 22:27:26 +03:00
88a3b9824a fix: show friendlier error message for JSON parsing 2025-10-05 22:27:26 +03:00
8edbfacda5 Add Claude 2025-10-05 22:27:26 +03:00
Kalzu Rekku
ad17dff2fa Fix json quotation bug. 2025-10-05 21:39:09 +03:00
Kalzu Rekku
d69240913a added plan for future stuff, roadmap.md. 2025-10-05 20:17:07 +03:00
Kalzu Rekku
3ae9395f9d Initial commit. The shell now combiles and runs. 2025-10-05 20:03:35 +03:00