Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
# Each extension keeps its own lockfile.
directories: ['/extensions/*']
schedule:
interval: 'weekly'
day: 'friday'
Expand Down
2 changes: 2 additions & 0 deletions .github/release-hold
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# One line per extension folder that a merge must not release yet: the folder name, then why.
fixture its images ghcr.io/agentage/fixture, fixture-api and fixture-pages are linked to agentage/extension-fixture; remove this line once agentage/examples can write them
123 changes: 102 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,56 @@ permissions:
contents: read

jobs:
changes:
name: Changed extensions
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
matrix: ${{ steps.pick.outputs.matrix }}
any: ${{ steps.pick.outputs.any }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0

# A change outside extensions/ (a workflow, a root file) or an unknown base tests every extension.
- name: Pick the extension folders this change touches
id: pick
env:
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
run: |
set -euo pipefail
all=$(find extensions -mindepth 2 -maxdepth 2 -name package.json | cut -d/ -f2 | sort)
if [ -n "$BASE" ] && git cat-file -e "$BASE^{commit}" 2>/dev/null; then
files=$(git diff --name-only "$BASE" HEAD)
else
files=''
fi
if [ -z "$files" ] || grep -qv '^extensions/' <<<"$files"; then
picked=$all
else
picked=$(sed -n 's#^extensions/\([^/]*\)/.*#\1#p' <<<"$files" | sort -u | grep -Fxf <(echo "$all") || true)
fi
matrix=$(for n in $picked; do
jq -c --arg dir "extensions/$n" '{id: .agentage.id, dir: $dir, cli: ((.agentage.parts.cli // false) != false)}' "extensions/$n/package.json"
done | jq -cs '{include: .}')
echo "picked: $(echo $picked)" | tee -a "$GITHUB_STEP_SUMMARY"
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
echo "any=$([ -n "$picked" ] && echo true || echo false)" >> "$GITHUB_OUTPUT"

verify:
name: Verify
name: ${{ matrix.id }} verify and check
needs: changes
if: needs.changes.outputs.any == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.changes.outputs.matrix) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -27,21 +73,34 @@ jobs:
with:
node-version: 22
cache: 'npm'
cache-dependency-path: ${{ matrix.dir }}/package-lock.json

- name: Install
run: npm ci

- name: Verify (type-check, lint, format, test with coverage, build)
run: npm run verify

- name: Conformance (the kit's six rules; the store rule uses the runner's docker)
- name: Conformance (the kit's rules; the store rule uses the runner's docker)
run: node_modules/.bin/agentage extension check

local:
name: up and the e2e gate on local
name: ${{ matrix.id }} up and the e2e gate on local
needs: changes
if: needs.changes.outputs.any == 'true'
runs-on: ubuntu-latest
# The gate on docker stays under 10 minutes (about 3 on 2026-11-06); slower is a regression.
timeout-minutes: 10
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.changes.outputs.matrix) }}
defaults:
run:
working-directory: ${{ matrix.dir }}
env:
# The fewest gate tests each extension must run (probe ran 55 on 2026-11-06); a new id needs a floor here.
MIN_EXECUTED: ${{ fromJSON('{"probe":"30","fixture":"25"}')[matrix.id] }}
SECRETS_OK: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.head.repo.fork != true }}
steps:
- name: Checkout
uses: actions/checkout@v7
Expand All @@ -51,15 +110,17 @@ jobs:
with:
node-version: 22
cache: 'npm'
cache-dependency-path: ${{ matrix.dir }}/package-lock.json

- name: Install (and Chromium for the widget test; the runner has its OS libraries)
run: |
test -n "$MIN_EXECUTED" || { echo "no MIN_EXECUTED floor for ${{ matrix.id }} in ci.yml"; exit 1; }
npm ci
npx playwright install chromium

# agentage/e2e is private (the org PAT_TOKEN reads it); Dependabot runs get no secrets.
# agentage/e2e is private (the org PAT_TOKEN reads it); Dependabot and fork runs get no secrets.
- name: Checkout agentage/e2e
if: github.actor != 'dependabot[bot]'
if: env.SECRETS_OK == 'true'
uses: actions/checkout@v7
with:
repository: agentage/e2e
Expand All @@ -68,38 +129,58 @@ jobs:
persist-credentials: false

- name: Install agentage/e2e
if: github.actor != 'dependabot[bot]'
if: env.SECRETS_OK == 'true'
working-directory: e2e-suite
run: |
npm ci --prefix e2e-suite --no-audit --no-fund
npx --prefix e2e-suite playwright install chromium
npm ci --no-audit --no-fund
npx playwright install chromium

# The cli and its kit come from this lockfile: a cli or kit patch needs a probe commit.
# The cli and its kit come from this extension's lockfile: a cli or kit patch needs a commit here.
- name: agentage extension up --docker (the release recipes, store, dev issuer, gateway)
run: node_modules/.bin/agentage extension up --docker

- name: Smoke and the widget a11y test through the local gateway (e2e/)
- name: Smoke and the widget tests through the local gateway
run: npm run test:e2e

- name: e2e gate on docker (agentage/e2e, probe gate docker)
if: github.actor != 'dependabot[bot]'
# {ID}_DIR lets the gate read the contracts and the cli part from this checkout.
- name: e2e gate on docker (agentage/e2e, the row of this id)
if: env.SECRETS_OK == 'true'
working-directory: e2e-suite
env:
PROBE_DIR: ${{ github.workspace }}
run: npm run e2e -- probe gate docker
EXT_DIR: ${{ github.workspace }}/${{ matrix.dir }}
run: |
var="$(echo '${{ matrix.id }}' | tr a-z- A-Z_)_DIR"
env "$var=$EXT_DIR" npm run e2e -- '${{ matrix.id }}' gate docker

# A gate that skipped itself is not green (55 executed on 2026-11-06); the cli part tests need PROBE_DIR.
# A gate that skipped itself is not green; an extension with a cli part must run its cli tests.
- name: Assert the gate was not vacuous and read this checkout
if: github.actor != 'dependabot[bot]'
if: env.SECRETS_OK == 'true'
working-directory: e2e-suite
env:
MIN_EXECUTED: '30'
run: |
set -euo pipefail
node scripts/assert-executed.mjs
ran=$(jq '[.. | objects | select(.specs?) | .specs[] | select(.file | test("probe/p0/cli")) | .tests[] | select(.status != "skipped")] | length' reports/results.json)
echo "cli part tests executed: $ran"
test "$ran" -gt 0
if [ '${{ matrix.cli }}' = 'true' ]; then
ran=$(jq --arg p '${{ matrix.id }}/p0/cli' '[.. | objects | select(.specs?) | .specs[] | select(.file | test($p)) | .tests[] | select(.status != "skipped")] | length' reports/results.json)
echo "cli part tests executed: $ran"
test "$ran" -gt 0
fi

- name: Logs on failure
if: failure() || cancelled()
run: docker compose -f .agentage/compose.json logs --no-color --tail 80 || true

# The one required context: green when every picked extension passed, or none was picked.
ci-required:
name: ci-required
needs: [changes, verify, local]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Every job passed or had nothing to test
env:
NEEDS: ${{ toJSON(needs) }}
run: |
set -euo pipefail
jq -r 'to_entries[] | "\(.key): \(.value.result)"' <<<"$NEEDS"
jq -e '.changes.result == "success" and all(.[]; .result == "success" or .result == "skipped")' <<<"$NEEDS" >/dev/null
56 changes: 45 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Release

# A v* tag: agentage extension release refuses the template, a commit off master and a tag that is
# not the version, keeps a released version (re-run = npm only), then pushes the images, attaches
# agentage-extension.json to the release and publishes to npm with OIDC (npm = this file).
# A merge is the release: agentage extension release --changed gives each extension whose folder
# differs from its last <id>@* tag a date version YYYY.MDD.N, the tag <id>@<version>, its images,
# the records on the GitHub release and npm with OIDC (a private package skips npm). One that fails
# does not stop the others; the run ends with one table and is red when any failed.
on:
push:
tags: ['v*']
branches: [master]

concurrency:
group: release
Expand All @@ -18,9 +19,9 @@ permissions:

jobs:
release:
name: Images, record, package
name: Images, records, packages of the changed extensions
runs-on: ubuntu-latest
timeout-minutes: 45
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
with:
Expand All @@ -29,11 +30,44 @@ jobs:
with:
node-version: 22
cache: 'npm'
- run: npm ci --ignore-scripts && npm run verify
- run: npm install -g npm@11 # OIDC needs npm >= 11.5.1
- env:
cache-dependency-path: extensions/*/package-lock.json

# A held folder leaves this checkout (sparse), so the cli neither sees it nor tags it.
- name: Hold the extensions named in .github/release-hold
id: hold
run: |
set -euo pipefail
keep=()
for d in extensions/*/; do
name=$(basename "$d")
why=$(awk -v n="$name" '$1 == n { $1 = ""; sub(/^ +/, ""); print; exit }' .github/release-hold)
if [ -n "$why" ]; then
echo "AMBER $name: not released: $why"
echo "::warning title=$name is held::$why"
else
keep+=("${d%/}")
fi
done
if [ "${#keep[@]}" -lt "$(find extensions -mindepth 1 -maxdepth 1 -type d | wc -l)" ]; then
git sparse-checkout set --cone "${keep[@]}"
fi
test -z "$(git status --porcelain)"
echo "any=$([ "${#keep[@]}" -gt 0 ] && echo true || echo false)" >> "$GITHUB_OUTPUT"

- name: Install and verify each extension (its own lockfile)
if: steps.hold.outputs.any == 'true'
run: |
set -euo pipefail
for d in extensions/*/; do
(cd "$d" && npm ci --ignore-scripts && npm run verify)
done
- if: steps.hold.outputs.any == 'true'
run: npm install -g npm@11 # OIDC needs npm >= 11.5.1
- if: steps.hold.outputs.any == 'true'
env:
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: printf '%s' "$GHCR_TOKEN" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- env:
- if: steps.hold.outputs.any == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node_modules/.bin/agentage extension release # the lockfile's cli, never a fresh resolve
run: npx -y @agentage/cli@0.71.0 extension release --changed # pinned: the merge-release cli
4 changes: 2 additions & 2 deletions .repo-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ waive:
- id: cicd-no-npm-token
reason: 'temporary first-publish token for a new npm name; removed once @agentage/widget is on npm'
- id: rb-published-files
reason: 'tag-driven release in feature 1; prepare-release.yml arrives with the release loop (feature 2)'
reason: 'a merge is the release: release.yml gives each changed extension a date version, so nothing is bumped by hand'
- id: obs-kit
reason: 'the extension kit owns the server, logs and /health (sealing); telemetry shipping lands in the kit'
- id: be-migrations-ci
reason: 'an extension never migrates from its own repo: the kit migrate job applies migrations/ in the local job (up) and in estate apply before each rollout; unit tests apply them to an in-process postgres'
- id: cicd-release-artifact
reason: 'release.yml publishes through `agentage extension release` (images, a release record and the npm publish via OIDC), not a literal npm publish command'
reason: 'release.yml publishes through `agentage extension release` --changed (images, the release records and the npm publish via OIDC), not a literal npm publish command'
72 changes: 22 additions & 50 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,26 @@
# CLAUDE.md - agentage/extension-probe
# CLAUDE.md - agentage/examples

Public repo. The probe extension: it has every part kind and the shape every later extension
copies. Keep it minimal and exactly on the kit's rules. The human guide is [README.md](README.md):
run, verify and release. This file adds only what the tree does not say.
Public repo. Example extensions, one folder each under `extensions/`. The human guide is
[README.md](README.md). Each folder has its own `README.md` and `CLAUDE.md`: read the folder's
before you change it.

## Where facts live

- The parts at a glance, the kit: `README.md` "What it serves".
- api routes, scopes, limits, `emit` `exit`/`fail`: `docs/parts.md` "api"; proof `openapi.json` (generated).
- The MCP tool and its input: `docs/parts.md` "mcp"; proof `probe.mcpc.json` (generated).
- pages, ui, app, worker, cli: `docs/parts.md` "pages", "ui", "app", "worker", "cli"; proof `src/{part}/index.ts` (`src/app/index.tsx`).
- Database, seeds, the migrate entry: `docs/parts.md` "store"; proof `migrations/`, `seeds/`.
- Clone commands and tokens: `README.md` "Run it from a clone"; what `up` does, ports: `docs/develop.md` "Run it from a clone".
- What CI runs: `README.md` "Verify"; the e2e gate, `MIN_EXECUTED`: `docs/develop.md` "Verify"; proof `.github/workflows/ci.yml`.
- Release steps and refusals: `README.md` "Release"; proof `.github/workflows/release.yml`.
- Where a release runs: `README.md` "Deploy".
- The target design (the extension model, the app host, the app shell): the north star in the agentage product vault, `projects/architecture/`. Do not copy it into this repo.
- The manifest, commands, settings and secrets: the `agentage` block of `package.json`.

Read the file named here before you read `src/`.

## Rules this repo proves (the kit's `agentage extension check` and `src/manifest.test.ts`)

- A part module exports `create(ctx)` and nothing else; `src/ui/index.ts` exports `widgets` only.
Never `listen()`, the `process` global, a token check or an absolute agentage URL in `src/`.
- A part imports only its own folder and `src/lib/`: each image carries `dist/{part}` and
`dist/lib` only, so a cross-part import would not start.
- No Dockerfile, no compose file: the kit tool builds `ghcr.io/agentage/probe-{part}:{version}`.
- The manifest is the `agentage` block of `package.json`.
- `probe.mcpc.json` and `openapi.json` are committed contracts: `src/mcp/index.test.ts` diffs the
tool list from a 2025-11-25 and a 2026-07-28 client, `src/api/openapi.test.ts` the OpenAPI
generated from the Zod schemas. Regenerate with `npx agentage extension check --write` and `npm run format`.
The release steps are in the README.
- The release record `dist/agentage-extension.json` (images by digest) is written by
`build --push` only, in `release.yml`; never by hand, never committed. `up` writes its own
`.agentage/record.json` (ignored). `agentage extension release` keeps a released version's images
and record: never move a `v*` tag, release a new version.

## Commands

- `npm run verify`; `agentage extension up --docker` (asserts each part's `/health` body), then
`npm run test:e2e` (the Playwright smoke and the widget axe test through `localhost:4280`);
`agentage extension down` removes this working copy's compose project only (named in
`.agentage/compose.json`, one per checkout), so scripts address it with `-f`, never `-p`
- a flake is fixed at its cause: the gate runs with no retries, `e2e/` retries once in CI only to
keep a trace and fails a test that passed on it (`failOnFlakyTests`); a test that needs
the store boots it in `beforeAll` (PGlite's first use is a WASM boot), never inside a test's 5 s.
- `@agentage/cli` is an exact devDependency: CI and the release run `node_modules/.bin/agentage`,
so the cli and the kit tool that writes the image recipe are this lockfile's; a cli or kit patch
reaches the images only through a probe commit (Dependabot's weekly group)
- to try an unreleased kit or widget: `npm pack` them from agentage/platform into `.kit/`
(ignored) and `npm install ./.kit/*.tgz`, as platform CI does; never commit a tarball or a
`file:` spec
- The extensions and the layout: `README.md` "Layout".
- What CI runs per extension, the `MIN_EXECUTED` floors, the one required job `ci-required`:
`.github/workflows/ci.yml`.
- The release by merge, holds, the npm state: `docs/release.md`; proof `.github/workflows/release.yml`.
- The target design: the north star in the agentage product vault, `projects/architecture/`. Do not
copy it into this repo.

## Rules

- No npm workspaces and no root `package.json`: each extension folder is a whole package with its own
`package-lock.json` (the image build installs it). Run every npm and `agentage` command inside
the folder.
- Never bump a version and never push a tag: a merge to master releases each changed folder with a
date version `YYYY.MDD.N` and the tag `<id>@<version>`. A released version never changes.
- A new extension folder needs a `MIN_EXECUTED` floor in `ci.yml` and a row in agentage/e2e.
- `.github/release-hold` keeps a folder out of the release; each line names its reason. Remove the
line only when that reason is gone.
- Merge a pull request that moves files with "rebase", so `git log --follow` keeps the history.
Loading