aibox-cli 0.2.0 → 0.3.0
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/README.md +13 -12
- package/bin/aibox +21 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ aibox generates a `compose.dev.yaml` and configures your IDE on `aibox init` (or
|
|
|
88
88
|
2. Run `aibox init` in your project
|
|
89
89
|
3. Set the plugin's startup command to:
|
|
90
90
|
```
|
|
91
|
-
|
|
91
|
+
npx aibox claude --yolo
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
The Node.js interpreter is also configured to use the container, so running/debugging from the IDE uses the same sandboxed environment.
|
|
@@ -147,17 +147,18 @@ SHARED_MODULES=false
|
|
|
147
147
|
|
|
148
148
|
## All Flags
|
|
149
149
|
|
|
150
|
-
|
|
|
151
|
-
|
|
152
|
-
| `--name NAME` | Named instance (multiple containers per project) |
|
|
153
|
-
| `--
|
|
154
|
-
|
|
|
155
|
-
| `--copy` | Copy repo into Docker volume (full isolation) |
|
|
156
|
-
| `--worktree` | Use git worktree (lightweight isolation) |
|
|
157
|
-
| `--yolo` | Skip prompts, full sudo, no firewall |
|
|
158
|
-
| `--safe` | Keep prompts, restricted sudo, firewall on |
|
|
159
|
-
| `--
|
|
160
|
-
| `--
|
|
150
|
+
| Short | Long | Description |
|
|
151
|
+
|-------|------|-------------|
|
|
152
|
+
| `-n` | `--name NAME` | Named instance (multiple containers per project) |
|
|
153
|
+
| `-d` | `--dir PATH` | Run in a different project directory |
|
|
154
|
+
| `-i` | `--image NAME` | Override base Docker image |
|
|
155
|
+
| `-c` | `--copy` | Copy repo into Docker volume (full isolation) |
|
|
156
|
+
| `-w` | `--worktree` | Use git worktree (lightweight isolation) |
|
|
157
|
+
| `-y` | `--yolo` | Skip prompts, full sudo, no firewall |
|
|
158
|
+
| `-s` | `--safe` | Keep prompts, restricted sudo, firewall on |
|
|
159
|
+
| | `--shared-modules` | Share node_modules between host and container |
|
|
160
|
+
| | `--all` | With `down`: stop all project containers |
|
|
161
|
+
| | `--clean` | With `down`: also remove copy volumes / worktrees |
|
|
161
162
|
|
|
162
163
|
## License
|
|
163
164
|
|
package/bin/aibox
CHANGED
|
@@ -55,7 +55,7 @@ set -euo pipefail
|
|
|
55
55
|
|
|
56
56
|
# ── Script identity ──────────────────────────────────────────────
|
|
57
57
|
SCRIPT_NAME="$(basename "$0")"
|
|
58
|
-
AIBOX_VERSION="
|
|
58
|
+
AIBOX_VERSION="6"
|
|
59
59
|
CONFIG_DIR="${HOME}/.config/aibox"
|
|
60
60
|
DEFAULT_IMAGE="aibox:latest"
|
|
61
61
|
CONTAINER_PREFIX="aibox"
|
|
@@ -347,7 +347,7 @@ if ! [[ "$INSTANCE_NAME" =~ ^[a-z0-9_-]+$ ]]; then
|
|
|
347
347
|
exit 1
|
|
348
348
|
fi
|
|
349
349
|
CONTAINER_NAME="${BASE_CONTAINER_NAME}-${INSTANCE_NAME}"
|
|
350
|
-
WORKSPACE_DIR="/${PROJECT_NAME}"
|
|
350
|
+
WORKSPACE_DIR="/workspace/${PROJECT_NAME}"
|
|
351
351
|
|
|
352
352
|
# ── Isolation mode setup ─────────────────────────────────────────
|
|
353
353
|
COPY_VOLUME=""
|
|
@@ -436,6 +436,16 @@ set -e
|
|
|
436
436
|
# Fix auth volume ownership (Docker creates volumes as root)
|
|
437
437
|
chown -R aibox:aibox /home/aibox/.claude 2>/dev/null || true
|
|
438
438
|
|
|
439
|
+
# ── IDE path symlink ─────────────────────────────────────────
|
|
440
|
+
# Create symlink so container paths match host paths for IDE integration.
|
|
441
|
+
# Claude Code reports cwd-based paths to the IDE plugin; if they don't
|
|
442
|
+
# match host paths, diffs break (empty left side, wrong file path).
|
|
443
|
+
if [[ -n "${AIBOX_HOST_DIR:-}" && -n "${AIBOX_WORKSPACE_DIR:-}" \
|
|
444
|
+
&& "$AIBOX_HOST_DIR" != "$AIBOX_WORKSPACE_DIR" ]]; then
|
|
445
|
+
mkdir -p "$(dirname "$AIBOX_HOST_DIR")"
|
|
446
|
+
ln -sfn "$AIBOX_WORKSPACE_DIR" "$AIBOX_HOST_DIR"
|
|
447
|
+
fi
|
|
448
|
+
|
|
439
449
|
# ── Mode-dependent setup ──────────────────────────────────────
|
|
440
450
|
MODE="${AIBOX_MODE:-safe}"
|
|
441
451
|
|
|
@@ -535,7 +545,7 @@ _prepare_copy_volume() {
|
|
|
535
545
|
|
|
536
546
|
# Check if volume already has content (--entrypoint bypasses su-exec drop)
|
|
537
547
|
local has_content
|
|
538
|
-
has_content=$(docker run --rm --entrypoint sh -v "${COPY_VOLUME}
|
|
548
|
+
has_content=$(docker run --rm --entrypoint sh -v "${COPY_VOLUME}:${WORKSPACE_DIR}" "$IMAGE" -c "ls -A ${WORKSPACE_DIR} 2>/dev/null | head -1" 2>/dev/null || true)
|
|
539
549
|
|
|
540
550
|
if [[ -n "$has_content" ]]; then
|
|
541
551
|
echo "Copy volume already populated (${COPY_VOLUME}). Reusing."
|
|
@@ -555,14 +565,15 @@ _prepare_copy_volume() {
|
|
|
555
565
|
fi
|
|
556
566
|
|
|
557
567
|
if ! cat "$bundle_file" | docker run --rm -i --entrypoint sh \
|
|
558
|
-
-v "${COPY_VOLUME}
|
|
568
|
+
-v "${COPY_VOLUME}:${WORKSPACE_DIR}" \
|
|
559
569
|
"$IMAGE" -c "
|
|
560
570
|
cat > /tmp/repo.bundle
|
|
561
|
-
|
|
571
|
+
mkdir -p ${WORKSPACE_DIR}
|
|
572
|
+
cd ${WORKSPACE_DIR}
|
|
562
573
|
git clone /tmp/repo.bundle .
|
|
563
574
|
rm /tmp/repo.bundle
|
|
564
575
|
git checkout -b '${branch_name}' 2>/dev/null || git checkout '${branch_name}'
|
|
565
|
-
chown -R aibox:aibox
|
|
576
|
+
chown -R aibox:aibox ${WORKSPACE_DIR}
|
|
566
577
|
"; then
|
|
567
578
|
rm -f "$bundle_file"
|
|
568
579
|
docker volume rm "$COPY_VOLUME" 2>/dev/null || true
|
|
@@ -648,6 +659,8 @@ _environment_yaml() {
|
|
|
648
659
|
echo "${indent}- CLAUDE_CONFIG_DIR=/home/aibox/.claude"
|
|
649
660
|
echo "${indent}- AIBOX_MODE=\${AIBOX_MODE:-safe}"
|
|
650
661
|
echo "${indent}- AIBOX_EXTRA_DOMAINS=\${AIBOX_EXTRA_DOMAINS:-}"
|
|
662
|
+
echo "${indent}- AIBOX_HOST_DIR=${PROJECT_DIR}"
|
|
663
|
+
echo "${indent}- AIBOX_WORKSPACE_DIR=${WORKSPACE_DIR}"
|
|
651
664
|
}
|
|
652
665
|
|
|
653
666
|
# Build -e flags for docker exec from current terminal environment
|
|
@@ -709,7 +722,7 @@ services:
|
|
|
709
722
|
$(_labels_yaml " ")
|
|
710
723
|
volumes:
|
|
711
724
|
$(_volumes_yaml " " "$PROJECT_DIR")
|
|
712
|
-
working_dir: ${
|
|
725
|
+
working_dir: ${PROJECT_DIR}
|
|
713
726
|
environment:
|
|
714
727
|
$(_environment_yaml " ")
|
|
715
728
|
stdin_open: true
|
|
@@ -737,7 +750,7 @@ services:
|
|
|
737
750
|
$(_labels_yaml " ")
|
|
738
751
|
volumes:
|
|
739
752
|
$(_volumes_yaml " " ".")
|
|
740
|
-
working_dir: ${
|
|
753
|
+
working_dir: ${PROJECT_DIR}
|
|
741
754
|
environment:
|
|
742
755
|
$(_environment_yaml " ")
|
|
743
756
|
stdin_open: true
|