diff --git a/.agents/skills/publish-capture/SKILL.md b/.agents/skills/publish-capture/SKILL.md new file mode 100644 index 0000000..b666c5e --- /dev/null +++ b/.agents/skills/publish-capture/SKILL.md @@ -0,0 +1,51 @@ +--- +name: publish-capture +description: Give concise publishing instructions for @replayio/self-healing-capture, or assist with its authorized release from the Self Healing repository. +--- + +# Publish the capture package + +Read `packages/capture/package.json`, `scripts/publish-capture.ts`, and the release +section of `packages/capture/README.md` from the intended release revision. Confirm +the version from the manifest; do not carry a version number forward from an old +conversation. Use merged main unless the user specifies another reviewed revision. + +## Giving instructions + +Lead with one copy-pasteable shell command. Use the user's actual repository path, +properly shell-quoted. For a merged release that still needs to be pulled: + +```sh +cd '' && git switch main && git pull --ff-only && npm ci && npm run capture:publish +``` + +If the terminal is already at the prepared release checkout, give only: + +```sh +npm run capture:publish +``` + +State the Node requirement from the release docs (currently 22.14+) and that npm +will prompt for login/2FA with an account authorized to publish to `@replayio`. +That is normally the whole answer. Explain script internals or troubleshooting +only when relevant to the user's question. Keep CI/test infrastructure details in +development documentation rather than the user-facing publishing instructions. + +The release script owns version-existence checks, verification, build, packing, +authentication, publication, and registry visibility checks. Use that entry point +rather than expanding its internals into manual commands. A request for instructions +means provide the command, not execute publication. Installing the release in a +customer application is a separate task. + +## Assisting with an authorized release + +Check for local changes before switching branches; preserve them. Run publication +in an interactive terminal so npm can handle its authentication prompts. Do not +request credentials in chat. For a requested rehearsal, use +`npm run capture:publish -- --dry-run`. + +An already-published version is a successful no-op. If npm accepted publication but +registry visibility is pending, follow the script's printed verification command; +do not republish or bump the version merely because propagation is delayed. +Report the actual result and exact version. Merging the PR or deploying the service +does not establish npm publication. diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2fbbe0b..1505e4d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,7 +19,18 @@ jobs: node-version: 22 cache: npm - run: npm ci - - run: npx playwright install --with-deps chromium - run: npm test - run: npm run build - run: npm pack --workspace @replayio/self-healing-capture --pack-destination /tmp + browser-tests: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npx playwright install --with-deps chromium + - run: npm run test:browser diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 51f7440..6fc28ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,7 +23,6 @@ jobs: node-version: 22 cache: npm - run: npm ci - - run: npx playwright install --with-deps chromium - run: npm test - run: npm run build - name: Check Infisical configuration diff --git a/AGENTS.md b/AGENTS.md index 5f7d29f..05bfb4c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,3 +9,6 @@ This is an initial Netlify/React/TypeScript service scaffold modeled on Loop QA. - Keep factory/provider secrets server-side. Connections store only AES-GCM encrypted Subtext credentials, bound to their keyed fingerprint; never store plaintext keys. Do not add session recording data to the coordination database. - Run relevant tests for changes. For the initial service, `npm test` covers the handler and real Postgres semantics through PGlite; `npm run build` checks TypeScript and the frontend. - Keep deployment and database migration explicit. Preview environments must not share production databases or credentials. + +For capture package publishing instructions or release assistance, use +[the publish-capture skill](.agents/skills/publish-capture/SKILL.md). diff --git a/README.md b/README.md index 728549e..ce9f743 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,16 @@ Use Node 22.13 or newer and npm. No provider account or database is needed to vi ```sh npm ci -npx playwright install chromium # browser-backed capture selector tests npm run dev # landing page only, http://localhost:5173 npm run dev:netlify # landing page + REST API, http://localhost:8888 npm test # isolated PGlite Postgres tests; no external services npm run build # strict TypeScript check + production frontend ``` +Browser-backed capture selector tests run separately in PR CI. To run them locally, +use `npx playwright install chromium` followed by `npm run test:browser`. They are +not part of `npm test`, production deployment, or package publishing. + For local database development, copy `.env.example` to `.env`, set `DATABASE_URL`, and apply the bootstrap migration with `node --env-file=.env --import tsx scripts/migrate.ts`. Netlify Dev loads `.env` automatically. Provision with a **Subtext API key** using `POST /api/v1/accounts` (`provisionAccount`). It returns a **Self Healing account API key**. All subsequent API calls authenticate with that returned key, not the Subtext key. Each account has a dedicated QA service identity and token. Subtext and QA credentials stay encrypted server-side; QA receives only session-scoped proxy callbacks. diff --git a/package.json b/package.json index 91c3403..3d0e500 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "db:migrate": "node --import tsx scripts/migrate.ts", "deploy:ci": "node --import tsx scripts/deploy-ci.ts", "build:capture": "npm run build --workspace @replayio/self-healing-capture", - "capture:publish": "node --import tsx scripts/publish-capture.ts" + "capture:publish": "node --import tsx scripts/publish-capture.ts", + "test:browser": "node --import tsx --test tests/browser/*.test.ts" }, "dependencies": { "@neondatabase/serverless": "^0.10.0", diff --git a/packages/capture/README.md b/packages/capture/README.md index 1eb61c2..84e150f 100644 --- a/packages/capture/README.md +++ b/packages/capture/README.md @@ -42,9 +42,7 @@ to UPGRADING.md and include verification steps. Publish locally with interactive npm authentication and 2FA: ```sh -npm ci -npx playwright install chromium -npm run capture:publish +npm ci && npm run capture:publish ``` Run from a terminal using Node 22.14+ and an npm account with publishing access to `@replayio`. diff --git a/tests/capture-selector.test.ts b/tests/browser/capture-selector.test.ts similarity index 98% rename from tests/capture-selector.test.ts rename to tests/browser/capture-selector.test.ts index 192ea4f..d85e3e2 100644 --- a/tests/capture-selector.test.ts +++ b/tests/browser/capture-selector.test.ts @@ -3,13 +3,13 @@ import { test } from "node:test"; import { chromium } from "@playwright/test"; import { readFileSync } from "node:fs"; import ts from "typescript"; -import type { interactionSelector as SelectorFunction } from "../packages/capture/src/interaction-selector.ts"; +import type { interactionSelector as SelectorFunction } from "../../packages/capture/src/interaction-selector.ts"; // Serialize the package's TypeScript output, without tsx's Node-only function-name helpers. const interactionSelector = new Function( ts.transpileModule( readFileSync( new URL( - "../packages/capture/src/interaction-selector.ts", + "../../packages/capture/src/interaction-selector.ts", import.meta.url, ), "utf8",