mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-09 22:19:47 +08:00
Hard rename, no dual-read alias (codex Finding D4). The on-disk migration script (Phase C, separate commit) renames the config key in users' ~/.gstack/config.yaml and any CLAUDE.md blocks. Touched call sites: - bin/gstack-config defaults + validation + list/defaults output - bin/gstack-gbrain-detect (gstack_brain_sync_mode field still emitted with the same name for downstream-tool compat; reads new key) - bin/gstack-brain-sync, bin/gstack-brain-enqueue, bin/gstack-brain-uninstall - bin/gstack-timeline-log (comment ref) - scripts/resolvers/preamble/generate-brain-sync-block.ts: renames key, branches on gbrain_mcp_mode=remote-http to emit "ARTIFACTS_SYNC: remote-mode (managed by brain server <host>)" instead of the local mode/queue/last_push line (codex Finding #11) - bin/gstack-brain-restore + bin/gstack-gbrain-source-wireup: read ~/.gstack-artifacts-remote.txt with ~/.gstack-brain-remote.txt fallback during the migration window - bin/gstack-artifacts-init: tolerant of unrecognized URL forms (local paths, file://, self-hosted gitea) so test infrastructure and unusual remotes work without canonicalization - test/brain-sync.test.ts: gstack-brain-init → gstack-artifacts-init - test/skill-e2e-brain-privacy-gate.test.ts: artifacts_sync_mode keys - test/gen-skill-docs.test.ts: budget 35K → 36.5K for the new MCP-mode probe in the preamble resolver - health/SKILL.md.tmpl, sync-gbrain/SKILL.md.tmpl: comment + verdict line Hard delete: - bin/gstack-brain-init (replaced by bin/gstack-artifacts-init in v1.27.0.0) - test/gstack-brain-init-gh-mock.test.ts (replaced by gstack-artifacts-init.test.ts) 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-brain-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 &
|