Skip to content

Commit e2a7ec7

Browse files
committed
Add non-TUI inspect flow and ignore local AI artifacts
1 parent a2003f7 commit e2a7ec7

4 files changed

Lines changed: 47 additions & 1 deletion

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ __pycache__/
77
.venv/
88
venv/
99
.claude/
10+
CLAUDE.md
1011
.coverage
1112
*.egg-info/
1213

@@ -26,6 +27,9 @@ dump.txt
2627
*.bin
2728
models/object_gate/
2829
release/
30+
report.json
31+
refactor-instructions.md
32+
phasmid-autotest/
2933

3034
!requirements.txt
3135
!MIO _Logo.png

src/phasmid/cli.py

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,11 @@ def _build_tui_parser() -> argparse.ArgumentParser:
450450

451451
inspect_p = subparsers.add_parser("inspect", help="Inspect a Vessel")
452452
inspect_p.add_argument("vessel", nargs="?", help="Path to Vessel file")
453+
inspect_p.add_argument(
454+
"--no-tui",
455+
action="store_true",
456+
help="Print Vessel status without opening the TUI",
457+
)
453458

454459
close_p = subparsers.add_parser("close", help="Close a Vessel")
455460
close_p.add_argument("vessel", nargs="?", help="Path to Vessel file")
@@ -683,6 +688,9 @@ def main():
683688

684689
if args.command == "inspect":
685690
vessel = getattr(args, "vessel", None)
691+
no_tui = getattr(args, "no_tui", False)
692+
if no_tui or not sys.stdout.isatty():
693+
return _run_inspect_command(args)
686694
from .tui.app import run_tui
687695

688696
run_tui(initial_screen="inspect", vessel_path=vessel)
@@ -786,6 +794,32 @@ def _run_close_command(args) -> int:
786794
return 0
787795

788796

797+
def _run_inspect_command(args) -> int:
798+
vessel = getattr(args, "vessel", None)
799+
if not vessel:
800+
error("Vessel path is required for inspect.")
801+
return 1
802+
803+
path = Path(vessel).expanduser().resolve()
804+
if not path.exists():
805+
error(f"vessel file not found: {path}")
806+
return 1
807+
808+
svc = VesselWorkflowService()
809+
try:
810+
vessels = svc._vessels.list_all()
811+
meta = next((item for item in vessels if item.path.resolve() == path), None)
812+
except OSError as exc:
813+
error(str(exc))
814+
return 1
815+
816+
status_label = "open" if meta and meta.is_open else "closed"
817+
open_count = meta.open_count if meta else 0
818+
info(f"Vessel: {path.name}")
819+
info(f"status: {status_label} open count: {open_count}")
820+
return 0
821+
822+
789823
def _run_face_command(args) -> int:
790824
if getattr(args, "face_command", None) != "create":
791825
error("Face action is required.")
@@ -1678,4 +1712,4 @@ def _run_legacy_command(args) -> None:
16781712

16791713

16801714
if __name__ == "__main__":
1681-
main()
1715+
sys.exit(main() or 0)

src/phasmid/config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,7 @@ def standby_hotkey() -> str:
243243

244244
def allow_no_object_binding() -> bool:
245245
return env_flag("PHASMID_ALLOW_NO_OBJECT_BINDING", default=False)
246+
247+
248+
def config_dir_override() -> str:
249+
return env_text("PHASMID_CONFIG_DIR", "").strip()

src/phasmid/services/profile_service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import tomli_w
1414

15+
from ..config import config_dir_override
1516
from ..models.profile import Profile # noqa: F401 (re-exported)
1617

1718
APP_NAME = "phasmid"
@@ -20,6 +21,9 @@
2021

2122

2223
def config_dir() -> Path:
24+
override = config_dir_override()
25+
if override:
26+
return Path(override)
2327
return Path(platformdirs.user_config_dir(APP_NAME, APP_AUTHOR))
2428

2529

0 commit comments

Comments
 (0)