Skip to content

Commit 57e8fad

Browse files
committed
testing maestro
1 parent 7b9d193 commit 57e8fad

4 files changed

Lines changed: 164 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Phase 01: AI-Friendly Docs — SEO, Sitemap & llms.txt Improvements
2+
3+
This phase makes the ProofKit documentation site discoverable and consumable by both search engines and AI agents. By the end, the docs will have proper SEO metadata (sitemap, robots.txt, OpenGraph tags), improved llms.txt endpoints, and a working agent-detection middleware that serves markdown to LLM crawlers. This is the highest-priority work because better discoverability directly impacts how well AI assistants can help users build with ProofKit.
4+
5+
## Tasks
6+
7+
- [ ] Add SEO fundamentals to the Fumadocs site (`apps/docs/`):
8+
- Create `apps/docs/src/app/sitemap.ts` using Next.js App Router's built-in sitemap generation. Import `source` from `@/lib/source` and iterate `source.getPages()` to produce URLs rooted at `https://proofkit.dev/docs/`. Include the llms.txt routes as well.
9+
- Create `apps/docs/src/app/robots.ts` using Next.js App Router's built-in robots generation. Allow all crawlers, point to the sitemap URL, and explicitly allow `/llms.txt`, `/llms-full.txt`, and `/llms/` paths.
10+
- Update `generateMetadata` in `apps/docs/src/app/docs/(docs)/[[...slug]]/page.tsx` to include OpenGraph metadata (`og:title`, `og:description`, `og:type: article`, `og:url`) using the page's title, description, and constructed URL. Use Next.js `Metadata` type's built-in `openGraph` field.
11+
- Add a root-level `metadata` export in `apps/docs/src/app/layout.tsx` with `metadataBase` set to `https://proofkit.dev` so all relative OG URLs resolve correctly.
12+
13+
- [ ] Improve the llms.txt endpoints for better agent consumption:
14+
- In `apps/docs/src/app/llms.txt/route.ts`: fix the `"package"` field in `notify-intent.yml` — it still says `"with-changesets"` (template placeholder) instead of identifying the actual package. Note: this is in `.github/workflows/notify-intent.yml` line 59. Update the payload to dynamically determine the package name from the changed files, or use a static value like `"proofkit"`.
15+
- In the same llms.txt route, add a `## Getting Started` section that tells agents: "To scaffold a new ProofKit project, run `pnpm create proofkit` or `npx create-proofkit@latest`. For package-specific usage, see the per-package links below."
16+
- Add cache headers (`Cache-Control: public, max-age=3600, s-maxage=86400`) to all three llms.txt route responses so CDN can cache them.
17+
- In `apps/docs/src/app/llms/[package]/route.ts`, ensure the response includes a header comment pointing to the main llms.txt for context.
18+
19+
- [ ] Create agent-detection middleware for serving markdown to LLM crawlers:
20+
- Create `apps/docs/src/middleware.ts` that detects common AI/LLM user agents (e.g., `GPTBot`, `ChatGPT-User`, `Claude-Web`, `Anthropic`, `CCBot`, `Google-Extended`, `PerplexityBot`, `Bytespider`, and generic patterns like `bot` + `ai` in user-agent).
21+
- When an LLM agent is detected requesting a `/docs/` page, rewrite the request to the corresponding `/llms/` endpoint or serve the raw MDX content as plain text. The simplest approach: redirect detected agents to `/llms-full.txt` for root requests or `/llms/{package}` for package-specific requests by parsing the URL slug.
22+
- For non-agent requests, pass through normally.
23+
- Configure the middleware matcher in the export to only run on `/docs/:path*` routes to avoid affecting API routes or static assets.
24+
25+
- [ ] Audit and improve llms.txt content accuracy:
26+
- Read through each package's docs directory (`apps/docs/content/docs/{package}/`) and compare the descriptions in the llms.txt PACKAGES array against the actual content. Ensure package descriptions are accurate and helpful for an AI agent trying to understand what each package does.
27+
- Check that `apps/docs/src/app/llms/[package]/route.ts` correctly maps all 7 packages and that the content returned for each is complete (not truncating or missing pages).
28+
- Verify the `getLLMText()` function in `apps/docs/src/lib/get-llm-text.ts` properly strips frontmatter and produces clean markdown. Test edge cases: pages with code blocks, tables, links.
29+
30+
- [ ] Build and verify the docs site compiles with all changes:
31+
- Run `pnpm --filter @proofkit/docs build` to ensure no build errors from the new sitemap, robots, middleware, and metadata changes.
32+
- Run `pnpm run ci` from the repo root to validate lint, typecheck, and tests all pass.
33+
- If any issues arise, fix them before completing this task.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Phase 02: Doc-Staleness Detection & Cross-Linking
2+
3+
This phase builds the automated doc-staleness detection system that runs during the release process. It also improves cross-linking between docs, SKILL.md files, and CLI help output so that AI agents and users can navigate between related resources. The goal is to ensure documentation never silently drifts from the actual package behavior.
4+
5+
## Tasks
6+
7+
- [ ] Build a doc-staleness detection script that compares package source changes against doc updates:
8+
- Create `scripts/check-doc-staleness.ts` (or `.mjs`) at the repo root.
9+
- The script should:
10+
1. For each package in `packages/*/`, get the most recent commit that touched `src/` files
11+
2. Get the most recent commit that touched the corresponding `apps/docs/content/docs/{package}/` directory
12+
3. If source was modified more recently than docs, flag it as potentially stale
13+
4. Also check if the package's SKILL.md was updated after the last source change
14+
5. Output a structured report (JSON or markdown) listing stale packages with: package name, days since last source change, days since last doc update, list of changed source files
15+
- Use `child_process.execSync` with `git log` commands — keep it simple, no external dependencies.
16+
- Add a `"check:docs"` script to root `package.json` that runs this script.
17+
- The script should exit with code 0 (always succeed) but print warnings prominently. It's advisory, not blocking.
18+
19+
- [ ] Integrate doc-staleness check into the release workflow:
20+
- In `.github/workflows/release.yml`, add a new job called `doc-review` that runs after the test jobs but before the release job.
21+
- The job should: checkout, setup Node, install deps, run `pnpm check:docs`.
22+
- Capture the output and post it as a PR comment (using `actions/github-script`) on the changeset version PR if one exists. This way maintainers see the staleness report before merging the release.
23+
- Make this job `continue-on-error: true` so it never blocks the release.
24+
25+
- [ ] Fix the `notify-intent.yml` placeholder issue:
26+
- In `.github/workflows/notify-intent.yml` line 59, the `"package"` field is `"with-changesets"` (a template placeholder from `intent setup`).
27+
- Change it to `"proofkit"` or dynamically determine it from the changed files path (e.g., extract the package name from the first changed file matching `packages/*/`).
28+
- Also update the comment block at the top of the file (lines 11-13) to remove the template variable references.
29+
30+
- [ ] Improve cross-linking between docs, skills, and CLI output:
31+
- In each package's main doc page (`apps/docs/content/docs/{package}/index.mdx`), add a "For AI Agents" callout or section at the bottom that points to the package's SKILL.md file location and the llms.txt per-package endpoint. Use a Fumadocs `Callout` component if available, or a simple blockquote.
32+
- In each SKILL.md file's `sources` frontmatter field, verify the doc URLs point to the correct pages on proofkit.dev. Update any that are wrong or missing.
33+
- In the CLI's help output (check `packages/cli/src/` for the main command definitions), ensure the `--help` text mentions `https://proofkit.dev/docs/cli` for full documentation.
34+
35+
- [ ] Write tests for the doc-staleness script:
36+
- Create `scripts/__tests__/check-doc-staleness.test.ts` (or co-locate with the script).
37+
- Test the core logic: parsing git log output, comparing dates, generating the report structure.
38+
- Mock `execSync` to provide controlled git log output rather than depending on actual git history.
39+
- Run `pnpm run ci` to confirm everything passes.
40+
41+
- [ ] Run full CI checks:
42+
- Run `pnpm run ci` from the repo root to validate lint, typecheck, and tests all pass with the new script, workflow changes, and cross-linking updates.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Phase 03: CLI Test Hardening & Agent-Friendly Output
2+
3+
This phase speeds up the `proofkit init` test suite, prepares the test infrastructure for upcoming new templates, and ensures CLI output includes guidance that helps AI agents use ProofKit correctly. The CLI is the primary entry point for new users (many of whom are non-developers working with AI assistants), so its output quality directly impacts the AI-assisted experience.
4+
5+
## Tasks
6+
7+
- [ ] Profile the existing CLI test suite to identify bottlenecks:
8+
- Run `pnpm --filter @proofkit/cli test` with timing output (e.g., `time` prefix or Vitest's `--reporter=verbose`) and record how long each test file takes.
9+
- Check `packages/cli/vitest.config.ts` — note that `fileParallelism: false` is currently set. Investigate which tests actually need sequential execution (shared state, filesystem conflicts) vs. which could safely run in parallel.
10+
- Look at the test-layer.ts and init-fixtures.ts helpers — check if tests share any mutable state that would prevent parallelization.
11+
- Document findings as comments in the vitest config file explaining why parallelism is disabled (if truly needed) or enable it if tests are safe to parallelize.
12+
13+
- [ ] Optimize test execution speed:
14+
- In test files that create filesystem artifacts (`executor.test.ts`, `integration.test.ts`, `init-scaffold-contract.test.ts`), ensure each test uses a unique temp directory (e.g., via `crypto.randomUUID()` or `Date.now()` suffix) so they don't conflict when run in parallel.
15+
- If tests are currently writing to a shared output directory, refactor to use isolated directories per test.
16+
- Try enabling `fileParallelism: true` in `vitest.config.ts` after ensuring isolation. If specific test files still need sequential execution, use Vitest's `test.sequential` or split them into a separate config.
17+
- Check if the `pnpm build` step in the test script (`"test": "pnpm build && vitest run"`) can be cached or skipped when source hasn't changed. Consider using `turbo` for caching the build step.
18+
19+
- [ ] Prepare test infrastructure for new templates:
20+
- Review the existing template test pattern in `init-scaffold-contract.test.ts` to understand how templates are validated (deterministic output checks).
21+
- Create a reusable test helper function (e.g., `createTemplateTestSuite(templateName, options)`) in `packages/cli/tests/test-utils.ts` or a new `template-test-helpers.ts` that:
22+
1. Sets up an isolated temp directory
23+
2. Runs the init scaffold for the given template
24+
3. Reads and returns the generated artifacts (package.json, config files, etc.)
25+
4. Provides assertion helpers for common checks (has correct dependencies, has correct scripts, config matches expected shape)
26+
- Refactor existing template tests to use this helper where it reduces duplication. Don't force it if the existing tests are already clean.
27+
28+
- [ ] Make CLI output more AI-agent-friendly:
29+
- In the post-init success message (find in `packages/cli/src/` — likely in the init command handler or executor), add a line pointing to docs: "Full documentation: https://proofkit.dev/docs"
30+
- If there's a `--help` flag handler for the main `proofkit` command, ensure it includes the docs URL.
31+
- In error messages from the CLI, ensure they include enough context for an AI agent to diagnose the issue (e.g., "Missing required field X. See https://proofkit.dev/docs/cli/reference for options.").
32+
- Review the AGENTS.md at the repo root — ensure it mentions the CLI and how to use it for project scaffolding.
33+
34+
- [ ] Run all tests and verify improvements:
35+
- Run `pnpm --filter @proofkit/cli test` and compare timing to the baseline recorded in the profiling task.
36+
- Run `pnpm run ci` from the repo root to validate everything passes.
37+
- If any test failures occur, fix them before completing this task.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Phase 04: Release Hardening & Beta Exit Preparation
2+
3+
This phase hardens the CI/CD pipeline, validates the full release process end-to-end, and prepares for exiting beta prerelease mode. By the end, the release pipeline will be validated and ready for the stable release cut. The actual `changeset pre exit` command should be run manually by a maintainer when ready — this phase prepares everything needed for that moment.
4+
5+
## Tasks
6+
7+
- [ ] Audit and fix CI workflow issues:
8+
- Review `.github/workflows/release.yml` for any gaps or issues:
9+
- Verify all job dependencies are correct (lint → typecheck → test → smoke → release)
10+
- Ensure Node version is consistent across jobs (some use 22, release uses 24 — verify this is intentional)
11+
- Check that the `changesets/action@v1` step has correct configuration for the beta prerelease mode
12+
- Review `.github/workflows/continuous-release.yml` (PR checks):
13+
- Verify the `pkg-pr-new publish` step works correctly for preview packages
14+
- Ensure all parallel jobs (lint, typecheck, test, build) have consistent Node/pnpm versions
15+
- Check that Doppler OIDC authentication is properly configured for smoke tests (`.github/workflows/release.yml` smoke test job). Don't modify secrets, just verify the workflow references are correct.
16+
17+
- [ ] Validate the changeset configuration for stable release:
18+
- Read `.changeset/config.json` and verify settings are correct for public release:
19+
- `access: "public"` is set
20+
- `baseBranch: "main"` is correct
21+
- `ignore` list only contains packages that should not be published (`@proofkit/docs`, `@proofkit/typegen-web`)
22+
- `updateInternalDependencies: "patch"` is appropriate
23+
- Read `.changeset/pre.json` and document the current beta state: which packages have beta versions, how many changesets are queued.
24+
- Create a checklist file at `docs/release/beta-exit-checklist.md` with structured markdown (front matter: type: reference, tags: [release, beta, checklist]) documenting:
25+
1. Pre-exit steps (run full CI, verify all tests pass, review doc staleness report)
26+
2. The exit command: `pnpm changeset pre exit`
27+
3. Post-exit steps (run `pnpm changeset version`, review generated changelogs, commit, push, let CI release)
28+
4. Rollback plan if something goes wrong
29+
5. List of packages and their current beta versions vs expected stable versions
30+
31+
- [ ] Ensure all packages build cleanly for release:
32+
- Run `pnpm build` from the repo root and verify all packages compile without errors.
33+
- Run `pnpm --filter @proofkit/registry build` separately since it's private — verify it still builds even if it might be removed later.
34+
- Check that each package's `package.json` has correct `exports`, `main`, `types`, and `files` fields for npm publishing.
35+
- Run `pnpm dlx publint` on each package (or check if it's already part of the build pipeline) to validate package entry points.
36+
37+
- [ ] Run the complete CI pipeline locally to simulate a release:
38+
- Run `pnpm run ci` (lint + typecheck + test) from the repo root.
39+
- Run `pnpm build` to verify build succeeds.
40+
- Run `pnpm changeset status` to see the current changeset queue and verify it reports correctly.
41+
- If smoke tests can be run locally (check if Doppler secrets are available), run `pnpm --filter @proofkit/cli test:smoke`. If not, note this as a CI-only gate.
42+
- Fix any issues found during this validation.
43+
44+
- [ ] Create a release runbook document:
45+
- Create `docs/release/release-runbook.md` with structured markdown front matter (type: reference, tags: [release, process, runbook]) documenting:
46+
1. The complete release process from changeset creation to npm publish
47+
2. How the CI pipeline validates each step
48+
3. How to handle common failure scenarios (failed publish, partial release, reverted changeset)
49+
4. How the doc-staleness check (from Phase 02) integrates into the process
50+
5. How skill staleness checks (notify-intent → check-skills) fit into the release cycle
51+
6. Contact/escalation info if the release pipeline breaks
52+
- Use `[[Beta-Exit-Checklist]]` wiki-link to cross-reference the checklist from the previous task.

0 commit comments

Comments
 (0)