-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup
More file actions
executable file
·43 lines (38 loc) · 1.8 KB
/
Copy pathsetup
File metadata and controls
executable file
·43 lines (38 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# setup — Diecast installer.
#
# Takes a fresh clone of
# github.com/sridherj/diecast on a machine with `uv` + `git` + Claude Code
# and produces a usable Diecast install in under 90 seconds.
#
# Usage:
# ./setup # full install with $CAST_TERMINAL prompt
# ./setup --dry-run # print the action plan without touching the filesystem
# ./setup --upgrade # rerun path used by /cast-upgrade (sp2b)
# ./setup --no-prompt # skip the $CAST_TERMINAL prompt (CI / non-interactive)
# ./setup --help # this help
#
# Pre-existing files at install targets are backed up under
# ~/.claude/.cast-bak-<UTC-timestamp>/ before being overwritten.
# The 5 newest backup directories are retained; the rest are pruned.
#
# ── $CAST_TERMINAL prompt: dual interactive paths ──
# 1. Claude Code branch: ./setup invoked from inside a Claude Code session that
# has the diecast repo loaded (CAST_INTERACTIVE=1) → use cast-interactive-questions
# (richer rendering via AskUserQuestion).
# 2. Pure shell branch: ./setup invoked from a plain terminal → use Python `input()`.
# Do NOT collapse the two paths. Pure shell installs are the dominant first-touch case.
import os
import sys
from pathlib import Path
# Resolve the repo root so we can import the bootstrap package without
# requiring it to be installed (bootstrap runs before `uv sync`).
_SCRIPT_DIR = Path(__file__).resolve().parent
_CAST_SERVER_DIR = _SCRIPT_DIR / "cast-server"
# Add cast-server/ to sys.path so `cast_server.bootstrap.setup_flow` is importable.
if str(_CAST_SERVER_DIR) not in sys.path:
sys.path.insert(0, str(_CAST_SERVER_DIR))
from cast_server.bootstrap.setup_flow import run_setup # noqa: E402
if __name__ == "__main__":
run_setup(repo_dir=_SCRIPT_DIR)