fix(system): S61-S62 — API cleanup, drone path routing, naming checker, .backup→.recovery rename (#142)
- API: 18-item P0/P1/P2 cleanup (debug prints→logger, help gate fix, URL injection fix, key masking, unused imports) - Drone: passport walk-up replaces hardcoded src/aipass/<branch> pattern, 13 naming bypasses removed - Seedgo: naming checker fixed (__dunder__ skip + column-0 scope detection) — eliminates 71 false positives system-wide - Spawn: .backup→.recovery rename (pre-change snapshots no longer conflict with backup branch namespace) - .gitignore: .recovery/ added - HERALD.md: Updated through S62 (backup audit, .recovery rename, night shift launch) - README.md: Stats updated (141 PRs, 2900+ tests) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ae459853f0
commit
6772cacce2
@@ -32,14 +32,31 @@ _COMMANDS = ("pr", "status", "sync", "lock", "unlock")
|
||||
|
||||
|
||||
def _detect_branch_dir() -> tuple[str, Path] | None:
|
||||
"""Detect caller's branch from CWD. Returns (branch_name, branch_dir) or None."""
|
||||
cwd = Path.cwd()
|
||||
parts = cwd.parts
|
||||
for i, part in enumerate(parts):
|
||||
if part == "aipass" and i > 0 and parts[i - 1] == "src" and i + 1 < len(parts):
|
||||
branch_name = parts[i + 1]
|
||||
branch_dir = Path(*parts[: i + 2])
|
||||
return branch_name, branch_dir
|
||||
"""Detect caller's branch from CWD via passport lookup.
|
||||
|
||||
Walks up from CWD looking for ``.trinity/passport.json`` and extracts
|
||||
the branch name + directory. Works for any registered branch regardless
|
||||
of where it lives on disk (commons, skills, aipass sub-dirs, etc.).
|
||||
"""
|
||||
current = Path.cwd().resolve()
|
||||
for _ in range(10):
|
||||
passport = current / ".trinity" / "passport.json"
|
||||
if passport.exists():
|
||||
try:
|
||||
with open(passport, "r", encoding="utf-8") as fh:
|
||||
data = json.load(fh)
|
||||
name = data.get("branch_info", {}).get("branch_name")
|
||||
if not name:
|
||||
name = data.get("identity", {}).get("name")
|
||||
if name:
|
||||
return name, current
|
||||
except Exception as exc:
|
||||
logger.warning("Failed to read passport at %s: %s", passport, exc)
|
||||
return None
|
||||
parent = current.parent
|
||||
if parent == current:
|
||||
break
|
||||
current = parent
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user