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.
26 lines
1.8 KiB
Bash
Executable File
26 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Append one orbit-usage feedback record (JSONL). Cheap: one call per orbit query that informed a decision.
|
|
# Usage: fb.sh <recipe|adhoc> <verdict> "<purpose>" "<orbit command>" <result_rows> ["<note>"] [gap]
|
|
# verdict: useful | wrong | incomplete | grep-needed | noise | unused
|
|
# gap (optional): cfg-test | cfg-feature | gated-file | dyn | fn-ref | macro | rsx | cross-file-impl |
|
|
# external-trait | inline-path | pattern-match | stale-index | sig-truncated | other
|
|
# Env: ORBIT_FEEDBACK (default ~/.local/share/orbit-skill/feedback.jsonl), ORBIT_AGENT (e.g. search, reviewer)
|
|
set -euo pipefail
|
|
F=${ORBIT_FEEDBACK:-$HOME/.local/share/orbit-skill/feedback.jsonl}; mkdir -p "$(dirname "$F")"
|
|
top=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
common=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null || echo "$top/.git")
|
|
python3 - "$F" "$top" "$common" "$@" <<'PY'
|
|
import json, sys, subprocess, datetime, os
|
|
F, top, common, recipe, verdict, purpose, cmd, rows = sys.argv[1:9]
|
|
note = sys.argv[9] if len(sys.argv) > 9 else ''
|
|
gap = sys.argv[10] if len(sys.argv) > 10 else ''
|
|
g = lambda *a: subprocess.run(['git', '-C', top, *a], capture_output=True, text=True).stdout.strip()
|
|
rec = dict(ts=datetime.datetime.now().astimezone().isoformat(timespec='seconds'),
|
|
repo=os.path.basename(os.path.dirname(common)) if common.endswith('.git') else os.path.basename(top),
|
|
commit=g('rev-parse', '--short=8', 'HEAD'), dirty=bool(g('status', '--porcelain')),
|
|
orbit=subprocess.run(['orbit', '--version'], capture_output=True, text=True).stdout.split()[-1],
|
|
agent=os.environ.get('ORBIT_AGENT', ''), recipe=recipe, purpose=purpose, cmd=cmd,
|
|
rows=int(rows) if rows.isdigit() else rows, verdict=verdict, gap=gap, note=note)
|
|
open(F, 'a').write(json.dumps(rec, ensure_ascii=False) + '\n')
|
|
PY
|