Skip to content

Commit 9505b83

Browse files
jszobodyclaudehappy-otter
committed
Add interactive shell mode for Keep
- Implemented `keep shell` command for interactive secret management - Persistent context (stage/vault) across commands - Command shortcuts and aliases for efficiency - Context switching commands (stage, vault, use) - Command history with readline support - Works in both interactive and non-interactive modes - Comprehensive documentation in CLI reference - Added PsySH dependency for future REPL enhancements Features: - No need to repeatedly specify --stage and --vault - Quick aliases: s (stage), v (vault), g (get), d (delete), etc. - Partial name matching for stages and vaults - All standard Keep commands work in shell mode - Clean exit with multiple aliases (exit, quit, q) Example: keep shell --stage=production keep> set API_KEY "value" keep> stage development keep> copy API_KEY --to=production Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
1 parent 54c5ebb commit 9505b83

4 files changed

Lines changed: 490 additions & 2 deletions

File tree

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
],
2222
"require": {
2323
"php": "^8.3",
24+
"ext-sodium": "*",
2425
"illuminate/console": "^12.0",
2526
"illuminate/container": "^12.0",
2627
"illuminate/events": "^12.0",
2728
"illuminate/support": "^12.0",
2829
"laravel/prompts": "^0.3.0",
30+
"psy/psysh": "^0.12.10",
2931
"symfony/console": "^7.0",
30-
"vlucas/phpdotenv": "^5.6",
31-
"ext-sodium": "*"
32+
"vlucas/phpdotenv": "^5.6"
3233
},
3334
"require-dev": {
3435
"aws/aws-sdk-php": "^3.354",

docs/guide/reference/cli-reference.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,72 @@ keep show --stage=staging --format=json
172172
keep show --stage=production --vault=secretsmanager --format=env
173173
```
174174

175+
## `keep shell`
176+
177+
Start an interactive shell for Keep commands with persistent context.
178+
179+
| Option | Type | Default | Description |
180+
|--------|------|---------|-------------|
181+
| `--stage` | string | *first configured stage* | Initial stage to use |
182+
| `--vault` | string | *default vault* | Initial vault to use |
183+
184+
### Shell Mode Features
185+
186+
The interactive shell provides:
187+
- **Persistent context**: No need to specify --stage and --vault for each command
188+
- **Command shortcuts**: Quick aliases for common commands
189+
- **Context switching**: Easy switching between stages and vaults
190+
- **Command history**: Access previous commands with arrow keys
191+
192+
### Shell Commands
193+
194+
**Context Management:**
195+
```bash
196+
keep> stage production # Switch to production stage (alias: s)
197+
keep> vault ssm # Switch to ssm vault (alias: v)
198+
keep> use ssm:production # Switch both at once (alias: u)
199+
keep> context # Show current context (alias: ctx)
200+
```
201+
202+
**Secret Operations:**
203+
```bash
204+
keep> set API_KEY value # Set a secret
205+
keep> get API_KEY # Get a secret (alias: g)
206+
keep> delete API_KEY # Delete a secret (alias: d)
207+
keep> show # List all secrets (aliases: ls, list, l)
208+
keep> copy KEY --to=prod # Copy using current context as source
209+
```
210+
211+
**Shell Control:**
212+
```bash
213+
keep> help # Show available commands (alias: ?)
214+
keep> history # Show command history (alias: h)
215+
keep> clear # Clear screen (alias: cls)
216+
keep> exit # Exit shell (aliases: quit, q)
217+
```
218+
219+
### Examples
220+
221+
```bash
222+
# Start shell with initial context
223+
keep shell --stage=production --vault=ssm
224+
225+
# Interactive session
226+
keep (ssm:production)> show
227+
keep (ssm:production)> stage development
228+
✓ Switched to stage: development
229+
keep (ssm:development)> set API_KEY "dev-key"
230+
keep (ssm:development)> copy API_KEY --to=production
231+
keep (ssm:development)> exit
232+
Goodbye!
233+
```
234+
235+
### Tips
236+
- Use partial names for stages/vaults (e.g., `s prod` for `stage production`)
237+
- All standard Keep commands work in the shell
238+
- Commands automatically use the current context
239+
- Use tab for basic command completion (if readline is available)
240+
175241
## `keep delete`
176242

177243
Remove secrets from vaults.

0 commit comments

Comments
 (0)