mirror of
https://github.com/boshu2/agentops.git
synced 2026-09-14 15:08:13 +08:00
1e073d8363
Olympus (ol) was the power-user daemon predecessor to AgentOps, archived in strategic-direction.md. The bridge contracts (SPEC_ONLY, never enforced), MemRL policy surface, OL quarantine constraints collector, and supporting scripts/tests all referenced a now-dead integration. Purging them removes ~2400 lines of stale surface area. ## Deleted files - docs/ol-bridge-contracts.md - docs/architecture/ao-olympus-ownership-matrix.md - docs/plans/2026-02-13-ao-olympus-bridge-next-steps.md - docs/contracts/memrl-policy-integration.md - docs/contracts/memrl-policy.schema.json - docs/contracts/memrl-policy.profile.example.json - cli/cmd/ao/inject_ol_test.go - skills/vibe/scripts/ol-validate.sh + codex mirror - skills-codex/swarm/scripts/ol-ratchet.sh, ol-wave-loader.sh - tests/ol-integration/ (entire directory) ## CLI code stripped - internal/search/types.go: OLConstraint struct + InjectedKnowledge.OLConstraints field - internal/search/inject_run.go: CollectOLConstraints, WriteConstraintsSection, quarantineRelPath const, all related trim/render logic - cmd/ao/inject.go: gatherOLConstraints, collectOLConstraints wrapper, olConstraint type alias, init-time call site - Package comments in provenance/storage/types/formatter updated "olympus" → "agentops" - formatter/markdown.go: session tag "olympus" → "agentops" (+ test update) - Tests: deleted TestCollectOLConstraints + TestInject_collectOLConstraints, stripped OL subtests from TestFormatKnowledgeMarkdown and TestInject_*, renamed "olympus" literal test data to "other-repo" - rpi_phased_context.go: stripped "matches Olympus DefaultTimeout" and "Modeled on Olympus internal/git/worktree.go" comments ## Docs + skills stripped - mkdocs.yml nav: 3 entries removed (AO-Olympus Matrix, MemRL Policy, OL-AO Bridge) - docs/INDEX.md, contracts/index.md, architecture/index.md, index.md: cross-refs removed - strategic-direction.md: retirement rationale compressed to one paragraph - docs/context-packet.md, positioning/devops-for-vibe-coding.md, plans/README.md: OL-specific content removed - skills/vibe/SKILL.md + codex mirror, swarm/SKILL.md: OL script refs removed - skills/vibe/references/deep-checks.md, plan/references/planning-rules.md (+ codex), pre-mortem/references/council-fail-patterns.md (+ codex): OL rule/pattern entries removed - skills-codex hashes regenerated (plan, pre-mortem, swarm, vibe) ## Precommit hook fix - hooks/go-test-precommit.sh: prefer ~/.local/go/bin/go when present. Hooks don't inherit interactive-shell PATH, so apt-provided go-1.22 would otherwise override a user-local 1.26 install. Mirrors the zshrc pattern. ## Retained (historical / useful) - strategic-direction.md: 1-paragraph archival note - Historical release notes (docs/releases/*.md) — immutable past-release record - cli/testdata/transcripts/real-2.4mb.jsonl — captured test fixture - docs/brownian-ratchet.md ol-rg3p bead-ID refs — internal bead prefix, not Olympus ## Verification - go build ./... && go vet ./... clean - go test ./... clean except pre-existing TestGCBridgeVersion_Live panic - scripts/docs-build.sh --check (mkdocs strict) clean - scripts/check-contract-compatibility.sh passes - scripts/regen-codex-hashes.sh run — 4 skills updated
101 lines
3.3 KiB
Bash
Executable File
101 lines
3.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# PreToolUse hook: fast Go validation before git commit.
|
|
#
|
|
# Fast path (<5s): go vet + go build on every commit.
|
|
# Targeted tests: only for cli/internal/ changes (skip cmd/ao — deferred to pre-push).
|
|
#
|
|
# Blocking (exit 2) if checks fail — prevents committing broken code.
|
|
set -euo pipefail
|
|
|
|
[[ "${AGENTOPS_HOOKS_DISABLED:-}" == "1" ]] && exit 0
|
|
|
|
INPUT=$(cat)
|
|
# Guard empty stdin: jq fails on empty input, so exit early
|
|
[[ -z "$INPUT" ]] && exit 0
|
|
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // ""' 2>/dev/null) || TOOL_NAME=""
|
|
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // ""' 2>/dev/null) || COMMAND=""
|
|
|
|
# Only trigger on Bash tool
|
|
[[ "$TOOL_NAME" == "Bash" ]] || exit 0
|
|
|
|
# Only trigger on git commit commands
|
|
case "$COMMAND" in
|
|
*"git commit"*) ;;
|
|
*) exit 0 ;;
|
|
esac
|
|
|
|
# Prefer user-local Go (~/.local/go) over system Go when present.
|
|
# Hooks don't inherit interactive-shell PATH, so the apt-provided go-1.22
|
|
# would otherwise be picked up even when the user has a newer local install.
|
|
if [[ -x "$HOME/.local/go/bin/go" ]]; then
|
|
export PATH="$HOME/.local/go/bin:$PATH"
|
|
export GOROOT="$HOME/.local/go"
|
|
fi
|
|
|
|
# Need go compiler
|
|
command -v go &>/dev/null || exit 0
|
|
|
|
# Must be in a Go project (has go.mod)
|
|
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null)" || exit 0
|
|
GO_MOD=""
|
|
for candidate in "$REPO_ROOT/go.mod" "$REPO_ROOT/cli/go.mod"; do
|
|
if [[ -f "$candidate" ]]; then
|
|
GO_MOD="$candidate"
|
|
break
|
|
fi
|
|
done
|
|
[[ -n "$GO_MOD" ]] || exit 0
|
|
|
|
GO_DIR="$(dirname "$GO_MOD")"
|
|
|
|
# Scope gate: skip the Go fast-gate entirely when no Go files are staged.
|
|
# Prevents this hook from blocking non-Go commits (docs, skills, shell, YAML).
|
|
# Matches *.go files and go.{mod,sum,work,work.sum} at any depth.
|
|
STAGED_FILES="$(git diff --cached --name-only 2>/dev/null || true)"
|
|
if ! printf '%s\n' "$STAGED_FILES" | grep -qE '\.go$|(^|/)go\.mod$|(^|/)go\.sum$|(^|/)go\.work(\.sum)?$'; then
|
|
echo "Pre-commit: no Go files staged — skipping go vet/build" >&2
|
|
exit 0
|
|
fi
|
|
|
|
# --- Fast gate: vet + build (<5s) ---
|
|
echo "Pre-commit: go vet..." >&2
|
|
if ! (cd "$GO_DIR" && go vet ./... 2>&1) >&2; then
|
|
echo "BLOCKED: go vet failed. Fix before committing." >&2
|
|
exit 2
|
|
fi
|
|
|
|
echo "Pre-commit: go build..." >&2
|
|
if ! (cd "$GO_DIR" && go build ./... 2>&1) >&2; then
|
|
echo "BLOCKED: go build failed. Fix before committing." >&2
|
|
exit 2
|
|
fi
|
|
|
|
# --- Targeted tests: only cli/internal/ packages ---
|
|
STAGED_FILES="$(git diff --cached --name-only 2>/dev/null || true)"
|
|
|
|
# Check for cmd/ao changes — defer to pre-push
|
|
if printf '%s\n' "$STAGED_FILES" | grep -q 'cli/cmd/ao/'; then
|
|
echo "Pre-commit: cmd/ao changes detected — full test suite deferred to pre-push" >&2
|
|
fi
|
|
|
|
# Run tests only for changed cli/internal/ packages
|
|
INTERNAL_CHANGED="$(printf '%s\n' "$STAGED_FILES" | grep '^cli/internal/' | grep '\.go$' || true)"
|
|
if [[ -n "$INTERNAL_CHANGED" ]]; then
|
|
# Extract unique package directories relative to GO_DIR
|
|
PKGS="$(printf '%s\n' "$INTERNAL_CHANGED" \
|
|
| xargs -n1 dirname \
|
|
| sort -u \
|
|
| sed "s|^cli/|./|")"
|
|
|
|
if [[ -n "$PKGS" ]]; then
|
|
echo "Pre-commit: testing changed internal packages..." >&2
|
|
# shellcheck disable=SC2086
|
|
if ! (cd "$GO_DIR" && go test -count=1 -short $PKGS 2>&1 | tail -10) >&2; then
|
|
echo "BLOCKED: internal package tests failed. Fix before committing." >&2
|
|
exit 2
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
exit 0
|