Skip to content
Myr

Merge build/107-agent-sources-and-skills: pinned Effect and Wrangler source, and four playbook skills

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parents f6da76a, 233ebe9 · Browse files · 9 files+425 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+425 added−0 removed

  • other:+425 added−0 removed

9 files+425 added−0 removed

added:.agents/skills/add-check-kind/SKILL.md+80 added
added:.agents/skills/add-operation/SKILL.md+80 added
added:.agents/skills/add-port/SKILL.md+71 added
added:.agents/skills/add-refusal/SKILL.md+76 added
added:.claude/skills/add-check-kind/SKILL.md+1 added
added:.claude/skills/add-operation/SKILL.md+1 added
added:.claude/skills/add-port/SKILL.md+1 added
added:.claude/skills/add-refusal/SKILL.md+1 added
added:scripts/vendor-agent-sources.sh+114 added
1#!/usr/bin/env bash2# Ported from joelhooks/rat-stack@fba26d8 `scripts/vendor-agent-sources.sh`3# (MIT, LICENSES/rat-stack.MIT.txt). Changes are listed in PROVENANCE.md.4#5# Clones the exact source of the Effect and Wrangler versions this repo pins6# into .agent_sources/<repo>, for agents to read as API truth. Reference only:7# nothing imports it, and .gitignore keeps it out of git.8#9# bash scripts/vendor-agent-sources.sh # clone what is missing or moved10# bash scripts/vendor-agent-sources.sh --refresh # clone both again11set -euo pipefail1213ROOT="$(cd "$(dirname "$0")/.." && pwd)"14SOURCES="${ROOT}/.agent_sources"15REFRESH=false1617for arg in "$@"; do18 case "$arg" in19 --refresh) REFRESH=true ;;20 -h | --help)21 echo "Usage: $0 [--refresh]"22 echo "Clones pinned Effect and workers-sdk source into .agent_sources/."23 exit 024 ;;25 *)26 echo "Unknown arg: $arg" >&227 exit 128 ;;29 esac30done3132# One field of a JSON file, or an empty line when it is absent.33json_field() {34 node -p 'const v = require(process.argv[1]); process.argv[2].split(".").reduce((o, k) => (o == null ? undefined : o[k]), v) ?? ""' "$1" "$2"35}3637# The version a package.json pins, refused unless it is one exact version.38pin() {39 local file="$1" field="$2" version40 version="$(json_field "${ROOT}/${file}" "$field")"4142 if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then43 echo "${file} ${field} is '${version}', not one exact version; pin it before vendoring." >&244 exit 145 fi4647 echo "$version"48}4950# clone_source <repo> <remote> <tag> <package.json in the clone> <version> <note>51clone_source() {52 local repo="$1" remote="$2" ref="$3" manifest="$4" version="$5" note="$6"53 local dest="${SOURCES}/${repo}"54 local metadata="${dest}/.agent-source.json"55 local commit cloned5657 # The metadata is written last, so its presence marks a finished clone.58 if [[ "$REFRESH" != true && -f "$metadata" ]]; then59 if [[ "$(json_field "$metadata" ref)" == "$ref" ]]; then60 echo "skip ${repo} @ ${ref} (present; pass --refresh to clone again)"61 return 062 fi6364 echo "${repo}: the pin moved to ${ref}; cloning again"65 fi6667 if ! git ls-remote --exit-code --refs "$remote" "refs/tags/${ref}" >/dev/null; then68 echo "Cannot resolve tag ${ref} at ${remote}; refusing to fall back to another ref." >&269 exit 170 fi7172 rm -rf "$dest"73 mkdir -p "$SOURCES"74 echo "clone ${repo} @ ${ref}"75 # For an annotated tag, git warns that it "is not a commit"; the checkout is76 # still the commit the tag points at.77 git -c advice.detachedHead=false clone --quiet --depth 1 --branch "$ref" "$remote" "$dest"78 commit="$(git -C "$dest" rev-parse HEAD)"7980 cloned="$(json_field "${dest}/${manifest}" version)"81 if [[ "$cloned" != "$version" ]]; then82 rm -rf "$dest"83 echo "${repo} @ ${ref} has ${manifest} at version '${cloned}', not ${version}; refusing it." >&284 exit 185 fi8687 cat >"$metadata" <<EOF88{89 "type": "git-source",90 "repo": "${repo}",91 "remote": "${remote}",92 "ref": "${ref}",93 "commit": "${commit}",94 "version": "${version}",95 "addedAt": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",96 "note": "${note} Refresh: bash scripts/vendor-agent-sources.sh --refresh"97}98EOF99100 echo " -> ${dest} (${commit})"101}102103# The pins come from the package.json files, so a bump there is a bump here.104EFFECT_VERSION="$(pin package.json workspaces.catalog.effect)"105WRANGLER_VERSION="$(pin apps/platform/package.json devDependencies.wrangler)"106107clone_source effect https://github.com/Effect-TS/effect.git "effect@${EFFECT_VERSION}" \108 packages/effect/package.json "$EFFECT_VERSION" \109 "Effect v4 matching the root catalog's effect@${EFFECT_VERSION}."110clone_source workers-sdk https://github.com/cloudflare/workers-sdk.git "wrangler@${WRANGLER_VERSION}" \111 packages/wrangler/package.json "$WRANGLER_VERSION" \112 "Wrangler and Miniflare matching apps/platform's wrangler@${WRANGLER_VERSION}."113114echo "done: agent sources under ${SOURCES}"