-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add justfile with sandbox management targets #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Default: list available targets | ||
| default: | ||
| @just --list | ||
|
|
||
| image := "claude-sandbox" | ||
| env_file := "sandbox/myenv" | ||
| sandbox_dir := "sandbox" | ||
| workspace := "demo/workspace" | ||
| trace := "false" | ||
| learn := "false" | ||
|
|
||
| # Build the sandbox Docker image | ||
| sandbox-build: | ||
| docker build -t {{image}} {{sandbox_dir}} | ||
|
|
||
| # Copy sample.env to myenv if it doesn't already exist | ||
| sandbox-setup: | ||
| @if [ ! -f {{env_file}} ]; then \ | ||
| cp sandbox/sample.env {{env_file}}; \ | ||
| echo "Created {{env_file}} — edit it and set your ANTHROPIC_API_KEY"; \ | ||
| else \ | ||
| echo "{{env_file}} already exists, skipping"; \ | ||
| fi | ||
|
|
||
| # Run an interactive Claude Code shell in the sandbox | ||
| sandbox-run: | ||
| docker run --rm -it --env-file {{env_file}} -v "$(cd {{workspace}} && pwd)":/workspace -v "$(pwd)/plugins":/plugins {{image}} | ||
|
|
||
| # Run a one-shot prompt in the sandbox (trace=true to summarize session, learn=true to run /kaizen:learn) | ||
| sandbox-prompt prompt: | ||
| #!/usr/bin/env sh | ||
| TRACE_CMD="" | ||
| LEARN_CMD="" | ||
| if [ "{{trace}}" = "true" ]; then | ||
| TRACE_CMD=" | ||
| echo; echo; echo Summarizing the session...; echo | ||
| claude --plugin-dir /plugins/kaizen/ --dangerously-skip-permissions --no-session-persistence -p 'tell me what happened in the newest json file in /home/sandbox/.claude/projects/-workspace/' | ||
| " | ||
| fi | ||
| if [ "{{learn}}" = "true" ]; then | ||
| LEARN_CMD=" | ||
| echo; echo; echo Learning...; echo | ||
| claude --plugin-dir /plugins/kaizen/ --dangerously-skip-permissions --continue -p '/kaizen:learn' | ||
| " | ||
| fi | ||
| docker run --rm -it --env-file {{env_file}} -v "$(cd {{workspace}} && pwd)":/workspace -v "$(pwd)/plugins":/plugins {{image}} sh -c " | ||
| claude --plugin-dir /plugins/kaizen/ --dangerously-skip-permissions -p '{{prompt}}' | ||
| $TRACE_CMD | ||
| $LEARN_CMD | ||
| " | ||
|
|
||
| # Smoke-test that Claude Code is installed and working | ||
| sandbox-test: | ||
| docker run --rm --env-file {{env_file}} {{image}} claude -p "who are you" | ||
|
|
||
| # Remove the sandbox Docker image | ||
| sandbox-clean: | ||
| docker rmi {{image}} | ||
|
Comment on lines
+57
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
After a 🐛 Proposed fix- docker rmi {{image}}
+ docker rmi -f {{image}}🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| ANTHROPIC_API_KEY=sk-ant-xxxx | ||
| KAIZEN_DEBUG=1 | ||
| IS_SANDBOX=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a timeout to the smoke-test to prevent indefinite blocking.
If the Claude API call hangs (network issue, bad key, etc.) this target blocks forever, which is especially problematic in CI. Using
timeout(GNU coreutils) keeps the test bounded.🐛 Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents