diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a951481..b622098 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,16 +169,16 @@ jobs: --build-arg COMMIT_SHA="$GITHUB_SHA" --build-arg VERSION="$version" . node packages/apphost/scripts/image-smoke.mjs apphost:ci - - name: Image smoke - extension-probe on this kit, every part through up + - name: Image smoke - the probe extension on this kit, every part through up env: PROBE_REF: ${{ vars.PROBE_REF }} run: | set -euo pipefail mkdir -p /tmp/pack npm pack --workspaces --pack-destination /tmp/pack >/dev/null - # A PR runs against the extension-probe branch named as its head (or a non-default base), else + # A PR runs against the examples branch named as its head (or a non-default base), else # the repo variable PROBE_REF (set while a kit change waits on a probe release), else master. - probe=https://github.com/agentage/extension-probe.git + probe=https://github.com/agentage/examples.git branch="${PROBE_REF:-master}" # The base counts only when it is another PR's branch: a PR on master falls to the variable. base="${GITHUB_BASE_REF:-}" @@ -186,10 +186,12 @@ jobs: for ref in "$base" "${GITHUB_HEAD_REF:-}"; do if [ -n "$ref" ] && git ls-remote --exit-code --heads "$probe" "$ref" >/dev/null; then branch="$ref"; fi done - echo "extension-probe branch: $branch" >> "$GITHUB_STEP_SUMMARY" + echo "examples branch: $branch" >> "$GITHUB_STEP_SUMMARY" git clone --depth 1 --branch "$branch" "$probe" /tmp/probe - mkdir -p /tmp/probe/.kit - cd /tmp/probe + dir=$(node "$GITHUB_WORKSPACE/scripts/probe-dir.mjs" /tmp/probe) + echo "PROBE_DIR=$dir" >> "$GITHUB_ENV" + mkdir -p "$dir/.kit" + cd "$dir" # The probe's @agentage/* dependencies built here replace the registry copies. tarballs=() for tgz in /tmp/pack/agentage-*.tgz; do @@ -207,7 +209,7 @@ jobs: node node_modules/@agentage/extension/dist/tool/cli.js up - name: Image smoke - discovery is valid through the gateway, e2e (up already asserted each part's /health commit) - working-directory: /tmp/probe + working-directory: ${{ env.PROBE_DIR }} run: | set -euo pipefail curl -sf http://localhost:4280/.well-known/agentage-extension.json > /tmp/discovery.json @@ -216,7 +218,7 @@ jobs: npm run test:e2e - name: Image smoke - the kit caller route through the gateway (200 own scopes, 401, 403) - working-directory: /tmp/probe + working-directory: ${{ env.PROBE_DIR }} run: | set -euo pipefail at=http://localhost:4280/api/probe/caller @@ -229,7 +231,7 @@ jobs: # The one container (C7): the image builds from this kit, starts healthy and serves the api. - name: One container smoke - build --container, run it, the api answers - working-directory: /tmp/probe + working-directory: ${{ env.PROBE_DIR }} run: | set -euo pipefail node node_modules/@agentage/extension/dist/tool/cli.js build --container @@ -245,7 +247,7 @@ jobs: - name: Container logs on failure if: failure() - run: docker compose -f /tmp/probe/.agentage/compose.json logs --no-color --tail 80 || true + run: docker compose -f "$PROBE_DIR/.agentage/compose.json" logs --no-color --tail 80 || true widget-screenshots: name: Widget screenshots @@ -305,13 +307,13 @@ jobs: path: platform # The same probe branch as the image smoke: head, a non-default base, vars.PROBE_REF, master. - - name: Pick the extension-probe branch + - name: Pick the examples branch id: probe-ref env: PROBE_REF: ${{ vars.PROBE_REF }} run: | branch="${PROBE_REF:-master}" - probe=https://github.com/agentage/extension-probe.git + probe=https://github.com/agentage/examples.git # The base counts only when it is another PR's branch: a PR on master falls to the variable. base="${GITHUB_BASE_REF:-}" if [ "$base" = "${{ github.event.repository.default_branch }}" ]; then base=""; fi @@ -338,13 +340,17 @@ jobs: echo "e2e branch: $branch" >> "$GITHUB_STEP_SUMMARY" echo "branch=$branch" >> "$GITHUB_OUTPUT" - - name: Checkout agentage/extension-probe + - name: Checkout agentage/examples uses: actions/checkout@v7 with: - repository: agentage/extension-probe + repository: agentage/examples ref: ${{ steps.probe-ref.outputs.branch }} path: probe + # extensions/probe when the checked-out ref has it, else the repo root. + - name: Find the probe folder + run: echo "PROBE_DIR=$(node platform/scripts/probe-dir.mjs "$PWD/probe")" >> "$GITHUB_ENV" + # agentage/e2e is private; the org PAT_TOKEN reads it. Dependabot runs get no secrets. - name: Checkout agentage/e2e if: github.actor != 'dependabot[bot]' @@ -368,8 +374,8 @@ jobs: run: | npm ci --prefix platform npm run build --prefix platform - npm pack --workspaces --prefix platform --pack-destination "$PWD/probe" - cd probe + npm pack --workspaces --prefix platform --pack-destination "$PROBE_DIR" + cd "$PROBE_DIR" # No npm ci first: a probe that already pins the candidate version cannot fetch it from npm. # Any other workspace package the probe names (identity) comes from this tree too, never npm. tarballs=(./agentage-extension-*.tgz ./agentage-widget-*.tgz) @@ -388,19 +394,17 @@ jobs: npm run build - name: agentage extension up - working-directory: probe + working-directory: ${{ env.PROBE_DIR }} # The kit's own tool, not the agentage bin: the probe's @agentage/cli bundles the released kit. run: node node_modules/@agentage/extension/dist/tool/cli.js up - name: e2e gate on docker (agentage/e2e, probe gate docker) if: github.actor != 'dependabot[bot]' working-directory: e2e-suite - env: - PROBE_DIR: ${{ github.workspace }}/probe run: | npm ci # The gate validates the discovery document and the record with the kit under test. - npm install --no-save ../probe/agentage-extension-*.tgz + npm install --no-save "$PROBE_DIR"/agentage-extension-*.tgz # The version alone cannot tell the candidate from npm (both can be 0.13.0): the source can. resolved=$(jq -r '.packages["node_modules/@agentage/extension"].resolved' node_modules/.package-lock.json) echo "e2e validates with @agentage/extension $(jq -r .version node_modules/@agentage/extension/package.json) from $resolved" @@ -418,5 +422,5 @@ jobs: - name: agentage extension down if: always() - working-directory: probe + working-directory: ${{ env.PROBE_DIR }} run: node node_modules/@agentage/extension/dist/tool/cli.js down || true diff --git a/.repo-doctor.yml b/.repo-doctor.yml index 8e76c11..141b308 100644 --- a/.repo-doctor.yml +++ b/.repo-doctor.yml @@ -8,4 +8,4 @@ waive: - id: ts-nodenext-ext reason: "the only hits are JSON fixtures imported with { type: 'json' }; tsc enforces .js on every .ts import" - id: cicd-no-npm-install - reason: 'the image smoke runs npm install ./.kit/kit.tgz in a throwaway extension-probe clone, so the image carries the packed kit; this repo installs with npm ci' + reason: 'the image smoke runs npm install ./.kit/kit.tgz in a throwaway probe clone, so the image carries the packed kit; this repo installs with npm ci' diff --git a/CLAUDE.md b/CLAUDE.md index 6fdccbc..f13d6dc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -139,8 +139,8 @@ Read the file named here before you read `src/` (`src/` = `packages/extension/sr - `up` names its compose project per working copy; scripts reach it with `-f .agentage/compose.json`, never `-p`. The ui CSP allows the dev issuer only when `AGENTAGE_DEV_ISSUER` is set (only `up` sets it). -- CI's image smoke clones extension-probe master (or, on a PR, the probe branch of the same name - when one exists), installs the packed packages it uses and runs `up`: a probe change can turn +- CI's image smoke clones agentage/examples master (or, on a PR, the branch of the same name + when one exists), takes extensions/probe (the repo root when absent), installs the packed packages it uses and runs `up`: a probe change can turn this CI red, and a kit change that breaks the probe never reaches npm. - Public repo: no secrets, no internal hosts, no provider names, no roadmap in code or docs. - Docs: sentences of 25 words or fewer, no em dash, no plan ids a reader cannot open. diff --git a/README.md b/README.md index 70d0284..be63411 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ export function create(ctx: McpContext) { - `worker`: jobs on a five-field cron. A job never runs twice at once. - `cli`: one handler per command in `agentage.commands`. -[extension-probe](https://github.com/agentage/extension-probe) has every part kind. +[the probe extension](https://github.com/agentage/examples) has every part kind. More: [docs/parts.md](docs/parts.md). @@ -137,7 +137,7 @@ The same run builds the app host program image from `packages/apphost/Dockerfile the release. A re-run records the image that it pushed before. It refuses a version tag with another digest. The decision and the record are in `packages/apphost/scripts/image-release.mjs`. -Before that, CI builds [extension-probe](https://github.com/agentage/extension-probe) on the +Before that, CI builds [the probe extension](https://github.com/agentage/examples) on the packed packages, runs `up`, and checks every part image and the served discovery document. A kit change is proven in containers before it ships. diff --git a/docs/parts.md b/docs/parts.md index 6d44313..98ae143 100644 --- a/docs/parts.md +++ b/docs/parts.md @@ -92,7 +92,7 @@ The app part is one root component in `src/app/index.tsx`, its default export. I - `check` refuses an app part whose package.json does not declare `@agentage/design-system` `^0.20` (the kit app code imports it); `@agentage/extension` lists it as an optional peer. The manifest is the `agentage` block of the extension's `package.json`. See -[extension-probe](https://github.com/agentage/extension-probe) for every part kind. +[the probe extension](https://github.com/agentage/examples) for every part kind. ## Store diff --git a/scripts/probe-dir.mjs b/scripts/probe-dir.mjs new file mode 100644 index 0000000..ee42e40 --- /dev/null +++ b/scripts/probe-dir.mjs @@ -0,0 +1,11 @@ +import { existsSync } from 'node:fs'; +import { join } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +// examples keeps probe in extensions/probe since its folder layout; an older ref has it at the root. +export const probeDir = (checkout) => { + const nested = join(checkout, 'extensions', 'probe'); + return existsSync(join(nested, 'package.json')) ? nested : checkout; +}; + +if (process.argv[1] === fileURLToPath(import.meta.url)) console.log(probeDir(process.argv[2])); diff --git a/scripts/probe-dir.test.mjs b/scripts/probe-dir.test.mjs new file mode 100644 index 0000000..6f48ed2 --- /dev/null +++ b/scripts/probe-dir.test.mjs @@ -0,0 +1,38 @@ +import { execFileSync } from 'node:child_process'; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { afterEach, describe, expect, it } from 'vitest'; +import { probeDir } from './probe-dir.mjs'; + +const made = []; +const checkout = (nested) => { + const root = mkdtempSync(join(tmpdir(), 'probe-dir-')); + made.push(root); + writeFileSync(join(root, 'package.json'), '{}'); + if (nested) { + mkdirSync(join(root, 'extensions', 'probe'), { recursive: true }); + writeFileSync(join(root, 'extensions', 'probe', 'package.json'), '{}'); + } + return root; +}; + +afterEach(() => made.splice(0).forEach((d) => rmSync(d, { recursive: true, force: true }))); + +describe('probeDir', () => { + it('takes the repo root when the probe is at the root', () => { + const root = checkout(false); + expect(probeDir(root)).toBe(root); + }); + + it('takes extensions/probe when that folder holds the probe', () => { + const root = checkout(true); + expect(probeDir(root)).toBe(join(root, 'extensions', 'probe')); + }); + + it('prints the folder when run as a script', () => { + const root = checkout(true); + const out = execFileSync('node', ['scripts/probe-dir.mjs', root], { encoding: 'utf8' }); + expect(out.trim()).toBe(join(root, 'extensions', 'probe')); + }); +}); diff --git a/vitest.config.ts b/vitest.config.ts index 0d12f42..e2b80e0 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -14,7 +14,11 @@ export default defineConfig({ // An in-process postgres boots in seconds when the whole suite runs at once (tests and hooks). testTimeout: 30_000, hookTimeout: 30_000, - include: ['packages/*/src/**/*.test.{ts,tsx}', 'packages/apphost/scripts/*.test.mjs'], + include: [ + 'packages/*/src/**/*.test.{ts,tsx}', + 'packages/apphost/scripts/*.test.mjs', + 'scripts/*.test.mjs', + ], globalSetup: ['packages/extension/src/test-support/pglite-template.ts'], setupFiles: [ 'packages/extension/src/test-support/cleanup.ts',