liutaio 0.1.7 → 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.
Files changed (2) hide show
  1. package/docker/run.sh +34 -9
  2. package/package.json +1 -1
package/docker/run.sh CHANGED
@@ -43,6 +43,7 @@ EXTRA_ENVS=()
43
43
  FORCE_OAUTH=false
44
44
  FRESH_LOGIN=false
45
45
  SHOW_HELP=false
46
+ CREDS_FILE_OVERRIDE=""
46
47
 
47
48
  while [[ $# -gt 0 ]]; do
48
49
  case $1 in
@@ -56,6 +57,7 @@ while [[ $# -gt 0 ]]; do
56
57
  --node-version) NODE_VERSION="$2"; shift 2 ;;
57
58
  --repo) REPO_ROOT="$2"; shift 2 ;;
58
59
  --env) EXTRA_ENVS+=("$2"); shift 2 ;;
60
+ --creds-file) CREDS_FILE_OVERRIDE="$2"; shift 2 ;;
59
61
  -*) echo "Unknown option: $1"; exit 1 ;;
60
62
  *)
61
63
  if [ -z "$AGENTS_FILE" ]; then AGENTS_FILE="$1"
@@ -87,14 +89,17 @@ if [ -z "$AGENTS_FILE" ] || [ -z "$ITERATIONS" ] || [ -z "$BASE_BRANCH" ]; then
87
89
  echo " --node-version V Node.js version (default: 22, or LIUTAIO_NODE_VERSION)"
88
90
  echo " --repo PATH Path to git repo (default: auto-detect from cwd)"
89
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)"
90
93
  echo " --agent-template Print the agent.md template to stdout"
91
94
  echo " --version, -v Show version number"
92
95
  echo ""
93
96
  echo "Authentication (checked in this order):"
94
- echo " 1. Cached OAuth credentials (Docker volume from a previous --oauth run)"
95
- echo " 2. Host credentials (macOS Keychain or ~/.claude/.credentials.json)"
96
- echo " 3. ANTHROPIC_API_KEY env var"
97
- echo " 4. Interactive OAuth login (prompts in the terminal)"
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)"
98
103
  echo ""
99
104
  echo "Examples:"
100
105
  echo " liutaio agent.md 10 my-branch # auto-detect auth"
@@ -154,6 +159,24 @@ resolve_auth() {
154
159
  # --oauth skips host credentials, goes straight to cached OAuth or interactive
155
160
  if ! $FORCE_OAUTH; then
156
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
+
157
180
  # 1. Host credentials: macOS Keychain
158
181
  if [ "$(uname)" = "Darwin" ]; then
159
182
  local keychain_data
@@ -171,11 +194,12 @@ resolve_auth() {
171
194
  fi
172
195
  fi
173
196
 
174
- # 2. Host credentials: ~/.claude/.credentials.json
175
- if [ -f "$HOME/.claude/.credentials.json" ]; then
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
176
200
  CREDS_FILE=$(mktemp "${TMPDIR:-/tmp}/liutaio-creds-XXXXXX")
177
201
  chmod 600 "$CREDS_FILE"
178
- cp "$HOME/.claude/.credentials.json" "$CREDS_FILE"
202
+ cp "$CLAUDE_DIR/.credentials.json" "$CREDS_FILE"
179
203
  if jq -e '.claudeAiOauth.accessToken' "$CREDS_FILE" >/dev/null 2>&1; then
180
204
  AUTH_METHOD="credentials-file"
181
205
  return 0
@@ -331,8 +355,9 @@ fi
331
355
  # ─── Display auth method ────────────────────────────────────────────
332
356
  AUTH_DISPLAY=""
333
357
  case "$AUTH_METHOD" in
334
- keychain) AUTH_DISPLAY="macOS Keychain" ;;
335
- credentials-file) AUTH_DISPLAY="~/.claude/.credentials.json" ;;
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" ;;
336
361
  api-key) AUTH_DISPLAY="ANTHROPIC_API_KEY" ;;
337
362
  cached-oauth) AUTH_DISPLAY="cached OAuth (use --fresh-login to re-auth)" ;;
338
363
  interactive-oauth) AUTH_DISPLAY="interactive OAuth (will prompt)" ;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liutaio",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Run AI coding agents in Docker containers — autonomously, safely, and with zero setup.",
5
5
  "license": "MIT",
6
6
  "bin": {