@_mehrad/cbox 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cbox +16 -0
- package/dist/cbox-darwin-arm64 +0 -0
- package/dist/{cbox → cbox-darwin-x64} +0 -0
- package/package.json +16 -4
- package/raycast/cbox-attach-session.sh +0 -41
- package/raycast/cbox-kill-session.sh +0 -11
- package/raycast/cbox-list-sessions.sh +0 -9
- package/raycast/cbox-run-prompt.sh +0 -22
package/bin/cbox
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
case "$(uname -s)" in
|
|
3
|
+
Darwin) ;;
|
|
4
|
+
*) echo "cbox: unsupported OS: $(uname -s)" >&2; exit 1 ;;
|
|
5
|
+
esac
|
|
6
|
+
SELF="$0"
|
|
7
|
+
while [ -L "$SELF" ]; do
|
|
8
|
+
LINK=$(readlink "$SELF")
|
|
9
|
+
case "$LINK" in
|
|
10
|
+
/*) SELF="$LINK" ;;
|
|
11
|
+
*) SELF="$(dirname "$SELF")/$LINK" ;;
|
|
12
|
+
esac
|
|
13
|
+
done
|
|
14
|
+
DIR=$(cd "$(dirname "$SELF")/.." && pwd)
|
|
15
|
+
[ "$(uname -m)" = "arm64" ] && exec "$DIR/dist/cbox-darwin-arm64" "$@"
|
|
16
|
+
exec "$DIR/dist/cbox-darwin-x64" "$@"
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_mehrad/cbox",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Claude Sandbox CLI — run Claude Code in Docker",
|
|
5
5
|
"bin": {
|
|
6
|
-
"cbox": "
|
|
6
|
+
"cbox": "bin/cbox"
|
|
7
7
|
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/",
|
|
10
|
+
"dist/cbox-darwin-arm64",
|
|
11
|
+
"dist/cbox-darwin-x64",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"os": [
|
|
15
|
+
"darwin"
|
|
16
|
+
],
|
|
8
17
|
"scripts": {
|
|
9
18
|
"start": "bun run src/index.ts",
|
|
10
|
-
"build": "bun build --compile --minify --
|
|
11
|
-
"
|
|
19
|
+
"build": "bun build --compile --minify src/index.ts --target=bun-darwin-arm64 --outfile dist/cbox-darwin-arm64 && bun build --compile --minify src/index.ts --target=bun-darwin-x64 --outfile dist/cbox-darwin-x64",
|
|
20
|
+
"prepublishOnly": "bun run build",
|
|
21
|
+
"test": "bun test",
|
|
22
|
+
"release": "bash scripts/release.sh",
|
|
23
|
+
"publish:all": "bash scripts/publish.sh"
|
|
12
24
|
},
|
|
13
25
|
"dependencies": {
|
|
14
26
|
"commander": "^14.0.0"
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# @raycast.schemaVersion 1
|
|
4
|
-
# @raycast.title CSB Attach Session
|
|
5
|
-
# @raycast.mode silent
|
|
6
|
-
# @raycast.packageName cbox
|
|
7
|
-
# @raycast.description Attach to a Claude Sandbox session in a new terminal window
|
|
8
|
-
# @raycast.argument1 { "type": "text", "placeholder": "Session ID or name" }
|
|
9
|
-
|
|
10
|
-
SESSION="$1"
|
|
11
|
-
|
|
12
|
-
# Validate session id/name to prevent osascript injection
|
|
13
|
-
if ! echo "$SESSION" | grep -qE '^[a-zA-Z0-9_-]+$'; then
|
|
14
|
-
echo "Error: invalid session ID or name: $SESSION"
|
|
15
|
-
exit 1
|
|
16
|
-
fi
|
|
17
|
-
|
|
18
|
-
TERM_APP=$(python3 -c "
|
|
19
|
-
import json, os
|
|
20
|
-
cfg = os.path.expanduser('~/.config/cbox/config.json')
|
|
21
|
-
try:
|
|
22
|
-
with open(cfg) as f:
|
|
23
|
-
data = json.load(f)
|
|
24
|
-
print(data.get('terminalApp', 'Terminal'))
|
|
25
|
-
except:
|
|
26
|
-
print('Terminal')
|
|
27
|
-
" 2>/dev/null || echo "Terminal")
|
|
28
|
-
|
|
29
|
-
if [ "$TERM_APP" = "iTerm" ]; then
|
|
30
|
-
osascript -e "tell application \"iTerm\"
|
|
31
|
-
create window with default profile
|
|
32
|
-
tell current session of current window
|
|
33
|
-
write text \"cbox attach $SESSION\"
|
|
34
|
-
end tell
|
|
35
|
-
end tell"
|
|
36
|
-
else
|
|
37
|
-
osascript -e "tell application \"Terminal\"
|
|
38
|
-
do script \"cbox attach $SESSION\"
|
|
39
|
-
activate
|
|
40
|
-
end tell"
|
|
41
|
-
fi
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# @raycast.schemaVersion 1
|
|
4
|
-
# @raycast.title CSB Kill Session
|
|
5
|
-
# @raycast.mode silent
|
|
6
|
-
# @raycast.packageName cbox
|
|
7
|
-
# @raycast.description Kill a Claude Sandbox session
|
|
8
|
-
# @raycast.argument1 { "type": "text", "placeholder": "Session ID or name" }
|
|
9
|
-
|
|
10
|
-
SESSION="$1"
|
|
11
|
-
cbox kill "$SESSION" && echo "Session $SESSION killed."
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# @raycast.schemaVersion 1
|
|
4
|
-
# @raycast.title CSB Run Prompt
|
|
5
|
-
# @raycast.mode fullOutput
|
|
6
|
-
# @raycast.packageName cbox
|
|
7
|
-
# @raycast.description Run a one-shot Claude Code prompt and show output
|
|
8
|
-
# @raycast.argument1 { "type": "text", "placeholder": "Your prompt" }
|
|
9
|
-
|
|
10
|
-
PROMPT="$1"
|
|
11
|
-
RESULT=$(cbox run -j "$PROMPT" 2>&1)
|
|
12
|
-
echo "$RESULT" | python3 -c "
|
|
13
|
-
import sys, json
|
|
14
|
-
try:
|
|
15
|
-
data = json.load(sys.stdin)
|
|
16
|
-
if data.get('error'):
|
|
17
|
-
print('Error:', data['error'])
|
|
18
|
-
else:
|
|
19
|
-
print(data.get('output', ''))
|
|
20
|
-
except:
|
|
21
|
-
print(sys.stdin.read())
|
|
22
|
-
"
|