diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..f48ae88 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,14 @@ +FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Postman CLI, installed system-wide (/usr/local/bin) while still root +RUN curl -fsSL https://dl-cli.pstmn.io/install/unix.sh | sh \ + && postman --version + +USER node + +ENV PATH="/home/node/.local/bin:${PATH}" + +RUN curl -fsSL https://claude.ai/install.sh | bash -s stable \ + && claude --version diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6aa0b7c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,12 @@ +{ + "name": "Intergalactic Banking Platform", + "build": { + "dockerfile": "Dockerfile" + }, + "remoteUser": "node", + "containerEnv": { + "DISABLE_AUTOUPDATER": "1" + }, + "forwardPorts": [3000, 3100, 3200, 8080, 8090], + "postCreateCommand": "bash .devcontainer/post-create.sh" +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000..74111a4 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Runs once after the Codespace container is created. Failures are non-fatal. + +claude plugin marketplace add anthropics/claude-plugins-official \ + && claude plugin install postman@claude-plugins-official \ + || echo "Postman plugin install failed; run: claude plugin install postman@claude-plugins-official" + +# Claude Code: if ANTHROPIC_API_KEY is set, pre-approve it and skip onboarding +# so users can open `claude` and start prompting without logging in. +if [ -n "${ANTHROPIC_API_KEY:-}" ]; then + node -e ' + const fs = require("fs"); + const p = process.env.HOME + "/.claude.json"; + let c = {}; + try { c = JSON.parse(fs.readFileSync(p, "utf8")); } catch {} + c.hasCompletedOnboarding = true; + c.customApiKeyResponses = c.customApiKeyResponses || {}; + const approved = new Set(c.customApiKeyResponses.approved || []); + approved.add(process.env.ANTHROPIC_API_KEY.slice(-20)); + c.customApiKeyResponses.approved = [...approved]; + c.customApiKeyResponses.rejected = c.customApiKeyResponses.rejected || []; + fs.writeFileSync(p, JSON.stringify(c, null, 2)); + ' && echo "Claude Code configured to use ANTHROPIC_API_KEY" \ + || echo "Claude Code key setup failed; run claude and log in manually" +else + echo "ANTHROPIC_API_KEY not set; add it as a Codespaces secret, or run: claude and log in" +fi + +# Postman CLI: if POSTMAN_API_KEY is set, log in so `postman` commands work immediately. +if [ -n "${POSTMAN_API_KEY:-}" ]; then + postman login --with-api-key "$POSTMAN_API_KEY" >/dev/null \ + && echo "Postman CLI logged in" \ + || echo "Postman login failed; run: postman login" +else + echo "POSTMAN_API_KEY not set; add it as a Codespaces secret, or run: postman login" +fi