From 98ca3d7757834e56d19a5eced1404333a473a635 Mon Sep 17 00:00:00 2001 From: Amp Date: Fri, 30 Oct 2026 18:03:29 +0000 Subject: [PATCH 1/2] Prepare orbs with Node 22, dependencies and Playwright browsers Fresh orbs ship Node 26, under which Playwright 1.56's zip extractor never settles, so `playwright install` hangs after the first file. Setup installs Node 22 (the version CI uses) on the repository's PATH, then npm ci, Playwright Chromium and WebKit with system packages, habit-hooks with its plugins, and pytest. Amp-Thread-ID: https://ampcode.com/threads/T-01a18ded-a697-70d0-8d84-d3b629511658 Co-authored-by: Lada Kesseler --- .agents/setup | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 3 ++ 2 files changed, 83 insertions(+) create mode 100755 .agents/setup diff --git a/.agents/setup b/.agents/setup new file mode 100755 index 0000000..0c1db5a --- /dev/null +++ b/.agents/setup @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +set -euo pipefail + +node_version=v22.23.4 +habit_hooks_version=1.5.0 +playwright_browsers=(chromium webkit) +playwright_install_limit=10m + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +node_installs="$HOME/.local/share" +node_home="$node_installs/node-$node_version" +node_current="$node_installs/node-22" +profile_marker="# augmented-coding-patterns Node.js 22" + +timed() { + local started=$SECONDS + printf '\n==> %s\n' "$1" + "${@:2}" + printf '==> %s took %ss\n' "$1" $((SECONDS - started)) +} + +install_node() { + if [[ ! -x $node_home/bin/node ]]; then + local staging="$node_home.partial" + rm -rf -- "$staging" + mkdir -p -- "$staging" + curl -fsSL "https://nodejs.org/dist/$node_version/node-$node_version-linux-x64.tar.xz" | + tar -xJ -C "$staging" --strip-components=1 + mv -- "$staging" "$node_home" + fi + ln -sfn -- "$node_home" "$node_current" + export PATH="$node_current/bin:$PATH" + node --version +} + +put_node_on_repository_path() { + grep -Fqx "$profile_marker" "$HOME/.bash_profile" 2>/dev/null && return + cat >> "$HOME/.bash_profile" </dev/null | grep -q 'install ok installed' || echo "$package" + done +} + +install_playwright_browsers() ( + cd "$repo_root/website" + if [[ -n $(missing_playwright_system_packages) ]]; then + npx playwright install-deps "${playwright_browsers[@]}" + fi + timeout "$playwright_install_limit" npx playwright install "${playwright_browsers[@]}" +) + +install_python_tools() { + uv tool install --quiet "habit-hooks==$habit_hooks_version" \ + --with "habit-hooks-typescript==$habit_hooks_version" \ + --with "habit-hooks-generic==$habit_hooks_version" + uv tool install --quiet pytest +} + +timed "Node.js $node_version" install_node +timed "Node.js on repository PATH" put_node_on_repository_path +timed "website dependencies" install_website_dependencies +timed "Playwright ${playwright_browsers[*]}" install_playwright_browsers +timed "habit-hooks $habit_hooks_version and pytest" install_python_tools diff --git a/.gitignore b/.gitignore index a1aba4e..ce265a3 100644 --- a/.gitignore +++ b/.gitignore @@ -154,3 +154,6 @@ scratches/ # Exceptions: Allow website source code !website/lib/playground/ + +# Amp orb portals +.amp/portals/* From 8098dda8f1bf10356fe3ac12ae37c9e20e3d630d Mon Sep 17 00:00:00 2001 From: Amp Date: Fri, 30 Oct 2026 21:36:10 +0000 Subject: [PATCH 2/2] Serve the built site as an orb service with a portal Builds the Cloudflare site and serves it with wrangler pages dev on the port Amp assigns, so the Portal tab opens the site at /. Amp-Thread-ID: https://ampcode.com/threads/T-01a18ded-a697-70d0-8d84-d3b629511658 Co-authored-by: Lada Kesseler --- .amp/services.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .amp/services.yaml diff --git a/.amp/services.yaml b/.amp/services.yaml new file mode 100644 index 0000000..12f8b30 --- /dev/null +++ b/.amp/services.yaml @@ -0,0 +1,11 @@ +services: + site: + command: npm run build:cloudflare && npx wrangler pages dev out --ip 0.0.0.0 --port "$PORT" --show-interactive-dev-session=false + cwd: website + env: + WRANGLER_SEND_METRICS: "false" + health: / + portal: + url: / + title: Site + description: Static Cloudflare build served by wrangler pages dev. Restart the service to rebuild after content changes.