Skip to content
Myr

Add pinned Effect and Wrangler source for agents, and four playbook skills

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

- scripts/vendor-agent-sources.sh, ported from Rat Stack, clones effect@4.0.1 and workers-sdk at wrangler@4.147.0 into the gitignored .agent_sources/<repo> (flat, as AGENTS.md and the build name .agent_sources/effect). Both pins are read from package.json (the root catalog's effect, apps/platform's wrangler), never hard-coded, and refused unless each is one exact version. - Each tag is checked with `git ls-remote --exit-code` before its clone and the script exits 1 with no fallback when one doesn't resolve. The clone's own package.json version must equal the pin. .agent-source.json (ref, commit, version) is written last, so it marks a finished clone: a repeat run skips, offline; a pin that moved re-clones; --refresh re-clones both. - .agents/skills/{add-operation,add-refusal,add-check-kind,add-port}: numbered playbooks in Rat Stack's add-a-capability shape. Each step names exact paths and ends on a done-when; each ends with the gate step and a Report list. Steps that land in a later wave say "from W<n>"; the CLI is `<cli>`; no router skill. - add-refusal follows the code: retryable and next are fields fixed per tag (the Retryable/Final spreads), not statics. It states the alias rule and that no alias mechanism exists yet. add-operation names the gotcha that every Contracts.toLayer call, test stand-ins included, must gain the new tag. - .claude/skills/<name>/SKILL.md is a symlink to the .agents/skills file, not a symlink to the directory: scripts/brand.ts reads every committed path, and a committed directory symlink fails brand:check with EISDIR. Headless Claude Code 2.1.292 lists all four skills with these links and none without them. - Tests: none; the issue names no seam (Markdown and a fetch script). Checked by hand: the issue's check prints 0; an unresolvable tag (effect@4.0.999), an inexact pin and a missing key each exit 1; a moved pin, a repeat run and --refresh behave as above. - The upstream tag names were confirmed with `git ls-remote --tags`: effect@4.0.1 and wrangler@4.147.0 (annotated; git's "is not a commit" warning on clone is harmless).

authored by oscabriel · committed by oscabriel · parent 19e6c65 · Browse files · 9 files+418 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+418 added−0 removed

  • other:+418 added−0 removed

9 files+418 added−0 removed

added:.agents/skills/add-check-kind/SKILL.md+80 added
added:.agents/skills/add-operation/SKILL.md+75 added
added:.agents/skills/add-port/SKILL.md+71 added
added:.agents/skills/add-refusal/SKILL.md+74 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}"