Files
g4borg f1de89e869 🤖 Add orbit prototype plugin for Rust code review
Standalone plugin with one skill: when to use orbit and when grep, a
mandatory preflight for stale indexes and blind regions (cfg(test),
features, macros, dyn dispatch), a scripted review pass over isolated
worktree DBs, and a JSONL feedback log for mining real usage later.
Registered in the marketplace as a prototype.
2026-09-29 19:52:59 +02:00

27 lines
947 B
Python
Executable File

"""Tiny helper: run orbit sql against an isolated DB, scoped to a worktree's commit."""
import json, os, subprocess, sys
def load_env(path):
env = {}
for line in open(path):
line = line.strip()
if '=' in line and not line.startswith('#'):
k, v = line.split('=', 1)
env[k] = v
return env
def q(sql, repo=None, db=None, all_=False):
cmd = ['orbit', 'sql', sql, '-F', 'json']
if db: cmd += ['--db', db]
if all_: cmd += ['--all']
elif repo: cmd += ['--repo', repo]
r = subprocess.run(cmd, capture_output=True, text=True)
if r.returncode != 0:
sys.exit(f"orbit sql failed: {r.stderr.strip()}\n{sql}")
if 'not indexed' in r.stderr:
sys.exit(f"STALE/UNINDEXED scope: {r.stderr.strip()}")
return json.loads(r.stdout or '[]')
def git(repo, *args):
return subprocess.run(['git', '-C', repo, *args], capture_output=True, text=True, check=True).stdout