Files
boshu2__agentops/scripts/install-codex.sh
T
Bo e431339c40 feat(hookless)!: remove all hooks — skills + CLI only (soc-57b7f #remove-all-hooks) (#511)
## What

AgentOps 3.0 goes **fully hookless**. This removes the entire hook
product surface — the product is now skills + the `ao` CLI with **zero
hooks**. CI is the authoritative gate.

## Deleted

- `hooks/` — 46 hook scripts + `hooks.json` + examples (whole directory)
- `cli/embedded/hooks/` + embedded `hooks.json` +
`embedded/lib/hook-helpers.sh`
- `lib/hook-helpers.sh`
- `ao hooks` CLI command: `cli/cmd/ao/hooks.go`, `hooks_run.go` + 5 hook
test files; `cli/internal/bridge/hooks.go`;
`cli/internal/doctor/fix_hooks.go` + test
- Codex hook manifest (`hooks/codex-hooks.json`) + handler/audit scripts
(`scripts/audit-codex-hooks.sh`, `install-dev-hooks.sh`,
`test-hooks-output.sh`, `test-codex-hookless-lifecycle.sh`,
`test-hookless-rpi-phased.sh`)
- Hook lease surface: `docs/contracts/hook-lease-*`,
`schemas/hook-lease.v1.schema.json`,
`scripts/check-hook-lease-inventory.sh`,
`check-hook-port-replacements.sh`, `generate-hook-lease-inventory.py`
- Hook docs: `docs/HOOKS.md`, `cli/docs/HOOKS.md`,
`docs/architecture/hook-noise-audit.md`,
`docs/contracts/hook-runtime-contract.md`
- `tests/hooks/` (whole dir) + hook test scripts; 5 hook eval suites +
fixtures

## CI gates removed

`hook-preflight`, `validate-hooks-doc-parity`, `hook-output-schema-lint`
(+ scripts/bats), the hook eval suites, the `test-runtime-codex-smoke` /
`test-codex-native-install` / `test-codex-plugin-install` hook-handler
assertions, the cli-integration hook-lifecycle steps, the bats
`tests/hooks/*` glob + orphan-hooks audit, and the `--with-hooks`
install path. `embedded-sync` now validates only lib/skills. Both
summary `needs:` lists + the summary echo +
`docs/contracts/ci-jobs.yaml` updated; `validate-ci-policy-parity`
passes (66 rows). `.codex-plugin/plugin.json` drops the "Hooks"
capability.

## Load-bearing PRESERVED (reported, not forced)

- **`cli/cmd/ao/codex_runtime.go`** — the codex runtime *lifecycle
profile* (`HookCapable`/`HookConfigured` detection) is a
runtime-capability abstraction used by 6 `validate-codex-*` CI gates,
distinct from the hook product. Deleting it is a separate refactor.
- **`hooks-authoring` skill** + `schemas/hooks-manifest.v1.schema.json`
— reframed as an opt-in "author your own hooks" guide. Deleting the
skill cascades into catalog/domain-map/dispositions/context-map golden
files (skill-count sync), out of scope for the hook-product removal.
- **`scripts/pre-push-gate.sh`** — retired local gate (not in CI);
self-skips deleted hook scripts via `[[ -x ]]` guards; its 55 bats tests
still pass.
- Domain-enforcement audit keeps the `enforced`-mode schema for
backward-compatible JSON readers, but the hookless resolver only returns
`audited`/`unavailable`.

## Verification

`go build` / `go vet` clean; `go test ./...` = **11849 passed, 0
failed** (68 pkgs). gofmt clean on all touched files. Green: registry
`--check` (0 hooks), `regen-codex-hashes --check`,
`validate-ci-policy-parity`, `check-wiring-closure`,
`validate-embedded-sync`, `validate-manifests`, `validate-agents-split`,
`doc-release` (0 broken links), `generate-cli-reference --check`,
`heal.sh --strict`, codex/claude/plugin smoke tests, baseline-audit (0
stale). Diff: 231 files, +354 / −39803.

Closes-scenario: soc-57b7f#remove-all-hooks
Bounded-context: BC5-Runtime
Evidence: .github/workflows/validate.yml
2026-05-24 11:19:37 -04:00

115 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# install-codex.sh — Install AgentOps into the local Codex native plugin cache
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/boshu2/agentops/main/scripts/install-codex.sh | bash
# curl -fsSL https://raw.githubusercontent.com/boshu2/agentops/main/scripts/install-codex.sh | bash -s -- --with-hooks
#
# What it does:
# 1. Downloads a temporary AgentOps archive (no local git clone)
# 2. Builds the generated Codex-native skill bundle
# 3. Refreshes the native Codex plugin cache in ~/.codex/plugins/cache
# 4. Archives stale raw skill mirrors in ~/.agents/skills and ~/.codex/skills when found
# 5. Enables the plugin in ~/.codex/config.toml
#
# Update policy:
# Re-run this installer when new AgentOps releases land.
set -euo pipefail
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m'
info() { echo -e "${GREEN}✓${NC} $*"; }
warn() { echo -e "${YELLOW}!${NC} $*"; }
fail() { echo -e "${RED}✗${NC} $*"; exit 1; }
UPDATE_CMD="curl -fsSL https://raw.githubusercontent.com/boshu2/agentops/main/scripts/install-codex.sh | bash"
SOURCE_ROOT_OVERRIDE="${AGENTOPS_BUNDLE_ROOT:-}"
INSTALL_REF="${AGENTOPS_INSTALL_REF:-main}"
usage() {
cat <<'EOF'
install-codex.sh
Install AgentOps into the local Codex native plugin cache.
Options:
--help Show this help
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--help|-h)
usage
exit 0
;;
*)
echo "Unknown arg: $1" >&2
usage >&2
exit 2
;;
esac
done
if [[ "$INSTALL_REF" == "main" ]]; then
ARCHIVE_URL="https://codeload.github.com/boshu2/agentops/tar.gz/refs/heads/main"
else
ARCHIVE_URL="https://codeload.github.com/boshu2/agentops/tar.gz/refs/tags/$INSTALL_REF"
fi
echo "Installing AgentOps for Codex..."
echo ""
for cmd in curl tar; do
if ! command -v "$cmd" >/dev/null 2>&1; then
fail "Missing required command: $cmd"
fi
done
if ! command -v codex >/dev/null 2>&1; then
warn "Codex CLI not found in PATH. Install from https://github.com/openai/codex"
warn "Continuing anyway — skills will be ready when Codex is installed."
fi
TMP_DIR="$(mktemp -d)"
cleanup() { rm -rf "$TMP_DIR"; }
trap cleanup EXIT
if [[ -n "$SOURCE_ROOT_OVERRIDE" ]]; then
SRC_ROOT="$SOURCE_ROOT_OVERRIDE"
info "Using provided AgentOps bundle: $SRC_ROOT"
else
ARCHIVE_FILE="${TMP_DIR}/agentops.tar.gz"
info "Downloading AgentOps bundle..."
curl -fsSL "$ARCHIVE_URL" -o "$ARCHIVE_FILE"
tar -tzf "$ARCHIVE_FILE" > "${TMP_DIR}/archive-files.txt"
ARCHIVE_ROOT="$(awk -F/ 'NR == 1 { print $1 }' "${TMP_DIR}/archive-files.txt")"
[ -n "$ARCHIVE_ROOT" ] || fail "Could not determine archive root directory"
tar -xzf "$ARCHIVE_FILE" -C "$TMP_DIR"
SRC_ROOT="${TMP_DIR}/${ARCHIVE_ROOT}"
fi
[ -f "$SRC_ROOT/scripts/install-codex-plugin.sh" ] || fail "Native Codex installer not found in bundle"
# skills-codex/ is pre-built in the bundle (manually maintained, no sync needed)
plugin_args=(
--repo-root "$SRC_ROOT"
--version "$INSTALL_REF"
--update-command "$UPDATE_CMD"
)
bash "$SRC_ROOT/scripts/install-codex-plugin.sh" "${plugin_args[@]}"
echo ""
echo "Update note:"
echo " AgentOps ships frequent updates."
echo " Re-run this installer regularly to pick up the latest main branch changes:"
echo " $UPDATE_CMD"