liutaio 0.1.6 → 0.1.8
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/docker/run.sh +37 -11
- package/package.json +1 -1
package/docker/run.sh
CHANGED
|
@@ -42,6 +42,8 @@ REPO_ROOT=""
|
|
|
42
42
|
EXTRA_ENVS=()
|
|
43
43
|
FORCE_OAUTH=false
|
|
44
44
|
FRESH_LOGIN=false
|
|
45
|
+
SHOW_HELP=false
|
|
46
|
+
CREDS_FILE_OVERRIDE=""
|
|
45
47
|
|
|
46
48
|
while [[ $# -gt 0 ]]; do
|
|
47
49
|
case $1 in
|
|
@@ -50,11 +52,12 @@ while [[ $# -gt 0 ]]; do
|
|
|
50
52
|
--fresh-login) FRESH_LOGIN=true; FORCE_OAUTH=true; shift ;;
|
|
51
53
|
--rebuild) REBUILD=true; shift ;;
|
|
52
54
|
--dry-run) DRY_RUN=true; shift ;;
|
|
53
|
-
--help|-h) AGENTS_FILE=""; ITERATIONS=""; BASE_BRANCH=""; break ;;
|
|
55
|
+
--help|-h) AGENTS_FILE=""; ITERATIONS=""; BASE_BRANCH=""; SHOW_HELP=true; break ;;
|
|
54
56
|
--name) CONTAINER_NAME="$2"; shift 2 ;;
|
|
55
57
|
--node-version) NODE_VERSION="$2"; shift 2 ;;
|
|
56
58
|
--repo) REPO_ROOT="$2"; shift 2 ;;
|
|
57
59
|
--env) EXTRA_ENVS+=("$2"); shift 2 ;;
|
|
60
|
+
--creds-file) CREDS_FILE_OVERRIDE="$2"; shift 2 ;;
|
|
58
61
|
-*) echo "Unknown option: $1"; exit 1 ;;
|
|
59
62
|
*)
|
|
60
63
|
if [ -z "$AGENTS_FILE" ]; then AGENTS_FILE="$1"
|
|
@@ -86,20 +89,23 @@ if [ -z "$AGENTS_FILE" ] || [ -z "$ITERATIONS" ] || [ -z "$BASE_BRANCH" ]; then
|
|
|
86
89
|
echo " --node-version V Node.js version (default: 22, or LIUTAIO_NODE_VERSION)"
|
|
87
90
|
echo " --repo PATH Path to git repo (default: auto-detect from cwd)"
|
|
88
91
|
echo " --env KEY=VALUE Pass env var into the container (repeatable)"
|
|
92
|
+
echo " --creds-file PATH Use specific Claude credentials file (overrides auto-detect)"
|
|
89
93
|
echo " --agent-template Print the agent.md template to stdout"
|
|
90
94
|
echo " --version, -v Show version number"
|
|
91
95
|
echo ""
|
|
92
96
|
echo "Authentication (checked in this order):"
|
|
93
|
-
echo " 1.
|
|
94
|
-
echo " 2.
|
|
95
|
-
echo " 3.
|
|
96
|
-
echo " 4.
|
|
97
|
+
echo " 1. --creds-file PATH (explicit override)"
|
|
98
|
+
echo " 2. macOS Keychain (Claude Code-credentials)"
|
|
99
|
+
echo " 3. \$CLAUDE_CONFIG_DIR/.credentials.json (default: ~/.claude/.credentials.json)"
|
|
100
|
+
echo " 4. ANTHROPIC_API_KEY env var"
|
|
101
|
+
echo " 5. Cached OAuth (Docker volume from a previous --oauth run)"
|
|
102
|
+
echo " 6. Interactive OAuth login (prompts in the terminal)"
|
|
97
103
|
echo ""
|
|
98
104
|
echo "Examples:"
|
|
99
105
|
echo " liutaio agent.md 10 my-branch # auto-detect auth"
|
|
100
106
|
echo " liutaio agent.md 10 my-branch --oauth # force OAuth login"
|
|
101
107
|
echo " liutaio agent.md 10 my-branch --fresh-login # re-authenticate"
|
|
102
|
-
exit 1
|
|
108
|
+
if $SHOW_HELP; then exit 0; else exit 1; fi
|
|
103
109
|
fi
|
|
104
110
|
|
|
105
111
|
# ─── Detect repo root ───────────────────────────────────────────────
|
|
@@ -153,6 +159,24 @@ resolve_auth() {
|
|
|
153
159
|
# --oauth skips host credentials, goes straight to cached OAuth or interactive
|
|
154
160
|
if ! $FORCE_OAUTH; then
|
|
155
161
|
|
|
162
|
+
# 0. Explicit --creds-file override (highest priority)
|
|
163
|
+
if [ -n "$CREDS_FILE_OVERRIDE" ]; then
|
|
164
|
+
if [ ! -f "$CREDS_FILE_OVERRIDE" ]; then
|
|
165
|
+
echo "Error: --creds-file not found: $CREDS_FILE_OVERRIDE"
|
|
166
|
+
exit 1
|
|
167
|
+
fi
|
|
168
|
+
CREDS_FILE=$(mktemp "${TMPDIR:-/tmp}/liutaio-creds-XXXXXX")
|
|
169
|
+
chmod 600 "$CREDS_FILE"
|
|
170
|
+
cp "$CREDS_FILE_OVERRIDE" "$CREDS_FILE"
|
|
171
|
+
if jq -e '.claudeAiOauth.accessToken' "$CREDS_FILE" >/dev/null 2>&1; then
|
|
172
|
+
AUTH_METHOD="creds-file-override"
|
|
173
|
+
return 0
|
|
174
|
+
fi
|
|
175
|
+
echo "Error: --creds-file does not contain a valid OAuth token: $CREDS_FILE_OVERRIDE"
|
|
176
|
+
rm -f "$CREDS_FILE"
|
|
177
|
+
exit 1
|
|
178
|
+
fi
|
|
179
|
+
|
|
156
180
|
# 1. Host credentials: macOS Keychain
|
|
157
181
|
if [ "$(uname)" = "Darwin" ]; then
|
|
158
182
|
local keychain_data
|
|
@@ -170,11 +194,12 @@ resolve_auth() {
|
|
|
170
194
|
fi
|
|
171
195
|
fi
|
|
172
196
|
|
|
173
|
-
# 2. Host credentials:
|
|
174
|
-
|
|
197
|
+
# 2. Host credentials: $CLAUDE_CONFIG_DIR/.credentials.json (default: ~/.claude)
|
|
198
|
+
CLAUDE_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
|
|
199
|
+
if [ -f "$CLAUDE_DIR/.credentials.json" ]; then
|
|
175
200
|
CREDS_FILE=$(mktemp "${TMPDIR:-/tmp}/liutaio-creds-XXXXXX")
|
|
176
201
|
chmod 600 "$CREDS_FILE"
|
|
177
|
-
cp "$
|
|
202
|
+
cp "$CLAUDE_DIR/.credentials.json" "$CREDS_FILE"
|
|
178
203
|
if jq -e '.claudeAiOauth.accessToken' "$CREDS_FILE" >/dev/null 2>&1; then
|
|
179
204
|
AUTH_METHOD="credentials-file"
|
|
180
205
|
return 0
|
|
@@ -330,8 +355,9 @@ fi
|
|
|
330
355
|
# ─── Display auth method ────────────────────────────────────────────
|
|
331
356
|
AUTH_DISPLAY=""
|
|
332
357
|
case "$AUTH_METHOD" in
|
|
333
|
-
keychain)
|
|
334
|
-
|
|
358
|
+
keychain) AUTH_DISPLAY="macOS Keychain" ;;
|
|
359
|
+
creds-file-override) AUTH_DISPLAY="$CREDS_FILE_OVERRIDE (--creds-file)" ;;
|
|
360
|
+
credentials-file) AUTH_DISPLAY="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/.credentials.json" ;;
|
|
335
361
|
api-key) AUTH_DISPLAY="ANTHROPIC_API_KEY" ;;
|
|
336
362
|
cached-oauth) AUTH_DISPLAY="cached OAuth (use --fresh-login to re-auth)" ;;
|
|
337
363
|
interactive-oauth) AUTH_DISPLAY="interactive OAuth (will prompt)" ;;
|