feat: Claude Code Monitor — lanes, pipelines and a merged workspace

Internal SmartGift build of a Claude Code monitoring dashboard.

Lanes: a durable unit of parallel agent work, one per working directory,
tracked across session restarts. Managed lanes are git worktrees the
dashboard provisions and can reset or remove behind a three-check destroy
guard and a counted preflight; adopted lanes are directories you already
own and are never destroyable.

Pipelines: a lane moves through pipeline stages. A stage the agent declares
with evidence renders green; a stage inferred from the tool-event stream
renders dashed amber and never counts as done. Detection is forward-only
within a 30-minute window, and never writes the declared stage.

Workspace: one page at /run with a lane grid, the selected lane's pipeline,
and a full Claude console behind a disclosure.
This commit is contained in:
2026-07-29 17:07:45 +07:00
commit 57dc91585d
783 changed files with 221743 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env sh
#
# Commit-msg: lightweight, dependency-free Conventional Commits advisory.
# This is intentionally NON-blocking — it only prints a hint when the subject
# doesn't look conventional. Commits are gated on tests (see pre-commit), not
# on the message format.
MSG_FILE="$1"
SUBJECT="$(head -n1 "$MSG_FILE" 2>/dev/null)"
# Skip merge/revert/fixup/squash commits — git generates those subjects.
case "$SUBJECT" in
Merge*|Revert*|fixup!*|squash!*) exit 0 ;;
esac
# type(scope)?!: description — e.g. "feat(tray): poll /api/stats"
PATTERN='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9._/-]+\))?!?: .+'
if ! printf '%s' "$SUBJECT" | grep -Eq "$PATTERN"; then
echo "💡 Tip: commit subjects work best in Conventional Commits form:"
echo " <type>(optional-scope): <description>"
echo " e.g. feat(tray): poll /api/stats for live counts"
echo " (advisory only — your commit will still proceed)"
fi
exit 0
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env sh
#
# Pre-commit: auto-format staged files, then run the full test suite.
# The commit is ABORTED unless every test passes.
#
# Activated via `core.hooksPath=.husky` (set by the package.json "prepare"
# script on `npm install`). No husky/lint-staged runtime required.
# Abort the commit on the first failing command (formatting error or failing test).
set -e
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"
# ── 1. Format staged files with Prettier, then re-stage them ────────────────
# Only Added/Copied/Modified/Renamed paths in the index. --ignore-unknown lets
# Prettier silently skip anything it can't parse, so we can hand it every staged
# path without filtering by extension. NUL-delimited (-z / -0) so paths with
# spaces are handled correctly.
#
# NOTE: this re-adds the *whole* file. If you intentionally staged only part of
# a file, review the result after the auto-format.
STAGED="$(git diff --cached --name-only --diff-filter=ACMR)"
if [ -n "$STAGED" ]; then
PRETTIER="$ROOT/node_modules/.bin/prettier"
if [ -x "$PRETTIER" ]; then
set -- "$PRETTIER"
else
set -- npx --no-install prettier
fi
echo "🎨 Formatting staged files with Prettier..."
git diff --cached --name-only --diff-filter=ACMR -z | xargs -0 "$@" --write --ignore-unknown
git diff --cached --name-only --diff-filter=ACMR -z | xargs -0 git add
else
echo "🎨 No staged files to format."
fi
# ── 2. Run tests — commit is blocked unless all pass ────────────────────────
# Each suite is retried once on failure. The full run executes dozens of test
# files concurrently, each starting its own server (plus the CLI suite's
# spawned child processes with hard kill timeouts), so a loaded machine can
# produce a one-off timing failure unrelated to the commit. A real regression
# is deterministic: it fails both runs and still blocks the commit. This keeps
# the gate strict without making commits a dice roll on machine load.
run_suite() {
# $1 = human label, $2 = npm script
echo "🧪 Running $1 tests..."
if npm run "$2"; then
return 0
fi
echo "⚠️ $1 suite failed — retrying once to rule out machine-load flakiness..."
if npm run "$2"; then
echo "✅ $1 suite passed on retry — treating the first failure as a load flake."
echo " If this keeps happening, the flaky test above deserves a real fix."
return 0
fi
echo "❌ $1 suite failed twice — genuine failure, aborting the commit."
return 1
}
run_suite backend test:server
run_suite frontend test:client
echo "✅ Formatting applied and all tests passed — proceeding with commit."