4242import hashlib
4343import json
4444import os
45+ import shlex
4546import shutil
4647import subprocess
4748from pathlib import Path
5253ENGINE_ROOT = Path (__file__ ).resolve ().parents [2 ]
5354SKEL_SHIP_CHECK = ENGINE_ROOT / "skel" / "ship-check.py"
5455
55- # ── Spine (oracle CLI) paths ──────────────────────────────────────────────────
56- SPINE_ROOT = Path ( "/home/anombyte/Hermes/current-projects/.worktrees/atlas-coin- oracle" )
57- TSX_BIN = SPINE_ROOT / "node_modules" / ".bin" / "tsx"
58- CLI_SRC = SPINE_ROOT / " apps" / " cli" / " src" / " index.ts"
59- # The oracle invocation prefix consumed by ship-check.py via ATLAS_ORACLE_CMD .
60- CLI_CMD = f" { TSX_BIN } { CLI_SRC } "
56+ # ── Spine (oracle CLI) ────── ──────────────────────────────────────────────────
57+ # The oracle invocation prefix is supplied via the ATLAS_ORACLE_CMD env var so
58+ # this test stays portable (no hardcoded paths). Point it at your built atlas CLI,
59+ # e.g. ATLAS_ORACLE_CMD="<spine>/node_modules/.bin/tsx <spine>/ apps/ cli/ src/ index.ts"
60+ # ship-check.py shlex-splits it and appends `oracle grade ...` .
61+ CLI_CMD = os . environ . get ( "ATLAS_ORACLE_CMD" , "" )
6162
6263ALPINE_REF = "docker.io/library/alpine:3.20"
6364
@@ -68,7 +69,7 @@ def has_podman() -> bool:
6869
6970
7071def has_oracle_cli () -> bool :
71- return TSX_BIN . exists () and CLI_SRC . exists ( )
72+ return bool ( CLI_CMD . strip () )
7273
7374
7475def resolve_alpine_digest () -> str :
@@ -86,7 +87,7 @@ def resolve_alpine_digest() -> str:
8687 return digest
8788
8889
89- SKIP_REASON = "requires podman + the built atlas oracle CLI (tsx) in the spine worktree "
90+ SKIP_REASON = "requires podman + ATLAS_ORACLE_CMD pointing at a built atlas oracle CLI"
9091podman_and_cli = pytest .mark .skipif (
9192 not (has_podman () and has_oracle_cli ()), reason = SKIP_REASON
9293)
@@ -260,7 +261,7 @@ def test_ledger_integrity(tmp_path):
260261
261262 ledger_dir = root / ".atlas-ai" / "ledger"
262263 verify = subprocess .run (
263- [ str ( TSX_BIN ), str ( CLI_SRC ), "ledger" , "verify" , str (ledger_dir )],
264+ shlex . split ( CLI_CMD ) + [ "ledger" , "verify" , str (ledger_dir )],
264265 capture_output = True , text = True ,
265266 )
266267 if verify .returncode == 0 and verify .stdout .strip ():
0 commit comments