diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..cd4b605 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,22 @@ +{ + // Dev container for engage-mcp — a TypeScript / Node.js (ESM) MCP server. + // + // The typescript-node base image ships Node.js 20 (this repo's supported + // engine, package.json "engines.node": ">=20"), so the hve-core-all Copilot + // CLI plugin installed in postCreateCommand has Node and npm available + // without layering a separate Node feature. + "name": "engage-mcp", + "image": "mcr.microsoft.com/devcontainers/typescript-node:20", + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + "customizations": { + "vscode": { + "extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] + } + }, + // Install this repo's dependencies, then best-effort install the hve-core-all + // Copilot CLI plugin (shared with .github/workflows/copilot-setup-steps.yml). + "postCreateCommand": "npm ci && bash .devcontainer/setup-hve-core.sh", + "remoteUser": "node" +} diff --git a/.devcontainer/setup-hve-core.sh b/.devcontainer/setup-hve-core.sh new file mode 100755 index 0000000..4db31cf --- /dev/null +++ b/.devcontainer/setup-hve-core.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Best-effort, idempotent installer for the hve-core-all GitHub Copilot CLI +# plugin (from github.com/microsoft/hve-core). +# +# Shared by: +# - .github/workflows/copilot-setup-steps.yml (Copilot cloud sandbox) +# - .devcontainer/devcontainer.json (dev container postCreate) +# +# This script is intentionally NON-FATAL: every step tolerates failure so the +# sandbox / dev container still starts even without network access or when the +# Copilot CLI is unavailable. Failures are surfaced as GitHub Actions warnings +# (the `::warning::` prefix is inert outside Actions). +set -euo pipefail + +echo "==> Ensuring the GitHub Copilot CLI is available" +command -v copilot >/dev/null 2>&1 || npm install -g @github/copilot || echo "::warning::copilot CLI install failed" + +echo "==> Registering the microsoft/hve-core plugin marketplace" +copilot plugin marketplace add microsoft/hve-core || echo "::warning::marketplace add failed" + +echo "==> Installing the hve-core-all plugin" +copilot plugin install hve-core-all@hve-core || echo "::warning::hve-core-all install failed" + +echo "==> Installed Copilot plugins:" +copilot plugin list || true diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000..a76bf84 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,62 @@ +name: Copilot Setup Steps + +# Prepares the environment for the GitHub Copilot coding agent: installs this +# repository's Node.js toolchain and the hve-core-all Copilot CLI plugin (from +# github.com/microsoft/hve-core) so the agent starts ready to work. +# +# The single job MUST be named `copilot-setup-steps` for the Copilot coding +# agent to discover and run it. See: +# https://docs.github.com/en/copilot/customizing-copilot/customizing-the-development-environment-for-copilot-coding-agent + +on: + workflow_dispatch: + push: + paths: + - .github/workflows/copilot-setup-steps.yml + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +permissions: + contents: read + +jobs: + copilot-setup-steps: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + + # Node.js is set up even though this is a Node project so the Copilot CLI + # plugin install (which needs npm) always has a runtime available. Version + # matches package.json "engines.node": ">=20" and the CI matrix baseline. + - name: Set up Node.js + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: "20" + cache: npm + + - name: Install dependencies + continue-on-error: true + run: npm ci + + - name: Install hve-core-all plugin + continue-on-error: true + env: + GITHUB_TOKEN: ${{ github.token }} + run: bash .devcontainer/setup-hve-core.sh + + - name: Verify tools + run: | + echo "node: $(node --version)" + echo "npm: $(npm --version)" + if command -v copilot >/dev/null 2>&1; then + echo "copilot: $(copilot --version)" + else + echo "copilot: not installed" + fi + copilot plugin list || true