cc-pets 0.1.0 → 0.1.1
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/claude-with-pet +1 -12
- package/bin/codex-with-pet +10 -13
- package/package.json +1 -1
package/bin/claude-with-pet
CHANGED
|
@@ -23,17 +23,6 @@ fi
|
|
|
23
23
|
|
|
24
24
|
mkdir -p "${CLIENT_DIR}"
|
|
25
25
|
touch "${CLIENT_FILE}"
|
|
26
|
-
cleanup() {
|
|
27
|
-
rm -f "${CLIENT_FILE}"
|
|
28
|
-
}
|
|
29
|
-
trap cleanup EXIT
|
|
30
|
-
trap 'exit 129' HUP
|
|
31
|
-
trap 'exit 130' INT
|
|
32
|
-
trap 'exit 143' TERM
|
|
33
26
|
|
|
34
27
|
open -g "${PET_APP}" --args --managed
|
|
35
|
-
|
|
36
|
-
"${REAL_CLAUDE}" "$@"
|
|
37
|
-
CLAUDE_STATUS=$?
|
|
38
|
-
set -e
|
|
39
|
-
exit "${CLAUDE_STATUS}"
|
|
28
|
+
exec "${REAL_CLAUDE}" "$@"
|
package/bin/codex-with-pet
CHANGED
|
@@ -5,27 +5,24 @@ SCRIPT_DIR="${0:A:h}"
|
|
|
5
5
|
PROJECT_DIR="${SCRIPT_DIR:h}"
|
|
6
6
|
PET_BIN="${PROJECT_DIR}/.build/release/codex-pet"
|
|
7
7
|
PET_APP="${PROJECT_DIR}/.build/release/CodexPet.app"
|
|
8
|
-
REAL_CODEX="${CODEX_REAL_BIN
|
|
8
|
+
REAL_CODEX="${CODEX_REAL_BIN:-}"
|
|
9
9
|
CLIENT_DIR="${${TMPDIR:-/tmp/}%/}/codex-pet-$(id -u)-clients"
|
|
10
10
|
CLIENT_FILE="${CLIENT_DIR}/$$"
|
|
11
11
|
|
|
12
|
+
if [[ -z "${REAL_CODEX}" ]]; then
|
|
13
|
+
REAL_CODEX="$(whence -p codex 2>/dev/null || true)"
|
|
14
|
+
fi
|
|
15
|
+
if [[ -z "${REAL_CODEX}" || ! -x "${REAL_CODEX}" ]]; then
|
|
16
|
+
print -u2 "未找到可执行的 Codex CLI。请先安装 codex,或通过 CODEX_REAL_BIN 指定真实路径。"
|
|
17
|
+
exit 127
|
|
18
|
+
fi
|
|
19
|
+
|
|
12
20
|
if [[ ! -x "${PET_BIN}" || ! -d "${PET_APP}" ]]; then
|
|
13
21
|
"${PROJECT_DIR}/scripts/build.sh" >/dev/null
|
|
14
22
|
fi
|
|
15
23
|
|
|
16
24
|
mkdir -p "${CLIENT_DIR}"
|
|
17
25
|
touch "${CLIENT_FILE}"
|
|
18
|
-
cleanup() {
|
|
19
|
-
rm -f "${CLIENT_FILE}"
|
|
20
|
-
}
|
|
21
|
-
trap cleanup EXIT
|
|
22
|
-
trap 'exit 129' HUP
|
|
23
|
-
trap 'exit 130' INT
|
|
24
|
-
trap 'exit 143' TERM
|
|
25
26
|
|
|
26
27
|
open -g "${PET_APP}" --args --managed
|
|
27
|
-
|
|
28
|
-
"${REAL_CODEX}" "$@"
|
|
29
|
-
CODEX_STATUS=$?
|
|
30
|
-
set -e
|
|
31
|
-
exit "${CODEX_STATUS}"
|
|
28
|
+
exec "${REAL_CODEX}" "$@"
|