mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-09 14:09:47 +08:00
Three new regression tests guard the rename's blast radius (per codex Findings #1, #8, #9, #12): - test/no-stale-gstack-brain-refs.test.ts: greps bin/, scripts/, *.tmpl, test/ for forbidden identifiers (gstack-brain-init, gbrain_sync_mode); fails CI if any non-allowlisted file references them. - test/post-rename-doc-regen.test.ts: confirms gen-skill-docs output has no stale references in any */SKILL.md (the cross-product blind spot). - test/setup-gbrain-path4-structure.test.ts: structural lint over the Path 4 prose contract — STOP gates after verify failure, never-write- token rules, mode-aware CLAUDE.md block, bearer always via env-var. Two new gate-tier E2E tests (deterministic stub HTTP server, fixed inputs): - test/skill-e2e-setup-gbrain-remote.test.ts: Path 4 happy path. Stubs an HTTP MCP server, drives the skill via Agent SDK with a stubbed bearer, asserts claude.json gets the http MCP entry, CLAUDE.md gets the remote-http block, the secret token NEVER leaks to CLAUDE.md. - test/skill-e2e-setup-gbrain-bad-token.test.ts: stub server returns 401; asserts the AUTH classifier hint surfaces, no MCP registration occurs, CLAUDE.md is unchanged. Regression guard for the "verify failed → STOP" rule. touchfiles.ts: setup-gbrain-remote and setup-gbrain-bad-token added at gate-tier so CI catches Path 4 regressions on every PR. Plus a few comment refs flipped: bin/gstack-jsonl-merge, bin/gstack-timeline-log (legacy gstack-brain-init mentions in headers). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
41 lines
1.6 KiB
Bash
Executable File
41 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# gstack-timeline-log — append a timeline event to the project timeline
|
|
# Usage: gstack-timeline-log '{"skill":"review","event":"started","branch":"main"}'
|
|
#
|
|
# Session timeline: local by default. If the user enables `artifacts_sync_mode`
|
|
# with the `full` (not `artifacts-only`) privacy tier — via the first-run
|
|
# stop-gate from `gstack-artifacts-init` or the preamble — timeline events are
|
|
# published to the user's private GBrain sync repo. See docs/gbrain-sync.md.
|
|
# Required fields: skill, event (started|completed).
|
|
# Optional: branch, outcome, duration_s, session, ts.
|
|
# Validation failure → skip silently (non-blocking).
|
|
set -euo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
eval "$("$SCRIPT_DIR/gstack-slug" 2>/dev/null)"
|
|
GSTACK_HOME="${GSTACK_HOME:-$HOME/.gstack}"
|
|
mkdir -p "$GSTACK_HOME/projects/$SLUG"
|
|
|
|
INPUT="$1"
|
|
|
|
# Validate: input must be parseable JSON with required fields
|
|
if ! printf '%s' "$INPUT" | bun -e "
|
|
const j = JSON.parse(await Bun.stdin.text());
|
|
if (!j.skill || !j.event) process.exit(1);
|
|
" 2>/dev/null; then
|
|
exit 0 # skip silently, non-blocking
|
|
fi
|
|
|
|
# Inject timestamp if not present
|
|
if ! printf '%s' "$INPUT" | bun -e "const j=JSON.parse(await Bun.stdin.text()); if(!j.ts) process.exit(1)" 2>/dev/null; then
|
|
INPUT=$(printf '%s' "$INPUT" | bun -e "
|
|
const j = JSON.parse(await Bun.stdin.text());
|
|
j.ts = new Date().toISOString();
|
|
console.log(JSON.stringify(j));
|
|
" 2>/dev/null) || true
|
|
fi
|
|
|
|
echo "$INPUT" >> "$GSTACK_HOME/projects/$SLUG/timeline.jsonl"
|
|
|
|
# gbrain-sync: enqueue for cross-machine sync (no-op if sync is off).
|
|
"$SCRIPT_DIR/gstack-brain-enqueue" "projects/$SLUG/timeline.jsonl" 2>/dev/null &
|