feat: DRY push functions, add push-greptile + sync test/show commands

Extract pushWithSync() helper to eliminate boilerplate across 6 push
functions. Add pushHeartbeat() for connectivity testing. Add push-greptile
to CLI. New commands: gstack-sync test (validates full push/pull flow
via sync_heartbeats table), gstack-sync show (terminal team data
dashboard with summary/evals/ships/retros views). Guard main block
with import.meta.main.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-15 19:42:45 -05:00
parent 704fe34e98
commit dc3fcc8611
3 changed files with 312 additions and 73 deletions
+31 -19
View File
@@ -2,15 +2,14 @@
# gstack-sync — team data sync CLI.
#
# Usage:
# gstack-sync setup — interactive auth flow
# gstack-sync status — show sync status (queue, cache, connection)
# gstack-sync push-eval <file> — push an eval result JSON to Supabase
# gstack-sync push-retro <file> — push a retro snapshot JSON
# gstack-sync push-qa <file> — push a QA report JSON
# gstack-sync push-ship <file> — push a ship log JSON
# gstack-sync pullpull team data to local cache
# gstack-sync draindrain the offline queue
# gstack-sync logout — clear auth tokens
# gstack-sync setup — interactive auth flow
# gstack-sync status — show sync status
# gstack-sync test — validate full sync flow
# gstack-sync show [evals|ships|retros] — view team data
# gstack-sync push-{eval,retro,qa,ship,greptile} <file> — push data
# gstack-sync pull — pull team data to local cache
# gstack-sync drain drain the offline queue
# gstack-sync logout clear auth tokens
#
# Env overrides (for testing):
# GSTACK_DIR — override auto-detected gstack root
@@ -42,6 +41,16 @@ case "${1:-}" in
FILE="${2:?Usage: gstack-sync push-ship <file.json>}"
exec bun run "$GSTACK_DIR/lib/cli-sync.ts" push-ship "$FILE"
;;
push-greptile)
FILE="${2:?Usage: gstack-sync push-greptile <file.json>}"
exec bun run "$GSTACK_DIR/lib/cli-sync.ts" push-greptile "$FILE"
;;
test)
exec bun run "$GSTACK_DIR/lib/cli-sync.ts" test
;;
show)
exec bun run "$GSTACK_DIR/lib/cli-sync.ts" show "${@:2}"
;;
pull)
exec bun run "$GSTACK_DIR/lib/cli-sync.ts" pull
;;
@@ -52,18 +61,21 @@ case "${1:-}" in
exec bun run "$GSTACK_DIR/lib/cli-sync.ts" logout
;;
*)
echo "Usage: gstack-sync {setup|status|push-eval|push-retro|push-qa|push-ship|pull|drain|logout}"
echo "Usage: gstack-sync <command> [args]"
echo ""
echo "Commands:"
echo " setup Interactive auth flow (opens browser)"
echo " status Show sync status (queue, cache, connection)"
echo " push-eval <file> Push eval result JSON to team store"
echo " push-retro <file> Push retro snapshot JSON"
echo " push-qa <file> Push QA report JSON"
echo " push-ship <file> Push ship log JSON"
echo " pull Pull team data to local cache"
echo " drain Drain the offline sync queue"
echo " logout Clear auth tokens"
echo " setup Interactive auth flow (opens browser)"
echo " status Show sync status (queue, cache, connection)"
echo " test Validate full sync flow (push + pull)"
echo " show [evals|ships|retros] View team data in terminal"
echo " push-eval <file> Push eval result JSON to team store"
echo " push-retro <file> Push retro snapshot JSON"
echo " push-qa <file> Push QA report JSON"
echo " push-ship <file> Push ship log JSON"
echo " push-greptile <file> Push Greptile triage entry JSON"
echo " pull Pull team data to local cache"
echo " drain Drain the offline sync queue"
echo " logout Clear auth tokens"
exit 1
;;
esac