aibox-cli 0.1.0 → 0.2.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/bin/aibox +26 -13
- package/package.json +1 -1
package/bin/aibox
CHANGED
|
@@ -20,14 +20,15 @@
|
|
|
20
20
|
# aibox help Show this help (default)
|
|
21
21
|
#
|
|
22
22
|
# Flags:
|
|
23
|
-
# --name NAME
|
|
23
|
+
# -n, --name NAME Run a named instance (e.g. -n refactor)
|
|
24
24
|
# Allows multiple containers per project
|
|
25
|
-
# --
|
|
25
|
+
# -d, --dir PATH Run in a different project directory
|
|
26
|
+
# -i, --image NAME Override base Docker image (default: aibox:latest)
|
|
27
|
+
# -c, --copy Copy project into container (full isolation, no host sync)
|
|
28
|
+
# -w, --worktree Use git worktree (lightweight isolation, stays on host)
|
|
29
|
+
# -y, --yolo Yolo mode: skip permissions, full sudo, no firewall
|
|
30
|
+
# -s, --safe Safe mode: keep permissions, restricted sudo, firewall on
|
|
26
31
|
# --shared-modules Share node_modules between host and container
|
|
27
|
-
# --copy Copy project into container (full isolation, no host sync)
|
|
28
|
-
# --worktree Use git worktree (lightweight isolation, stays on host)
|
|
29
|
-
# --yolo Yolo mode: skip permissions, full sudo, no firewall
|
|
30
|
-
# --safe Safe mode: keep permissions, restricted sudo, firewall on
|
|
31
32
|
#
|
|
32
33
|
# Network firewall:
|
|
33
34
|
# Default: only allows Claude API, npm, GitHub, PyPI, SSH, DNS.
|
|
@@ -183,6 +184,7 @@ _check_deps() {
|
|
|
183
184
|
IMAGE="$DEFAULT_IMAGE"
|
|
184
185
|
SHARED_MODULES=false
|
|
185
186
|
INSTANCE_NAME=""
|
|
187
|
+
PROJECT_DIR_FLAG=""
|
|
186
188
|
DOWN_ALL=false
|
|
187
189
|
DOWN_CLEAN=false
|
|
188
190
|
SKIP_PERMISSIONS=false
|
|
@@ -193,24 +195,28 @@ POSITIONAL=()
|
|
|
193
195
|
parse_flags() {
|
|
194
196
|
while [[ $# -gt 0 ]]; do
|
|
195
197
|
case "$1" in
|
|
196
|
-
|
|
198
|
+
-i|--image)
|
|
197
199
|
IMAGE="${2:?'--image requires a value'}"
|
|
198
200
|
shift 2
|
|
199
201
|
;;
|
|
200
|
-
|
|
202
|
+
-n|--name)
|
|
201
203
|
INSTANCE_NAME="${2:?'--name requires a value'}"
|
|
202
204
|
shift 2
|
|
203
205
|
;;
|
|
206
|
+
-d|--dir)
|
|
207
|
+
PROJECT_DIR_FLAG="${2:?'--dir requires a value'}"
|
|
208
|
+
shift 2
|
|
209
|
+
;;
|
|
204
210
|
--shared-modules)
|
|
205
211
|
SHARED_MODULES=true
|
|
206
212
|
shift
|
|
207
213
|
;;
|
|
208
|
-
|
|
214
|
+
-c|--copy)
|
|
209
215
|
[[ -n "$ISOLATION" ]] && { echo "Error: --copy and --worktree are mutually exclusive" >&2; exit 1; }
|
|
210
216
|
ISOLATION="copy"
|
|
211
217
|
shift
|
|
212
218
|
;;
|
|
213
|
-
|
|
219
|
+
-w|--worktree)
|
|
214
220
|
[[ -n "$ISOLATION" ]] && { echo "Error: --copy and --worktree are mutually exclusive" >&2; exit 1; }
|
|
215
221
|
ISOLATION="worktree"
|
|
216
222
|
shift
|
|
@@ -223,11 +229,11 @@ parse_flags() {
|
|
|
223
229
|
DOWN_CLEAN=true
|
|
224
230
|
shift
|
|
225
231
|
;;
|
|
226
|
-
|
|
232
|
+
-y|--yolo)
|
|
227
233
|
SKIP_PERMISSIONS=true
|
|
228
234
|
shift
|
|
229
235
|
;;
|
|
230
|
-
|
|
236
|
+
-s|--safe)
|
|
231
237
|
SAFE_MODE=true
|
|
232
238
|
shift
|
|
233
239
|
;;
|
|
@@ -254,7 +260,14 @@ elif [[ "$SAFE_MODE" == "true" ]]; then
|
|
|
254
260
|
fi
|
|
255
261
|
|
|
256
262
|
# ── Per-project config file (.aibox) ─────────────────────────────
|
|
257
|
-
|
|
263
|
+
if [[ -n "$PROJECT_DIR_FLAG" ]]; then
|
|
264
|
+
PROJECT_DIR="$(cd "$PROJECT_DIR_FLAG" 2>/dev/null && pwd)" || {
|
|
265
|
+
echo "Error: directory not found: $PROJECT_DIR_FLAG" >&2
|
|
266
|
+
exit 1
|
|
267
|
+
}
|
|
268
|
+
else
|
|
269
|
+
PROJECT_DIR="$(pwd)"
|
|
270
|
+
fi
|
|
258
271
|
PROJECT_CONF="${PROJECT_DIR}/.aibox"
|
|
259
272
|
|
|
260
273
|
# ── Safety: refuse to run in dangerous directories ───────────────
|