diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh new file mode 100755 index 00000000..dee0e53e --- /dev/null +++ b/.claude/hooks/session-start.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# SessionStart hook for Claude Code on the web: bootstrap Aikido Safe Chain and +# install dependencies through its shims, as .devcontainer and .cursor do. +# +# Hook stdout is injected into the session, so the install log goes to stderr. +# Shim PATH is written by setup-cloud-environment.sh before that script can fail +# (CLAUDE_ENV_FILE). Do not append it here after the bootstrap: a failed hook +# would then leave the package managers unshimmed. +set -euo pipefail + +if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then + exit 0 +fi + +cd "$CLAUDE_PROJECT_DIR" + +bash ./scripts/setup-cloud-environment.sh >&2 diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 00000000..1833e5e2 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,15 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "bash \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/session-start.sh", + "timeout": 600 + } + ] + } + ] + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 184bb317..a73f3756 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,6 +2,7 @@ "name": "Node.js", "image": "mcr.microsoft.com/devcontainers/javascript-node:5.2.1-24-trixie@sha256:7a81958053c4e3b5b20fa122f7a422d32dd0eebe87a6726f7b14483585ea60fd", "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/devcontainers/features/docker-in-docker:4": { "moby": false } diff --git a/.gitignore b/.gitignore index b2984bed..14bbb06b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,10 @@ out # Lock Files yarn.lock -# AI -.claude +# AI (keep the shared Claude Code settings and hooks; ignore local state) +.claude/* +!.claude/settings.json +!.claude/hooks/ # Dist dist diff --git a/DEFENSE_IN_DEPTH.md b/DEFENSE_IN_DEPTH.md index f400e80c..594feb7e 100644 --- a/DEFENSE_IN_DEPTH.md +++ b/DEFENSE_IN_DEPTH.md @@ -9,8 +9,8 @@ Profile: npm library ยท public - [x] `DEFENSE_IN_DEPTH.md` present (this file) โ€” PR #1698 ## 2. CODEOWNERS and cloud bootstrap -- [ ] `.github/CODEOWNERS` covers `/.github/`, `/.vscode/`, `/.cursor/`, `/.devcontainer/`, `/.claude/`, `/.codex/`, `/scripts/` with owners the maintainer names (PR #1734 pending) -- [ ] Codespaces, Cursor Cloud Agents, and Claude Code on the web bootstrap Aikido Safe Chain via scripts/setup-cloud-environment.sh (--ci shims, frozen lockfile); Claude Code runs it from `.claude/hooks/session-start.sh` (web sessions only, install log on stderr, 600s timeout) and `.gitignore` keeps `.claude/settings.json` and `.claude/hooks/` tracked +- [x] `.github/CODEOWNERS` covers `/.github/`, `/.vscode/`, `/.cursor/`, `/.devcontainer/`, `/.claude/`, `/.codex/`, `/scripts/` with owners the maintainer names โ€” PR #1734 +- [ ] Codespaces, Cursor Cloud Agents, and Claude Code on the web bootstrap Aikido Safe Chain via scripts/setup-cloud-environment.sh (--ci shims, frozen lockfile); Claude Code runs it from `.claude/hooks/session-start.sh` (web sessions only, install log on stderr, 600s timeout) and `.gitignore` keeps `.claude/settings.json` and `.claude/hooks/` tracked (PR #1735 pending) - [ ] Codex cloud environments use Manual setup with `bash ./scripts/setup-cloud-environment.sh` as the setup and maintenance script (manual) - [ ] Claude Code on the web environments allow `malware-list.aikido.dev` (Custom network access plus the default package-manager list) (manual) - [x] Dev Container `image` pinned by digest (`name:@sha256:`; not a floating tag) โ€” PR #1718