From 251148c3ff41359b2e0089a361d1321c17317996 Mon Sep 17 00:00:00 2001 From: Stefano Fiorini Date: Mon, 4 May 2026 04:41:34 +0000 Subject: [PATCH] Perform code optimization and document cleanup (#1) ## Summary - add repository-wide quality tooling and verification scaffolding, including CI workflows, pnpm workspace setup, ESLint/Prettier/markdown checks, and generated-output verification helpers - reorganize skill sources and generation flow by introducing canonical `_source` variants, generator/manifests, reusable helper abstractions, and shared web-automation/browser utilities - clean up and expand documentation so the root README flows into docs and skill docs, with clearer development, reviewer, installer, and workflow guidance ## Notable changes - docs flow and consistency cleanup across `README.md`, `docs/README.md`, and related docs - new scripts for `check`, docs verification, generated-file verification, shell portability, and safe directory replacement - refactors in Atlassian and web-automation skill runtimes to reduce duplication and centralize reusable code - changelog, development documentation, and CI surface updates ## Test Plan - [ ] `pnpm run check` - [ ] review generated/manifests and skill sync outputs - [ ] smoke-check docs flow from `README.md` to `docs/README.md` to skill docs ## Notes - this branch currently includes tracked `skills/web-automation/shared/node_modules` content that should be reviewed carefully as potentially noisy/accidental committed artifacts Co-authored-by: Stefano Fiorini Reviewed-on: https://git.fiorinis.com/Home/ai-coding-skills/pulls/1 --- .github/workflows/check-online.yml | 40 + .github/workflows/check.yml | 46 + .gitignore | 2 + .markdownlint-cli2.jsonc | 40 + .markdownlint.jsonc | 37 + .markdownlintignore | 14 + .prettierignore | 13 + .prettierrc.json | 8 + CHANGELOG.md | 204 + README.md | 105 +- docs/ATLASSIAN.md | 24 +- docs/CLEANUP-BASELINE.md | 558 +++ docs/CREATE-PLAN.md | 80 +- docs/CURSOR.md | 4 +- docs/DEVELOPMENT.md | 460 +++ docs/DO-TASK.md | 201 +- docs/IMPLEMENT-PLAN.md | 103 +- docs/INSTALLER.md | 30 +- docs/PI-COMMON-REVIEWER.md | 35 +- docs/PI-RESEARCH.md | 33 +- docs/PI-SUPERPOWERS.md | 9 +- docs/PI.md | 42 +- docs/README.md | 85 +- docs/REVIEWERS.md | 81 + docs/TELEGRAM-NOTIFICATIONS.md | 85 +- docs/WEB-AUTOMATION.md | 8 +- eslint.config.mjs | 54 + markdown-link-check.json | 9 + markdown-link-check.online.json | 12 + package.json | 28 +- .../skills/atlassian/.generated-manifest.json | 103 + pi-package/skills/atlassian/SKILL.md | 2 + .../skills/atlassian/scripts/package.json | 5 +- .../skills/atlassian/scripts/src/adf.ts | 1 + .../skills/atlassian/scripts/src/cli.ts | 8 +- .../atlassian/scripts/src/command-helpers.ts | 25 + .../skills/atlassian/scripts/src/config.ts | 1 + .../atlassian/scripts/src/confluence.ts | 26 +- .../skills/atlassian/scripts/src/files.ts | 1 + .../skills/atlassian/scripts/src/health.ts | 1 + .../skills/atlassian/scripts/src/http.ts | 1 + .../skills/atlassian/scripts/src/jira.ts | 34 +- .../skills/atlassian/scripts/src/output.ts | 1 + .../skills/atlassian/scripts/src/raw.ts | 10 +- .../skills/atlassian/scripts/src/types.ts | 1 + .../create-plan/.generated-manifest.json | 31 + pi-package/skills/create-plan/SKILL.md | 2 + .../templates/continuation-runbook.md | 11 + .../create-plan/templates/milestone-plan.md | 18 + .../create-plan/templates/story-tracker.md | 6 + .../skills/do-task/.generated-manifest.json | 19 + pi-package/skills/do-task/SKILL.md | 2 + .../skills/do-task/templates/task-plan.md | 1 + .../implement-plan/.generated-manifest.json | 13 + pi-package/skills/implement-plan/SKILL.md | 2 + .../web-automation/.generated-manifest.json | 103 + pi-package/skills/web-automation/SKILL.md | 2 + .../skills/web-automation/scripts/auth.ts | 3 +- .../skills/web-automation/scripts/browse.ts | 50 +- .../web-automation/scripts/check-install.js | 6 +- .../skills/web-automation/scripts/extract.js | 1 + .../skills/web-automation/scripts/flow.ts | 3 +- .../web-automation/scripts/lib/browser.ts | 76 + .../web-automation/scripts/package.json | 5 +- .../web-automation/scripts/scan-local-app.ts | 24 +- .../skills/web-automation/scripts/scrape.ts | 1 + .../web-automation/scripts/test-full.ts | 1 + .../web-automation/scripts/test-minimal.ts | 1 + .../web-automation/scripts/test-profile.ts | 1 + .../web-automation/scripts/tsconfig.json | 2 +- .../scripts/turndown-plugin-gfm.d.ts | 1 + pnpm-lock.yaml | 3404 +++++++++++++++++ pnpm-workspace.yaml | 39 + scripts/generate-skills.mjs | 616 +++ scripts/lib/assert-no-pnpm-version-pin.mjs | 76 + scripts/lib/portable.sh | 28 + scripts/lib/run-check.mjs | 98 + scripts/lib/run-link-check.mjs | 144 + scripts/lib/run-shellcheck.mjs | 161 + scripts/lib/safe-replace-dir.mjs | 77 + scripts/lib/safe-replace-dir.sh | 102 + scripts/lib/skill-manager-core.mjs | 45 +- scripts/manage-skills.mjs | 12 +- scripts/sync-pi-package-skills.sh | 62 - scripts/tests/generate-skills.test.mjs | 365 ++ scripts/tests/safe-replace-dir.test.mjs | 139 + .../tests/skill-manager-core-remove.test.mjs | 137 + scripts/tests/skill-manager-core.test.mjs | 2 +- scripts/tests/verify-docs-flow.test.mjs | 71 + scripts/tests/verify-generated.test.mjs | 348 ++ scripts/verify-docs-flow.mjs | 318 ++ scripts/verify-generated.mjs | 421 ++ scripts/verify-pi-resources.sh | 22 +- scripts/verify-pi-workflows.sh | 8 +- skills/.markdownlint.jsonc | 20 + skills/atlassian/_source/claude-code/SKILL.md | 78 + skills/atlassian/_source/codex/SKILL.md | 81 + skills/atlassian/_source/cursor/SKILL.md | 93 + skills/atlassian/_source/opencode/SKILL.md | 78 + skills/atlassian/_source/pi/SKILL.md | 99 + .../claude-code/.generated-manifest.json | 103 + skills/atlassian/claude-code/SKILL.md | 2 + .../claude-code/scripts/package.json | 5 +- .../atlassian/claude-code/scripts/src/adf.ts | 1 + .../atlassian/claude-code/scripts/src/cli.ts | 8 +- .../scripts/src/command-helpers.ts | 25 + .../claude-code/scripts/src/config.ts | 1 + .../claude-code/scripts/src/confluence.ts | 26 +- .../claude-code/scripts/src/files.ts | 1 + .../claude-code/scripts/src/health.ts | 1 + .../atlassian/claude-code/scripts/src/http.ts | 1 + .../atlassian/claude-code/scripts/src/jira.ts | 34 +- .../claude-code/scripts/src/output.ts | 1 + .../atlassian/claude-code/scripts/src/raw.ts | 10 +- .../claude-code/scripts/src/types.ts | 1 + .../atlassian/codex/.generated-manifest.json | 103 + skills/atlassian/codex/SKILL.md | 2 + skills/atlassian/codex/scripts/package.json | 5 +- skills/atlassian/codex/scripts/src/adf.ts | 1 + skills/atlassian/codex/scripts/src/cli.ts | 8 +- .../codex/scripts/src/command-helpers.ts | 25 + skills/atlassian/codex/scripts/src/config.ts | 1 + .../atlassian/codex/scripts/src/confluence.ts | 26 +- skills/atlassian/codex/scripts/src/files.ts | 1 + skills/atlassian/codex/scripts/src/health.ts | 1 + skills/atlassian/codex/scripts/src/http.ts | 1 + skills/atlassian/codex/scripts/src/jira.ts | 34 +- skills/atlassian/codex/scripts/src/output.ts | 1 + skills/atlassian/codex/scripts/src/raw.ts | 10 +- skills/atlassian/codex/scripts/src/types.ts | 1 + .../atlassian/cursor/.generated-manifest.json | 103 + skills/atlassian/cursor/SKILL.md | 2 + skills/atlassian/cursor/scripts/package.json | 5 +- skills/atlassian/cursor/scripts/src/adf.ts | 1 + skills/atlassian/cursor/scripts/src/cli.ts | 8 +- .../cursor/scripts/src/command-helpers.ts | 25 + skills/atlassian/cursor/scripts/src/config.ts | 1 + .../cursor/scripts/src/confluence.ts | 26 +- skills/atlassian/cursor/scripts/src/files.ts | 1 + skills/atlassian/cursor/scripts/src/health.ts | 1 + skills/atlassian/cursor/scripts/src/http.ts | 1 + skills/atlassian/cursor/scripts/src/jira.ts | 34 +- skills/atlassian/cursor/scripts/src/output.ts | 1 + skills/atlassian/cursor/scripts/src/raw.ts | 10 +- skills/atlassian/cursor/scripts/src/types.ts | 1 + .../opencode/.generated-manifest.json | 103 + skills/atlassian/opencode/SKILL.md | 2 + .../atlassian/opencode/scripts/package.json | 5 +- skills/atlassian/opencode/scripts/src/adf.ts | 1 + skills/atlassian/opencode/scripts/src/cli.ts | 8 +- .../opencode/scripts/src/command-helpers.ts | 25 + .../atlassian/opencode/scripts/src/config.ts | 1 + .../opencode/scripts/src/confluence.ts | 26 +- .../atlassian/opencode/scripts/src/files.ts | 1 + .../atlassian/opencode/scripts/src/health.ts | 1 + skills/atlassian/opencode/scripts/src/http.ts | 1 + skills/atlassian/opencode/scripts/src/jira.ts | 34 +- .../atlassian/opencode/scripts/src/output.ts | 1 + skills/atlassian/opencode/scripts/src/raw.ts | 10 +- .../atlassian/opencode/scripts/src/types.ts | 1 + skills/atlassian/pi/.generated-manifest.json | 103 + skills/atlassian/pi/SKILL.md | 2 + skills/atlassian/pi/scripts/package.json | 5 +- skills/atlassian/pi/scripts/src/adf.ts | 1 + skills/atlassian/pi/scripts/src/cli.ts | 8 +- .../pi/scripts/src/command-helpers.ts | 25 + skills/atlassian/pi/scripts/src/config.ts | 1 + skills/atlassian/pi/scripts/src/confluence.ts | 26 +- skills/atlassian/pi/scripts/src/files.ts | 1 + skills/atlassian/pi/scripts/src/health.ts | 1 + skills/atlassian/pi/scripts/src/http.ts | 1 + skills/atlassian/pi/scripts/src/jira.ts | 34 +- skills/atlassian/pi/scripts/src/output.ts | 1 + skills/atlassian/pi/scripts/src/raw.ts | 10 +- skills/atlassian/pi/scripts/src/types.ts | 1 + skills/atlassian/shared/scripts/src/cli.ts | 7 +- .../shared/scripts/src/command-helpers.ts | 24 + .../shared/scripts/src/confluence.ts | 25 +- skills/atlassian/shared/scripts/src/jira.ts | 33 +- skills/atlassian/shared/scripts/src/raw.ts | 9 +- .../scripts/tests/command-helpers.test.ts | 43 + .../create-plan/_source/claude-code/SKILL.md | 584 +++ .../templates/continuation-runbook.md | 138 + .../claude-code/templates/milestone-plan.md | 118 + .../claude-code/templates/story-tracker.md | 71 + skills/create-plan/_source/codex/SKILL.md | 624 +++ .../codex/templates/continuation-runbook.md | 145 + .../_source/codex/templates/milestone-plan.md | 125 + .../_source/codex/templates/story-tracker.md | 78 + skills/create-plan/_source/cursor/SKILL.md | 649 ++++ .../cursor/templates/continuation-runbook.md | 144 + .../cursor/templates/milestone-plan.md | 124 + .../_source/cursor/templates/story-tracker.md | 78 + skills/create-plan/_source/opencode/SKILL.md | 717 ++++ .../templates/continuation-runbook.md | 138 + .../opencode/templates/milestone-plan.md | 118 + .../opencode/templates/story-tracker.md | 71 + skills/create-plan/_source/pi/SKILL.md | 234 ++ .../pi/templates/continuation-runbook.md | 145 + .../_source/pi/templates/milestone-plan.md | 118 + .../_source/pi/templates/story-tracker.md | 71 + .../claude-code/.generated-manifest.json | 31 + skills/create-plan/claude-code/SKILL.md | 31 +- .../templates/continuation-runbook.md | 11 + .../claude-code/templates/milestone-plan.md | 18 + .../claude-code/templates/story-tracker.md | 6 + .../codex/.generated-manifest.json | 31 + skills/create-plan/codex/SKILL.md | 26 +- .../codex/templates/continuation-runbook.md | 11 + .../codex/templates/milestone-plan.md | 19 + .../codex/templates/story-tracker.md | 7 + .../cursor/.generated-manifest.json | 31 + skills/create-plan/cursor/SKILL.md | 30 +- .../cursor/templates/continuation-runbook.md | 11 + .../cursor/templates/milestone-plan.md | 19 + .../cursor/templates/story-tracker.md | 7 + .../opencode/.generated-manifest.json | 31 + skills/create-plan/opencode/SKILL.md | 157 +- .../templates/continuation-runbook.md | 11 + .../opencode/templates/milestone-plan.md | 18 + .../opencode/templates/story-tracker.md | 6 + .../create-plan/pi/.generated-manifest.json | 31 + skills/create-plan/pi/SKILL.md | 2 + .../pi/templates/continuation-runbook.md | 11 + .../pi/templates/milestone-plan.md | 18 + .../create-plan/pi/templates/story-tracker.md | 6 + skills/do-task/_source/claude-code/SKILL.md | 798 ++++ .../claude-code/templates/task-plan.md | 143 + skills/do-task/_source/codex/SKILL.md | 848 ++++ .../_source/codex/templates/task-plan.md | 143 + skills/do-task/_source/cursor/SKILL.md | 853 +++++ .../_source/cursor/templates/task-plan.md | 143 + skills/do-task/_source/opencode/SKILL.md | 848 ++++ .../_source/opencode/templates/task-plan.md | 143 + skills/do-task/_source/pi/SKILL.md | 210 + .../do-task/_source/pi/templates/task-plan.md | 128 + .../claude-code/.generated-manifest.json | 19 + skills/do-task/claude-code/SKILL.md | 44 +- .../claude-code/templates/task-plan.md | 2 +- skills/do-task/codex/.generated-manifest.json | 19 + skills/do-task/codex/SKILL.md | 43 +- skills/do-task/codex/templates/task-plan.md | 2 +- .../do-task/cursor/.generated-manifest.json | 19 + skills/do-task/cursor/SKILL.md | 43 +- skills/do-task/cursor/templates/task-plan.md | 2 +- .../do-task/opencode/.generated-manifest.json | 19 + skills/do-task/opencode/SKILL.md | 43 +- .../do-task/opencode/templates/task-plan.md | 2 +- skills/do-task/pi/.generated-manifest.json | 19 + skills/do-task/pi/SKILL.md | 2 + skills/do-task/pi/templates/task-plan.md | 1 + .../_source/claude-code/SKILL.md | 646 ++++ skills/implement-plan/_source/codex/SKILL.md | 723 ++++ skills/implement-plan/_source/cursor/SKILL.md | 727 ++++ .../implement-plan/_source/opencode/SKILL.md | 797 ++++ skills/implement-plan/_source/pi/SKILL.md | 241 ++ .../claude-code/.generated-manifest.json | 13 + skills/implement-plan/claude-code/SKILL.md | 28 +- .../codex/.generated-manifest.json | 13 + skills/implement-plan/codex/SKILL.md | 29 +- .../cursor/.generated-manifest.json | 13 + skills/implement-plan/cursor/SKILL.md | 30 +- .../opencode/.generated-manifest.json | 13 + skills/implement-plan/opencode/SKILL.md | 160 +- .../pi/.generated-manifest.json | 13 + skills/implement-plan/pi/SKILL.md | 2 + .../pi/.generated-manifest.json | 19 + skills/reviewer-runtime/pi/notify-telegram.sh | 3 +- skills/reviewer-runtime/pi/run-review.sh | 10 +- skills/reviewer-runtime/run-review.sh | 7 +- .../tests/claude-review-template-guard.sh | 1 + skills/reviewer-runtime/tests/smoke-test.sh | 4 +- .../tests/telegram-notify-test.sh | 4 +- .../_source/claude-code/SKILL.md | 99 + skills/web-automation/_source/codex/SKILL.md | 99 + skills/web-automation/_source/cursor/SKILL.md | 112 + .../web-automation/_source/opencode/SKILL.md | 99 + skills/web-automation/_source/pi/SKILL.md | 122 + .../claude-code/.generated-manifest.json | 103 + skills/web-automation/claude-code/SKILL.md | 2 + .../claude-code/scripts/auth.ts | 3 +- .../claude-code/scripts/browse.ts | 50 +- .../claude-code/scripts/check-install.js | 1 + .../claude-code/scripts/extract.js | 1 + .../claude-code/scripts/flow.ts | 3 +- .../claude-code/scripts/lib/browser.ts | 76 + .../claude-code/scripts/package.json | 5 +- .../claude-code/scripts/scan-local-app.ts | 24 +- .../claude-code/scripts/scrape.ts | 1 + .../claude-code/scripts/test-full.ts | 1 + .../claude-code/scripts/test-minimal.ts | 1 + .../claude-code/scripts/test-profile.ts | 1 + .../claude-code/scripts/tsconfig.json | 2 +- .../scripts/turndown-plugin-gfm.d.ts | 1 + .../codex/.generated-manifest.json | 103 + skills/web-automation/codex/SKILL.md | 2 + skills/web-automation/codex/scripts/auth.ts | 3 +- skills/web-automation/codex/scripts/browse.ts | 50 +- .../codex/scripts/check-install.js | 1 + .../web-automation/codex/scripts/extract.js | 1 + skills/web-automation/codex/scripts/flow.ts | 3 +- .../codex/scripts/lib/browser.ts | 76 + .../web-automation/codex/scripts/package.json | 5 +- .../codex/scripts/scan-local-app.ts | 24 +- skills/web-automation/codex/scripts/scrape.ts | 1 + .../web-automation/codex/scripts/test-full.ts | 1 + .../codex/scripts/test-minimal.ts | 1 + .../codex/scripts/test-profile.ts | 1 + .../codex/scripts/tsconfig.json | 2 +- .../codex/scripts/turndown-plugin-gfm.d.ts | 1 + .../cursor/.generated-manifest.json | 103 + skills/web-automation/cursor/SKILL.md | 2 + skills/web-automation/cursor/scripts/auth.ts | 3 +- .../web-automation/cursor/scripts/browse.ts | 50 +- .../cursor/scripts/check-install.js | 1 + .../web-automation/cursor/scripts/extract.js | 1 + skills/web-automation/cursor/scripts/flow.ts | 3 +- .../cursor/scripts/lib/browser.ts | 76 + .../cursor/scripts/package.json | 5 +- .../cursor/scripts/scan-local-app.ts | 24 +- .../web-automation/cursor/scripts/scrape.ts | 1 + .../cursor/scripts/test-full.ts | 1 + .../cursor/scripts/test-minimal.ts | 1 + .../cursor/scripts/test-profile.ts | 1 + .../cursor/scripts/tsconfig.json | 2 +- .../cursor/scripts/turndown-plugin-gfm.d.ts | 1 + .../opencode/.generated-manifest.json | 103 + skills/web-automation/opencode/SKILL.md | 2 + .../web-automation/opencode/scripts/auth.ts | 3 +- .../web-automation/opencode/scripts/browse.ts | 50 +- .../opencode/scripts/check-install.js | 1 + .../opencode/scripts/extract.js | 1 + .../web-automation/opencode/scripts/flow.ts | 3 +- .../opencode/scripts/lib/browser.ts | 76 + .../opencode/scripts/package.json | 5 +- .../opencode/scripts/scan-local-app.ts | 24 +- .../web-automation/opencode/scripts/scrape.ts | 1 + .../opencode/scripts/test-full.ts | 1 + .../opencode/scripts/test-minimal.ts | 1 + .../opencode/scripts/test-profile.ts | 1 + .../opencode/scripts/tsconfig.json | 2 +- .../opencode/scripts/turndown-plugin-gfm.d.ts | 1 + .../pi/.generated-manifest.json | 103 + skills/web-automation/pi/SKILL.md | 2 + skills/web-automation/pi/scripts/auth.ts | 3 +- skills/web-automation/pi/scripts/browse.ts | 50 +- .../pi/scripts/check-install.js | 6 +- skills/web-automation/pi/scripts/extract.js | 1 + skills/web-automation/pi/scripts/flow.ts | 3 +- .../web-automation/pi/scripts/lib/browser.ts | 76 + skills/web-automation/pi/scripts/package.json | 5 +- .../pi/scripts/scan-local-app.ts | 24 +- skills/web-automation/pi/scripts/scrape.ts | 1 + skills/web-automation/pi/scripts/test-full.ts | 1 + .../web-automation/pi/scripts/test-minimal.ts | 1 + .../web-automation/pi/scripts/test-profile.ts | 1 + .../web-automation/pi/scripts/tsconfig.json | 2 +- .../pi/scripts/turndown-plugin-gfm.d.ts | 1 + skills/web-automation/shared/auth.ts | 575 +++ skills/web-automation/shared/browse.ts | 151 + skills/web-automation/shared/check-install.js | 40 + skills/web-automation/shared/extract.js | 188 + skills/web-automation/shared/flow.ts | 329 ++ skills/web-automation/shared/lib/browser.ts | 75 + skills/web-automation/shared/package.json | 36 + skills/web-automation/shared/pnpm-lock.yaml | 1292 +++++++ .../web-automation/shared/scan-local-app.ts | 179 + skills/web-automation/shared/scrape.ts | 351 ++ skills/web-automation/shared/test-full.ts | 36 + skills/web-automation/shared/test-minimal.ts | 23 + skills/web-automation/shared/test-profile.ts | 33 + skills/web-automation/shared/tsconfig.json | 16 + .../shared/turndown-plugin-gfm.d.ts | 8 + 373 files changed, 28504 insertions(+), 1281 deletions(-) create mode 100644 .github/workflows/check-online.yml create mode 100644 .github/workflows/check.yml create mode 100644 .markdownlint-cli2.jsonc create mode 100644 .markdownlint.jsonc create mode 100644 .markdownlintignore create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 CHANGELOG.md create mode 100644 docs/CLEANUP-BASELINE.md create mode 100644 docs/DEVELOPMENT.md create mode 100644 docs/REVIEWERS.md create mode 100644 eslint.config.mjs create mode 100644 markdown-link-check.json create mode 100644 markdown-link-check.online.json create mode 100644 pi-package/skills/atlassian/.generated-manifest.json create mode 100644 pi-package/skills/atlassian/scripts/src/command-helpers.ts create mode 100644 pi-package/skills/create-plan/.generated-manifest.json create mode 100644 pi-package/skills/do-task/.generated-manifest.json create mode 100644 pi-package/skills/implement-plan/.generated-manifest.json create mode 100644 pi-package/skills/web-automation/.generated-manifest.json mode change 100755 => 100644 pi-package/skills/web-automation/scripts/extract.js create mode 100644 pi-package/skills/web-automation/scripts/lib/browser.ts create mode 100644 pnpm-lock.yaml create mode 100644 pnpm-workspace.yaml create mode 100644 scripts/generate-skills.mjs create mode 100644 scripts/lib/assert-no-pnpm-version-pin.mjs create mode 100644 scripts/lib/portable.sh create mode 100644 scripts/lib/run-check.mjs create mode 100644 scripts/lib/run-link-check.mjs create mode 100644 scripts/lib/run-shellcheck.mjs create mode 100644 scripts/lib/safe-replace-dir.mjs create mode 100755 scripts/lib/safe-replace-dir.sh delete mode 100755 scripts/sync-pi-package-skills.sh create mode 100644 scripts/tests/generate-skills.test.mjs create mode 100644 scripts/tests/safe-replace-dir.test.mjs create mode 100644 scripts/tests/skill-manager-core-remove.test.mjs create mode 100644 scripts/tests/verify-docs-flow.test.mjs create mode 100644 scripts/tests/verify-generated.test.mjs create mode 100644 scripts/verify-docs-flow.mjs create mode 100644 scripts/verify-generated.mjs create mode 100644 skills/.markdownlint.jsonc create mode 100644 skills/atlassian/_source/claude-code/SKILL.md create mode 100644 skills/atlassian/_source/codex/SKILL.md create mode 100644 skills/atlassian/_source/cursor/SKILL.md create mode 100644 skills/atlassian/_source/opencode/SKILL.md create mode 100644 skills/atlassian/_source/pi/SKILL.md create mode 100644 skills/atlassian/claude-code/.generated-manifest.json create mode 100644 skills/atlassian/claude-code/scripts/src/command-helpers.ts create mode 100644 skills/atlassian/codex/.generated-manifest.json create mode 100644 skills/atlassian/codex/scripts/src/command-helpers.ts create mode 100644 skills/atlassian/cursor/.generated-manifest.json create mode 100644 skills/atlassian/cursor/scripts/src/command-helpers.ts create mode 100644 skills/atlassian/opencode/.generated-manifest.json create mode 100644 skills/atlassian/opencode/scripts/src/command-helpers.ts create mode 100644 skills/atlassian/pi/.generated-manifest.json create mode 100644 skills/atlassian/pi/scripts/src/command-helpers.ts create mode 100644 skills/atlassian/shared/scripts/src/command-helpers.ts create mode 100644 skills/atlassian/shared/scripts/tests/command-helpers.test.ts create mode 100644 skills/create-plan/_source/claude-code/SKILL.md create mode 100644 skills/create-plan/_source/claude-code/templates/continuation-runbook.md create mode 100644 skills/create-plan/_source/claude-code/templates/milestone-plan.md create mode 100644 skills/create-plan/_source/claude-code/templates/story-tracker.md create mode 100644 skills/create-plan/_source/codex/SKILL.md create mode 100644 skills/create-plan/_source/codex/templates/continuation-runbook.md create mode 100644 skills/create-plan/_source/codex/templates/milestone-plan.md create mode 100644 skills/create-plan/_source/codex/templates/story-tracker.md create mode 100644 skills/create-plan/_source/cursor/SKILL.md create mode 100644 skills/create-plan/_source/cursor/templates/continuation-runbook.md create mode 100644 skills/create-plan/_source/cursor/templates/milestone-plan.md create mode 100644 skills/create-plan/_source/cursor/templates/story-tracker.md create mode 100644 skills/create-plan/_source/opencode/SKILL.md create mode 100644 skills/create-plan/_source/opencode/templates/continuation-runbook.md create mode 100644 skills/create-plan/_source/opencode/templates/milestone-plan.md create mode 100644 skills/create-plan/_source/opencode/templates/story-tracker.md create mode 100644 skills/create-plan/_source/pi/SKILL.md create mode 100644 skills/create-plan/_source/pi/templates/continuation-runbook.md create mode 100644 skills/create-plan/_source/pi/templates/milestone-plan.md create mode 100644 skills/create-plan/_source/pi/templates/story-tracker.md create mode 100644 skills/create-plan/claude-code/.generated-manifest.json create mode 100644 skills/create-plan/codex/.generated-manifest.json create mode 100644 skills/create-plan/cursor/.generated-manifest.json create mode 100644 skills/create-plan/opencode/.generated-manifest.json create mode 100644 skills/create-plan/pi/.generated-manifest.json create mode 100644 skills/do-task/_source/claude-code/SKILL.md create mode 100644 skills/do-task/_source/claude-code/templates/task-plan.md create mode 100644 skills/do-task/_source/codex/SKILL.md create mode 100644 skills/do-task/_source/codex/templates/task-plan.md create mode 100644 skills/do-task/_source/cursor/SKILL.md create mode 100644 skills/do-task/_source/cursor/templates/task-plan.md create mode 100644 skills/do-task/_source/opencode/SKILL.md create mode 100644 skills/do-task/_source/opencode/templates/task-plan.md create mode 100644 skills/do-task/_source/pi/SKILL.md create mode 100644 skills/do-task/_source/pi/templates/task-plan.md create mode 100644 skills/do-task/claude-code/.generated-manifest.json create mode 100644 skills/do-task/codex/.generated-manifest.json create mode 100644 skills/do-task/cursor/.generated-manifest.json create mode 100644 skills/do-task/opencode/.generated-manifest.json create mode 100644 skills/do-task/pi/.generated-manifest.json create mode 100644 skills/implement-plan/_source/claude-code/SKILL.md create mode 100644 skills/implement-plan/_source/codex/SKILL.md create mode 100644 skills/implement-plan/_source/cursor/SKILL.md create mode 100644 skills/implement-plan/_source/opencode/SKILL.md create mode 100644 skills/implement-plan/_source/pi/SKILL.md create mode 100644 skills/implement-plan/claude-code/.generated-manifest.json create mode 100644 skills/implement-plan/codex/.generated-manifest.json create mode 100644 skills/implement-plan/cursor/.generated-manifest.json create mode 100644 skills/implement-plan/opencode/.generated-manifest.json create mode 100644 skills/implement-plan/pi/.generated-manifest.json create mode 100644 skills/reviewer-runtime/pi/.generated-manifest.json create mode 100644 skills/web-automation/_source/claude-code/SKILL.md create mode 100644 skills/web-automation/_source/codex/SKILL.md create mode 100644 skills/web-automation/_source/cursor/SKILL.md create mode 100644 skills/web-automation/_source/opencode/SKILL.md create mode 100644 skills/web-automation/_source/pi/SKILL.md create mode 100644 skills/web-automation/claude-code/.generated-manifest.json mode change 100755 => 100644 skills/web-automation/claude-code/scripts/extract.js create mode 100644 skills/web-automation/claude-code/scripts/lib/browser.ts create mode 100644 skills/web-automation/codex/.generated-manifest.json mode change 100755 => 100644 skills/web-automation/codex/scripts/extract.js create mode 100644 skills/web-automation/codex/scripts/lib/browser.ts create mode 100644 skills/web-automation/cursor/.generated-manifest.json mode change 100755 => 100644 skills/web-automation/cursor/scripts/extract.js create mode 100644 skills/web-automation/cursor/scripts/lib/browser.ts create mode 100644 skills/web-automation/opencode/.generated-manifest.json mode change 100755 => 100644 skills/web-automation/opencode/scripts/extract.js create mode 100644 skills/web-automation/opencode/scripts/lib/browser.ts create mode 100644 skills/web-automation/pi/.generated-manifest.json mode change 100755 => 100644 skills/web-automation/pi/scripts/extract.js create mode 100644 skills/web-automation/pi/scripts/lib/browser.ts create mode 100644 skills/web-automation/shared/auth.ts create mode 100644 skills/web-automation/shared/browse.ts create mode 100644 skills/web-automation/shared/check-install.js create mode 100755 skills/web-automation/shared/extract.js create mode 100644 skills/web-automation/shared/flow.ts create mode 100644 skills/web-automation/shared/lib/browser.ts create mode 100644 skills/web-automation/shared/package.json create mode 100644 skills/web-automation/shared/pnpm-lock.yaml create mode 100644 skills/web-automation/shared/scan-local-app.ts create mode 100644 skills/web-automation/shared/scrape.ts create mode 100644 skills/web-automation/shared/test-full.ts create mode 100644 skills/web-automation/shared/test-minimal.ts create mode 100644 skills/web-automation/shared/test-profile.ts create mode 100644 skills/web-automation/shared/tsconfig.json create mode 100644 skills/web-automation/shared/turndown-plugin-gfm.d.ts diff --git a/.github/workflows/check-online.yml b/.github/workflows/check-online.yml new file mode 100644 index 0000000..9a6f824 --- /dev/null +++ b/.github/workflows/check-online.yml @@ -0,0 +1,40 @@ +name: check-online + +# Runs full external link checking on a schedule and on manual trigger. +# Kept separate from the main `check` workflow so everyday push/PR CI +# is not slowed down or broken by transient network issues. + +on: + schedule: + # Every Monday at 09:00 UTC + - cron: "0 9 * * 1" + workflow_dispatch: + +jobs: + check-online: + name: check-online (ubuntu-latest) + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install shellcheck + run: sudo apt-get update -q && sudo apt-get install -y -q shellcheck + + - name: Install ripgrep + run: sudo apt-get install -y -q ripgrep + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run full quality suite with external link checking + run: pnpm run verify:docs:online diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..55d45f3 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,46 @@ +name: check + +on: + push: + branches: ["**"] + pull_request: + branches: ["**"] + +jobs: + check: + name: check (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install shellcheck (Ubuntu) + if: runner.os == 'Linux' + run: sudo apt-get update -q && sudo apt-get install -y -q shellcheck + + - name: Install shellcheck (macOS) + if: runner.os == 'macOS' + run: brew install shellcheck + + - name: Install ripgrep (Ubuntu) + if: runner.os == 'Linux' + run: sudo apt-get install -y -q ripgrep + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run full quality suite (offline link-checking) + run: pnpm run check diff --git a/.gitignore b/.gitignore index afc45ba..302fb9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ /ai_plan/ /.pi/ /.worktrees/ +/node_modules/ /skills/atlassian/shared/scripts/.env /skills/atlassian/shared/scripts/node_modules/ /skills/atlassian/*/scripts/.env /skills/atlassian/*/scripts/node_modules/ /skills/web-automation/*/scripts/node_modules/ +/skills/web-automation/shared/node_modules/ /pi-package/skills/*/scripts/node_modules/ diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc new file mode 100644 index 0000000..1240b71 --- /dev/null +++ b/.markdownlint-cli2.jsonc @@ -0,0 +1,40 @@ +// markdownlint-cli2 configuration — ai-coding-skills (M2) +// +// This file controls which files are linted and which are ignored. +// The markdownlint *rules* are configured in .markdownlint.jsonc (root) and +// skills/.markdownlint.jsonc (agent-facing skill files). +// +// Scope: README.md, docs/, and canonical SKILL.md files. +// Excluded: all node_modules, generated agent-variant directories, pi-package. +{ + // Glob patterns for which files to lint + "globs": [ + "README.md", + "docs/**/*.md", + // Canonical skill files only — agent variants are excluded below + "skills/atlassian/shared/**/*.md", + "skills/create-plan/**/*.md", + "skills/do-task/**/*.md", + "skills/implement-plan/**/*.md", + "skills/reviewer-runtime/**/*.md", + "skills/web-automation/codex/**/*.md", + "skills/web-automation/pi/**/*.md", + "skills/web-automation/claude-code/SKILL.md", + "skills/web-automation/cursor/SKILL.md", + "skills/web-automation/opencode/SKILL.md", + "skills/atlassian/codex/SKILL.md", + "skills/atlassian/claude-code/SKILL.md", + "skills/atlassian/cursor/SKILL.md", + "skills/atlassian/opencode/SKILL.md", + "skills/atlassian/pi/SKILL.md" + ], + + // Ignore patterns — always exclude node_modules, generated artefacts, and canonical _source dirs + "ignores": [ + "**/node_modules/**", + "pi-package/**", + // Canonical source directories — contain per-agent source with relative links + // calibrated to their generated location (one level up); exclude from linting. + "skills/**/_source/**" + ] +} diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc new file mode 100644 index 0000000..58744ee --- /dev/null +++ b/.markdownlint.jsonc @@ -0,0 +1,37 @@ +// markdownlint configuration — ai-coding-skills (M1) +// +// Pre-existing violations in docs/ and skills/ SKILL.md files are recorded +// in docs/CLEANUP-BASELINE.md and deferred to a later milestone for fixing. +// New markdown files added from M1 onward must satisfy all enabled rules. +{ + // Inherit all default rules, then override below + "default": true, + + // MD013 — line length + // This project contains long technical strings, code snippets, and URLs + // in markdown prose. Enforce a generous limit rather than the strict 80-char + // default to avoid noise on otherwise-clean documents. + "MD013": { + "line_length": 120, + "heading_line_length": 120, + "code_block_line_length": 160, + "code_blocks": false, + "tables": false + }, + + // MD033 — inline HTML + // Allow HTML in markdown (used in some SKILL.md files for tables/details). + "MD033": false, + + // MD034 — bare URLs + // Disabled: existing docs include many plain URLs intentionally. + "MD034": false, + + // MD041 — first line should be top-level heading + // Disabled: some files intentionally start with front-matter or a preamble. + "MD041": false, + + // MD060 — table column style + // Disabled: existing tables use compact pipe style throughout. + "MD060": false +} diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 0000000..73df57e --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1,14 @@ +node_modules/ +**/node_modules/** +pnpm-lock.yaml +# Generated agent-variant directories (non-mutating M1 policy) +skills/atlassian/codex/ +skills/atlassian/claude-code/ +skills/atlassian/cursor/ +skills/atlassian/opencode/ +skills/atlassian/pi/ +skills/web-automation/claude-code/ +skills/web-automation/cursor/ +skills/web-automation/opencode/ +skills/web-automation/pi/ +pi-package/ diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ace8cfc --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +node_modules/ +pnpm-lock.yaml +# Generated agent-variant directories (non-mutating M1 policy) +skills/atlassian/codex/ +skills/atlassian/claude-code/ +skills/atlassian/cursor/ +skills/atlassian/opencode/ +skills/atlassian/pi/ +skills/web-automation/claude-code/ +skills/web-automation/cursor/ +skills/web-automation/opencode/ +skills/web-automation/pi/ +pi-package/ diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..09fce03 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "semi": true, + "singleQuote": false, + "trailingComma": "es5", + "printWidth": 100, + "tabWidth": 2, + "endOfLine": "lf" +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..bafe987 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,204 @@ +# Changelog — ai-coding-skills + +All notable changes to the ai-coding-skills repository are recorded here. +Entries are milestone-scoped; stories within each milestone are listed for traceability. + +--- + +## M5 — Final hardening, CI surface, and documentation closeout + +### What changed in M5 + +**S-501 — CI workflow added** + +`.github/workflows/check.yml` runs on every push and pull request against a +matrix of `ubuntu-latest` and `macos-latest`. Each job: + +1. Installs `shellcheck` (apt on Ubuntu, brew on macOS). +2. Installs `ripgrep` (apt on Ubuntu; pre-installed on macOS runners). +3. Installs Node.js 22 and pnpm 10. +4. Runs `pnpm install --frozen-lockfile`. +5. Runs `pnpm run check` (full quality suite, offline link-checking). + +`.github/workflows/check-online.yml` runs `verify:docs:online` on a weekly +schedule (Monday 09:00 UTC) and on manual `workflow_dispatch`. This keeps +external link checking out of the push/PR critical path. + +**S-502 — Root README contributing section** + +`README.md` now includes a "Contributing / Development" section that names +`pnpm run check` as the single quality gate, lists prerequisites, and links +to `docs/DEVELOPMENT.md`. + +**S-503 — `docs/DEVELOPMENT.md` finalised** + +Added: + +- **"Adding a new agent variant"** recipe (6 steps from canonical source to CI). +- **"Adding a new skill"** recipe (6 steps). +- **"CI"** section describing both workflows and how to add new prerequisites. +- **Permanent `check` contract** replacing the transitional M1 wording. +- Cross-reference links to `.github/workflows/check.yml` and + `.github/workflows/check-online.yml`. + +**S-504 — Baseline report closed** + +`docs/CLEANUP-BASELINE.md` updated with a "Final state" section showing every +baseline failure resolved, a baseline status summary table, and the +post-M5 `pnpm run check` output. The document is now closed. + +**S-505 — `package.json` file list synced** + +`docs/DEVELOPMENT.md` and `docs/REVIEWERS.md` added to the `files` array. +All listed entries verified to exist in the post-M5 tree. + +**S-506 — Changelog extended (this entry)** + +**S-507 — Final green run confirmed** + +`pnpm run check` exits 0 on macOS 15 (arm64) with Node 22.14.0 and +pnpm 10.18.1. CI workflow exercises the same gate on both `ubuntu-latest` +and `macos-latest`. + +### `pnpm run check` status after M5 + +```text +PASS lint +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +PASS verify:docs +PASS verify:generated +``` + +All checks green. CI enforces this on every push and PR. + +--- + +## M4 — Shared-abstraction extraction and dead-code removal + +*See `docs/CLEANUP-BASELINE.md` § "Post-M4 state" for the full M4 delta.* + +--- + +## M3 — Shared-source generator for agent variants + +### Package metadata change ⚠️ + +**All generated agent-variant `package.json` files have been renamed to unique +private scoped names.** This is an intentional breaking rename in the artifact +structure, but all packages carry `"private": true` and are **never published** +to any registry. End-user manual-install workflows are unaffected: copying a +`skills///` directory continues to work unchanged. + +| Old `name` | New `name` | Path | +|-----------|-----------|------| +| `atlassian-skill-scripts` | `@ai-coding-skills/atlassian-claude-code` | `skills/atlassian/claude-code/scripts/package.json` | +| `atlassian-skill-scripts` | `@ai-coding-skills/atlassian-codex` | `skills/atlassian/codex/scripts/package.json` | +| `atlassian-skill-scripts` | `@ai-coding-skills/atlassian-cursor` | `skills/atlassian/cursor/scripts/package.json` | +| `atlassian-skill-scripts` | `@ai-coding-skills/atlassian-opencode` | `skills/atlassian/opencode/scripts/package.json` | +| `atlassian-skill-scripts` | `@ai-coding-skills/atlassian-pi` | `skills/atlassian/pi/scripts/package.json` | +| `atlassian-skill-scripts` | `@ai-coding-skills/atlassian-pi-mirror` | `pi-package/skills/atlassian/scripts/package.json` | +| `web-automation-scripts` | `@ai-coding-skills/web-automation-claude-code` | `skills/web-automation/claude-code/scripts/package.json` | +| `web-automation-scripts` | `@ai-coding-skills/web-automation-codex` | `skills/web-automation/codex/scripts/package.json` | +| `web-automation-scripts` | `@ai-coding-skills/web-automation-cursor` | `skills/web-automation/cursor/scripts/package.json` | +| `web-automation-scripts` | `@ai-coding-skills/web-automation-opencode` | `skills/web-automation/opencode/scripts/package.json` | +| `web-automation-scripts` | `@ai-coding-skills/web-automation-pi` | `skills/web-automation/pi/scripts/package.json` | +| `web-automation-scripts` | `@ai-coding-skills/web-automation-pi-mirror` | `pi-package/skills/web-automation/scripts/package.json` | + +All renamed packages also gained `"private": true`. + +### What else changed in M3 + +**S-301 — Canonical sources documented** + +Canonical source directories introduced (all outside every generated root): + +- `skills/atlassian/_source//SKILL.md` — per-agent Atlassian skill descriptions +- `skills/web-automation/_source//SKILL.md` — per-agent Web Automation skill descriptions +- `skills/web-automation/shared/` — shared web-automation TypeScript runtime scripts +- `skills/create-plan/_source//` — per-agent create-plan SKILL.md + templates +- `skills/do-task/_source//` — per-agent do-task SKILL.md + templates +- `skills/implement-plan/_source//` — per-agent implement-plan SKILL.md +- `skills/reviewer-runtime/` (base) — canonical `run-review.sh` and `notify-telegram.sh` + +**S-302 — Generator built** + +`scripts/generate-skills.mjs` regenerates all 31 generated roots from canonical +sources in one pass. Exports `detectFileType`, `applyHeader`, +`makePackageJsonContent`, `getGeneratedRoots`, `buildManifest`, and +`generateSkills`. 35 unit tests. + +**S-303 — Manual-workflow skills migrated** + +`create-plan`, `do-task`, `implement-plan` agent variants now generated from +`_source/` canonical sources. Only diffs vs pre-migration: file-type-aware +headers and new `.generated-manifest.json` files. + +**S-304 — Web-automation runtime scripts migrated** + +`skills/web-automation/shared/` created from the former codex canonical source. +All five web-automation agent variants and the pi-package mirror now generated +from this shared location. + +**S-305 — Reviewer-runtime Pi variants migrated** + +`skills/reviewer-runtime/pi/run-review.sh` and `notify-telegram.sh` are now +generated from the canonical base scripts. The "keep this file in sync" +comments are replaced by generated-file headers. + +**S-306 — `sync:pi` and `verify:generated` implemented** + +- `pnpm run sync:pi` now calls `node scripts/generate-skills.mjs`. +- `scripts/verify-generated.mjs` implements the full comparison contract: + walks declared roots only, uses `.generated-manifest.json` as oracle, reports + structured diffs, exits non-zero on any mismatch. 5 unit tests including the + required `_source/` stray-file boundary test. +- `pnpm run verify:generated` wired to the real implementation. + +**S-307 — Workspace updated** + +`pnpm-workspace.yaml` updated to **include** all generated agent-variant +packages (now uniquely named) alongside the canonical sources. The M1 +negative-glob exclusions are replaced by positive includes. + +**S-308 — Documentation updated** + +- `docs/DEVELOPMENT.md`: new "How variants are generated" section with + canonical source table, generated-root list, contributor workflow, header + policy table, and manifest contract. +- `CHANGELOG.md` (this file): full rename table and story summaries. + +### Byte-equivalence diff allow-list (M3 vs pre-M3 generated roots) + +The only permitted diffs between the M3-generated output and the pre-M3 +manually-maintained variants are: + +1. **File-type-aware generated-file headers** — added per the policy table in + `docs/DEVELOPMENT.md`. +2. **New `.generated-manifest.json` files** — one per generated root. +3. **`package.json` `name` field** — renamed to `@ai-coding-skills/-`. +4. **`"private": true` added** — to each generated `package.json`. + +No other content diffs are permitted; `verify:generated` and the generator +itself reject any other change. + +### `pnpm run check` status after M3 + +```text +PASS lint (was FAIL; all pre-existing violations fixed) +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +PASS verify:docs +PASS verify:generated (was stub; now real implementation) +``` + +All checks green for the first time. + +--- + +*Previous milestones (M1, M2) did not have a CHANGELOG.md entry. See +`docs/CLEANUP-BASELINE.md` for the M1 baseline and M2 delta.* diff --git a/README.md b/README.md index 5ebea96..dfe2ac2 100644 --- a/README.md +++ b/README.md @@ -16,69 +16,36 @@ This repo is organized similarly to `obra/superpowers` and is designed to scale ```text ai-coding-skills/ ├── README.md -├── docs/ -│ ├── README.md -│ ├── INSTALLER.md -│ ├── CODEX.md -│ ├── CLAUDE-CODE.md -│ ├── CURSOR.md -│ ├── OPENCODE.md -│ ├── ATLASSIAN.md -│ ├── CREATE-PLAN.md -│ ├── DO-TASK.md -│ ├── IMPLEMENT-PLAN.md -│ ├── PI.md -│ ├── PI-COMMON-REVIEWER.md -│ ├── PI-RESEARCH.md -│ ├── PI-SUPERPOWERS.md -│ ├── TELEGRAM-NOTIFICATIONS.md -│ └── WEB-AUTOMATION.md +├── docs/ — user-facing docs (see docs/README.md) ├── skills/ -│ ├── _template/ -│ │ └── SKILL.md │ ├── atlassian/ -│ │ ├── codex/ -│ │ ├── claude-code/ -│ │ ├── cursor/ -│ │ ├── opencode/ -│ │ ├── pi/ -│ │ └── shared/ +│ │ ├── codex/ claude-code/ cursor/ opencode/ pi/ shared/ │ ├── create-plan/ -│ │ ├── codex/ -│ │ ├── claude-code/ -│ │ ├── opencode/ -│ │ ├── cursor/ -│ │ └── pi/ +│ │ ├── codex/ claude-code/ cursor/ opencode/ pi/ │ ├── do-task/ -│ │ ├── codex/ -│ │ ├── claude-code/ -│ │ ├── opencode/ -│ │ ├── cursor/ -│ │ └── pi/ +│ │ ├── codex/ claude-code/ cursor/ opencode/ pi/ │ ├── implement-plan/ -│ │ ├── codex/ -│ │ ├── claude-code/ -│ │ ├── opencode/ -│ │ ├── cursor/ -│ │ └── pi/ +│ │ ├── codex/ claude-code/ cursor/ opencode/ pi/ │ ├── reviewer-runtime/ -│ │ ├── pi/ -│ │ └── tests/ +│ │ ├── pi/ — Pi-specific run-review.sh + notify-telegram.sh +│ │ └── tests/ — reviewer-runtime smoke tests │ └── web-automation/ -│ ├── codex/ -│ ├── claude-code/ -│ ├── cursor/ -│ ├── opencode/ -│ └── pi/ -├── .codex/ -├── .claude-plugin/ -├── .opencode/ -│ └── plugins/ -├── commands/ -├── hooks/ -└── tests/ +│ ├── codex/ claude-code/ cursor/ opencode/ pi/ +├── pi-package/ +│ └── skills/ — Pi-facing mirror synced by sync:pi +├── scripts/ +│ ├── lib/ — shared Node helpers + portable.sh +│ └── tests/ — Node.js unit tests +├── package.json +└── pnpm-workspace.yaml ``` +## Where to Read Next + +See **[docs/README.md](docs/README.md)** for the full documentation index with +ordered reading flow, one-line summaries for every doc, and links to per-agent +install guides, skill docs, Pi docs, Telegram setup, and development notes. + ## Skills | Skill | Agent Variant | Purpose | Status | Docs | @@ -150,9 +117,11 @@ node scripts/manage-skills.mjs --client pi --scope packageGlobal --pi-package -- node scripts/manage-skills.mjs --client pi --scope packageLocal --pi-package --action install --yes ``` -The wizard detects Codex, Claude Code, Cursor, OpenCode, and Pi, previews operations, checks Superpowers dependencies for workflow skills, and prints a final operation report. +The wizard detects Codex, Claude Code, Cursor, OpenCode, and Pi, previews operations, checks +Superpowers dependencies for workflow skills, and prints a final operation report. -`ai_plan/` is gitignored local planning state used by `create-plan` and `do-task`. The skill manager does not install, sync, or publish `ai_plan/` contents. +`ai_plan/` is gitignored local planning state used by `create-plan` and `do-task`. The skill +manager does not install, sync, or publish `ai_plan/` contents. ## Pi Package @@ -162,7 +131,7 @@ The repo root now includes a pi package manifest that ships only the pi-specific - `skills/reviewer-runtime/pi/` - `docs/PI*.md` - `scripts/manage-skills.mjs` and `scripts/manage-skills.sh` -- `scripts/sync-pi-package-skills.sh` +- `scripts/generate-skills.mjs` - `scripts/verify-pi-resources.sh` - `scripts/verify-pi-workflows.sh` - `scripts/verify-reviewer-support.sh` @@ -190,10 +159,30 @@ The repo pins its pnpm version in `package.json` so Corepack-backed installs res Before publishing or sharing a tarball, run: ```bash -./scripts/sync-pi-package-skills.sh +pnpm run sync:pi npm run verify:pi npm run verify:reviewers npm pack --dry-run --json ``` Additional pi-specific guidance lives in [docs/PI.md](docs/PI.md). + +For development prerequisites, quality tooling, and the `pnpm run check` +contract, see [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md). + +## Contributing / Development + +See **[docs/DEVELOPMENT.md](docs/DEVELOPMENT.md)** for the full development guide. + +Quick reference — the single quality gate every contributor must pass: + +```bash +pnpm install +pnpm run check # lint · typecheck · test · verify:pi · verify:reviewers · verify:docs · verify:generated +``` + +Prerequisites: Node.js 20+, pnpm 10+, `shellcheck` (brew / apt), `ripgrep` (brew / apt). + +CI runs the same `pnpm run check` command on both `ubuntu-latest` and `macos-latest` +(see `.github/workflows/check.yml`). External link checking runs separately on a +weekly schedule (`.github/workflows/check-online.yml`). diff --git a/docs/ATLASSIAN.md b/docs/ATLASSIAN.md index 13a7cbe..29a1161 100644 --- a/docs/ATLASSIAN.md +++ b/docs/ATLASSIAN.md @@ -2,13 +2,17 @@ ## Purpose -Provide a portable Atlassian Cloud skill for Codex, Claude Code, Cursor Agent, OpenCode, and Pi using one shared CLI surface for common Jira and Confluence workflows. +Provide a portable Atlassian Cloud skill for Codex, Claude Code, Cursor Agent, OpenCode, and Pi +using one shared CLI surface for common Jira and Confluence workflows. ## Why This Skill Exists -The repo targets multiple agent environments with uneven MCP availability. This skill packages a consistent CLI contract so the same task-oriented workflows can be used across all supported agents without depending on MCP-specific integrations. +The repo targets multiple agent environments with uneven MCP availability. This skill packages a +consistent CLI contract so the same task-oriented workflows can be used across all supported agents +without depending on MCP-specific integrations. -The canonical runtime lives in `skills/atlassian/shared/scripts/`. Installable per-agent `scripts/` bundles are generated from that source with: +The canonical runtime lives in `skills/atlassian/shared/scripts/`. Installable per-agent +`scripts/` bundles are generated from that source with: ```bash pnpm --dir skills/atlassian/shared/scripts sync:agents @@ -23,7 +27,8 @@ pnpm --dir skills/atlassian/shared/scripts sync:agents - `ATLASSIAN_EMAIL` - `ATLASSIAN_API_TOKEN` -The `ATLASSIAN_*` values may come from the shell environment or a `.env` file in the installed agent-specific `scripts/` folder. +The `ATLASSIAN_*` values may come from the shell environment or a `.env` file in the installed +agent-specific `scripts/` folder. Optional: @@ -52,12 +57,15 @@ Optional: ## Command Notes -- `health` validates local configuration, probes Jira and Confluence separately, and reports one product as unavailable without masking the other. +- `health` validates local configuration, probes Jira and Confluence separately, and reports one + product as unavailable without masking the other. - `jira-create` requires `--type`, `--summary`, and either `--project` or `ATLASSIAN_DEFAULT_PROJECT`. - `jira-update` requires `--issue` and at least one of `--summary` or `--description-file`. - `conf-create` requires `--title`, `--body-file`, and either `--space` or `ATLASSIAN_DEFAULT_SPACE`. -- `conf-update` requires `--page`, `--title`, and `--body-file`; it fetches the current page version before building the update payload. -- `raw --body-file` expects a workspace-scoped JSON file and is limited to validated Atlassian API prefixes. +- `conf-update` requires `--page`, `--title`, and `--body-file`; it fetches the current page + version before building the update payload. +- `raw --body-file` expects a workspace-scoped JSON file and is limited to validated Atlassian + API prefixes. ## Safety Model @@ -130,7 +138,7 @@ Recommended full Pi package install: Manual single-skill Pi install from the package mirror: ```bash -./scripts/sync-pi-package-skills.sh +pnpm run sync:pi mkdir -p .pi/skills/atlassian cp -R pi-package/skills/atlassian/* .pi/skills/atlassian/ cd .pi/skills/atlassian/scripts diff --git a/docs/CLEANUP-BASELINE.md b/docs/CLEANUP-BASELINE.md new file mode 100644 index 0000000..22dac99 --- /dev/null +++ b/docs/CLEANUP-BASELINE.md @@ -0,0 +1,558 @@ +# Cleanup Baseline — ai-coding-skills (M1) + +Captured: 2026-05-03 · Platform: macOS (arm64, Apple Silicon) · Node 22.14.0 · pnpm 10.18.1 + +This document records the as-is state of every quality check at the start of +the refactor series. All pre-existing failures listed here have since been +resolved. As of M5 `pnpm run check` exits **0** on a clean checkout. Any +failure now represents a regression and must be fixed before merge. + +--- + +## Byte-equivalence assertion + +Before any file was modified in M1, `git status` showed a clean working tree. +After all S-101 through S-107 changes were applied, `git status` confirms: + +- **Zero** modifications to any nested `package.json` under `skills/` or `pi-package/`. +- **Zero** modifications to any file under `skills/*/{codex,claude-code,cursor,opencode,pi}/` + (the generated agent-variant directories). +- All changes are confined to new root-level config files, new scripts, updated + root `package.json` (devDependencies + scripts), and new docs. + +--- + +## 1. Pre-existing root scripts + +### `pnpm run sync:pi` + +```text +Synced pi package skill mirror into …/pi-package/skills. +EXIT: 0 +``` + +### `pnpm run verify:pi` + +```text +package metadata ok +pi resources verified +pi workflow skill docs verified +EXIT: 0 +``` + +### `pnpm run verify:reviewers` + +```text +reviewer support verified +EXIT: 0 +``` + +### `pnpm run test:installer` + +```text +TAP version 13 +# tests 22 +# pass 22 +# fail 0 +EXIT: 0 +``` + +--- + +## 2. Nested package scripts + +### atlassian/shared/scripts — `test` + +```text +TAP version 13 +# tests 23 +# pass 23 +# fail 0 +EXIT: 0 +``` + +### atlassian/shared/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### atlassian/codex/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### atlassian/claude-code/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### atlassian/cursor/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### atlassian/opencode/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### atlassian/pi/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### web-automation/codex/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### web-automation/codex/scripts — `lint` + +```text +EXIT: 0 +``` + +### web-automation/claude-code/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### web-automation/cursor/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### web-automation/opencode/scripts — `typecheck` + +```text +EXIT: 0 +``` + +### web-automation/pi/scripts — `typecheck` + +```text +EXIT: 0 +``` + +--- + +## 3. reviewer-runtime tests + +All three test scripts under `skills/reviewer-runtime/tests/` passed: + +```text +claude-review-template-guard.sh PASS +smoke-test.sh PASS +telegram-notify-test.sh PASS +EXIT: 0 (each) +``` + +--- + +## 4. M1 quality tooling — baseline violations + +### 4a. ESLint (`pnpm run lint` — ESLint stage) + +Exit code: **1** — 2 pre-existing errors (no new errors from M1 additions). + +Files with violations in the existing codebase: + +| File | Line | Rule | Message | +|------|------|------|---------| +| `scripts/lib/skill-manager-core.mjs` | 282 | `no-useless-assignment` | Value assigned to `entries` is not used | +| `scripts/manage-skills.mjs` | 270 | `no-unused-vars` | `client` is assigned a value but never used | + +Action: Fix in a later milestone. Do not suppress with eslint-disable comments +unless the code is intentionally dead. + +### 4b. shellcheck (`pnpm run lint` — shellcheck stage) + +Exit code: **1** — 7 files with pre-existing findings (no new violations from M1). + +| File | Finding | +|------|---------| +| `scripts/verify-pi-resources.sh` | SC2016 (info, ×3): single-quoted backtick strings; SC2251 (info, ×1): `!` outside condition | +| `scripts/verify-pi-workflows.sh` | SC2016 (info, ×2): single-quoted backtick strings; SC2251 (info, ×1): `!` outside condition | +| `skills/reviewer-runtime/pi/run-review.sh` | SC2329 (info): unused `handle_signal`; SC2034 (warning, ×2): unused variables | +| `skills/reviewer-runtime/run-review.sh` | SC2329 (info): unused `handle_signal`; SC2034 (warning, ×2): unused variables | +| `skills/reviewer-runtime/tests/claude-review-template-guard.sh` | SC2016 (info, ×1): single-quoted expansion | +| `skills/reviewer-runtime/tests/smoke-test.sh` | SC2064 (warning, ×1): `trap` should use single quotes | +| `skills/reviewer-runtime/tests/telegram-notify-test.sh` | SC2064 (warning, ×1): `trap` should use single quotes | + +The following files pass shellcheck with EXIT 0: + +- `scripts/install-pi-package.sh` +- `scripts/manage-skills.sh` +- `scripts/sync-pi-package-skills.sh` +- `scripts/verify-reviewer-support.sh` +- `skills/reviewer-runtime/notify-telegram.sh` +- `skills/reviewer-runtime/pi/notify-telegram.sh` +- `skills/web-automation/scripts/sync-variants.sh` + +Action: Fix `SC2064` trap issues and `SC2034` warnings in a later milestone. +SC2016 findings are intentional (single-quoted strings containing backticks are +used as literal grep patterns to match markdown text). + +### 4c. markdownlint (`pnpm run verify:docs`) + +Exit code: **1** — 1160 errors across 62 files (no new violations from M1 additions). + +markdownlint-cli2 v0.22.1 scanned `README.md`, `docs/**/*.md`, and canonical +`SKILL.md` files (excluding node\_modules and generated agent-variant +directories). + +Rule breakdown (selected): + +| Rule | Description | +|------|-------------| +| MD013 | Line length > 120 chars (majority of errors) | +| MD012 | Multiple consecutive blank lines | +| MD024 | Duplicate headings | +| MD029 | Ordered list item prefix | +| MD032 | Blanks around lists | +| MD038 | Spaces inside code span | +| MD040 | Fenced code without language | +| MD058 | Blanks around tables | + +Affected files include (non-exhaustive): `docs/ATLASSIAN.md`, +`docs/CREATE-PLAN.md`, `docs/DO-TASK.md`, `docs/IMPLEMENT-PLAN.md`, +`docs/INSTALLER.md`, `docs/PI-COMMON-REVIEWER.md`, `docs/PI-RESEARCH.md`, +`docs/PI-SUPERPOWERS.md`, `docs/PI.md`, `docs/README.md`, +`docs/TELEGRAM-NOTIFICATIONS.md`, `docs/WEB-AUTOMATION.md`, `README.md`, +and all `skills/*/*/SKILL.md` variants. + +Action: Bulk-fix in a dedicated doc-cleanup milestone. New docs added in M1 +(`docs/DEVELOPMENT.md`, `docs/CLEANUP-BASELINE.md`) pass all enabled rules. + +### 4d. markdown-link-check (offline, `pnpm run verify:docs`) + +Exit code: **0** — no broken repo-relative or anchor links found. + +53 markdown files scanned (offline mode: external http/https links ignored). +All internal links are valid. + +### 4e. `pnpm run typecheck` (workspace aggregate) + +Exit code: **0**. + +Ran `typecheck` in workspace members: + +- `skills/atlassian/shared/scripts` — PASS +- `skills/web-automation/codex/scripts` — PASS + +### 4f. `pnpm run test` (workspace aggregate) + +Exit code: **0**. + +Ran: + +- `pnpm run test:installer` (22/22 tests) +- `skills/atlassian/shared/scripts test` (23/23 tests) + +### 4g. `pnpm run check` aggregate (M1 transitional state) + +```text +FAIL lint (exit 1) — ESLint + shellcheck pre-existing violations (§4a, §4b) +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +FAIL verify:docs (exit 1) — markdownlint pre-existing violations (§4c) +PASS verify:generated (stub) +``` + +Overall exit: **1** — expected per transitional contract; all failures are +pre-existing and documented in this file. + +--- + +## 5. Platform notes + +- Tested on macOS 15 (arm64). No GNU/Linux run available at M1 capture time. +- shellcheck 0.11.0 installed via `brew install shellcheck`. +- `stat` variant: BSD stat (macOS default). The `scripts/` shell scripts do + not call `stat`; this affects only M5 CI configuration. +- `rg` (ripgrep) is required by `scripts/verify-pi-workflows.sh`. It is + present on the test machine; absent systems should install via + `brew install ripgrep` / `apt-get install ripgrep`. + +--- + +*This file is generated once (M1) and updated only when a subsequent milestone +changes the baseline status of a check.* + +--- + +## Post-M3 state + +Captured: 2026-05-03 · Platform: macOS 15 (arm64) · Node 22.14.0 · pnpm 10.18.1 + +M3 resolved all remaining pre-existing `lint` violations (2 ESLint errors and +7 shellcheck findings). `verify:generated` is now a real implementation +(was a stub in M2). + +### `pnpm run check` aggregate (post-M3) + +```text +PASS lint (was FAIL in M1/M2; pre-existing violations fixed in M3) +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +PASS verify:docs +PASS verify:generated (was stub in M2; real implementation in M3) +``` + +Overall exit: **0** — all checks green for the first time. + +### What changed in M3 + +- `scripts/generate-skills.mjs` added (generator for all 31 agent-variant roots). +- `scripts/verify-generated.mjs` added (drift detector). +- Canonical source directories created: `skills//_source/`, + `skills/web-automation/shared/`. +- All 31 generated roots now carry `.generated-manifest.json` and file-type-aware + headers. +- `package.json` renames: all generated agent-variant packages renamed to + `@ai-coding-skills/-` with `"private": true`. +- `pnpm-workspace.yaml` updated: M1 negative-glob exclusions replaced by + positive includes for all uniquely-named generated variants. +- Pre-existing ESLint violations fixed: `skill-manager-core.mjs:282` + (`no-useless-assignment`) and `manage-skills.mjs:270` (`no-unused-vars`). +- Pre-existing shellcheck findings fixed: SC2034 and SC2329 in + `reviewer-runtime/run-review.sh`; SC2064 in test trap statements; + SC2016 / SC2251 in verify scripts (suppress intentional patterns). +- `pnpm run sync:pi` now calls the generator instead of + `sync-pi-package-skills.sh`. +- `docs/DEVELOPMENT.md` extended with generation workflow and metadata docs. +- `CHANGELOG.md` created with package-metadata change callout. + +### Full byte-equivalence diff (M3 vs pre-M3) + +See `CHANGELOG.md` § "Byte-equivalence diff allow-list" for the complete +documented diff between M3-generated output and the pre-M3 variants. The +only permitted diffs are headers, `.generated-manifest.json`, `name` rename, +and `"private": true`. + +--- + +## Post-M2 state + +Captured: 2026-05-03 · Platform: macOS 15 (arm64) · Node 22.14.0 · pnpm 10.18.1 + +M2 resolved all `verify:docs` violations and the `verify:pi` portability +issue (`stat -f` BSD-ism in `scripts/verify-pi-resources.sh`). + +### `pnpm run check` aggregate (post-M2) + +```text +FAIL lint (exit 1) — same 2 ESLint + 7 shellcheck pre-existing violations (§4a, §4b) +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +PASS verify:docs (was FAIL in M1; now clean) +PASS verify:generated (stub) +``` + +Overall exit: **1** — only `lint` still fails on pre-existing violations. +`verify:docs` is now green (0 markdownlint errors, offline link-check clean, +docs-flow verifier passes). + +### What changed in M2 + +- `scripts/lib/portable.sh` added with `portable_stat_perms` helper. +- `scripts/verify-pi-resources.sh` updated to use `portable_stat_perms` + (replaces `stat -f '%Lp'` BSD-only call). +- `scripts/lib/run-shellcheck.mjs` updated to pass `-x --source-path=SCRIPTDIR` + so shellcheck follows `source` directives correctly on both platforms. +- `skills/.markdownlint.jsonc` added to disable MD013 and MD024 for + agent-facing SKILL.md files. +- All 1160 M1 markdownlint violations resolved (auto-fix + targeted edits). +- `docs/README.md` reorganized into ordered reading flow. +- `README.md` layout section updated to reflect actual repo tree. +- `docs/REVIEWERS.md` added as canonical reviewer CLI matrix. +- `docs/TELEGRAM-NOTIFICATIONS.md` extended with Pi section. +- `docs/CREATE-PLAN.md`, `docs/IMPLEMENT-PLAN.md`, `docs/DO-TASK.md` updated + with REVIEWERS.md references and unique variant headings. +- OpenCode reviewer branches added to `skills/create-plan/opencode/SKILL.md` + and `skills/implement-plan/opencode/SKILL.md`. +- `scripts/verify-docs-flow.mjs` implemented and wired into `verify:docs`. +- `pnpm run verify:docs:online` added for external link checks. + +### Ubuntu smoke note + +No Docker/Ubuntu run was available at M2 capture time. The portability +fix (`portable_stat_perms`) replaces the only identified BSD-ism. The +Ubuntu Docker command is documented in +[DEVELOPMENT.md](./DEVELOPMENT.md#cross-platform-shell-support-m2). + +--- + +## Post-M4 state + +Captured: 2026-05-03 · Platform: macOS 15 (arm64) · Node 22.14.0 · pnpm 10.18.1 + +M4 extracted reusable abstractions, consolidated shared helpers, tightened +types, and removed the legacy dead-code path. `pnpm run check` remains fully +green. + +### `pnpm run check` aggregate (post-M4) + +```text +PASS lint +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +PASS verify:docs +PASS verify:generated +``` + +Overall exit: **0** — all checks green (no regressions from M3). + +### What changed in M4 + +- **S-401** — `scripts/lib/safe-replace-dir.mjs` added: Node.js helper that + validates a target is a strict descendant of a safety root before replacing + it. Thin shell wrapper `scripts/lib/safe-replace-dir.sh` provided for + sourcing in shell scripts. `scripts/sync-pi-package-skills.sh` updated to + use `safe_replace_dir` from the shared helper (inline `replace_dir` removed). + +- **S-402** — `removeTarget(op)` extracted from `executeOperation()` in + `scripts/lib/skill-manager-core.mjs` and exported. The helper handles + skill, helper, and symlink removal with idempotent semantics. + `executeOperation` now delegates to `removeTarget` for all remove branches. + +- **S-403** — `skills/atlassian/shared/scripts/src/command-helpers.ts` added + with `dryRunResponse()` and `resolveFormat()` helpers. `confluence.ts`, + `jira.ts`, and `raw.ts` consume `dryRunResponse` (8 inline objects removed). + `cli.ts` imports `resolveFormat` from `command-helpers` instead of defining + it locally. All atlassian agent variants regenerated. + +- **S-404** — `skills/web-automation/shared/lib/browser.ts` created with + `getProfilePath`, `launchBrowser`, and `getPage`. `browse.ts` imports and + re-exports them. `auth.ts`, `flow.ts`, and `scan-local-app.ts` now import + directly from `lib/browser.js`. Generator updated to include `lib/` + directory in `scriptFiles` for web-automation variants. `tsconfig.json` + updated to include `lib/**/*.ts`. + +- **S-405** — `scan-local-app.ts` `page: any` parameters replaced with + `Page` from `playwright-core`. Added `GotoError` discriminated type to + narrow the `page.goto().catch()` union type safely. + +- **S-406** — `scripts/sync-pi-package-skills.sh` deleted (retired in M3, + inline `replace_dir` migrated to shared helper as part of S-401). Comment + in `skill-manager-core.mjs` referencing the deleted file updated. + Generator's `clearGeneratedRoot` fixed to preserve `node_modules` at all + depths (was only protected at root level, causing pnpm workspace packages + inside `scripts/` subdirs to lose their node_modules on regeneration). + +- **S-407** — Tests added: + - `scripts/tests/safe-replace-dir.test.mjs` (6 tests for S-401 helper) + - `scripts/tests/skill-manager-core-remove.test.mjs` (5 tests for S-402) + - `skills/atlassian/shared/scripts/tests/command-helpers.test.ts` (7 tests + for S-403 `dryRunResponse` and `resolveFormat`) + +### Test count (post-M4) + +| Suite | Tests | +|---|---| +| `pnpm run test:installer` (root scripts) | 80 | +| `atlassian/shared/scripts` | 29 | +| **Total** | **109** | + +--- + +## Final state (post-M5) — CLOSED + +Captured: 2026-05-03 · Platform: macOS 15 (arm64) · Node 22.14.0 · pnpm 10.18.1 + +M5 added CI configuration, finalised documentation, closed out this baseline +report, and locked in a permanently green `pnpm run check` gate. No +pre-existing failures remain open. + +### `pnpm run check` aggregate (post-M5 — macOS) + +```text +PASS lint +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +PASS verify:docs +PASS verify:generated + +All checks passed. +``` + +Overall exit: **0** — all checks green (no regressions from M4). + +### What changed in M5 + +- **S-501** — `.github/workflows/check.yml` added: matrix over `ubuntu-latest` + and `macos-latest`; installs `shellcheck` (apt/brew), `ripgrep` (apt), pnpm, + and Node.js 22; runs `pnpm run check`. +- **S-501** — `.github/workflows/check-online.yml` added: weekly schedule + + `workflow_dispatch`; runs `verify:docs:online` for full external link checking. +- **S-502** — Root `README.md` gained a "Contributing / Development" section + naming `pnpm run check` as the single quality gate and linking to + `docs/DEVELOPMENT.md`. +- **S-503** — `docs/DEVELOPMENT.md` finalised: added "Adding a new agent", + "Adding a new skill", and "CI" sections; transitional contract replaced by + the permanent M5 contract; baseline links updated. +- **S-504** — This file (`docs/CLEANUP-BASELINE.md`) closed out with the + "Final state" section. +- **S-505** — Root `package.json` `files` list updated: `docs/DEVELOPMENT.md` + and `docs/REVIEWERS.md` added. +- **S-506** — `CHANGELOG.md` extended with the M5 consolidated entry. +- **S-507** — Final `pnpm run check` run confirmed green (output above). + +### Baseline status summary + +Every pre-existing failure recorded in this document is now **resolved**. +No waivers are required. + +| Check | M1 status | Final status | Resolution | +|-------|-----------|--------------|------------| +| `lint` (ESLint) | FAIL — 2 errors | **PASS** | Fixed in M3 (S-302) | +| `lint` (shellcheck) | FAIL — 7 findings | **PASS** | Fixed in M3 (S-302) | +| `typecheck` | PASS | **PASS** | Never regressed | +| `test` | PASS | **PASS** | Never regressed | +| `verify:pi` | PASS | **PASS** | Portability hardened in M2 | +| `verify:reviewers` | PASS | **PASS** | Never regressed | +| `verify:docs` (markdownlint) | FAIL — 1160 errors | **PASS** | Fixed in M2 | +| `verify:docs` (link-check) | PASS | **PASS** | Never regressed | +| `verify:generated` | PASS (stub) | **PASS** | Real implementation in M3 | + +### Ubuntu smoke test + +The CI workflow (`.github/workflows/check.yml`) runs the same `pnpm run check` +command on `ubuntu-latest`. This replaces the Docker one-liner that was the +only documented Ubuntu smoke test path in M1–M4. + +For local reproduction on Linux: + +```bash +# Requires Docker +docker run --rm \ + -v "$PWD:/w" \ + -w /w \ + node:22-bookworm \ + bash -lc 'apt-get update -q && apt-get install -y -q shellcheck ripgrep python3 \ + && corepack enable \ + && pnpm install --frozen-lockfile \ + && pnpm run check' +``` + +*This baseline report is now closed. Future regressions must be caught by CI +and fixed before merge; they should NOT reopen this document.* diff --git a/docs/CREATE-PLAN.md b/docs/CREATE-PLAN.md index 2f9109e..eafad01 100644 --- a/docs/CREATE-PLAN.md +++ b/docs/CREATE-PLAN.md @@ -2,7 +2,8 @@ ## Purpose -Create structured implementation plans with milestone and story tracking, and optionally review them iteratively with a second model/provider before finalizing. +Create structured implementation plans with milestone and story tracking, and optionally review +them iteratively with a second model/provider before finalizing. ## Requirements @@ -12,7 +13,8 @@ Create structured implementation plans with milestone and story tracking, and op - `superpowers:writing-plans` - For Codex, native skill discovery must be configured: - `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` -- Cursor can use the Cursor Superpowers plugin cache or manual `.cursor/skills/superpowers/skills` / `~/.cursor/skills/superpowers/skills` installs. +- Cursor can use the Cursor Superpowers plugin cache or manual `.cursor/skills/superpowers/skills` + / `~/.cursor/skills/superpowers/skills` installs. - OpenCode can use `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers`. - Shared reviewer runtime must be installed beside agent skills when using reviewer CLIs: - Codex: `~/.codex/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` @@ -24,11 +26,14 @@ Create structured implementation plans with milestone and story tracking, and op If dependencies are missing, stop and return: -"Missing dependency: native Superpowers skills are required (`superpowers:brainstorming`, `superpowers:writing-plans`). Install from https://github.com/obra/superpowers, then retry." +"Missing dependency: native Superpowers skills are required (`superpowers:brainstorming`, +`superpowers:writing-plans`). Install from https://github.com/obra/superpowers, then retry." ### Reviewer CLI Requirements (Optional) -To use the iterative plan review feature, one of these CLIs must be installed: +The canonical reviewer CLI support matrix is documented in +[REVIEWERS.md](./REVIEWERS.md). To use the iterative plan review feature, one +of these CLIs must be installed: | Reviewer CLI | Install | Verify | |---|---|---| @@ -38,9 +43,11 @@ To use the iterative plan review feature, one of these CLIs must be installed: | `opencode` | `brew install opencode` or your package manager | `opencode --version` | | `pi` | Install Pi coding agent | `pi --version`; list models with `pi --list-models [search]` | -The reviewer CLI is independent of which agent is running the planning — e.g., Claude Code can send plans to Codex for review, and vice versa. +The reviewer CLI is independent of which agent is running the planning — e.g., Claude Code can +send plans to Codex for review, and vice versa. -**Additional dependency for `cursor` reviewer:** `jq` is required to parse Cursor's JSON output. Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. +**Additional dependency for `cursor` reviewer:** `jq` is required to parse Cursor's JSON output. +Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. ## Install @@ -109,7 +116,7 @@ Recommended full Pi package install: Manual single-skill Pi install from the package mirror: ```bash -./scripts/sync-pi-package-skills.sh +pnpm run sync:pi mkdir -p .pi/skills/create-plan cp -R pi-package/skills/create-plan/* .pi/skills/create-plan/ mkdir -p .pi/skills/reviewer-runtime/pi @@ -144,8 +151,10 @@ Verify Superpowers dependencies exist in your agent skills root: - Claude Code: `~/.claude/skills/superpowers/writing-plans/SKILL.md` - OpenCode: `~/.agents/skills/superpowers/brainstorming/SKILL.md` or `~/.config/opencode/skills/superpowers/brainstorming/SKILL.md` - OpenCode: `~/.agents/skills/superpowers/writing-plans/SKILL.md` or `~/.config/opencode/skills/superpowers/writing-plans/SKILL.md` -- Cursor: `.cursor/skills/superpowers/skills/brainstorming/SKILL.md`, `~/.cursor/skills/superpowers/skills/brainstorming/SKILL.md`, or the Cursor Superpowers plugin cache -- Cursor: `.cursor/skills/superpowers/skills/writing-plans/SKILL.md`, `~/.cursor/skills/superpowers/skills/writing-plans/SKILL.md`, or the Cursor Superpowers plugin cache +- Cursor: `.cursor/skills/superpowers/skills/brainstorming/SKILL.md`, + `~/.cursor/skills/superpowers/skills/brainstorming/SKILL.md`, or the Cursor Superpowers plugin cache +- Cursor: `.cursor/skills/superpowers/skills/writing-plans/SKILL.md`, + `~/.cursor/skills/superpowers/skills/writing-plans/SKILL.md`, or the Cursor Superpowers plugin cache - Pi: `.pi/skills/superpowers/brainstorming/SKILL.md` or `~/.pi/agent/skills/superpowers/brainstorming/SKILL.md` or `~/.agents/skills/superpowers/brainstorming/SKILL.md` - Pi: `.pi/skills/superpowers/writing-plans/SKILL.md` or `~/.pi/agent/skills/superpowers/writing-plans/SKILL.md` or `~/.agents/skills/superpowers/writing-plans/SKILL.md` @@ -156,11 +165,14 @@ Verify Superpowers dependencies exist in your agent skills root: - Commits `.gitignore` update locally when added. - Asks which reviewer CLI, model, and max rounds to use (or accepts `skip` for no review). - Iteratively reviews the plan with the chosen reviewer (default max 10 rounds) before generating files. -- Runs reviewer commands through `reviewer-runtime/run-review.sh` when available, with fallback to direct synchronous execution only if the helper is missing. +- Runs reviewer commands through `reviewer-runtime/run-review.sh` when available, with fallback to + direct synchronous execution only if the helper is missing. - Waits as long as the reviewer runtime keeps emitting per-minute `In progress N` heartbeats. - Requires reviewer findings to be ordered `P0` through `P3`, with `P3` explicitly non-blocking. -- Captures reviewer stderr and helper status logs for diagnostics and retains them on failed, empty-output, or operator-decision review rounds. -- Sends completion notifications through Telegram only when the shared setup in [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) is installed and configured. +- Captures reviewer stderr and helper status logs for diagnostics and retains them on failed, + empty-output, or operator-decision review rounds. +- Sends completion notifications through Telegram only when the shared setup in + [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) is installed and configured. - Produces: - `original-plan.md` - `final-transcript.md` @@ -172,10 +184,12 @@ Verify Superpowers dependencies exist in your agent skills root: After the plan is created (design + milestones + stories), the skill sends it to a second model for review: -1. **Configure** — user picks a reviewer CLI (`codex`, `claude`, `cursor`, `opencode`, `pi`), a model, and optional max rounds (default 10), or skips +1. **Configure** — user picks a reviewer CLI (`codex`, `claude`, `cursor`, `opencode`, `pi`), a + model, and optional max rounds (default 10), or skips 2. **Prepare** — plan payload and a bash reviewer command script are written to temp files 3. **Run** — the command script is executed through `reviewer-runtime/run-review.sh` when installed -4. **Feedback** — reviewer evaluates correctness, risks, missing steps, alternatives, security, and returns `## Summary`, `## Findings`, and `## Verdict` +4. **Feedback** — reviewer evaluates correctness, risks, missing steps, alternatives, security, and + returns `## Summary`, `## Findings`, and `## Verdict` 5. **Prioritize** — findings are ordered `P0`, `P1`, `P2`, `P3` 6. **Revise** — the planning agent addresses findings in priority order and re-submits 7. **Repeat** — up to max rounds until the reviewer returns `VERDICT: APPROVED` @@ -210,13 +224,17 @@ ts= level= state=` shorthand, for example `pi/claude-opus-4-7`; this means `REVIEWER_CLI=pi` and `REVIEWER_MODEL=claude-opus-4-7`. Provider-qualified or multi-slash Pi model IDs are preserved after the first `pi/` prefix, for example `pi/anthropic/claude-opus-4-7`. +All workflow variants can use Pi itself as a reviewer CLI. Use `pi/` shorthand, for +example `pi/claude-opus-4-7`; this means `REVIEWER_CLI=pi` and `REVIEWER_MODEL=claude-opus-4-7`. +Provider-qualified or multi-slash Pi model IDs are preserved after the first `pi/` prefix, for +example `pi/anthropic/claude-opus-4-7`. -The canonical isolated read-only Pi reviewer flag contract lives in [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). This workflow passes the plan review payload at `/tmp/plan-${REVIEW_ID}.md` and expects the standard `## Summary`, `## Findings`, and `## Verdict` response. Pi reviewer output is captured as markdown stdout, not JSON. +The canonical isolated read-only Pi reviewer flag contract lives in +[PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). This workflow passes the plan review payload at +`/tmp/plan-${REVIEW_ID}.md` and expects the standard `## Summary`, `## Findings`, and `## Verdict` +response. Pi reviewer output is captured as markdown stdout, not JSON. -If the Pi reviewer model or provider is unavailable, surface the helper stderr/status and use `pi --list-models [search]` to inspect configured models. +If the Pi reviewer model or provider is unavailable, surface the helper stderr/status and use +`pi --list-models [search]` to inspect configured models. ## Notifications @@ -257,17 +280,20 @@ If the Pi reviewer model or provider is unavailable, surface the helper stderr/s All plan templates now include guardrail sections that enforce: **Planning Guardrails** (`milestone-plan.md`): + - Design validation before implementation planning - Native skill discovery (no deprecated CLI wrappers) - Milestone verification + local commits + explicit approval **Tracking Guardrails** (`story-tracker.md`): + - Immediate status updates when work starts/completes - Explicit user approval at each milestone boundary - No pushes until all milestones approved - Synchronization between tracker and plan files **Skill Workflow Guardrails** (`continuation-runbook.md`): + - Native skill invocation before action - Explicit skill announcements - Checklist tracking for driven skills @@ -275,7 +301,7 @@ All plan templates now include guardrail sections that enforce: ## Variant Hardening Notes -### Claude Code +### Claude Code Hardening - Must invoke explicit required sub-skills: - `superpowers:brainstorming` @@ -284,7 +310,7 @@ All plan templates now include guardrail sections that enforce: - if in plan mode, instruct user to exit plan mode before generating files - Must copy `original-plan.md` from `~/.claude/plans/` when available. -### Codex +### Codex Hardening - Must use native skill discovery from `~/.agents/skills/` (no CLI wrappers). - Must verify Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` @@ -294,7 +320,7 @@ All plan templates now include guardrail sections that enforce: - Must track checklist-driven skills with `update_plan` todos. - Deprecated CLI commands (`superpowers-codex bootstrap`, `use-skill`) must NOT be used. -### OpenCode +### OpenCode Hardening - Must use OpenCode native skill tool (not Claude/Codex invocation syntax). - Must verify Superpowers skill discovery under: @@ -304,7 +330,7 @@ All plan templates now include guardrail sections that enforce: - `superpowers/brainstorming` - `superpowers/writing-plans` -### Cursor +### Cursor Hardening - Must use Cursor-native discovery from `.cursor/skills/`, `~/.cursor/skills/`, or installed Cursor plugin cache entries. - Must announce skill usage explicitly before invocation. diff --git a/docs/CURSOR.md b/docs/CURSOR.md index 720182a..be14d00 100644 --- a/docs/CURSOR.md +++ b/docs/CURSOR.md @@ -54,7 +54,9 @@ Global uses `~/.cursor/skills/reviewer-runtime/` instead. ## Superpowers -Cursor can discover Superpowers from the Cursor plugin cache or from manual repo-local/global skill roots. Prefer the plugin install when it is present; do not also install a manual Superpowers copy, or Cursor may show each Superpowers skill twice. +Cursor can discover Superpowers from the Cursor plugin cache or from manual repo-local/global +skill roots. Prefer the plugin install when it is present; do not also install a manual Superpowers +copy, or Cursor may show each Superpowers skill twice. ```bash ~/.cursor/plugins/cache/cursor-public/superpowers//skills//SKILL.md diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md new file mode 100644 index 0000000..e88d927 --- /dev/null +++ b/docs/DEVELOPMENT.md @@ -0,0 +1,460 @@ +# Development Guide — ai-coding-skills + +This document covers prerequisites, how to run checks locally, the quality +tooling, the workspace policy, and the `pnpm run check` contract. + +## Prerequisites + +| Tool | Minimum version | Install | +|------|----------------|---------| +| Node.js | 20 | `fnm install 22` or `nvm install 22` | +| pnpm | 10 | `npm install -g pnpm` | +| `rg` (ripgrep) | any | `brew install ripgrep` / `apt-get install ripgrep` | +| **shellcheck** | **any** | `brew install shellcheck` / `apt-get install shellcheck` | +| `stat` (BSD or GNU) | any | pre-installed on macOS; GNU variant on Linux | +| Python 3 | 3.8+ | pre-installed on most systems | + +**`shellcheck` is required.** The `pnpm run lint` script will exit 2 with a +clear error message if `shellcheck` is not on `PATH`. Every contributor must +install it before running any quality checks. + +## Quick start + +```bash +# Install dependencies (workspace-aware, no nested package.json modifications) +pnpm install + +# Run the full quality suite +pnpm run check +``` + +## Individual checks + +| Command | What it does | +|---------|-------------| +| `pnpm run sync:pi` | Mirror pi skill variants into `pi-package/skills/` | +| `pnpm run verify:pi` | Assert pi resource and workflow invariants | +| `pnpm run verify:reviewers` | Assert reviewer-runtime skill invariants | +| `pnpm run test:installer` | Run root-level Node.js unit tests (22 tests) | +| `pnpm run lint` | ESLint on root scripts + shellcheck on all `.sh` files | +| `pnpm run lint:fix` | Auto-fix ESLint + Prettier (do not run on pre-existing code until M2) | +| `pnpm run typecheck` | TypeScript `tsc --noEmit` in workspace packages | +| `pnpm run test` | Run all tests (root + workspace packages) | +| `pnpm run verify:docs` | markdownlint + offline link-check + docs-flow verifier | +| `pnpm run verify:docs:online` | Same as `verify:docs` but with full external link checking | +| `pnpm run verify:generated` | Assert generated output freshness (stub; fleshed out in M3) | +| `pnpm run verify:ci` | Assert CI workflow files carry no pnpm version pins (see [pnpm version pinning](#pnpm-version-pinning)) | +| `pnpm run check` | Aggregate: run every gate above and report a summary | + +## Quality tooling (added in M1) + +### ESLint + +Root-level flat config in `eslint.config.mjs`. Covers `scripts/**/*.mjs` +and `scripts/**/*.js`. Uses `@eslint/js` recommended rules and Node.js +globals. Nested workspace packages are responsible for their own ESLint +configuration. + +### Prettier + +Config in `.prettierrc.json` (print-width 100, LF line endings). Ignore +file at `.prettierignore` excludes generated agent-variant directories and +`pnpm-lock.yaml`. + +### markdownlint + +Config in `.markdownlint.jsonc` (rules) and `.markdownlint-cli2.jsonc` +(file globs and ignores). Key overrides vs defaults: + +- `MD013` line-length relaxed to 120 chars (code blocks and tables excluded). +- `MD033` (inline HTML) disabled. +- `MD034` (bare URLs) disabled. +- `MD041` (first-line heading) disabled. +- `MD060` (table column style) disabled. + +Run `pnpm run verify:docs` to lint all `README.md`, `docs/*.md`, and +`skills/**/SKILL.md` files (node\_modules excluded automatically). + +### markdown-link-check + +Two configs: + +- `markdown-link-check.json` — **offline** mode (default): ignores all + `http://` and `https://` links. Safe for local dev and CI. +- `markdown-link-check.online.json` — **online** mode: checks external links + with a 10 s timeout, 2 retries, and retry-on-429. Use `--online` flag on + `scripts/lib/run-link-check.mjs`. + +`pnpm run verify:docs` uses the offline config by default. + +### shellcheck + +Wrapper script at `scripts/lib/run-shellcheck.mjs`. Discovers every `*.sh` +file under `scripts/` and `skills/` (excluding node\_modules and generated +agent-variant directories) and runs shellcheck on each. + +**Installation:** + +- macOS: `brew install shellcheck` +- Debian/Ubuntu: `sudo apt-get install shellcheck` +- Other: + +The wrapper exits with code **2** (not 1) when shellcheck is missing, so CI +can distinguish "shellcheck absent" from "shellcheck found violations". + +## Cross-platform shell support (M2) + +All shell scripts under `scripts/` and `skills/reviewer-runtime/` that are +exercised by `verify:pi`, `verify:reviewers`, `sync:pi`, and `test:installer` +must work on both **macOS** (BSD userland) and **Ubuntu/Debian** (GNU +userland) without modification. + +### BSD vs GNU differences encountered + +| Feature | macOS (BSD) | Linux (GNU) | Portable form | +|---------|-------------|-------------|---------------| +| `stat` permissions | `stat -f '%Lp' ` | `stat -c '%a' ` | `portable_stat_perms` helper | +| herestrings (`<<<`) | supported (bash) | supported (bash) | OK (scripts use `#!/usr/bin/env bash`) | +| `find -E` (extended regex) | macOS-only | not available | use `grep` or POSIX `-name` | +| `sed -i ''` | macOS form | use `sed -i` on Linux | detect or avoid in-place sed | +| `date -j` (date arithmetic) | macOS-only | use `date -d` on Linux | Node helper or `date +%s` | +| `readlink -f` | not on macOS by default | GNU standard | `realpath` or `cd && pwd` | + +### `scripts/lib/portable.sh` + +A shared helper that abstracts the two known BSD/GNU divergences hit in +this repo: + +```bash +# Source from any script that needs portable stat +# shellcheck source=lib/portable.sh +source "$(dirname "${BASH_SOURCE[0]}")/lib/portable.sh" + +# Returns octal permission string: e.g. "755" +portable_stat_perms "$path" +``` + +The `shellcheck` wrapper passes `-x --source-path=SCRIPTDIR` so source +directives resolve relative to the script file, not the working directory. + +### How to run the Ubuntu smoke test locally + +```bash +# Requires Docker +docker run --rm \ + -v "$PWD:/w" \ + -w /w \ + node:20-bookworm \ + bash -lc 'apt-get update -q && apt-get install -y -q shellcheck ripgrep python3 \ + && corepack enable \ + && pnpm install --frozen-lockfile \ + && pnpm run check' +``` + +This runs the full `pnpm run check` suite (lint, typecheck, test, verify:pi, +verify:reviewers, verify:docs, verify:generated) inside a clean Debian Bookworm +container with Node 20. + +## `check` contract (final — M5) + +`pnpm run check` is **fully green** on a clean checkout with the documented +prerequisites installed. + +```text +PASS lint +PASS typecheck +PASS test +PASS verify:pi +PASS verify:reviewers +PASS verify:docs +PASS verify:generated +PASS verify:ci +``` + +This is the only acceptable state for merge. Any failure on a check not in +`docs/CLEANUP-BASELINE.md` is a regression and must be fixed before merge. + +> **History:** In M1 the contract was transitional and allowed pre-existing +> failures recorded in the baseline. M2 fixed `verify:docs`. M3 fixed +> `lint` and promoted `verify:generated` from stub to real implementation. +> M4 added abstractions without regressions. M5 added CI and finalized docs. +> The baseline is now closed out — see `docs/CLEANUP-BASELINE.md`. + +## pnpm workspace policy (updated in M3) + +The `pnpm-workspace.yaml` at the repo root uses a **positive-include** policy +introduced in M3. There are no negative-glob exclusions. + +**Canonical source packages** (never generated): + +- `skills/atlassian/shared/scripts` — shared Atlassian TypeScript runtime +- `skills/web-automation/shared` — shared web-automation runtime template + +**Generated agent-variant packages** (uniquely named, positively included): + +- `skills/atlassian/{claude-code,codex,cursor,opencode,pi}/scripts` + → names `@ai-coding-skills/atlassian-{claude-code,codex,cursor,opencode,pi}` +- `skills/web-automation/{claude-code,codex,cursor,opencode,pi}/scripts` + → names `@ai-coding-skills/web-automation-{claude-code,codex,cursor,opencode,pi}` +- `pi-package/skills/atlassian/scripts` + → name `@ai-coding-skills/atlassian-pi-mirror` +- `pi-package/skills/web-automation/scripts` + → name `@ai-coding-skills/web-automation-pi-mirror` + +**Why unique names matter:** + +Each package in a pnpm workspace must have a distinct `name` field. In M1 all +generated agent-variant packages shared the same non-unique name as their +canonical source package. In M3 every package receives a scoped unique name +of the form `@ai-coding-skills/-`, enabling pnpm to include them +alongside canonical source packages without conflicts. The pi-package mirrors +use the `-mirror` suffix to distinguish them from the `pi` agent variants. + +All generated packages are `"private": true` and are never published to any +registry. + +After `pnpm install`, `git status` should show zero modifications to any +package.json file under any generated directory. If it does not, the workspace +config or generator is broken. + +## How to interpret the baseline report + +See `docs/CLEANUP-BASELINE.md` for the historical as-is capture from M1. That +baseline is now **closed** — all pre-existing failures have been resolved. +When a CI run fails on any check it is a regression and must be fixed before +merge. + +## How variants are generated (M3) + +Every agent-variant directory under `skills///` and every +`pi-package/skills//` mirror is **generator-owned**. Do not edit +files inside these directories directly — edit the canonical source instead +and run `pnpm run sync:pi` to regenerate. + +### Canonical sources (non-generated) + +These directories are **never** generated and are **never** inside a generated +root. They are the single source of truth for all content. + +| Skill | Canonical source | +|-------|------------------| +| `atlassian` | SKILL.md: `skills/atlassian/_source//SKILL.md`; scripts: `skills/atlassian/shared/scripts/` | +| `web-automation` | SKILL.md: `skills/web-automation/_source//SKILL.md`; scripts: `skills/web-automation/shared/` | +| `create-plan` | `skills/create-plan/_source//` (SKILL.md + templates) | +| `do-task` | `skills/do-task/_source//` (SKILL.md + templates) | +| `implement-plan` | `skills/implement-plan/_source//SKILL.md` | +| `reviewer-runtime` (base) | `skills/reviewer-runtime/run-review.sh`, `notify-telegram.sh` | + +The `_source/` directories and `shared/` directories sit under the skill root +**outside** every generated root. Stale-file detection (`verify:generated`) +never traverses them. + +### Generated roots (authoritative list) + +All paths are relative to the repo root. + +```text +skills/atlassian/{claude-code,codex,cursor,opencode,pi}/ +skills/web-automation/{claude-code,codex,cursor,opencode,pi}/ +skills/create-plan/{claude-code,codex,cursor,opencode,pi}/ +skills/do-task/{claude-code,codex,cursor,opencode,pi}/ +skills/implement-plan/{claude-code,codex,cursor,opencode,pi}/ +skills/reviewer-runtime/pi/ +pi-package/skills/{atlassian,create-plan,do-task,implement-plan,web-automation}/ +``` + +### Contributor workflow + +1. **Edit the canonical source** in the appropriate `_source//`, `shared/`, or + base `skills/reviewer-runtime/` directory. +2. **Run the generator:** + + ```bash + pnpm run sync:pi # regenerates all 31 generated roots + ``` + +3. **Verify no drift:** + + ```bash + pnpm run verify:generated # must exit 0 + ``` + +4. **Stage both the canonical source AND the generated output** in the same commit. + Never commit a canonical change without regenerating. + +### File-type-aware header policy + +Every generated file (except JSON and `pnpm-lock.yaml`) receives a header +identifying it as generated and pointing to the canonical source. Headers are +inserted so they do not break parsers or tools: + +| File type | Header form | Placement | +|-----------|-------------|----------| +| Markdown (with YAML front matter) | `` | After closing `---` | +| Markdown (no front matter) | `` | Top of file | +| Shell script | `# ⚠️ GENERATED FILE ...` | After `#!` shebang | +| TypeScript / JavaScript | `// ⚠️ GENERATED FILE ...` | After `#!` shebang if present, else top | +| YAML (non-lockfile) | `# ⚠️ GENERATED FILE ...` | Top of file | +| JSON | *(no header — recorded in `.generated-manifest.json`)* | — | +| `pnpm-lock.yaml` | *(no header — managed by pnpm)* | — | +| JSONC | `// ⚠️ GENERATED FILE ...` | Top of file | + +### `.generated-manifest.json` contract + +Each generated root contains a `.generated-manifest.json` that: + +- Has a `$schema` marker and a `generator` field for identification. +- Lists every **other** generator-owned path in that root (relative path, + file mode, SHA-256 hash, kind). +- **Does NOT list itself** (non-self-referential). +- Is scoped to exactly **one** generated root — there is no manifest at + `skills//`. +- Is verified structurally (not byte-for-byte) by `verify:generated`. + +### Package metadata (M3 change) + +Each generated agent-variant `package.json` carries: + +- A **unique private name** in the form `@ai-coding-skills/-` (e.g. + `@ai-coding-skills/atlassian-claude-code`). +- `"private": true` to prevent accidental npm publication. + +The pi-package mirrors (`pi-package/skills/atlassian/scripts` and +`pi-package/skills/web-automation/scripts`) use the `-mirror` agent suffix +(`@ai-coding-skills/atlassian-pi-mirror`, `@ai-coding-skills/web-automation-pi-mirror`) +to distinguish them from the `pi` agent variants in the workspace. + +This replaces the previous non-unique `name` fields (`atlassian-skill-scripts`, +`web-automation-scripts`). These packages are private and are never published. +See `CHANGELOG.md` for the full rename list. + +## Adding a new agent variant + +To add support for a brand-new agent (e.g. `mynewagent`) across all skills: + +1. **Create canonical source files** for every skill: + + ```bash + mkdir -p skills//_source/mynewagent + # Add SKILL.md (copy and adapt from an existing agent variant) + ``` + +2. **Update the generator** (`scripts/generate-skills.mjs`): + - Add `"mynewagent"` to the `AGENTS` array (or the per-skill agent list). + - Ensure any agent-specific substitution logic is handled. + +3. **Regenerate all variants:** + + ```bash + pnpm run sync:pi + pnpm run verify:generated # must exit 0 + ``` + +4. **Update the workspace** (`pnpm-workspace.yaml`): + - Add entries for every `skills//mynewagent/scripts` package that + has a `package.json` (e.g. atlassian and web-automation). + +5. **Update documentation:** + - Add a row to the skills table in `README.md`. + - Add a row to the reviewer matrix in `docs/REVIEWERS.md` if the agent + exposes a reviewer CLI. + - Add an install guide at `docs/MYNEWAGENT.md` and link it from + `docs/README.md`. + - Add the doc file to the `files` list in root `package.json`. + +6. **Verify the full suite:** + + ```bash + pnpm install + pnpm run check + ``` + +## Adding a new skill + +To add an entirely new skill (e.g. `my-skill`): + +1. **Create the canonical source tree:** + + ```bash + mkdir -p skills/my-skill/_source/{claude-code,codex,cursor,opencode,pi} + # Add SKILL.md to each _source// directory + ``` + +2. **Update the generator** (`scripts/generate-skills.mjs`): + - Add `"my-skill"` to the `SKILLS` array. + - Provide a `getSkillMeta(skill)` entry with agents list, source resolver, + and any extra files to copy (templates, scripts, etc.). + +3. **Regenerate:** + + ```bash + pnpm run sync:pi + pnpm run verify:generated + ``` + +4. **Add the pi-package entry** if the skill should be distributed via the + Pi package: + - Update `package.json` → `pi.skills` with the new path. + - Update the `files` array to include the new skill directory. + +5. **Write documentation** in `docs/MY-SKILL.md` and link from `docs/README.md` + and the skills table in `README.md`. + +6. **Run the full suite:** `pnpm run check`. + +## CI + +Two GitHub Actions workflows live in `.github/workflows/`: + +| File | Trigger | Purpose | +|------|---------|---------| +| `check.yml` | push, pull_request (all branches) | Full `pnpm run check` on `ubuntu-latest` **and** `macos-latest`. Offline link-checking (no network dependency). | +| `check-online.yml` | weekly schedule (Mon 09:00 UTC) + `workflow_dispatch` | `pnpm run verify:docs:online` with full external link checking. | + +### What the `check` workflow does + +1. Checks out the repository. +2. Installs `shellcheck` via `apt-get` (Ubuntu) or `brew` (macOS). +3. Installs `ripgrep` via `apt-get` (Ubuntu only; pre-installed on macOS runners). +4. Installs Node.js 22 via `actions/setup-node`. +5. Installs pnpm via `pnpm/action-setup@v4` — **no `version:` key is set**; the action reads the version from + `package.json#packageManager` (currently `pnpm@10.18.1+sha512…`), which is the single source of truth. +6. Runs `pnpm install --frozen-lockfile`. +7. Runs `pnpm run check` (the same command contributors run locally). + +The matrix runs both `ubuntu-latest` and `macos-latest` to guard against +platform-specific regressions. Because M2 made all shell scripts portable +across BSD and GNU coreutils, both runners should stay green. + +### pnpm version pinning + +The pnpm version is pinned **exclusively** in `package.json#packageManager`: + +```json +"packageManager": "pnpm@10.18.1+sha512.77a884a..." +``` + +This field carries an exact version *and* an integrity hash, giving stronger +reproducibility than a floating major like `version: "10"`. The +`pnpm/action-setup@v4` step in `check.yml` reads this field automatically; +do **not** add a `with.version` key to that step. + +`pnpm run verify:ci` (backed by `scripts/lib/assert-no-pnpm-version-pin.mjs`) +greps every `.github/workflows/*.yml` for `pnpm/action-setup` blocks that +carry a `version:` key and fails if any are found. This prevents +reintroduction of the conflict that caused `pnpm/action-setup@v4` to error. + +### Adding new prerequisites to CI + +If a new tool is required (e.g. a new binary called by a verify script), +add the install step to **both** OS branches in `check.yml`. Document the +new prerequisite in the Prerequisites table at the top of this file. + +## Links + +- [CLEANUP-BASELINE.md](./CLEANUP-BASELINE.md) — as-is quality baseline +- [README.md](../README.md) — project overview +- [docs/README.md](./README.md) — documentation index +- [CHANGELOG.md](../CHANGELOG.md) — milestone-by-milestone change record +- [.github/workflows/check.yml](../.github/workflows/check.yml) — CI workflow +- [.github/workflows/check-online.yml](../.github/workflows/check-online.yml) — weekly online link check diff --git a/docs/DO-TASK.md b/docs/DO-TASK.md index 65ded60..d721e2e 100644 --- a/docs/DO-TASK.md +++ b/docs/DO-TASK.md @@ -2,13 +2,19 @@ ## Purpose -Execute a single user-supplied prompt end-to-end with **two reviewer loops** (plan review + implementation review), with TDD-first execution, a pre-implementation verification gate, and a single task commit — all in one run of the skill. `do-task` is scoped to small-to-medium ad-hoc tasks; for multi-milestone work use `create-plan` + `implement-plan` instead. +Execute a single user-supplied prompt end-to-end with **two reviewer loops** (plan review + +implementation review), with TDD-first execution, a pre-implementation verification gate, and a +single task commit — all in one run of the skill. `do-task` is scoped to small-to-medium ad-hoc +tasks; for multi-milestone work use `create-plan` + `implement-plan` instead. -`do-task` persists one plan artifact per run: `ai_plan/YYYY-MM-DD-/task-plan.md`. The folder is kept as a record after success (not deleted). Resume is supported via the `Status` enum and Runtime State fields. +`do-task` persists one plan artifact per run: `ai_plan/YYYY-MM-DD-/task-plan.md`. The +folder is kept as a record after success (not deleted). Resume is supported via the `Status` enum +and Runtime State fields. ## Requirements -- Git repo with `/ai_plan/` entry in `.gitignore` (the skill adds the entry automatically if missing and commits it as a separate infra commit). +- Git repo with `/ai_plan/` entry in `.gitignore` (the skill adds the entry automatically if + missing and commits it as a separate infra commit). - Superpowers skills installed from: https://github.com/obra/superpowers - Required dependencies (vary by variant; see Install below): - `superpowers:brainstorming` (or `superpowers/brainstorming` for OpenCode) @@ -18,32 +24,50 @@ Execute a single user-supplied prompt end-to-end with **two reviewer loops** (pl - `superpowers:using-git-worktrees` (only when the prompt opts in to a worktree) - For Codex, native skill discovery must be configured: - `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` -- Cursor can use the Cursor Superpowers plugin cache or manual `.cursor/skills/superpowers/skills` / `~/.cursor/skills/superpowers/skills` installs, and `jq` is a hard prerequisite for the Cursor variant. +- Cursor can use the Cursor Superpowers plugin cache or manual `.cursor/skills/superpowers/skills` + / `~/.cursor/skills/superpowers/skills` installs, and `jq` is a hard prerequisite for the + Cursor variant. - OpenCode can use `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers`. -- Shared reviewer runtime (`run-review.sh`) AND Telegram notifier helper (`notify-telegram.sh`) must be installed beside agent skills. Both scripts ship under `skills/reviewer-runtime/` in this repo and must be copied into the per-variant location: +- Shared reviewer runtime (`run-review.sh`) AND Telegram notifier helper (`notify-telegram.sh`) + must be installed beside agent skills. Both scripts ship under `skills/reviewer-runtime/` in this + repo and must be copied into the per-variant location: - Codex: `~/.codex/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` - Claude Code: `~/.claude/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` - OpenCode: `~/.config/opencode/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` - - Cursor: `.cursor/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` (repo-local, preferred) or `~/.cursor/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` (global fallback) - - Pi: `.pi/skills/reviewer-runtime/pi/{run-review.sh,notify-telegram.sh}` (repo-local) or `~/.pi/agent/skills/reviewer-runtime/pi/{run-review.sh,notify-telegram.sh}` (global) + - Cursor: `.cursor/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` (repo-local, + preferred) or `~/.cursor/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` + (global fallback) + - Pi: `.pi/skills/reviewer-runtime/pi/{run-review.sh,notify-telegram.sh}` (repo-local) or + `~/.pi/agent/skills/reviewer-runtime/pi/{run-review.sh,notify-telegram.sh}` (global) - Variant-specific prerequisites: - **Claude Code:** `claude --version`, explicit `Skill`-tool invocation of sub-skills. - **Codex:** `codex --version`; `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` symlink present. - - **Cursor:** `cursor-agent --version`, `jq --version` (hard prereq), Superpowers available from the Cursor plugin cache or manual Cursor skill roots. - - **OpenCode:** `opencode --version`; Superpowers available from `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers`; Phase 1 runs Bootstrap Superpowers Context. + - **Cursor:** `cursor-agent --version`, `jq --version` (hard prereq), Superpowers available + from the Cursor plugin cache or manual Cursor skill roots. + - **OpenCode:** `opencode --version`; Superpowers available from `~/.agents/skills/superpowers` + or `~/.config/opencode/skills/superpowers`; Phase 1 runs Bootstrap Superpowers Context. - Telegram notification setup is documented in [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) Dependency-missing messages are variant-specific: -- **Claude Code:** `Missing dependency: [specific missing item]. Install required Superpowers skills (https://github.com/obra/superpowers) and the reviewer-runtime helper, then retry.` -- **Codex:** `Missing dependency: [specific missing item]. Install required Superpowers skills (https://github.com/obra/superpowers) and the reviewer-runtime helper, then retry.` -- **Cursor:** `Missing dependency: [specific missing item]. Install Cursor Agent CLI, jq, and the Cursor Superpowers plugin or Superpowers skills under .cursor/skills/ or ~/.cursor/skills/, then retry.` -- **OpenCode:** `Missing dependency: [specific missing item]. Install required OpenCode Superpowers skills (https://github.com/obra/superpowers, OpenCode setup) and the reviewer-runtime helper, then retry.` -- **Pi:** `Missing dependency: [specific missing item]. Install Pi, required Superpowers skills, and the Pi reviewer-runtime helper, then retry.` +- **Claude Code:** `Missing dependency: [specific missing item]. Install required Superpowers + skills (https://github.com/obra/superpowers) and the reviewer-runtime helper, then retry.` +- **Codex:** `Missing dependency: [specific missing item]. Install required Superpowers skills + (https://github.com/obra/superpowers) and the reviewer-runtime helper, then retry.` +- **Cursor:** `Missing dependency: [specific missing item]. Install Cursor Agent CLI, jq, and the + Cursor Superpowers plugin or Superpowers skills under .cursor/skills/ or ~/.cursor/skills/, + then retry.` +- **OpenCode:** `Missing dependency: [specific missing item]. Install required OpenCode + Superpowers skills (https://github.com/obra/superpowers, OpenCode setup) and the + reviewer-runtime helper, then retry.` +- **Pi:** `Missing dependency: [specific missing item]. Install Pi, required Superpowers skills, + and the Pi reviewer-runtime helper, then retry.` ### Reviewer CLI Requirements -One of these CLIs must be installed to drive either of the two review loops: +The canonical reviewer CLI support matrix is documented in +[REVIEWERS.md](./REVIEWERS.md). One of these CLIs must be installed to drive either of the two +review loops: | Reviewer CLI | Install | Verify | Read-Only Mode | Session Resume | |---|---|---|---|---| @@ -53,9 +77,12 @@ One of these CLIs must be installed to drive either of the two review loops: | `opencode` | `brew install opencode` or your package manager | `opencode --version` | `--agent plan` | Opt-in (`-s `; fresh call is the default) | | `pi` | Install Pi coding agent | `pi --version`; list models with `pi --list-models [search]` | `--tools read,grep,find,ls` | No (fresh call each round) | -The reviewer CLI is independent of which agent is running the skill — e.g., Claude Code can send both the plan and the implementation to Codex for review. +The reviewer CLI is independent of which agent is running the skill — e.g., Claude Code can send +both the plan and the implementation to Codex for review. -**Additional dependency for `cursor` reviewer:** `jq` is required to parse Cursor's JSON output. Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. The cursor variant of `do-task` makes `jq` a hard prerequisite regardless of which reviewer CLI is selected. +**Additional dependency for `cursor` reviewer:** `jq` is required to parse Cursor's JSON output. +Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. The cursor +variant of `do-task` makes `jq` a hard prerequisite regardless of which reviewer CLI is selected. ## Install @@ -124,7 +151,7 @@ Recommended full Pi package install: Manual single-skill Pi install from the package mirror: ```bash -./scripts/sync-pi-package-skills.sh +pnpm run sync:pi mkdir -p .pi/skills/do-task cp -R pi-package/skills/do-task/* .pi/skills/do-task/ mkdir -p .pi/skills/reviewer-runtime/pi @@ -138,9 +165,11 @@ Pi workflow skills also require Superpowers. See [PI-SUPERPOWERS.md](./PI-SUPERP ## Verify Installation -Run the per-variant checks for everything the corresponding `SKILL.md` enforces. Each check is structured: (1) CLI binary version, (2) skill file presence, (3) reviewer-runtime + notifier helper presence, (4) Superpowers sub-skill discovery, (5) variant-specific extras. +Run the per-variant checks for everything the corresponding `SKILL.md` enforces. Each check is +structured: (1) CLI binary version, (2) skill file presence, (3) reviewer-runtime + notifier +helper presence, (4) Superpowers sub-skill discovery, (5) variant-specific extras. -### Codex +### Codex Verify ```bash codex --version @@ -154,7 +183,7 @@ test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md ``` -### Claude Code +### Claude Code Verify ```bash claude --version @@ -167,7 +196,7 @@ test -f ~/.claude/skills/superpowers/verification-before-completion/SKILL.md test -f ~/.claude/skills/superpowers/finishing-a-development-branch/SKILL.md ``` -### OpenCode +### OpenCode Verify ```bash opencode --version @@ -180,7 +209,7 @@ test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md || test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md || test -f ~/.config/opencode/skills/superpowers/finishing-a-development-branch/SKILL.md ``` -### Cursor +### Cursor Verify ```bash cursor-agent --version @@ -194,7 +223,7 @@ test -f .cursor/skills/superpowers/skills/verification-before-completion/SKILL.m test -f .cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/finishing-a-development-branch/SKILL.md' -print -quit 2>/dev/null | grep -q . ``` -### Pi +### Pi Verify ```bash pi --version @@ -210,26 +239,44 @@ test -f .pi/skills/superpowers/finishing-a-development-branch/SKILL.md || test - ## Key Behavior - Creates one persistent plan artifact at `ai_plan/YYYY-MM-DD-/task-plan.md`. -- Ensures `/ai_plan/` is in `.gitignore`. If missing, adds it and creates a separate `chore(gitignore): ignore ai_plan local planning artifacts` commit. -- Parses the user prompt, detects the trigger phrase, and asks 1-3 clarifying questions unless the prompt already has a concrete target + outcome + unambiguous scope + resolvable identifiers. -- Invokes `superpowers:brainstorming` for any behavior-changing task (feature creation, non-trivial bug fix, refactor, design decision). The only skip conditions are `pure-documentation` and `pure-comment-whitespace-rename`. -- Asks which reviewer CLI, model, and max rounds to use (or accepts `skip` for no review). "Use defaults" maps to `codex / gpt-5.4 / MAX_ROUNDS=10`. -- Runs the plan review loop (Phase 5) before implementation, iterating up to `MAX_ROUNDS` (default 10) or until the reviewer returns `VERDICT: APPROVED`. -- Executes with TDD-first (Phase 6) via `superpowers:test-driven-development`. Auto-skip permitted only for `pure-documentation` and `pure-comment-whitespace-rename`; all other skips (including config-file additions) require explicit user approval, recorded in the TDD Approach section with an ISO-8601 timestamp. +- Ensures `/ai_plan/` is in `.gitignore`. If missing, adds it and creates a separate + `chore(gitignore): ignore ai_plan local planning artifacts` commit. +- Parses the user prompt, detects the trigger phrase, and asks 1-3 clarifying questions unless + the prompt already has a concrete target + outcome + unambiguous scope + resolvable identifiers. +- Invokes `superpowers:brainstorming` for any behavior-changing task (feature creation, + non-trivial bug fix, refactor, design decision). The only skip conditions are + `pure-documentation` and `pure-comment-whitespace-rename`. +- Asks which reviewer CLI, model, and max rounds to use (or accepts `skip` for no review). + "Use defaults" maps to `codex / gpt-5.4 / MAX_ROUNDS=10`. +- Runs the plan review loop (Phase 5) before implementation, iterating up to `MAX_ROUNDS` + (default 10) or until the reviewer returns `VERDICT: APPROVED`. +- Executes with TDD-first (Phase 6) via `superpowers:test-driven-development`. Auto-skip + permitted only for `pure-documentation` and `pure-comment-whitespace-rename`; all other skips + (including config-file additions) require explicit user approval, recorded in the TDD Approach + section with an ISO-8601 timestamp. - Runs lint/typecheck/tests as a **verification gate** (Phase 7) before the implementation review loop. -- Runs the implementation review loop (Phase 8) against the diff + verification output, iterating up to `MAX_ROUNDS` or until `APPROVED`. +- Runs the implementation review loop (Phase 8) against the diff + verification output, + iterating up to `MAX_ROUNDS` or until `APPROVED`. - Scans every outbound reviewer payload for secrets (subroutine step 1a). Per-payload, no caching. -- Creates a **single commit** after the implementation review approves. Does NOT push. Asks the user for explicit `yes` before any push. -- Defaults to the **current branch**. Worktree only on explicit opt-in (`"in a worktree"`, `"use a worktree"`, `"on an isolated branch"`, `"on a new branch called X"`). +- Creates a **single commit** after the implementation review approves. Does NOT push. Asks the + user for explicit `yes` before any push. +- Defaults to the **current branch**. Worktree only on explicit opt-in (`"in a worktree"`, + `"use a worktree"`, `"on an isolated branch"`, `"on a new branch called X"`). - Supports resume: detects existing folder by slug and uses `Status` + Runtime State to decide how to re-enter. -- Sends completion notifications through Telegram only when the shared setup in [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) is installed and configured. +- Sends completion notifications through Telegram only when the shared setup in + [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) is installed and configured. ## Dual Review Loops `do-task` runs the reviewer twice per successful run, with separate session IDs so reviewer context never leaks across loops. -1. **Plan review loop (Phase 5)** — payload is the current `task-plan.md` with `Runtime State` and `Review History` stripped. The reviewer evaluates whether the plan matches the prompt, whether assumptions are surfaced, whether acceptance criteria are testable, whether the TDD approach is appropriate, and whether there are missing files/risks/security concerns. -2. **Implementation review loop (Phase 8)** — payload is the approved task plan (without Runtime State) + `git diff` (unstaged + staged) + verification output (lint, typecheck, tests). The reviewer evaluates correctness, code quality, test coverage, security, and regression risk. +1. **Plan review loop (Phase 5)** — payload is the current `task-plan.md` with `Runtime State` + and `Review History` stripped. The reviewer evaluates whether the plan matches the prompt, + whether assumptions are surfaced, whether acceptance criteria are testable, whether the TDD + approach is appropriate, and whether there are missing files/risks/security concerns. +2. **Implementation review loop (Phase 8)** — payload is the approved task plan (without Runtime + State) + `git diff` (unstaged + staged) + verification output (lint, typecheck, tests). The + reviewer evaluates correctness, code quality, test coverage, security, and regression risk. Both loops share the same 9-step subroutine and the same `MAX_ROUNDS` counter (default 10). @@ -239,7 +286,10 @@ Both loops share the same 9-step subroutine and the same `MAX_ROUNDS` counter (d 2. **Secret scan (step 1a)** — per-payload, no caching. See Secret Scan section below. 3. Generate reviewer command script at `/tmp/do-task--review-.sh`. 4. Run via `reviewer-runtime/run-review.sh`. -5. Promote reviewer output and capture the session ID on Round 1; persist it to `task-plan.md` Runtime State under the loop-specific variable (`CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, or `OPENCODE_IMPL_SESSION_ID`). +5. Promote reviewer output and capture the session ID on Round 1; persist it to `task-plan.md` + Runtime State under the loop-specific variable (`CODEX_PLAN_SESSION_ID`, + `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, + `OPENCODE_PLAN_SESSION_ID`, or `OPENCODE_IMPL_SESSION_ID`). 6. Parse verdict; append an entry to Review History; bump the round counter. 7. Branch: `APPROVED` → exit, `REVISE` → caller revises and re-enters, `MAX_ROUNDS` → caller decides. 8. Liveness contract: wait while `In progress N` heartbeats arrive from the runner. @@ -274,7 +324,8 @@ ts= level= state=/task-plan.md`. Its `Status` enu ## Failure Handling -- `completed-empty-output` — the reviewer exited without producing review text; surface `.stderr` and `.status`, then retry only after diagnosing the cause. -- `needs-operator-decision` — the helper reached hard-timeout escalation; surface `.status` and decide whether to extend the timeout, abort, or retry with different parameters. -- Successful rounds clean up temp artifacts. Failed, empty-output, and operator-decision rounds retain `.stderr`, `.status`, and `.runner.out` until diagnosed. -- Verification gate (Phase 7) retries up to 3 times. On exhaustion, `Status` becomes `aborted-verification` and the user is asked whether to retry, override, or abort. +- `completed-empty-output` — the reviewer exited without producing review text; surface + `.stderr` and `.status`, then retry only after diagnosing the cause. +- `needs-operator-decision` — the helper reached hard-timeout escalation; surface `.status` + and decide whether to extend the timeout, abort, or retry with different parameters. +- Successful rounds clean up temp artifacts. Failed, empty-output, and operator-decision rounds + retain `.stderr`, `.status`, and `.runner.out` until diagnosed. +- Verification gate (Phase 7) retries up to 3 times. On exhaustion, `Status` becomes + `aborted-verification` and the user is asked whether to retry, override, or abort. - As long as fresh `in-progress` heartbeats continue to arrive roughly once per minute, the caller keeps waiting. ## Secret Scan (subroutine step 1a; per-payload; no caching) -Every outbound reviewer payload is scanned **before** being sent to the reviewer CLI. This scan runs on every round of both loops. No results are cached, because the Phase 8 payload includes newly-introduced diff content that earlier rounds never saw. +Every outbound reviewer payload is scanned **before** being sent to the reviewer CLI. This scan +runs on every round of both loops. No results are cached, because the Phase 8 payload includes +newly-introduced diff content that earlier rounds never saw. Canonical anchored regex list (10 patterns): -``` +```text AWS access key: AKIA[0-9A-Z]{16} GCP service-acct: "type"\s*:\s*"service_account" GitHub tokens: (ghp|gho|ghs|ghu|ghr)_[A-Za-z0-9]{36,} @@ -320,9 +377,14 @@ PEM private keys: -----BEGIN [A-Z ]+ PRIVATE KEY----- JWT: eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ ``` -If a match is found, the skill **redacts the matched text before showing it to the user** using the fixed token `[REDACTED::-chars]` (pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`). File paths and line numbers are kept. Raw match text is never echoed to terminal, chat log, or any persistent file. +If a match is found, the skill **redacts the matched text before showing it to the user** using +the fixed token `[REDACTED::-chars]` (pattern labels: +`aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, +`anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`). File paths and line numbers are kept. +Raw match text is never echoed to terminal, chat log, or any persistent file. The user answers `yes` / `no` / `redact`: + - `yes` — proceed; Runtime State records `last_scan_outcome_=user-approved-with-matches`. - `redact` — the user supplies redactions, the skill applies them, and re-scans before sending. Runtime State records `last_scan_outcome_=redacted-and-approved`. - `no` — stop the loop, set `Status: failed`, send Telegram summary. @@ -343,15 +405,21 @@ For all supported reviewer CLIs, the preferred execution path is: 2. Run that script through `reviewer-runtime/run-review.sh`. 3. Fall back to direct synchronous execution only if the helper is missing or not executable. - - ## Pi Reviewer Support -All workflow variants can use Pi itself as a reviewer CLI. Use `pi/` shorthand, for example `pi/claude-opus-4-7`; this means `REVIEWER_CLI=pi` and `REVIEWER_MODEL=claude-opus-4-7`. Provider-qualified or multi-slash Pi model IDs are preserved after the first `pi/` prefix, for example `pi/anthropic/claude-opus-4-7`. +All workflow variants can use Pi itself as a reviewer CLI. Use `pi/` shorthand, +for example `pi/claude-opus-4-7`; this means `REVIEWER_CLI=pi` and +`REVIEWER_MODEL=claude-opus-4-7`. Provider-qualified or multi-slash Pi model IDs are preserved +after the first `pi/` prefix, for example `pi/anthropic/claude-opus-4-7`. -The canonical isolated read-only Pi reviewer flag contract lives in [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). This workflow passes the plan and implementation review payload at `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` and expects the standard `## Summary`, `## Findings`, and `## Verdict` response. Pi reviewer output is captured as markdown stdout, not JSON. +The canonical isolated read-only Pi reviewer flag contract lives in +[PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). This workflow passes the plan and +implementation review payload at `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` and expects the +standard `## Summary`, `## Findings`, and `## Verdict` response. Pi reviewer output is captured +as markdown stdout, not JSON. -If the Pi reviewer model or provider is unavailable, surface the helper stderr/status and use `pi --list-models [search]` to inspect configured models. +If the Pi reviewer model or provider is unavailable, surface the helper stderr/status and use +`pi --list-models [search]` to inspect configured models. ## Notifications @@ -359,7 +427,8 @@ If the Pi reviewer model or provider is unavailable, surface the helper stderr/s - Shared setup: [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, the skill sends a Telegram summary first if configured. -- Terminal outcomes that trigger Telegram: `pushed`, `local-only`, `aborted-plan-review`, `aborted-impl-review`, `aborted-verification`, `failed`. +- Terminal outcomes that trigger Telegram: `pushed`, `local-only`, `aborted-plan-review`, + `aborted-impl-review`, `aborted-verification`, `failed`. The reviewer-runtime helper also supports manual override flags for diagnostics: @@ -377,7 +446,9 @@ run-review.sh \ ## Template Guardrails -All four `templates/task-plan.md` files share identical core sections (14 `## `-level headings) and identical Status enum (10 values). Variant-specific guardrail language is permitted in the leading blockquote and in the `Runtime` field of the Metadata table. +All four `templates/task-plan.md` files share identical core sections (14 `##`-level headings) +and identical Status enum (10 values). Variant-specific guardrail language is permitted in the +leading blockquote and in the `Runtime` field of the Metadata table. **Core sections** (appear in every variant, same order): @@ -396,11 +467,15 @@ All four `templates/task-plan.md` files share identical core sections (14 `## `- 13. Final Status 14. Guardrails (do NOT remove) -**Runtime State keys** (same across all variants): `plan_review_round`, `implementation_review_round`, `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, `last_phase_entered`, `last_round_ts`, `last_scan_outcome_plan`, `last_scan_outcome_impl`, `verification_attempts`, `tests_added_count`, `tdd_used`. +**Runtime State keys** (same across all variants): `plan_review_round`, +`implementation_review_round`, `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, +`CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, +`OPENCODE_IMPL_SESSION_ID`, `last_phase_entered`, `last_round_ts`, `last_scan_outcome_plan`, +`last_scan_outcome_impl`, `verification_attempts`, `tests_added_count`, `tdd_used`. ## Variant Hardening Notes -### Claude Code +### Claude Code Hardening - Must invoke explicit required sub-skills via the `Skill` tool: - `superpowers:brainstorming` @@ -411,7 +486,7 @@ All four `templates/task-plan.md` files share identical core sections (14 `## `- - Must enforce plan-mode file-write guard in Phase 4: - If currently in plan mode, instruct user to exit plan mode before writing `task-plan.md`. -### Codex +### Codex Hardening - Must use native skill discovery from `~/.agents/skills/` (no CLI wrappers). - Must verify Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` @@ -422,22 +497,25 @@ All four `templates/task-plan.md` files share identical core sections (14 `## `- - Helper paths: `~/.codex/skills/reviewer-runtime/...`. - No plan-mode guard (Codex has no plan-mode concept). -### OpenCode +### OpenCode Hardening -- Must use OpenCode's native skill tool (not Claude's `Skill` tool syntax). OpenCode may load shared skill files from `~/.agents/skills/`, but invocation is still OpenCode-native. -- Phase 1 includes a Bootstrap Superpowers Context step that lists installed skills and confirms the required `superpowers/` set is discoverable before any other phase runs. +- Must use OpenCode's native skill tool (not Claude's `Skill` tool syntax). OpenCode may load + shared skill files from `~/.agents/skills/`, but invocation is still OpenCode-native. +- Phase 1 includes a Bootstrap Superpowers Context step that lists installed skills and confirms + the required `superpowers/` set is discoverable before any other phase runs. - Must verify Superpowers skill discovery under `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers`. - Helper paths: `~/.config/opencode/skills/reviewer-runtime/...`. - Opencode reviewer calls MUST use `--agent plan` (the built-in plan primary agent) for read-only posture. - No plan-mode guard (OpenCode has no plan-mode concept). -### Cursor +### Cursor Hardening - Must use Cursor-native discovery from `.cursor/skills/`, `~/.cursor/skills/`, or installed Cursor plugin cache entries. - Must announce skill usage explicitly before invocation. - `jq` is a hard prerequisite. - Helper paths: `.cursor/skills/reviewer-runtime/...` preferred, `~/.cursor/skills/reviewer-runtime/...` fallback. -- Reviewer invocations MUST use `--mode=ask --trust --output-format json`. Never `--mode=agent`, never `--force`, never write-capable modes for reviewer calls. +- Reviewer invocations MUST use `--mode=ask --trust --output-format json`. Never `--mode=agent`, + never `--force`, never write-capable modes for reviewer calls. - No plan-mode guard (Cursor has no plan-mode concept). ## Execution Workflow Rules @@ -447,7 +525,8 @@ All four `templates/task-plan.md` files share identical core sections (14 `## `- - Plan review completes before any implementation starts. - Phase 7 verification gate must pass before the implementation review starts. - The task commit is a single commit created in Phase 9. -- The `.gitignore` infra commit (Phase 1) is explicitly separate from the task commit and is allowed even when the final task ends up `aborted` or `failed`. +- The `.gitignore` infra commit (Phase 1) is explicitly separate from the task commit and is + allowed even when the final task ends up `aborted` or `failed`. - No push without explicit `yes` from the user. - Secret scan runs per-payload with no caching. - `MAX_ROUNDS=10` is shared across both loops (single mental model). diff --git a/docs/IMPLEMENT-PLAN.md b/docs/IMPLEMENT-PLAN.md index de54920..1b1ef7b 100644 --- a/docs/IMPLEMENT-PLAN.md +++ b/docs/IMPLEMENT-PLAN.md @@ -2,7 +2,10 @@ ## Purpose -Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. Milestones are implemented one-by-one with lint/typecheck/test gates, reviewed by a second model/provider, and committed locally until all are approved. +Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative +cross-model review at each milestone boundary. Milestones are implemented one-by-one with +lint/typecheck/test gates, reviewed by a second model/provider, and committed locally until all +are approved. ## Requirements @@ -19,7 +22,8 @@ Execute an existing plan (created by `create-plan`) in an isolated git worktree, - `superpowers:finishing-a-development-branch` - For Codex, native skill discovery must be configured: - `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` -- Cursor can use the Cursor Superpowers plugin cache or manual `.cursor/skills/superpowers/skills` / `~/.cursor/skills/superpowers/skills` installs. +- Cursor can use the Cursor Superpowers plugin cache or manual `.cursor/skills/superpowers/skills` + / `~/.cursor/skills/superpowers/skills` installs. - OpenCode can use `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers`. - Shared reviewer runtime must be installed beside agent skills when using reviewer CLIs: - Codex: `~/.codex/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}` @@ -35,7 +39,9 @@ If dependencies are missing, stop and return: ### Reviewer CLI Requirements (Optional) -To use the iterative milestone review feature, one of these CLIs must be installed: +The canonical reviewer CLI support matrix is documented in +[REVIEWERS.md](./REVIEWERS.md). To use the iterative milestone review feature, one of these CLIs +must be installed: | Reviewer CLI | Install | Verify | |---|---|---| @@ -45,9 +51,11 @@ To use the iterative milestone review feature, one of these CLIs must be install | `opencode` | `brew install opencode` or your package manager | `opencode --version` | | `pi` | Install Pi coding agent | `pi --version`; list models with `pi --list-models [search]` | -The reviewer CLI is independent of which agent is running the implementation — e.g., Claude Code can send milestones to Codex for review, and vice versa. +The reviewer CLI is independent of which agent is running the implementation — e.g., Claude Code +can send milestones to Codex for review, and vice versa. -**Additional dependency for `cursor` reviewer:** `jq` is required to parse Cursor's JSON output. Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. +**Additional dependency for `cursor` reviewer:** `jq` is required to parse Cursor's JSON output. +Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. ## Install @@ -116,7 +124,7 @@ Recommended full Pi package install: Manual single-skill Pi install from the package mirror: ```bash -./scripts/sync-pi-package-skills.sh +pnpm run sync:pi mkdir -p .pi/skills/implement-plan cp -R pi-package/skills/implement-plan/* .pi/skills/implement-plan/ mkdir -p .pi/skills/reviewer-runtime/pi @@ -124,7 +132,8 @@ cp -R skills/reviewer-runtime/pi/* .pi/skills/reviewer-runtime/pi/ chmod +x .pi/skills/reviewer-runtime/pi/*.sh ``` -Global manual installs use `~/.pi/agent/skills/implement-plan/` and `~/.pi/agent/skills/reviewer-runtime/pi/` instead of `.pi/skills/...`. +Global manual installs use `~/.pi/agent/skills/implement-plan/` and +`~/.pi/agent/skills/reviewer-runtime/pi/` instead of `.pi/skills/...`. Pi workflow skills also require Superpowers. See [PI-SUPERPOWERS.md](./PI-SUPERPOWERS.md) and [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). @@ -157,14 +166,30 @@ Verify Superpowers execution dependencies exist in your agent skills root: - OpenCode: `~/.agents/skills/superpowers/using-git-worktrees/SKILL.md` or `~/.config/opencode/skills/superpowers/using-git-worktrees/SKILL.md` - OpenCode: `~/.agents/skills/superpowers/verification-before-completion/SKILL.md` or `~/.config/opencode/skills/superpowers/verification-before-completion/SKILL.md` - OpenCode: `~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md` or `~/.config/opencode/skills/superpowers/finishing-a-development-branch/SKILL.md` -- Cursor: `.cursor/skills/superpowers/skills/executing-plans/SKILL.md`, `~/.cursor/skills/superpowers/skills/executing-plans/SKILL.md`, or the Cursor Superpowers plugin cache -- Cursor: `.cursor/skills/superpowers/skills/using-git-worktrees/SKILL.md`, `~/.cursor/skills/superpowers/skills/using-git-worktrees/SKILL.md`, or the Cursor Superpowers plugin cache -- Cursor: `.cursor/skills/superpowers/skills/verification-before-completion/SKILL.md`, `~/.cursor/skills/superpowers/skills/verification-before-completion/SKILL.md`, or the Cursor Superpowers plugin cache -- Cursor: `.cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md`, `~/.cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md`, or the Cursor Superpowers plugin cache -- Pi: `.pi/skills/superpowers/executing-plans/SKILL.md` or `~/.pi/agent/skills/superpowers/executing-plans/SKILL.md` or `~/.agents/skills/superpowers/executing-plans/SKILL.md` -- Pi: `.pi/skills/superpowers/using-git-worktrees/SKILL.md` or `~/.pi/agent/skills/superpowers/using-git-worktrees/SKILL.md` or `~/.agents/skills/superpowers/using-git-worktrees/SKILL.md` -- Pi: `.pi/skills/superpowers/verification-before-completion/SKILL.md` or `~/.pi/agent/skills/superpowers/verification-before-completion/SKILL.md` or `~/.agents/skills/superpowers/verification-before-completion/SKILL.md` -- Pi: `.pi/skills/superpowers/finishing-a-development-branch/SKILL.md` or `~/.pi/agent/skills/superpowers/finishing-a-development-branch/SKILL.md` or `~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md` +- Cursor: `.cursor/skills/superpowers/skills/executing-plans/SKILL.md`, + `~/.cursor/skills/superpowers/skills/executing-plans/SKILL.md`, or the Cursor Superpowers + plugin cache +- Cursor: `.cursor/skills/superpowers/skills/using-git-worktrees/SKILL.md`, + `~/.cursor/skills/superpowers/skills/using-git-worktrees/SKILL.md`, or the Cursor Superpowers + plugin cache +- Cursor: `.cursor/skills/superpowers/skills/verification-before-completion/SKILL.md`, + `~/.cursor/skills/superpowers/skills/verification-before-completion/SKILL.md`, or the Cursor + Superpowers plugin cache +- Cursor: `.cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md`, + `~/.cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md`, or the Cursor + Superpowers plugin cache +- Pi: `.pi/skills/superpowers/executing-plans/SKILL.md` or + `~/.pi/agent/skills/superpowers/executing-plans/SKILL.md` or + `~/.agents/skills/superpowers/executing-plans/SKILL.md` +- Pi: `.pi/skills/superpowers/using-git-worktrees/SKILL.md` or + `~/.pi/agent/skills/superpowers/using-git-worktrees/SKILL.md` or + `~/.agents/skills/superpowers/using-git-worktrees/SKILL.md` +- Pi: `.pi/skills/superpowers/verification-before-completion/SKILL.md` or + `~/.pi/agent/skills/superpowers/verification-before-completion/SKILL.md` or + `~/.agents/skills/superpowers/verification-before-completion/SKILL.md` +- Pi: `.pi/skills/superpowers/finishing-a-development-branch/SKILL.md` or + `~/.pi/agent/skills/superpowers/finishing-a-development-branch/SKILL.md` or + `~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md` ## Key Behavior @@ -173,14 +198,17 @@ Verify Superpowers execution dependencies exist in your agent skills root: - Executes milestones one-by-one, tracking stories in `story-tracker.md`. - Runs lint/typecheck/tests as a gate before each milestone review. - Sends each milestone to a reviewer CLI for approval (max rounds configurable, default 10). -- Runs reviewer commands through `reviewer-runtime/run-review.sh` when available, with fallback to direct synchronous execution only if the helper is missing. +- Runs reviewer commands through `reviewer-runtime/run-review.sh` when available, with fallback to + direct synchronous execution only if the helper is missing. - Waits as long as the reviewer runtime keeps emitting per-minute `In progress N` heartbeats. - Requires reviewer findings to be ordered `P0` through `P3`, with `P3` explicitly non-blocking. -- Captures reviewer stderr and helper status logs for diagnostics and retains them on failed, empty-output, or operator-decision review rounds. +- Captures reviewer stderr and helper status logs for diagnostics and retains them on failed, + empty-output, or operator-decision review rounds. - Commits each milestone locally only after reviewer approval (does not push). - After all milestones approved, merges worktree branch to parent and deletes worktree. - Supports resume: detects existing worktree and `in-dev`/`completed` stories. -- Sends completion notifications through Telegram only when the shared setup in [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) is installed and configured. +- Sends completion notifications through Telegram only when the shared setup in + [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) is installed and configured. ## Milestone Review Loop @@ -189,7 +217,8 @@ After each milestone is implemented and verified, the skill sends it to a second 1. **Configure** — user picks a reviewer CLI (`codex`, `claude`, `cursor`, `opencode`, `pi`) and model, or skips 2. **Prepare** — milestone payload and a bash reviewer command script are written to temp files 3. **Run** — the command script is executed through `reviewer-runtime/run-review.sh` when installed -4. **Feedback** — reviewer evaluates correctness, acceptance criteria, code quality, test coverage, security, and returns `## Summary`, `## Findings`, and `## Verdict` +4. **Feedback** — reviewer evaluates correctness, acceptance criteria, code quality, test coverage, + security, and returns `## Summary`, `## Findings`, and `## Verdict` 5. **Prioritize** — findings are ordered `P0`, `P1`, `P2`, `P3` 6. **Revise** — the implementing agent addresses findings in priority order, re-verifies, and re-submits 7. **Repeat** — up to max rounds (default 10) until the reviewer returns `VERDICT: APPROVED` @@ -224,13 +253,17 @@ ts= level= state=` shorthand, for example `pi/claude-opus-4-7`; this means `REVIEWER_CLI=pi` and `REVIEWER_MODEL=claude-opus-4-7`. Provider-qualified or multi-slash Pi model IDs are preserved after the first `pi/` prefix, for example `pi/anthropic/claude-opus-4-7`. +All workflow variants can use Pi itself as a reviewer CLI. Use `pi/` shorthand, for +example `pi/claude-opus-4-7`; this means `REVIEWER_CLI=pi` and `REVIEWER_MODEL=claude-opus-4-7`. +Provider-qualified or multi-slash Pi model IDs are preserved after the first `pi/` prefix, for +example `pi/anthropic/claude-opus-4-7`. -The canonical isolated read-only Pi reviewer flag contract lives in [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). This workflow passes the milestone review payload at `/tmp/milestone-${REVIEW_ID}.md` and expects the standard `## Summary`, `## Findings`, and `## Verdict` response. Pi reviewer output is captured as markdown stdout, not JSON. +The canonical isolated read-only Pi reviewer flag contract lives in +[PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). This workflow passes the milestone review +payload at `/tmp/milestone-${REVIEW_ID}.md` and expects the standard `## Summary`, +`## Findings`, and `## Verdict` response. Pi reviewer output is captured as markdown stdout, +not JSON. -If the Pi reviewer model or provider is unavailable, surface the helper stderr/status and use `pi --list-models [search]` to inspect configured models. +If the Pi reviewer model or provider is unavailable, surface the helper stderr/status and use +`pi --list-models [search]` to inspect configured models. ## Notifications @@ -282,7 +321,7 @@ run-review.sh \ ## Variant Hardening Notes -### Claude Code +### Claude Code Hardening - Must invoke explicit required sub-skills: - `superpowers:executing-plans` @@ -290,7 +329,7 @@ run-review.sh \ - `superpowers:verification-before-completion` - `superpowers:finishing-a-development-branch` -### Codex +### Codex Hardening - Must use native skill discovery from `~/.agents/skills/` (no CLI wrappers). - Must verify Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` @@ -298,7 +337,7 @@ run-review.sh \ - Must track checklist-driven skills with `update_plan` todos. - Deprecated CLI commands (`superpowers-codex bootstrap`, `use-skill`) must NOT be used. -### OpenCode +### OpenCode Hardening - Must use OpenCode native skill tool (not Claude/Codex invocation syntax). - Must verify Superpowers skill discovery under: @@ -306,7 +345,7 @@ run-review.sh \ - `~/.config/opencode/skills/superpowers` - Must explicitly load all four execution sub-skills. -### Cursor +### Cursor Hardening - Must use Cursor-native discovery from `.cursor/skills/`, `~/.cursor/skills/`, or installed Cursor plugin cache entries. - Must announce skill usage explicitly before invocation. diff --git a/docs/INSTALLER.md b/docs/INSTALLER.md index 164781a..8f7def1 100644 --- a/docs/INSTALLER.md +++ b/docs/INSTALLER.md @@ -1,6 +1,7 @@ # Skill Manager Installer -Use the skill manager wizard to install, update/reinstall, or remove skills from this repository for supported local coding clients. +Use the skill manager wizard to install, update/reinstall, or remove skills from this repository +for supported local coding clients. ## Quick Start @@ -58,9 +59,12 @@ Workflow skills require Obra Superpowers: - `create-plan`: `brainstorming`, `writing-plans` - `implement-plan`: `executing-plans`, `using-git-worktrees`, `verification-before-completion`, `finishing-a-development-branch` -- `do-task`: `brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch` plus conditional `using-git-worktrees` +- `do-task`: `brainstorming`, `test-driven-development`, `verification-before-completion`, + `finishing-a-development-branch` plus conditional `using-git-worktrees` -When a selected install/update needs Superpowers and none are detected for the target client/scope, the wizard asks whether to install them. It asks for an absolute path to an Obra Superpowers `skills` directory and lets you choose symlink or copy: +When a selected install/update needs Superpowers and none are detected for the target client/scope, +the wizard asks whether to install them. It asks for an absolute path to an Obra Superpowers +`skills` directory and lets you choose symlink or copy: - symlink is recommended because updates to the source checkout are immediately visible - copy is more self-contained but must be updated manually @@ -69,13 +73,19 @@ The wizard recognizes client-native and plugin-managed Superpowers installs befo - Codex: `~/.agents/skills/superpowers` or `~/.codex/superpowers/skills` - Claude Code: `~/.claude/skills/superpowers` or the enabled `superpowers@claude-plugins-official` plugin cache -- Cursor: `.cursor/skills/superpowers/skills`, `~/.cursor/skills/superpowers/skills`, or the Cursor public Superpowers plugin cache +- Cursor: `.cursor/skills/superpowers/skills`, `~/.cursor/skills/superpowers/skills`, + or the Cursor public Superpowers plugin cache - OpenCode: `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers` - Pi: `~/.agents/skills/superpowers`, `~/.pi/agent/skills/superpowers`, or `.pi/skills/superpowers` -When Cursor has no plugin/cache install, the wizard installs Superpowers at `/superpowers/skills` because Cursor variants expect `superpowers/skills//SKILL.md`. Symlinking is still preferred when the source tree is managed locally. Codex and OpenCode can commonly reuse the shared `~/.agents/skills/superpowers` convention documented in [CODEX.md](./CODEX.md) and [OPENCODE.md](./OPENCODE.md). +When Cursor has no plugin/cache install, the wizard installs Superpowers at +`/superpowers/skills` because Cursor variants expect +`superpowers/skills//SKILL.md`. Symlinking is still preferred when the source tree is +managed locally. Codex and OpenCode can commonly reuse the shared `~/.agents/skills/superpowers` +convention documented in [CODEX.md](./CODEX.md) and [OPENCODE.md](./OPENCODE.md). -When removing the last repository workflow skill from a client/scope, the wizard asks whether to remove Superpowers for that variant too. +When removing the last repository workflow skill from a client/scope, the wizard asks whether to +remove Superpowers for that variant too. ## Reviewer Runtime Helpers @@ -87,7 +97,9 @@ Workflow skills install/update the reviewer-runtime helper bundle automatically ## Pi Package Mode -Pi can be managed as a package install or by manual skill copy. Package mode always manages the full Pi bundle; per-skill prompts and `--skill` narrowing are ignored for `packageGlobal` and `packageLocal`. +Pi can be managed as a package install or by manual skill copy. Package mode always manages the +full Pi bundle; per-skill prompts and `--skill` narrowing are ignored for `packageGlobal` and +`packageLocal`. Package-mode actions: @@ -148,6 +160,8 @@ The final report uses these columns: Exit code is non-zero if any selected operation fails. -Dangling symlink warnings are surfaced as `warning` rows. For example, if a previously symlinked Superpowers source has moved or been deleted, the final report keeps the operation non-destructive and shows the dangling symlink target in `details` so you can repair or remove it deliberately. +Dangling symlink warnings are surfaced as `warning` rows. For example, if a previously symlinked +Superpowers source has moved or been deleted, the final report keeps the operation non-destructive +and shows the dangling symlink target in `details` so you can repair or remove it deliberately. See [PI.md](./PI.md) for Pi package layout details and mirror maintenance. diff --git a/docs/PI-COMMON-REVIEWER.md b/docs/PI-COMMON-REVIEWER.md index 702e272..552a314 100644 --- a/docs/PI-COMMON-REVIEWER.md +++ b/docs/PI-COMMON-REVIEWER.md @@ -4,11 +4,15 @@ This document covers the shared reviewer-runtime helpers used by the Pi workflow skills. -It is intentionally separate from [PI-SUPERPOWERS.md](./PI-SUPERPOWERS.md). Superpowers are skill dependencies; reviewer-runtime is helper-script setup. +It is intentionally separate from [PI-SUPERPOWERS.md](./PI-SUPERPOWERS.md). Superpowers are +skill dependencies; reviewer-runtime is helper-script setup. ## Pi As A Reviewer CLI -Pi workflow skills may use `pi` itself as the reviewer CLI, even when the main workflow is already running in pi. In that case, the reviewer model is configured independently from the running agent model. This lets the operator run a workflow with one model while asking another pi-configured model, including provider-qualified model IDs, to review the plan or implementation. +Pi workflow skills may use `pi` itself as the reviewer CLI, even when the main workflow is already +running in pi. In that case, the reviewer model is configured independently from the running agent +model. This lets the operator run a workflow with one model while asking another pi-configured +model, including provider-qualified model IDs, to review the plan or implementation. The canonical isolated, read-only reviewer command is: @@ -16,13 +20,16 @@ The canonical isolated, read-only reviewer command is: pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files --model "$REVIEWER_MODEL" --tools read,grep,find,ls -p "Read the review payload and return the requested verdict." ``` -Workflow docs should link to this section instead of restating the full flag contract. Each workflow substitutes its own payload path and verdict prompt: +Workflow docs should link to this section instead of restating the full flag contract. Each +workflow substitutes its own payload path and verdict prompt: - `create-plan`: `/tmp/plan-${REVIEW_ID}.md` - `implement-plan`: `/tmp/milestone-${REVIEW_ID}.md` - `do-task`: `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` -User-facing shorthand `pi/` means `REVIEWER_CLI=pi` and `REVIEWER_MODEL=`. Split only on the first slash when the prefix before that slash is exactly `pi`; keep the remainder verbatim. Examples: +User-facing shorthand `pi/` means `REVIEWER_CLI=pi` and +`REVIEWER_MODEL=`. Split only on the first slash when the prefix before that slash +is exactly `pi`; keep the remainder verbatim. Examples: - `pi/claude-opus-4-7` -> `claude-opus-4-7` - `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7` @@ -31,15 +38,25 @@ User-facing shorthand `pi/` means `REVIEWER_CLI=pi` and `REVIEWER Pi reviewer calls must stay isolated from the main workflow: - Use `--no-session` so the reviewer does not continue or persist the workflow session. -- Use `--no-skills --no-prompt-templates --no-extensions --no-context-files` so the reviewer does not load workflow skills, project context files, or package extensions that could re-enter `create-plan`, `implement-plan`, or `do-task`. -- Use exactly `--tools read,grep,find,ls` for review. The pi reviewer command MUST NOT include `write`, `edit`, or `bash`; the reviewer reads payloads and diffs but never modifies files or runs commands. +- Use `--no-skills --no-prompt-templates --no-extensions --no-context-files` so the reviewer does + not load workflow skills, project context files, or package extensions that could re-enter + `create-plan`, `implement-plan`, or `do-task`. +- Use exactly `--tools read,grep,find,ls` for review. + The pi reviewer command MUST NOT include `write`, `edit`, or `bash`; + the reviewer reads payloads and diffs but never modifies files or runs commands. -If the reviewer subprocess exits non-zero because the provider, credentials, or model ID are unavailable, surface the captured stderr/status from `run-review.sh`, then ask the user for a configured reviewer model. Use `pi --list-models [search]` to inspect available configured models when needed. +If the reviewer subprocess exits non-zero because the provider, credentials, or model ID are +unavailable, surface the captured stderr/status from `run-review.sh`, then ask the user for a +configured reviewer model. Use `pi --list-models [search]` to inspect available configured models +when needed. Official references: -- `https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent` documents pi providers, model selection, skills, extensions, and print mode. -- Local `pi --help` for pi `0.70.0` confirms `--model ` supports `provider/id`, `--print, -p` runs non-interactively, `--tools, -t ` allowlists tools, and the read-only example is `pi --tools read,grep,find,ls -p "Review the code in src/"`. +- `https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent` documents pi providers, + model selection, skills, extensions, and print mode. +- Local `pi --help` for pi `0.70.0` confirms `--model ` supports `provider/id`, + `--print, -p` runs non-interactively, `--tools, -t ` allowlists tools, and the read-only + example is `pi --tools read,grep,find,ls -p "Review the code in src/"`. ## Required Files diff --git a/docs/PI-RESEARCH.md b/docs/PI-RESEARCH.md index ec1e2a0..1f1cb46 100644 --- a/docs/PI-RESEARCH.md +++ b/docs/PI-RESEARCH.md @@ -2,7 +2,8 @@ ## Scope -This document records the pi-specific findings that drive the `pi` variants in this repo. It is intentionally source-backed so later skill work does not rely on memory or assumptions. +This document records the pi-specific findings that drive the `pi` variants in this repo. It is +intentionally source-backed so later skill work does not rely on memory or assumptions. Checked on `2026-04-23`. @@ -32,11 +33,15 @@ Important discovery details from the skills docs: - top-level `.md` files are loaded as skills in pi-native roots like `.pi/skills/` - per the upstream skills docs, top-level `.md` files are ignored in `.agents/skills/` -Implication for this repo: `skills//pi/SKILL.md` fits pi's recursive discovery model cleanly for source authoring and manual copies, but it is not clean for package-discovered installs because Pi requires the immediate parent directory of `SKILL.md` to match the skill frontmatter `name`. +Implication for this repo: `skills//pi/SKILL.md` fits pi's recursive discovery model +cleanly for source authoring and manual copies, but it is not clean for package-discovered installs +because Pi requires the immediate parent directory of `SKILL.md` to match the skill frontmatter +`name`. ### Package Support -Pi packages are a first-class distribution path. The package docs say pi can load resources through conventional directories like `skills/`, or through explicit `pi` manifest entries in `package.json`. +Pi packages are a first-class distribution path. The package docs say pi can load resources through +conventional directories like `skills/`, or through explicit `pi` manifest entries in `package.json`. Relevant package behaviors: @@ -46,11 +51,16 @@ Relevant package behaviors: - installed pi packages can also ship `extensions/`, `prompts/`, and `themes/` - when pi installs npm or git packages, it runs `npm install` -Implication for this repo: a single repo-level `package.json` is a viable v1 surface for shipping only the Pi resources, but the package-facing skill directories must be shaped like `/SKILL.md`. That means the repo should preserve `skills//pi/` for editing and expose a separate mirror such as `pi-package/skills//` to Pi. +Implication for this repo: a single repo-level `package.json` is a viable v1 surface for shipping +only the Pi resources, but the package-facing skill directories must be shaped like +`/SKILL.md`. That means the repo should preserve `skills//pi/` for editing and +expose a separate mirror such as `pi-package/skills//` to Pi. ### Settings And Path Overrides -Pi settings support `packages`, `extensions`, `skills`, `prompts`, and `themes`. In both `~/.pi/agent/settings.json` and `.pi/settings.json`, the `skills` array can point to local files or directories, and the docs explicitly allow absolute paths and `~`. +Pi settings support `packages`, `extensions`, `skills`, `prompts`, and `themes`. In both +`~/.pi/agent/settings.json` and `.pi/settings.json`, the `skills` array can point to local files +or directories, and the docs explicitly allow absolute paths and `~`. Implication for this repo: @@ -68,18 +78,23 @@ Pi extensions are TypeScript modules that can: - add UI interactions and custom components - persist session state -The coding-agent README explicitly lists advanced behaviors like sub-agents, plan mode, permission gates, MCP integration, and git checkpointing as extension-capable areas. +The coding-agent README explicitly lists advanced behaviors like sub-agents, plan mode, permission +gates, MCP integration, and git checkpointing as extension-capable areas. -Implication for this repo: extensions are a real opportunity for workflow-heavy skills, but they are optional for the initial skill port. The base skill variants should remain usable without any extension dependency. +Implication for this repo: extensions are a real opportunity for workflow-heavy skills, but they +are optional for the initial skill port. The base skill variants should remain usable without any +extension dependency. ### Cross-Harness Compatibility -The pi skills docs explicitly call out `~/.agents/skills/` as a supported global skill root, and describe adding Codex or Claude skill directories through settings when needed. +The pi skills docs explicitly call out `~/.agents/skills/` as a supported global skill root, and +describe adding Codex or Claude skill directories through settings when needed. Implication for this repo: - existing Superpowers installs exposed through `~/.agents/skills/` can already be visible to pi -- pi-specific skill variants still need their own instructions because pi does not share Codex's `update_plan`, plan-mode, or worktree assumptions +- pi-specific skill variants still need their own instructions because pi does not share Codex's + `update_plan`, plan-mode, or worktree assumptions ## Decisions Derived From Research diff --git a/docs/PI-SUPERPOWERS.md b/docs/PI-SUPERPOWERS.md index 71095c3..8d74989 100644 --- a/docs/PI-SUPERPOWERS.md +++ b/docs/PI-SUPERPOWERS.md @@ -4,7 +4,8 @@ This document is only about making Obra Superpowers visible to Pi. -If you need the shared reviewer helpers (`run-review.sh`, `notify-telegram.sh`), use [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md) instead. +If you need the shared reviewer helpers (`run-review.sh`, `notify-telegram.sh`), use +[PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md) instead. ## What Pi Needs @@ -18,7 +19,8 @@ The workflow-heavy Pi skills depend on Superpowers such as: - `finishing-a-development-branch` - `using-git-worktrees` -Pi can discover them from shared roots like `~/.agents/skills/`, Pi-native roots like `~/.pi/agent/skills/` or `.pi/skills/`, or settings-defined skill directories. +Pi can discover them from shared roots like `~/.agents/skills/`, Pi-native roots like +`~/.pi/agent/skills/` or `.pi/skills/`, or settings-defined skill directories. ## Verify An Existing Install @@ -42,7 +44,8 @@ test -f ~/.pi/agent/skills/superpowers/brainstorming/SKILL.md || test -f .pi/ski ## Install Option 1: Reuse A Shared Skills Root -If you already have Superpowers available for another harness, the simplest Pi setup is to expose that same tree through `~/.agents/skills/`. +If you already have Superpowers available for another harness, the simplest Pi setup is to expose +that same tree through `~/.agents/skills/`. Example: diff --git a/docs/PI.md b/docs/PI.md index 93a398f..63fcdd7 100644 --- a/docs/PI.md +++ b/docs/PI.md @@ -9,7 +9,8 @@ The Pi support surface has two layers: - editable source variants in `skills//pi/` - a package-facing mirror in `pi-package/skills//` -That split is intentional. Pi requires the immediate parent directory of `SKILL.md` to match the skill's frontmatter `name`, so the package cannot point directly at `skills//pi/`. +That split is intentional. Pi requires the immediate parent directory of `SKILL.md` to match the +skill's frontmatter `name`, so the package cannot point directly at `skills//pi/`. Related docs: @@ -21,15 +22,18 @@ Related docs: ### Source Of Truth -Author Pi variants under: +Edit the **canonical sources** under: -- `skills/atlassian/pi/` -- `skills/create-plan/pi/` -- `skills/do-task/pi/` -- `skills/implement-plan/pi/` -- `skills/web-automation/pi/` +- `skills/atlassian/_source/pi/SKILL.md` +- `skills/create-plan/_source/pi/` (SKILL.md + templates) +- `skills/do-task/_source/pi/` (SKILL.md + templates) +- `skills/implement-plan/_source/pi/SKILL.md` +- `skills/web-automation/_source/pi/SKILL.md` -These are the directories to edit by hand. +After editing a canonical source, run `pnpm run sync:pi` to regenerate all +agent-variant directories including `skills//pi/` and the package mirrors. +Do not edit the generated `skills//pi/` directories directly — they are +overwritten by the generator. ### Package Mirror @@ -41,7 +45,9 @@ The package exposes: - `pi-package/skills/implement-plan/` - `pi-package/skills/web-automation/` -Those directories are generated from the source variants by [`scripts/sync-pi-package-skills.sh`](../scripts/sync-pi-package-skills.sh). +Those directories are generated from the canonical sources by +[`scripts/generate-skills.mjs`](../scripts/generate-skills.mjs) +(run via `pnpm run sync:pi`). ### Shared Setup Docs @@ -92,7 +98,11 @@ That script: - fetches the CloakBrowser binary for `web-automation` - prints `pi list` at the end so the active install is visible immediately -For this cloned-checkout flow, local checkout package install keeps the runtime in `pi-package/skills//scripts`. Pi loads the skills from the package mirror in this repo; it does not copy them into `~/.pi/agent/skills//` or `.pi/skills//` unless you do a manual copy install. +For this cloned-checkout flow, +local checkout package install keeps the runtime in `pi-package/skills//scripts`. +Pi loads the skills from the package mirror in this repo; +it does not copy them into `~/.pi/agent/skills//` or `.pi/skills//` +unless you do a manual copy install. The package surface intentionally ships: @@ -101,7 +111,7 @@ The package surface intentionally ships: - `docs/PI*.md` - `scripts/install-pi-package.sh` - `scripts/manage-skills.mjs` and `scripts/manage-skills.sh` -- `scripts/sync-pi-package-skills.sh` +- `scripts/generate-skills.mjs` - `scripts/verify-pi-resources.sh` - `scripts/verify-pi-workflows.sh` - `scripts/verify-reviewer-support.sh` @@ -110,7 +120,8 @@ It intentionally does not ship `skills//pi/**` as package-discovered ski ## Single-Skill Copy Install -If you only want one Pi skill without installing the whole package, copy from the package-facing mirror into a Pi skill root: +If you only want one Pi skill without installing the whole package, copy from the package-facing +mirror into a Pi skill root: ```bash mkdir -p .pi/skills/create-plan @@ -124,13 +135,16 @@ Global installs use `~/.pi/agent/skills//` instead of `.pi/skills/ When a source Pi variant changes: ```bash -./scripts/sync-pi-package-skills.sh +pnpm run sync:pi npm run verify:pi npm run verify:reviewers npm pack --dry-run --json ``` -The focused `scripts/install-pi-package.sh` installer intentionally does not run sync. It assumes the checked-in `pi-package/skills/*` mirror is already current. The multi-client skill manager plans a sync step before manual Pi skill-copy operations so manual installs use the current package-facing mirror. +The focused `scripts/install-pi-package.sh` installer intentionally does not run sync. It assumes +the checked-in `pi-package/skills/*` mirror is already current. The multi-client skill manager +plans a sync step before manual Pi skill-copy operations so manual installs use the current +package-facing mirror. The verifier is responsible for catching: diff --git a/docs/README.md b/docs/README.md index 84e698f..f76c90e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,31 +1,72 @@ # Skills Documentation -This directory contains user-facing docs for each skill. +This directory contains user-facing docs for all skills, agents, and tooling +in the `ai-coding-skills` repository. -## Recommended Reading Flow +## Reading Order -1. Use [INSTALLER.md](./INSTALLER.md) for the guided install/update/remove wizard (`./scripts/manage-skills.sh`). -2. Use the client docs ([CODEX.md](./CODEX.md), [CLAUDE-CODE.md](./CLAUDE-CODE.md), [CURSOR.md](./CURSOR.md), [OPENCODE.md](./OPENCODE.md)) for manual installs, and [PI.md](./PI.md) for Pi overview, package install, and manual single-skill copy. -3. Use the skill docs below for skill-specific requirements, runtime setup, verification, and examples. -4. For Pi workflow skills, also consult [PI-SUPERPOWERS.md](./PI-SUPERPOWERS.md) and [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). +Work through the sections below in order on a first read. Return to individual +sections as needed. -## Index +### 1. Getting Started -- [INSTALLER.md](./INSTALLER.md) — Skill manager wizard for installing, updating/reinstalling, and removing repo skills across supported clients. -- [CODEX.md](./CODEX.md) — Manual install instructions for Codex variants. -- [CLAUDE-CODE.md](./CLAUDE-CODE.md) — Manual install instructions for Claude Code variants. -- [CURSOR.md](./CURSOR.md) — Manual install instructions for Cursor variants. -- [OPENCODE.md](./OPENCODE.md) — Manual install instructions for OpenCode variants. -- [ATLASSIAN.md](./ATLASSIAN.md) — Includes requirements, generated bundle sync, install, auth, safety rules, and usage examples for the Atlassian skill. -- [CREATE-PLAN.md](./CREATE-PLAN.md) — Includes requirements, install, verification, and execution workflow for create-plan. -- [DO-TASK.md](./DO-TASK.md) — Single-prompt end-to-end execution with dual reviewer loops (plan + implementation), TDD-first, single task commit. Sibling of create-plan/implement-plan scoped to ad-hoc tasks. -- [IMPLEMENT-PLAN.md](./IMPLEMENT-PLAN.md) — Includes requirements, install, verification, and milestone review workflow for implement-plan. -- [PI.md](./PI.md) — Pi support overview, source-vs-package layout, install flow, and extension decision. -- [PI-RESEARCH.md](./PI-RESEARCH.md) — Source-backed pi findings that inform the repo's pi variants and packaging choices. -- [PI-SUPERPOWERS.md](./PI-SUPERPOWERS.md) — How to install or verify Obra Superpowers for Pi. -- [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md) — How to install or verify the shared reviewer-runtime helpers for Pi workflow skills. -- [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) — Shared Telegram notification setup used by reviewer-driven skills. -- [WEB-AUTOMATION.md](./WEB-AUTOMATION.md) — Includes requirements, install, dependency verification, and usage examples for web-automation. +- [INSTALLER.md](./INSTALLER.md) — Guided install/update/remove wizard + (`./scripts/manage-skills.sh`). **Start here** if you want the fastest path + to installed skills. + +### 2. Per-Agent Manual Install + +Use these guides to install specific skills manually for a single agent: + +- [CODEX.md](./CODEX.md) — Manual install for Codex variants. +- [CLAUDE-CODE.md](./CLAUDE-CODE.md) — Manual install for Claude Code variants. +- [CURSOR.md](./CURSOR.md) — Manual install for Cursor variants. +- [OPENCODE.md](./OPENCODE.md) — Manual install for OpenCode variants. +- [PI.md](./PI.md) — Pi overview, source-vs-package layout, and manual install. + +### 3. Skill Guides + +Reference docs for each skill family: + +- [ATLASSIAN.md](./ATLASSIAN.md) — Jira/Confluence CLI: requirements, generated + bundle sync, install, auth, safety rules, and usage examples. +- [CREATE-PLAN.md](./CREATE-PLAN.md) — Structured planning with milestones, + cross-model review, and reviewer CLI requirements. +- [DO-TASK.md](./DO-TASK.md) — Single-prompt end-to-end execution with dual + reviewer loops, TDD-first, single task commit. +- [IMPLEMENT-PLAN.md](./IMPLEMENT-PLAN.md) — Worktree-isolated plan execution + with iterative cross-model milestone review. +- [WEB-AUTOMATION.md](./WEB-AUTOMATION.md) — CloakBrowser-backed browsing, + scraping, auth, and flow automation. + +### 4. Pi-Specific Docs + +- [PI-RESEARCH.md](./PI-RESEARCH.md) — Source-backed Pi findings that inform + repo Pi variants and packaging choices. +- [PI-SUPERPOWERS.md](./PI-SUPERPOWERS.md) — How to install or verify Obra + Superpowers for Pi. +- [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md) — Shared reviewer-runtime + helpers for Pi workflow skills; canonical Pi reviewer flag contract. + +### 5. Telegram Notifications + +- [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) — Shared Telegram + notification setup for Codex, Claude Code, OpenCode, Cursor, and Pi. + +### 6. Reviewer Matrix + +- [REVIEWERS.md](./REVIEWERS.md) — Canonical reviewer CLI support matrix; + single source of truth for all workflow variants. + +### 7. Development + +- [DEVELOPMENT.md](./DEVELOPMENT.md) — Prerequisites, `pnpm run check`, + workspace policy, generation workflow, cross-platform shell support, and the + quality contract. +- [CLEANUP-BASELINE.md](./CLEANUP-BASELINE.md) — As-is quality baseline + captured at M1, updated through subsequent milestones. +- [../CHANGELOG.md](../CHANGELOG.md) — Milestone-by-milestone change record + (includes M3 package-metadata rename table). ## Repo Setup diff --git a/docs/REVIEWERS.md b/docs/REVIEWERS.md new file mode 100644 index 0000000..dd3ae42 --- /dev/null +++ b/docs/REVIEWERS.md @@ -0,0 +1,81 @@ +# Reviewer CLI Support Matrix + +This document is the **single canonical source** for the reviewer CLI support +matrix used by `create-plan`, `implement-plan`, and `do-task`. All workflow +docs and `SKILL.md` variants must refer here and stay in sync. + +## Canonical Reviewer CLIs + +| CLI | Install | Verify | Read-Only Mode | Session Resume | +|-----|---------|--------|----------------|----------------| +| `codex` | `npm install -g @openai/codex` | `codex --version` | `-s read-only` | Yes (`codex exec resume `) | +| `claude` | `npm install -g @anthropic-ai/claude-code` | `claude --version` | `--strict-mcp-config --setting-sources user` | No (fresh call each round) | +| `cursor` | `curl https://cursor.com/install -fsS \| bash` | `cursor-agent --version` | `--mode=ask` | Yes (`--resume `) | +| `opencode` | `brew install opencode` or your package manager | `opencode --version` | `--agent plan` | Opt-in (`-s `; fresh call is the default) | +| `pi` | Install Pi coding agent | `pi --version`; list models with `pi --list-models [search]` | `--tools read,grep,find,ls` | No (fresh call each round) | + +**`skip`** is always a valid value; it bypasses the reviewer loop and requires +explicit user approval instead. + +## Notes + +- The reviewer CLI is independent of which agent is running the skill. For + example, Claude Code can send plans to Codex for review and vice versa. +- **`cursor` reviewer prerequisite:** `jq` is required to parse Cursor's JSON + output. Install via `brew install jq` (macOS) or your package manager. + Verify: `jq --version`. The Cursor variant of `do-task` makes `jq` a hard + prerequisite regardless of which reviewer CLI is selected. +- **`opencode` reviewer:** Uses `--agent plan` (built-in read-oriented agent) + for review posture. Session resume is opt-in via `-s `; fresh call is the + recommended default for non-interactive headless runs. +- **`pi` reviewer:** Use `pi/` shorthand, for example + `pi/claude-opus-4-7`; this means `REVIEWER_CLI=pi` and + `REVIEWER_MODEL=claude-opus-4-7`. Provider-qualified or multi-slash Pi model + IDs are preserved after the first `pi/` prefix, for example + `pi/anthropic/claude-opus-4-7`. The canonical isolated read-only Pi reviewer + flag contract lives in [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md). + +## Reviewer Output Contract + +All reviewer CLIs must return the following structure: + +```markdown +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Severity levels: + +| Level | Meaning | +|-------|---------| +| `P0` | Total blocker | +| `P1` | Major risk | +| `P2` | Must-fix before approval | +| `P3` | Cosmetic / nice to have (non-blocking) | + +Rules: + +- `VERDICT: APPROVED` is valid only when no `P0`, `P1`, or `P2` findings remain. +- `P3` findings are non-blocking, but the caller should still try to fix them + when cheap and safe. +- Each severity section uses `- None.` when empty. + +## References + +- [PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md) — Canonical Pi reviewer + flag contract and read-only command template. +- [TELEGRAM-NOTIFICATIONS.md](./TELEGRAM-NOTIFICATIONS.md) — Telegram + notification setup used by reviewer-driven workflows. diff --git a/docs/TELEGRAM-NOTIFICATIONS.md b/docs/TELEGRAM-NOTIFICATIONS.md index 2e8c1b3..a16c98e 100644 --- a/docs/TELEGRAM-NOTIFICATIONS.md +++ b/docs/TELEGRAM-NOTIFICATIONS.md @@ -2,7 +2,9 @@ ## Purpose -Shared setup for Telegram notifications used by reviewer-driven skills such as `create-plan` and `implement-plan`, both for completion and for pauses that need user attention. +Shared setup for Telegram notifications used by reviewer-driven skills such as +`create-plan`, `implement-plan`, and `do-task`, both for completion and for +pauses that need user attention. ## Requirements @@ -12,17 +14,23 @@ Shared setup for Telegram notifications used by reviewer-driven skills such as ` - Codex: `~/.codex/skills/reviewer-runtime/notify-telegram.sh` - Claude Code: `~/.claude/skills/reviewer-runtime/notify-telegram.sh` - OpenCode: `~/.config/opencode/skills/reviewer-runtime/notify-telegram.sh` - - Cursor: `.cursor/skills/reviewer-runtime/notify-telegram.sh` or `~/.cursor/skills/reviewer-runtime/notify-telegram.sh` + - Cursor: `.cursor/skills/reviewer-runtime/notify-telegram.sh` + or `~/.cursor/skills/reviewer-runtime/notify-telegram.sh` + - Pi: `.pi/skills/reviewer-runtime/pi/notify-telegram.sh` + or `~/.pi/agent/skills/reviewer-runtime/pi/notify-telegram.sh` ## Install -The helper ships from `skills/reviewer-runtime/` together with `run-review.sh`. +The helpers ship from `skills/reviewer-runtime/` (non-Pi) and +`skills/reviewer-runtime/pi/` (Pi) together with `run-review.sh`. ### Codex ```bash mkdir -p ~/.codex/skills/reviewer-runtime -cp skills/reviewer-runtime/run-review.sh skills/reviewer-runtime/notify-telegram.sh ~/.codex/skills/reviewer-runtime/ +cp skills/reviewer-runtime/run-review.sh \ + skills/reviewer-runtime/notify-telegram.sh \ + ~/.codex/skills/reviewer-runtime/ chmod +x ~/.codex/skills/reviewer-runtime/*.sh ``` @@ -30,7 +38,9 @@ chmod +x ~/.codex/skills/reviewer-runtime/*.sh ```bash mkdir -p ~/.claude/skills/reviewer-runtime -cp skills/reviewer-runtime/run-review.sh skills/reviewer-runtime/notify-telegram.sh ~/.claude/skills/reviewer-runtime/ +cp skills/reviewer-runtime/run-review.sh \ + skills/reviewer-runtime/notify-telegram.sh \ + ~/.claude/skills/reviewer-runtime/ chmod +x ~/.claude/skills/reviewer-runtime/*.sh ``` @@ -38,7 +48,9 @@ chmod +x ~/.claude/skills/reviewer-runtime/*.sh ```bash mkdir -p ~/.config/opencode/skills/reviewer-runtime -cp skills/reviewer-runtime/run-review.sh skills/reviewer-runtime/notify-telegram.sh ~/.config/opencode/skills/reviewer-runtime/ +cp skills/reviewer-runtime/run-review.sh \ + skills/reviewer-runtime/notify-telegram.sh \ + ~/.config/opencode/skills/reviewer-runtime/ chmod +x ~/.config/opencode/skills/reviewer-runtime/*.sh ``` @@ -48,7 +60,9 @@ Repo-local install: ```bash mkdir -p .cursor/skills/reviewer-runtime -cp skills/reviewer-runtime/run-review.sh skills/reviewer-runtime/notify-telegram.sh .cursor/skills/reviewer-runtime/ +cp skills/reviewer-runtime/run-review.sh \ + skills/reviewer-runtime/notify-telegram.sh \ + .cursor/skills/reviewer-runtime/ chmod +x .cursor/skills/reviewer-runtime/*.sh ``` @@ -56,22 +70,57 @@ Global install: ```bash mkdir -p ~/.cursor/skills/reviewer-runtime -cp skills/reviewer-runtime/run-review.sh skills/reviewer-runtime/notify-telegram.sh ~/.cursor/skills/reviewer-runtime/ +cp skills/reviewer-runtime/run-review.sh \ + skills/reviewer-runtime/notify-telegram.sh \ + ~/.cursor/skills/reviewer-runtime/ chmod +x ~/.cursor/skills/reviewer-runtime/*.sh ``` +### Pi + +Pi uses a separate set of helpers from `skills/reviewer-runtime/pi/` that are +optimized for the Pi agent environment. See +[PI-COMMON-REVIEWER.md](./PI-COMMON-REVIEWER.md) for full details. + +Global install: + +```bash +mkdir -p ~/.pi/agent/skills/reviewer-runtime/pi +cp -R skills/reviewer-runtime/pi/* ~/.pi/agent/skills/reviewer-runtime/pi/ +chmod +x ~/.pi/agent/skills/reviewer-runtime/pi/*.sh +``` + +Repo-local install: + +```bash +mkdir -p .pi/skills/reviewer-runtime/pi +cp -R skills/reviewer-runtime/pi/* .pi/skills/reviewer-runtime/pi/ +chmod +x .pi/skills/reviewer-runtime/pi/*.sh +``` + ## Verify Installation +### Verify: Non-Pi agents + ```bash test -x ~/.codex/skills/reviewer-runtime/notify-telegram.sh || true test -x ~/.claude/skills/reviewer-runtime/notify-telegram.sh || true test -x ~/.config/opencode/skills/reviewer-runtime/notify-telegram.sh || true -test -x .cursor/skills/reviewer-runtime/notify-telegram.sh || test -x ~/.cursor/skills/reviewer-runtime/notify-telegram.sh || true +test -x .cursor/skills/reviewer-runtime/notify-telegram.sh \ + || test -x ~/.cursor/skills/reviewer-runtime/notify-telegram.sh || true +``` + +### Verify: Pi + +```bash +test -x .pi/skills/reviewer-runtime/pi/notify-telegram.sh \ + || test -x ~/.pi/agent/skills/reviewer-runtime/pi/notify-telegram.sh || true ``` ## Configure Telegram -Export the required variables before running a skill that sends Telegram notifications: +Export the required variables before running a skill that sends Telegram +notifications: ```bash export TELEGRAM_BOT_TOKEN="" @@ -86,7 +135,7 @@ export TELEGRAM_API_BASE_URL="https://api.telegram.org" ## Test the Helper -Example: +Non-Pi agents example: ```bash TELEGRAM_BOT_TOKEN="" \ @@ -94,9 +143,19 @@ TELEGRAM_CHAT_ID="" \ skills/reviewer-runtime/notify-telegram.sh --message "Telegram notification test" ``` +Pi example: + +```bash +TELEGRAM_BOT_TOKEN="" \ +TELEGRAM_CHAT_ID="" \ +skills/reviewer-runtime/pi/notify-telegram.sh --message "Pi Telegram test" +``` + ## Rules - Telegram is the only supported notification path for these skills. - Notification failures are non-blocking, but they must be surfaced to the user. -- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. -- Skills should report when Telegram is not configured instead of silently pretending a notification was sent. +- Before stopping for any user interaction, approval, or manual decision, send a + Telegram summary first if configured. +- Skills should report when Telegram is not configured instead of silently + pretending a notification was sent. diff --git a/docs/WEB-AUTOMATION.md b/docs/WEB-AUTOMATION.md index 05e62eb..969a69b 100644 --- a/docs/WEB-AUTOMATION.md +++ b/docs/WEB-AUTOMATION.md @@ -89,7 +89,7 @@ Recommended full Pi package install: Manual single-skill Pi install from the package mirror: ```bash -./scripts/sync-pi-package-skills.sh +pnpm run sync:pi mkdir -p .pi/skills/web-automation cp -R pi-package/skills/web-automation/* .pi/skills/web-automation/ cd .pi/skills/web-automation/scripts @@ -112,7 +112,8 @@ pnpm approve-builds pnpm rebuild better-sqlite3 esbuild ``` -This repo intentionally treats `cloakbrowser` as a refreshable dependency: update to the latest available compatible release, then regenerate the lockfile from that resolved set. +This repo intentionally treats `cloakbrowser` as a refreshable dependency: update to the latest +available compatible release, then regenerate the lockfile from that resolved set. ## Verify Installation & Wiring @@ -129,7 +130,8 @@ Expected checks: If the check fails, stop and return: -"Missing dependency/config: web-automation requires `cloakbrowser` and `playwright-core` with CloakBrowser-based scripts. Run setup in this skill, then retry." +"Missing dependency/config: web-automation requires `cloakbrowser` and `playwright-core` with +CloakBrowser-based scripts. Run setup in this skill, then retry." If runtime later fails with native-binding issues, run: diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..efd636f --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,54 @@ +// ESLint flat config — repo root (M1) +// Scoped to root-level scripts only. Nested workspace packages manage +// their own lint config (or inherit this in a later milestone). +import js from "@eslint/js"; +import globals from "globals"; + +export default [ + // Apply ESLint recommended rules to root-level JS/MJS scripts + { + files: ["scripts/**/*.mjs", "scripts/**/*.js"], + ...js.configs.recommended, + languageOptions: { + globals: { + ...globals.node, + }, + }, + }, + + // Global ignores — never lint generated directories or node_modules + { + ignores: [ + "**/node_modules/**", + // Generated agent-variant directories (M3: now uniquely named but still + // not linted — the canonical source in shared/ or _source/ is the linting target) + "skills/atlassian/codex/**", + "skills/atlassian/claude-code/**", + "skills/atlassian/cursor/**", + "skills/atlassian/opencode/**", + "skills/atlassian/pi/**", + "skills/web-automation/claude-code/**", + "skills/web-automation/cursor/**", + "skills/web-automation/opencode/**", + "skills/web-automation/pi/**", + // skill-only generated variants (no scripts to lint) + "skills/create-plan/claude-code/**", + "skills/create-plan/codex/**", + "skills/create-plan/cursor/**", + "skills/create-plan/opencode/**", + "skills/create-plan/pi/**", + "skills/do-task/claude-code/**", + "skills/do-task/codex/**", + "skills/do-task/cursor/**", + "skills/do-task/opencode/**", + "skills/do-task/pi/**", + "skills/implement-plan/claude-code/**", + "skills/implement-plan/codex/**", + "skills/implement-plan/cursor/**", + "skills/implement-plan/opencode/**", + "skills/implement-plan/pi/**", + "skills/reviewer-runtime/pi/**", + "pi-package/**", + ], + }, +]; diff --git a/markdown-link-check.json b/markdown-link-check.json new file mode 100644 index 0000000..2f5a79c --- /dev/null +++ b/markdown-link-check.json @@ -0,0 +1,9 @@ +{ + "timeout": "10s", + "retryCount": 2, + "retryOn429": true, + "aliveStatusCodes": [200, 206, 429], + "ignorePatterns": [ + { "pattern": "^https?://" } + ] +} diff --git a/markdown-link-check.online.json b/markdown-link-check.online.json new file mode 100644 index 0000000..99124a9 --- /dev/null +++ b/markdown-link-check.online.json @@ -0,0 +1,12 @@ +{ + "timeout": "10s", + "retryCount": 2, + "retryOn429": true, + "aliveStatusCodes": [200, 206, 429], + "ignorePatterns": [ + { "pattern": "^https://github.com/obra/" }, + { "pattern": "^https://github.com/anthropics/" }, + { "pattern": "^https://localhost" }, + { "pattern": "^http://localhost" } + ] +} diff --git a/package.json b/package.json index d8b711d..29d9ade 100644 --- a/package.json +++ b/package.json @@ -27,22 +27,34 @@ "docs/PI-SUPERPOWERS.md", "docs/PI-COMMON-REVIEWER.md", "docs/WEB-AUTOMATION.md", + "docs/DEVELOPMENT.md", + "docs/REVIEWERS.md", "pi-package/skills", "skills/reviewer-runtime/pi", "scripts/install-pi-package.sh", "scripts/lib/skill-manager-core.mjs", "scripts/manage-skills.mjs", "scripts/manage-skills.sh", - "scripts/sync-pi-package-skills.sh", + "CHANGELOG.md", + "scripts/generate-skills.mjs", "scripts/verify-pi-resources.sh", "scripts/verify-pi-workflows.sh", "scripts/verify-reviewer-support.sh" ], "scripts": { - "sync:pi": "./scripts/sync-pi-package-skills.sh", + "sync:pi": "node scripts/generate-skills.mjs", "verify:pi": "./scripts/verify-pi-resources.sh && ./scripts/verify-pi-workflows.sh", "verify:reviewers": "./scripts/verify-reviewer-support.sh", - "test:installer": "node --test scripts/tests/*.test.mjs" + "test:installer": "node --test scripts/tests/*.test.mjs", + "lint": "eslint . ; R1=$?; node scripts/lib/run-shellcheck.mjs ; R2=$?; [ $((R1+R2)) -eq 0 ]", + "lint:fix": "eslint . --fix && prettier --write .", + "typecheck": "pnpm run -r --if-present typecheck", + "test": "pnpm run test:installer && pnpm run -r --if-present test", + "verify:docs": "markdownlint-cli2 ; R1=$?; node scripts/lib/run-link-check.mjs ; R2=$?; node scripts/verify-docs-flow.mjs ; R3=$?; [ $((R1+R2+R3)) -eq 0 ]", + "verify:docs:online": "markdownlint-cli2 ; R1=$?; node scripts/lib/run-link-check.mjs --online ; R2=$?; node scripts/verify-docs-flow.mjs ; R3=$?; [ $((R1+R2+R3)) -eq 0 ]", + "verify:generated": "node scripts/verify-generated.mjs", + "verify:ci": "node scripts/lib/assert-no-pnpm-version-pin.mjs", + "check": "node scripts/lib/run-check.mjs" }, "pi": { "skills": [ @@ -53,5 +65,13 @@ "./pi-package/skills/web-automation" ] }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "devDependencies": { + "@eslint/js": "10.0.1", + "eslint": "10.3.0", + "globals": "17.6.0", + "markdown-link-check": "3.14.2", + "markdownlint-cli2": "0.22.1", + "prettier": "3.8.3" + } } diff --git a/pi-package/skills/atlassian/.generated-manifest.json b/pi-package/skills/atlassian/.generated-manifest.json new file mode 100644 index 0000000..760da18 --- /dev/null +++ b/pi-package/skills/atlassian/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "pi-package/skills/atlassian", + "files": [ + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "97dd269f922ea83f6abfd29497ca532b94540acd1461b3a012f92853db55e196" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "15556a6f53e68bb8d92d2710aae0836bc80af7f29be9d63aa1b87fcbd33732c6" + }, + { + "path": "scripts/src/adf.ts", + "kind": "file", + "mode": "644", + "sha256": "c7c3b4a78ccd8fb5a8ab99c82e0eab67a0a0d656b3985c1f56817bda199ad20f" + }, + { + "path": "scripts/src/cli.ts", + "kind": "file", + "mode": "644", + "sha256": "90dcc029adf0625b86c5eec44c5c1fd11bbf95ffe1185016d139c8a6982d54ff" + }, + { + "path": "scripts/src/command-helpers.ts", + "kind": "file", + "mode": "644", + "sha256": "aa03d8d288c8c00485ea10d3b3a60804c1b9ee23ef265004e7912f3242dbcee7" + }, + { + "path": "scripts/src/config.ts", + "kind": "file", + "mode": "644", + "sha256": "700dcdce96afab5294426e09f539135ae5432632370260190d6292071422eb3f" + }, + { + "path": "scripts/src/confluence.ts", + "kind": "file", + "mode": "644", + "sha256": "28f65f280cd9b6119ce7eab583d0083231525ad6dc04b73389cb5dcbab5bf095" + }, + { + "path": "scripts/src/files.ts", + "kind": "file", + "mode": "644", + "sha256": "16296eaa3ae41a4d7c694773036f9bb4bd2baa2db6a9c318078532b713678dba" + }, + { + "path": "scripts/src/health.ts", + "kind": "file", + "mode": "644", + "sha256": "1db4b49e05b16a095b7e7ca31cdc4e22ebda19e20e05c40baaaac648eaec0d08" + }, + { + "path": "scripts/src/http.ts", + "kind": "file", + "mode": "644", + "sha256": "66444b777d4d9b14d9793eb051c586eb811d2b36815b1018dd9d7517666c7eb2" + }, + { + "path": "scripts/src/jira.ts", + "kind": "file", + "mode": "644", + "sha256": "bec0e81a0424dd412c36988cef42c01a95f044ee8346ba626e7eb8bd79379f07" + }, + { + "path": "scripts/src/output.ts", + "kind": "file", + "mode": "644", + "sha256": "38e99818582a4962c09a83175634cba2bfead6acf33bd5f43cdca5caed7100a0" + }, + { + "path": "scripts/src/raw.ts", + "kind": "file", + "mode": "644", + "sha256": "48fd54bd0cdb421badb58f9be2933a039fe3b9350bbe6191070c9f7bb0054670" + }, + { + "path": "scripts/src/types.ts", + "kind": "file", + "mode": "644", + "sha256": "9f92d27ab68604d5abfd0f5dc9552b96fed6d1f9fc7dc6eb30190d8b617628bf" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "3c2eb7ba5c95a16cada153de4787ca7a4bf179609bf3848e12ff15b1b7927a68" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "69d83441799f3feada7fbf85691bda16fc30718b724871d7e37cfac574db2253" + } + ] +} diff --git a/pi-package/skills/atlassian/SKILL.md b/pi-package/skills/atlassian/SKILL.md index 10d3507..406e702 100644 --- a/pi-package/skills/atlassian/SKILL.md +++ b/pi-package/skills/atlassian/SKILL.md @@ -3,6 +3,8 @@ name: atlassian description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. --- + + # Atlassian (Pi) Portable Atlassian workflows for pi using the shared TypeScript CLI in `scripts/`. diff --git a/pi-package/skills/atlassian/scripts/package.json b/pi-package/skills/atlassian/scripts/package.json index a9d8adc..4e18a43 100644 --- a/pi-package/skills/atlassian/scripts/package.json +++ b/pi-package/skills/atlassian/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "atlassian-skill-scripts", + "name": "@ai-coding-skills/atlassian-pi-mirror", "version": "1.0.0", "description": "Shared runtime for the Atlassian skill", "type": "module", @@ -16,5 +16,6 @@ "tsx": "^4.20.5", "typescript": "^5.9.2" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/pi-package/skills/atlassian/scripts/src/adf.ts b/pi-package/skills/atlassian/scripts/src/adf.ts index 638914c..8774bd1 100644 --- a/pi-package/skills/atlassian/scripts/src/adf.ts +++ b/pi-package/skills/atlassian/scripts/src/adf.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. const TEXT_NODE = "text"; function textNode(text: string) { diff --git a/pi-package/skills/atlassian/scripts/src/cli.ts b/pi-package/skills/atlassian/scripts/src/cli.ts index 6012b99..a4f4fd0 100644 --- a/pi-package/skills/atlassian/scripts/src/cli.ts +++ b/pi-package/skills/atlassian/scripts/src/cli.ts @@ -1,8 +1,10 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import process from "node:process"; import { pathToFileURL } from "node:url"; import { Command } from "commander"; +import { resolveFormat } from "./command-helpers.js"; import { createConfluenceClient } from "./confluence.js"; import { loadConfig } from "./config.js"; import { readWorkspaceFile } from "./files.js"; @@ -10,7 +12,7 @@ import { runHealthCheck } from "./health.js"; import { createJiraClient } from "./jira.js"; import { writeOutput } from "./output.js"; import { runRawCommand } from "./raw.js"; -import type { FetchLike, OutputFormat, Writer } from "./types.js"; +import type { FetchLike, Writer } from "./types.js"; type CliContext = { cwd?: string; @@ -20,10 +22,6 @@ type CliContext = { stderr?: Writer; }; -function resolveFormat(format: string | undefined): OutputFormat { - return format === "text" ? "text" : "json"; -} - function createRuntime(context: CliContext) { const cwd = context.cwd ?? process.cwd(); const env = context.env ?? process.env; diff --git a/pi-package/skills/atlassian/scripts/src/command-helpers.ts b/pi-package/skills/atlassian/scripts/src/command-helpers.ts new file mode 100644 index 0000000..9ceca7c --- /dev/null +++ b/pi-package/skills/atlassian/scripts/src/command-helpers.ts @@ -0,0 +1,25 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import type { CommandOutput, OutputFormat } from "./types.js"; + +/** + * Produce the standard dry-run response payload for write operations. + * + * Use this when `--dry-run` is passed to skip the actual API call and + * echo the pending request back to the caller. + * + * @example + * if (input.dryRun) return dryRunResponse(request); + */ +export function dryRunResponse(data: T): CommandOutput { + return { ok: true, dryRun: true, data }; +} + +/** + * Resolve the `--format` CLI option to a typed OutputFormat. + * + * Returns `"text"` only for the exact string `"text"`; + * all other values (including `undefined`) fall back to `"json"`. + */ +export function resolveFormat(format: string | undefined): OutputFormat { + return format === "text" ? "text" : "json"; +} diff --git a/pi-package/skills/atlassian/scripts/src/config.ts b/pi-package/skills/atlassian/scripts/src/config.ts index eb34a39..58d37cc 100644 --- a/pi-package/skills/atlassian/scripts/src/config.ts +++ b/pi-package/skills/atlassian/scripts/src/config.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import path from "node:path"; import { config as loadDotEnv } from "dotenv"; diff --git a/pi-package/skills/atlassian/scripts/src/confluence.ts b/pi-package/skills/atlassian/scripts/src/confluence.ts index f22d66d..6ac333d 100644 --- a/pi-package/skills/atlassian/scripts/src/confluence.ts +++ b/pi-package/skills/atlassian/scripts/src/confluence.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -177,13 +179,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -223,13 +219,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -266,13 +256,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, diff --git a/pi-package/skills/atlassian/scripts/src/files.ts b/pi-package/skills/atlassian/scripts/src/files.ts index 8339109..cd7ed39 100644 --- a/pi-package/skills/atlassian/scripts/src/files.ts +++ b/pi-package/skills/atlassian/scripts/src/files.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { readFile } from "node:fs/promises"; import path from "node:path"; diff --git a/pi-package/skills/atlassian/scripts/src/health.ts b/pi-package/skills/atlassian/scripts/src/health.ts index b2d4d24..5946887 100644 --- a/pi-package/skills/atlassian/scripts/src/health.ts +++ b/pi-package/skills/atlassian/scripts/src/health.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createJsonHeaders, createStatusError } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; diff --git a/pi-package/skills/atlassian/scripts/src/http.ts b/pi-package/skills/atlassian/scripts/src/http.ts index 5791886..1184cd1 100644 --- a/pi-package/skills/atlassian/scripts/src/http.ts +++ b/pi-package/skills/atlassian/scripts/src/http.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createBasicAuthHeader } from "./config.js"; import type { AtlassianConfig, FetchLike } from "./types.js"; diff --git a/pi-package/skills/atlassian/scripts/src/jira.ts b/pi-package/skills/atlassian/scripts/src/jira.ts index 5cf3a6e..6773dff 100644 --- a/pi-package/skills/atlassian/scripts/src/jira.ts +++ b/pi-package/skills/atlassian/scripts/src/jira.ts @@ -1,4 +1,6 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { markdownToAdf } from "./adf.js"; +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike, JiraIssueSummary } from "./types.js"; @@ -161,13 +163,7 @@ export function createJiraClient(options: JiraClientOptions) { }, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", "/rest/api/3/issue", request.body); return { ok: true, data: raw }; @@ -192,13 +188,7 @@ export function createJiraClient(options: JiraClientOptions) { fields, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("PUT", `/rest/api/3/issue/${input.issue}`, request.body); return { @@ -215,13 +205,7 @@ export function createJiraClient(options: JiraClientOptions) { body: markdownToAdf(input.body), }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", `/rest/api/3/issue/${input.issue}/comment`, request.body); return { @@ -242,13 +226,7 @@ export function createJiraClient(options: JiraClientOptions) { }, ); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("POST", `/rest/api/3/issue/${input.issue}/transitions`, request.body); return { diff --git a/pi-package/skills/atlassian/scripts/src/output.ts b/pi-package/skills/atlassian/scripts/src/output.ts index 06b8a6e..afb43d9 100644 --- a/pi-package/skills/atlassian/scripts/src/output.ts +++ b/pi-package/skills/atlassian/scripts/src/output.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import type { CommandOutput, OutputFormat, Writer } from "./types.js"; function renderText(payload: CommandOutput) { diff --git a/pi-package/skills/atlassian/scripts/src/raw.ts b/pi-package/skills/atlassian/scripts/src/raw.ts index 8e11793..43ed8de 100644 --- a/pi-package/skills/atlassian/scripts/src/raw.ts +++ b/pi-package/skills/atlassian/scripts/src/raw.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { readWorkspaceFile } from "./files.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -61,13 +63,7 @@ export async function runRawCommand( ...(body === undefined ? {} : { body }), }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const data = await sendJsonRequest({ config, diff --git a/pi-package/skills/atlassian/scripts/src/types.ts b/pi-package/skills/atlassian/scripts/src/types.ts index 7f48f56..c365ff5 100644 --- a/pi-package/skills/atlassian/scripts/src/types.ts +++ b/pi-package/skills/atlassian/scripts/src/types.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. export type AtlassianConfig = { baseUrl: string; jiraBaseUrl: string; diff --git a/pi-package/skills/create-plan/.generated-manifest.json b/pi-package/skills/create-plan/.generated-manifest.json new file mode 100644 index 0000000..a35116e --- /dev/null +++ b/pi-package/skills/create-plan/.generated-manifest.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "pi-package/skills/create-plan", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "8767db25ce6f03e141ce4c48f37e9d7c4958c3cf3d70729f3bd7214b84f6d065" + }, + { + "path": "templates/continuation-runbook.md", + "kind": "file", + "mode": "644", + "sha256": "1685cded3d4abaf03122a490175ff03b7da593ce60cbca97ae15fadcb706617f" + }, + { + "path": "templates/milestone-plan.md", + "kind": "file", + "mode": "644", + "sha256": "364c08bf0a5ee3738195a0770db72c5a4c9ad7f7fb89eaa064eb8c67f47ad69a" + }, + { + "path": "templates/story-tracker.md", + "kind": "file", + "mode": "644", + "sha256": "ecb550ea9dcd9dde6c813e90af9f538bf5a247fc249e8e323f2b7bf583e52196" + } + ] +} diff --git a/pi-package/skills/create-plan/SKILL.md b/pi-package/skills/create-plan/SKILL.md index 3af2db2..6d91443 100644 --- a/pi-package/skills/create-plan/SKILL.md +++ b/pi-package/skills/create-plan/SKILL.md @@ -3,6 +3,8 @@ name: create-plan description: Use when a user asks to create or maintain a structured implementation plan in pi, including milestones, bite-sized stories, and resumable local planning artifacts under ai_plan. --- + + # Create Plan (Pi) Create and maintain a local plan workspace under `ai_plan/` at project root. diff --git a/pi-package/skills/create-plan/templates/continuation-runbook.md b/pi-package/skills/create-plan/templates/continuation-runbook.md index 78f1b70..1d0deae 100644 --- a/pi-package/skills/create-plan/templates/continuation-runbook.md +++ b/pi-package/skills/create-plan/templates/continuation-runbook.md @@ -1,3 +1,4 @@ + # Continuation Runbook: [Plan Title] ## Reference Files (START HERE) @@ -65,15 +66,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Full Context Reproduction ### Project Overview + [What this project/feature is about] ### User Requirements + [All gathered requirements] ### Scope + [In scope / out of scope] ### Dependencies + [External dependencies, prerequisites, related systems] --- @@ -81,16 +86,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Key Specifications ### Type Definitions + ```typescript // Copy-paste ready type definitions ``` ### Enums & Constants + ```typescript // All enums/constants needed ``` ### API Endpoints + ```typescript // Request/response shapes ``` @@ -108,16 +116,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Verification Commands ### Lint (changed files first) + ```bash # example: pnpm eslint ``` ### Typecheck + ```bash # example: pnpm tsc --noEmit ``` ### Tests (target changed scope first) + ```bash # example: pnpm test -- ``` diff --git a/pi-package/skills/create-plan/templates/milestone-plan.md b/pi-package/skills/create-plan/templates/milestone-plan.md index 9c9b7e9..1e428c6 100644 --- a/pi-package/skills/create-plan/templates/milestone-plan.md +++ b/pi-package/skills/create-plan/templates/milestone-plan.md @@ -1,6 +1,8 @@ + # [Plan Title] ## Overview + - **Goal:** [One sentence describing the end state] - **Created:** YYYY-MM-DD - **Status:** In Progress | Complete @@ -8,37 +10,46 @@ ## Context ### Requirements + [Gathered requirements from user questions] ### Constraints + [Technical, business, or timeline constraints] ### Success Criteria + [How we know this is complete] ## Architecture ### Design Decisions + [Key architectural choices and rationale] ### Component Relationships + [How pieces fit together] ### Data Flow + [How data moves through the system] ## Milestones ### M1: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-101, S-102, S-103... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -48,15 +59,18 @@ --- ### M2: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-201, S-202, S-203... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -68,16 +82,19 @@ ## Technical Specifications ### Types & Interfaces + ```typescript // Key type definitions ``` ### API Contracts + ```typescript // Endpoint signatures, request/response shapes ``` ### Constants & Enums + ```typescript // Shared constants ``` @@ -94,6 +111,7 @@ ## Related Plan Files This file is part of the plan folder under `ai_plan/`: + - `original-plan.md` - Original approved plan (reference for original intent) - `final-transcript.md` - Final planning transcript (reference for rationale/context) - `milestone-plan.md` - This file (full specification) diff --git a/pi-package/skills/create-plan/templates/story-tracker.md b/pi-package/skills/create-plan/templates/story-tracker.md index a346cc8..64a0d1f 100644 --- a/pi-package/skills/create-plan/templates/story-tracker.md +++ b/pi-package/skills/create-plan/templates/story-tracker.md @@ -1,6 +1,8 @@ + # Story Tracker: [Plan Title] ## Progress Summary + - **Current Milestone:** M1 - **Stories Complete:** 0/N - **Milestones Approved:** 0/M @@ -46,15 +48,18 @@ ## Update Instructions (MANDATORY) Before starting any story: + 1. Mark story as `in-dev` 2. Update "Last Updated" After completing any story: + 1. Mark story as `completed` 2. Add local commit hash to Notes 3. Update "Stories Complete" and "Last Updated" At milestone boundary: + 1. Run lint/typecheck/tests for changed files 2. Commit (no push) 3. Request feedback @@ -63,4 +68,5 @@ At milestone boundary: 6. Continue only after approval After all milestones approved: + - Ask permission to push and then mark plan completed. diff --git a/pi-package/skills/do-task/.generated-manifest.json b/pi-package/skills/do-task/.generated-manifest.json new file mode 100644 index 0000000..a158855 --- /dev/null +++ b/pi-package/skills/do-task/.generated-manifest.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "pi-package/skills/do-task", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "4920ad0cdeda546b37432c2268159724de54ddb01922308f2df88fcca4db8d31" + }, + { + "path": "templates/task-plan.md", + "kind": "file", + "mode": "644", + "sha256": "fd38213fabf350e14b48c5209910d00c16ff74c455101618063835fa8c19e73e" + } + ] +} diff --git a/pi-package/skills/do-task/SKILL.md b/pi-package/skills/do-task/SKILL.md index 16afac2..3e4bb5f 100644 --- a/pi-package/skills/do-task/SKILL.md +++ b/pi-package/skills/do-task/SKILL.md @@ -3,6 +3,8 @@ name: do-task description: Execute a single user-supplied prompt end-to-end in pi with plan review, implementation review, verification, and one persistent task-plan artifact. --- + + # Do Task (Pi) Execute an ad-hoc user prompt end-to-end: parse, clarify, plan, implement, verify, review, commit, and optionally push. diff --git a/pi-package/skills/do-task/templates/task-plan.md b/pi-package/skills/do-task/templates/task-plan.md index 4165ce1..3ddfee7 100644 --- a/pi-package/skills/do-task/templates/task-plan.md +++ b/pi-package/skills/do-task/templates/task-plan.md @@ -1,3 +1,4 @@ + # Task Plan: [Short Title] > **Variant guardrail (pi):** Required workflow skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) must be available to pi as documented in `docs/PI-SUPERPOWERS.md`. Load the relevant workflow skill before entering its matching phase. diff --git a/pi-package/skills/implement-plan/.generated-manifest.json b/pi-package/skills/implement-plan/.generated-manifest.json new file mode 100644 index 0000000..329cb71 --- /dev/null +++ b/pi-package/skills/implement-plan/.generated-manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "pi-package/skills/implement-plan", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "578e5b4fbc443ade486e4aa034b0875ebfa7eefd3a1268852ac1c5cbf71f28bf" + } + ] +} diff --git a/pi-package/skills/implement-plan/SKILL.md b/pi-package/skills/implement-plan/SKILL.md index eb4e77b..f458dff 100644 --- a/pi-package/skills/implement-plan/SKILL.md +++ b/pi-package/skills/implement-plan/SKILL.md @@ -3,6 +3,8 @@ name: implement-plan description: Use when a plan folder created by create-plan must be executed in pi with milestone verification, reviewer gates, local commits, and resumable tracker updates. --- + + # Implement Plan (Pi) Execute an existing plan under `ai_plan/` milestone by milestone, using verification gates, reviewer approval, and local commits after each approved milestone. diff --git a/pi-package/skills/web-automation/.generated-manifest.json b/pi-package/skills/web-automation/.generated-manifest.json new file mode 100644 index 0000000..f799067 --- /dev/null +++ b/pi-package/skills/web-automation/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "pi-package/skills/web-automation", + "files": [ + { + "path": "scripts/auth.ts", + "kind": "file", + "mode": "644", + "sha256": "c0940f452437b05b95e58a9a7ab265fb50aa412bd672e82fedd6a37cbfb3d505" + }, + { + "path": "scripts/browse.ts", + "kind": "file", + "mode": "644", + "sha256": "d7e4b4c50116032e5a00f90bca27e069dfc5bbf6eeb06ec8f8edc9e5a9792ab8" + }, + { + "path": "scripts/check-install.js", + "kind": "file", + "mode": "644", + "sha256": "e46ee8cbe103794bf1e9c3466bb0fbd21079ceddc60ad9521299e8bc0150e48f" + }, + { + "path": "scripts/extract.js", + "kind": "file", + "mode": "644", + "sha256": "6fa2a0589de8afd6501e332e5fa263e1344187ea43a33590b431cdee59d04217" + }, + { + "path": "scripts/flow.ts", + "kind": "file", + "mode": "644", + "sha256": "94f3e7987cab253dc3c9e80656a11759fada13b3915608bff7ae08418602f366" + }, + { + "path": "scripts/lib/browser.ts", + "kind": "file", + "mode": "644", + "sha256": "879b5f883ff1f888d45ed20be05c2d9bc3d6fe5305a1972b7d49a7e6c0e24934" + }, + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "1d9226da585c65106dacd874e5e6c7951f5a5b2b0f0cf5902f305a951ca4b44d" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "17017e15e8b04311f5d53bdd37065b2f5a514a3119f40a0403148440ed181437" + }, + { + "path": "scripts/scan-local-app.ts", + "kind": "file", + "mode": "644", + "sha256": "9e1818c254a633e087715609152936dcb3613a0aa724d40a8a13460510691dc7" + }, + { + "path": "scripts/scrape.ts", + "kind": "file", + "mode": "644", + "sha256": "a1a3d81d57d9e8ab1854ce3cb230bdd39ae1087ec50c9fe82cc58f5f2663ebeb" + }, + { + "path": "scripts/test-full.ts", + "kind": "file", + "mode": "644", + "sha256": "76a647e840753621445c36894bff62e163f6a2e4d0860fa8e64d8df45fe21e08" + }, + { + "path": "scripts/test-minimal.ts", + "kind": "file", + "mode": "644", + "sha256": "59e0b2319d3f7521b2a8a4fca2d779afaa157bf2d160160fdec8cb56bea30b4f" + }, + { + "path": "scripts/test-profile.ts", + "kind": "file", + "mode": "644", + "sha256": "6cf0141581a9275bfa8a070a36212cef5f6417d64df3df3e614ec682008376b9" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "e5f22d72266068cf410976c880511f2ec1875445256e11739a5e1de6ffedf38d" + }, + { + "path": "scripts/turndown-plugin-gfm.d.ts", + "kind": "file", + "mode": "644", + "sha256": "c5001c059b160eff18a4097a8a0a7b96689b4ebc374543c7d5bf6e40b0d8a5ac" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "7ff56c1c50697439875f4dd0a7f7697962c8ba2105a4f66ab7b170f5dcc762bd" + } + ] +} diff --git a/pi-package/skills/web-automation/SKILL.md b/pi-package/skills/web-automation/SKILL.md index 5a021e7..53b403a 100644 --- a/pi-package/skills/web-automation/SKILL.md +++ b/pi-package/skills/web-automation/SKILL.md @@ -3,6 +3,8 @@ name: web-automation description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. --- + + # Web Automation with CloakBrowser (Pi) Automated web browsing and scraping for pi using the shared runtime bundle in `scripts/`. diff --git a/pi-package/skills/web-automation/scripts/auth.ts b/pi-package/skills/web-automation/scripts/auth.ts index e79f23d..b06e846 100644 --- a/pi-package/skills/web-automation/scripts/auth.ts +++ b/pi-package/skills/web-automation/scripts/auth.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Authentication handler for web automation @@ -10,7 +11,7 @@ * npx tsx auth.ts --url "https://example.com" --type auto */ -import { getPage, launchBrowser } from './browse.js'; +import { getPage, launchBrowser } from './lib/browser.js'; import parseArgs from 'minimist'; import type { Page, BrowserContext } from 'playwright-core'; import { createInterface } from 'readline'; diff --git a/pi-package/skills/web-automation/scripts/browse.ts b/pi-package/skills/web-automation/scripts/browse.ts index 01cf098..e270db8 100644 --- a/pi-package/skills/web-automation/scripts/browse.ts +++ b/pi-package/skills/web-automation/scripts/browse.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Browser launcher using CloakBrowser with persistent profile @@ -9,12 +10,13 @@ * npx tsx browse.ts --url "https://example.com" --headless false --wait 5000 */ -import { launchPersistentContext } from 'cloakbrowser'; -import { homedir } from 'os'; -import { join } from 'path'; -import { existsSync, mkdirSync } from 'fs'; import parseArgs from 'minimist'; -import type { Page, BrowserContext } from 'playwright-core'; +import type { BrowserContext } from 'playwright-core'; + +import { getProfilePath, launchBrowser, getPage } from './lib/browser.js'; + +// Re-export shared helpers so existing imports of browse.ts continue to work. +export { getProfilePath, launchBrowser, getPage }; interface BrowseOptions { url: string; @@ -36,36 +38,6 @@ function sleep(ms: number): Promise { return new Promise((resolve) => setTimeout(resolve, ms)); } -const getProfilePath = (): string => { - const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; - if (customPath) return customPath; - - const profileDir = join(homedir(), '.cloakbrowser-profile'); - if (!existsSync(profileDir)) { - mkdirSync(profileDir, { recursive: true }); - } - return profileDir; -}; - -export async function launchBrowser(options: { - headless?: boolean; -}): Promise { - const profilePath = getProfilePath(); - const envHeadless = process.env.CLOAKBROWSER_HEADLESS; - const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); - - console.log(`Using profile: ${profilePath}`); - console.log(`Headless mode: ${headless}`); - - const context = await launchPersistentContext({ - userDataDir: profilePath, - headless, - humanize: true, - }); - - return context; -} - export async function browse(options: BrowseOptions): Promise { const browser = await launchBrowser({ headless: options.headless }); const page = browser.pages()[0] || await browser.newPage(); @@ -111,14 +83,6 @@ export async function browse(options: BrowseOptions): Promise { } } -export async function getPage(options?: { - headless?: boolean; -}): Promise<{ page: Page; browser: BrowserContext }> { - const browser = await launchBrowser({ headless: options?.headless }); - const page = browser.pages()[0] || await browser.newPage(); - return { page, browser }; -} - async function main() { const args = parseArgs(process.argv.slice(2), { string: ['url', 'output'], diff --git a/pi-package/skills/web-automation/scripts/check-install.js b/pi-package/skills/web-automation/scripts/check-install.js index 2a60c8a..cb7197d 100644 --- a/pi-package/skills/web-automation/scripts/check-install.js +++ b/pi-package/skills/web-automation/scripts/check-install.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; @@ -18,11 +19,9 @@ async function main() { try { await import("cloakbrowser"); await import("playwright-core"); - await import("better-sqlite3"); - await import("esbuild"); } catch (error) { fail( - "Missing dependency/config: web-automation requires cloakbrowser, playwright-core, better-sqlite3, and esbuild.", + "Missing dependency/config: web-automation requires cloakbrowser and playwright-core.", error instanceof Error ? error.message : String(error) ); } @@ -34,7 +33,6 @@ async function main() { } process.stdout.write("OK: cloakbrowser + playwright-core installed\n"); - process.stdout.write("OK: better-sqlite3 + esbuild installed\n"); process.stdout.write("OK: CloakBrowser integration detected in browse.ts\n"); } diff --git a/pi-package/skills/web-automation/scripts/extract.js b/pi-package/skills/web-automation/scripts/extract.js old mode 100755 new mode 100644 index 5e3908a..f7b5995 --- a/pi-package/skills/web-automation/scripts/extract.js +++ b/pi-package/skills/web-automation/scripts/extract.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/pi-package/skills/web-automation/scripts/flow.ts b/pi-package/skills/web-automation/scripts/flow.ts index 5d01e55..6b8b5e6 100644 --- a/pi-package/skills/web-automation/scripts/flow.ts +++ b/pi-package/skills/web-automation/scripts/flow.ts @@ -1,8 +1,9 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import parseArgs from 'minimist'; import type { Page } from 'playwright-core'; -import { launchBrowser } from './browse'; +import { launchBrowser } from './lib/browser.js'; type Step = | { action: 'goto'; url: string } diff --git a/pi-package/skills/web-automation/scripts/lib/browser.ts b/pi-package/skills/web-automation/scripts/lib/browser.ts new file mode 100644 index 0000000..5723bad --- /dev/null +++ b/pi-package/skills/web-automation/scripts/lib/browser.ts @@ -0,0 +1,76 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. +/** + * Shared browser-launch and profile helpers for web-automation scripts. + * + * Centralises the three reusable primitives that every command entry point + * needs: + * - getProfilePath() — resolve the persistent CloakBrowser profile dir + * - launchBrowser() — launch a CloakBrowser persistent context + * - getPage() — get a ready Page + BrowserContext pair + * + * All command entry points (auth.ts, browse.ts, flow.ts, scan-local-app.ts) + * import from here instead of duplicating these bodies. + */ + +import { launchPersistentContext } from 'cloakbrowser'; +import { existsSync, mkdirSync } from 'fs'; +import { homedir } from 'os'; +import { join } from 'path'; +import type { BrowserContext, Page } from 'playwright-core'; + +/** + * Return the path to the persistent CloakBrowser profile directory. + * + * Uses `CLOAKBROWSER_PROFILE_PATH` env var when set; otherwise defaults to + * `~/.cloakbrowser-profile/` and creates it if it does not exist. + */ +export function getProfilePath(): string { + const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; + if (customPath) return customPath; + + const profileDir = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profileDir)) { + mkdirSync(profileDir, { recursive: true }); + } + return profileDir; +} + +/** + * Launch a CloakBrowser persistent context with the shared profile. + * + * Headless mode is resolved in order: + * 1. `options.headless` (explicit caller preference) + * 2. `CLOAKBROWSER_HEADLESS` env var + * 3. `true` (safe default) + */ +export async function launchBrowser(options: { + headless?: boolean; +}): Promise { + const profilePath = getProfilePath(); + const envHeadless = process.env.CLOAKBROWSER_HEADLESS; + const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); + + console.log(`Using profile: ${profilePath}`); + console.log(`Headless mode: ${headless}`); + + const context = await launchPersistentContext({ + userDataDir: profilePath, + headless, + humanize: true, + }); + + return context; +} + +/** + * Return a ready `{ page, browser }` pair using the shared persistent profile. + * + * Re-uses the first existing page or opens a new one if the context is empty. + */ +export async function getPage(options?: { + headless?: boolean; +}): Promise<{ page: Page; browser: BrowserContext }> { + const browser = await launchBrowser({ headless: options?.headless }); + const page = browser.pages()[0] || (await browser.newPage()); + return { page, browser }; +} diff --git a/pi-package/skills/web-automation/scripts/package.json b/pi-package/skills/web-automation/scripts/package.json index a2221e8..6bc3972 100644 --- a/pi-package/skills/web-automation/scripts/package.json +++ b/pi-package/skills/web-automation/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "web-automation-scripts", + "name": "@ai-coding-skills/web-automation-pi-mirror", "version": "1.0.0", "description": "Web browsing and scraping scripts using CloakBrowser", "type": "module", @@ -32,5 +32,6 @@ "tsx": "^4.7.0", "typescript": "^5.3.0" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/pi-package/skills/web-automation/scripts/scan-local-app.ts b/pi-package/skills/web-automation/scripts/scan-local-app.ts index 6a05b35..cf8d190 100644 --- a/pi-package/skills/web-automation/scripts/scan-local-app.ts +++ b/pi-package/skills/web-automation/scripts/scan-local-app.ts @@ -1,8 +1,10 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { mkdirSync, writeFileSync } from 'fs'; import { dirname, resolve } from 'path'; -import { getPage } from './browse.js'; +import type { Page } from 'playwright-core'; +import { getPage } from './lib/browser.js'; type NavResult = { requestedUrl: string; @@ -39,30 +41,34 @@ function getRoutes(baseUrl: string): string[] { return [baseUrl]; } -async function gotoWithStatus(page: any, url: string): Promise { +type GotoError = { error: unknown }; + +async function gotoWithStatus(page: Page, url: string): Promise { const response = await page .goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }) - .catch((error: unknown) => ({ error })); + .catch((error: unknown): GotoError => ({ error })); - if (response?.error) { + if (response !== null && response !== undefined && 'error' in response) { + const gotoError = response as GotoError; return { requestedUrl: url, url: page.url(), status: null, title: await page.title().catch(() => ''), - error: String(response.error), + error: String(gotoError.error), }; } + const httpResponse = response as Awaited>; return { requestedUrl: url, url: page.url(), - status: response ? response.status() : null, + status: httpResponse ? httpResponse.status() : null, title: await page.title().catch(() => ''), }; } -async function textOrNull(page: any, selector: string): Promise { +async function textOrNull(page: Page, selector: string): Promise { const locator = page.locator(selector).first(); try { if ((await locator.count()) === 0) return null; @@ -73,7 +79,7 @@ async function textOrNull(page: any, selector: string): Promise { } } -async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { +async function loginIfConfigured(page: Page, baseUrl: string, lines: string[]) { const loginPath = env('SCAN_LOGIN_PATH'); const username = env('SCAN_USERNAME') ?? env('CLOAKBROWSER_USERNAME'); const password = env('SCAN_PASSWORD') ?? env('CLOAKBROWSER_PASSWORD'); @@ -109,7 +115,7 @@ async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { lines.push(''); } -async function checkRoutes(page: any, baseUrl: string, lines: string[]) { +async function checkRoutes(page: Page, baseUrl: string, lines: string[]) { const routes = getRoutes(baseUrl); const routeChecks: RouteCheck[] = []; diff --git a/pi-package/skills/web-automation/scripts/scrape.ts b/pi-package/skills/web-automation/scripts/scrape.ts index 0820de0..2a4b75d 100644 --- a/pi-package/skills/web-automation/scripts/scrape.ts +++ b/pi-package/skills/web-automation/scripts/scrape.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Web scraper that extracts content to markdown diff --git a/pi-package/skills/web-automation/scripts/test-full.ts b/pi-package/skills/web-automation/scripts/test-full.ts index 356bbab..16037ee 100644 --- a/pi-package/skills/web-automation/scripts/test-full.ts +++ b/pi-package/skills/web-automation/scripts/test-full.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/pi-package/skills/web-automation/scripts/test-minimal.ts b/pi-package/skills/web-automation/scripts/test-minimal.ts index a5412e7..7cef2ce 100644 --- a/pi-package/skills/web-automation/scripts/test-minimal.ts +++ b/pi-package/skills/web-automation/scripts/test-minimal.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launch } from 'cloakbrowser'; async function test() { diff --git a/pi-package/skills/web-automation/scripts/test-profile.ts b/pi-package/skills/web-automation/scripts/test-profile.ts index ec59ddd..604ec55 100644 --- a/pi-package/skills/web-automation/scripts/test-profile.ts +++ b/pi-package/skills/web-automation/scripts/test-profile.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/pi-package/skills/web-automation/scripts/tsconfig.json b/pi-package/skills/web-automation/scripts/tsconfig.json index 4c23583..689017a 100644 --- a/pi-package/skills/web-automation/scripts/tsconfig.json +++ b/pi-package/skills/web-automation/scripts/tsconfig.json @@ -11,6 +11,6 @@ "outDir": "./dist", "rootDir": "." }, - "include": ["*.ts"], + "include": ["*.ts", "lib/**/*.ts"], "exclude": ["node_modules", "dist"] } diff --git a/pi-package/skills/web-automation/scripts/turndown-plugin-gfm.d.ts b/pi-package/skills/web-automation/scripts/turndown-plugin-gfm.d.ts index 316bed1..113765e 100644 --- a/pi-package/skills/web-automation/scripts/turndown-plugin-gfm.d.ts +++ b/pi-package/skills/web-automation/scripts/turndown-plugin-gfm.d.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. declare module 'turndown-plugin-gfm' { import TurndownService from 'turndown'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..50c406d --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,3404 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@eslint/js': + specifier: 10.0.1 + version: 10.0.1(eslint@10.3.0) + eslint: + specifier: 10.3.0 + version: 10.3.0 + globals: + specifier: 17.6.0 + version: 17.6.0 + markdown-link-check: + specifier: 3.14.2 + version: 3.14.2 + markdownlint-cli2: + specifier: 0.22.1 + version: 0.22.1 + prettier: + specifier: 3.8.3 + version: 3.8.3 + + pi-package/skills/atlassian/scripts: + dependencies: + commander: + specifier: ^13.1.0 + version: 13.1.0 + dotenv: + specifier: ^16.4.7 + version: 16.6.1 + devDependencies: + '@types/node': + specifier: ^24.3.0 + version: 24.12.2 + tsx: + specifier: ^4.20.5 + version: 4.21.0 + typescript: + specifier: ^5.9.2 + version: 5.9.3 + + pi-package/skills/web-automation/scripts: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.9.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.26(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.4 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + skills/atlassian/claude-code/scripts: + dependencies: + commander: + specifier: ^13.1.0 + version: 13.1.0 + dotenv: + specifier: ^16.4.7 + version: 16.6.1 + devDependencies: + '@types/node': + specifier: ^24.3.0 + version: 24.12.2 + tsx: + specifier: ^4.20.5 + version: 4.21.0 + typescript: + specifier: ^5.9.2 + version: 5.9.3 + + skills/atlassian/codex/scripts: + dependencies: + commander: + specifier: ^13.1.0 + version: 13.1.0 + dotenv: + specifier: ^16.4.7 + version: 16.6.1 + devDependencies: + '@types/node': + specifier: ^24.3.0 + version: 24.12.2 + tsx: + specifier: ^4.20.5 + version: 4.21.0 + typescript: + specifier: ^5.9.2 + version: 5.9.3 + + skills/atlassian/cursor/scripts: + dependencies: + commander: + specifier: ^13.1.0 + version: 13.1.0 + dotenv: + specifier: ^16.4.7 + version: 16.6.1 + devDependencies: + '@types/node': + specifier: ^24.3.0 + version: 24.12.2 + tsx: + specifier: ^4.20.5 + version: 4.21.0 + typescript: + specifier: ^5.9.2 + version: 5.9.3 + + skills/atlassian/opencode/scripts: + dependencies: + commander: + specifier: ^13.1.0 + version: 13.1.0 + dotenv: + specifier: ^16.4.7 + version: 16.6.1 + devDependencies: + '@types/node': + specifier: ^24.3.0 + version: 24.12.2 + tsx: + specifier: ^4.20.5 + version: 4.21.0 + typescript: + specifier: ^5.9.2 + version: 5.9.3 + + skills/atlassian/pi/scripts: + dependencies: + commander: + specifier: ^13.1.0 + version: 13.1.0 + dotenv: + specifier: ^16.4.7 + version: 16.6.1 + devDependencies: + '@types/node': + specifier: ^24.3.0 + version: 24.12.2 + tsx: + specifier: ^4.20.5 + version: 4.21.0 + typescript: + specifier: ^5.9.2 + version: 5.9.3 + + skills/atlassian/shared/scripts: + dependencies: + commander: + specifier: ^13.1.0 + version: 13.1.0 + dotenv: + specifier: ^16.4.7 + version: 16.6.1 + devDependencies: + '@types/node': + specifier: ^24.3.0 + version: 24.12.2 + tsx: + specifier: ^4.20.5 + version: 4.21.0 + typescript: + specifier: ^5.9.2 + version: 5.9.3 + + skills/web-automation/claude-code/scripts: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.9.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.26(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.4 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + skills/web-automation/codex/scripts: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.9.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.26(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.4 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + skills/web-automation/cursor/scripts: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.9.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.26(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.4 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + skills/web-automation/opencode/scripts: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.9.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.26(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.4 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + skills/web-automation/pi/scripts: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.9.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.26(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.4 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + + skills/web-automation/shared: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.9.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.26(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.4 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + +packages: + + '@asamuzakjp/css-color@3.2.0': + resolution: {integrity: sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==} + + '@csstools/color-helpers@5.1.0': + resolution: {integrity: sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==} + engines: {node: '>=18'} + + '@csstools/css-calc@2.1.4': + resolution: {integrity: sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-parser-algorithms': ^3.0.5 + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-color-parser@3.1.0': + resolution: {integrity: sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-parser-algorithms': ^3.0.5 + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-parser-algorithms@3.0.5': + resolution: {integrity: sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-tokenizer@3.0.4': + resolution: {integrity: sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==} + engines: {node: '>=18'} + + '@esbuild/aix-ppc64@0.27.0': + resolution: {integrity: sha512-KuZrd2hRjz01y5JK9mEBSD3Vj3mbCvemhT466rSuJYeE/hjuBrHfjjcjMdTm/sz7au+++sdbJZJmuBwQLuw68A==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.27.0': + resolution: {integrity: sha512-CC3vt4+1xZrs97/PKDkl0yN7w8edvU2vZvAFGD16n9F0Cvniy5qvzRXjfO1l94efczkkQE6g1x0i73Qf5uthOQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.27.0': + resolution: {integrity: sha512-j67aezrPNYWJEOHUNLPj9maeJte7uSMM6gMoxfPC9hOg8N02JuQi/T7ewumf4tNvJadFkvLZMlAq73b9uwdMyQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.27.0': + resolution: {integrity: sha512-wurMkF1nmQajBO1+0CJmcN17U4BP6GqNSROP8t0X/Jiw2ltYGLHpEksp9MpoBqkrFR3kv2/te6Sha26k3+yZ9Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.27.0': + resolution: {integrity: sha512-uJOQKYCcHhg07DL7i8MzjvS2LaP7W7Pn/7uA0B5S1EnqAirJtbyw4yC5jQ5qcFjHK9l6o/MX9QisBg12kNkdHg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.27.0': + resolution: {integrity: sha512-8mG6arH3yB/4ZXiEnXof5MK72dE6zM9cDvUcPtxhUZsDjESl9JipZYW60C3JGreKCEP+p8P/72r69m4AZGJd5g==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.27.0': + resolution: {integrity: sha512-9FHtyO988CwNMMOE3YIeci+UV+x5Zy8fI2qHNpsEtSF83YPBmE8UWmfYAQg6Ux7Gsmd4FejZqnEUZCMGaNQHQw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.27.0': + resolution: {integrity: sha512-zCMeMXI4HS/tXvJz8vWGexpZj2YVtRAihHLk1imZj4efx1BQzN76YFeKqlDr3bUWI26wHwLWPd3rwh6pe4EV7g==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.27.0': + resolution: {integrity: sha512-AS18v0V+vZiLJyi/4LphvBE+OIX682Pu7ZYNsdUHyUKSoRwdnOsMf6FDekwoAFKej14WAkOef3zAORJgAtXnlQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.27.0': + resolution: {integrity: sha512-t76XLQDpxgmq2cNXKTVEB7O7YMb42atj2Re2Haf45HkaUpjM2J0UuJZDuaGbPbamzZ7bawyGFUkodL+zcE+jvQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.27.0': + resolution: {integrity: sha512-Mz1jxqm/kfgKkc/KLHC5qIujMvnnarD9ra1cEcrs7qshTUSksPihGrWHVG5+osAIQ68577Zpww7SGapmzSt4Nw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.27.0': + resolution: {integrity: sha512-QbEREjdJeIreIAbdG2hLU1yXm1uu+LTdzoq1KCo4G4pFOLlvIspBm36QrQOar9LFduavoWX2msNFAAAY9j4BDg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.27.0': + resolution: {integrity: sha512-sJz3zRNe4tO2wxvDpH/HYJilb6+2YJxo/ZNbVdtFiKDufzWq4JmKAiHy9iGoLjAV7r/W32VgaHGkk35cUXlNOg==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.27.0': + resolution: {integrity: sha512-z9N10FBD0DCS2dmSABDBb5TLAyF1/ydVb+N4pi88T45efQ/w4ohr/F/QYCkxDPnkhkp6AIpIcQKQ8F0ANoA2JA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.27.0': + resolution: {integrity: sha512-pQdyAIZ0BWIC5GyvVFn5awDiO14TkT/19FTmFcPdDec94KJ1uZcmFs21Fo8auMXzD4Tt+diXu1LW1gHus9fhFQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.27.0': + resolution: {integrity: sha512-hPlRWR4eIDDEci953RI1BLZitgi5uqcsjKMxwYfmi4LcwyWo2IcRP+lThVnKjNtk90pLS8nKdroXYOqW+QQH+w==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.27.0': + resolution: {integrity: sha512-1hBWx4OUJE2cab++aVZ7pObD6s+DK4mPGpemtnAORBvb5l/g5xFGk0vc0PjSkrDs0XaXj9yyob3d14XqvnQ4gw==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.27.0': + resolution: {integrity: sha512-6m0sfQfxfQfy1qRuecMkJlf1cIzTOgyaeXaiVaaki8/v+WB+U4hc6ik15ZW6TAllRlg/WuQXxWj1jx6C+dfy3w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.27.0': + resolution: {integrity: sha512-xbbOdfn06FtcJ9d0ShxxvSn2iUsGd/lgPIO2V3VZIPDbEaIj1/3nBBe1AwuEZKXVXkMmpr6LUAgMkLD/4D2PPA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.27.0': + resolution: {integrity: sha512-fWgqR8uNbCQ/GGv0yhzttj6sU/9Z5/Sv/VGU3F5OuXK6J6SlriONKrQ7tNlwBrJZXRYk5jUhuWvF7GYzGguBZQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.27.0': + resolution: {integrity: sha512-aCwlRdSNMNxkGGqQajMUza6uXzR/U0dIl1QmLjPtRbLOx3Gy3otfFu/VjATy4yQzo9yFDGTxYDo1FfAD9oRD2A==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.27.0': + resolution: {integrity: sha512-nyvsBccxNAsNYz2jVFYwEGuRRomqZ149A39SHWk4hV0jWxKM0hjBPm3AmdxcbHiFLbBSwG6SbpIcUbXjgyECfA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.27.0': + resolution: {integrity: sha512-Q1KY1iJafM+UX6CFEL+F4HRTgygmEW568YMqDA5UV97AuZSm21b7SXIrRJDwXWPzr8MGr75fUZPV67FdtMHlHA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.27.0': + resolution: {integrity: sha512-W1eyGNi6d+8kOmZIwi/EDjrL9nxQIQ0MiGqe/AWc6+IaHloxHSGoeRgDRKHFISThLmsewZ5nHFvGFWdBYlgKPg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.27.0': + resolution: {integrity: sha512-30z1aKL9h22kQhilnYkORFYt+3wp7yZsHWus+wSKAJR8JtdfI76LJ4SBdMsCopTR3z/ORqVu5L1vtnHZWVj4cQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.27.0': + resolution: {integrity: sha512-aIitBcjQeyOhMTImhLZmtxfdOcuNRpwlPNmlFKPcHQYPhEssw75Cl1TSXJXpMkzaua9FUetx/4OQKq7eJul5Cg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@eslint-community/eslint-utils@4.9.1': + resolution: {integrity: sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + + '@eslint-community/regexpp@4.12.2': + resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + + '@eslint/config-array@0.23.5': + resolution: {integrity: sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/config-helpers@0.5.5': + resolution: {integrity: sha512-eIJYKTCECbP/nsKaaruF6LW967mtbQbsw4JTtSVkUQc9MneSkbrgPJAbKl9nWr0ZeowV8BfsarBmPpBzGelA2w==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/core@1.2.1': + resolution: {integrity: sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/js@10.0.1': + resolution: {integrity: sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + peerDependencies: + eslint: ^10.0.0 + peerDependenciesMeta: + eslint: + optional: true + + '@eslint/object-schema@3.0.5': + resolution: {integrity: sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/plugin-kit@0.7.1': + resolution: {integrity: sha512-rZAP3aVgB9ds9KOeUSL+zZ21hPmo8dh6fnIFwRQj5EAZl9gzR7wxYbYXYysAM8CTqGmUGyp2S4kUdV17MnGuWQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@humanfs/core@0.19.2': + resolution: {integrity: sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.8': + resolution: {integrity: sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==} + engines: {node: '>=18.18.0'} + + '@humanfs/types@0.15.0': + resolution: {integrity: sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==} + engines: {node: '>=18.18.0'} + + '@humanwhocodes/module-importer@1.0.1': + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} + + '@humanwhocodes/retry@0.4.3': + resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} + engines: {node: '>=18.18'} + + '@isaacs/fs-minipass@4.0.1': + resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} + engines: {node: '>=18.0.0'} + + '@mixmark-io/domino@2.2.0': + resolution: {integrity: sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==} + + '@mozilla/readability@0.5.0': + resolution: {integrity: sha512-Z+CZ3QaosfFaTqvhQsIktyGrjFjSC0Fa4EMph4mqKnWhmyoGICsV/8QK+8HpXut6zV7zwfWwqDmEjtk1Qf6EgQ==} + engines: {node: '>=14.0.0'} + + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + + '@oozcitak/dom@2.0.2': + resolution: {integrity: sha512-GjpKhkSYC3Mj4+lfwEyI1dqnsKTgwGy48ytZEhm4A/xnH/8z9M3ZVXKr/YGQi3uCLs1AEBS+x5T2JPiueEDW8w==} + engines: {node: '>=20.0'} + + '@oozcitak/infra@2.0.2': + resolution: {integrity: sha512-2g+E7hoE2dgCz/APPOEK5s3rMhJvNxSMBrP+U+j1OWsIbtSpWxxlUjq1lU8RIsFJNYv7NMlnVsCuHcUzJW+8vA==} + engines: {node: '>=20.0'} + + '@oozcitak/url@3.0.0': + resolution: {integrity: sha512-ZKfET8Ak1wsLAiLWNfFkZc/BraDccuTJKR6svTYc7sVjbR+Iu0vtXdiDMY4o6jaFl5TW2TlS7jbLl4VovtAJWQ==} + engines: {node: '>=20.0'} + + '@oozcitak/util@10.0.0': + resolution: {integrity: sha512-hAX0pT/73190NLqBPPWSdBVGtbY6VOhWYK3qqHqtXQ1gK7kS2yz4+ivsN07hpJ6I3aeMtKP6J6npsEKOAzuTLA==} + engines: {node: '>=20.0'} + + '@sindresorhus/merge-streams@4.0.0': + resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} + engines: {node: '>=18'} + + '@tootallnate/quickjs-emscripten@0.23.0': + resolution: {integrity: sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==} + + '@types/debug@4.1.13': + resolution: {integrity: sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==} + + '@types/esrecurse@4.3.1': + resolution: {integrity: sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==} + + '@types/estree@1.0.8': + resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + + '@types/jsdom@21.1.7': + resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/katex@0.16.8': + resolution: {integrity: sha512-trgaNyfU+Xh2Tc+ABIb44a5AYUpicB3uwirOioeOkNPPbmgRNtcWyDeeFRzjPZENO9Vq8gvVqfhaaXWLlevVwg==} + + '@types/minimist@1.2.5': + resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} + + '@types/ms@2.1.0': + resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} + + '@types/node@24.12.2': + resolution: {integrity: sha512-A1sre26ke7HDIuY/M23nd9gfB+nrmhtYyMINbjI1zHJxYteKR6qSMX56FsmjMcDb3SMcjJg5BiRRgOCC/yBD0g==} + + '@types/tough-cookie@4.0.5': + resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} + + '@types/turndown@5.0.6': + resolution: {integrity: sha512-ru00MoyeeouE5BX4gRL+6m/BsDfbRayOskWqUvh7CLGW+UXxHQItqALa38kKnOiZPqJrtzJUgAC2+F0rL1S4Pg==} + + '@types/unist@2.0.11': + resolution: {integrity: sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==} + + acorn-jsx@5.3.2: + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + + acorn@8.16.0: + resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==} + engines: {node: '>=0.4.0'} + hasBin: true + + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + + ajv@6.15.0: + resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} + + ansi-regex@6.2.2: + resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==} + engines: {node: '>=12'} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + + ast-types@0.13.4: + resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} + engines: {node: '>=4'} + + async@3.2.6: + resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} + + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + basic-ftp@5.3.1: + resolution: {integrity: sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw==} + engines: {node: '>=10.0.0'} + + better-sqlite3@12.9.0: + resolution: {integrity: sha512-wqUv4Gm3toFpHDQmaKD4QhZm3g1DjUBI0yzS4UBl6lElUmXFYdTQmmEDpAFa5o8FiFiymURypEnfVHzILKaxqQ==} + engines: {node: 20.x || 22.x || 23.x || 24.x || 25.x} + + bindings@1.5.0: + resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + + bl@4.1.0: + resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} + + boolbase@1.0.0: + resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} + + brace-expansion@5.0.5: + resolution: {integrity: sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==} + engines: {node: 18 || 20 || >=22} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + character-entities-legacy@3.0.0: + resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==} + + character-entities@2.0.2: + resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==} + + character-reference-invalid@2.0.1: + resolution: {integrity: sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==} + + cheerio-select@2.1.0: + resolution: {integrity: sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==} + + cheerio@1.2.0: + resolution: {integrity: sha512-WDrybc/gKFpTYQutKIK6UvfcuxijIZfMfXaYm8NMsPQxSYvf+13fXUJ4rztGGbJcBQ/GF55gvrZ0Bc0bj/mqvg==} + engines: {node: '>=20.18.1'} + + chownr@1.1.4: + resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} + + chownr@3.0.0: + resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==} + engines: {node: '>=18'} + + cloakbrowser@0.3.26: + resolution: {integrity: sha512-SWzAUNSLM8SANO7rnqFHPHinp63DDn3+MmxsSiJ/G+LUyo5ADwxZgBe3sQfLOjFa5QKoZuS9vvA3PqZNjzQIRQ==} + engines: {node: '>=20.0.0'} + hasBin: true + peerDependencies: + mmdb-lib: '>=2.0.0' + playwright-core: '>=1.40.0' + puppeteer-core: '>=21.0.0' + socks-proxy-agent: '>=10.0.0' + peerDependenciesMeta: + mmdb-lib: + optional: true + playwright-core: + optional: true + puppeteer-core: + optional: true + socks-proxy-agent: + optional: true + + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + + commander@13.1.0: + resolution: {integrity: sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==} + engines: {node: '>=18'} + + commander@14.0.3: + resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} + engines: {node: '>=20'} + + commander@8.3.0: + resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} + engines: {node: '>= 12'} + + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + css-select@5.2.2: + resolution: {integrity: sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==} + + css-what@6.2.2: + resolution: {integrity: sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==} + engines: {node: '>= 6'} + + cssstyle@4.6.0: + resolution: {integrity: sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==} + engines: {node: '>=18'} + + data-uri-to-buffer@6.0.2: + resolution: {integrity: sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==} + engines: {node: '>= 14'} + + data-urls@5.0.0: + resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} + engines: {node: '>=18'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decimal.js@10.6.0: + resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==} + + decode-named-character-reference@1.3.0: + resolution: {integrity: sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==} + + decompress-response@6.0.0: + resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} + engines: {node: '>=10'} + + deep-extend@0.6.0: + resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} + engines: {node: '>=4.0.0'} + + deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + + degenerator@5.0.1: + resolution: {integrity: sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==} + engines: {node: '>= 14'} + + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + dequal@2.0.3: + resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} + engines: {node: '>=6'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + devlop@1.1.0: + resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + + dom-serializer@2.0.0: + resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} + + domelementtype@2.3.0: + resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} + + domhandler@5.0.3: + resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} + engines: {node: '>= 4'} + + domutils@3.2.2: + resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==} + + dotenv@16.6.1: + resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==} + engines: {node: '>=12'} + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + encoding-sniffer@0.2.1: + resolution: {integrity: sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==} + + end-of-stream@1.4.5: + resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} + + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + + entities@6.0.1: + resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==} + engines: {node: '>=0.12'} + + entities@7.0.1: + resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==} + engines: {node: '>=0.12'} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-object-atoms@1.1.1: + resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + + esbuild@0.27.0: + resolution: {integrity: sha512-jd0f4NHbD6cALCyGElNpGAOtWxSq46l9X/sWB0Nzd5er4Kz2YTm+Vl0qKFT9KUJvD8+fiO8AvoHhFvEatfVixA==} + engines: {node: '>=18'} + hasBin: true + + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + escodegen@2.1.0: + resolution: {integrity: sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==} + engines: {node: '>=6.0'} + hasBin: true + + eslint-scope@9.1.2: + resolution: {integrity: sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + eslint-visitor-keys@5.0.1: + resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + eslint@10.3.0: + resolution: {integrity: sha512-XbEXaRva5cF0ZQB8w6MluHA0kZZfV2DuCMJ3ozyEOHLwDpZX2Lmm/7Pp0xdJmI0GL1W05VH5VwIFHEm1Vcw2gw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true + + espree@11.2.0: + resolution: {integrity: sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + esquery@1.7.0: + resolution: {integrity: sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==} + engines: {node: '>=0.10'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + + expand-template@2.0.3: + resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} + engines: {node: '>=6'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + engines: {node: '>=8.6.0'} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + + fastq@1.20.1: + resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} + + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} + + file-uri-to-path@1.0.0: + resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} + + flatted@3.4.2: + resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==} + + form-data@4.0.5: + resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==} + engines: {node: '>= 6'} + + fs-constants@1.0.0: + resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + get-east-asian-width@1.5.0: + resolution: {integrity: sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==} + engines: {node: '>=18'} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + get-tsconfig@4.14.0: + resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==} + + get-uri@6.0.5: + resolution: {integrity: sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==} + engines: {node: '>= 14'} + + github-from-package@0.0.0: + resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + + globals@17.6.0: + resolution: {integrity: sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA==} + engines: {node: '>=18'} + + globby@16.2.0: + resolution: {integrity: sha512-QrJia2qDf5BB/V6HYlDTs0I0lBahyjLzpGQg3KT7FnCdTonAyPy2RtY802m2k4ALx6Dp752f82WsOczEVr3l6Q==} + engines: {node: '>=20'} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hasown@2.0.3: + resolution: {integrity: sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==} + engines: {node: '>= 0.4'} + + html-encoding-sniffer@4.0.0: + resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} + engines: {node: '>=18'} + + html-link-extractor@1.0.5: + resolution: {integrity: sha512-ADd49pudM157uWHwHQPUSX4ssMsvR/yHIswOR5CUfBdK9g9ZYGMhVSE6KZVHJ6kCkR0gH4htsfzU6zECDNVwyw==} + + htmlparser2@10.1.0: + resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==} + + http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + + iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + ignore@7.0.5: + resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} + engines: {node: '>= 4'} + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + ini@1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + + ip-address@10.2.0: + resolution: {integrity: sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==} + engines: {node: '>= 12'} + + is-absolute-url@4.0.1: + resolution: {integrity: sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + is-alphabetical@2.0.1: + resolution: {integrity: sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==} + + is-alphanumerical@2.0.1: + resolution: {integrity: sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==} + + is-decimal@2.0.1: + resolution: {integrity: sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-hexadecimal@2.0.1: + resolution: {integrity: sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-path-inside@4.0.0: + resolution: {integrity: sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==} + engines: {node: '>=12'} + + is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + + is-relative-url@4.1.0: + resolution: {integrity: sha512-vhIXKasjAuxS7n+sdv7pJQykEAgS+YU8VBQOENXwo/VZpOHDgBBsIbHo7zFKaWBjYWF4qxERdhbPRRtFAeJKfg==} + engines: {node: '>=14.16'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + js-yaml@4.1.1: + resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==} + hasBin: true + + jsdom@24.1.3: + resolution: {integrity: sha512-MyL55p3Ut3cXbeBEG7Hcv0mVM8pp8PBNWxRqchZnSfAiES1v1mRnMeFfaHWIPULpwsYfvO+ZmMZz5tGCnjzDUQ==} + engines: {node: '>=18'} + peerDependencies: + canvas: ^2.11.2 + peerDependenciesMeta: + canvas: + optional: true + + json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + + jsonc-parser@3.3.1: + resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} + + jsonpointer@5.0.1: + resolution: {integrity: sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==} + engines: {node: '>=0.10.0'} + + katex@0.16.45: + resolution: {integrity: sha512-pQpZbdBu7wCTmQUh7ufPmLr0pFoObnGUoL/yhtwJDgmmQpbkg/0HSVti25Fu4rmd1oCR6NGWe9vqTWuWv3GcNA==} + hasBin: true + + keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + + levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + + link-check@5.5.1: + resolution: {integrity: sha512-GrtE4Zp/FBduvElmad375NrPeMYnKwNt9rH/TDG/rbQbHL0QVC4S/cEPVKZ0CkhXlVuiK+/5flGpRxQzoLbjEA==} + + linkify-it@5.0.0: + resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} + + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + lru-cache@7.18.3: + resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==} + engines: {node: '>=12'} + + markdown-it@14.1.1: + resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==} + hasBin: true + + markdown-link-check@3.14.2: + resolution: {integrity: sha512-DPJ+itd3D5fcfXD5s1i53lugH0Z/h80kkQxlYCBh8tFwEZGhyVgDcLl0rnKlWssAVDAmSmcbePpHpMEY+JcMMQ==} + hasBin: true + + markdown-link-extractor@4.0.3: + resolution: {integrity: sha512-aEltJiQ4/oC0h6Jbw/uuATGSHZPkcH8DIunNH1A0e+GSFkvZ6BbBkdvBTVfIV8r6HapCU3yTd0eFdi3ZeM1eAQ==} + + markdownlint-cli2-formatter-default@0.0.6: + resolution: {integrity: sha512-VVDGKsq9sgzu378swJ0fcHfSicUnMxnL8gnLm/Q4J/xsNJ4e5bA6lvAz7PCzIl0/No0lHyaWdqVD2jotxOSFMQ==} + peerDependencies: + markdownlint-cli2: '>=0.0.4' + + markdownlint-cli2@0.22.1: + resolution: {integrity: sha512-X14ZbytybDCXAViDmtN4DKLt9ZTrRn+oOrxTYlg3a65jS6QcYYbAkGPh/En2L/GDNbFYJ6lKaQSUNrrbN1bPrw==} + engines: {node: '>=20'} + hasBin: true + + markdownlint@0.40.0: + resolution: {integrity: sha512-UKybllYNheWac61Ia7T6fzuQNDZimFIpCg2w6hHjgV1Qu0w1TV0LlSgryUGzM0bkKQCBhy2FDhEELB73Kb0kAg==} + engines: {node: '>=20'} + + marked@17.0.6: + resolution: {integrity: sha512-gB0gkNafnonOw0obSTEGZTT86IuhILt2Wfx0mWH/1Au83kybTayroZ/V6nS25mN7u8ASy+5fMhgB3XPNrOZdmA==} + engines: {node: '>= 20'} + hasBin: true + + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + mdurl@2.0.0: + resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==} + + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + micromark-core-commonmark@2.0.3: + resolution: {integrity: sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==} + + micromark-extension-directive@4.0.0: + resolution: {integrity: sha512-/C2nqVmXXmiseSSuCdItCMho7ybwwop6RrrRPk0KbOHW21JKoCldC+8rFOaundDoRBUWBnJJcxeA/Kvi34WQXg==} + + micromark-extension-gfm-autolink-literal@2.1.0: + resolution: {integrity: sha512-oOg7knzhicgQ3t4QCjCWgTmfNhvQbDDnJeVu9v81r7NltNCVmhPy1fJRX27pISafdjL+SVc4d3l48Gb6pbRypw==} + + micromark-extension-gfm-footnote@2.1.0: + resolution: {integrity: sha512-/yPhxI1ntnDNsiHtzLKYnE3vf9JZ6cAisqVDauhp4CEHxlb4uoOTxOCJ+9s51bIB8U1N1FJ1RXOKTIlD5B/gqw==} + + micromark-extension-gfm-table@2.1.1: + resolution: {integrity: sha512-t2OU/dXXioARrC6yWfJ4hqB7rct14e8f7m0cbI5hUmDyyIlwv5vEtooptH8INkbLzOatzKuVbQmAYcbWoyz6Dg==} + + micromark-extension-math@3.1.0: + resolution: {integrity: sha512-lvEqd+fHjATVs+2v/8kg9i5Q0AP2k85H0WUOwpIVvUML8BapsMvh1XAogmQjOCsLpoKRCVQqEkQBB3NhVBcsOg==} + + micromark-factory-destination@2.0.1: + resolution: {integrity: sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==} + + micromark-factory-label@2.0.1: + resolution: {integrity: sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==} + + micromark-factory-space@2.0.1: + resolution: {integrity: sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==} + + micromark-factory-title@2.0.1: + resolution: {integrity: sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==} + + micromark-factory-whitespace@2.0.1: + resolution: {integrity: sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==} + + micromark-util-character@2.1.1: + resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} + + micromark-util-chunked@2.0.1: + resolution: {integrity: sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==} + + micromark-util-classify-character@2.0.1: + resolution: {integrity: sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==} + + micromark-util-combine-extensions@2.0.1: + resolution: {integrity: sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==} + + micromark-util-decode-numeric-character-reference@2.0.2: + resolution: {integrity: sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==} + + micromark-util-encode@2.0.1: + resolution: {integrity: sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==} + + micromark-util-html-tag-name@2.0.1: + resolution: {integrity: sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==} + + micromark-util-normalize-identifier@2.0.1: + resolution: {integrity: sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==} + + micromark-util-resolve-all@2.0.1: + resolution: {integrity: sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==} + + micromark-util-sanitize-uri@2.0.1: + resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==} + + micromark-util-subtokenize@2.1.0: + resolution: {integrity: sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==} + + micromark-util-symbol@2.0.1: + resolution: {integrity: sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==} + + micromark-util-types@2.0.2: + resolution: {integrity: sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==} + + micromark@4.0.2: + resolution: {integrity: sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mimic-response@3.1.0: + resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} + engines: {node: '>=10'} + + minimatch@10.2.5: + resolution: {integrity: sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==} + engines: {node: 18 || 20 || >=22} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + minipass@7.1.3: + resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} + engines: {node: '>=16 || 14 >=14.17'} + + minizlib@3.1.0: + resolution: {integrity: sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==} + engines: {node: '>= 18'} + + mkdirp-classic@0.5.3: + resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + napi-build-utils@2.0.0: + resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==} + + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + + needle@3.5.0: + resolution: {integrity: sha512-jaQyPKKk2YokHrEg+vFDYxXIHTCBgiZwSHOoVx/8V3GIBS8/VN6NdVRmg8q1ERtPkMvmOvebsgga4sAj5hls/w==} + engines: {node: '>= 4.4.x'} + hasBin: true + + netmask@2.1.1: + resolution: {integrity: sha512-eonl3sLUha+S1GzTPxychyhnUzKyeQkZ7jLjKrBagJgPla13F+uQ71HgpFefyHgqrjEbCPkDArxYsjY8/+gLKA==} + engines: {node: '>= 0.4.0'} + + node-abi@3.90.0: + resolution: {integrity: sha512-pZNQT7UnYlMwMBy5N1lV5X/YLTbZM5ncytN3xL7CHEzhDN8uVe0u55yaPUJICIJjaCW8NrM5BFdqr7HLweStNA==} + engines: {node: '>=10'} + + node-email-verifier@3.4.1: + resolution: {integrity: sha512-69JMeWgEUrCji+dOLULirdSoosRxgAq2y+imfmHHBGvgTwyTKqvm65Ls3+W30DCIWMrYj5kKVb/DHTQDK7OVwQ==} + engines: {node: '>=18.0.0'} + + nth-check@2.1.1: + resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} + + nwsapi@2.2.23: + resolution: {integrity: sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ==} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} + engines: {node: '>= 0.8.0'} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + + pac-proxy-agent@7.2.0: + resolution: {integrity: sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==} + engines: {node: '>= 14'} + + pac-resolver@7.0.1: + resolution: {integrity: sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==} + engines: {node: '>= 14'} + + parse-entities@4.0.2: + resolution: {integrity: sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==} + + parse5-htmlparser2-tree-adapter@7.1.0: + resolution: {integrity: sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==} + + parse5-parser-stream@7.1.2: + resolution: {integrity: sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==} + + parse5@7.3.0: + resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + + playwright-core@1.59.1: + resolution: {integrity: sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==} + engines: {node: '>=18'} + hasBin: true + + prebuild-install@7.1.3: + resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} + engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. + hasBin: true + + prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + + prettier@3.8.3: + resolution: {integrity: sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==} + engines: {node: '>=14'} + hasBin: true + + progress@2.0.3: + resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} + engines: {node: '>=0.4.0'} + + proxy-agent@6.5.0: + resolution: {integrity: sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==} + engines: {node: '>= 14'} + + proxy-from-env@1.1.0: + resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} + + psl@1.15.0: + resolution: {integrity: sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==} + + pump@3.0.4: + resolution: {integrity: sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==} + + punycode.js@2.3.1: + resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==} + engines: {node: '>=6'} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + + rc@1.2.8: + resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} + hasBin: true + + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + + requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + rrweb-cssom@0.7.1: + resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==} + + rrweb-cssom@0.8.0: + resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==} + + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + sax@1.6.0: + resolution: {integrity: sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==} + engines: {node: '>=11.0.0'} + + saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + + semver@7.7.4: + resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==} + engines: {node: '>=10'} + hasBin: true + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + simple-concat@1.0.1: + resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} + + simple-get@4.0.1: + resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==} + + slash@5.1.0: + resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} + engines: {node: '>=14.16'} + + smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + + smol-toml@1.6.1: + resolution: {integrity: sha512-dWUG8F5sIIARXih1DTaQAX4SsiTXhInKf1buxdY9DIg4ZYPZK5nGM1VRIYmEbDbsHt7USo99xSLFu5Q1IqTmsg==} + engines: {node: '>= 18'} + + socks-proxy-agent@8.0.5: + resolution: {integrity: sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==} + engines: {node: '>= 14'} + + socks@2.8.8: + resolution: {integrity: sha512-NlGELfPrgX2f1TAAcz0WawlLn+0r3FyhhCRpFFK2CemXenPYvzMWWZINv3eDNo9ucdwme7oCHRY0Jnbs4aIkog==} + engines: {node: '>= 10.0.0', npm: '>= 3.0.0'} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + string-width@8.1.0: + resolution: {integrity: sha512-Kxl3KJGb/gxkaUMOjRsQ8IrXiGW75O4E3RPjFIINOVH8AMl2SQ/yWdTzWwF3FevIX9LcMAjJW+GRwAlAbTSXdg==} + engines: {node: '>=20'} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} + + strip-json-comments@2.0.1: + resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} + engines: {node: '>=0.10.0'} + + symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + + tar-fs@2.1.4: + resolution: {integrity: sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==} + + tar-stream@2.2.0: + resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} + engines: {node: '>=6'} + + tar@7.5.13: + resolution: {integrity: sha512-tOG/7GyXpFevhXVh8jOPJrmtRpOTsYqUIkVdVooZYJS/z8WhfQUX8RJILmeuJNinGAMSu1veBr4asSHFt5/hng==} + engines: {node: '>=18'} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + tough-cookie@4.1.4: + resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==} + engines: {node: '>=6'} + + tr46@5.1.1: + resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==} + engines: {node: '>=18'} + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + tsx@4.21.0: + resolution: {integrity: sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==} + engines: {node: '>=18.0.0'} + hasBin: true + + tunnel-agent@0.6.0: + resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} + + turndown-plugin-gfm@1.0.2: + resolution: {integrity: sha512-vwz9tfvF7XN/jE0dGoBei3FXWuvll78ohzCZQuOb+ZjWrs3a0XhQVomJEb2Qh4VHTPNRO4GPZh0V7VRbiWwkRg==} + + turndown@7.2.4: + resolution: {integrity: sha512-I8yFsfRzmzK0WV1pNNOA4A7y4RDfFxPRxb3t+e3ui14qSGOxGtiSP6GjeX+Y6CHb7HYaFj7ECUD7VE5kQMZWGQ==} + engines: {node: '>=18', npm: '>=9'} + + type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + uc.micro@2.1.0: + resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==} + + undici-types@7.16.0: + resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} + + undici@7.25.0: + resolution: {integrity: sha512-xXnp4kTyor2Zq+J1FfPI6Eq3ew5h6Vl0F/8d9XU5zZQf1tX9s2Su1/3PiMmUANFULpmksxkClamIZcaUqryHsQ==} + engines: {node: '>=20.18.1'} + + unicorn-magic@0.4.0: + resolution: {integrity: sha512-wH590V9VNgYH9g3lH9wWjTrUoKsjLF6sGLjhR4sH1LWpLmCOH0Zf7PukhDA8BiS7KHe4oPNkcTHqYkj7SOGUOw==} + engines: {node: '>=20'} + + universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + validator@13.15.35: + resolution: {integrity: sha512-TQ5pAGhd5whStmqWvYF4OjQROlmv9SMFVt37qoCBdqRffuuklWYQlCNnEs2ZaIBD1kZRNnikiZOS1eqgkar0iw==} + engines: {node: '>= 0.10'} + + w3c-xmlserializer@5.0.0: + resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} + engines: {node: '>=18'} + + webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + + whatwg-encoding@3.1.1: + resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} + engines: {node: '>=18'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation + + whatwg-mimetype@4.0.0: + resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} + engines: {node: '>=18'} + + whatwg-url@14.2.0: + resolution: {integrity: sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==} + engines: {node: '>=18'} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + ws@8.20.0: + resolution: {integrity: sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + xml-name-validator@5.0.0: + resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} + engines: {node: '>=18'} + + xmlbuilder2@4.0.3: + resolution: {integrity: sha512-bx8Q1STctnNaaDymWnkfQLKofs0mGNN7rLLapJlGuV3VlvegD7Ls4ggMjE3aUSWItCCzU0PEv45lI87iSigiCA==} + engines: {node: '>=20.0'} + + xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + + yallist@5.0.0: + resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} + engines: {node: '>=18'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + +snapshots: + + '@asamuzakjp/css-color@3.2.0': + dependencies: + '@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-color-parser': 3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + lru-cache: 10.4.3 + + '@csstools/color-helpers@5.1.0': {} + + '@csstools/css-calc@2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-color-parser@3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/color-helpers': 5.1.0 + '@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-tokenizer@3.0.4': {} + + '@esbuild/aix-ppc64@0.27.0': + optional: true + + '@esbuild/android-arm64@0.27.0': + optional: true + + '@esbuild/android-arm@0.27.0': + optional: true + + '@esbuild/android-x64@0.27.0': + optional: true + + '@esbuild/darwin-arm64@0.27.0': + optional: true + + '@esbuild/darwin-x64@0.27.0': + optional: true + + '@esbuild/freebsd-arm64@0.27.0': + optional: true + + '@esbuild/freebsd-x64@0.27.0': + optional: true + + '@esbuild/linux-arm64@0.27.0': + optional: true + + '@esbuild/linux-arm@0.27.0': + optional: true + + '@esbuild/linux-ia32@0.27.0': + optional: true + + '@esbuild/linux-loong64@0.27.0': + optional: true + + '@esbuild/linux-mips64el@0.27.0': + optional: true + + '@esbuild/linux-ppc64@0.27.0': + optional: true + + '@esbuild/linux-riscv64@0.27.0': + optional: true + + '@esbuild/linux-s390x@0.27.0': + optional: true + + '@esbuild/linux-x64@0.27.0': + optional: true + + '@esbuild/netbsd-arm64@0.27.0': + optional: true + + '@esbuild/netbsd-x64@0.27.0': + optional: true + + '@esbuild/openbsd-arm64@0.27.0': + optional: true + + '@esbuild/openbsd-x64@0.27.0': + optional: true + + '@esbuild/openharmony-arm64@0.27.0': + optional: true + + '@esbuild/sunos-x64@0.27.0': + optional: true + + '@esbuild/win32-arm64@0.27.0': + optional: true + + '@esbuild/win32-ia32@0.27.0': + optional: true + + '@esbuild/win32-x64@0.27.0': + optional: true + + '@eslint-community/eslint-utils@4.9.1(eslint@10.3.0)': + dependencies: + eslint: 10.3.0 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.2': {} + + '@eslint/config-array@0.23.5': + dependencies: + '@eslint/object-schema': 3.0.5 + debug: 4.4.3 + minimatch: 10.2.5 + transitivePeerDependencies: + - supports-color + + '@eslint/config-helpers@0.5.5': + dependencies: + '@eslint/core': 1.2.1 + + '@eslint/core@1.2.1': + dependencies: + '@types/json-schema': 7.0.15 + + '@eslint/js@10.0.1(eslint@10.3.0)': + optionalDependencies: + eslint: 10.3.0 + + '@eslint/object-schema@3.0.5': {} + + '@eslint/plugin-kit@0.7.1': + dependencies: + '@eslint/core': 1.2.1 + levn: 0.4.1 + + '@humanfs/core@0.19.2': + dependencies: + '@humanfs/types': 0.15.0 + + '@humanfs/node@0.16.8': + dependencies: + '@humanfs/core': 0.19.2 + '@humanfs/types': 0.15.0 + '@humanwhocodes/retry': 0.4.3 + + '@humanfs/types@0.15.0': {} + + '@humanwhocodes/module-importer@1.0.1': {} + + '@humanwhocodes/retry@0.4.3': {} + + '@isaacs/fs-minipass@4.0.1': + dependencies: + minipass: 7.1.3 + + '@mixmark-io/domino@2.2.0': {} + + '@mozilla/readability@0.5.0': {} + + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.20.1 + + '@oozcitak/dom@2.0.2': + dependencies: + '@oozcitak/infra': 2.0.2 + '@oozcitak/url': 3.0.0 + '@oozcitak/util': 10.0.0 + + '@oozcitak/infra@2.0.2': + dependencies: + '@oozcitak/util': 10.0.0 + + '@oozcitak/url@3.0.0': + dependencies: + '@oozcitak/infra': 2.0.2 + '@oozcitak/util': 10.0.0 + + '@oozcitak/util@10.0.0': {} + + '@sindresorhus/merge-streams@4.0.0': {} + + '@tootallnate/quickjs-emscripten@0.23.0': {} + + '@types/debug@4.1.13': + dependencies: + '@types/ms': 2.1.0 + + '@types/esrecurse@4.3.1': {} + + '@types/estree@1.0.8': {} + + '@types/jsdom@21.1.7': + dependencies: + '@types/node': 24.12.2 + '@types/tough-cookie': 4.0.5 + parse5: 7.3.0 + + '@types/json-schema@7.0.15': {} + + '@types/katex@0.16.8': {} + + '@types/minimist@1.2.5': {} + + '@types/ms@2.1.0': {} + + '@types/node@24.12.2': + dependencies: + undici-types: 7.16.0 + + '@types/tough-cookie@4.0.5': {} + + '@types/turndown@5.0.6': {} + + '@types/unist@2.0.11': {} + + acorn-jsx@5.3.2(acorn@8.16.0): + dependencies: + acorn: 8.16.0 + + acorn@8.16.0: {} + + agent-base@7.1.4: {} + + ajv@6.15.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ansi-regex@6.2.2: {} + + argparse@2.0.1: {} + + ast-types@0.13.4: + dependencies: + tslib: 2.8.1 + + async@3.2.6: {} + + asynckit@0.4.0: {} + + balanced-match@4.0.4: {} + + base64-js@1.5.1: {} + + basic-ftp@5.3.1: {} + + better-sqlite3@12.9.0: + dependencies: + bindings: 1.5.0 + prebuild-install: 7.1.3 + + bindings@1.5.0: + dependencies: + file-uri-to-path: 1.0.0 + + bl@4.1.0: + dependencies: + buffer: 5.7.1 + inherits: 2.0.4 + readable-stream: 3.6.2 + + boolbase@1.0.0: {} + + brace-expansion@5.0.5: + dependencies: + balanced-match: 4.0.4 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + buffer@5.7.1: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + chalk@5.6.2: {} + + character-entities-legacy@3.0.0: {} + + character-entities@2.0.2: {} + + character-reference-invalid@2.0.1: {} + + cheerio-select@2.1.0: + dependencies: + boolbase: 1.0.0 + css-select: 5.2.2 + css-what: 6.2.2 + domelementtype: 2.3.0 + domhandler: 5.0.3 + domutils: 3.2.2 + + cheerio@1.2.0: + dependencies: + cheerio-select: 2.1.0 + dom-serializer: 2.0.0 + domhandler: 5.0.3 + domutils: 3.2.2 + encoding-sniffer: 0.2.1 + htmlparser2: 10.1.0 + parse5: 7.3.0 + parse5-htmlparser2-tree-adapter: 7.1.0 + parse5-parser-stream: 7.1.2 + undici: 7.25.0 + whatwg-mimetype: 4.0.0 + + chownr@1.1.4: {} + + chownr@3.0.0: {} + + cloakbrowser@0.3.26(playwright-core@1.59.1): + dependencies: + tar: 7.5.13 + optionalDependencies: + playwright-core: 1.59.1 + + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + + commander@13.1.0: {} + + commander@14.0.3: {} + + commander@8.3.0: {} + + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + css-select@5.2.2: + dependencies: + boolbase: 1.0.0 + css-what: 6.2.2 + domhandler: 5.0.3 + domutils: 3.2.2 + nth-check: 2.1.1 + + css-what@6.2.2: {} + + cssstyle@4.6.0: + dependencies: + '@asamuzakjp/css-color': 3.2.0 + rrweb-cssom: 0.8.0 + + data-uri-to-buffer@6.0.2: {} + + data-urls@5.0.0: + dependencies: + whatwg-mimetype: 4.0.0 + whatwg-url: 14.2.0 + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + decimal.js@10.6.0: {} + + decode-named-character-reference@1.3.0: + dependencies: + character-entities: 2.0.2 + + decompress-response@6.0.0: + dependencies: + mimic-response: 3.1.0 + + deep-extend@0.6.0: {} + + deep-is@0.1.4: {} + + degenerator@5.0.1: + dependencies: + ast-types: 0.13.4 + escodegen: 2.1.0 + esprima: 4.0.1 + + delayed-stream@1.0.0: {} + + dequal@2.0.3: {} + + detect-libc@2.1.2: {} + + devlop@1.1.0: + dependencies: + dequal: 2.0.3 + + dom-serializer@2.0.0: + dependencies: + domelementtype: 2.3.0 + domhandler: 5.0.3 + entities: 4.5.0 + + domelementtype@2.3.0: {} + + domhandler@5.0.3: + dependencies: + domelementtype: 2.3.0 + + domutils@3.2.2: + dependencies: + dom-serializer: 2.0.0 + domelementtype: 2.3.0 + domhandler: 5.0.3 + + dotenv@16.6.1: {} + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + encoding-sniffer@0.2.1: + dependencies: + iconv-lite: 0.6.3 + whatwg-encoding: 3.1.1 + + end-of-stream@1.4.5: + dependencies: + once: 1.4.0 + + entities@4.5.0: {} + + entities@6.0.1: {} + + entities@7.0.1: {} + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-object-atoms@1.1.1: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.3 + + esbuild@0.27.0: + optionalDependencies: + '@esbuild/aix-ppc64': 0.27.0 + '@esbuild/android-arm': 0.27.0 + '@esbuild/android-arm64': 0.27.0 + '@esbuild/android-x64': 0.27.0 + '@esbuild/darwin-arm64': 0.27.0 + '@esbuild/darwin-x64': 0.27.0 + '@esbuild/freebsd-arm64': 0.27.0 + '@esbuild/freebsd-x64': 0.27.0 + '@esbuild/linux-arm': 0.27.0 + '@esbuild/linux-arm64': 0.27.0 + '@esbuild/linux-ia32': 0.27.0 + '@esbuild/linux-loong64': 0.27.0 + '@esbuild/linux-mips64el': 0.27.0 + '@esbuild/linux-ppc64': 0.27.0 + '@esbuild/linux-riscv64': 0.27.0 + '@esbuild/linux-s390x': 0.27.0 + '@esbuild/linux-x64': 0.27.0 + '@esbuild/netbsd-arm64': 0.27.0 + '@esbuild/netbsd-x64': 0.27.0 + '@esbuild/openbsd-arm64': 0.27.0 + '@esbuild/openbsd-x64': 0.27.0 + '@esbuild/openharmony-arm64': 0.27.0 + '@esbuild/sunos-x64': 0.27.0 + '@esbuild/win32-arm64': 0.27.0 + '@esbuild/win32-ia32': 0.27.0 + '@esbuild/win32-x64': 0.27.0 + + escape-string-regexp@4.0.0: {} + + escodegen@2.1.0: + dependencies: + esprima: 4.0.1 + estraverse: 5.3.0 + esutils: 2.0.3 + optionalDependencies: + source-map: 0.6.1 + + eslint-scope@9.1.2: + dependencies: + '@types/esrecurse': 4.3.1 + '@types/estree': 1.0.8 + esrecurse: 4.3.0 + estraverse: 5.3.0 + + eslint-visitor-keys@3.4.3: {} + + eslint-visitor-keys@5.0.1: {} + + eslint@10.3.0: + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@10.3.0) + '@eslint-community/regexpp': 4.12.2 + '@eslint/config-array': 0.23.5 + '@eslint/config-helpers': 0.5.5 + '@eslint/core': 1.2.1 + '@eslint/plugin-kit': 0.7.1 + '@humanfs/node': 0.16.8 + '@humanwhocodes/module-importer': 1.0.1 + '@humanwhocodes/retry': 0.4.3 + '@types/estree': 1.0.8 + ajv: 6.15.0 + cross-spawn: 7.0.6 + debug: 4.4.3 + escape-string-regexp: 4.0.0 + eslint-scope: 9.1.2 + eslint-visitor-keys: 5.0.1 + espree: 11.2.0 + esquery: 1.7.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 8.0.0 + find-up: 5.0.0 + glob-parent: 6.0.2 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + json-stable-stringify-without-jsonify: 1.0.1 + minimatch: 10.2.5 + natural-compare: 1.4.0 + optionator: 0.9.4 + transitivePeerDependencies: + - supports-color + + espree@11.2.0: + dependencies: + acorn: 8.16.0 + acorn-jsx: 5.3.2(acorn@8.16.0) + eslint-visitor-keys: 5.0.1 + + esprima@4.0.1: {} + + esquery@1.7.0: + dependencies: + estraverse: 5.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@5.3.0: {} + + esutils@2.0.3: {} + + expand-template@2.0.3: {} + + fast-deep-equal@3.1.3: {} + + fast-glob@3.3.3: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fast-json-stable-stringify@2.1.0: {} + + fast-levenshtein@2.0.6: {} + + fastq@1.20.1: + dependencies: + reusify: 1.1.0 + + file-entry-cache@8.0.0: + dependencies: + flat-cache: 4.0.1 + + file-uri-to-path@1.0.0: {} + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + + flat-cache@4.0.1: + dependencies: + flatted: 3.4.2 + keyv: 4.5.4 + + flatted@3.4.2: {} + + form-data@4.0.5: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.3 + mime-types: 2.1.35 + + fs-constants@1.0.0: {} + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + get-east-asian-width@1.5.0: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.3 + math-intrinsics: 1.1.0 + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.1 + + get-tsconfig@4.14.0: + dependencies: + resolve-pkg-maps: 1.0.0 + + get-uri@6.0.5: + dependencies: + basic-ftp: 5.3.1 + data-uri-to-buffer: 6.0.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + github-from-package@0.0.0: {} + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob-parent@6.0.2: + dependencies: + is-glob: 4.0.3 + + globals@17.6.0: {} + + globby@16.2.0: + dependencies: + '@sindresorhus/merge-streams': 4.0.0 + fast-glob: 3.3.3 + ignore: 7.0.5 + is-path-inside: 4.0.0 + slash: 5.1.0 + unicorn-magic: 0.4.0 + + gopd@1.2.0: {} + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + hasown@2.0.3: + dependencies: + function-bind: 1.1.2 + + html-encoding-sniffer@4.0.0: + dependencies: + whatwg-encoding: 3.1.1 + + html-link-extractor@1.0.5: + dependencies: + cheerio: 1.2.0 + + htmlparser2@10.1.0: + dependencies: + domelementtype: 2.3.0 + domhandler: 5.0.3 + domutils: 3.2.2 + entities: 7.0.1 + + http-proxy-agent@7.0.2: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + iconv-lite@0.6.3: + dependencies: + safer-buffer: 2.1.2 + + ieee754@1.2.1: {} + + ignore@5.3.2: {} + + ignore@7.0.5: {} + + imurmurhash@0.1.4: {} + + inherits@2.0.4: {} + + ini@1.3.8: {} + + ip-address@10.2.0: {} + + is-absolute-url@4.0.1: {} + + is-alphabetical@2.0.1: {} + + is-alphanumerical@2.0.1: + dependencies: + is-alphabetical: 2.0.1 + is-decimal: 2.0.1 + + is-decimal@2.0.1: {} + + is-extglob@2.1.1: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-hexadecimal@2.0.1: {} + + is-number@7.0.0: {} + + is-path-inside@4.0.0: {} + + is-potential-custom-element-name@1.0.1: {} + + is-relative-url@4.1.0: + dependencies: + is-absolute-url: 4.0.1 + + isexe@2.0.0: {} + + js-yaml@4.1.1: + dependencies: + argparse: 2.0.1 + + jsdom@24.1.3: + dependencies: + cssstyle: 4.6.0 + data-urls: 5.0.0 + decimal.js: 10.6.0 + form-data: 4.0.5 + html-encoding-sniffer: 4.0.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.23 + parse5: 7.3.0 + rrweb-cssom: 0.7.1 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 4.1.4 + w3c-xmlserializer: 5.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 3.1.1 + whatwg-mimetype: 4.0.0 + whatwg-url: 14.2.0 + ws: 8.20.0 + xml-name-validator: 5.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + json-buffer@3.0.1: {} + + json-schema-traverse@0.4.1: {} + + json-stable-stringify-without-jsonify@1.0.1: {} + + jsonc-parser@3.3.1: {} + + jsonpointer@5.0.1: {} + + katex@0.16.45: + dependencies: + commander: 8.3.0 + + keyv@4.5.4: + dependencies: + json-buffer: 3.0.1 + + levn@0.4.1: + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + + link-check@5.5.1: + dependencies: + is-relative-url: 4.1.0 + ms: 2.1.3 + needle: 3.5.0 + node-email-verifier: 3.4.1 + proxy-agent: 6.5.0 + transitivePeerDependencies: + - supports-color + + linkify-it@5.0.0: + dependencies: + uc.micro: 2.1.0 + + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + + lru-cache@10.4.3: {} + + lru-cache@7.18.3: {} + + markdown-it@14.1.1: + dependencies: + argparse: 2.0.1 + entities: 4.5.0 + linkify-it: 5.0.0 + mdurl: 2.0.0 + punycode.js: 2.3.1 + uc.micro: 2.1.0 + + markdown-link-check@3.14.2: + dependencies: + async: 3.2.6 + chalk: 5.6.2 + commander: 14.0.3 + link-check: 5.5.1 + markdown-link-extractor: 4.0.3 + needle: 3.5.0 + progress: 2.0.3 + proxy-agent: 6.5.0 + xmlbuilder2: 4.0.3 + transitivePeerDependencies: + - supports-color + + markdown-link-extractor@4.0.3: + dependencies: + html-link-extractor: 1.0.5 + marked: 17.0.6 + + markdownlint-cli2-formatter-default@0.0.6(markdownlint-cli2@0.22.1): + dependencies: + markdownlint-cli2: 0.22.1 + + markdownlint-cli2@0.22.1: + dependencies: + globby: 16.2.0 + js-yaml: 4.1.1 + jsonc-parser: 3.3.1 + jsonpointer: 5.0.1 + markdown-it: 14.1.1 + markdownlint: 0.40.0 + markdownlint-cli2-formatter-default: 0.0.6(markdownlint-cli2@0.22.1) + micromatch: 4.0.8 + smol-toml: 1.6.1 + transitivePeerDependencies: + - supports-color + + markdownlint@0.40.0: + dependencies: + micromark: 4.0.2 + micromark-core-commonmark: 2.0.3 + micromark-extension-directive: 4.0.0 + micromark-extension-gfm-autolink-literal: 2.1.0 + micromark-extension-gfm-footnote: 2.1.0 + micromark-extension-gfm-table: 2.1.1 + micromark-extension-math: 3.1.0 + micromark-util-types: 2.0.2 + string-width: 8.1.0 + transitivePeerDependencies: + - supports-color + + marked@17.0.6: {} + + math-intrinsics@1.1.0: {} + + mdurl@2.0.0: {} + + merge2@1.4.1: {} + + micromark-core-commonmark@2.0.3: + dependencies: + decode-named-character-reference: 1.3.0 + devlop: 1.1.0 + micromark-factory-destination: 2.0.1 + micromark-factory-label: 2.0.1 + micromark-factory-space: 2.0.1 + micromark-factory-title: 2.0.1 + micromark-factory-whitespace: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-chunked: 2.0.1 + micromark-util-classify-character: 2.0.1 + micromark-util-html-tag-name: 2.0.1 + micromark-util-normalize-identifier: 2.0.1 + micromark-util-resolve-all: 2.0.1 + micromark-util-subtokenize: 2.1.0 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-extension-directive@4.0.0: + dependencies: + devlop: 1.1.0 + micromark-factory-space: 2.0.1 + micromark-factory-whitespace: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + parse-entities: 4.0.2 + + micromark-extension-gfm-autolink-literal@2.1.0: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-sanitize-uri: 2.0.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-extension-gfm-footnote@2.1.0: + dependencies: + devlop: 1.1.0 + micromark-core-commonmark: 2.0.3 + micromark-factory-space: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-normalize-identifier: 2.0.1 + micromark-util-sanitize-uri: 2.0.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-extension-gfm-table@2.1.1: + dependencies: + devlop: 1.1.0 + micromark-factory-space: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-extension-math@3.1.0: + dependencies: + '@types/katex': 0.16.8 + devlop: 1.1.0 + katex: 0.16.45 + micromark-factory-space: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-factory-destination@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-factory-label@2.0.1: + dependencies: + devlop: 1.1.0 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-factory-space@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-types: 2.0.2 + + micromark-factory-title@2.0.1: + dependencies: + micromark-factory-space: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-factory-whitespace@2.0.1: + dependencies: + micromark-factory-space: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-util-character@2.1.1: + dependencies: + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-util-chunked@2.0.1: + dependencies: + micromark-util-symbol: 2.0.1 + + micromark-util-classify-character@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-util-combine-extensions@2.0.1: + dependencies: + micromark-util-chunked: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-util-decode-numeric-character-reference@2.0.2: + dependencies: + micromark-util-symbol: 2.0.1 + + micromark-util-encode@2.0.1: {} + + micromark-util-html-tag-name@2.0.1: {} + + micromark-util-normalize-identifier@2.0.1: + dependencies: + micromark-util-symbol: 2.0.1 + + micromark-util-resolve-all@2.0.1: + dependencies: + micromark-util-types: 2.0.2 + + micromark-util-sanitize-uri@2.0.1: + dependencies: + micromark-util-character: 2.1.1 + micromark-util-encode: 2.0.1 + micromark-util-symbol: 2.0.1 + + micromark-util-subtokenize@2.1.0: + dependencies: + devlop: 1.1.0 + micromark-util-chunked: 2.0.1 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + + micromark-util-symbol@2.0.1: {} + + micromark-util-types@2.0.2: {} + + micromark@4.0.2: + dependencies: + '@types/debug': 4.1.13 + debug: 4.4.3 + decode-named-character-reference: 1.3.0 + devlop: 1.1.0 + micromark-core-commonmark: 2.0.3 + micromark-factory-space: 2.0.1 + micromark-util-character: 2.1.1 + micromark-util-chunked: 2.0.1 + micromark-util-combine-extensions: 2.0.1 + micromark-util-decode-numeric-character-reference: 2.0.2 + micromark-util-encode: 2.0.1 + micromark-util-normalize-identifier: 2.0.1 + micromark-util-resolve-all: 2.0.1 + micromark-util-sanitize-uri: 2.0.1 + micromark-util-subtokenize: 2.1.0 + micromark-util-symbol: 2.0.1 + micromark-util-types: 2.0.2 + transitivePeerDependencies: + - supports-color + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.2 + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mimic-response@3.1.0: {} + + minimatch@10.2.5: + dependencies: + brace-expansion: 5.0.5 + + minimist@1.2.8: {} + + minipass@7.1.3: {} + + minizlib@3.1.0: + dependencies: + minipass: 7.1.3 + + mkdirp-classic@0.5.3: {} + + ms@2.1.3: {} + + napi-build-utils@2.0.0: {} + + natural-compare@1.4.0: {} + + needle@3.5.0: + dependencies: + iconv-lite: 0.6.3 + sax: 1.6.0 + + netmask@2.1.1: {} + + node-abi@3.90.0: + dependencies: + semver: 7.7.4 + + node-email-verifier@3.4.1: + dependencies: + ms: 2.1.3 + validator: 13.15.35 + + nth-check@2.1.1: + dependencies: + boolbase: 1.0.0 + + nwsapi@2.2.23: {} + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + optionator@0.9.4: + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.5 + + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + + pac-proxy-agent@7.2.0: + dependencies: + '@tootallnate/quickjs-emscripten': 0.23.0 + agent-base: 7.1.4 + debug: 4.4.3 + get-uri: 6.0.5 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + pac-resolver: 7.0.1 + socks-proxy-agent: 8.0.5 + transitivePeerDependencies: + - supports-color + + pac-resolver@7.0.1: + dependencies: + degenerator: 5.0.1 + netmask: 2.1.1 + + parse-entities@4.0.2: + dependencies: + '@types/unist': 2.0.11 + character-entities-legacy: 3.0.0 + character-reference-invalid: 2.0.1 + decode-named-character-reference: 1.3.0 + is-alphanumerical: 2.0.1 + is-decimal: 2.0.1 + is-hexadecimal: 2.0.1 + + parse5-htmlparser2-tree-adapter@7.1.0: + dependencies: + domhandler: 5.0.3 + parse5: 7.3.0 + + parse5-parser-stream@7.1.2: + dependencies: + parse5: 7.3.0 + + parse5@7.3.0: + dependencies: + entities: 6.0.1 + + path-exists@4.0.0: {} + + path-key@3.1.1: {} + + picomatch@2.3.2: {} + + playwright-core@1.59.1: {} + + prebuild-install@7.1.3: + dependencies: + detect-libc: 2.1.2 + expand-template: 2.0.3 + github-from-package: 0.0.0 + minimist: 1.2.8 + mkdirp-classic: 0.5.3 + napi-build-utils: 2.0.0 + node-abi: 3.90.0 + pump: 3.0.4 + rc: 1.2.8 + simple-get: 4.0.1 + tar-fs: 2.1.4 + tunnel-agent: 0.6.0 + + prelude-ls@1.2.1: {} + + prettier@3.8.3: {} + + progress@2.0.3: {} + + proxy-agent@6.5.0: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + lru-cache: 7.18.3 + pac-proxy-agent: 7.2.0 + proxy-from-env: 1.1.0 + socks-proxy-agent: 8.0.5 + transitivePeerDependencies: + - supports-color + + proxy-from-env@1.1.0: {} + + psl@1.15.0: + dependencies: + punycode: 2.3.1 + + pump@3.0.4: + dependencies: + end-of-stream: 1.4.5 + once: 1.4.0 + + punycode.js@2.3.1: {} + + punycode@2.3.1: {} + + querystringify@2.2.0: {} + + queue-microtask@1.2.3: {} + + rc@1.2.8: + dependencies: + deep-extend: 0.6.0 + ini: 1.3.8 + minimist: 1.2.8 + strip-json-comments: 2.0.1 + + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + + requires-port@1.0.0: {} + + resolve-pkg-maps@1.0.0: {} + + reusify@1.1.0: {} + + rrweb-cssom@0.7.1: {} + + rrweb-cssom@0.8.0: {} + + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + + safe-buffer@5.2.1: {} + + safer-buffer@2.1.2: {} + + sax@1.6.0: {} + + saxes@6.0.0: + dependencies: + xmlchars: 2.2.0 + + semver@7.7.4: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + simple-concat@1.0.1: {} + + simple-get@4.0.1: + dependencies: + decompress-response: 6.0.0 + once: 1.4.0 + simple-concat: 1.0.1 + + slash@5.1.0: {} + + smart-buffer@4.2.0: {} + + smol-toml@1.6.1: {} + + socks-proxy-agent@8.0.5: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + socks: 2.8.8 + transitivePeerDependencies: + - supports-color + + socks@2.8.8: + dependencies: + ip-address: 10.2.0 + smart-buffer: 4.2.0 + + source-map@0.6.1: + optional: true + + string-width@8.1.0: + dependencies: + get-east-asian-width: 1.5.0 + strip-ansi: 7.2.0 + + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + + strip-ansi@7.2.0: + dependencies: + ansi-regex: 6.2.2 + + strip-json-comments@2.0.1: {} + + symbol-tree@3.2.4: {} + + tar-fs@2.1.4: + dependencies: + chownr: 1.1.4 + mkdirp-classic: 0.5.3 + pump: 3.0.4 + tar-stream: 2.2.0 + + tar-stream@2.2.0: + dependencies: + bl: 4.1.0 + end-of-stream: 1.4.5 + fs-constants: 1.0.0 + inherits: 2.0.4 + readable-stream: 3.6.2 + + tar@7.5.13: + dependencies: + '@isaacs/fs-minipass': 4.0.1 + chownr: 3.0.0 + minipass: 7.1.3 + minizlib: 3.1.0 + yallist: 5.0.0 + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + tough-cookie@4.1.4: + dependencies: + psl: 1.15.0 + punycode: 2.3.1 + universalify: 0.2.0 + url-parse: 1.5.10 + + tr46@5.1.1: + dependencies: + punycode: 2.3.1 + + tslib@2.8.1: {} + + tsx@4.21.0: + dependencies: + esbuild: 0.27.0 + get-tsconfig: 4.14.0 + optionalDependencies: + fsevents: 2.3.3 + + tunnel-agent@0.6.0: + dependencies: + safe-buffer: 5.2.1 + + turndown-plugin-gfm@1.0.2: {} + + turndown@7.2.4: + dependencies: + '@mixmark-io/domino': 2.2.0 + + type-check@0.4.0: + dependencies: + prelude-ls: 1.2.1 + + typescript@5.9.3: {} + + uc.micro@2.1.0: {} + + undici-types@7.16.0: {} + + undici@7.25.0: {} + + unicorn-magic@0.4.0: {} + + universalify@0.2.0: {} + + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + + url-parse@1.5.10: + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + + util-deprecate@1.0.2: {} + + validator@13.15.35: {} + + w3c-xmlserializer@5.0.0: + dependencies: + xml-name-validator: 5.0.0 + + webidl-conversions@7.0.0: {} + + whatwg-encoding@3.1.1: + dependencies: + iconv-lite: 0.6.3 + + whatwg-mimetype@4.0.0: {} + + whatwg-url@14.2.0: + dependencies: + tr46: 5.1.1 + webidl-conversions: 7.0.0 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + word-wrap@1.2.5: {} + + wrappy@1.0.2: {} + + ws@8.20.0: {} + + xml-name-validator@5.0.0: {} + + xmlbuilder2@4.0.3: + dependencies: + '@oozcitak/dom': 2.0.2 + '@oozcitak/infra': 2.0.2 + '@oozcitak/util': 10.0.0 + js-yaml: 4.1.1 + + xmlchars@2.2.0: {} + + yallist@5.0.0: {} + + yocto-queue@0.1.0: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..f7f6657 --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,39 @@ +# pnpm workspace — includes canonical sources + uniquely-named generated variants (M3) +# +# M3 update: every generated agent-variant package.json now carries a unique +# private name (@ai-coding-skills/-), which allows pnpm to include +# ALL generated roots alongside the canonical sources. The M1 negative-glob +# exclusions are replaced by explicit positive includes. +# +# Canonical source packages (never generated): +# - skills/atlassian/shared/scripts → atlassian-skill-scripts (source + tests) +# - skills/web-automation/shared → web-automation-scripts (source template) +# +# Generated agent-variant directories (now uniquely named, included): +# - skills/atlassian/{claude-code,codex,cursor,opencode,pi}/scripts +# - skills/web-automation/{claude-code,codex,cursor,opencode,pi}/scripts +# - pi-package/skills/atlassian/scripts (@ai-coding-skills/atlassian-pi-mirror) +# - pi-package/skills/web-automation/scripts (@ai-coding-skills/web-automation-pi-mirror) + +packages: + # ── Canonical source packages ──────────────────────────────────────────── + - "skills/atlassian/shared/scripts" + - "skills/web-automation/shared" + + # ── Generated atlassian agent-variant packages ─────────────────────────── + - "skills/atlassian/claude-code/scripts" + - "skills/atlassian/codex/scripts" + - "skills/atlassian/cursor/scripts" + - "skills/atlassian/opencode/scripts" + - "skills/atlassian/pi/scripts" + + # ── Generated web-automation agent-variant packages ────────────────────── + - "skills/web-automation/claude-code/scripts" + - "skills/web-automation/codex/scripts" + - "skills/web-automation/cursor/scripts" + - "skills/web-automation/opencode/scripts" + - "skills/web-automation/pi/scripts" + + # ── Generated pi-package mirrors ───────────────────────────────────────── + - "pi-package/skills/atlassian/scripts" + - "pi-package/skills/web-automation/scripts" diff --git a/scripts/generate-skills.mjs b/scripts/generate-skills.mjs new file mode 100644 index 0000000..fcf6697 --- /dev/null +++ b/scripts/generate-skills.mjs @@ -0,0 +1,616 @@ +#!/usr/bin/env node +/** + * generate-skills.mjs — shared-source generator for agent variants (M3, S-302) + * + * Generates every agent-variant directory (`skills///`) and + * `pi-package/skills//` mirror from canonical sources. Generated files + * carry file-type-aware headers; each generated root gets a non-self-referential + * `.generated-manifest.json`. + * + * Usage: + * node scripts/generate-skills.mjs # regenerate everything + * pnpm run sync:pi # same via pnpm alias + * + * Exported helpers (used by verify-generated.mjs and tests): + * detectFileType(filePath) → string + * applyHeader(content, fileType, canonicalHint) → string + * makePackageJsonContent(sourcePkg, skillName, agentName) → object + * getGeneratedRoots(repoRoot?) → string[] + * buildManifest(generatedRootAbs, generatedRootRel) → Promise + * generateSkills(repoRoot, options?) → Promise<{generatedRoots: string[]}> + */ + +import { + lstat, + mkdir, + readdir, + readFile, + rm, + writeFile, +} from "node:fs/promises"; +import crypto from "node:crypto"; +import path from "node:path"; +import { pathToFileURL } from "node:url"; + +const REPO_ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), ".."); + +// ── Constants ────────────────────────────────────────────────────────────── + +const MANIFEST_SCHEMA = + "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json"; +const MANIFEST_GENERATOR = "scripts/generate-skills.mjs"; +const MANIFEST_FILENAME = ".generated-manifest.json"; + +const AGENTS = ["claude-code", "codex", "cursor", "opencode", "pi"]; + +/** + * Canonical list of all generated roots, relative to repo root. + * Verifier uses this to know which directories to walk. + */ +const GENERATED_ROOTS = [ + // atlassian agent variants + "skills/atlassian/claude-code", + "skills/atlassian/codex", + "skills/atlassian/cursor", + "skills/atlassian/opencode", + "skills/atlassian/pi", + // web-automation agent variants + "skills/web-automation/claude-code", + "skills/web-automation/codex", + "skills/web-automation/cursor", + "skills/web-automation/opencode", + "skills/web-automation/pi", + // create-plan agent variants + "skills/create-plan/claude-code", + "skills/create-plan/codex", + "skills/create-plan/cursor", + "skills/create-plan/opencode", + "skills/create-plan/pi", + // do-task agent variants + "skills/do-task/claude-code", + "skills/do-task/codex", + "skills/do-task/cursor", + "skills/do-task/opencode", + "skills/do-task/pi", + // implement-plan agent variants + "skills/implement-plan/claude-code", + "skills/implement-plan/codex", + "skills/implement-plan/cursor", + "skills/implement-plan/opencode", + "skills/implement-plan/pi", + // reviewer-runtime pi variant + "skills/reviewer-runtime/pi", + // pi-package mirrors + "pi-package/skills/atlassian", + "pi-package/skills/create-plan", + "pi-package/skills/do-task", + "pi-package/skills/implement-plan", + "pi-package/skills/web-automation", +]; + +// ── File-type detection ──────────────────────────────────────────────────── + +/** + * Classify a file path into a header policy category. + * @param {string} filePath - Relative or absolute path to the file. + * @returns {'markdown'|'shell'|'ts'|'js'|'json'|'yaml'|'jsonc'|'unknown'} + */ +export function detectFileType(filePath) { + const base = path.basename(filePath); + const ext = path.extname(base).toLowerCase(); + + if (ext === ".md") return "markdown"; + if (ext === ".sh") return "shell"; + if (ext === ".ts") return "ts"; + if (ext === ".js") return "js"; + if (ext === ".jsonc") return "jsonc"; + if (ext === ".json") return "json"; + if (ext === ".yaml" || ext === ".yml") return "yaml"; + return "unknown"; +} + +// ── Header insertion ────────────────────────────────────────────────────── + +const HEADER_MSG = (hint) => + `⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in ${hint} and run \`pnpm run sync:pi\`.`; + +/** + * Insert a file-type-aware generated-file header into content. + * + * Policy: + * markdown → HTML comment after YAML front matter (or at top if no front matter) + * shell → # comment after shebang (never before it) + * ts/js → // comment at top + * jsonc → // comment at top + * yaml → # comment at top (pnpm-lock.yaml skipped by caller) + * json → no header (recorded in .generated-manifest.json) + * unknown → no header + * + * @param {string} content - Original file content. + * @param {string} fileType - Output of detectFileType(). + * @param {string} canonicalHint - Human-readable hint to canonical source location. + * @returns {string} Content with header inserted, or original if no header applies. + */ +export function applyHeader(content, fileType, canonicalHint) { + const msg = HEADER_MSG(canonicalHint); + + switch (fileType) { + case "markdown": { + // Insert HTML comment after YAML front matter closing ---, or at top + if (content.startsWith("---\n")) { + const closingIdx = content.indexOf("\n---\n", 4); + if (closingIdx !== -1) { + const after = closingIdx + 5; // length of "\n---\n" + const before = content.slice(0, after); + const rest = content.slice(after); + // Ensure the comment is on its own line, with a blank line before/after + return `${before}\n\n${rest}`; + } + } + return `\n${content}`; + } + + case "shell": { + // Insert # comment AFTER shebang line (never before it) + const lines = content.split("\n"); + if (lines[0].startsWith("#!")) { + return [lines[0], `# ${msg}`, ...lines.slice(1)].join("\n"); + } + return `# ${msg}\n${content}`; + } + + case "ts": + case "js": + case "jsonc": { + // Insert after shebang if present (TypeScript requires #! on line 1) + const lines = content.split("\n"); + if (lines[0].startsWith("#!")) { + return [lines[0], `// ${msg}`, ...lines.slice(1)].join("\n"); + } + return `// ${msg}\n${content}`; + } + + case "yaml": { + return `# ${msg}\n${content}`; + } + + case "json": + case "unknown": + default: + return content; + } +} + +// ── package.json transformation ─────────────────────────────────────────── + +/** + * Produce a modified package.json object with a unique scoped name and + * `"private": true` for an agent-variant generated root. + * + * @param {object} sourcePkg - Parsed source package.json object. + * @param {string} skillName - Skill identifier (e.g. "atlassian"). + * @param {string} agentName - Agent identifier (e.g. "claude-code"). + * @returns {object} New object (source is not mutated). + */ +export function makePackageJsonContent(sourcePkg, skillName, agentName) { + return { + ...sourcePkg, + name: `@ai-coding-skills/${skillName}-${agentName}`, + private: true, + }; +} + +// ── Generated-root list ─────────────────────────────────────────────────── + +/** + * Return the authoritative list of generated roots as repo-relative paths. + * Callers (verify-generated.mjs) use this to know which directories to walk. + * + * @returns {string[]} Sorted array of relative paths. + */ +export function getGeneratedRoots() { + return [...GENERATED_ROOTS]; +} + +// ── Manifest construction ───────────────────────────────────────────────── + +/** + * Walk a directory recursively and return all file paths (abs). + * Skips node_modules. + */ +async function walkDir(dir) { + const results = []; + let entries; + try { + entries = await readdir(dir, { withFileTypes: true }); + } catch { + return results; + } + for (const entry of entries) { + if (entry.name === "node_modules") continue; + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + const sub = await walkDir(full); + results.push(...sub); + } else if (entry.isFile()) { + results.push(full); + } + } + return results; +} + +/** + * Build a .generated-manifest.json object for a generated root. + * + * The manifest lists every file in the generated root EXCEPT itself. + * Files are sorted by relative path for stable canonical serialization. + * + * @param {string} generatedRootAbs - Absolute path to the generated root directory. + * @param {string} generatedRootRel - Repo-relative path (e.g. "skills/create-plan/pi"). + * @returns {Promise} Manifest object (not yet serialized to disk). + */ +export async function buildManifest(generatedRootAbs, generatedRootRel) { + const allFiles = await walkDir(generatedRootAbs); + const entries = []; + + for (const absPath of allFiles) { + const relPath = path.relative(generatedRootAbs, absPath).replace(/\\/g, "/"); + + // Non-self-referential: the manifest never lists itself + if (relPath === MANIFEST_FILENAME) continue; + + const contentBuf = await readFile(absPath); + const sha256 = crypto.createHash("sha256").update(contentBuf).digest("hex"); + + const st = await lstat(absPath); + const mode = (st.mode & 0o777).toString(8).padStart(3, "0"); + + entries.push({ + path: relPath, + kind: "file", + mode, + sha256, + }); + } + + entries.sort((a, b) => a.path.localeCompare(b.path)); + + return { + $schema: MANIFEST_SCHEMA, + generator: MANIFEST_GENERATOR, + generatedRoot: generatedRootRel, + files: entries, + }; +} + +// ── Core generation helpers ─────────────────────────────────────────────── + +/** + * Copy a single file from source to destination, inserting a header. + * Skips header for: + * - pnpm-lock.yaml (managed by pnpm, would be stripped on next install) + * - JSON files (per header policy, no in-file header) + * - node_modules (never copied) + */ +async function copyWithHeader(srcAbs, dstAbs, canonicalHint) { + const basename = path.basename(srcAbs); + // Skip pnpm-lock.yaml header (pnpm regenerates without comment) + const skipHeader = basename === "pnpm-lock.yaml"; + + const raw = await readFile(srcAbs, "utf8"); + const fileType = skipHeader ? "unknown" : detectFileType(srcAbs); + const content = applyHeader(raw, fileType, canonicalHint); + + await mkdir(path.dirname(dstAbs), { recursive: true }); + await writeFile(dstAbs, content, "utf8"); +} + +/** + * Recursively copy a directory tree, adding headers to text files. + */ +async function copyDirWithHeaders(srcDir, dstDir, canonicalHint) { + const entries = await readdir(srcDir, { withFileTypes: true }); + await mkdir(dstDir, { recursive: true }); + + for (const entry of entries) { + if (entry.name === "node_modules") continue; + const src = path.join(srcDir, entry.name); + const dst = path.join(dstDir, entry.name); + + if (entry.isDirectory()) { + await copyDirWithHeaders(src, dst, canonicalHint); + } else if (entry.isFile()) { + await copyWithHeader(src, dst, canonicalHint); + } + } +} + +/** + * Write a .generated-manifest.json file into a generated root. + */ +async function writeManifest(generatedRootAbs, generatedRootRel) { + const manifest = await buildManifest(generatedRootAbs, generatedRootRel); + const dstPath = path.join(generatedRootAbs, MANIFEST_FILENAME); + await writeFile(dstPath, JSON.stringify(manifest, null, 2) + "\n", "utf8"); +} + +// ── Skill-family generators ─────────────────────────────────────────────── + +/** + * Generate one agent variant for a "skills-only" skill + * (create-plan, do-task, implement-plan). + * + * Canonical source: skills//_source// + * Generated root: skills/// + * + * @param {string} writeRoot - Root directory to write output into (defaults to repoRoot). + */ +async function generateSkillOnlyVariant(repoRoot, writeRoot, skillName, agentName, generatedRootRel) { + const sourceDir = path.join(repoRoot, "skills", skillName, "_source", agentName); + const targetDir = path.join(writeRoot, generatedRootRel); + const canonicalHint = `skills/${skillName}/_source/${agentName}/`; + + // Clear previous generated content (preserve node_modules if any) + await clearGeneratedRoot(targetDir); + + // Copy all files from source with headers + await copyDirWithHeaders(sourceDir, targetDir, canonicalHint); + + // Write manifest + await writeManifest(targetDir, generatedRootRel); +} + +/** + * Generate one agent variant for a "scripts+skill" skill + * (atlassian, web-automation). + * + * For atlassian: + * - SKILL.md from skills/atlassian/_source//SKILL.md + * - scripts/* from skills/atlassian/shared/scripts/ + * (only src/, tsconfig.json, pnpm-lock.yaml — not tests/ or scripts/sync-*) + * + * For web-automation: + * - SKILL.md from skills/web-automation/_source//SKILL.md + * - scripts/* from skills/web-automation/shared/ + * + * @param {string} [packageAgentName] - Override the agent name used only for the + * package.json `name` field. Defaults to `agentName`. Use this to give + * pi-package mirrors a distinct name (e.g. "pi-mirror") so workspace package + * names are unique even when two roots share the same source agent. + */ +async function generateScriptsSkillVariant( + repoRoot, + writeRoot, + skillName, + agentName, + generatedRootRel, + config, + packageAgentName, +) { + const targetDir = path.join(writeRoot, generatedRootRel); + await clearGeneratedRoot(targetDir); + + // 1. Copy SKILL.md from per-agent canonical source + const skillMdSrc = path.join(repoRoot, "skills", skillName, "_source", agentName, "SKILL.md"); + const skillMdDst = path.join(targetDir, "SKILL.md"); + const skillMdHint = `skills/${skillName}/_source/${agentName}/SKILL.md`; + await copyWithHeader(skillMdSrc, skillMdDst, skillMdHint); + + // 2. Copy scripts + const scriptsTargetDir = path.join(targetDir, "scripts"); + await mkdir(scriptsTargetDir, { recursive: true }); + + const canonicalScripts = path.join(repoRoot, config.canonicalScripts); + const scriptsHint = `${config.canonicalScripts}/`; + + for (const entry of config.scriptFiles) { + const srcPath = path.join(canonicalScripts, entry); + const dstPath = path.join(scriptsTargetDir, entry); // scriptsTargetDir already uses writeRoot + + // Check if source exists + let st; + try { + st = await lstat(srcPath); + } catch { + continue; // skip if file doesn't exist in canonical + } + + if (st.isDirectory()) { + await copyDirWithHeaders(srcPath, dstPath, scriptsHint); + } else { + await copyWithHeader(srcPath, dstPath, scriptsHint); + } + } + + // 3. Generate modified package.json + const srcPkgPath = path.join(canonicalScripts, "package.json"); + const srcPkg = JSON.parse(await readFile(srcPkgPath, "utf8")); + + let targetPkg = makePackageJsonContent(srcPkg, skillName, packageAgentName ?? agentName); + + // For atlassian variants, strip test/sync scripts (not in agent variants) + if (skillName === "atlassian") { + const agentScripts = {}; + for (const [k, v] of Object.entries(targetPkg.scripts ?? {})) { + if (k !== "test" && k !== "sync:agents") agentScripts[k] = v; + } + targetPkg = { ...targetPkg, scripts: agentScripts }; + } + + const dstPkgPath = path.join(scriptsTargetDir, "package.json"); + await writeFile(dstPkgPath, JSON.stringify(targetPkg, null, 2) + "\n", "utf8"); + + // 4. Write manifest + await writeManifest(targetDir, generatedRootRel); +} + +/** + * Generate the reviewer-runtime pi variant from the non-Pi canonical scripts. + * + * Canonical source: skills/reviewer-runtime/{run-review.sh,notify-telegram.sh} + * Generated root: skills/reviewer-runtime/pi/ + * + * The pi variant is byte-identical to the canonical except for: + * - A generated # comment after the shebang (replaces old "keep in sync" comment) + * + * @param {string} writeRoot - Root directory to write output into (defaults to repoRoot). + */ +async function generateReviewerRuntimePi(repoRoot, writeRoot) { + const srcDir = path.join(repoRoot, "skills", "reviewer-runtime"); + const dstDir = path.join(writeRoot, "skills", "reviewer-runtime", "pi"); + const canonicalHint = "skills/reviewer-runtime/"; + + // Clear old generated content (preserve tests/ which is canonical) + await clearGeneratedRoot(dstDir); + + for (const fname of ["run-review.sh", "notify-telegram.sh"]) { + const srcPath = path.join(srcDir, fname); + const dstPath = path.join(dstDir, fname); + + const raw = await readFile(srcPath, "utf8"); + let content = applyHeader(raw, "shell", `${canonicalHint}${fname}`); + + await mkdir(path.dirname(dstPath), { recursive: true }); + await writeFile(dstPath, content, "utf8"); + + // Preserve executable bit + const st = await lstat(srcPath); + if (st.mode & 0o100) { + const { chmod } = await import("node:fs/promises"); + await chmod(dstPath, 0o755); + } + } + + // Write manifest (generatedRootRel is always relative to repo root, not writeRoot) + await writeManifest(dstDir, "skills/reviewer-runtime/pi"); +} + +/** + * Clear generated content in a root, preserving: + * - node_modules (installed by pnpm) — at any depth + * - .generated-manifest.json (will be rewritten after generation) + * + * Subdirectories are always recursed into before removal so that + * node_modules trees nested at any depth (e.g. scripts/node_modules inside + * atlassian or web-automation variants) are preserved. + */ +async function clearGeneratedRoot(rootDir) { + let entries; + try { + entries = await readdir(rootDir, { withFileTypes: true }); + } catch { + return; // dir doesn't exist yet — nothing to clear + } + + for (const entry of entries) { + if (entry.name === "node_modules") continue; + if (entry.name === MANIFEST_FILENAME) continue; + const fullPath = path.join(rootDir, entry.name); + if (entry.isDirectory()) { + // Always recurse so node_modules at any depth is preserved. + await clearGeneratedRoot(fullPath); + // Remove the directory only if nothing protected remains inside it. + const remaining = await readdir(fullPath).catch(() => []); + if (remaining.length === 0) { + await rm(fullPath, { recursive: true, force: true }); + } + } else { + await rm(fullPath, { force: true }); + } + } +} + +// ── Skill configurations ────────────────────────────────────────────────── + +const SCRIPTS_SKILL_CONFIGS = { + atlassian: { + canonicalScripts: "skills/atlassian/shared/scripts", + // Files to copy from canonicalScripts into each agent's scripts/ dir + scriptFiles: ["src", "tsconfig.json", "pnpm-lock.yaml"], + }, + "web-automation": { + canonicalScripts: "skills/web-automation/shared", + scriptFiles: [ + "auth.ts", + "browse.ts", + "check-install.js", + "extract.js", + "flow.ts", + "lib", + "scan-local-app.ts", + "scrape.ts", + "test-full.ts", + "test-minimal.ts", + "test-profile.ts", + "tsconfig.json", + "turndown-plugin-gfm.d.ts", + "pnpm-lock.yaml", + ], + }, +}; + +// ── Main generator ──────────────────────────────────────────────────────── + +/** + * Regenerate all agent variants from canonical sources. + * + * @param {string} repoRoot - Absolute path to repo root (canonical sources are read from here). + * @param {object} [options] + * @param {boolean} [options.dryRun] - If true, don't write files (future use). + * @param {string} [options.targetRoot] - Write generated output here instead of `repoRoot`. + * Canonical sources are always read from `repoRoot`. Use this to generate into a + * temp directory for drift detection without modifying on-disk files. + * @returns {Promise<{generatedRoots: string[]}>} + */ +export async function generateSkills(repoRoot = REPO_ROOT, options = {}) { + const { dryRun = false, targetRoot } = options; + const writeRoot = targetRoot ?? repoRoot; + if (dryRun) { + return { generatedRoots: GENERATED_ROOTS }; + } + + const skillOnlySkills = ["create-plan", "do-task", "implement-plan"]; + + // 1. Generate skill-only skills (create-plan, do-task, implement-plan) + for (const skillName of skillOnlySkills) { + for (const agentName of AGENTS) { + const rootRel = `skills/${skillName}/${agentName}`; + await generateSkillOnlyVariant(repoRoot, writeRoot, skillName, agentName, rootRel); + } + // pi-package mirror (same source as pi variant) + const piPackageRel = `pi-package/skills/${skillName}`; + await generateSkillOnlyVariant(repoRoot, writeRoot, skillName, "pi", piPackageRel); + } + + // 2. Generate scripts skills (atlassian, web-automation) + for (const [skillName, config] of Object.entries(SCRIPTS_SKILL_CONFIGS)) { + for (const agentName of AGENTS) { + const rootRel = `skills/${skillName}/${agentName}`; + await generateScriptsSkillVariant(repoRoot, writeRoot, skillName, agentName, rootRel, config); + } + // pi-package mirror: same source as pi variant but a distinct package name + // ("pi-mirror" suffix) so the workspace has no duplicate package names. + const piPackageRel = `pi-package/skills/${skillName}`; + await generateScriptsSkillVariant(repoRoot, writeRoot, skillName, "pi", piPackageRel, config, "pi-mirror"); + } + + // 3. Generate reviewer-runtime pi variant + await generateReviewerRuntimePi(repoRoot, writeRoot); + + return { generatedRoots: GENERATED_ROOTS }; +} + +// ── CLI entry point ──────────────────────────────────────────────────────── + +if (import.meta.url === pathToFileURL(process.argv[1]).href) { + try { + const result = await generateSkills(REPO_ROOT); + console.log( + `Generated ${result.generatedRoots.length} roots from canonical sources.`, + ); + process.exit(0); + } catch (err) { + console.error("generate-skills: fatal error:", err.message ?? err); + process.exit(1); + } +} diff --git a/scripts/lib/assert-no-pnpm-version-pin.mjs b/scripts/lib/assert-no-pnpm-version-pin.mjs new file mode 100644 index 0000000..2b95c01 --- /dev/null +++ b/scripts/lib/assert-no-pnpm-version-pin.mjs @@ -0,0 +1,76 @@ +#!/usr/bin/env node +/** + * assert-no-pnpm-version-pin.mjs — CI regression guard (followup: fix pnpm version conflict) + * + * Ensures no .github/workflows/*.yml file pins pnpm via a `version:` key + * under a `pnpm/action-setup` step. The canonical version source is + * `package.json#packageManager`, which carries an exact version + integrity + * hash. Duplicating the version in the workflow creates a conflict that + * pnpm/action-setup@v4 treats as an error. + * + * Usage: + * node scripts/lib/assert-no-pnpm-version-pin.mjs + * pnpm run verify:ci + * + * Exit codes: + * 0 — no version pin found + * 1 — one or more violations found (details on stderr) + */ + +import { readFileSync, readdirSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(__dirname, "../.."); +const WORKFLOWS_DIR = path.join(REPO_ROOT, ".github", "workflows"); + +let violations = 0; + +// Read workflow files — silently pass if directory doesn't exist +let files; +try { + files = readdirSync(WORKFLOWS_DIR).filter( + (f) => f.endsWith(".yml") || f.endsWith(".yaml") + ); +} catch { + process.stdout.write("OK: no .github/workflows directory found; nothing to check.\n"); + process.exit(0); +} + +for (const file of files) { + const fullPath = path.join(WORKFLOWS_DIR, file); + const content = readFileSync(fullPath, "utf8"); + const lines = content.split("\n"); + + for (let i = 0; i < lines.length; i++) { + // Locate a step that uses pnpm/action-setup + if (!lines[i].includes("pnpm/action-setup")) continue; + + // Look ahead up to 10 lines for a `version:` key in the same step + const end = Math.min(i + 10, lines.length); + for (let j = i + 1; j < end; j++) { + const ahead = lines[j]; + // A new step begins at a `- name:` or `- uses:` list item → stop + if (/^\s*-\s+(name|uses)\s*:/.test(ahead)) break; + // `version:` key found inside this step → violation + if (/^\s+version\s*:/.test(ahead)) { + process.stderr.write( + `ERROR: ${file}:${j + 1}: 'version:' key found under pnpm/action-setup step.\n` + + ` Remove 'with.version'; let package.json#packageManager be the single\n` + + ` source of truth for the pnpm version (exact version + integrity hash).\n\n` + ); + violations++; + break; + } + } + } +} + +if (violations > 0) { + process.stderr.write(`${violations} violation(s) found.\n`); + process.exit(1); +} + +process.stdout.write("OK: no pnpm version pins found in workflow files.\n"); +process.exit(0); diff --git a/scripts/lib/portable.sh b/scripts/lib/portable.sh new file mode 100644 index 0000000..1dd0ac7 --- /dev/null +++ b/scripts/lib/portable.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# portable.sh — POSIX-safe helper functions for BSD/GNU shell portability +# +# Source this file in scripts that need cross-platform variants of: +# - stat(1) — BSD uses -f, GNU uses -c +# +# Usage: +# source "$(dirname "${BASH_SOURCE[0]}")/portable.sh" +# portable_stat_perms "$file" # -> octal permissions string, e.g. "755" +# +# Supported platforms: +# - macOS (BSD stat) +# - Linux/Ubuntu (GNU stat) + +# portable_stat_perms +# Outputs the file's permission bits as an octal string (e.g. "755"). +# Exits non-zero if stat fails. +portable_stat_perms() { + local path="$1" + case "$(uname -s)" in + Darwin) + stat -f '%Lp' "$path" + ;; + *) + stat -c '%a' "$path" + ;; + esac +} diff --git a/scripts/lib/run-check.mjs b/scripts/lib/run-check.mjs new file mode 100644 index 0000000..94dde00 --- /dev/null +++ b/scripts/lib/run-check.mjs @@ -0,0 +1,98 @@ +#!/usr/bin/env node +/** + * run-check.mjs — aggregate quality check runner (M1, S-106) + * + * Runs every quality gate in sequence and reports a summary. + * All steps run even if earlier steps fail, so you get a complete + * picture of the repository health in one pass. + * + * Transitional contract (M1): + * This script may exit non-zero. Pre-existing failures are recorded in + * docs/CLEANUP-BASELINE.md. Only issues introduced by new changes (not + * listed in the baseline) constitute a regression. + * + * Usage: + * node scripts/lib/run-check.mjs # full check + * pnpm run check # same, via pnpm + */ + +import { spawnSync } from "node:child_process"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(__dirname, "../.."); + +// ── Steps ────────────────────────────────────────────────────────────────── + +const STEPS = [ + { label: "lint", cmd: "pnpm", args: ["run", "lint"] }, + { label: "typecheck", cmd: "pnpm", args: ["run", "typecheck"] }, + { label: "test", cmd: "pnpm", args: ["run", "test"] }, + { label: "verify:pi", cmd: "pnpm", args: ["run", "verify:pi"] }, + { label: "verify:reviewers", cmd: "pnpm", args: ["run", "verify:reviewers"] }, + { label: "verify:docs", cmd: "pnpm", args: ["run", "verify:docs"] }, + { label: "verify:generated", cmd: "pnpm", args: ["run", "verify:generated"] }, + { label: "verify:ci", cmd: "pnpm", args: ["run", "verify:ci"] }, +]; + +// ── Runner ───────────────────────────────────────────────────────────────── + +const RESET = "\x1b[0m"; +const GREEN = "\x1b[32m"; +const RED = "\x1b[31m"; +const BOLD = "\x1b[1m"; +const DIM = "\x1b[2m"; + +function colorize(color, text) { + // Respect NO_COLOR env variable + if (process.env.NO_COLOR || process.env.CI) return text; + return `${color}${text}${RESET}`; +} + +const results = []; + +for (const step of STEPS) { + process.stdout.write(`\n${colorize(BOLD, `=== ${step.label} ===`)}\n`); + const result = spawnSync(step.cmd, step.args, { + cwd: REPO_ROOT, + stdio: "inherit", + encoding: "utf8", + shell: false, + }); + const ok = result.status === 0 && !result.error; + results.push({ label: step.label, ok, status: result.status ?? -1 }); +} + +// ── Summary ──────────────────────────────────────────────────────────────── + +process.stdout.write(`\n${colorize(BOLD, "=== check summary ===")}\n`); + +const failures = []; +for (const r of results) { + if (r.ok) { + process.stdout.write( + ` ${colorize(GREEN, "PASS")} ${r.label}\n` + ); + } else { + process.stdout.write( + ` ${colorize(RED, "FAIL")} ${r.label} ${colorize(DIM, `(exit ${r.status})`)} — see docs/CLEANUP-BASELINE.md if pre-existing\n` + ); + failures.push(r.label); + } +} + +process.stdout.write("\n"); + +if (failures.length === 0) { + process.stdout.write(colorize(GREEN, "All checks passed.\n")); + process.exit(0); +} else { + process.stdout.write( + colorize( + RED, + `${failures.length} check(s) failed: ${failures.join(", ")}\n` + ) + ); + process.exit(1); +} diff --git a/scripts/lib/run-link-check.mjs b/scripts/lib/run-link-check.mjs new file mode 100644 index 0000000..6840323 --- /dev/null +++ b/scripts/lib/run-link-check.mjs @@ -0,0 +1,144 @@ +#!/usr/bin/env node +/** + * run-link-check.mjs — markdown link-check runner (M1, S-104) + * + * Runs markdown-link-check across README.md, docs/, and every SKILL.md + * (excluding node_modules and generated agent-variant directories). + * + * Modes: + * --offline (default) — checks only repo-relative links and #anchor links. + * All http/https links are ignored. Safe for CI and local dev + * without network access. + * --online — checks all links, including external URLs, with timeouts + * and retries as configured in markdown-link-check.online.json. + * + * Exit codes: + * 0 — all checked links are alive (or ignored in offline mode) + * 1 — one or more broken links found + */ + +import { spawnSync } from "node:child_process"; +import { readdirSync, existsSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(__dirname, "../.."); + +// ── CLI arguments ────────────────────────────────────────────────────────── + +const online = process.argv.includes("--online"); +const configFile = online + ? path.join(REPO_ROOT, "markdown-link-check.online.json") + : path.join(REPO_ROOT, "markdown-link-check.json"); + +// ── File discovery ───────────────────────────────────────────────────────── + +const SKIP_PATHS = new Set([ + "skills/atlassian/codex", + "skills/atlassian/claude-code", + "skills/atlassian/cursor", + "skills/atlassian/opencode", + "skills/atlassian/pi", + "skills/web-automation/claude-code", + "skills/web-automation/cursor", + "skills/web-automation/opencode", + "skills/web-automation/pi", + "pi-package", +]); + +// Also skip any _source/ subdirectory within skills — canonical source files +// use relative paths calibrated to the generated location (one level shallower). +const SKIP_SEGMENT = "_source"; + +function shouldSkip(absPath) { + const rel = path.relative(REPO_ROOT, absPath); + for (const skip of SKIP_PATHS) { + if (rel === skip || rel.startsWith(skip + path.sep)) return true; + } + const parts = rel.split(path.sep); + if (parts.includes("node_modules")) return true; + // Skip canonical _source/ directories (links calibrated to generated location) + if (parts.includes(SKIP_SEGMENT)) return true; + return false; +} + +function collectMarkdownFiles(dir) { + const found = []; + let entries; + try { + entries = readdirSync(dir, { withFileTypes: true }); + } catch { + return found; + } + for (const entry of entries) { + const full = path.join(dir, entry.name); + if (shouldSkip(full)) continue; + if (entry.isDirectory()) { + found.push(...collectMarkdownFiles(full)); + } else if ( + entry.isFile() && + (entry.name.endsWith(".md") || entry.name === "SKILL.md") + ) { + found.push(full); + } + } + return found; +} + +// ── Collect target files ─────────────────────────────────────────────────── + +const files = [ + path.join(REPO_ROOT, "README.md"), + ...collectMarkdownFiles(path.join(REPO_ROOT, "docs")), + ...collectMarkdownFiles(path.join(REPO_ROOT, "skills")), +].filter(existsSync); + +// De-duplicate (README.md could appear twice) +const uniqueFiles = [...new Set(files)]; + +if (uniqueFiles.length === 0) { + console.log("link-check: no markdown files found — nothing to check."); + process.exit(0); +} + +console.log( + `link-check: checking ${uniqueFiles.length} file(s) ` + + `[mode: ${online ? "online" : "offline"}]…` +); + +// ── Run markdown-link-check ──────────────────────────────────────────────── + +const mlcBin = path.join( + REPO_ROOT, + "node_modules", + ".bin", + "markdown-link-check" +); + +let failures = 0; +for (const file of uniqueFiles.sort()) { + const result = spawnSync( + mlcBin, + ["--config", configFile, "--quiet", file], + { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] } + ); + const output = (result.stdout + result.stderr).trim(); + const rel = path.relative(REPO_ROOT, file); + if (result.status !== 0) { + failures += 1; + console.error(`\n--- ${rel} ---`); + if (output) console.error(output); + } +} + +if (failures > 0) { + console.error( + `\nlink-check: ${failures} file(s) have broken links. ` + + `See docs/CLEANUP-BASELINE.md for the as-is baseline.` + ); + process.exit(1); +} else { + console.log("link-check: all links OK."); + process.exit(0); +} diff --git a/scripts/lib/run-shellcheck.mjs b/scripts/lib/run-shellcheck.mjs new file mode 100644 index 0000000..b4a905d --- /dev/null +++ b/scripts/lib/run-shellcheck.mjs @@ -0,0 +1,161 @@ +#!/usr/bin/env node +/** + * run-shellcheck.mjs — shell script quality wrapper (M1, S-105) + * + * Discovers *.sh files under scripts/ and skills/ (excluding node_modules + * and generated agent-variant directories), then runs shellcheck on each. + * + * shellcheck is a REQUIRED prerequisite. The script fails immediately when + * shellcheck is not found on PATH. Install it with: + * macOS: brew install shellcheck + * Debian: apt-get install shellcheck + * + * Exit codes: + * 0 — all files passed shellcheck + * 1 — one or more files have shellcheck findings + * 2 — shellcheck is missing from PATH + */ + +import { spawnSync } from "node:child_process"; +import { readdirSync } from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const REPO_ROOT = path.resolve(__dirname, "../.."); + +// ── Prerequisites check ──────────────────────────────────────────────────── + +function checkShellcheck() { + const result = spawnSync("shellcheck", ["--version"], { encoding: "utf8" }); + if (result.error || result.status === null || result.status > 1) { + console.error( + [ + "ERROR: shellcheck is not available on PATH.", + "", + "shellcheck is a required prerequisite for this repository.", + "Install it before running lint:", + "", + " macOS: brew install shellcheck", + " Debian/Ubuntu: sudo apt-get install shellcheck", + " Other: https://github.com/koalaman/shellcheck#installing", + ].join("\n") + ); + process.exit(2); + } +} + +// ── File discovery ───────────────────────────────────────────────────────── + +/** + * Directories to scan for *.sh files. + * Relative paths from REPO_ROOT. + */ +const SCAN_DIRS = ["scripts", "skills"]; + +/** + * Path segments that indicate a directory should be skipped entirely. + * Matches generated agent-variant bundles and npm/pnpm install artifacts. + */ +const SKIP_SEGMENTS = new Set([ + "node_modules", + // Generated agent-variant directories (excluded per M1 workspace policy) + // skills//codex — except web-automation/codex which is canonical + // We skip all codex variants to be safe; shellcheck only cares about .sh files + // and all variants share the same scripts anyway. +]); + +/** + * Exact relative paths (from REPO_ROOT) to skip, matched after normalisation. + * These are the generated variants that duplicate canonical source. + */ +const SKIP_PATHS = new Set([ + "skills/atlassian/codex", + "skills/atlassian/claude-code", + "skills/atlassian/cursor", + "skills/atlassian/opencode", + "skills/atlassian/pi", + "skills/web-automation/claude-code", + "skills/web-automation/cursor", + "skills/web-automation/opencode", + "skills/web-automation/pi", + "pi-package", +]); + +function shouldSkip(absPath) { + const rel = path.relative(REPO_ROOT, absPath); + // Check exact-prefix matches (directory and its children) + for (const skip of SKIP_PATHS) { + if (rel === skip || rel.startsWith(skip + path.sep)) return true; + } + // Check path-segment matches (e.g. node_modules anywhere in path) + for (const seg of rel.split(path.sep)) { + if (SKIP_SEGMENTS.has(seg)) return true; + } + return false; +} + +function collectShellFiles(dir) { + const found = []; + let entries; + try { + entries = readdirSync(dir, { withFileTypes: true }); + } catch { + return found; // directory does not exist — skip silently + } + for (const entry of entries) { + const full = path.join(dir, entry.name); + if (shouldSkip(full)) continue; + if (entry.isDirectory()) { + found.push(...collectShellFiles(full)); + } else if (entry.isFile() && entry.name.endsWith(".sh")) { + found.push(full); + } + } + return found; +} + +// ── Main ─────────────────────────────────────────────────────────────────── + +checkShellcheck(); + +const files = SCAN_DIRS.flatMap((d) => + collectShellFiles(path.join(REPO_ROOT, d)) +); + +if (files.length === 0) { + console.log("shellcheck: no .sh files found — nothing to check."); + process.exit(0); +} + +console.log(`shellcheck: scanning ${files.length} file(s)…`); + +let failures = 0; +for (const file of files.sort()) { + const result = spawnSync("shellcheck", ["-x", "--source-path=SCRIPTDIR", file], { + encoding: "utf8", + stdio: ["ignore", "pipe", "pipe"], + }); + const output = (result.stdout + result.stderr).trim(); + const rel = path.relative(REPO_ROOT, file); + if (result.status !== 0) { + failures += 1; + // Print findings prefixed with the relative path so output is reproducible + // regardless of cwd. + console.error(`\n--- ${rel} ---`); + if (output) console.error(output); + } else { + // Quiet on success — only show problems + } +} + +if (failures > 0) { + console.error( + `\nshellcheck: ${failures} file(s) have findings. ` + + `See docs/CLEANUP-BASELINE.md for the as-is baseline.` + ); + process.exit(1); +} else { + console.log("shellcheck: all files passed."); + process.exit(0); +} diff --git a/scripts/lib/safe-replace-dir.mjs b/scripts/lib/safe-replace-dir.mjs new file mode 100644 index 0000000..0f6956d --- /dev/null +++ b/scripts/lib/safe-replace-dir.mjs @@ -0,0 +1,77 @@ +/** + * safe-replace-dir.mjs — safely replace a directory within a safety-root boundary + * + * Exports: + * safeReplaceDir(source, target, safetyRoot) → Promise + * + * Usage: + * import { safeReplaceDir } from "./lib/safe-replace-dir.mjs"; + * await safeReplaceDir("/path/to/source", "/safe/root/target", "/safe/root"); + * + * Safety contract: + * - `target` must be a strict descendant of `safetyRoot` (not equal to it). + * - `target` must be a non-empty path. + * - Throws with a descriptive message if either constraint is violated. + * + * Behaviour: + * - Removes any existing content at `target` (rm -rf equivalent). + * - Creates `target` (and any missing parent directories). + * - Copies all files from `source` into `target`. + */ + +import { cp, mkdir, realpath, rm } from "node:fs/promises"; +import path from "node:path"; + +/** + * Safely replace `target` with the contents of `source`, enforcing that + * `target` is a strict descendant of `safetyRoot`. + * + * @param {string} source - Directory to copy from. + * @param {string} target - Directory to replace (will be removed then recreated). + * @param {string} safetyRoot - Ancestor boundary; `target` must be inside this. + * @returns {Promise} + */ +export async function safeReplaceDir(source, target, safetyRoot) { + if (!target || target === "") { + throw new Error(`Refusing to replace unsafe target: (empty string)`); + } + + const resolvedSafety = path.resolve(safetyRoot); + const resolvedTarget = path.resolve(target); + + // Lexical check: target must be a strict descendant of safetyRoot. + const relative = path.relative(resolvedSafety, resolvedTarget); + if (!relative || relative.startsWith("..") || path.isAbsolute(relative) || relative === "") { + throw new Error(`Refusing to replace target outside safety root: ${target}`); + } + + // Real-path check: resolve the deepest existing ancestor of target's parent + // and verify it lies inside the real (symlink-resolved) safety root. + // This blocks a symlinked parent directory from redirecting outside the boundary. + const realSafety = await realpath(resolvedSafety); + let checkPath = path.dirname(resolvedTarget); + for (;;) { + try { + const realAncestor = await realpath(checkPath); + const realRel = path.relative(realSafety, realAncestor); + if (realRel.startsWith("..") || path.isAbsolute(realRel)) { + throw new Error(`Refusing to replace target outside safety root: ${target}`); + } + break; // validation passed + } catch (err) { + if (err.code === "ENOENT") { + const parent = path.dirname(checkPath); + if (parent === checkPath) { + throw new Error(`Refusing to replace target outside safety root: ${target}`, { cause: err }); + } + checkPath = parent; + continue; + } + throw err; + } + } + + await rm(resolvedTarget, { recursive: true, force: true }); + await mkdir(resolvedTarget, { recursive: true }); + await cp(source, resolvedTarget, { recursive: true, force: true }); +} diff --git a/scripts/lib/safe-replace-dir.sh b/scripts/lib/safe-replace-dir.sh new file mode 100755 index 0000000..b444ec4 --- /dev/null +++ b/scripts/lib/safe-replace-dir.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash +# safe-replace-dir.sh — safely replace a directory within a safety-root boundary +# +# Provides safe_replace_dir() for sourcing, or run standalone: +# ./scripts/lib/safe-replace-dir.sh +# +# Safety contract (mirrors safe-replace-dir.mjs): +# - must be a non-empty path. +# - must be a strict descendant of (not equal to it). +# - Prints an error and returns/exits 1 if either constraint is violated. +# +# Usage (sourced): +# source "$(dirname "${BASH_SOURCE[0]}")/safe-replace-dir.sh" +# safe_replace_dir "$source" "$target" "$safety_root" +# +# Usage (standalone): +# ./scripts/lib/safe-replace-dir.sh /path/to/source /safe/root/target /safe/root + +safe_replace_dir() { + local source=$1 + local target=$2 + local safety_root=$3 + + if [[ -z "$target" ]]; then + echo "safe_replace_dir: refusing to replace unsafe target: (empty string)" >&2 + return 1 + fi + + # Resolve the real (symlink-resolved) safety root. + local abs_safety + abs_safety=$(cd "$safety_root" 2>/dev/null && pwd -P) || { + echo "safe_replace_dir: safety root does not exist: $safety_root" >&2 + return 1 + } + + # Build an absolute lexical path for target's parent directory. + local target_parent target_base + target_base=$(basename "$target") + target_parent=$(dirname "$target") + # Make target_parent absolute without relying on cd (target may not exist yet). + if [[ "$target_parent" != /* ]]; then + target_parent="${PWD}/${target_parent}" + fi + + # Walk up from target_parent to find the deepest existing directory, + # accumulating the non-existing path suffix as we go. + local suffix="" + local walk="$target_parent" + while [[ ! -d "$walk" ]]; do + local component + component=$(basename "$walk") + if [[ -z "$suffix" ]]; then + suffix="$component" + else + suffix="${component}/${suffix}" + fi + local next + next=$(dirname "$walk") + if [[ "$next" == "$walk" ]]; then + echo "safe_replace_dir: could not find existing ancestor for: $target" >&2 + return 1 + fi + walk="$next" + done + + # Resolve the real path of the existing ancestor (follows symlinks). + local abs_parent + abs_parent=$(cd "$walk" && pwd -P) || { + echo "safe_replace_dir: could not resolve parent directory: $walk" >&2 + return 1 + } + + # Reconstruct the full absolute target path. + local abs_target + if [[ -n "$suffix" ]]; then + abs_target="${abs_parent}/${suffix}/${target_base}" + else + abs_target="${abs_parent}/${target_base}" + fi + + # Check that abs_target is strictly inside abs_safety + case "$abs_target" in + "${abs_safety}/"*) ;; + *) + echo "safe_replace_dir: refusing to replace target outside safety root: $target" >&2 + return 1 + ;; + esac + + rm -rf "$abs_target" + mkdir -p "$abs_target" + cp -R "${source}/." "$abs_target/" +} + +# Allow standalone use +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + if [[ $# -ne 3 ]]; then + echo "Usage: $0 " >&2 + exit 1 + fi + safe_replace_dir "$1" "$2" "$3" || exit 1 +fi diff --git a/scripts/lib/skill-manager-core.mjs b/scripts/lib/skill-manager-core.mjs index 27f88c9..814785f 100644 --- a/scripts/lib/skill-manager-core.mjs +++ b/scripts/lib/skill-manager-core.mjs @@ -279,7 +279,7 @@ async function findClaudeCodeSuperpowersPluginRoots(homeDir) { async function findCursorSuperpowersPluginRoots(homeDir) { const pluginRoot = path.join(homeDir, ".cursor", "plugins", "cache", "cursor-public", "superpowers"); - let entries = []; + let entries; try { entries = await readdir(pluginRoot, { withFileTypes: true }); } catch (error) { @@ -532,6 +532,24 @@ export async function buildOperationPlan({ selections, repoRoot = process.cwd(), return { operations, prompts, reportRows, assumeYes }; } +/** + * Remove the target of an operation (skill, helper, or superpowers). + * + * Validates that the target is within the skills root before removing. + * Handles both regular directories and symbolic links. + * Idempotent: succeeds even when the target does not exist. + * + * @param {object} op - Operation object with at least `target` and `skillsRoot`. + * @returns {Promise} Operation with `status: "ok"`. + */ +export async function removeTarget(op) { + await validateRemoveTarget(op.target, op.skillsRoot, { repoRoot: REPO_ROOT }); + const info = existsSync(op.target) ? await lstat(op.target) : null; + if (info?.isSymbolicLink()) await unlink(op.target); + else await rm(op.target, { recursive: true, force: true }); + return { ...op, status: "ok" }; +} + export async function validateRemoveTarget(target, skillsRoot, { repoRoot = process.cwd() } = {}) { const resolvedRoot = path.resolve(skillsRoot); const resolvedTarget = path.resolve(target); @@ -598,7 +616,8 @@ export async function executeOperation(op) { if (op.action === "unsupported" || op.status === "skipped") return { ...op, status: "skipped" }; if (op.kind === "package-skill") return { ...op, status: "included" }; if (op.kind === "sync-pi-package") { - runCommand(path.join(op.repoRoot, "scripts", "sync-pi-package-skills.sh"), [], { cwd: op.repoRoot }); + // Use the canonical generator (pnpm run sync:pi / node scripts/generate-skills.mjs). + runCommand(process.execPath, [path.join(op.repoRoot, "scripts", "generate-skills.mjs")], { cwd: op.repoRoot }); return { ...op, status: "ok" }; } if (op.kind === "pi-package") { @@ -607,33 +626,19 @@ export async function executeOperation(op) { return { ...op, status: "ok" }; } if (op.kind === "skill") { - if (op.action === "remove") { - await validateRemoveTarget(op.target, op.skillsRoot, { repoRoot: REPO_ROOT }); - const info = existsSync(op.target) ? await lstat(op.target) : null; - if (info?.isSymbolicLink()) await unlink(op.target); - else await rm(op.target, { recursive: true, force: true }); - return { ...op, status: "ok" }; - } + if (op.action === "remove") return removeTarget(op); await copyDirectoryReplacing(op.source, op.target); return { ...op, status: "ok" }; } if (op.kind === "helper") { - if (op.action === "remove") { - await validateRemoveTarget(op.target, op.skillsRoot, { repoRoot: REPO_ROOT }); - const info = existsSync(op.target) ? await lstat(op.target) : null; - if (info?.isSymbolicLink()) await unlink(op.target); - else await rm(op.target, { recursive: true, force: true }); - return { ...op, status: "ok" }; - } + if (op.action === "remove") return removeTarget(op); await installHelperAllowlist(op); return { ...op, status: "ok" }; } if (op.kind === "superpowers") { + if (op.action === "remove") return removeTarget(op); await mkdir(path.dirname(op.target), { recursive: true }); - if (op.action === "remove") { - await validateRemoveTarget(op.target, op.skillsRoot, { repoRoot: REPO_ROOT }); - await rm(op.target, { recursive: true, force: true }); - } else if (op.mode === "copy") { + if (op.mode === "copy") { await copyDirectoryReplacing(op.source, op.target); } else { await rm(op.target, { recursive: true, force: true }); diff --git a/scripts/manage-skills.mjs b/scripts/manage-skills.mjs index 5050fcf..511588a 100755 --- a/scripts/manage-skills.mjs +++ b/scripts/manage-skills.mjs @@ -203,6 +203,15 @@ async function interactiveAnswers({ dryRun = false } = {}) { } } +async function readAnswers(source) { + if (source === "-") { + let content = ""; + for await (const chunk of input) content += chunk; + return JSON.parse(content); + } + return JSON.parse(await readFile(path.resolve(source), "utf8")); +} + async function main() { const args = parseArgs(process.argv.slice(2)); if (args.help) { @@ -216,7 +225,7 @@ async function main() { let answers; if (args.answers) { - answers = JSON.parse(await readFile(path.resolve(args.answers), "utf8")); + answers = await readAnswers(args.answers); } else { answers = await buildCliSelection(args); } @@ -267,7 +276,6 @@ async function main() { const removeAnswer = await rl.question(`Remove Superpowers for ${prompt.clientId}/${prompt.scope} too? (yes/no) [no]: `); if (removeAnswer.trim().toLowerCase() === "yes") { const scope = resolveClientScope(prompt.clientId, prompt.scope, process.cwd()); - const client = CLIENTS[prompt.clientId]; const target = `${scope.skillsRoot}/superpowers`; plan.operations.push({ kind: "superpowers", clientId: prompt.clientId, scope: prompt.scope, action: "remove", target, skillsRoot: scope.skillsRoot }); } diff --git a/scripts/sync-pi-package-skills.sh b/scripts/sync-pi-package-skills.sh deleted file mode 100755 index 2908b34..0000000 --- a/scripts/sync-pi-package-skills.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) -TARGET_ROOT="${ROOT_DIR}/pi-package/skills" -SKILL_FAMILIES=( - "atlassian" - "create-plan" - "do-task" - "implement-plan" - "web-automation" -) - -extract_skill_name() { - local skill_md=$1 - awk '/^name:/ { print $2; exit }' "$skill_md" -} - -replace_dir() { - local source=$1 - local target=$2 - - if [[ -z "$target" || "$target" == "/" || "$target" == "." || "$target" == ".." ]]; then - echo "Refusing to sync into unsafe target: $target" >&2 - exit 1 - fi - - case "$target" in - "${ROOT_DIR}"/*) ;; - *) - echo "Refusing to remove target outside repo root: $target" >&2 - exit 1 - ;; - esac - - rm -rf "$target" - mkdir -p "$target" - cp -R "${source}/." "$target/" -} - -rm -rf "$TARGET_ROOT" -mkdir -p "$TARGET_ROOT" - -for family in "${SKILL_FAMILIES[@]}"; do - source_dir="${ROOT_DIR}/skills/${family}/pi" - skill_md="${source_dir}/SKILL.md" - - if [[ ! -f "$skill_md" ]]; then - echo "Missing source SKILL.md: $skill_md" >&2 - exit 1 - fi - - skill_name=$(extract_skill_name "$skill_md") - if [[ -z "$skill_name" ]]; then - echo "Could not derive skill name from $skill_md" >&2 - exit 1 - fi - - replace_dir "$source_dir" "${TARGET_ROOT}/${skill_name}" -done - -echo "Synced pi package skill mirror into ${TARGET_ROOT}." diff --git a/scripts/tests/generate-skills.test.mjs b/scripts/tests/generate-skills.test.mjs new file mode 100644 index 0000000..1628adf --- /dev/null +++ b/scripts/tests/generate-skills.test.mjs @@ -0,0 +1,365 @@ +/** + * Unit tests for generate-skills.mjs — RED phase of TDD. + * + * Tests cover: + * - detectFileType: classification of files by extension + * - applyHeader: insertion per file-type-aware policy + * - makePackageJsonContent: unique name + private:true + * - getGeneratedRoots: returns the canonical generated-root list + */ + +import assert from "node:assert/strict"; +import { mkdtemp, mkdir, writeFile, rm, readFile } from "node:fs/promises"; +import crypto from "node:crypto"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import test from "node:test"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const SCRIPTS_DIR = path.resolve(__dirname, ".."); + +const { + detectFileType, + applyHeader, + makePackageJsonContent, + getGeneratedRoots, + buildManifest, + generateSkills, +} = await import(`${SCRIPTS_DIR}/generate-skills.mjs`); + +// ── detectFileType ──────────────────────────────────────────────────────── + +test("detectFileType: .md files → markdown", () => { + assert.equal(detectFileType("SKILL.md"), "markdown"); + assert.equal(detectFileType("templates/milestone-plan.md"), "markdown"); + assert.equal(detectFileType("README.md"), "markdown"); +}); + +test("detectFileType: .sh files → shell", () => { + assert.equal(detectFileType("run-review.sh"), "shell"); + assert.equal(detectFileType("scripts/install.sh"), "shell"); +}); + +test("detectFileType: .ts and .d.ts files → ts", () => { + assert.equal(detectFileType("src/cli.ts"), "ts"); + assert.equal(detectFileType("turndown-plugin-gfm.d.ts"), "ts"); + assert.equal(detectFileType("auth.ts"), "ts"); +}); + +test("detectFileType: .js files → js", () => { + assert.equal(detectFileType("check-install.js"), "js"); + assert.equal(detectFileType("extract.js"), "js"); +}); + +test("detectFileType: .json files → json", () => { + assert.equal(detectFileType("package.json"), "json"); + assert.equal(detectFileType("tsconfig.json"), "json"); +}); + +test("detectFileType: .yaml and .yml files → yaml", () => { + assert.equal(detectFileType("pnpm-lock.yaml"), "yaml"); + assert.equal(detectFileType("other.yml"), "yaml"); +}); + +test("detectFileType: .jsonc files → jsonc", () => { + assert.equal(detectFileType(".markdownlint.jsonc"), "jsonc"); +}); + +test("detectFileType: unknown extension → unknown", () => { + assert.equal(detectFileType("Makefile"), "unknown"); + assert.equal(detectFileType("somefile"), "unknown"); +}); + +// ── applyHeader ─────────────────────────────────────────────────────────── + +test("applyHeader: markdown with YAML front matter inserts HTML comment after closing ---", () => { + const content = "---\nname: create-plan\n---\n\n# Create Plan\n\nBody.\n"; + const result = applyHeader(content, "markdown", "skills/create-plan/_source/claude-code/SKILL.md"); + + // Front matter block preserved verbatim at start + assert.ok(result.startsWith("---\nname: create-plan\n---\n"), "front matter at start"); + + // HTML comment present + assert.ok(result.includes("`; + const generatedContent = `---\nname: test-skill\n---\n\n${headerLine}\n\n# Test Skill\n`; + await writeFile(path.join(agentDir, "SKILL.md"), generatedContent); + + // Add a STRAY file in the agent dir — this SHOULD be flagged + await writeFile(path.join(agentDir, "STRAY.md"), "stray content"); + + // Write a manifest that does NOT include STRAY.md + const { buildManifest } = await import(`${SCRIPTS_DIR}/generate-skills.mjs`); + const manifest = await buildManifest(agentDir, `skills/${skillName}/${agentName}`); + // Remove STRAY.md from manifest (simulate pre-stray-add manifest) + manifest.files = manifest.files.filter((f) => f.path !== "STRAY.md"); + await writeFile( + path.join(agentDir, ".generated-manifest.json"), + JSON.stringify(manifest, null, 2) + "\n", + ); + + const result = await verifyGenerated(dir, { + generatedRootsOverride: [`skills/${skillName}/${agentName}`], + }); + + assert.equal(result.ok, false, "should fail when stray file present"); + const strayError = result.errors.some((e) => e.includes("STRAY.md")); + assert.ok(strayError, `STRAY.md should appear in errors: ${JSON.stringify(result.errors)}`); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); + +test("verifyGenerated: .generated-manifest.json is excluded from stale-file detection", async () => { + // Even though .generated-manifest.json is in the generated root, it should + // not be considered a "stale file" just because it's not in the files list + const dir = await mkdtemp(path.join(tmpdir(), "vg-manifest-self-")); + try { + const skillName = "test-skill"; + const agentName = "pi"; + + const sourceDir = path.join(dir, "skills", skillName, "_source", agentName); + const agentDir = path.join(dir, "skills", skillName, agentName); + + await mkdir(sourceDir, { recursive: true }); + await mkdir(agentDir, { recursive: true }); + + const skillContent = "---\nname: test-skill\n---\n\n# Test Skill\n"; + await writeFile(path.join(sourceDir, "SKILL.md"), skillContent); + + const headerLine = + ``; + const generatedContent = `---\nname: test-skill\n---\n\n${headerLine}\n\n# Test Skill\n`; + await writeFile(path.join(agentDir, "SKILL.md"), generatedContent); + + // Write manifest (will include SKILL.md, not itself) + const { buildManifest } = await import(`${SCRIPTS_DIR}/generate-skills.mjs`); + const manifest = await buildManifest(agentDir, `skills/${skillName}/${agentName}`); + await writeFile( + path.join(agentDir, ".generated-manifest.json"), + JSON.stringify(manifest, null, 2) + "\n", + ); + + const result = await verifyGenerated(dir, { + generatedRootsOverride: [`skills/${skillName}/${agentName}`], + }); + + // Should pass — .generated-manifest.json is excluded from stale detection + const manifestErrors = result.errors.filter((e) => e.includes(".generated-manifest.json")); + assert.equal(manifestErrors.length, 0, `manifest file should not appear as stale: ${JSON.stringify(manifestErrors)}`); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); + +test("verifyGenerated: missing file from manifest is flagged as deleted", async () => { + const dir = await mkdtemp(path.join(tmpdir(), "vg-missing-file-")); + try { + const skillName = "test-skill"; + const agentName = "cursor"; + + const sourceDir = path.join(dir, "skills", skillName, "_source", agentName); + const agentDir = path.join(dir, "skills", skillName, agentName); + + await mkdir(sourceDir, { recursive: true }); + await mkdir(agentDir, { recursive: true }); + + const skillContent = "---\nname: test-skill\n---\n\n# Test Skill\n"; + await writeFile(path.join(sourceDir, "SKILL.md"), skillContent); + await writeFile(path.join(agentDir, "SKILL.md"), "generated content\n"); + + // Manifest claims templates/plan.md exists, but the file doesn't + const manifest = { + $schema: "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + generator: "scripts/generate-skills.mjs", + generatedRoot: `skills/${skillName}/${agentName}`, + files: [ + { path: "SKILL.md", kind: "file", mode: "644", sha256: "aaa" }, + { path: "templates/plan.md", kind: "file", mode: "644", sha256: "bbb" }, + ], + }; + await writeFile( + path.join(agentDir, ".generated-manifest.json"), + JSON.stringify(manifest, null, 2) + "\n", + ); + + const result = await verifyGenerated(dir, { + generatedRootsOverride: [`skills/${skillName}/${agentName}`], + }); + + assert.equal(result.ok, false, "should fail on missing file"); + const missingError = result.errors.some((e) => e.includes("templates/plan.md")); + assert.ok(missingError, `missing file should appear in errors: ${JSON.stringify(result.errors)}`); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); + +test("verifyGenerated: content mismatch is flagged", async () => { + const dir = await mkdtemp(path.join(tmpdir(), "vg-content-mismatch-")); + try { + const skillName = "test-skill"; + const agentName = "opencode"; + + const sourceDir = path.join(dir, "skills", skillName, "_source", agentName); + const agentDir = path.join(dir, "skills", skillName, agentName); + + await mkdir(sourceDir, { recursive: true }); + await mkdir(agentDir, { recursive: true }); + + await writeFile(path.join(sourceDir, "SKILL.md"), "---\nname: test-skill\n---\n\n# Original\n"); + // Agent dir has DIFFERENT content than what manifest says + await writeFile(path.join(agentDir, "SKILL.md"), "---\nname: test-skill\n---\n\n# Modified!\n"); + + const manifest = { + $schema: "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + generator: "scripts/generate-skills.mjs", + generatedRoot: `skills/${skillName}/${agentName}`, + files: [ + { + path: "SKILL.md", + kind: "file", + mode: "644", + // SHA of the ORIGINAL content (not what's on disk) + sha256: "0000000000000000000000000000000000000000000000000000000000000000", + }, + ], + }; + await writeFile( + path.join(agentDir, ".generated-manifest.json"), + JSON.stringify(manifest, null, 2) + "\n", + ); + + const result = await verifyGenerated(dir, { + generatedRootsOverride: [`skills/${skillName}/${agentName}`], + }); + + assert.equal(result.ok, false, "should fail on content mismatch"); + const mismatchError = result.errors.some((e) => e.includes("SKILL.md")); + assert.ok(mismatchError, `content mismatch should appear in errors: ${JSON.stringify(result.errors)}`); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); + +test("verifyGenerated: manifest entry with wrong sha256 is flagged even when paths match", async () => { + const dir = await mkdtemp(path.join(tmpdir(), "vg-manifest-sha-")); + try { + const skillName = "test-skill"; + const agentName = "codex"; + + const sourceDir = path.join(dir, "skills", skillName, "_source", agentName); + const agentDir = path.join(dir, "skills", skillName, agentName); + + await mkdir(sourceDir, { recursive: true }); + await mkdir(agentDir, { recursive: true }); + + const content = "---\nname: test-skill\n---\n\n# Test Skill\n"; + await writeFile(path.join(sourceDir, "SKILL.md"), content); + await writeFile(path.join(agentDir, "SKILL.md"), content); + + // Manifest has correct path but deliberately wrong sha256 (simulates corrupted metadata) + const manifest = { + $schema: "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + generator: "scripts/generate-skills.mjs", + generatedRoot: `skills/${skillName}/${agentName}`, + files: [ + { + path: "SKILL.md", + kind: "file", + mode: "644", + sha256: "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", + }, + ], + }; + await writeFile( + path.join(agentDir, ".generated-manifest.json"), + JSON.stringify(manifest, null, 2) + "\n", + ); + + const result = await verifyGenerated(dir, { + generatedRootsOverride: [`skills/${skillName}/${agentName}`], + }); + + // Even though file paths match, the sha256 mismatch in the manifest should be detected + assert.equal(result.ok, false, "should fail on sha256 mismatch in manifest"); + const sha256Error = result.errors.some( + (e) => e.includes("sha256") || e.includes("SKILL.md"), + ); + assert.ok(sha256Error, `sha256 mismatch should appear in errors: ${JSON.stringify(result.errors)}`); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); + +test("verifyGenerated: manifest entry with wrong mode is flagged even when paths match", async () => { + const dir = await mkdtemp(path.join(tmpdir(), "vg-manifest-mode-")); + try { + const skillName = "test-skill"; + const agentName = "cursor"; + + const agentDir = path.join(dir, "skills", skillName, agentName); + await mkdir(agentDir, { recursive: true }); + + const content = "# Test Skill\n"; + await writeFile(path.join(agentDir, "SKILL.md"), content); + + // Build a correct manifest first (with real sha256) + const { buildManifest } = await import(`${SCRIPTS_DIR}/generate-skills.mjs`); + const correctManifest = await buildManifest(agentDir, `skills/${skillName}/${agentName}`); + + // Tamper: change the mode field for the SKILL.md entry + const tamperedManifest = { + ...correctManifest, + files: correctManifest.files.map((f) => + f.path === "SKILL.md" ? { ...f, mode: "777" } : f, + ), + }; + await writeFile( + path.join(agentDir, ".generated-manifest.json"), + JSON.stringify(tamperedManifest, null, 2) + "\n", + ); + + const result = await verifyGenerated(dir, { + generatedRootsOverride: [`skills/${skillName}/${agentName}`], + }); + + // The mode mismatch in the manifest should be detected by diffManifests + assert.equal(result.ok, false, "should fail on mode mismatch in manifest"); + const modeError = result.errors.some( + (e) => e.includes("mode") || e.includes("SKILL.md"), + ); + assert.ok(modeError, `mode mismatch should appear in errors: ${JSON.stringify(result.errors)}`); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); diff --git a/scripts/verify-docs-flow.mjs b/scripts/verify-docs-flow.mjs new file mode 100644 index 0000000..0740f25 --- /dev/null +++ b/scripts/verify-docs-flow.mjs @@ -0,0 +1,318 @@ +#!/usr/bin/env node +/** + * verify-docs-flow.mjs — documentation reading-flow and consistency verifier (M2, S-206) + * + * Asserts: + * (i) every docs/*.md file is linked from docs/README.md + * (ii) the reviewer CLI matrix is consistent across the four canonical sources + * (iii) the Telegram agent list matches the set of agents with helpers on disk + * (iv) all repository-relative paths referenced in README.md and docs/ exist + * + * Exits 0 when all checks pass; exits 1 with a report when any check fails. + * + * Usage: + * node scripts/verify-docs-flow.mjs + * pnpm run verify:docs (wired via package.json) + */ + +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +export const REPO_ROOT = path.resolve(__dirname, ".."); + +// ── (i) docs/README.md coverage ─────────────────────────────────────────── + +/** + * Check that every *.md file under docs/ is linked from docs/README.md. + * Returns an array of error strings (empty = pass). + * + * @param {string} repoRoot + * @returns {Promise} + */ +export async function checkDocsIndexCoverage(repoRoot) { + const docsDir = path.join(repoRoot, "docs"); + const readmePath = path.join(docsDir, "README.md"); + + if (!fs.existsSync(readmePath)) { + return ["docs/README.md is missing"]; + } + + const readmeContent = fs.readFileSync(readmePath, "utf8"); + const errors = []; + + // Collect all *.md files under docs/ except README.md itself + const mdFiles = fs + .readdirSync(docsDir) + .filter((f) => f.endsWith(".md") && f !== "README.md"); + + for (const file of mdFiles) { + // Accept both ./FILE.md and FILE.md link forms + const linked = + readmeContent.includes(`](${file})`) || + readmeContent.includes(`](./${file})`); + if (!linked) { + errors.push(`docs/README.md does not link to docs/${file}`); + } + } + + return errors; +} + +// ── (ii) Reviewer matrix consistency ────────────────────────────────────── + +/** + * Canonical reviewer CLI names expected in workflow docs. + * Order matters for the consistency check. + */ +const EXPECTED_REVIEWER_CLIS = ["codex", "claude", "cursor", "opencode", "pi"]; + +/** + * Check that the reviewer CLI matrix is consistent across the four canonical + * workflow docs. Returns an array of error strings (empty = pass). + * + * @param {string} repoRoot + * @returns {Promise} + */ +export async function checkReviewerMatrixConsistency(repoRoot) { + const canonical = [ + "docs/CREATE-PLAN.md", + "docs/IMPLEMENT-PLAN.md", + "docs/DO-TASK.md", + "docs/REVIEWERS.md", + ]; + + const errors = []; + + for (const docPath of canonical) { + const fullPath = path.join(repoRoot, docPath); + if (!fs.existsSync(fullPath)) { + errors.push(`${docPath} is missing`); + continue; + } + const content = fs.readFileSync(fullPath, "utf8"); + // Each canonical doc must reference all five CLIs + for (const cli of EXPECTED_REVIEWER_CLIS) { + if (!content.includes(`\`${cli}\``)) { + errors.push(`${docPath}: does not mention reviewer CLI \`${cli}\``); + } + } + } + + return errors; +} + +// ── (iii) Telegram agent coverage ───────────────────────────────────────── + +/** + * Agents that must have helpers on disk in skills/reviewer-runtime/. + * Non-Pi agents use the top-level directory; Pi uses the pi/ sub-directory. + */ +const TELEGRAM_AGENTS = [ + { + id: "codex", + helperPath: "skills/reviewer-runtime/notify-telegram.sh", + telegramSectionKeyword: "Codex", + }, + { + id: "claude-code", + helperPath: "skills/reviewer-runtime/notify-telegram.sh", + telegramSectionKeyword: "Claude Code", + }, + { + id: "opencode", + helperPath: "skills/reviewer-runtime/notify-telegram.sh", + telegramSectionKeyword: "OpenCode", + }, + { + id: "cursor", + helperPath: "skills/reviewer-runtime/notify-telegram.sh", + telegramSectionKeyword: "Cursor", + }, + { + id: "pi", + helperPath: "skills/reviewer-runtime/pi/notify-telegram.sh", + telegramSectionKeyword: "Pi", + }, +]; + +/** + * Check that docs/TELEGRAM-NOTIFICATIONS.md documents every agent that has a + * notify-telegram.sh helper on disk. Returns an array of error strings. + * + * @param {string} repoRoot + * @returns {Promise} + */ +export async function checkTelegramAgentCoverage(repoRoot) { + const telegramDoc = path.join(repoRoot, "docs", "TELEGRAM-NOTIFICATIONS.md"); + const errors = []; + + if (!fs.existsSync(telegramDoc)) { + return ["docs/TELEGRAM-NOTIFICATIONS.md is missing"]; + } + + const content = fs.readFileSync(telegramDoc, "utf8"); + + for (const agent of TELEGRAM_AGENTS) { + const helperFullPath = path.join(repoRoot, agent.helperPath); + if (!fs.existsSync(helperFullPath)) { + errors.push( + `Telegram agent ${agent.id}: helper ${agent.helperPath} does not exist on disk` + ); + continue; + } + // The Telegram doc must mention this agent somewhere + if (!content.includes(agent.telegramSectionKeyword)) { + errors.push( + `docs/TELEGRAM-NOTIFICATIONS.md does not document agent: ${agent.telegramSectionKeyword}` + ); + } + } + + // Pi-specific: must link to PI-COMMON-REVIEWER.md + if (!content.includes("PI-COMMON-REVIEWER.md")) { + errors.push( + "docs/TELEGRAM-NOTIFICATIONS.md must link to docs/PI-COMMON-REVIEWER.md" + ); + } + + return errors; +} + +// ── (iv) Repo-relative path references ──────────────────────────────────── + +/** + * Patterns to skip when checking path references — these are URLs and + * non-filesystem references that look like repo paths but aren't. + */ +const PATH_SKIP_PATTERNS = [ + /^https?:\/\//, // HTTP URLs + /^\/tmp\//, // /tmp paths (runtime artifacts) + /^\$\{/, // shell variable expansions + /^~\//, // home directory paths + /^\.\.?\//, // relative ./ or ../ — checked differently + /node_modules/, // node_modules + /^[A-Z_]+_[A-Z_]+$/, // environment variable names +]; + +/** + * Extract candidate repository-relative paths from markdown text. + * Looks for: + * - markdown links: [text](path) + * - inline code: `path` + * - bare paths starting with known top-level directories + * + * @param {string} content + * @returns {string[]} - candidate relative paths + */ +function extractRepoPaths(content) { + const candidates = new Set(); + + // Markdown links: [text](path) where path does not start with http/https + const linkRe = /\[(?:[^\]]*)\]\(([^)]+)\)/g; + let m; + while ((m = linkRe.exec(content)) !== null) { + const href = m[1].split("#")[0].trim(); // strip anchors + if (!href) continue; + if (PATH_SKIP_PATTERNS.some((p) => p.test(href))) continue; + // Normalize ./ prefix + const normalized = href.startsWith("./") ? href.slice(2) : href; + if (normalized.startsWith("../")) continue; // skip upward traversals + candidates.add(normalized); + } + + return [...candidates]; +} + +/** + * Check that all repository-relative paths referenced in README.md and docs/ + * actually exist in the repository. Returns an array of error strings. + * + * @param {string} repoRoot + * @returns {Promise} + */ +export async function checkRepoPathsExist(repoRoot) { + const errors = []; + const filesToCheck = [ + path.join(repoRoot, "README.md"), + ...fs + .readdirSync(path.join(repoRoot, "docs")) + .filter((f) => f.endsWith(".md")) + .map((f) => path.join(repoRoot, "docs", f)), + ]; + + for (const filePath of filesToCheck) { + if (!fs.existsSync(filePath)) continue; + const content = fs.readFileSync(filePath, "utf8"); + const relDoc = path.relative(repoRoot, filePath); + const candidates = extractRepoPaths(content); + + for (const candidate of candidates) { + // Skip things that obviously aren't repo paths + if (!candidate || candidate.length < 3) continue; + // Skip paths that look like markdown-only links (heading anchors) + if (candidate.startsWith("#")) continue; + // For links relative to docs/, resolve relative to docs/ + let candidatePath; + if (relDoc.startsWith("docs/")) { + candidatePath = path.join(repoRoot, "docs", candidate); + // If not found there, try relative to repo root + if (!fs.existsSync(candidatePath)) { + candidatePath = path.join(repoRoot, candidate); + } + } else { + candidatePath = path.join(repoRoot, candidate); + } + + if (!fs.existsSync(candidatePath)) { + errors.push(`${relDoc}: broken repo path reference → ${candidate}`); + } + } + } + + return errors; +} + +// ── Main ─────────────────────────────────────────────────────────────────── + +async function main() { + const repoRoot = REPO_ROOT; + const allErrors = []; + const checks = [ + ["docs/README.md coverage", checkDocsIndexCoverage], + ["reviewer matrix consistency", checkReviewerMatrixConsistency], + ["Telegram agent coverage", checkTelegramAgentCoverage], + ["repo-relative path existence", checkRepoPathsExist], + ]; + + for (const [label, fn] of checks) { + const errors = await fn(repoRoot); + if (errors.length > 0) { + console.error(`\n[FAIL] ${label}:`); + for (const e of errors) { + console.error(` - ${e}`); + } + allErrors.push(...errors); + } else { + console.log(`[pass] ${label}`); + } + } + + if (allErrors.length > 0) { + console.error(`\ndocs-flow: ${allErrors.length} error(s) found.`); + process.exit(1); + } else { + console.log("\ndocs-flow: all checks passed."); + process.exit(0); + } +} + +// Run main only when executed directly (not when imported by tests) +const isMain = process.argv[1] === fileURLToPath(import.meta.url); +if (isMain) { + main().catch((err) => { + console.error(err); + process.exit(1); + }); +} diff --git a/scripts/verify-generated.mjs b/scripts/verify-generated.mjs new file mode 100644 index 0000000..b4a227a --- /dev/null +++ b/scripts/verify-generated.mjs @@ -0,0 +1,421 @@ +#!/usr/bin/env node +/** + * verify-generated.mjs — drift detector for generator-owned files (M3, S-306) + * + * Verifies that every declared generated root on disk matches the content that + * the generator would produce from the current canonical sources. + * + * Two verification modes: + * + * Production mode (default, no generatedRootsOverride): + * Calls generateSkills() into a temp directory and compares the freshly + * generated output file-by-file against the on-disk generated roots. + * Detects ALL forms of drift: + * (a) Direct edits to generated files + * (b) Canonical source changes without running `pnpm run sync:pi` + * (c) Stale files added to a generated root + * (d) Files deleted from a generated root + * + * Test mode (generatedRootsOverride set): + * Uses `.generated-manifest.json` as the oracle (manifest-based checks). + * Suitable for unit tests that use artificial generated-root fixtures + * without a full canonical source tree. + * + * Walk scope: only the declared generated roots returned by generate-skills.mjs. + * - `skills//_source/` and `skills//shared/` are NEVER walked. + * - `.generated-manifest.json` is excluded from content comparison. + * - `node_modules/` is always excluded. + * + * Exit codes: + * 0 — all generated roots match + * 1 — one or more mismatches detected + * + * Usage: + * node scripts/verify-generated.mjs + * pnpm run verify:generated + * + * Exported: + * verifyGenerated(repoRoot, options?) → Promise<{ok: boolean, errors: string[]}> + */ + +import crypto from "node:crypto"; +import { lstat, mkdtemp, readdir, readFile, rm } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { pathToFileURL } from "node:url"; + +import { buildManifest, generateSkills, getGeneratedRoots } from "./generate-skills.mjs"; + +const REPO_ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), ".."); +const MANIFEST_FILENAME = ".generated-manifest.json"; + +// ── Helpers ─────────────────────────────────────────────────────────────── + +async function sha256File(absPath) { + const buf = await readFile(absPath); + return crypto.createHash("sha256").update(buf).digest("hex"); +} + +async function pathExists(p) { + try { + await lstat(p); + return true; + } catch { + return false; + } +} + +/** + * Walk a directory and return all file relative paths (excluding node_modules + * and the manifest file itself, which is handled separately). + */ +async function walkRootFiles(rootDir) { + const results = []; + let entries; + try { + entries = await readdir(rootDir, { withFileTypes: true }); + } catch { + return results; + } + + for (const entry of entries) { + if (entry.name === "node_modules") continue; + if (entry.name === MANIFEST_FILENAME) continue; // manifest handled separately + + const full = path.join(rootDir, entry.name); + if (entry.isDirectory()) { + const sub = await walkSubDir(full, entry.name); + results.push(...sub); + } else if (entry.isFile()) { + results.push(entry.name); + } + } + return results; +} + +async function walkSubDir(dir, prefix) { + const results = []; + let entries; + try { + entries = await readdir(dir, { withFileTypes: true }); + } catch { + return results; + } + for (const entry of entries) { + if (entry.name === "node_modules") continue; + const relPath = `${prefix}/${entry.name}`; + const full = path.join(dir, entry.name); + if (entry.isDirectory()) { + const sub = await walkSubDir(full, relPath); + results.push(...sub); + } else if (entry.isFile()) { + results.push(relPath); + } + } + return results; +} + +/** + * Load and parse the .generated-manifest.json from a generated root. + * Returns null if missing or malformed. + */ +async function loadManifest(rootDir) { + const manifestPath = path.join(rootDir, MANIFEST_FILENAME); + try { + const raw = await readFile(manifestPath, "utf8"); + const obj = JSON.parse(raw); + // Structural validation: must have $schema and generator markers + if (!obj.$schema || !obj.generator || !Array.isArray(obj.files)) { + return null; + } + return obj; + } catch { + return null; + } +} + +/** + * Verify structural equality of two manifests (ignoring ephemeral fields). + * Returns array of difference descriptions, or empty array if equal. + */ +function diffManifests(expected, actual, rootRel) { + const diffs = []; + + if (expected.$schema !== actual.$schema) { + diffs.push(`${rootRel}/.generated-manifest.json: $schema mismatch`); + } + if (expected.generator !== actual.generator) { + diffs.push(`${rootRel}/.generated-manifest.json: generator mismatch`); + } + if (expected.generatedRoot !== actual.generatedRoot) { + diffs.push( + `${rootRel}/.generated-manifest.json: generatedRoot mismatch ` + + `(expected ${expected.generatedRoot}, got ${actual.generatedRoot})`, + ); + } + + // Compare files arrays structurally — paths, kind, mode, and sha256 + const expByPath = new Map(expected.files.map((f) => [f.path, f])); + const actByPath = new Map(actual.files.map((f) => [f.path, f])); + + for (const p of expByPath.keys()) { + if (!actByPath.has(p)) { + diffs.push(`${rootRel}/.generated-manifest.json: expected file entry missing: ${p}`); + } + } + for (const p of actByPath.keys()) { + if (!expByPath.has(p)) { + diffs.push(`${rootRel}/.generated-manifest.json: unexpected file entry: ${p}`); + } + } + + // For entries present in both, compare kind, mode, and sha256 + for (const [p, expEntry] of expByPath) { + const actEntry = actByPath.get(p); + if (!actEntry) continue; // missing already reported above + + if (expEntry.kind !== actEntry.kind) { + diffs.push( + `${rootRel}/.generated-manifest.json: ${p}: kind mismatch ` + + `(expected ${expEntry.kind}, got ${actEntry.kind})`, + ); + } + if (expEntry.mode !== actEntry.mode) { + diffs.push( + `${rootRel}/.generated-manifest.json: ${p}: mode mismatch ` + + `(expected ${expEntry.mode}, got ${actEntry.mode})`, + ); + } + if (expEntry.sha256 !== actEntry.sha256) { + diffs.push( + `${rootRel}/.generated-manifest.json: ${p}: sha256 mismatch ` + + `(expected ${expEntry.sha256.slice(0, 8)}…, got ${actEntry.sha256.slice(0, 8)}…)`, + ); + } + } + + return diffs; +} + +// ── Core verifier ───────────────────────────────────────────────────────── + +/** + * Verify all declared generated roots against freshly generated output. + * + * Calls generateSkills() into a temp directory and compares the resulting + * files to the on-disk roots. Detects all drift types: + * - Canonical source changed without running `pnpm run sync:pi` + * - Generated file edited directly + * - Stale file added to generated root + * - Generated file deleted from root + * + * Does NOT walk _source/, shared/, or node_modules/. + * + * @param {string} repoRoot - Absolute path to repo root. + * @param {string[]} rootsRelative - Generated root paths to verify. + * @param {string[]} errors - Error array to append to. + */ +async function verifyWithFreshGeneration(repoRoot, rootsRelative, errors) { + const tmpDir = await mkdtemp(path.join(tmpdir(), "verify-gen-")); + try { + await generateSkills(repoRoot, { targetRoot: tmpDir }); + + for (const rootRel of rootsRelative) { + const freshRootAbs = path.join(tmpDir, rootRel); + const onDiskRootAbs = path.join(repoRoot, rootRel); + + if (!(await pathExists(onDiskRootAbs))) { + errors.push(`generated root missing: ${rootRel}`); + continue; + } + + const freshFiles = await walkRootFiles(freshRootAbs); + const onDiskFiles = await walkRootFiles(onDiskRootAbs); + + const freshSet = new Set(freshFiles); + const diskSet = new Set(onDiskFiles); + + // Files the generator produces but are absent on disk + for (const f of freshFiles) { + if (!diskSet.has(f)) { + errors.push(`${rootRel}/${f}: missing (expected per canonical sources — run \`pnpm run sync:pi\`)`); + } + } + + // On-disk files the generator would NOT produce (stale) + for (const f of onDiskFiles) { + if (!freshSet.has(f)) { + errors.push(`${rootRel}/${f}: stale (not produced from canonical sources)`); + } + } + + // Content comparison for files present in both sets + for (const f of freshFiles) { + if (!diskSet.has(f)) continue; // missing already reported + const freshHash = await sha256File(path.join(freshRootAbs, f)); + const diskHash = await sha256File(path.join(onDiskRootAbs, f)); + if (freshHash !== diskHash) { + errors.push( + `${rootRel}/${f}: content drift ` + + `(on-disk sha256=${diskHash.slice(0, 8)}…, expected=${freshHash.slice(0, 8)}… — run \`pnpm run sync:pi\`)`, + ); + } + } + + // Validate .generated-manifest.json on disk matches what the generator produced + const freshManifestPath = path.join(freshRootAbs, MANIFEST_FILENAME); + const diskManifestPath = path.join(onDiskRootAbs, MANIFEST_FILENAME); + if (await pathExists(freshManifestPath)) { + if (!(await pathExists(diskManifestPath))) { + errors.push(`${rootRel}/${MANIFEST_FILENAME}: missing`); + } else { + const freshManifest = await loadManifest(freshRootAbs); + const diskManifest = await loadManifest(onDiskRootAbs); + if (!diskManifest) { + errors.push(`${rootRel}/${MANIFEST_FILENAME}: missing or malformed`); + } else if (freshManifest) { + const manifestDiffs = diffManifests(freshManifest, diskManifest, rootRel); + errors.push(...manifestDiffs); + } + } + } + } + } finally { + await rm(tmpDir, { recursive: true, force: true }); + } +} + +/** + * Verify using .generated-manifest.json as the oracle (test / no-canonical-sources mode). + * + * Used when generatedRootsOverride is set: the test fixture creates generated + * roots with manifests but does not provide a full canonical source tree. + * + * For each root: + * 1. Load the on-disk .generated-manifest.json (report missing manifest). + * 2. For every file listed in the manifest: verify existence, mode, sha256. + * 3. Walk the root for any files NOT listed in the manifest (stale files). + * 4. Verify the manifest's own structural fields match expected schema. + * + * @param {string} repoRoot - Absolute path to repo root. + * @param {string[]} rootsRelative - Generated root paths to verify. + * @param {string[]} errors - Error array to append to. + */ +async function verifyWithManifest(repoRoot, rootsRelative, errors) { + for (const rootRel of rootsRelative) { + const rootAbs = path.join(repoRoot, rootRel); + + // Check the root directory exists + if (!(await pathExists(rootAbs))) { + errors.push(`generated root missing: ${rootRel}`); + continue; + } + + // Load on-disk manifest + const manifest = await loadManifest(rootAbs); + if (!manifest) { + errors.push(`${rootRel}/.generated-manifest.json: missing or malformed`); + // Can't verify files without a manifest; report all on-disk files as stale + const onDisk = await walkRootFiles(rootAbs); + for (const f of onDisk) { + errors.push(`${rootRel}/${f}: stale (no valid manifest)`); + } + continue; + } + + // Build expected manifest from current disk state (structural check) + const expectedManifest = await buildManifest(rootAbs, rootRel); + const manifestDiffs = diffManifests(expectedManifest, manifest, rootRel); + errors.push(...manifestDiffs); + + // Build maps for file checks + const manifestByPath = new Map(manifest.files.map((f) => [f.path, f])); + + // Check each file listed in manifest + for (const entry of manifest.files) { + const fileAbs = path.join(rootAbs, entry.path); + + if (!(await pathExists(fileAbs))) { + errors.push(`${rootRel}/${entry.path}: missing (listed in manifest)`); + continue; + } + + // Check content hash + const actualHash = await sha256File(fileAbs); + if (actualHash !== entry.sha256) { + errors.push( + `${rootRel}/${entry.path}: content mismatch ` + + `(manifest sha256=${entry.sha256.slice(0, 8)}…, actual=${actualHash.slice(0, 8)}…)`, + ); + } + + // Check mode + const st = await lstat(fileAbs); + const actualMode = (st.mode & 0o777).toString(8).padStart(3, "0"); + if (actualMode !== entry.mode) { + errors.push( + `${rootRel}/${entry.path}: mode mismatch ` + + `(manifest=${entry.mode}, actual=${actualMode})`, + ); + } + } + + // Detect stale files: on-disk files not listed in manifest + const onDiskFiles = await walkRootFiles(rootAbs); + for (const relPath of onDiskFiles) { + if (!manifestByPath.has(relPath)) { + errors.push(`${rootRel}/${relPath}: stale (not in manifest)`); + } + } + } +} + +/** + * Verify all declared generated roots in a repo. + * + * In production mode (no generatedRootsOverride): generates into a temp + * directory and compares file-by-file against on-disk roots. This detects + * both direct edits to generated files AND changes to canonical sources that + * were not followed by `pnpm run sync:pi`. + * + * In test mode (generatedRootsOverride set): uses manifest-based checks. + * Suitable for unit tests that provide artificial generated-root fixtures + * without a full canonical source tree. + * + * @param {string} [repoRoot] - Absolute path to repo root. + * @param {object} [options] + * @param {string[]} [options.generatedRootsOverride] - Override root list (test mode only). + * @returns {Promise<{ok: boolean, errors: string[]}>} + */ +export async function verifyGenerated(repoRoot = REPO_ROOT, options = {}) { + const rootsRelative = options.generatedRootsOverride ?? getGeneratedRoots(); + const errors = []; + + if (options.generatedRootsOverride) { + // Test mode: no canonical source tree available — use manifest oracle + await verifyWithManifest(repoRoot, rootsRelative, errors); + } else { + // Production mode: generate fresh from canonical sources and compare + await verifyWithFreshGeneration(repoRoot, rootsRelative, errors); + } + + return { ok: errors.length === 0, errors }; +} + +// ── CLI entry point ──────────────────────────────────────────────────────── + +if (import.meta.url === pathToFileURL(process.argv[1]).href) { + const result = await verifyGenerated(REPO_ROOT); + + if (result.ok) { + console.log("verify:generated: all generated roots are up to date."); + process.exit(0); + } else { + console.error("verify:generated: drift detected:\n"); + for (const err of result.errors) { + console.error(` ✗ ${err}`); + } + console.error(`\n${result.errors.length} error(s). Run \`pnpm run sync:pi\` to regenerate.`); + process.exit(1); + } +} diff --git a/scripts/verify-pi-resources.sh b/scripts/verify-pi-resources.sh index a0dd42a..28b6f63 100755 --- a/scripts/verify-pi-resources.sh +++ b/scripts/verify-pi-resources.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash set -euo pipefail +# shellcheck source=lib/portable.sh +source "$(dirname "${BASH_SOURCE[0]}")/lib/portable.sh" + REQUIRED_FILES=( "docs/PI-RESEARCH.md" "docs/PI.md" @@ -18,7 +21,6 @@ REQUIRED_FILES=( "skills/reviewer-runtime/pi/run-review.sh" "skills/reviewer-runtime/pi/notify-telegram.sh" "scripts/install-pi-package.sh" - "scripts/sync-pi-package-skills.sh" "pi-package/skills/atlassian/SKILL.md" "pi-package/skills/create-plan/SKILL.md" "pi-package/skills/do-task/SKILL.md" @@ -36,13 +38,13 @@ done test -x skills/reviewer-runtime/pi/run-review.sh test -x skills/reviewer-runtime/pi/notify-telegram.sh test -x scripts/install-pi-package.sh -test -x scripts/sync-pi-package-skills.sh find skills/web-automation/pi/scripts -type f -print -quit | grep -q . find skills/atlassian/pi/scripts -type f -print -quit | grep -q . for file in skills/create-plan/pi/SKILL.md skills/do-task/pi/SKILL.md skills/implement-plan/pi/SKILL.md; do grep -q 'docs/PI-SUPERPOWERS.md' "$file" grep -q 'docs/PI-COMMON-REVIEWER.md' "$file" + # shellcheck disable=SC2016 grep -q 'Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`' "$file" grep -q 'pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files' "$file" grep -q -- '--tools read,grep,find,ls -p' "$file" @@ -51,11 +53,13 @@ done grep -q 'reviewer model is configured independently' docs/PI-COMMON-REVIEWER.md grep -q 'provider-qualified model IDs' docs/PI-COMMON-REVIEWER.md +# shellcheck disable=SC2016 grep -q 'MUST NOT include `write`, `edit`, or `bash`' docs/PI-COMMON-REVIEWER.md grep -q 'Reviewer CLI | codex \\| claude \\| cursor \\| opencode \\| pi' skills/do-task/pi/templates/task-plan.md grep -q 'pi-package/skills/atlassian/scripts' skills/atlassian/pi/SKILL.md grep -q 'pi-package/skills/web-automation/scripts' skills/web-automation/pi/SKILL.md +# shellcheck disable=SC2016 grep -q 'local checkout package install keeps the runtime in `pi-package/skills//scripts`' docs/PI.md grep -q 'install-pi-package.sh --global' docs/PI.md @@ -78,22 +82,28 @@ for family in atlassian create-plan do-task implement-plan web-automation; do diff -qr \ --exclude '.DS_Store' \ --exclude 'node_modules' \ + --exclude '.generated-manifest.json' \ + --exclude 'package.json' \ "$source_dir" "$mirror_dir" >/dev/null while IFS= read -r -d '' source_path; do rel_path=${source_path#"$source_dir"/} mirror_path="${mirror_dir}/${rel_path}" test -e "$mirror_path" - test "$(stat -f '%Lp' "$source_path")" = "$(stat -f '%Lp' "$mirror_path")" + test "$(portable_stat_perms "$source_path")" = "$(portable_stat_perms "$mirror_path")" done < <(find "$source_dir" \ \( -name '.DS_Store' -o -name 'node_modules' \) -prune -o \ -mindepth 1 -print0) done -! grep -nE 'update_plan|plan mode|sub-agent|subagents' \ +# SC2251: restructured to avoid ! outside condition +if grep -nE 'update_plan|plan mode|sub-agent|subagents' \ skills/create-plan/pi/SKILL.md \ skills/do-task/pi/SKILL.md \ - skills/implement-plan/pi/SKILL.md + skills/implement-plan/pi/SKILL.md; then + echo "Error: pi SKILL.md files must not contain Codex-specific terms" >&2 + exit 1 +fi node <<'EOF' const fs = require("fs"); @@ -126,7 +136,7 @@ for (const requiredFile of [ "pi-package/skills", "docs/PI-COMMON-REVIEWER.md", "scripts/install-pi-package.sh", - "scripts/sync-pi-package-skills.sh", + "scripts/generate-skills.mjs", ]) { if (!pkg.files.includes(requiredFile)) { console.error(`package.json files must include ${requiredFile}`); diff --git a/scripts/verify-pi-workflows.sh b/scripts/verify-pi-workflows.sh index 5e90488..5274db9 100755 --- a/scripts/verify-pi-workflows.sh +++ b/scripts/verify-pi-workflows.sh @@ -13,6 +13,7 @@ WORKFLOW_FILES=( for file in "${WORKFLOW_FILES[@]}"; do test -f "$file" grep -q 'docs/PI-SUPERPOWERS.md' "$file" + # shellcheck disable=SC2016 grep -q 'Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`' "$file" grep -q 'pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files' "$file" grep -q -- '--tools read,grep,find,ls -p' "$file" @@ -21,6 +22,7 @@ done grep -q 'reviewer model is configured independently' docs/PI-COMMON-REVIEWER.md grep -q 'provider-qualified model IDs' docs/PI-COMMON-REVIEWER.md +# shellcheck disable=SC2016 grep -q 'MUST NOT include `write`, `edit`, or `bash`' docs/PI-COMMON-REVIEWER.md if command -v pi >/dev/null 2>&1; then @@ -43,6 +45,10 @@ grep -q 'Reviewer CLI | codex \\| claude \\| cursor \\| opencode \\| pi' skills/ test -x skills/reviewer-runtime/pi/run-review.sh test -x skills/reviewer-runtime/pi/notify-telegram.sh -! rg -n 'update_plan|plan mode|sub-agent|subagents' "${WORKFLOW_FILES[@]}" +# SC2251: restructured to avoid ! outside condition +if rg -n 'update_plan|plan mode|sub-agent|subagents' "${WORKFLOW_FILES[@]}"; then + echo "Error: pi workflow SKILL.md files must not contain Codex-specific terms" >&2 + exit 1 +fi echo "pi workflow skill docs verified" diff --git a/skills/.markdownlint.jsonc b/skills/.markdownlint.jsonc new file mode 100644 index 0000000..3cc3f63 --- /dev/null +++ b/skills/.markdownlint.jsonc @@ -0,0 +1,20 @@ +// markdownlint configuration — skills/ (M2) +// +// Agent-facing SKILL.md files and plan templates contain verbose prose and +// long shell commands where a strict line-length limit is counterproductive. +// This file inherits the root config and then overrides the two rules that +// produce false positives in agent-facing content. +{ + // Inherit root-level rules + "extends": "../.markdownlint.jsonc", + + // MD013 — line length: disabled for skill files. + // Shell commands, long option lists, and URL references commonly exceed 120 + // chars and wrapping them would break copy-paste usability. + "MD013": false, + + // MD024 — duplicate headings: disabled for skill files. + // SKILL.md files intentionally use repeated per-agent section headings + // (e.g. "### Claude Code", "### Codex") in separate variant sections. + "MD024": false +} diff --git a/skills/atlassian/_source/claude-code/SKILL.md b/skills/atlassian/_source/claude-code/SKILL.md new file mode 100644 index 0000000..c7708d8 --- /dev/null +++ b/skills/atlassian/_source/claude-code/SKILL.md @@ -0,0 +1,78 @@ +--- +name: atlassian +description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. +--- + +# Atlassian (Claude Code) + +Portable Atlassian workflows for Claude Code using a shared TypeScript CLI. + +## Requirements + +- Node.js 20+ +- `pnpm` +- Atlassian Cloud account access +- `ATLASSIAN_BASE_URL` +- `ATLASSIAN_EMAIL` +- `ATLASSIAN_API_TOKEN` + +The `ATLASSIAN_*` values may come from the shell environment or a `.env` file in `~/.claude/skills/atlassian/scripts`. + +## First-Time Setup + +```bash +mkdir -p ~/.claude/skills/atlassian +cp -R skills/atlassian/claude-code/* ~/.claude/skills/atlassian/ +cd ~/.claude/skills/atlassian/scripts +pnpm install +``` + +## Prerequisite Check (MANDATORY) + +```bash +cd ~/.claude/skills/atlassian/scripts +node -e "require.resolve('commander');require.resolve('dotenv');console.log('OK: runtime dependencies installed')" +node -e 'require("dotenv").config({ path: ".env" }); const required = ["ATLASSIAN_BASE_URL", "ATLASSIAN_EMAIL", "ATLASSIAN_API_TOKEN"]; const missing = required.filter((key) => !(process.env[key] || "").trim()); if (missing.length) { console.error("Missing required Atlassian config: " + missing.join(", ")); process.exit(1); } console.log("OK: Atlassian config present")' +pnpm atlassian health +``` + +If any check fails, stop and return: + +`Missing dependency/config: atlassian requires installed CLI dependencies and valid Atlassian Cloud credentials. Configure ATLASSIAN_* in the shell environment or scripts/.env, then retry.` + +## Supported Commands + +- `pnpm atlassian health` +- `pnpm atlassian jira-search --jql "..."` +- `pnpm atlassian jira-get --issue ABC-123` +- `pnpm atlassian jira-create ... [--dry-run]` +- `pnpm atlassian jira-update ... [--dry-run]` +- `pnpm atlassian jira-comment ... [--dry-run]` +- `pnpm atlassian jira-transitions --issue ABC-123` +- `pnpm atlassian jira-transition ... [--dry-run]` +- `pnpm atlassian conf-search --query "..."` +- `pnpm atlassian conf-get --page 12345` +- `pnpm atlassian conf-create ... [--dry-run]` +- `pnpm atlassian conf-update ... [--dry-run]` +- `pnpm atlassian conf-comment ... [--dry-run]` +- `pnpm atlassian conf-children --page 12345` +- `pnpm atlassian raw --product jira|confluence --method GET|POST|PUT --path ...` + +## Usage Examples + +- `pnpm atlassian jira-search --jql "project = ENG ORDER BY updated DESC" --max-results 10` +- `pnpm atlassian conf-comment --page 12345 --body-file comment.storage.html --dry-run` +- `pnpm atlassian raw --product jira --method GET --path "/rest/api/3/issue/ENG-123"` + +## Safety Rules + +- Default output is JSON; only switch to text output when the user needs a human-readable summary. +- Use `--dry-run` before any write unless the user clearly asked for the mutation. +- Treat `raw` as an escape hatch, not the default API surface. +- `--body-file` must stay inside the current workspace. +- Confluence write bodies should be storage-format inputs in v1. + +## Notes + +- Atlassian Cloud is the primary supported platform in v1. +- The portable CLI exists so the same skill works consistently across multiple agent environments. diff --git a/skills/atlassian/_source/codex/SKILL.md b/skills/atlassian/_source/codex/SKILL.md new file mode 100644 index 0000000..e955654 --- /dev/null +++ b/skills/atlassian/_source/codex/SKILL.md @@ -0,0 +1,81 @@ +--- +name: atlassian +description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. +--- + +# Atlassian (Codex) + +Portable Atlassian workflows for Codex using a shared TypeScript CLI. + +## Requirements + +- Node.js 20+ +- `pnpm` +- Atlassian Cloud account access +- `ATLASSIAN_BASE_URL` +- `ATLASSIAN_EMAIL` +- `ATLASSIAN_API_TOKEN` + +The `ATLASSIAN_*` values may come from the shell environment or a `.env` file in `~/.codex/skills/atlassian/scripts`. + +## First-Time Setup + +```bash +mkdir -p ~/.codex/skills/atlassian +cp -R skills/atlassian/codex/* ~/.codex/skills/atlassian/ +cd ~/.codex/skills/atlassian/scripts +pnpm install +``` + +## Prerequisite Check (MANDATORY) + +Run before using the skill: + +```bash +cd ~/.codex/skills/atlassian/scripts +node -e "require.resolve('commander');require.resolve('dotenv');console.log('OK: runtime dependencies installed')" +node -e 'require("dotenv").config({ path: ".env" }); const required = ["ATLASSIAN_BASE_URL", "ATLASSIAN_EMAIL", "ATLASSIAN_API_TOKEN"]; const missing = required.filter((key) => !(process.env[key] || "").trim()); if (missing.length) { console.error("Missing required Atlassian config: " + missing.join(", ")); process.exit(1); } console.log("OK: Atlassian config present")' +pnpm atlassian health +``` + +If any check fails, stop and return: + +`Missing dependency/config: atlassian requires installed CLI dependencies and valid Atlassian Cloud credentials. Configure ATLASSIAN_* in the shell environment or scripts/.env, then retry.` + +## Supported Commands + +- `pnpm atlassian health` +- `pnpm atlassian jira-search --jql "..."` +- `pnpm atlassian jira-get --issue ABC-123` +- `pnpm atlassian jira-create ... [--dry-run]` +- `pnpm atlassian jira-update ... [--dry-run]` +- `pnpm atlassian jira-comment ... [--dry-run]` +- `pnpm atlassian jira-transitions --issue ABC-123` +- `pnpm atlassian jira-transition ... [--dry-run]` +- `pnpm atlassian conf-search --query "..."` +- `pnpm atlassian conf-get --page 12345` +- `pnpm atlassian conf-create ... [--dry-run]` +- `pnpm atlassian conf-update ... [--dry-run]` +- `pnpm atlassian conf-comment ... [--dry-run]` +- `pnpm atlassian conf-children --page 12345` +- `pnpm atlassian raw --product jira|confluence --method GET|POST|PUT --path ...` + +## Usage Examples + +- `pnpm atlassian jira-search --jql "project = ENG ORDER BY updated DESC" --max-results 10` +- `pnpm atlassian conf-update --page 12345 --title "Runbook" --body-file page.storage.html --dry-run` +- `pnpm atlassian raw --product confluence --method POST --path "/wiki/api/v2/pages" --body-file page.json --dry-run` + +## Safety Rules + +- Default output is JSON; prefer that for agent workflows. +- Use `--dry-run` before any mutating command unless the user clearly wants the write to happen immediately. +- Jira long-text fields are converted to ADF locally. +- Confluence page bodies are storage-first in v1. +- `--body-file` must point to workspace-scoped files only; do not use arbitrary system paths. +- `raw` is for explicit edge cases only and does not allow `DELETE`. + +## Notes + +- Atlassian Cloud is the only first-class target in v1. +- This skill exists so Codex, Claude Code, Cursor Agent, and OpenCode can share the same command surface even when MCP access differs. diff --git a/skills/atlassian/_source/cursor/SKILL.md b/skills/atlassian/_source/cursor/SKILL.md new file mode 100644 index 0000000..91cfb1c --- /dev/null +++ b/skills/atlassian/_source/cursor/SKILL.md @@ -0,0 +1,93 @@ +--- +name: atlassian +description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. +--- + +# Atlassian (Cursor Agent CLI) + +Portable Atlassian workflows for Cursor Agent CLI using a shared TypeScript CLI. + +## Requirements + +- Cursor Agent CLI skill discovery via `.cursor/skills/` or `~/.cursor/skills/` +- Node.js 20+ +- `pnpm` +- Atlassian Cloud account access +- `ATLASSIAN_BASE_URL` +- `ATLASSIAN_EMAIL` +- `ATLASSIAN_API_TOKEN` + +The `ATLASSIAN_*` values may come from the shell environment or a `.env` file in the installed `scripts/` folder. + +## First-Time Setup + +Repo-local install: + +```bash +mkdir -p .cursor/skills/atlassian +cp -R skills/atlassian/cursor/* .cursor/skills/atlassian/ +cd .cursor/skills/atlassian/scripts +pnpm install +``` + +Global install: + +```bash +mkdir -p ~/.cursor/skills/atlassian +cp -R skills/atlassian/cursor/* ~/.cursor/skills/atlassian/ +cd ~/.cursor/skills/atlassian/scripts +pnpm install +``` + +## Prerequisite Check (MANDATORY) + +Repo-local form: + +```bash +cursor-agent --version +cd .cursor/skills/atlassian/scripts +node -e "require.resolve('commander');require.resolve('dotenv');console.log('OK: runtime dependencies installed')" +node -e 'require("dotenv").config({ path: ".env" }); const required = ["ATLASSIAN_BASE_URL", "ATLASSIAN_EMAIL", "ATLASSIAN_API_TOKEN"]; const missing = required.filter((key) => !(process.env[key] || "").trim()); if (missing.length) { console.error("Missing required Atlassian config: " + missing.join(", ")); process.exit(1); } console.log("OK: Atlassian config present")' +pnpm atlassian health +``` + +If any check fails, stop and return: + +`Missing dependency/config: atlassian requires installed CLI dependencies and valid Atlassian Cloud credentials. Configure ATLASSIAN_* in the shell environment or scripts/.env, then retry.` + +## Supported Commands + +- `pnpm atlassian health` +- `pnpm atlassian jira-search --jql "..."` +- `pnpm atlassian jira-get --issue ABC-123` +- `pnpm atlassian jira-create ... [--dry-run]` +- `pnpm atlassian jira-update ... [--dry-run]` +- `pnpm atlassian jira-comment ... [--dry-run]` +- `pnpm atlassian jira-transitions --issue ABC-123` +- `pnpm atlassian jira-transition ... [--dry-run]` +- `pnpm atlassian conf-search --query "..."` +- `pnpm atlassian conf-get --page 12345` +- `pnpm atlassian conf-create ... [--dry-run]` +- `pnpm atlassian conf-update ... [--dry-run]` +- `pnpm atlassian conf-comment ... [--dry-run]` +- `pnpm atlassian conf-children --page 12345` +- `pnpm atlassian raw --product jira|confluence --method GET|POST|PUT --path ...` + +## Usage Examples + +- `pnpm atlassian jira-get --issue ENG-123` +- `pnpm atlassian conf-search --query "title ~ \\\"Runbook\\\"" --max-results 10 --start-at 0` +- `pnpm atlassian raw --product confluence --method POST --path "/wiki/api/v2/pages" --body-file page.json --dry-run` + +## Safety Rules + +- Prefer JSON output for agent use. +- Use `--dry-run` before writes unless the user explicitly wants the change applied. +- Keep `--body-file` inputs within the current workspace. +- Use `raw` only for user-requested unsupported endpoints. +- `raw` does not allow `DELETE`. + +## Notes + +- Cursor discovers this skill from `.cursor/skills/` or `~/.cursor/skills/`. +- Atlassian Cloud is the supported platform in v1. diff --git a/skills/atlassian/_source/opencode/SKILL.md b/skills/atlassian/_source/opencode/SKILL.md new file mode 100644 index 0000000..5fb17ab --- /dev/null +++ b/skills/atlassian/_source/opencode/SKILL.md @@ -0,0 +1,78 @@ +--- +name: atlassian +description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. +--- + +# Atlassian (OpenCode) + +Portable Atlassian workflows for OpenCode using a shared TypeScript CLI. + +## Requirements + +- Node.js 20+ +- `pnpm` +- Atlassian Cloud account access +- `ATLASSIAN_BASE_URL` +- `ATLASSIAN_EMAIL` +- `ATLASSIAN_API_TOKEN` + +The `ATLASSIAN_*` values may come from the shell environment or a `.env` file in `~/.config/opencode/skills/atlassian/scripts`. + +## First-Time Setup + +```bash +mkdir -p ~/.config/opencode/skills/atlassian +cp -R skills/atlassian/opencode/* ~/.config/opencode/skills/atlassian/ +cd ~/.config/opencode/skills/atlassian/scripts +pnpm install +``` + +## Prerequisite Check (MANDATORY) + +```bash +cd ~/.config/opencode/skills/atlassian/scripts +node -e "require.resolve('commander');require.resolve('dotenv');console.log('OK: runtime dependencies installed')" +node -e 'require("dotenv").config({ path: ".env" }); const required = ["ATLASSIAN_BASE_URL", "ATLASSIAN_EMAIL", "ATLASSIAN_API_TOKEN"]; const missing = required.filter((key) => !(process.env[key] || "").trim()); if (missing.length) { console.error("Missing required Atlassian config: " + missing.join(", ")); process.exit(1); } console.log("OK: Atlassian config present")' +pnpm atlassian health +``` + +If any check fails, stop and return: + +`Missing dependency/config: atlassian requires installed CLI dependencies and valid Atlassian Cloud credentials. Configure ATLASSIAN_* in the shell environment or scripts/.env, then retry.` + +## Supported Commands + +- `pnpm atlassian health` +- `pnpm atlassian jira-search --jql "..."` +- `pnpm atlassian jira-get --issue ABC-123` +- `pnpm atlassian jira-create ... [--dry-run]` +- `pnpm atlassian jira-update ... [--dry-run]` +- `pnpm atlassian jira-comment ... [--dry-run]` +- `pnpm atlassian jira-transitions --issue ABC-123` +- `pnpm atlassian jira-transition ... [--dry-run]` +- `pnpm atlassian conf-search --query "..."` +- `pnpm atlassian conf-get --page 12345` +- `pnpm atlassian conf-create ... [--dry-run]` +- `pnpm atlassian conf-update ... [--dry-run]` +- `pnpm atlassian conf-comment ... [--dry-run]` +- `pnpm atlassian conf-children --page 12345` +- `pnpm atlassian raw --product jira|confluence --method GET|POST|PUT --path ...` + +## Usage Examples + +- `pnpm atlassian jira-transition --issue ENG-123 --transition 31 --dry-run` +- `pnpm atlassian conf-create --space OPS --title "Runbook" --body-file page.storage.html --dry-run` +- `pnpm atlassian raw --product jira --method GET --path "/rest/api/3/issue/ENG-123"` + +## Safety Rules + +- Prefer JSON output for machine consumption. +- Use `--dry-run` on writes unless the user explicitly asks to commit the remote mutation. +- Restrict `--body-file` to project files. +- Use `raw` only for unsupported edge cases. +- `DELETE` is intentionally unsupported in raw mode. + +## Notes + +- Atlassian Cloud is first-class in v1; Data Center support is future work. +- The CLI contract is shared across all agent variants so the same usage pattern works everywhere. diff --git a/skills/atlassian/_source/pi/SKILL.md b/skills/atlassian/_source/pi/SKILL.md new file mode 100644 index 0000000..10d3507 --- /dev/null +++ b/skills/atlassian/_source/pi/SKILL.md @@ -0,0 +1,99 @@ +--- +name: atlassian +description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. +--- + +# Atlassian (Pi) + +Portable Atlassian workflows for pi using the shared TypeScript CLI in `scripts/`. + +## Requirements + +- Node.js 20+ +- `pnpm` +- Atlassian Cloud account access +- `ATLASSIAN_BASE_URL` +- `ATLASSIAN_EMAIL` +- `ATLASSIAN_API_TOKEN` + +The `ATLASSIAN_*` values may come from the shell environment or a `.env` file in the installed skill's `scripts/` directory. + +## First-Time Setup + +Global install: + +```bash +mkdir -p ~/.pi/agent/skills/atlassian +cp -R skills/atlassian/pi/* ~/.pi/agent/skills/atlassian/ +cd ~/.pi/agent/skills/atlassian/scripts +pnpm install +``` + +Project-local install: + +```bash +mkdir -p .pi/skills/atlassian +cp -R skills/atlassian/pi/* .pi/skills/atlassian/ +cd .pi/skills/atlassian/scripts +pnpm install +``` + +Pi can also load this repo through settings or package installs as documented in [docs/PI.md](../../../docs/PI.md). + +If you installed this repo from a local checkout with `./scripts/install-pi-package.sh`, the runtime stays in the checkout mirror at `pi-package/skills/atlassian/scripts`. + +## Prerequisite Check (MANDATORY) + +Run inside the skill runtime directory that matches your install style: + +- local checkout package install: `pi-package/skills/atlassian/scripts` +- project-local copied install: `.pi/skills/atlassian/scripts` +- global copied install: `~/.pi/agent/skills/atlassian/scripts` + +```bash +cd pi-package/skills/atlassian/scripts +node -e "require.resolve('commander');require.resolve('dotenv');console.log('OK: runtime dependencies installed')" +node -e 'require("dotenv").config({ path: ".env" }); const required = ["ATLASSIAN_BASE_URL", "ATLASSIAN_EMAIL", "ATLASSIAN_API_TOKEN"]; const missing = required.filter((key) => !(process.env[key] || "").trim()); if (missing.length) { console.error("Missing required Atlassian config: " + missing.join(", ")); process.exit(1); } console.log("OK: Atlassian config present")' +pnpm atlassian health +``` + +If any check fails, stop and return: + +`Missing dependency/config: atlassian requires installed CLI dependencies and valid Atlassian Cloud credentials. Configure ATLASSIAN_* in the shell environment or scripts/.env, then retry.` + +## Supported Commands + +- `pnpm atlassian health` +- `pnpm atlassian jira-search --jql "..."` +- `pnpm atlassian jira-get --issue ABC-123` +- `pnpm atlassian jira-create ... [--dry-run]` +- `pnpm atlassian jira-update ... [--dry-run]` +- `pnpm atlassian jira-comment ... [--dry-run]` +- `pnpm atlassian jira-transitions --issue ABC-123` +- `pnpm atlassian jira-transition ... [--dry-run]` +- `pnpm atlassian conf-search --query "..."` +- `pnpm atlassian conf-get --page 12345` +- `pnpm atlassian conf-create ... [--dry-run]` +- `pnpm atlassian conf-update ... [--dry-run]` +- `pnpm atlassian conf-comment ... [--dry-run]` +- `pnpm atlassian conf-children --page 12345` +- `pnpm atlassian raw --product jira|confluence --method GET|POST|PUT --path ...` + +## Usage Examples + +- `pnpm atlassian jira-search --jql "project = ENG ORDER BY updated DESC" --max-results 10` +- `pnpm atlassian conf-comment --page 12345 --body-file comment.storage.html --dry-run` +- `pnpm atlassian raw --product jira --method GET --path "/rest/api/3/issue/ENG-123"` + +## Safety Rules + +- Default output is JSON; prefer that for agent workflows. +- Use `--dry-run` before any mutating command unless the user clearly wants the write to happen immediately. +- `raw` is for explicit edge cases only and does not allow `DELETE`. +- `--body-file` must stay inside the current workspace. +- Confluence write bodies should be storage-format inputs in v1. + +## Notes + +- Atlassian Cloud is the primary supported platform in v1. +- Package installs use the repo's `pi-package/skills/atlassian/` mirror so the installed skill directory name matches `atlassian`. diff --git a/skills/atlassian/claude-code/.generated-manifest.json b/skills/atlassian/claude-code/.generated-manifest.json new file mode 100644 index 0000000..8c56602 --- /dev/null +++ b/skills/atlassian/claude-code/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/atlassian/claude-code", + "files": [ + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "4030a6965cd5b29674beedd2b5b1bce08b9bd8a7304dfc22d68ca9c0cdd0f6a3" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "15556a6f53e68bb8d92d2710aae0836bc80af7f29be9d63aa1b87fcbd33732c6" + }, + { + "path": "scripts/src/adf.ts", + "kind": "file", + "mode": "644", + "sha256": "c7c3b4a78ccd8fb5a8ab99c82e0eab67a0a0d656b3985c1f56817bda199ad20f" + }, + { + "path": "scripts/src/cli.ts", + "kind": "file", + "mode": "644", + "sha256": "90dcc029adf0625b86c5eec44c5c1fd11bbf95ffe1185016d139c8a6982d54ff" + }, + { + "path": "scripts/src/command-helpers.ts", + "kind": "file", + "mode": "644", + "sha256": "aa03d8d288c8c00485ea10d3b3a60804c1b9ee23ef265004e7912f3242dbcee7" + }, + { + "path": "scripts/src/config.ts", + "kind": "file", + "mode": "644", + "sha256": "700dcdce96afab5294426e09f539135ae5432632370260190d6292071422eb3f" + }, + { + "path": "scripts/src/confluence.ts", + "kind": "file", + "mode": "644", + "sha256": "28f65f280cd9b6119ce7eab583d0083231525ad6dc04b73389cb5dcbab5bf095" + }, + { + "path": "scripts/src/files.ts", + "kind": "file", + "mode": "644", + "sha256": "16296eaa3ae41a4d7c694773036f9bb4bd2baa2db6a9c318078532b713678dba" + }, + { + "path": "scripts/src/health.ts", + "kind": "file", + "mode": "644", + "sha256": "1db4b49e05b16a095b7e7ca31cdc4e22ebda19e20e05c40baaaac648eaec0d08" + }, + { + "path": "scripts/src/http.ts", + "kind": "file", + "mode": "644", + "sha256": "66444b777d4d9b14d9793eb051c586eb811d2b36815b1018dd9d7517666c7eb2" + }, + { + "path": "scripts/src/jira.ts", + "kind": "file", + "mode": "644", + "sha256": "bec0e81a0424dd412c36988cef42c01a95f044ee8346ba626e7eb8bd79379f07" + }, + { + "path": "scripts/src/output.ts", + "kind": "file", + "mode": "644", + "sha256": "38e99818582a4962c09a83175634cba2bfead6acf33bd5f43cdca5caed7100a0" + }, + { + "path": "scripts/src/raw.ts", + "kind": "file", + "mode": "644", + "sha256": "48fd54bd0cdb421badb58f9be2933a039fe3b9350bbe6191070c9f7bb0054670" + }, + { + "path": "scripts/src/types.ts", + "kind": "file", + "mode": "644", + "sha256": "9f92d27ab68604d5abfd0f5dc9552b96fed6d1f9fc7dc6eb30190d8b617628bf" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "3c2eb7ba5c95a16cada153de4787ca7a4bf179609bf3848e12ff15b1b7927a68" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "96b660983b82a4060d5e3d91f916aa683f584a7b26f74c3145b3e23994030b71" + } + ] +} diff --git a/skills/atlassian/claude-code/SKILL.md b/skills/atlassian/claude-code/SKILL.md index c7708d8..aad2a68 100644 --- a/skills/atlassian/claude-code/SKILL.md +++ b/skills/atlassian/claude-code/SKILL.md @@ -3,6 +3,8 @@ name: atlassian description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. --- + + # Atlassian (Claude Code) Portable Atlassian workflows for Claude Code using a shared TypeScript CLI. diff --git a/skills/atlassian/claude-code/scripts/package.json b/skills/atlassian/claude-code/scripts/package.json index a9d8adc..97d4dba 100644 --- a/skills/atlassian/claude-code/scripts/package.json +++ b/skills/atlassian/claude-code/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "atlassian-skill-scripts", + "name": "@ai-coding-skills/atlassian-claude-code", "version": "1.0.0", "description": "Shared runtime for the Atlassian skill", "type": "module", @@ -16,5 +16,6 @@ "tsx": "^4.20.5", "typescript": "^5.9.2" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/atlassian/claude-code/scripts/src/adf.ts b/skills/atlassian/claude-code/scripts/src/adf.ts index 638914c..8774bd1 100644 --- a/skills/atlassian/claude-code/scripts/src/adf.ts +++ b/skills/atlassian/claude-code/scripts/src/adf.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. const TEXT_NODE = "text"; function textNode(text: string) { diff --git a/skills/atlassian/claude-code/scripts/src/cli.ts b/skills/atlassian/claude-code/scripts/src/cli.ts index 6012b99..a4f4fd0 100644 --- a/skills/atlassian/claude-code/scripts/src/cli.ts +++ b/skills/atlassian/claude-code/scripts/src/cli.ts @@ -1,8 +1,10 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import process from "node:process"; import { pathToFileURL } from "node:url"; import { Command } from "commander"; +import { resolveFormat } from "./command-helpers.js"; import { createConfluenceClient } from "./confluence.js"; import { loadConfig } from "./config.js"; import { readWorkspaceFile } from "./files.js"; @@ -10,7 +12,7 @@ import { runHealthCheck } from "./health.js"; import { createJiraClient } from "./jira.js"; import { writeOutput } from "./output.js"; import { runRawCommand } from "./raw.js"; -import type { FetchLike, OutputFormat, Writer } from "./types.js"; +import type { FetchLike, Writer } from "./types.js"; type CliContext = { cwd?: string; @@ -20,10 +22,6 @@ type CliContext = { stderr?: Writer; }; -function resolveFormat(format: string | undefined): OutputFormat { - return format === "text" ? "text" : "json"; -} - function createRuntime(context: CliContext) { const cwd = context.cwd ?? process.cwd(); const env = context.env ?? process.env; diff --git a/skills/atlassian/claude-code/scripts/src/command-helpers.ts b/skills/atlassian/claude-code/scripts/src/command-helpers.ts new file mode 100644 index 0000000..9ceca7c --- /dev/null +++ b/skills/atlassian/claude-code/scripts/src/command-helpers.ts @@ -0,0 +1,25 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import type { CommandOutput, OutputFormat } from "./types.js"; + +/** + * Produce the standard dry-run response payload for write operations. + * + * Use this when `--dry-run` is passed to skip the actual API call and + * echo the pending request back to the caller. + * + * @example + * if (input.dryRun) return dryRunResponse(request); + */ +export function dryRunResponse(data: T): CommandOutput { + return { ok: true, dryRun: true, data }; +} + +/** + * Resolve the `--format` CLI option to a typed OutputFormat. + * + * Returns `"text"` only for the exact string `"text"`; + * all other values (including `undefined`) fall back to `"json"`. + */ +export function resolveFormat(format: string | undefined): OutputFormat { + return format === "text" ? "text" : "json"; +} diff --git a/skills/atlassian/claude-code/scripts/src/config.ts b/skills/atlassian/claude-code/scripts/src/config.ts index eb34a39..58d37cc 100644 --- a/skills/atlassian/claude-code/scripts/src/config.ts +++ b/skills/atlassian/claude-code/scripts/src/config.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import path from "node:path"; import { config as loadDotEnv } from "dotenv"; diff --git a/skills/atlassian/claude-code/scripts/src/confluence.ts b/skills/atlassian/claude-code/scripts/src/confluence.ts index f22d66d..6ac333d 100644 --- a/skills/atlassian/claude-code/scripts/src/confluence.ts +++ b/skills/atlassian/claude-code/scripts/src/confluence.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -177,13 +179,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -223,13 +219,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -266,13 +256,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, diff --git a/skills/atlassian/claude-code/scripts/src/files.ts b/skills/atlassian/claude-code/scripts/src/files.ts index 8339109..cd7ed39 100644 --- a/skills/atlassian/claude-code/scripts/src/files.ts +++ b/skills/atlassian/claude-code/scripts/src/files.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { readFile } from "node:fs/promises"; import path from "node:path"; diff --git a/skills/atlassian/claude-code/scripts/src/health.ts b/skills/atlassian/claude-code/scripts/src/health.ts index b2d4d24..5946887 100644 --- a/skills/atlassian/claude-code/scripts/src/health.ts +++ b/skills/atlassian/claude-code/scripts/src/health.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createJsonHeaders, createStatusError } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; diff --git a/skills/atlassian/claude-code/scripts/src/http.ts b/skills/atlassian/claude-code/scripts/src/http.ts index 5791886..1184cd1 100644 --- a/skills/atlassian/claude-code/scripts/src/http.ts +++ b/skills/atlassian/claude-code/scripts/src/http.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createBasicAuthHeader } from "./config.js"; import type { AtlassianConfig, FetchLike } from "./types.js"; diff --git a/skills/atlassian/claude-code/scripts/src/jira.ts b/skills/atlassian/claude-code/scripts/src/jira.ts index 5cf3a6e..6773dff 100644 --- a/skills/atlassian/claude-code/scripts/src/jira.ts +++ b/skills/atlassian/claude-code/scripts/src/jira.ts @@ -1,4 +1,6 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { markdownToAdf } from "./adf.js"; +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike, JiraIssueSummary } from "./types.js"; @@ -161,13 +163,7 @@ export function createJiraClient(options: JiraClientOptions) { }, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", "/rest/api/3/issue", request.body); return { ok: true, data: raw }; @@ -192,13 +188,7 @@ export function createJiraClient(options: JiraClientOptions) { fields, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("PUT", `/rest/api/3/issue/${input.issue}`, request.body); return { @@ -215,13 +205,7 @@ export function createJiraClient(options: JiraClientOptions) { body: markdownToAdf(input.body), }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", `/rest/api/3/issue/${input.issue}/comment`, request.body); return { @@ -242,13 +226,7 @@ export function createJiraClient(options: JiraClientOptions) { }, ); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("POST", `/rest/api/3/issue/${input.issue}/transitions`, request.body); return { diff --git a/skills/atlassian/claude-code/scripts/src/output.ts b/skills/atlassian/claude-code/scripts/src/output.ts index 06b8a6e..afb43d9 100644 --- a/skills/atlassian/claude-code/scripts/src/output.ts +++ b/skills/atlassian/claude-code/scripts/src/output.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import type { CommandOutput, OutputFormat, Writer } from "./types.js"; function renderText(payload: CommandOutput) { diff --git a/skills/atlassian/claude-code/scripts/src/raw.ts b/skills/atlassian/claude-code/scripts/src/raw.ts index 8e11793..43ed8de 100644 --- a/skills/atlassian/claude-code/scripts/src/raw.ts +++ b/skills/atlassian/claude-code/scripts/src/raw.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { readWorkspaceFile } from "./files.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -61,13 +63,7 @@ export async function runRawCommand( ...(body === undefined ? {} : { body }), }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const data = await sendJsonRequest({ config, diff --git a/skills/atlassian/claude-code/scripts/src/types.ts b/skills/atlassian/claude-code/scripts/src/types.ts index 7f48f56..c365ff5 100644 --- a/skills/atlassian/claude-code/scripts/src/types.ts +++ b/skills/atlassian/claude-code/scripts/src/types.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. export type AtlassianConfig = { baseUrl: string; jiraBaseUrl: string; diff --git a/skills/atlassian/codex/.generated-manifest.json b/skills/atlassian/codex/.generated-manifest.json new file mode 100644 index 0000000..835fa20 --- /dev/null +++ b/skills/atlassian/codex/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/atlassian/codex", + "files": [ + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "2462c2f552c99460071fc60231c5d2d9eca5283bd045e6c3f845e60f351e7e73" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "15556a6f53e68bb8d92d2710aae0836bc80af7f29be9d63aa1b87fcbd33732c6" + }, + { + "path": "scripts/src/adf.ts", + "kind": "file", + "mode": "644", + "sha256": "c7c3b4a78ccd8fb5a8ab99c82e0eab67a0a0d656b3985c1f56817bda199ad20f" + }, + { + "path": "scripts/src/cli.ts", + "kind": "file", + "mode": "644", + "sha256": "90dcc029adf0625b86c5eec44c5c1fd11bbf95ffe1185016d139c8a6982d54ff" + }, + { + "path": "scripts/src/command-helpers.ts", + "kind": "file", + "mode": "644", + "sha256": "aa03d8d288c8c00485ea10d3b3a60804c1b9ee23ef265004e7912f3242dbcee7" + }, + { + "path": "scripts/src/config.ts", + "kind": "file", + "mode": "644", + "sha256": "700dcdce96afab5294426e09f539135ae5432632370260190d6292071422eb3f" + }, + { + "path": "scripts/src/confluence.ts", + "kind": "file", + "mode": "644", + "sha256": "28f65f280cd9b6119ce7eab583d0083231525ad6dc04b73389cb5dcbab5bf095" + }, + { + "path": "scripts/src/files.ts", + "kind": "file", + "mode": "644", + "sha256": "16296eaa3ae41a4d7c694773036f9bb4bd2baa2db6a9c318078532b713678dba" + }, + { + "path": "scripts/src/health.ts", + "kind": "file", + "mode": "644", + "sha256": "1db4b49e05b16a095b7e7ca31cdc4e22ebda19e20e05c40baaaac648eaec0d08" + }, + { + "path": "scripts/src/http.ts", + "kind": "file", + "mode": "644", + "sha256": "66444b777d4d9b14d9793eb051c586eb811d2b36815b1018dd9d7517666c7eb2" + }, + { + "path": "scripts/src/jira.ts", + "kind": "file", + "mode": "644", + "sha256": "bec0e81a0424dd412c36988cef42c01a95f044ee8346ba626e7eb8bd79379f07" + }, + { + "path": "scripts/src/output.ts", + "kind": "file", + "mode": "644", + "sha256": "38e99818582a4962c09a83175634cba2bfead6acf33bd5f43cdca5caed7100a0" + }, + { + "path": "scripts/src/raw.ts", + "kind": "file", + "mode": "644", + "sha256": "48fd54bd0cdb421badb58f9be2933a039fe3b9350bbe6191070c9f7bb0054670" + }, + { + "path": "scripts/src/types.ts", + "kind": "file", + "mode": "644", + "sha256": "9f92d27ab68604d5abfd0f5dc9552b96fed6d1f9fc7dc6eb30190d8b617628bf" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "3c2eb7ba5c95a16cada153de4787ca7a4bf179609bf3848e12ff15b1b7927a68" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "e951cc63a6a3abf6b050b15f7316ea3675dd6aa3bc54677faa76ef5e6f1f7c16" + } + ] +} diff --git a/skills/atlassian/codex/SKILL.md b/skills/atlassian/codex/SKILL.md index e955654..fdb8193 100644 --- a/skills/atlassian/codex/SKILL.md +++ b/skills/atlassian/codex/SKILL.md @@ -3,6 +3,8 @@ name: atlassian description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. --- + + # Atlassian (Codex) Portable Atlassian workflows for Codex using a shared TypeScript CLI. diff --git a/skills/atlassian/codex/scripts/package.json b/skills/atlassian/codex/scripts/package.json index a9d8adc..603c142 100644 --- a/skills/atlassian/codex/scripts/package.json +++ b/skills/atlassian/codex/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "atlassian-skill-scripts", + "name": "@ai-coding-skills/atlassian-codex", "version": "1.0.0", "description": "Shared runtime for the Atlassian skill", "type": "module", @@ -16,5 +16,6 @@ "tsx": "^4.20.5", "typescript": "^5.9.2" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/atlassian/codex/scripts/src/adf.ts b/skills/atlassian/codex/scripts/src/adf.ts index 638914c..8774bd1 100644 --- a/skills/atlassian/codex/scripts/src/adf.ts +++ b/skills/atlassian/codex/scripts/src/adf.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. const TEXT_NODE = "text"; function textNode(text: string) { diff --git a/skills/atlassian/codex/scripts/src/cli.ts b/skills/atlassian/codex/scripts/src/cli.ts index 6012b99..a4f4fd0 100644 --- a/skills/atlassian/codex/scripts/src/cli.ts +++ b/skills/atlassian/codex/scripts/src/cli.ts @@ -1,8 +1,10 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import process from "node:process"; import { pathToFileURL } from "node:url"; import { Command } from "commander"; +import { resolveFormat } from "./command-helpers.js"; import { createConfluenceClient } from "./confluence.js"; import { loadConfig } from "./config.js"; import { readWorkspaceFile } from "./files.js"; @@ -10,7 +12,7 @@ import { runHealthCheck } from "./health.js"; import { createJiraClient } from "./jira.js"; import { writeOutput } from "./output.js"; import { runRawCommand } from "./raw.js"; -import type { FetchLike, OutputFormat, Writer } from "./types.js"; +import type { FetchLike, Writer } from "./types.js"; type CliContext = { cwd?: string; @@ -20,10 +22,6 @@ type CliContext = { stderr?: Writer; }; -function resolveFormat(format: string | undefined): OutputFormat { - return format === "text" ? "text" : "json"; -} - function createRuntime(context: CliContext) { const cwd = context.cwd ?? process.cwd(); const env = context.env ?? process.env; diff --git a/skills/atlassian/codex/scripts/src/command-helpers.ts b/skills/atlassian/codex/scripts/src/command-helpers.ts new file mode 100644 index 0000000..9ceca7c --- /dev/null +++ b/skills/atlassian/codex/scripts/src/command-helpers.ts @@ -0,0 +1,25 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import type { CommandOutput, OutputFormat } from "./types.js"; + +/** + * Produce the standard dry-run response payload for write operations. + * + * Use this when `--dry-run` is passed to skip the actual API call and + * echo the pending request back to the caller. + * + * @example + * if (input.dryRun) return dryRunResponse(request); + */ +export function dryRunResponse(data: T): CommandOutput { + return { ok: true, dryRun: true, data }; +} + +/** + * Resolve the `--format` CLI option to a typed OutputFormat. + * + * Returns `"text"` only for the exact string `"text"`; + * all other values (including `undefined`) fall back to `"json"`. + */ +export function resolveFormat(format: string | undefined): OutputFormat { + return format === "text" ? "text" : "json"; +} diff --git a/skills/atlassian/codex/scripts/src/config.ts b/skills/atlassian/codex/scripts/src/config.ts index eb34a39..58d37cc 100644 --- a/skills/atlassian/codex/scripts/src/config.ts +++ b/skills/atlassian/codex/scripts/src/config.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import path from "node:path"; import { config as loadDotEnv } from "dotenv"; diff --git a/skills/atlassian/codex/scripts/src/confluence.ts b/skills/atlassian/codex/scripts/src/confluence.ts index f22d66d..6ac333d 100644 --- a/skills/atlassian/codex/scripts/src/confluence.ts +++ b/skills/atlassian/codex/scripts/src/confluence.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -177,13 +179,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -223,13 +219,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -266,13 +256,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, diff --git a/skills/atlassian/codex/scripts/src/files.ts b/skills/atlassian/codex/scripts/src/files.ts index 8339109..cd7ed39 100644 --- a/skills/atlassian/codex/scripts/src/files.ts +++ b/skills/atlassian/codex/scripts/src/files.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { readFile } from "node:fs/promises"; import path from "node:path"; diff --git a/skills/atlassian/codex/scripts/src/health.ts b/skills/atlassian/codex/scripts/src/health.ts index b2d4d24..5946887 100644 --- a/skills/atlassian/codex/scripts/src/health.ts +++ b/skills/atlassian/codex/scripts/src/health.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createJsonHeaders, createStatusError } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; diff --git a/skills/atlassian/codex/scripts/src/http.ts b/skills/atlassian/codex/scripts/src/http.ts index 5791886..1184cd1 100644 --- a/skills/atlassian/codex/scripts/src/http.ts +++ b/skills/atlassian/codex/scripts/src/http.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createBasicAuthHeader } from "./config.js"; import type { AtlassianConfig, FetchLike } from "./types.js"; diff --git a/skills/atlassian/codex/scripts/src/jira.ts b/skills/atlassian/codex/scripts/src/jira.ts index 5cf3a6e..6773dff 100644 --- a/skills/atlassian/codex/scripts/src/jira.ts +++ b/skills/atlassian/codex/scripts/src/jira.ts @@ -1,4 +1,6 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { markdownToAdf } from "./adf.js"; +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike, JiraIssueSummary } from "./types.js"; @@ -161,13 +163,7 @@ export function createJiraClient(options: JiraClientOptions) { }, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", "/rest/api/3/issue", request.body); return { ok: true, data: raw }; @@ -192,13 +188,7 @@ export function createJiraClient(options: JiraClientOptions) { fields, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("PUT", `/rest/api/3/issue/${input.issue}`, request.body); return { @@ -215,13 +205,7 @@ export function createJiraClient(options: JiraClientOptions) { body: markdownToAdf(input.body), }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", `/rest/api/3/issue/${input.issue}/comment`, request.body); return { @@ -242,13 +226,7 @@ export function createJiraClient(options: JiraClientOptions) { }, ); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("POST", `/rest/api/3/issue/${input.issue}/transitions`, request.body); return { diff --git a/skills/atlassian/codex/scripts/src/output.ts b/skills/atlassian/codex/scripts/src/output.ts index 06b8a6e..afb43d9 100644 --- a/skills/atlassian/codex/scripts/src/output.ts +++ b/skills/atlassian/codex/scripts/src/output.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import type { CommandOutput, OutputFormat, Writer } from "./types.js"; function renderText(payload: CommandOutput) { diff --git a/skills/atlassian/codex/scripts/src/raw.ts b/skills/atlassian/codex/scripts/src/raw.ts index 8e11793..43ed8de 100644 --- a/skills/atlassian/codex/scripts/src/raw.ts +++ b/skills/atlassian/codex/scripts/src/raw.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { readWorkspaceFile } from "./files.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -61,13 +63,7 @@ export async function runRawCommand( ...(body === undefined ? {} : { body }), }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const data = await sendJsonRequest({ config, diff --git a/skills/atlassian/codex/scripts/src/types.ts b/skills/atlassian/codex/scripts/src/types.ts index 7f48f56..c365ff5 100644 --- a/skills/atlassian/codex/scripts/src/types.ts +++ b/skills/atlassian/codex/scripts/src/types.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. export type AtlassianConfig = { baseUrl: string; jiraBaseUrl: string; diff --git a/skills/atlassian/cursor/.generated-manifest.json b/skills/atlassian/cursor/.generated-manifest.json new file mode 100644 index 0000000..704e475 --- /dev/null +++ b/skills/atlassian/cursor/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/atlassian/cursor", + "files": [ + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "a48e86c0cd54ac3c9972b1d2818ee62a086ec34f1f7e88adcfc66eccc0adf04c" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "15556a6f53e68bb8d92d2710aae0836bc80af7f29be9d63aa1b87fcbd33732c6" + }, + { + "path": "scripts/src/adf.ts", + "kind": "file", + "mode": "644", + "sha256": "c7c3b4a78ccd8fb5a8ab99c82e0eab67a0a0d656b3985c1f56817bda199ad20f" + }, + { + "path": "scripts/src/cli.ts", + "kind": "file", + "mode": "644", + "sha256": "90dcc029adf0625b86c5eec44c5c1fd11bbf95ffe1185016d139c8a6982d54ff" + }, + { + "path": "scripts/src/command-helpers.ts", + "kind": "file", + "mode": "644", + "sha256": "aa03d8d288c8c00485ea10d3b3a60804c1b9ee23ef265004e7912f3242dbcee7" + }, + { + "path": "scripts/src/config.ts", + "kind": "file", + "mode": "644", + "sha256": "700dcdce96afab5294426e09f539135ae5432632370260190d6292071422eb3f" + }, + { + "path": "scripts/src/confluence.ts", + "kind": "file", + "mode": "644", + "sha256": "28f65f280cd9b6119ce7eab583d0083231525ad6dc04b73389cb5dcbab5bf095" + }, + { + "path": "scripts/src/files.ts", + "kind": "file", + "mode": "644", + "sha256": "16296eaa3ae41a4d7c694773036f9bb4bd2baa2db6a9c318078532b713678dba" + }, + { + "path": "scripts/src/health.ts", + "kind": "file", + "mode": "644", + "sha256": "1db4b49e05b16a095b7e7ca31cdc4e22ebda19e20e05c40baaaac648eaec0d08" + }, + { + "path": "scripts/src/http.ts", + "kind": "file", + "mode": "644", + "sha256": "66444b777d4d9b14d9793eb051c586eb811d2b36815b1018dd9d7517666c7eb2" + }, + { + "path": "scripts/src/jira.ts", + "kind": "file", + "mode": "644", + "sha256": "bec0e81a0424dd412c36988cef42c01a95f044ee8346ba626e7eb8bd79379f07" + }, + { + "path": "scripts/src/output.ts", + "kind": "file", + "mode": "644", + "sha256": "38e99818582a4962c09a83175634cba2bfead6acf33bd5f43cdca5caed7100a0" + }, + { + "path": "scripts/src/raw.ts", + "kind": "file", + "mode": "644", + "sha256": "48fd54bd0cdb421badb58f9be2933a039fe3b9350bbe6191070c9f7bb0054670" + }, + { + "path": "scripts/src/types.ts", + "kind": "file", + "mode": "644", + "sha256": "9f92d27ab68604d5abfd0f5dc9552b96fed6d1f9fc7dc6eb30190d8b617628bf" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "3c2eb7ba5c95a16cada153de4787ca7a4bf179609bf3848e12ff15b1b7927a68" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "39cb974a328958272e0fefa21969b41fca010326dbff121be2062af3138f9a9b" + } + ] +} diff --git a/skills/atlassian/cursor/SKILL.md b/skills/atlassian/cursor/SKILL.md index 91cfb1c..b9e9994 100644 --- a/skills/atlassian/cursor/SKILL.md +++ b/skills/atlassian/cursor/SKILL.md @@ -3,6 +3,8 @@ name: atlassian description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. --- + + # Atlassian (Cursor Agent CLI) Portable Atlassian workflows for Cursor Agent CLI using a shared TypeScript CLI. diff --git a/skills/atlassian/cursor/scripts/package.json b/skills/atlassian/cursor/scripts/package.json index a9d8adc..d6aa0c8 100644 --- a/skills/atlassian/cursor/scripts/package.json +++ b/skills/atlassian/cursor/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "atlassian-skill-scripts", + "name": "@ai-coding-skills/atlassian-cursor", "version": "1.0.0", "description": "Shared runtime for the Atlassian skill", "type": "module", @@ -16,5 +16,6 @@ "tsx": "^4.20.5", "typescript": "^5.9.2" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/atlassian/cursor/scripts/src/adf.ts b/skills/atlassian/cursor/scripts/src/adf.ts index 638914c..8774bd1 100644 --- a/skills/atlassian/cursor/scripts/src/adf.ts +++ b/skills/atlassian/cursor/scripts/src/adf.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. const TEXT_NODE = "text"; function textNode(text: string) { diff --git a/skills/atlassian/cursor/scripts/src/cli.ts b/skills/atlassian/cursor/scripts/src/cli.ts index 6012b99..a4f4fd0 100644 --- a/skills/atlassian/cursor/scripts/src/cli.ts +++ b/skills/atlassian/cursor/scripts/src/cli.ts @@ -1,8 +1,10 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import process from "node:process"; import { pathToFileURL } from "node:url"; import { Command } from "commander"; +import { resolveFormat } from "./command-helpers.js"; import { createConfluenceClient } from "./confluence.js"; import { loadConfig } from "./config.js"; import { readWorkspaceFile } from "./files.js"; @@ -10,7 +12,7 @@ import { runHealthCheck } from "./health.js"; import { createJiraClient } from "./jira.js"; import { writeOutput } from "./output.js"; import { runRawCommand } from "./raw.js"; -import type { FetchLike, OutputFormat, Writer } from "./types.js"; +import type { FetchLike, Writer } from "./types.js"; type CliContext = { cwd?: string; @@ -20,10 +22,6 @@ type CliContext = { stderr?: Writer; }; -function resolveFormat(format: string | undefined): OutputFormat { - return format === "text" ? "text" : "json"; -} - function createRuntime(context: CliContext) { const cwd = context.cwd ?? process.cwd(); const env = context.env ?? process.env; diff --git a/skills/atlassian/cursor/scripts/src/command-helpers.ts b/skills/atlassian/cursor/scripts/src/command-helpers.ts new file mode 100644 index 0000000..9ceca7c --- /dev/null +++ b/skills/atlassian/cursor/scripts/src/command-helpers.ts @@ -0,0 +1,25 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import type { CommandOutput, OutputFormat } from "./types.js"; + +/** + * Produce the standard dry-run response payload for write operations. + * + * Use this when `--dry-run` is passed to skip the actual API call and + * echo the pending request back to the caller. + * + * @example + * if (input.dryRun) return dryRunResponse(request); + */ +export function dryRunResponse(data: T): CommandOutput { + return { ok: true, dryRun: true, data }; +} + +/** + * Resolve the `--format` CLI option to a typed OutputFormat. + * + * Returns `"text"` only for the exact string `"text"`; + * all other values (including `undefined`) fall back to `"json"`. + */ +export function resolveFormat(format: string | undefined): OutputFormat { + return format === "text" ? "text" : "json"; +} diff --git a/skills/atlassian/cursor/scripts/src/config.ts b/skills/atlassian/cursor/scripts/src/config.ts index eb34a39..58d37cc 100644 --- a/skills/atlassian/cursor/scripts/src/config.ts +++ b/skills/atlassian/cursor/scripts/src/config.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import path from "node:path"; import { config as loadDotEnv } from "dotenv"; diff --git a/skills/atlassian/cursor/scripts/src/confluence.ts b/skills/atlassian/cursor/scripts/src/confluence.ts index f22d66d..6ac333d 100644 --- a/skills/atlassian/cursor/scripts/src/confluence.ts +++ b/skills/atlassian/cursor/scripts/src/confluence.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -177,13 +179,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -223,13 +219,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -266,13 +256,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, diff --git a/skills/atlassian/cursor/scripts/src/files.ts b/skills/atlassian/cursor/scripts/src/files.ts index 8339109..cd7ed39 100644 --- a/skills/atlassian/cursor/scripts/src/files.ts +++ b/skills/atlassian/cursor/scripts/src/files.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { readFile } from "node:fs/promises"; import path from "node:path"; diff --git a/skills/atlassian/cursor/scripts/src/health.ts b/skills/atlassian/cursor/scripts/src/health.ts index b2d4d24..5946887 100644 --- a/skills/atlassian/cursor/scripts/src/health.ts +++ b/skills/atlassian/cursor/scripts/src/health.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createJsonHeaders, createStatusError } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; diff --git a/skills/atlassian/cursor/scripts/src/http.ts b/skills/atlassian/cursor/scripts/src/http.ts index 5791886..1184cd1 100644 --- a/skills/atlassian/cursor/scripts/src/http.ts +++ b/skills/atlassian/cursor/scripts/src/http.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createBasicAuthHeader } from "./config.js"; import type { AtlassianConfig, FetchLike } from "./types.js"; diff --git a/skills/atlassian/cursor/scripts/src/jira.ts b/skills/atlassian/cursor/scripts/src/jira.ts index 5cf3a6e..6773dff 100644 --- a/skills/atlassian/cursor/scripts/src/jira.ts +++ b/skills/atlassian/cursor/scripts/src/jira.ts @@ -1,4 +1,6 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { markdownToAdf } from "./adf.js"; +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike, JiraIssueSummary } from "./types.js"; @@ -161,13 +163,7 @@ export function createJiraClient(options: JiraClientOptions) { }, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", "/rest/api/3/issue", request.body); return { ok: true, data: raw }; @@ -192,13 +188,7 @@ export function createJiraClient(options: JiraClientOptions) { fields, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("PUT", `/rest/api/3/issue/${input.issue}`, request.body); return { @@ -215,13 +205,7 @@ export function createJiraClient(options: JiraClientOptions) { body: markdownToAdf(input.body), }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", `/rest/api/3/issue/${input.issue}/comment`, request.body); return { @@ -242,13 +226,7 @@ export function createJiraClient(options: JiraClientOptions) { }, ); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("POST", `/rest/api/3/issue/${input.issue}/transitions`, request.body); return { diff --git a/skills/atlassian/cursor/scripts/src/output.ts b/skills/atlassian/cursor/scripts/src/output.ts index 06b8a6e..afb43d9 100644 --- a/skills/atlassian/cursor/scripts/src/output.ts +++ b/skills/atlassian/cursor/scripts/src/output.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import type { CommandOutput, OutputFormat, Writer } from "./types.js"; function renderText(payload: CommandOutput) { diff --git a/skills/atlassian/cursor/scripts/src/raw.ts b/skills/atlassian/cursor/scripts/src/raw.ts index 8e11793..43ed8de 100644 --- a/skills/atlassian/cursor/scripts/src/raw.ts +++ b/skills/atlassian/cursor/scripts/src/raw.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { readWorkspaceFile } from "./files.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -61,13 +63,7 @@ export async function runRawCommand( ...(body === undefined ? {} : { body }), }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const data = await sendJsonRequest({ config, diff --git a/skills/atlassian/cursor/scripts/src/types.ts b/skills/atlassian/cursor/scripts/src/types.ts index 7f48f56..c365ff5 100644 --- a/skills/atlassian/cursor/scripts/src/types.ts +++ b/skills/atlassian/cursor/scripts/src/types.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. export type AtlassianConfig = { baseUrl: string; jiraBaseUrl: string; diff --git a/skills/atlassian/opencode/.generated-manifest.json b/skills/atlassian/opencode/.generated-manifest.json new file mode 100644 index 0000000..439c89e --- /dev/null +++ b/skills/atlassian/opencode/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/atlassian/opencode", + "files": [ + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "780e807a8e4c611103273ce93ed029fdad62d87bc999bd022f8cebeefd61619b" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "15556a6f53e68bb8d92d2710aae0836bc80af7f29be9d63aa1b87fcbd33732c6" + }, + { + "path": "scripts/src/adf.ts", + "kind": "file", + "mode": "644", + "sha256": "c7c3b4a78ccd8fb5a8ab99c82e0eab67a0a0d656b3985c1f56817bda199ad20f" + }, + { + "path": "scripts/src/cli.ts", + "kind": "file", + "mode": "644", + "sha256": "90dcc029adf0625b86c5eec44c5c1fd11bbf95ffe1185016d139c8a6982d54ff" + }, + { + "path": "scripts/src/command-helpers.ts", + "kind": "file", + "mode": "644", + "sha256": "aa03d8d288c8c00485ea10d3b3a60804c1b9ee23ef265004e7912f3242dbcee7" + }, + { + "path": "scripts/src/config.ts", + "kind": "file", + "mode": "644", + "sha256": "700dcdce96afab5294426e09f539135ae5432632370260190d6292071422eb3f" + }, + { + "path": "scripts/src/confluence.ts", + "kind": "file", + "mode": "644", + "sha256": "28f65f280cd9b6119ce7eab583d0083231525ad6dc04b73389cb5dcbab5bf095" + }, + { + "path": "scripts/src/files.ts", + "kind": "file", + "mode": "644", + "sha256": "16296eaa3ae41a4d7c694773036f9bb4bd2baa2db6a9c318078532b713678dba" + }, + { + "path": "scripts/src/health.ts", + "kind": "file", + "mode": "644", + "sha256": "1db4b49e05b16a095b7e7ca31cdc4e22ebda19e20e05c40baaaac648eaec0d08" + }, + { + "path": "scripts/src/http.ts", + "kind": "file", + "mode": "644", + "sha256": "66444b777d4d9b14d9793eb051c586eb811d2b36815b1018dd9d7517666c7eb2" + }, + { + "path": "scripts/src/jira.ts", + "kind": "file", + "mode": "644", + "sha256": "bec0e81a0424dd412c36988cef42c01a95f044ee8346ba626e7eb8bd79379f07" + }, + { + "path": "scripts/src/output.ts", + "kind": "file", + "mode": "644", + "sha256": "38e99818582a4962c09a83175634cba2bfead6acf33bd5f43cdca5caed7100a0" + }, + { + "path": "scripts/src/raw.ts", + "kind": "file", + "mode": "644", + "sha256": "48fd54bd0cdb421badb58f9be2933a039fe3b9350bbe6191070c9f7bb0054670" + }, + { + "path": "scripts/src/types.ts", + "kind": "file", + "mode": "644", + "sha256": "9f92d27ab68604d5abfd0f5dc9552b96fed6d1f9fc7dc6eb30190d8b617628bf" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "3c2eb7ba5c95a16cada153de4787ca7a4bf179609bf3848e12ff15b1b7927a68" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "b7137d7c3ad97161cdb4603eebff6165a50baa247b61f3b8462744faa8d206d3" + } + ] +} diff --git a/skills/atlassian/opencode/SKILL.md b/skills/atlassian/opencode/SKILL.md index 5fb17ab..c5b6fda 100644 --- a/skills/atlassian/opencode/SKILL.md +++ b/skills/atlassian/opencode/SKILL.md @@ -3,6 +3,8 @@ name: atlassian description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. --- + + # Atlassian (OpenCode) Portable Atlassian workflows for OpenCode using a shared TypeScript CLI. diff --git a/skills/atlassian/opencode/scripts/package.json b/skills/atlassian/opencode/scripts/package.json index a9d8adc..0728989 100644 --- a/skills/atlassian/opencode/scripts/package.json +++ b/skills/atlassian/opencode/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "atlassian-skill-scripts", + "name": "@ai-coding-skills/atlassian-opencode", "version": "1.0.0", "description": "Shared runtime for the Atlassian skill", "type": "module", @@ -16,5 +16,6 @@ "tsx": "^4.20.5", "typescript": "^5.9.2" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/atlassian/opencode/scripts/src/adf.ts b/skills/atlassian/opencode/scripts/src/adf.ts index 638914c..8774bd1 100644 --- a/skills/atlassian/opencode/scripts/src/adf.ts +++ b/skills/atlassian/opencode/scripts/src/adf.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. const TEXT_NODE = "text"; function textNode(text: string) { diff --git a/skills/atlassian/opencode/scripts/src/cli.ts b/skills/atlassian/opencode/scripts/src/cli.ts index 6012b99..a4f4fd0 100644 --- a/skills/atlassian/opencode/scripts/src/cli.ts +++ b/skills/atlassian/opencode/scripts/src/cli.ts @@ -1,8 +1,10 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import process from "node:process"; import { pathToFileURL } from "node:url"; import { Command } from "commander"; +import { resolveFormat } from "./command-helpers.js"; import { createConfluenceClient } from "./confluence.js"; import { loadConfig } from "./config.js"; import { readWorkspaceFile } from "./files.js"; @@ -10,7 +12,7 @@ import { runHealthCheck } from "./health.js"; import { createJiraClient } from "./jira.js"; import { writeOutput } from "./output.js"; import { runRawCommand } from "./raw.js"; -import type { FetchLike, OutputFormat, Writer } from "./types.js"; +import type { FetchLike, Writer } from "./types.js"; type CliContext = { cwd?: string; @@ -20,10 +22,6 @@ type CliContext = { stderr?: Writer; }; -function resolveFormat(format: string | undefined): OutputFormat { - return format === "text" ? "text" : "json"; -} - function createRuntime(context: CliContext) { const cwd = context.cwd ?? process.cwd(); const env = context.env ?? process.env; diff --git a/skills/atlassian/opencode/scripts/src/command-helpers.ts b/skills/atlassian/opencode/scripts/src/command-helpers.ts new file mode 100644 index 0000000..9ceca7c --- /dev/null +++ b/skills/atlassian/opencode/scripts/src/command-helpers.ts @@ -0,0 +1,25 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import type { CommandOutput, OutputFormat } from "./types.js"; + +/** + * Produce the standard dry-run response payload for write operations. + * + * Use this when `--dry-run` is passed to skip the actual API call and + * echo the pending request back to the caller. + * + * @example + * if (input.dryRun) return dryRunResponse(request); + */ +export function dryRunResponse(data: T): CommandOutput { + return { ok: true, dryRun: true, data }; +} + +/** + * Resolve the `--format` CLI option to a typed OutputFormat. + * + * Returns `"text"` only for the exact string `"text"`; + * all other values (including `undefined`) fall back to `"json"`. + */ +export function resolveFormat(format: string | undefined): OutputFormat { + return format === "text" ? "text" : "json"; +} diff --git a/skills/atlassian/opencode/scripts/src/config.ts b/skills/atlassian/opencode/scripts/src/config.ts index eb34a39..58d37cc 100644 --- a/skills/atlassian/opencode/scripts/src/config.ts +++ b/skills/atlassian/opencode/scripts/src/config.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import path from "node:path"; import { config as loadDotEnv } from "dotenv"; diff --git a/skills/atlassian/opencode/scripts/src/confluence.ts b/skills/atlassian/opencode/scripts/src/confluence.ts index f22d66d..6ac333d 100644 --- a/skills/atlassian/opencode/scripts/src/confluence.ts +++ b/skills/atlassian/opencode/scripts/src/confluence.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -177,13 +179,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -223,13 +219,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -266,13 +256,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, diff --git a/skills/atlassian/opencode/scripts/src/files.ts b/skills/atlassian/opencode/scripts/src/files.ts index 8339109..cd7ed39 100644 --- a/skills/atlassian/opencode/scripts/src/files.ts +++ b/skills/atlassian/opencode/scripts/src/files.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { readFile } from "node:fs/promises"; import path from "node:path"; diff --git a/skills/atlassian/opencode/scripts/src/health.ts b/skills/atlassian/opencode/scripts/src/health.ts index b2d4d24..5946887 100644 --- a/skills/atlassian/opencode/scripts/src/health.ts +++ b/skills/atlassian/opencode/scripts/src/health.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createJsonHeaders, createStatusError } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; diff --git a/skills/atlassian/opencode/scripts/src/http.ts b/skills/atlassian/opencode/scripts/src/http.ts index 5791886..1184cd1 100644 --- a/skills/atlassian/opencode/scripts/src/http.ts +++ b/skills/atlassian/opencode/scripts/src/http.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createBasicAuthHeader } from "./config.js"; import type { AtlassianConfig, FetchLike } from "./types.js"; diff --git a/skills/atlassian/opencode/scripts/src/jira.ts b/skills/atlassian/opencode/scripts/src/jira.ts index 5cf3a6e..6773dff 100644 --- a/skills/atlassian/opencode/scripts/src/jira.ts +++ b/skills/atlassian/opencode/scripts/src/jira.ts @@ -1,4 +1,6 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { markdownToAdf } from "./adf.js"; +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike, JiraIssueSummary } from "./types.js"; @@ -161,13 +163,7 @@ export function createJiraClient(options: JiraClientOptions) { }, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", "/rest/api/3/issue", request.body); return { ok: true, data: raw }; @@ -192,13 +188,7 @@ export function createJiraClient(options: JiraClientOptions) { fields, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("PUT", `/rest/api/3/issue/${input.issue}`, request.body); return { @@ -215,13 +205,7 @@ export function createJiraClient(options: JiraClientOptions) { body: markdownToAdf(input.body), }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", `/rest/api/3/issue/${input.issue}/comment`, request.body); return { @@ -242,13 +226,7 @@ export function createJiraClient(options: JiraClientOptions) { }, ); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("POST", `/rest/api/3/issue/${input.issue}/transitions`, request.body); return { diff --git a/skills/atlassian/opencode/scripts/src/output.ts b/skills/atlassian/opencode/scripts/src/output.ts index 06b8a6e..afb43d9 100644 --- a/skills/atlassian/opencode/scripts/src/output.ts +++ b/skills/atlassian/opencode/scripts/src/output.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import type { CommandOutput, OutputFormat, Writer } from "./types.js"; function renderText(payload: CommandOutput) { diff --git a/skills/atlassian/opencode/scripts/src/raw.ts b/skills/atlassian/opencode/scripts/src/raw.ts index 8e11793..43ed8de 100644 --- a/skills/atlassian/opencode/scripts/src/raw.ts +++ b/skills/atlassian/opencode/scripts/src/raw.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { readWorkspaceFile } from "./files.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -61,13 +63,7 @@ export async function runRawCommand( ...(body === undefined ? {} : { body }), }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const data = await sendJsonRequest({ config, diff --git a/skills/atlassian/opencode/scripts/src/types.ts b/skills/atlassian/opencode/scripts/src/types.ts index 7f48f56..c365ff5 100644 --- a/skills/atlassian/opencode/scripts/src/types.ts +++ b/skills/atlassian/opencode/scripts/src/types.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. export type AtlassianConfig = { baseUrl: string; jiraBaseUrl: string; diff --git a/skills/atlassian/pi/.generated-manifest.json b/skills/atlassian/pi/.generated-manifest.json new file mode 100644 index 0000000..b07d803 --- /dev/null +++ b/skills/atlassian/pi/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/atlassian/pi", + "files": [ + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "454e09224d66eb976fa27a06e9998497f628baff1bc7a8f44d70e6eb107d7106" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "15556a6f53e68bb8d92d2710aae0836bc80af7f29be9d63aa1b87fcbd33732c6" + }, + { + "path": "scripts/src/adf.ts", + "kind": "file", + "mode": "644", + "sha256": "c7c3b4a78ccd8fb5a8ab99c82e0eab67a0a0d656b3985c1f56817bda199ad20f" + }, + { + "path": "scripts/src/cli.ts", + "kind": "file", + "mode": "644", + "sha256": "90dcc029adf0625b86c5eec44c5c1fd11bbf95ffe1185016d139c8a6982d54ff" + }, + { + "path": "scripts/src/command-helpers.ts", + "kind": "file", + "mode": "644", + "sha256": "aa03d8d288c8c00485ea10d3b3a60804c1b9ee23ef265004e7912f3242dbcee7" + }, + { + "path": "scripts/src/config.ts", + "kind": "file", + "mode": "644", + "sha256": "700dcdce96afab5294426e09f539135ae5432632370260190d6292071422eb3f" + }, + { + "path": "scripts/src/confluence.ts", + "kind": "file", + "mode": "644", + "sha256": "28f65f280cd9b6119ce7eab583d0083231525ad6dc04b73389cb5dcbab5bf095" + }, + { + "path": "scripts/src/files.ts", + "kind": "file", + "mode": "644", + "sha256": "16296eaa3ae41a4d7c694773036f9bb4bd2baa2db6a9c318078532b713678dba" + }, + { + "path": "scripts/src/health.ts", + "kind": "file", + "mode": "644", + "sha256": "1db4b49e05b16a095b7e7ca31cdc4e22ebda19e20e05c40baaaac648eaec0d08" + }, + { + "path": "scripts/src/http.ts", + "kind": "file", + "mode": "644", + "sha256": "66444b777d4d9b14d9793eb051c586eb811d2b36815b1018dd9d7517666c7eb2" + }, + { + "path": "scripts/src/jira.ts", + "kind": "file", + "mode": "644", + "sha256": "bec0e81a0424dd412c36988cef42c01a95f044ee8346ba626e7eb8bd79379f07" + }, + { + "path": "scripts/src/output.ts", + "kind": "file", + "mode": "644", + "sha256": "38e99818582a4962c09a83175634cba2bfead6acf33bd5f43cdca5caed7100a0" + }, + { + "path": "scripts/src/raw.ts", + "kind": "file", + "mode": "644", + "sha256": "48fd54bd0cdb421badb58f9be2933a039fe3b9350bbe6191070c9f7bb0054670" + }, + { + "path": "scripts/src/types.ts", + "kind": "file", + "mode": "644", + "sha256": "9f92d27ab68604d5abfd0f5dc9552b96fed6d1f9fc7dc6eb30190d8b617628bf" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "3c2eb7ba5c95a16cada153de4787ca7a4bf179609bf3848e12ff15b1b7927a68" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "69d83441799f3feada7fbf85691bda16fc30718b724871d7e37cfac574db2253" + } + ] +} diff --git a/skills/atlassian/pi/SKILL.md b/skills/atlassian/pi/SKILL.md index 10d3507..406e702 100644 --- a/skills/atlassian/pi/SKILL.md +++ b/skills/atlassian/pi/SKILL.md @@ -3,6 +3,8 @@ name: atlassian description: Interact with Atlassian Cloud Jira and Confluence through a portable task-oriented CLI for search, issue/page edits, comments, transitions, and bounded raw requests. --- + + # Atlassian (Pi) Portable Atlassian workflows for pi using the shared TypeScript CLI in `scripts/`. diff --git a/skills/atlassian/pi/scripts/package.json b/skills/atlassian/pi/scripts/package.json index a9d8adc..f1b233b 100644 --- a/skills/atlassian/pi/scripts/package.json +++ b/skills/atlassian/pi/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "atlassian-skill-scripts", + "name": "@ai-coding-skills/atlassian-pi", "version": "1.0.0", "description": "Shared runtime for the Atlassian skill", "type": "module", @@ -16,5 +16,6 @@ "tsx": "^4.20.5", "typescript": "^5.9.2" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/atlassian/pi/scripts/src/adf.ts b/skills/atlassian/pi/scripts/src/adf.ts index 638914c..8774bd1 100644 --- a/skills/atlassian/pi/scripts/src/adf.ts +++ b/skills/atlassian/pi/scripts/src/adf.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. const TEXT_NODE = "text"; function textNode(text: string) { diff --git a/skills/atlassian/pi/scripts/src/cli.ts b/skills/atlassian/pi/scripts/src/cli.ts index 6012b99..a4f4fd0 100644 --- a/skills/atlassian/pi/scripts/src/cli.ts +++ b/skills/atlassian/pi/scripts/src/cli.ts @@ -1,8 +1,10 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import process from "node:process"; import { pathToFileURL } from "node:url"; import { Command } from "commander"; +import { resolveFormat } from "./command-helpers.js"; import { createConfluenceClient } from "./confluence.js"; import { loadConfig } from "./config.js"; import { readWorkspaceFile } from "./files.js"; @@ -10,7 +12,7 @@ import { runHealthCheck } from "./health.js"; import { createJiraClient } from "./jira.js"; import { writeOutput } from "./output.js"; import { runRawCommand } from "./raw.js"; -import type { FetchLike, OutputFormat, Writer } from "./types.js"; +import type { FetchLike, Writer } from "./types.js"; type CliContext = { cwd?: string; @@ -20,10 +22,6 @@ type CliContext = { stderr?: Writer; }; -function resolveFormat(format: string | undefined): OutputFormat { - return format === "text" ? "text" : "json"; -} - function createRuntime(context: CliContext) { const cwd = context.cwd ?? process.cwd(); const env = context.env ?? process.env; diff --git a/skills/atlassian/pi/scripts/src/command-helpers.ts b/skills/atlassian/pi/scripts/src/command-helpers.ts new file mode 100644 index 0000000..9ceca7c --- /dev/null +++ b/skills/atlassian/pi/scripts/src/command-helpers.ts @@ -0,0 +1,25 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import type { CommandOutput, OutputFormat } from "./types.js"; + +/** + * Produce the standard dry-run response payload for write operations. + * + * Use this when `--dry-run` is passed to skip the actual API call and + * echo the pending request back to the caller. + * + * @example + * if (input.dryRun) return dryRunResponse(request); + */ +export function dryRunResponse(data: T): CommandOutput { + return { ok: true, dryRun: true, data }; +} + +/** + * Resolve the `--format` CLI option to a typed OutputFormat. + * + * Returns `"text"` only for the exact string `"text"`; + * all other values (including `undefined`) fall back to `"json"`. + */ +export function resolveFormat(format: string | undefined): OutputFormat { + return format === "text" ? "text" : "json"; +} diff --git a/skills/atlassian/pi/scripts/src/config.ts b/skills/atlassian/pi/scripts/src/config.ts index eb34a39..58d37cc 100644 --- a/skills/atlassian/pi/scripts/src/config.ts +++ b/skills/atlassian/pi/scripts/src/config.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import path from "node:path"; import { config as loadDotEnv } from "dotenv"; diff --git a/skills/atlassian/pi/scripts/src/confluence.ts b/skills/atlassian/pi/scripts/src/confluence.ts index f22d66d..6ac333d 100644 --- a/skills/atlassian/pi/scripts/src/confluence.ts +++ b/skills/atlassian/pi/scripts/src/confluence.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -177,13 +179,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -223,13 +219,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -266,13 +256,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, diff --git a/skills/atlassian/pi/scripts/src/files.ts b/skills/atlassian/pi/scripts/src/files.ts index 8339109..cd7ed39 100644 --- a/skills/atlassian/pi/scripts/src/files.ts +++ b/skills/atlassian/pi/scripts/src/files.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { readFile } from "node:fs/promises"; import path from "node:path"; diff --git a/skills/atlassian/pi/scripts/src/health.ts b/skills/atlassian/pi/scripts/src/health.ts index b2d4d24..5946887 100644 --- a/skills/atlassian/pi/scripts/src/health.ts +++ b/skills/atlassian/pi/scripts/src/health.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createJsonHeaders, createStatusError } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; diff --git a/skills/atlassian/pi/scripts/src/http.ts b/skills/atlassian/pi/scripts/src/http.ts index 5791886..1184cd1 100644 --- a/skills/atlassian/pi/scripts/src/http.ts +++ b/skills/atlassian/pi/scripts/src/http.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { createBasicAuthHeader } from "./config.js"; import type { AtlassianConfig, FetchLike } from "./types.js"; diff --git a/skills/atlassian/pi/scripts/src/jira.ts b/skills/atlassian/pi/scripts/src/jira.ts index 5cf3a6e..6773dff 100644 --- a/skills/atlassian/pi/scripts/src/jira.ts +++ b/skills/atlassian/pi/scripts/src/jira.ts @@ -1,4 +1,6 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import { markdownToAdf } from "./adf.js"; +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike, JiraIssueSummary } from "./types.js"; @@ -161,13 +163,7 @@ export function createJiraClient(options: JiraClientOptions) { }, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", "/rest/api/3/issue", request.body); return { ok: true, data: raw }; @@ -192,13 +188,7 @@ export function createJiraClient(options: JiraClientOptions) { fields, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("PUT", `/rest/api/3/issue/${input.issue}`, request.body); return { @@ -215,13 +205,7 @@ export function createJiraClient(options: JiraClientOptions) { body: markdownToAdf(input.body), }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", `/rest/api/3/issue/${input.issue}/comment`, request.body); return { @@ -242,13 +226,7 @@ export function createJiraClient(options: JiraClientOptions) { }, ); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("POST", `/rest/api/3/issue/${input.issue}/transitions`, request.body); return { diff --git a/skills/atlassian/pi/scripts/src/output.ts b/skills/atlassian/pi/scripts/src/output.ts index 06b8a6e..afb43d9 100644 --- a/skills/atlassian/pi/scripts/src/output.ts +++ b/skills/atlassian/pi/scripts/src/output.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. import type { CommandOutput, OutputFormat, Writer } from "./types.js"; function renderText(payload: CommandOutput) { diff --git a/skills/atlassian/pi/scripts/src/raw.ts b/skills/atlassian/pi/scripts/src/raw.ts index 8e11793..43ed8de 100644 --- a/skills/atlassian/pi/scripts/src/raw.ts +++ b/skills/atlassian/pi/scripts/src/raw.ts @@ -1,3 +1,5 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. +import { dryRunResponse } from "./command-helpers.js"; import { readWorkspaceFile } from "./files.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -61,13 +63,7 @@ export async function runRawCommand( ...(body === undefined ? {} : { body }), }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const data = await sendJsonRequest({ config, diff --git a/skills/atlassian/pi/scripts/src/types.ts b/skills/atlassian/pi/scripts/src/types.ts index 7f48f56..c365ff5 100644 --- a/skills/atlassian/pi/scripts/src/types.ts +++ b/skills/atlassian/pi/scripts/src/types.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/atlassian/shared/scripts/ and run `pnpm run sync:pi`. export type AtlassianConfig = { baseUrl: string; jiraBaseUrl: string; diff --git a/skills/atlassian/shared/scripts/src/cli.ts b/skills/atlassian/shared/scripts/src/cli.ts index 6012b99..6ef4df2 100644 --- a/skills/atlassian/shared/scripts/src/cli.ts +++ b/skills/atlassian/shared/scripts/src/cli.ts @@ -3,6 +3,7 @@ import { pathToFileURL } from "node:url"; import { Command } from "commander"; +import { resolveFormat } from "./command-helpers.js"; import { createConfluenceClient } from "./confluence.js"; import { loadConfig } from "./config.js"; import { readWorkspaceFile } from "./files.js"; @@ -10,7 +11,7 @@ import { runHealthCheck } from "./health.js"; import { createJiraClient } from "./jira.js"; import { writeOutput } from "./output.js"; import { runRawCommand } from "./raw.js"; -import type { FetchLike, OutputFormat, Writer } from "./types.js"; +import type { FetchLike, Writer } from "./types.js"; type CliContext = { cwd?: string; @@ -20,10 +21,6 @@ type CliContext = { stderr?: Writer; }; -function resolveFormat(format: string | undefined): OutputFormat { - return format === "text" ? "text" : "json"; -} - function createRuntime(context: CliContext) { const cwd = context.cwd ?? process.cwd(); const env = context.env ?? process.env; diff --git a/skills/atlassian/shared/scripts/src/command-helpers.ts b/skills/atlassian/shared/scripts/src/command-helpers.ts new file mode 100644 index 0000000..723b187 --- /dev/null +++ b/skills/atlassian/shared/scripts/src/command-helpers.ts @@ -0,0 +1,24 @@ +import type { CommandOutput, OutputFormat } from "./types.js"; + +/** + * Produce the standard dry-run response payload for write operations. + * + * Use this when `--dry-run` is passed to skip the actual API call and + * echo the pending request back to the caller. + * + * @example + * if (input.dryRun) return dryRunResponse(request); + */ +export function dryRunResponse(data: T): CommandOutput { + return { ok: true, dryRun: true, data }; +} + +/** + * Resolve the `--format` CLI option to a typed OutputFormat. + * + * Returns `"text"` only for the exact string `"text"`; + * all other values (including `undefined`) fall back to `"json"`. + */ +export function resolveFormat(format: string | undefined): OutputFormat { + return format === "text" ? "text" : "json"; +} diff --git a/skills/atlassian/shared/scripts/src/confluence.ts b/skills/atlassian/shared/scripts/src/confluence.ts index f22d66d..258eb0d 100644 --- a/skills/atlassian/shared/scripts/src/confluence.ts +++ b/skills/atlassian/shared/scripts/src/confluence.ts @@ -1,3 +1,4 @@ +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -177,13 +178,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -223,13 +218,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, @@ -266,13 +255,7 @@ export function createConfluenceClient(options: ConfluenceClientOptions) { }, }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await sendJsonRequest({ config, diff --git a/skills/atlassian/shared/scripts/src/jira.ts b/skills/atlassian/shared/scripts/src/jira.ts index 5cf3a6e..065666c 100644 --- a/skills/atlassian/shared/scripts/src/jira.ts +++ b/skills/atlassian/shared/scripts/src/jira.ts @@ -1,4 +1,5 @@ import { markdownToAdf } from "./adf.js"; +import { dryRunResponse } from "./command-helpers.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike, JiraIssueSummary } from "./types.js"; @@ -161,13 +162,7 @@ export function createJiraClient(options: JiraClientOptions) { }, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", "/rest/api/3/issue", request.body); return { ok: true, data: raw }; @@ -192,13 +187,7 @@ export function createJiraClient(options: JiraClientOptions) { fields, }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("PUT", `/rest/api/3/issue/${input.issue}`, request.body); return { @@ -215,13 +204,7 @@ export function createJiraClient(options: JiraClientOptions) { body: markdownToAdf(input.body), }); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const raw = await send("POST", `/rest/api/3/issue/${input.issue}/comment`, request.body); return { @@ -242,13 +225,7 @@ export function createJiraClient(options: JiraClientOptions) { }, ); - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); await send("POST", `/rest/api/3/issue/${input.issue}/transitions`, request.body); return { diff --git a/skills/atlassian/shared/scripts/src/raw.ts b/skills/atlassian/shared/scripts/src/raw.ts index 8e11793..de31354 100644 --- a/skills/atlassian/shared/scripts/src/raw.ts +++ b/skills/atlassian/shared/scripts/src/raw.ts @@ -1,3 +1,4 @@ +import { dryRunResponse } from "./command-helpers.js"; import { readWorkspaceFile } from "./files.js"; import { sendJsonRequest } from "./http.js"; import type { AtlassianConfig, CommandOutput, FetchLike } from "./types.js"; @@ -61,13 +62,7 @@ export async function runRawCommand( ...(body === undefined ? {} : { body }), }; - if (input.dryRun) { - return { - ok: true, - dryRun: true, - data: request, - }; - } + if (input.dryRun) return dryRunResponse(request); const data = await sendJsonRequest({ config, diff --git a/skills/atlassian/shared/scripts/tests/command-helpers.test.ts b/skills/atlassian/shared/scripts/tests/command-helpers.test.ts new file mode 100644 index 0000000..754a148 --- /dev/null +++ b/skills/atlassian/shared/scripts/tests/command-helpers.test.ts @@ -0,0 +1,43 @@ +import test from "node:test"; +import assert from "node:assert/strict"; + +import { dryRunResponse, resolveFormat } from "../src/command-helpers.js"; + +// ── dryRunResponse ──────────────────────────────────────────────────────── + +test("dryRunResponse wraps data with ok:true and dryRun:true", () => { + const data = { method: "POST", url: "https://example.com/api/v2/pages" }; + const result = dryRunResponse(data); + assert.equal(result.ok, true); + assert.equal(result.dryRun, true); + assert.deepEqual(result.data, data); +}); + +test("dryRunResponse preserves the exact data reference", () => { + const data = { nested: { key: "value" } }; + const result = dryRunResponse(data); + assert.strictEqual(result.data, data); +}); + +test("dryRunResponse works with primitive data", () => { + const result = dryRunResponse("dry-run-string"); + assert.equal(result.ok, true); + assert.equal(result.dryRun, true); + assert.equal(result.data, "dry-run-string"); +}); + +// ── resolveFormat ───────────────────────────────────────────────────────── + +test("resolveFormat returns json by default for undefined", () => { + assert.equal(resolveFormat(undefined), "json"); +}); + +test("resolveFormat returns json for unrecognised values", () => { + assert.equal(resolveFormat("xml"), "json"); + assert.equal(resolveFormat(""), "json"); + assert.equal(resolveFormat("TEXT"), "json"); +}); + +test("resolveFormat returns text only for the exact string 'text'", () => { + assert.equal(resolveFormat("text"), "text"); +}); diff --git a/skills/create-plan/_source/claude-code/SKILL.md b/skills/create-plan/_source/claude-code/SKILL.md new file mode 100644 index 0000000..90cdd43 --- /dev/null +++ b/skills/create-plan/_source/claude-code/SKILL.md @@ -0,0 +1,584 @@ +--- +name: create-plan +description: Use when starting a new feature, project, or complex task that needs structured planning with milestones, bite-sized stories, and resumable execution context. ALWAYS invoke when user says "create a plan", "make a plan", "plan this", "start planning", or similar planning requests. +--- + +# Create Plan (Claude Code) + +Create and maintain a local plan folder under `ai_plan/` at project root. + +## Prerequisite Check (MANDATORY) + +This Claude Code variant depends on Superpowers planning skills and explicit sub-skill invocation. + +Required: + +- Superpowers repo: `https://github.com/obra/superpowers` +- `brainstorming` skill +- `writing-plans` skill + +If any dependency is missing, stop immediately and return: + +"Missing dependency: Superpowers planning skills are required (`brainstorming`, `writing-plans`). Install from https://github.com/obra/superpowers, then retry." + +## Process + +### Phase 1: Analyze + +- Explore the codebase with exploration agents. +- Understand existing patterns and context. + +### Phase 2: Gather Requirements + +- Ask questions ONE AT A TIME until user says ready. +- Cover scope, constraints, success criteria, dependencies. +- Summarize before proceeding. + +### Phase 3: Configure Reviewer + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +If the user has already specified a reviewer CLI and model (e.g., "create a plan, review with codex o4-mini"), use those values. Otherwise, ask: + +1. **Which CLI should review the plan?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed directly to file generation + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see your account's available models (availability varies by subscription) + - Accept any model string the user provides + +3. **Max review rounds for the plan?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store the chosen `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phase 6 (Iterative Plan Review). + +### Phase 4: Design (REQUIRED SUB-SKILL) + +- Invoke `superpowers:brainstorming` explicitly. +- Present 2-3 approaches and recommend one. +- Validate design in sections. + +### Phase 5: Plan (REQUIRED SUB-SKILL) + +- Invoke `superpowers:writing-plans` explicitly. +- Break into milestones and bite-sized stories (2-5 min each). +- Story IDs: `S-{milestone}{sequence}`. + +### Phase 6: Iterative Plan Review + +Send the plan to the configured reviewer CLI for feedback. Revise and re-submit until approved (default max 10 rounds). + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use for temp artifacts: + +- `/tmp/plan-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.json` (Cursor only) +- `/tmp/plan-review-${REVIEW_ID}.stderr` +- `/tmp/plan-review-${REVIEW_ID}.status` +- `/tmp/plan-review-${REVIEW_ID}.runner.out` +- `/tmp/plan-review-${REVIEW_ID}.sh` + +Resolve the shared reviewer helper from the installed Claude Code skills directory: + +```bash +REVIEWER_RUNTIME=~/.claude/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.json) + ;; +esac +``` + +#### Step 2: Write Plan to Temp File + +Write the complete plan (milestones, stories, design decisions, specs) to `/tmp/plan-${REVIEW_ID}.md`. + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/plan-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "Review the implementation plan in /tmp/plan-${REVIEW_ID}.md. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: `), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review the implementation plan below. Focus on: + +$(cat /tmp/plan-${REVIEW_ID}.md) + +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/plan-${REVIEW_ID}.md and review the implementation plan. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/plan-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/plan-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/plan-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/plan-review-${REVIEW_ID}.stderr \ + --status-file /tmp/plan-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/plan-review-${REVIEW_ID}.sh >/tmp/plan-review-${REVIEW_ID}.runner.out 2>/tmp/plan-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/plan-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/plan-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md +``` + +Fallback is allowed only when the helper is missing or not executable. + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/plan-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/plan-review-${REVIEW_ID}.stderr` + - `/tmp/plan-review-${REVIEW_ID}.status` + - `/tmp/plan-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 7 (Initialize workspace) + - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as approved + - Helper state `completed-empty-output` → treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached → present the outcome to the user for a manual decision (proceed or stop) + +#### Step 5: Revise the Plan + +Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P3` when practical). Update the plan in conversation context and rewrite `/tmp/plan-${REVIEW_ID}.md`. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this plan and requested revisions. Read the updated payload at /tmp/plan-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed an implementation plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised the plan. Updated version is below. + +$(cat /tmp/plan-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review the full plan using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +After updating `/tmp/plan-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Present Final Result + +```markdown +## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +**Status:** Approved after N round(s) +[or] +**Status:** Max rounds (`MAX_ROUNDS`) reached — not fully approved + +[Final feedback / remaining concerns] +``` + +#### Step 8: Cleanup + +```bash +rm -f /tmp/plan-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.json \ + /tmp/plan-review-${REVIEW_ID}.stderr \ + /tmp/plan-review-${REVIEW_ID}.status \ + /tmp/plan-review-${REVIEW_ID}.runner.out \ + /tmp/plan-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 7: Initialize Local Plan Workspace (MANDATORY) + +At project root: + +1. Ensure `ai_plan/` exists. Create it if missing. +2. Ensure `.gitignore` contains `/ai_plan/`. +3. If `.gitignore` was changed, commit that change immediately (local commit only). + +Recommended commit message: + +- `chore(gitignore): ignore ai_plan local planning artifacts` + +### Phase 8: Generate Plan Files (MANDATORY - DO NOT SKIP) + +**PLAN MODE CHECK:** If currently in plan mode: + +1. Inform user that plan files cannot be written while in plan mode. +2. Instruct user to exit plan mode (approve plan or use ExitPlanMode). +3. Proceed with file generation only after exiting plan mode. + +Create `ai_plan/YYYY-MM-DD-/` with ALL files: + +1. `original-plan.md` - Copy the plan file from `~/.claude/plans/` as-is. +2. `final-transcript.md` - Copy of final planning transcript for reference. +3. `milestone-plan.md` - Full specification (template-based). +4. `story-tracker.md` - Status tracking (template-based, all stories start as `pending`). +5. `continuation-runbook.md` - Resume context and execution protocol (template-based). + +Use templates from this skill's `templates/` folder (or `~/.claude/skills/create-plan/templates/` when installed directly in Claude Code). + +### Phase 9: Handoff Instructions + +When handing off to execution, instruct: +> Read `ai_plan/YYYY-MM-DD-/continuation-runbook.md` first, then execute from `ai_plan` files only. + +Private plan files under `~/.claude/plans/` are planning artifacts and must not be used as execution source of truth. + +### Phase 10: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from the installed Claude Code skills directory: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.claude/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome for the create-plan run (approved, max rounds reached, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "create-plan completed for : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Tracker Discipline (MANDATORY) + +**ALWAYS update `story-tracker.md` before/after each story. NEVER proceed with stale tracker state.** + +Before starting any story: + +1. Open `story-tracker.md` +2. Mark story `in-dev` +3. Add notes if relevant +4. Then begin implementation + +After completing any story: + +1. Mark story `completed` +2. Add commit hash in Notes +3. Review pending stories +4. Update Last Updated and Stories Complete counts + +## Execution Rules to Include in Plan (MANDATORY) + +- Run lint/typecheck/tests after each milestone. +- Prefer linting changed files only for speed. +- Commit locally after each completed milestone (**do not push**). +- Stop and ask user for feedback. +- Apply feedback, rerun checks, and commit again. +- Move to next milestone only after user approval. +- After all milestones are completed and approved, ask permission to push. +- Only after approved push: mark plan as completed. + +## Gitignore Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates in `ai_plan/` as a problem. + +## Verification Checklist + +- [ ] `ai_plan/` exists at project root +- [ ] `.gitignore` includes `/ai_plan/` +- [ ] `.gitignore` ignore-rule commit was created if needed +- [ ] Plan directory created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Plan review completed (approved or max rounds) — or skipped +- [ ] `original-plan.md` copied from `~/.claude/plans/` plan file +- [ ] `final-transcript.md` present +- [ ] `milestone-plan.md` present +- [ ] `story-tracker.md` created with all stories as `pending` +- [ ] `continuation-runbook.md` present +- [ ] Handoff explicitly says to read runbook first and execute from plan folder +- [ ] Telegram notification attempted if configured + +## Exit Triggers for Question Phase + +User says: "ready", "done", "let's plan", "proceed", "enough questions" diff --git a/skills/create-plan/_source/claude-code/templates/continuation-runbook.md b/skills/create-plan/_source/claude-code/templates/continuation-runbook.md new file mode 100644 index 0000000..11ca6e7 --- /dev/null +++ b/skills/create-plan/_source/claude-code/templates/continuation-runbook.md @@ -0,0 +1,138 @@ +# Continuation Runbook: [Plan Title] + +## Reference Files (START HERE) + +Upon resumption, these files in this folder are the ONLY source of truth: + +| File | Purpose | When to Use | +|------|---------|-------------| +| `continuation-runbook.md` | Full context reproduction + execution workflow | Read FIRST | +| `story-tracker.md` | Current progress and status | Check/update BEFORE and AFTER every story | +| `milestone-plan.md` | Complete plan with specifications | Reference implementation details | +| `original-plan.md` | Original approved plan | Reference original intent | +| `final-transcript.md` | Final planning transcript | Reference reasoning/context | + +Do NOT reference planner-private files during implementation. + +--- + +## Quick Resume Instructions + +1. Read this runbook completely. +2. Check `story-tracker.md`. +3. Find next `pending` story and mark as `in-dev` before starting. +4. Implement the story. +5. Update tracker immediately after each change. + +--- + +## Mandatory Execution Workflow + +Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow this order: + +1. Read `continuation-runbook.md` first. +2. Execute stories milestone by milestone. +3. After completing a milestone: + - Run lint/typecheck/tests, prioritizing changed files for speed. + - Commit locally (**DO NOT PUSH**). + - Stop and ask user for feedback. +4. If feedback is provided: + - Apply feedback changes. + - Re-run checks for changed files. + - Commit locally again. + - Ask for milestone approval. +5. Only move to next milestone after explicit approval. +6. After all milestones are completed and approved: + - Ask permission to push. + - If approved, push. + - Mark plan status as `completed`. + +--- + +## Git Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates inside `ai_plan/` as an error. + +--- + +## Full Context Reproduction + +### Project Overview + +[What this project/feature is about] + +### User Requirements + +[All gathered requirements] + +### Scope + +[In scope / out of scope] + +### Dependencies + +[External dependencies, prerequisites, related systems] + +--- + +## Key Specifications + +### Type Definitions + +```typescript +// Copy-paste ready type definitions +``` + +### Enums & Constants + +```typescript +// All enums/constants needed +``` + +### API Endpoints + +```typescript +// Request/response shapes +``` + +--- + +## Critical Design Decisions + +| Decision | Chosen Approach | Alternatives Rejected | Rationale | +|----------|-----------------|----------------------|-----------| +| [Topic] | [What we chose] | [Other options] | [Why] | + +--- + +## Verification Commands + +### Lint (changed files first) + +```bash +# example: pnpm eslint +``` + +### Typecheck + +```bash +# example: pnpm tsc --noEmit +``` + +### Tests (target changed scope first) + +```bash +# example: pnpm test -- +``` + +--- + +## File Quick Reference + +| File | Purpose | +|------|---------| +| `original-plan.md` | Original approved plan | +| `final-transcript.md` | Final planning transcript | +| `milestone-plan.md` | Full specification | +| `story-tracker.md` | Current progress tracker | +| `continuation-runbook.md` | This runbook | diff --git a/skills/create-plan/_source/claude-code/templates/milestone-plan.md b/skills/create-plan/_source/claude-code/templates/milestone-plan.md new file mode 100644 index 0000000..f646b48 --- /dev/null +++ b/skills/create-plan/_source/claude-code/templates/milestone-plan.md @@ -0,0 +1,118 @@ +# [Plan Title] + +## Overview + +- **Goal:** [One sentence describing the end state] +- **Created:** YYYY-MM-DD +- **Status:** In Progress | Complete + +## Context + +### Requirements + +[Gathered requirements from user questions] + +### Constraints + +[Technical, business, or timeline constraints] + +### Success Criteria + +[How we know this is complete] + +## Architecture + +### Design Decisions + +[Key architectural choices and rationale] + +### Component Relationships + +[How pieces fit together] + +### Data Flow + +[How data moves through the system] + +## Milestones + +### M1: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-101, S-102, S-103... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +### M2: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-201, S-202, S-203... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +## Technical Specifications + +### Types & Interfaces + +```typescript +// Key type definitions +``` + +### API Contracts + +```typescript +// Endpoint signatures, request/response shapes +``` + +### Constants & Enums + +```typescript +// Shared constants +``` + +## Files Inventory + +| File | Purpose | Milestone | +|------|---------|-----------| +| `path/to/file.ts` | [What it does] | M1 | +| `path/to/other.ts` | [What it does] | M2 | + +--- + +## Related Plan Files + +This file is part of the plan folder under `ai_plan/`: + +- `original-plan.md` - Original approved plan (reference for original intent) +- `final-transcript.md` - Final planning transcript (reference for rationale/context) +- `milestone-plan.md` - This file (full specification) +- `story-tracker.md` - Status tracking (must be kept up to date) +- `continuation-runbook.md` - Resume/execution context (read first) diff --git a/skills/create-plan/_source/claude-code/templates/story-tracker.md b/skills/create-plan/_source/claude-code/templates/story-tracker.md new file mode 100644 index 0000000..08dbd3a --- /dev/null +++ b/skills/create-plan/_source/claude-code/templates/story-tracker.md @@ -0,0 +1,71 @@ +# Story Tracker: [Plan Title] + +## Progress Summary + +- **Current Milestone:** M1 +- **Stories Complete:** 0/N +- **Milestones Approved:** 0/M +- **Last Updated:** YYYY-MM-DD + +--- + +## Milestones + +### M1: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-101 | [Brief description] | pending | | +| S-102 | [Brief description] | pending | | +| S-103 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +### M2: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-201 | [Brief description] | pending | | +| S-202 | [Brief description] | pending | | +| S-203 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +## Status Legend + +| Status | Meaning | +|--------|---------| +| `pending` | Not started | +| `in-dev` | Currently being worked on | +| `completed` | Done - include commit hash in Notes | +| `deferred` | Postponed - include reason in Notes | + +## Update Instructions (MANDATORY) + +Before starting any story: + +1. Mark story as `in-dev` +2. Update "Last Updated" + +After completing any story: + +1. Mark story as `completed` +2. Add local commit hash to Notes +3. Update "Stories Complete" and "Last Updated" + +At milestone boundary: + +1. Run lint/typecheck/tests for changed files +2. Commit (no push) +3. Request feedback +4. Apply feedback, re-check changed files, commit again +5. Mark milestone **Approval Status: approved** only after user confirms +6. Continue only after approval + +After all milestones approved: + +- Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/_source/codex/SKILL.md b/skills/create-plan/_source/codex/SKILL.md new file mode 100644 index 0000000..4fe088c --- /dev/null +++ b/skills/create-plan/_source/codex/SKILL.md @@ -0,0 +1,624 @@ +--- +name: create-plan +description: Use when a user asks to create or maintain a structured implementation plan in Codex, including milestones, bite-sized stories, and resumable local planning artifacts under ai_plan. +--- + +# Create Plan (Codex Native Superpowers) + +Create and maintain a local plan workspace under `ai_plan/` at project root. + +## Overview + +This skill wraps the current Superpowers flow for Codex: + +1. Design first with `superpowers:brainstorming` +2. Then build an implementation plan with `superpowers:writing-plans` +3. Review the plan iteratively with a second model/provider +4. Persist a local execution package in `ai_plan/YYYY-MM-DD-/` + +**Core principle:** Codex uses native skill discovery from `~/.agents/skills/`. Do not use deprecated `superpowers-codex bootstrap` or `use-skill` CLI commands. + +## Prerequisite Check (MANDATORY) + +Required: + +- Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` +- `superpowers:brainstorming` +- `superpowers:writing-plans` + +Verify before proceeding: + +```bash +test -L ~/.agents/skills/superpowers +test -f ~/.agents/skills/superpowers/brainstorming/SKILL.md +test -f ~/.agents/skills/superpowers/writing-plans/SKILL.md +``` + +If any dependency is missing, stop and return: + +`Missing dependency: native Superpowers skills are required (superpowers:brainstorming, superpowers:writing-plans). Ensure ~/.agents/skills/superpowers is configured, then retry.` + +## Required Skill Invocation Rules + +- Invoke relevant skills through native discovery (no CLI wrapper). +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- For skills with checklists, track checklist items with `update_plan` todos. +- Tool mapping for Codex: + - `TodoWrite` -> `update_plan` + - `Task` subagents -> unavailable in Codex; do the work directly and state the limitation + - `Skill` -> use native skill discovery from `~/.agents/skills/` + +## Process + +### Phase 1: Analyze + +- Explore the codebase and existing patterns. + +### Phase 2: Gather Requirements + +- Ask questions one at a time until user says ready. +- Confirm scope, constraints, success criteria, dependencies. + +### Phase 3: Configure Reviewer + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +If the user has already specified a reviewer CLI and model (e.g., "create a plan, review with claude sonnet"), use those values. Otherwise, ask: + +1. **Which CLI should review the plan?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed directly to file generation + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see your account's available models (availability varies by subscription) + - Accept any model string the user provides + +3. **Max review rounds for the plan?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store the chosen `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phase 6 (Iterative Plan Review). + +### Phase 4: Design (REQUIRED SUB-SKILL) + +Invoke `superpowers:brainstorming`, then propose 2-3 approaches and recommend one. + +### Phase 5: Plan (REQUIRED SUB-SKILL) + +Invoke `superpowers:writing-plans`, then break work into milestones and bite-sized stories. + +### Phase 6: Iterative Plan Review + +Send the plan to the configured reviewer CLI for feedback. Revise and re-submit until approved (default max 10 rounds). + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use for temp artifacts: + +- `/tmp/plan-${REVIEW_ID}.md` - plan payload +- `/tmp/plan-review-${REVIEW_ID}.md` - normalized review text presented to the user +- `/tmp/plan-review-${REVIEW_ID}.json` - raw Cursor JSON (only for `cursor`) +- `/tmp/plan-review-${REVIEW_ID}.stderr` - reviewer stderr +- `/tmp/plan-review-${REVIEW_ID}.status` - helper heartbeat/status log +- `/tmp/plan-review-${REVIEW_ID}.runner.out` - helper-managed stdout from the reviewer command process +- `/tmp/plan-review-${REVIEW_ID}.sh` - reviewer command script + +Resolve the shared reviewer helper from the installed Codex skills directory: + +```bash +REVIEWER_RUNTIME=~/.codex/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.json) + ;; +esac +``` + +#### Step 2: Write Plan to Temp File + +Write the complete plan (milestones, stories, design decisions, specs) to `/tmp/plan-${REVIEW_ID}.md`. + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/plan-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "Review the implementation plan in /tmp/plan-${REVIEW_ID}.md. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: `), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review the implementation plan below. Focus on: + +$(cat /tmp/plan-${REVIEW_ID}.md) + +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/plan-${REVIEW_ID}.md and review the implementation plan. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/plan-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/plan-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/plan-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/plan-review-${REVIEW_ID}.stderr \ + --status-file /tmp/plan-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/plan-review-${REVIEW_ID}.sh >/tmp/plan-review-${REVIEW_ID}.runner.out 2>/tmp/plan-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/plan-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/plan-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md +``` + +Fallback is allowed only when the helper is missing or not executable. + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/plan-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/plan-review-${REVIEW_ID}.stderr` + - `/tmp/plan-review-${REVIEW_ID}.status` + - `/tmp/plan-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 7 (Initialize workspace) + - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as approved + - Helper state `completed-empty-output` → treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached → present the outcome to the user for a manual decision (proceed or stop) + +#### Step 5: Revise the Plan + +Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P3` when practical). Update the plan in conversation context and rewrite `/tmp/plan-${REVIEW_ID}.md`. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this plan and requested revisions. Read the updated payload at /tmp/plan-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed an implementation plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised the plan. Updated version is below. + +$(cat /tmp/plan-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review the full plan using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +After updating `/tmp/plan-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Present Final Result + +```markdown +## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +**Status:** Approved after N round(s) +[or] +**Status:** Max rounds (`MAX_ROUNDS`) reached — not fully approved + +[Final feedback / remaining concerns] +``` + +#### Step 8: Cleanup + +```bash +rm -f /tmp/plan-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.json \ + /tmp/plan-review-${REVIEW_ID}.stderr \ + /tmp/plan-review-${REVIEW_ID}.status \ + /tmp/plan-review-${REVIEW_ID}.runner.out \ + /tmp/plan-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 7: Initialize Local Plan Workspace (MANDATORY) + +At project root: + +1. Ensure `ai_plan/` exists. Create it if missing. +2. Ensure `.gitignore` contains `/ai_plan/`. +3. If `.gitignore` was changed, commit that change immediately (local commit only). + +Recommended commit message: + +- `chore(gitignore): ignore ai_plan local planning artifacts` + +### Phase 8: Generate Plan Files (MANDATORY) + +Create `ai_plan/YYYY-MM-DD-/` with all files below: + +1. `original-plan.md` - copy of original planner-generated plan. +2. `final-transcript.md` - copy of final planning transcript used to reach approved plan. +3. `milestone-plan.md` - full implementation spec (from template). +4. `story-tracker.md` - story/milestone status tracker (from template). +5. `continuation-runbook.md` - execution instructions and context (from template). + +Use templates from this skill's `templates/` folder. + +### Phase 9: Handoff + +Always instruct the executing agent: +> Read `ai_plan/YYYY-MM-DD-/continuation-runbook.md` first, then execute from that folder. + +Do not rely on planner-private files during implementation. + +### Phase 10: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from the installed Codex skills directory: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.codex/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome for the create-plan run (approved, max rounds reached, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "create-plan completed for : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Quick Reference + +| Phase | Action | Required Output | +|---|---|---| +| 1 | Analyze codebase/context | Constraints and known patterns | +| 2 | Gather requirements (one question at a time) | Confirmed scope and success criteria | +| 3 | Configure reviewer CLI and model | `REVIEWER_CLI`, `REVIEWER_MODEL`, `MAX_ROUNDS` (or `skip`) | +| 4 | Invoke `superpowers:brainstorming` | Chosen design approach | +| 5 | Invoke `superpowers:writing-plans` | Milestones and bite-sized stories | +| 6 | Iterative plan review (max `MAX_ROUNDS` rounds) | Reviewer approval or max-rounds warning | +| 7 | Initialize `ai_plan/` + `.gitignore` | Local planning workspace ready | +| 8 | Build plan package from templates | Full plan folder with required files | +| 9 | Handoff with runbook-first instruction | Resumable execution context | +| 10 | Send Telegram notification | User notified or notification status reported | + +## Execution Rules to Include in Plan (MANDATORY) + +- Run lint/typecheck/tests after each milestone. +- Prefer linting changed files only for speed. +- Commit locally after each completed milestone (**do not push**). +- Stop and ask user for feedback. +- Apply feedback, rerun checks, and commit again. +- Move to next milestone only after user approval. +- After all milestones are completed and approved, ask permission to push. +- Only after approved push: mark plan as completed. + +## Gitignore Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates in `ai_plan/` as a problem. + +## Common Mistakes + +- Using deprecated commands like `superpowers-codex bootstrap` or `superpowers-codex use-skill`. +- Jumping to implementation planning without running `superpowers:brainstorming` first. +- Asking multiple requirement questions in one message. +- Forgetting to create/update `.gitignore` for `/ai_plan/`. +- Omitting one or more required files in the plan package. +- Handoff without explicit "read runbook first" direction. +- Skipping the reviewer phase without explicit user opt-out. +- Not capturing the Codex session ID for resume in subsequent review rounds. +- Using any notification path other than Telegram. + +## Rationalizations and Counters + +| Rationalization | Counter | +|---|---| +| "Bootstrap CLI is faster" | Deprecated for Codex; native discovery is the supported path. | +| "I can skip brainstorming for small tasks" | Creative/planning work still requires design validation first. | +| "I don't need `update_plan` for checklist skills" | Checklist tracking is mandatory for execution reliability. | +| "I can keep plan files outside `ai_plan/`" | This skill standardizes local resumable planning under `ai_plan/`. | +| "The reviewer approved, I can skip my own validation" | Reviewer feedback supplements but does not replace your own verification. | + +## Red Flags - Stop and Correct + +- You are about to run any `superpowers-codex` command. +- You started writing milestones before design validation. +- You did not announce which skill you invoked and why. +- You are marking planning complete without all required files. +- Handoff does not explicitly point to `continuation-runbook.md`. +- You are applying a reviewer suggestion that contradicts user requirements. + +## Verification Checklist + +- [ ] `ai_plan/` exists at project root +- [ ] `.gitignore` includes `/ai_plan/` +- [ ] `.gitignore` ignore-rule commit was created if needed +- [ ] Plan directory created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Plan review completed (approved or max rounds) — or skipped +- [ ] `original-plan.md` present +- [ ] `final-transcript.md` present +- [ ] `milestone-plan.md` present +- [ ] `story-tracker.md` present +- [ ] `continuation-runbook.md` present +- [ ] Handoff explicitly says to read runbook first and execute from plan folder +- [ ] Telegram notification attempted if configured diff --git a/skills/create-plan/_source/codex/templates/continuation-runbook.md b/skills/create-plan/_source/codex/templates/continuation-runbook.md new file mode 100644 index 0000000..dcaaf28 --- /dev/null +++ b/skills/create-plan/_source/codex/templates/continuation-runbook.md @@ -0,0 +1,145 @@ +# Continuation Runbook: [Plan Title] + +## Reference Files (START HERE) + +Upon resumption, these files in this folder are the ONLY source of truth: + +| File | Purpose | When to Use | +|------|---------|-------------| +| `continuation-runbook.md` | Full context reproduction + execution workflow | Read FIRST | +| `story-tracker.md` | Current progress and status | Check/update BEFORE and AFTER every story | +| `milestone-plan.md` | Complete plan with specifications | Reference implementation details | +| `original-plan.md` | Original approved plan | Reference original intent | +| `final-transcript.md` | Final planning transcript | Reference reasoning/context | + +Do NOT reference planner-private files during implementation. + +## Skill Workflow Guardrails + +- Invoke relevant skills before action using native skill discovery. +- Announce which skill is being used and why. +- If a checklist-driven skill applies, track checklist execution explicitly. +- Do not use deprecated CLI wrappers for skill invocation. + +--- + +## Quick Resume Instructions + +1. Read this runbook completely. +2. Check `story-tracker.md`. +3. Find next `pending` story and mark as `in-dev` before starting. +4. Implement the story. +5. Update tracker immediately after each change. + +--- + +## Mandatory Execution Workflow + +Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow this order: + +1. Read `continuation-runbook.md` first. +2. Execute stories milestone by milestone. +3. After completing a milestone: + - Run lint/typecheck/tests, prioritizing changed files for speed. + - Commit locally (**DO NOT PUSH**). + - Stop and ask user for feedback. +4. If feedback is provided: + - Apply feedback changes. + - Re-run checks for changed files. + - Commit locally again. + - Ask for milestone approval. +5. Only move to next milestone after explicit approval. +6. After all milestones are completed and approved: + - Ask permission to push. + - If approved, push. + - Mark plan status as `completed`. + +--- + +## Git Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates inside `ai_plan/` as an error. + +--- + +## Full Context Reproduction + +### Project Overview + +[What this project/feature is about] + +### User Requirements + +[All gathered requirements] + +### Scope + +[In scope / out of scope] + +### Dependencies + +[External dependencies, prerequisites, related systems] + +--- + +## Key Specifications + +### Type Definitions + +```typescript +// Copy-paste ready type definitions +``` + +### Enums & Constants + +```typescript +// All enums/constants needed +``` + +### API Endpoints + +```typescript +// Request/response shapes +``` + +--- + +## Critical Design Decisions + +| Decision | Chosen Approach | Alternatives Rejected | Rationale | +|----------|-----------------|----------------------|-----------| +| [Topic] | [What we chose] | [Other options] | [Why] | + +--- + +## Verification Commands + +### Lint (changed files first) + +```bash +# example: +``` + +### Typecheck + +```bash +# example: +``` + +### Tests (target changed scope first) + +```bash +# example: +``` + +--- + +## File Quick Reference + +| File | Purpose | +|------|---------| +| `original-plan.md` | Original approved plan | +| `final-transcript.md` | Final planning transcript | +| `milestone-plan.md` | Full specification | +| `story-tracker.md` | Current progress tracker | +| `continuation-runbook.md` | This runbook | diff --git a/skills/create-plan/_source/codex/templates/milestone-plan.md b/skills/create-plan/_source/codex/templates/milestone-plan.md new file mode 100644 index 0000000..36ce980 --- /dev/null +++ b/skills/create-plan/_source/codex/templates/milestone-plan.md @@ -0,0 +1,125 @@ +# [Plan Title] + +## Overview + +- **Goal:** [One sentence describing the end state] +- **Created:** YYYY-MM-DD +- **Status:** In Progress | Complete + +## Planning Guardrails + +- This plan assumes design was validated before implementation planning. +- Skills are invoked via native discovery (Codex: `~/.agents/skills/`). +- Deprecated CLI wrappers (for example, `superpowers-codex bootstrap` / `use-skill`) are not part of this workflow. +- Milestones require verification + local commits + explicit approval before proceeding. + +## Context + +### Requirements + +[Gathered requirements from user questions] + +### Constraints + +[Technical, business, or timeline constraints] + +### Success Criteria + +[How we know this is complete] + +## Architecture + +### Design Decisions + +[Key architectural choices and rationale] + +### Component Relationships + +[How pieces fit together] + +### Data Flow + +[How data moves through the system] + +## Milestones + +### M1: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-101, S-102, S-103... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +### M2: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-201, S-202, S-203... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +## Technical Specifications + +### Types & Interfaces + +```typescript +// Key type definitions (or equivalent language constructs) +``` + +### API Contracts + +```typescript +// Endpoint signatures, request/response shapes (if applicable) +``` + +### Constants & Enums + +```typescript +// Shared constants (if applicable) +``` + +## Files Inventory + +| File | Purpose | Milestone | +|------|---------|-----------| +| `path/to/file.ts` | [What it does] | M1 | +| `path/to/other.ts` | [What it does] | M2 | + +--- + +## Related Plan Files + +This file is part of the plan folder under `ai_plan/`: + +- `original-plan.md` - Original approved plan (reference for original intent) +- `final-transcript.md` - Final planning transcript (reference for rationale/context) +- `milestone-plan.md` - This file (full specification) +- `story-tracker.md` - Status tracking (must be kept up to date) +- `continuation-runbook.md` - Resume/execution context (read first) diff --git a/skills/create-plan/_source/codex/templates/story-tracker.md b/skills/create-plan/_source/codex/templates/story-tracker.md new file mode 100644 index 0000000..b08681d --- /dev/null +++ b/skills/create-plan/_source/codex/templates/story-tracker.md @@ -0,0 +1,78 @@ +# Story Tracker: [Plan Title] + +## Progress Summary + +- **Current Milestone:** M1 +- **Stories Complete:** 0/N +- **Milestones Approved:** 0/M +- **Last Updated:** YYYY-MM-DD + +## Tracking Guardrails + +- Update status immediately when work starts (`in-dev`) and when work completes (`completed`). +- Require explicit user approval at each milestone boundary before continuing. +- Do not push until all milestones are approved and permission is explicitly granted. +- Keep this file and `milestone-plan.md` synchronized. + +--- + +## Milestones + +### M1: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-101 | [Brief description] | pending | | +| S-102 | [Brief description] | pending | | +| S-103 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +### M2: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-201 | [Brief description] | pending | | +| S-202 | [Brief description] | pending | | +| S-203 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +## Status Legend + +| Status | Meaning | +|--------|---------| +| `pending` | Not started | +| `in-dev` | Currently being worked on | +| `completed` | Done - include commit hash in Notes | +| `deferred` | Postponed - include reason in Notes | + +## Update Instructions (MANDATORY) + +Before starting any story: + +1. Mark story as `in-dev` +2. Update "Last Updated" + +After completing any story: + +1. Mark story as `completed` +2. Add local commit hash to Notes +3. Update "Stories Complete" and "Last Updated" + +At milestone boundary: + +1. Run lint/typecheck/tests for changed files +2. Commit (no push) +3. Request feedback +4. Apply feedback, re-check changed files, commit again +5. Mark milestone **Approval Status: approved** only after user confirms +6. Continue only after approval + +After all milestones approved: + +- Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/_source/cursor/SKILL.md b/skills/create-plan/_source/cursor/SKILL.md new file mode 100644 index 0000000..24016af --- /dev/null +++ b/skills/create-plan/_source/cursor/SKILL.md @@ -0,0 +1,649 @@ +--- +name: create-plan +description: Use when starting a new feature, project, or complex task that needs structured planning with milestones, bite-sized stories, and resumable execution context in Cursor Agent CLI workflows. ALWAYS invoke when user says "create a plan", "make a plan", "plan this", "start planning", or similar planning requests. +--- + +# Create Plan (Cursor Agent CLI) + +Create and maintain a local plan folder under `ai_plan/` at project root. + +## Overview + +This skill wraps the current Superpowers flow for the Cursor Agent CLI (`cursor-agent`): + +1. Design first with `superpowers:brainstorming` +2. Then build an implementation plan with `superpowers:writing-plans` +3. Review the plan iteratively with a second model/provider +4. Persist a local execution package in `ai_plan/YYYY-MM-DD-/` + +**Core principle:** Cursor Agent CLI discovers skills from `.cursor/skills/` (repo-local), `~/.cursor/skills/` (global), and installed Cursor plugin cache entries. It also reads `AGENTS.md` at the repo root for additional instructions. + +## Prerequisite Check (MANDATORY) + +Required: + +- Cursor Agent CLI: `cursor-agent --version` (install via `curl https://cursor.com/install -fsS | bash`). The binary is `cursor-agent` (installed to `~/.local/bin/`). Some environments alias it as `cursor agent` (subcommand of the Cursor IDE CLI) — both forms work, but this skill uses `cursor-agent` throughout. +- `jq` (required only if using `cursor` as the reviewer CLI): `jq --version` (install via `brew install jq` or your package manager) +- Superpowers repo: `https://github.com/obra/superpowers` +- Superpowers skills available from the Cursor plugin cache, `.cursor/skills/` (repo-local), or `~/.cursor/skills/` (global). Do not install both the plugin and a manual Superpowers copy, or Cursor may show duplicate skill entries. +- `superpowers:brainstorming` +- `superpowers:writing-plans` + +Verify before proceeding: + +```bash +cursor-agent --version +test -f .cursor/skills/superpowers/skills/brainstorming/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/brainstorming/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/brainstorming/SKILL.md' -print -quit 2>/dev/null | grep -q . +test -f .cursor/skills/superpowers/skills/writing-plans/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/writing-plans/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/writing-plans/SKILL.md' -print -quit 2>/dev/null | grep -q . +# Only if using cursor as reviewer CLI: +# jq --version +``` + +If any dependency is missing, stop and return: + +`Missing dependency: Superpowers planning skills are required (superpowers:brainstorming, superpowers:writing-plans). Install the Cursor Superpowers plugin or install Superpowers under .cursor/skills/ or ~/.cursor/skills/, then retry.` + +## Required Skill Invocation Rules + +- Invoke relevant skills through Cursor-native discovery (`.cursor/skills/`, `~/.cursor/skills/`, or installed Cursor plugin cache entries). +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- For skills with checklists, track checklist items explicitly in conversation. + +## Process + +### Phase 1: Analyze + +- Explore the codebase and existing patterns. + +### Phase 2: Gather Requirements + +- Ask questions one at a time until user says ready. +- Confirm scope, constraints, success criteria, dependencies. + +### Phase 3: Configure Reviewer + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +If the user has already specified a reviewer CLI and model (e.g., "create a plan, review with codex o4-mini"), use those values. Otherwise, ask: + +1. **Which CLI should review the plan?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed directly to file generation + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see your account's available models (availability varies by subscription) + - Accept any model string the user provides + +3. **Max review rounds for the plan?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store the chosen `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phase 6 (Iterative Plan Review). + +### Phase 4: Design (REQUIRED SUB-SKILL) + +Invoke `superpowers:brainstorming`, then propose 2-3 approaches and recommend one. + +### Phase 5: Plan (REQUIRED SUB-SKILL) + +Invoke `superpowers:writing-plans`, then break work into milestones and bite-sized stories. +Story IDs: `S-{milestone}{sequence}`. + +### Phase 6: Iterative Plan Review + +Send the plan to the configured reviewer CLI for feedback. Revise and re-submit until approved (default max 10 rounds). + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use for temp artifacts: + +- `/tmp/plan-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.json` (Cursor only) +- `/tmp/plan-review-${REVIEW_ID}.stderr` +- `/tmp/plan-review-${REVIEW_ID}.status` +- `/tmp/plan-review-${REVIEW_ID}.runner.out` +- `/tmp/plan-review-${REVIEW_ID}.sh` + +Resolve the shared reviewer helper from Cursor's installed skills directory: + +```bash +if [ -x .cursor/skills/reviewer-runtime/run-review.sh ]; then + REVIEWER_RUNTIME=.cursor/skills/reviewer-runtime/run-review.sh +else + REVIEWER_RUNTIME=~/.cursor/skills/reviewer-runtime/run-review.sh +fi +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.json) + ;; +esac +``` + +#### Step 2: Write Plan to Temp File + +Write the complete plan (milestones, stories, design decisions, specs) to `/tmp/plan-${REVIEW_ID}.md`. + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/plan-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "Review the implementation plan in /tmp/plan-${REVIEW_ID}.md. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: `), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review the implementation plan below. Focus on: + +$(cat /tmp/plan-${REVIEW_ID}.md) + +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/plan-${REVIEW_ID}.md and review the implementation plan. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/plan-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. + +Notes on Cursor flags: + +- `--mode=ask` — read-only mode, no file modifications +- `--trust` — trust workspace without prompting (required for non-interactive use) +- `-p` / `--print` — non-interactive mode, output to stdout +- `--output-format json` — structured output with `session_id` and `result` fields + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/plan-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/plan-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/plan-review-${REVIEW_ID}.stderr \ + --status-file /tmp/plan-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/plan-review-${REVIEW_ID}.sh >/tmp/plan-review-${REVIEW_ID}.runner.out 2>/tmp/plan-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/plan-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/plan-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md +``` + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/plan-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/plan-review-${REVIEW_ID}.stderr` + - `/tmp/plan-review-${REVIEW_ID}.status` + - `/tmp/plan-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 7 (Initialize workspace) + - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as approved + - Helper state `completed-empty-output` → treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached → present the outcome to the user for a manual decision (proceed or stop) + +#### Step 5: Revise the Plan + +Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P3` when practical). Update the plan in conversation context and rewrite `/tmp/plan-${REVIEW_ID}.md`. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this plan and requested revisions. Read the updated payload at /tmp/plan-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed an implementation plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised the plan. Updated version is below. + +$(cat /tmp/plan-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review the full plan using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +After updating `/tmp/plan-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Present Final Result + +```markdown +## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +**Status:** Approved after N round(s) +[or] +**Status:** Max rounds (`MAX_ROUNDS`) reached — not fully approved + +[Final feedback / remaining concerns] +``` + +#### Step 8: Cleanup + +```bash +rm -f /tmp/plan-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.json \ + /tmp/plan-review-${REVIEW_ID}.stderr \ + /tmp/plan-review-${REVIEW_ID}.status \ + /tmp/plan-review-${REVIEW_ID}.runner.out \ + /tmp/plan-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 7: Initialize Local Plan Workspace (MANDATORY) + +At project root: + +1. Ensure `ai_plan/` exists. Create it if missing. +2. Ensure `.gitignore` contains `/ai_plan/`. +3. If `.gitignore` was changed, commit that change immediately (local commit only). + +Recommended commit message: + +- `chore(gitignore): ignore ai_plan local planning artifacts` + +### Phase 8: Generate Plan Files (MANDATORY) + +Create `ai_plan/YYYY-MM-DD-/` with all files below: + +1. `original-plan.md` - copy of original planner-generated plan. +2. `final-transcript.md` - copy of final planning transcript used to reach approved plan. +3. `milestone-plan.md` - full implementation spec (from template). +4. `story-tracker.md` - story/milestone status tracker (from template). +5. `continuation-runbook.md` - execution instructions and context (from template). + +Use templates from this skill's `templates/` folder. + +### Phase 9: Handoff + +Always instruct the executing agent: +> Read `ai_plan/YYYY-MM-DD-/continuation-runbook.md` first, then execute from that folder. + +Do not rely on planner-private files during implementation. + +### Phase 10: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from Cursor's installed skills directory: + +```bash +if [ -x .cursor/skills/reviewer-runtime/notify-telegram.sh ]; then + TELEGRAM_NOTIFY_RUNTIME=.cursor/skills/reviewer-runtime/notify-telegram.sh +else + TELEGRAM_NOTIFY_RUNTIME=~/.cursor/skills/reviewer-runtime/notify-telegram.sh +fi +``` + +On every terminal outcome for the create-plan run (approved, max rounds reached, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "create-plan completed for : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Quick Reference + +| Phase | Action | Required Output | +|---|---|---| +| 1 | Analyze codebase/context | Constraints and known patterns | +| 2 | Gather requirements (one question at a time) | Confirmed scope and success criteria | +| 3 | Configure reviewer CLI and model | `REVIEWER_CLI`, `REVIEWER_MODEL`, `MAX_ROUNDS` (or `skip`) | +| 4 | Invoke `superpowers:brainstorming` | Chosen design approach | +| 5 | Invoke `superpowers:writing-plans` | Milestones and bite-sized stories | +| 6 | Iterative plan review (max `MAX_ROUNDS` rounds) | Reviewer approval or max-rounds warning | +| 7 | Initialize `ai_plan/` + `.gitignore` | Local planning workspace ready | +| 8 | Build plan package from templates | Full plan folder with required files | +| 9 | Handoff with runbook-first instruction | Resumable execution context | +| 10 | Send Telegram notification | User notified or notification status reported | + +## Tracker Discipline (MANDATORY) + +Before starting any story: + +1. Open `story-tracker.md` +2. Mark story `in-dev` +3. Add notes if relevant +4. Then begin implementation + +After completing any story: + +1. Mark story `completed` +2. Add commit hash in Notes +3. Review pending stories +4. Update Last Updated and Stories Complete counts + +## Execution Rules to Include in Plan (MANDATORY) + +- Run lint/typecheck/tests after each milestone. +- Prefer linting changed files only for speed. +- Commit locally after each completed milestone (**do not push**). +- Stop and ask user for feedback. +- Apply feedback, rerun checks, and commit again. +- Move to next milestone only after user approval. +- After all milestones are completed and approved, ask permission to push. +- Only after approved push: mark plan as completed. + +## Gitignore Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates in `ai_plan/` as a problem. + +## Common Mistakes + +- Forgetting `--trust` flag when running `cursor-agent` non-interactively (causes interactive prompt). +- Using `--mode=agent` or `--force` for reviews (reviewer should be read-only, use `--mode=ask`). +- Jumping to implementation planning without running `superpowers:brainstorming` first. +- Asking multiple requirement questions in one message. +- Forgetting to create/update `.gitignore` for `/ai_plan/`. +- Omitting one or more required files in the plan package. +- Handoff without explicit "read runbook first" direction. +- Skipping the reviewer phase without explicit user opt-out. +- Using any notification path other than Telegram. + +## Red Flags - Stop and Correct + +- You started writing milestones before design validation. +- You did not announce which skill you invoked and why. +- You are marking planning complete without all required files. +- Handoff does not explicitly point to `continuation-runbook.md`. +- You are applying a reviewer suggestion that contradicts user requirements. +- Reviewer CLI is running with write permissions (must be read-only). + +## Verification Checklist + +- [ ] `ai_plan/` exists at project root +- [ ] `.gitignore` includes `/ai_plan/` +- [ ] `.gitignore` ignore-rule commit was created if needed +- [ ] Plan directory created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Plan review completed (approved or max rounds) — or skipped +- [ ] `original-plan.md` present +- [ ] `final-transcript.md` present +- [ ] `milestone-plan.md` present +- [ ] `story-tracker.md` present +- [ ] `continuation-runbook.md` present +- [ ] Handoff explicitly says to read runbook first and execute from plan folder +- [ ] Telegram notification attempted if configured + +## Exit Triggers for Question Phase + +User says: "ready", "done", "let's plan", "proceed", "enough questions" diff --git a/skills/create-plan/_source/cursor/templates/continuation-runbook.md b/skills/create-plan/_source/cursor/templates/continuation-runbook.md new file mode 100644 index 0000000..1fac6bf --- /dev/null +++ b/skills/create-plan/_source/cursor/templates/continuation-runbook.md @@ -0,0 +1,144 @@ +# Continuation Runbook: [Plan Title] + +## Reference Files (START HERE) + +Upon resumption, these files in this folder are the ONLY source of truth: + +| File | Purpose | When to Use | +|------|---------|-------------| +| `continuation-runbook.md` | Full context reproduction + execution workflow | Read FIRST | +| `story-tracker.md` | Current progress and status | Check/update BEFORE and AFTER every story | +| `milestone-plan.md` | Complete plan with specifications | Reference implementation details | +| `original-plan.md` | Original approved plan | Reference original intent | +| `final-transcript.md` | Final planning transcript | Reference reasoning/context | + +Do NOT reference planner-private files during implementation. + +## Skill Workflow Guardrails + +- Invoke relevant skills before action using workspace discovery (`.cursor/skills/`). +- Announce which skill is being used and why. +- If a checklist-driven skill applies, track checklist execution explicitly. + +--- + +## Quick Resume Instructions + +1. Read this runbook completely. +2. Check `story-tracker.md`. +3. Find next `pending` story and mark as `in-dev` before starting. +4. Implement the story. +5. Update tracker immediately after each change. + +--- + +## Mandatory Execution Workflow + +Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow this order: + +1. Read `continuation-runbook.md` first. +2. Execute stories milestone by milestone. +3. After completing a milestone: + - Run lint/typecheck/tests, prioritizing changed files for speed. + - Commit locally (**DO NOT PUSH**). + - Stop and ask user for feedback. +4. If feedback is provided: + - Apply feedback changes. + - Re-run checks for changed files. + - Commit locally again. + - Ask for milestone approval. +5. Only move to next milestone after explicit approval. +6. After all milestones are completed and approved: + - Ask permission to push. + - If approved, push. + - Mark plan status as `completed`. + +--- + +## Git Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates inside `ai_plan/` as an error. + +--- + +## Full Context Reproduction + +### Project Overview + +[What this project/feature is about] + +### User Requirements + +[All gathered requirements] + +### Scope + +[In scope / out of scope] + +### Dependencies + +[External dependencies, prerequisites, related systems] + +--- + +## Key Specifications + +### Type Definitions + +```typescript +// Copy-paste ready type definitions +``` + +### Enums & Constants + +```typescript +// All enums/constants needed +``` + +### API Endpoints + +```typescript +// Request/response shapes +``` + +--- + +## Critical Design Decisions + +| Decision | Chosen Approach | Alternatives Rejected | Rationale | +|----------|-----------------|----------------------|-----------| +| [Topic] | [What we chose] | [Other options] | [Why] | + +--- + +## Verification Commands + +### Lint (changed files first) + +```bash +# example: +``` + +### Typecheck + +```bash +# example: +``` + +### Tests (target changed scope first) + +```bash +# example: +``` + +--- + +## File Quick Reference + +| File | Purpose | +|------|---------| +| `original-plan.md` | Original approved plan | +| `final-transcript.md` | Final planning transcript | +| `milestone-plan.md` | Full specification | +| `story-tracker.md` | Current progress tracker | +| `continuation-runbook.md` | This runbook | diff --git a/skills/create-plan/_source/cursor/templates/milestone-plan.md b/skills/create-plan/_source/cursor/templates/milestone-plan.md new file mode 100644 index 0000000..2a04aaa --- /dev/null +++ b/skills/create-plan/_source/cursor/templates/milestone-plan.md @@ -0,0 +1,124 @@ +# [Plan Title] + +## Overview + +- **Goal:** [One sentence describing the end state] +- **Created:** YYYY-MM-DD +- **Status:** In Progress | Complete + +## Planning Guardrails + +- This plan assumes design was validated before implementation planning. +- Skills are invoked via workspace discovery (`.cursor/skills/`). +- Milestones require verification + local commits + explicit approval before proceeding. + +## Context + +### Requirements + +[Gathered requirements from user questions] + +### Constraints + +[Technical, business, or timeline constraints] + +### Success Criteria + +[How we know this is complete] + +## Architecture + +### Design Decisions + +[Key architectural choices and rationale] + +### Component Relationships + +[How pieces fit together] + +### Data Flow + +[How data moves through the system] + +## Milestones + +### M1: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-101, S-102, S-103... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +### M2: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-201, S-202, S-203... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +## Technical Specifications + +### Types & Interfaces + +```typescript +// Key type definitions (or equivalent language constructs) +``` + +### API Contracts + +```typescript +// Endpoint signatures, request/response shapes (if applicable) +``` + +### Constants & Enums + +```typescript +// Shared constants (if applicable) +``` + +## Files Inventory + +| File | Purpose | Milestone | +|------|---------|-----------| +| `path/to/file.ts` | [What it does] | M1 | +| `path/to/other.ts` | [What it does] | M2 | + +--- + +## Related Plan Files + +This file is part of the plan folder under `ai_plan/`: + +- `original-plan.md` - Original approved plan (reference for original intent) +- `final-transcript.md` - Final planning transcript (reference for rationale/context) +- `milestone-plan.md` - This file (full specification) +- `story-tracker.md` - Status tracking (must be kept up to date) +- `continuation-runbook.md` - Resume/execution context (read first) diff --git a/skills/create-plan/_source/cursor/templates/story-tracker.md b/skills/create-plan/_source/cursor/templates/story-tracker.md new file mode 100644 index 0000000..b08681d --- /dev/null +++ b/skills/create-plan/_source/cursor/templates/story-tracker.md @@ -0,0 +1,78 @@ +# Story Tracker: [Plan Title] + +## Progress Summary + +- **Current Milestone:** M1 +- **Stories Complete:** 0/N +- **Milestones Approved:** 0/M +- **Last Updated:** YYYY-MM-DD + +## Tracking Guardrails + +- Update status immediately when work starts (`in-dev`) and when work completes (`completed`). +- Require explicit user approval at each milestone boundary before continuing. +- Do not push until all milestones are approved and permission is explicitly granted. +- Keep this file and `milestone-plan.md` synchronized. + +--- + +## Milestones + +### M1: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-101 | [Brief description] | pending | | +| S-102 | [Brief description] | pending | | +| S-103 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +### M2: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-201 | [Brief description] | pending | | +| S-202 | [Brief description] | pending | | +| S-203 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +## Status Legend + +| Status | Meaning | +|--------|---------| +| `pending` | Not started | +| `in-dev` | Currently being worked on | +| `completed` | Done - include commit hash in Notes | +| `deferred` | Postponed - include reason in Notes | + +## Update Instructions (MANDATORY) + +Before starting any story: + +1. Mark story as `in-dev` +2. Update "Last Updated" + +After completing any story: + +1. Mark story as `completed` +2. Add local commit hash to Notes +3. Update "Stories Complete" and "Last Updated" + +At milestone boundary: + +1. Run lint/typecheck/tests for changed files +2. Commit (no push) +3. Request feedback +4. Apply feedback, re-check changed files, commit again +5. Mark milestone **Approval Status: approved** only after user confirms +6. Continue only after approval + +After all milestones approved: + +- Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/_source/opencode/SKILL.md b/skills/create-plan/_source/opencode/SKILL.md new file mode 100644 index 0000000..86eecd8 --- /dev/null +++ b/skills/create-plan/_source/opencode/SKILL.md @@ -0,0 +1,717 @@ +--- +name: create-plan +description: Use when starting a new feature, project, or complex task that needs structured planning with milestones, bite-sized stories, and resumable execution context in Opencode workflows. ALWAYS invoke when user says "create a plan", "make a plan", "plan this", "start planning", or similar planning requests. +--- + +# Create Plan (OpenCode) + +Create and maintain a local plan folder under `ai_plan/` at project root. + +## Prerequisite Check (MANDATORY) + +This OpenCode variant depends on Superpowers skills being available through OpenCode's native skill system. + +Required: + +- Superpowers repo: `https://github.com/obra/superpowers` +- OpenCode Superpowers skills available at `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers` +- `superpowers/brainstorming` +- `superpowers/writing-plans` + +Verify before proceeding: + +```bash +test -f ~/.agents/skills/superpowers/brainstorming/SKILL.md || test -f ~/.config/opencode/skills/superpowers/brainstorming/SKILL.md +test -f ~/.agents/skills/superpowers/writing-plans/SKILL.md || test -f ~/.config/opencode/skills/superpowers/writing-plans/SKILL.md +``` + +If dependencies are missing, stop immediately and return: + +"Missing dependency: OpenCode Superpowers skills are required (`superpowers/brainstorming`, `superpowers/writing-plans`). Install from https://github.com/obra/superpowers (OpenCode setup), then retry." + +## Process + +### Phase 1: Bootstrap Superpowers Context (REQUIRED) + +Use OpenCode's native skill tool: + +- list skills +- verify `superpowers/brainstorming` and `superpowers/writing-plans` are discoverable + +### Phase 2: Analyze + +- Explore the codebase and existing patterns. + +### Phase 3: Gather Requirements + +- Ask questions ONE AT A TIME until user says ready. +- Cover scope, constraints, success criteria, dependencies. +- Summarize before proceeding. + +### Phase 4: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "create a plan, review with codex o4-mini"), use those values. Otherwise, ask: + +1. **Which CLI should review the plan?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed directly to file generation + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see your account's available models (availability varies by subscription) + - Accept any model string the user provides + +3. **Max review rounds for the plan?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store the chosen `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phase 7 (Iterative Plan Review). + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 5: Design (REQUIRED SUB-SKILL) + +Use OpenCode's native skill tool to load: + +- `superpowers/brainstorming` + +Then present 2-3 approaches and recommend one. + +### Phase 6: Plan (REQUIRED SUB-SKILL) + +Use OpenCode's native skill tool to load: + +- `superpowers/writing-plans` + +Then break into milestones and bite-sized stories (2-5 min each). +Story IDs: `S-{milestone}{sequence}`. + +### Phase 7: Iterative Plan Review + +Send the plan to the configured reviewer CLI for feedback. Revise and re-submit until approved (default max 10 rounds). + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use for temp artifacts: + +- `/tmp/plan-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.json` (Cursor only) +- `/tmp/plan-review-${REVIEW_ID}.stderr` +- `/tmp/plan-review-${REVIEW_ID}.status` +- `/tmp/plan-review-${REVIEW_ID}.runner.out` +- `/tmp/plan-review-${REVIEW_ID}.sh` + +Resolve the shared reviewer helper from the installed OpenCode skills directory: + +```bash +REVIEWER_RUNTIME=~/.config/opencode/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.json) + ;; + opencode) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.md) + ;; +esac +``` + +#### Step 2: Write Plan to Temp File + +Write the complete plan (milestones, stories, design decisions, specs) to `/tmp/plan-${REVIEW_ID}.md`. + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/plan-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "Review the implementation plan in /tmp/plan-${REVIEW_ID}.md. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: `), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review the implementation plan below. Focus on: + +$(cat /tmp/plan-${REVIEW_ID}.md) + +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/plan-${REVIEW_ID}.md and review the implementation plan. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/plan-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. + +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode uses `--agent plan` for read-oriented review. Fresh call is the recommended default. + +Round 1: + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/plan-${REVIEW_ID}.md and review the implementation plan. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use \`- None.\` when a severity has no findings. +- \`P0\` = total blocker, \`P1\` = major risk, \`P2\` = must-fix before approval, \`P3\` = cosmetic / nice to have. +- End with exactly one verdict line: \`VERDICT: APPROVED\` or \`VERDICT: REVISE\` +- \`VERDICT: APPROVED\` is allowed only when there are no \`P0\`, \`P1\`, or \`P2\` findings. \`P3\` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call, recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +Extract the review body: + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/plan-review-${REVIEW_ID}.json \ + > /tmp/plan-review-${REVIEW_ID}.md \ + || cp /tmp/plan-review-${REVIEW_ID}.json /tmp/plan-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output. On any opencode +CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the +helper-failure escalation in Step 4. + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/plan-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/plan-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/plan-review-${REVIEW_ID}.stderr \ + --status-file /tmp/plan-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/plan-review-${REVIEW_ID}.sh >/tmp/plan-review-${REVIEW_ID}.runner.out 2>/tmp/plan-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/plan-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/plan-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=opencode`, the `jq` extraction above covers output capture. If it falls through, copy runner output: `cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md`. On Round 1, also attempt to capture the session id for optional use in subsequent rounds: `OPENCODE_SESSION_ID=$(jq -r 'if type == "array" then (.[0] | (.id? // .session_id?)) else (.id? // .session_id?) end // empty' /tmp/plan-review-${REVIEW_ID}.json 2>/dev/null || true)` +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md +``` + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/plan-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/plan-review-${REVIEW_ID}.stderr` + - `/tmp/plan-review-${REVIEW_ID}.status` + - `/tmp/plan-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 8 (Initialize workspace) + - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as approved + - Helper state `completed-empty-output` → treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached → present the outcome to the user for a manual decision (proceed or stop) + +#### Step 5: Revise the Plan + +Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P3` when practical). Update the plan in conversation context and rewrite `/tmp/plan-${REVIEW_ID}.md`. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this plan and requested revisions. Read the updated payload at /tmp/plan-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/plan-review-${REVIEW_ID}.md \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed an implementation plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised the plan. Updated version is below. + +$(cat /tmp/plan-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review the full plan using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_ID}.md +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +**If `REVIEWER_CLI` is `opencode`:** + +Fresh call (recommended default — opencode has no guaranteed stable session ID in headless mode): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/plan-review-${REVIEW_ID}.json \ + > /tmp/plan-review-${REVIEW_ID}.md \ + || cp /tmp/plan-review-${REVIEW_ID}.json /tmp/plan-review-${REVIEW_ID}.md +``` + +Optional session-resume path (only if `OPENCODE_SESSION_ID` was captured on Round 1 and your installed opencode accepts `-s ` reliably in headless mode): + +```bash +opencode run \ + -s ${OPENCODE_SESSION_ID} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/plan-review-${REVIEW_ID}.json \ + > /tmp/plan-review-${REVIEW_ID}.md \ + || cp /tmp/plan-review-${REVIEW_ID}.json /tmp/plan-review-${REVIEW_ID}.md +``` + +If session resume fails (session expired or not supported), fall back to the fresh-call path above. + +After updating `/tmp/plan-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Present Final Result + +```markdown +## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +**Status:** Approved after N round(s) +[or] +**Status:** Max rounds (`MAX_ROUNDS`) reached — not fully approved + +[Final feedback / remaining concerns] +``` + +#### Step 8: Cleanup + +```bash +rm -f /tmp/plan-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.md \ + /tmp/plan-review-${REVIEW_ID}.json \ + /tmp/plan-review-${REVIEW_ID}.stderr \ + /tmp/plan-review-${REVIEW_ID}.status \ + /tmp/plan-review-${REVIEW_ID}.runner.out \ + /tmp/plan-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 8: Initialize Local Plan Workspace (MANDATORY) + +At project root: + +1. Ensure `ai_plan/` exists. Create it if missing. +2. Ensure `.gitignore` contains `/ai_plan/`. +3. If `.gitignore` was changed, commit that change immediately (local commit only). + +Recommended commit message: + +- `chore(gitignore): ignore ai_plan local planning artifacts` + +### Phase 9: Generate Plan Files (MANDATORY) + +Create `ai_plan/YYYY-MM-DD-/` with ALL files: + +1. `original-plan.md` - copy of original planner-generated plan. +2. `final-transcript.md` - copy of final planning transcript used to reach approved plan. +3. `milestone-plan.md` - full implementation spec (template-based). +4. `story-tracker.md` - status tracking (template-based, all stories start as `pending`). +5. `continuation-runbook.md` - resume context and execution protocol (template-based). + +Use templates from this skill's `templates/` folder. + +### Phase 10: Handoff + +Always instruct the executing agent: +> Read `ai_plan/YYYY-MM-DD-/continuation-runbook.md` first, then execute from `ai_plan` files only. + +### Phase 11: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from the installed OpenCode skills directory: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.config/opencode/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome for the create-plan run (approved, max rounds reached, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "create-plan completed for : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Tracker Discipline (MANDATORY) + +Before starting any story: + +1. Open `story-tracker.md` +2. Mark story `in-dev` +3. Add notes if relevant +4. Then begin implementation + +After completing any story: + +1. Mark story `completed` +2. Add commit hash in Notes +3. Review pending stories +4. Update Last Updated and Stories Complete counts + +## Execution Rules to Include in Plan (MANDATORY) + +- Run lint/typecheck/tests after each milestone. +- Prefer linting changed files only for speed. +- Commit locally after each completed milestone (**do not push**). +- Stop and ask user for feedback. +- Apply feedback, rerun checks, and commit again. +- Move to next milestone only after user approval. +- After all milestones are completed and approved, ask permission to push. +- Only after approved push: mark plan as completed. + +## Gitignore Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates in `ai_plan/` as a problem. + +## Verification Checklist + +- [ ] `ai_plan/` exists at project root +- [ ] `.gitignore` includes `/ai_plan/` +- [ ] `.gitignore` ignore-rule commit was created if needed +- [ ] Plan directory created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Plan review completed (approved or max rounds) — or skipped +- [ ] `original-plan.md` present +- [ ] `final-transcript.md` present +- [ ] `milestone-plan.md` present +- [ ] `story-tracker.md` created with all stories as `pending` +- [ ] `continuation-runbook.md` present +- [ ] Handoff explicitly says to read runbook first and execute from plan folder +- [ ] Telegram notification attempted if configured + +## Exit Triggers for Question Phase + +User says: "ready", "done", "let's plan", "proceed", "enough questions" diff --git a/skills/create-plan/_source/opencode/templates/continuation-runbook.md b/skills/create-plan/_source/opencode/templates/continuation-runbook.md new file mode 100644 index 0000000..11ca6e7 --- /dev/null +++ b/skills/create-plan/_source/opencode/templates/continuation-runbook.md @@ -0,0 +1,138 @@ +# Continuation Runbook: [Plan Title] + +## Reference Files (START HERE) + +Upon resumption, these files in this folder are the ONLY source of truth: + +| File | Purpose | When to Use | +|------|---------|-------------| +| `continuation-runbook.md` | Full context reproduction + execution workflow | Read FIRST | +| `story-tracker.md` | Current progress and status | Check/update BEFORE and AFTER every story | +| `milestone-plan.md` | Complete plan with specifications | Reference implementation details | +| `original-plan.md` | Original approved plan | Reference original intent | +| `final-transcript.md` | Final planning transcript | Reference reasoning/context | + +Do NOT reference planner-private files during implementation. + +--- + +## Quick Resume Instructions + +1. Read this runbook completely. +2. Check `story-tracker.md`. +3. Find next `pending` story and mark as `in-dev` before starting. +4. Implement the story. +5. Update tracker immediately after each change. + +--- + +## Mandatory Execution Workflow + +Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow this order: + +1. Read `continuation-runbook.md` first. +2. Execute stories milestone by milestone. +3. After completing a milestone: + - Run lint/typecheck/tests, prioritizing changed files for speed. + - Commit locally (**DO NOT PUSH**). + - Stop and ask user for feedback. +4. If feedback is provided: + - Apply feedback changes. + - Re-run checks for changed files. + - Commit locally again. + - Ask for milestone approval. +5. Only move to next milestone after explicit approval. +6. After all milestones are completed and approved: + - Ask permission to push. + - If approved, push. + - Mark plan status as `completed`. + +--- + +## Git Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates inside `ai_plan/` as an error. + +--- + +## Full Context Reproduction + +### Project Overview + +[What this project/feature is about] + +### User Requirements + +[All gathered requirements] + +### Scope + +[In scope / out of scope] + +### Dependencies + +[External dependencies, prerequisites, related systems] + +--- + +## Key Specifications + +### Type Definitions + +```typescript +// Copy-paste ready type definitions +``` + +### Enums & Constants + +```typescript +// All enums/constants needed +``` + +### API Endpoints + +```typescript +// Request/response shapes +``` + +--- + +## Critical Design Decisions + +| Decision | Chosen Approach | Alternatives Rejected | Rationale | +|----------|-----------------|----------------------|-----------| +| [Topic] | [What we chose] | [Other options] | [Why] | + +--- + +## Verification Commands + +### Lint (changed files first) + +```bash +# example: pnpm eslint +``` + +### Typecheck + +```bash +# example: pnpm tsc --noEmit +``` + +### Tests (target changed scope first) + +```bash +# example: pnpm test -- +``` + +--- + +## File Quick Reference + +| File | Purpose | +|------|---------| +| `original-plan.md` | Original approved plan | +| `final-transcript.md` | Final planning transcript | +| `milestone-plan.md` | Full specification | +| `story-tracker.md` | Current progress tracker | +| `continuation-runbook.md` | This runbook | diff --git a/skills/create-plan/_source/opencode/templates/milestone-plan.md b/skills/create-plan/_source/opencode/templates/milestone-plan.md new file mode 100644 index 0000000..f646b48 --- /dev/null +++ b/skills/create-plan/_source/opencode/templates/milestone-plan.md @@ -0,0 +1,118 @@ +# [Plan Title] + +## Overview + +- **Goal:** [One sentence describing the end state] +- **Created:** YYYY-MM-DD +- **Status:** In Progress | Complete + +## Context + +### Requirements + +[Gathered requirements from user questions] + +### Constraints + +[Technical, business, or timeline constraints] + +### Success Criteria + +[How we know this is complete] + +## Architecture + +### Design Decisions + +[Key architectural choices and rationale] + +### Component Relationships + +[How pieces fit together] + +### Data Flow + +[How data moves through the system] + +## Milestones + +### M1: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-101, S-102, S-103... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +### M2: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-201, S-202, S-203... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +## Technical Specifications + +### Types & Interfaces + +```typescript +// Key type definitions +``` + +### API Contracts + +```typescript +// Endpoint signatures, request/response shapes +``` + +### Constants & Enums + +```typescript +// Shared constants +``` + +## Files Inventory + +| File | Purpose | Milestone | +|------|---------|-----------| +| `path/to/file.ts` | [What it does] | M1 | +| `path/to/other.ts` | [What it does] | M2 | + +--- + +## Related Plan Files + +This file is part of the plan folder under `ai_plan/`: + +- `original-plan.md` - Original approved plan (reference for original intent) +- `final-transcript.md` - Final planning transcript (reference for rationale/context) +- `milestone-plan.md` - This file (full specification) +- `story-tracker.md` - Status tracking (must be kept up to date) +- `continuation-runbook.md` - Resume/execution context (read first) diff --git a/skills/create-plan/_source/opencode/templates/story-tracker.md b/skills/create-plan/_source/opencode/templates/story-tracker.md new file mode 100644 index 0000000..08dbd3a --- /dev/null +++ b/skills/create-plan/_source/opencode/templates/story-tracker.md @@ -0,0 +1,71 @@ +# Story Tracker: [Plan Title] + +## Progress Summary + +- **Current Milestone:** M1 +- **Stories Complete:** 0/N +- **Milestones Approved:** 0/M +- **Last Updated:** YYYY-MM-DD + +--- + +## Milestones + +### M1: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-101 | [Brief description] | pending | | +| S-102 | [Brief description] | pending | | +| S-103 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +### M2: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-201 | [Brief description] | pending | | +| S-202 | [Brief description] | pending | | +| S-203 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +## Status Legend + +| Status | Meaning | +|--------|---------| +| `pending` | Not started | +| `in-dev` | Currently being worked on | +| `completed` | Done - include commit hash in Notes | +| `deferred` | Postponed - include reason in Notes | + +## Update Instructions (MANDATORY) + +Before starting any story: + +1. Mark story as `in-dev` +2. Update "Last Updated" + +After completing any story: + +1. Mark story as `completed` +2. Add local commit hash to Notes +3. Update "Stories Complete" and "Last Updated" + +At milestone boundary: + +1. Run lint/typecheck/tests for changed files +2. Commit (no push) +3. Request feedback +4. Apply feedback, re-check changed files, commit again +5. Mark milestone **Approval Status: approved** only after user confirms +6. Continue only after approval + +After all milestones approved: + +- Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/_source/pi/SKILL.md b/skills/create-plan/_source/pi/SKILL.md new file mode 100644 index 0000000..3af2db2 --- /dev/null +++ b/skills/create-plan/_source/pi/SKILL.md @@ -0,0 +1,234 @@ +--- +name: create-plan +description: Use when a user asks to create or maintain a structured implementation plan in pi, including milestones, bite-sized stories, and resumable local planning artifacts under ai_plan. +--- + +# Create Plan (Pi) + +Create and maintain a local plan workspace under `ai_plan/` at project root. + +## Shared Setup + +Before using this skill, read: + +- [docs/PI-SUPERPOWERS.md](../../../docs/PI-SUPERPOWERS.md) +- [docs/PI-COMMON-REVIEWER.md](../../../docs/PI-COMMON-REVIEWER.md) + +The workflow depends on: + +- Obra Superpowers skills being visible to pi +- the pi reviewer-runtime helper being installed in a supported location + +## Prerequisite Check (MANDATORY) + +Required: + +- `pi --version` +- Superpowers `brainstorming` +- Superpowers `writing-plans` +- pi reviewer runtime helper: + - `.pi/skills/reviewer-runtime/pi/run-review.sh`, or + - `~/.pi/agent/skills/reviewer-runtime/pi/run-review.sh` + +Quick checks for common installs: + +```bash +pi --version +test -f ~/.agents/skills/superpowers/brainstorming/SKILL.md || test -f ~/.pi/agent/skills/superpowers/brainstorming/SKILL.md +test -f ~/.agents/skills/superpowers/writing-plans/SKILL.md || test -f ~/.pi/agent/skills/superpowers/writing-plans/SKILL.md +test -x .pi/skills/reviewer-runtime/pi/run-review.sh || test -x ~/.pi/agent/skills/reviewer-runtime/pi/run-review.sh +``` + +If you use a settings-defined skill path for Superpowers, verify it matches [docs/PI-SUPERPOWERS.md](../../../docs/PI-SUPERPOWERS.md) before continuing. + +If you install the reviewer helper in a nonstandard location, verify it matches [docs/PI-COMMON-REVIEWER.md](../../../docs/PI-COMMON-REVIEWER.md) before continuing. + +If any dependency is missing, stop and return: + +`Missing dependency: pi planning requires Superpowers brainstorming/writing-plans skills plus the reviewer setup documented in docs/PI-SUPERPOWERS.md and docs/PI-COMMON-REVIEWER.md.` + +## Required Workflow Rules + +- Load the relevant workflow skill before entering its phase. If pi did not auto-load it, use `/skill:brainstorming` or `/skill:writing-plans`. +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- Track checklist-style progress inside the plan artifacts that this skill generates. +- Do not use deprecated wrapper CLIs. + +## Process + +### Phase 1: Analyze + +- Explore the codebase and existing patterns. +- Review any current docs, scripts, or variant layouts that affect the plan. + +### Phase 2: Gather Requirements + +- Ask questions one at a time until the scope is clear. +- Confirm constraints, success criteria, dependencies, and what is out of scope. + +### Phase 3: Configure Reviewer + +If the user already specified a reviewer CLI and model, use those values. Otherwise ask: + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip` + +1. Which CLI should review the plan? + - `codex` + - `claude` + - `cursor` + - `opencode` + - `pi` + - `skip` +2. Which model? +3. Max review rounds? Default: `10` + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for the review loop. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the pi model running this workflow. Use any configured pi model string, including provider-qualified model IDs. If the reviewer model or provider is unavailable, surface the review helper stderr/status and ask for a configured model; use `pi --list-models [search]` to inspect configured models. + +The pi reviewer command rendered into `/tmp/plan-review-${REVIEW_ID}.sh` must be isolated and read-only: + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files --model "$REVIEWER_MODEL" --tools read,grep,find,ls -p "Read the file /tmp/plan-${REVIEW_ID}.md and review." +``` + +The pi reviewer invocation must not load workflow skills and must not include `write`, `edit`, or `bash` tools. + +### Phase 4: Design + +- Load `brainstorming`. +- Present 2-3 approaches and recommend one. +- Resolve open design questions before the milestone breakdown. + +### Phase 5: Plan + +- Load `writing-plans`. +- Break the work into milestones and bite-sized stories. +- Story IDs should use the `S-101`, `S-102` style. + +### Phase 6: Iterative Plan Review + +Skip this phase if `REVIEWER_CLI=skip`. + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use these temp artifacts: + +- `/tmp/plan-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.md` +- `/tmp/plan-review-${REVIEW_ID}.json` +- `/tmp/plan-review-${REVIEW_ID}.stderr` +- `/tmp/plan-review-${REVIEW_ID}.status` +- `/tmp/plan-review-${REVIEW_ID}.runner.out` +- `/tmp/plan-review-${REVIEW_ID}.sh` + +Resolve the pi reviewer runtime helper in this order: + +```bash +REVIEWER_RUNTIME="" +for candidate in ".pi/skills/reviewer-runtime/pi/run-review.sh" "$HOME/.pi/agent/skills/reviewer-runtime/pi/run-review.sh"; do + if [ -x "$candidate" ]; then + REVIEWER_RUNTIME="$candidate" + break + fi +done +``` + +#### Step 2: Write The Plan Payload + +Write the full plan to `/tmp/plan-${REVIEW_ID}.md`. + +Reviewer responses must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3` +- Use `- None.` when a severity has no findings +- `VERDICT: APPROVED` is valid only when no `P0`, `P1`, or `P2` findings remain + +#### Step 3: Submit To Reviewer + +Build a bash command script in `/tmp/plan-review-${REVIEW_ID}.sh` and execute it through the shared helper when present: + +```bash +"$REVIEWER_RUNTIME" \ + --command-file /tmp/plan-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/plan-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/plan-review-${REVIEW_ID}.stderr \ + --status-file /tmp/plan-review-${REVIEW_ID}.status +``` + +Fallback to direct execution only if the helper is missing. + +#### Step 4: Wait And Parse Verdict + +- Keep waiting while fresh `state=in-progress note="In progress N"` heartbeats continue to appear. +- Treat `P0`, `P1`, or `P2` as must-fix findings. +- `P3` findings are non-blocking, but fix them when cheap and safe. + +#### Step 5: Revise And Re-Submit + +- Address findings in priority order. +- Rebuild the plan payload. +- Re-submit until approved or `MAX_ROUNDS` is reached. + +### Phase 7: Generate Plan Files + +Once the plan is approved: + +1. Ensure `/ai_plan/` exists in `.gitignore` +2. Create `ai_plan/YYYY-MM-DD-/` +3. Write: + - `original-plan.md` + - `final-transcript.md` + - `milestone-plan.md` + - `story-tracker.md` + - `continuation-runbook.md` +4. Use the template files from this skill's `templates/` directory + +### Phase 8: Telegram Completion Notification + +Resolve the notification helper in this order: + +```bash +TELEGRAM_NOTIFY_RUNTIME="" +for candidate in ".pi/skills/reviewer-runtime/pi/notify-telegram.sh" "$HOME/.pi/agent/skills/reviewer-runtime/pi/notify-telegram.sh"; do + if [ -x "$candidate" ]; then + TELEGRAM_NOTIFY_RUNTIME="$candidate" + break + fi +done +``` + +If the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured, send a short completion summary. If not, state that no Telegram completion notification was sent. diff --git a/skills/create-plan/_source/pi/templates/continuation-runbook.md b/skills/create-plan/_source/pi/templates/continuation-runbook.md new file mode 100644 index 0000000..4c33f9a --- /dev/null +++ b/skills/create-plan/_source/pi/templates/continuation-runbook.md @@ -0,0 +1,145 @@ +# Continuation Runbook: [Plan Title] + +## Reference Files (START HERE) + +Upon resumption, these files in this folder are the ONLY source of truth: + +| File | Purpose | When to Use | +|------|---------|-------------| +| `continuation-runbook.md` | Full context reproduction + execution workflow | Read FIRST | +| `story-tracker.md` | Current progress and status | Check/update BEFORE and AFTER every story | +| `milestone-plan.md` | Complete plan with specifications | Reference implementation details | +| `original-plan.md` | Original approved plan | Reference original intent | +| `final-transcript.md` | Final planning transcript | Reference reasoning/context | + +Do NOT reference planner-private files during implementation. + +## Skill Workflow Guardrails + +- Load relevant skills before action. If pi did not auto-load them, use `/skill:`. +- Announce which skill is being used and why. +- If a checklist-driven workflow applies, keep its state current in the plan artifacts. +- Do not use deprecated wrapper CLIs. + +--- + +## Quick Resume Instructions + +1. Read this runbook completely. +2. Check `story-tracker.md`. +3. Find next `pending` story and mark as `in-dev` before starting. +4. Implement the story. +5. Update tracker immediately after each change. + +--- + +## Mandatory Execution Workflow + +Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow this order: + +1. Read `continuation-runbook.md` first. +2. Execute stories milestone by milestone. +3. After completing a milestone: + - Run lint/typecheck/tests, prioritizing changed files for speed. + - Commit locally (**DO NOT PUSH**). + - Stop and ask user for feedback. +4. If feedback is provided: + - Apply feedback changes. + - Re-run checks for changed files. + - Commit locally again. + - Ask for milestone approval. +5. Only move to next milestone after explicit approval. +6. After all milestones are completed and approved: + - Ask permission to push. + - If approved, push. + - Mark plan status as `completed`. + +--- + +## Git Note + +`ai_plan/` is intentionally local and must stay gitignored. Do not treat inability to commit plan-file updates inside `ai_plan/` as an error. + +--- + +## Full Context Reproduction + +### Project Overview + +[What this project/feature is about] + +### User Requirements + +[All gathered requirements] + +### Scope + +[In scope / out of scope] + +### Dependencies + +[External dependencies, prerequisites, related systems] + +--- + +## Key Specifications + +### Type Definitions + +```typescript +// Copy-paste ready type definitions +``` + +### Enums & Constants + +```typescript +// All enums/constants needed +``` + +### API Endpoints + +```typescript +// Request/response shapes +``` + +--- + +## Critical Design Decisions + +| Decision | Chosen Approach | Alternatives Rejected | Rationale | +|----------|-----------------|----------------------|-----------| +| [Topic] | [What we chose] | [Other options] | [Why] | + +--- + +## Verification Commands + +### Lint (changed files first) + +```bash +# example: pnpm eslint +``` + +### Typecheck + +```bash +# example: pnpm tsc --noEmit +``` + +### Tests (target changed scope first) + +```bash +# example: pnpm test -- +``` + +--- + +## File Quick Reference + +| File | Purpose | +|------|---------| +| `original-plan.md` | Original approved plan | +| `final-transcript.md` | Final planning transcript | +| `milestone-plan.md` | Full specification | +| `story-tracker.md` | Current progress tracker | +| `continuation-runbook.md` | This runbook | diff --git a/skills/create-plan/_source/pi/templates/milestone-plan.md b/skills/create-plan/_source/pi/templates/milestone-plan.md new file mode 100644 index 0000000..f646b48 --- /dev/null +++ b/skills/create-plan/_source/pi/templates/milestone-plan.md @@ -0,0 +1,118 @@ +# [Plan Title] + +## Overview + +- **Goal:** [One sentence describing the end state] +- **Created:** YYYY-MM-DD +- **Status:** In Progress | Complete + +## Context + +### Requirements + +[Gathered requirements from user questions] + +### Constraints + +[Technical, business, or timeline constraints] + +### Success Criteria + +[How we know this is complete] + +## Architecture + +### Design Decisions + +[Key architectural choices and rationale] + +### Component Relationships + +[How pieces fit together] + +### Data Flow + +[How data moves through the system] + +## Milestones + +### M1: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-101, S-102, S-103... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +### M2: [Name] + +**Description:** [What this milestone achieves] + +**Acceptance Criteria:** + +- [ ] [Criterion 1] +- [ ] [Criterion 2] + +**Stories:** S-201, S-202, S-203... + +**Milestone Completion Rule (MANDATORY):** + +- Run lint/typecheck/tests for changed files. +- Commit locally (DO NOT push). +- Stop and ask user for feedback. +- Apply feedback, re-check changed files, commit again. +- Move to next milestone only after user approval. + +--- + +## Technical Specifications + +### Types & Interfaces + +```typescript +// Key type definitions +``` + +### API Contracts + +```typescript +// Endpoint signatures, request/response shapes +``` + +### Constants & Enums + +```typescript +// Shared constants +``` + +## Files Inventory + +| File | Purpose | Milestone | +|------|---------|-----------| +| `path/to/file.ts` | [What it does] | M1 | +| `path/to/other.ts` | [What it does] | M2 | + +--- + +## Related Plan Files + +This file is part of the plan folder under `ai_plan/`: + +- `original-plan.md` - Original approved plan (reference for original intent) +- `final-transcript.md` - Final planning transcript (reference for rationale/context) +- `milestone-plan.md` - This file (full specification) +- `story-tracker.md` - Status tracking (must be kept up to date) +- `continuation-runbook.md` - Resume/execution context (read first) diff --git a/skills/create-plan/_source/pi/templates/story-tracker.md b/skills/create-plan/_source/pi/templates/story-tracker.md new file mode 100644 index 0000000..08dbd3a --- /dev/null +++ b/skills/create-plan/_source/pi/templates/story-tracker.md @@ -0,0 +1,71 @@ +# Story Tracker: [Plan Title] + +## Progress Summary + +- **Current Milestone:** M1 +- **Stories Complete:** 0/N +- **Milestones Approved:** 0/M +- **Last Updated:** YYYY-MM-DD + +--- + +## Milestones + +### M1: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-101 | [Brief description] | pending | | +| S-102 | [Brief description] | pending | | +| S-103 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +### M2: [Name] + +| Story | Description | Status | Notes | +|-------|-------------|--------|-------| +| S-201 | [Brief description] | pending | | +| S-202 | [Brief description] | pending | | +| S-203 | [Brief description] | pending | | + +**Approval Status:** pending + +--- + +## Status Legend + +| Status | Meaning | +|--------|---------| +| `pending` | Not started | +| `in-dev` | Currently being worked on | +| `completed` | Done - include commit hash in Notes | +| `deferred` | Postponed - include reason in Notes | + +## Update Instructions (MANDATORY) + +Before starting any story: + +1. Mark story as `in-dev` +2. Update "Last Updated" + +After completing any story: + +1. Mark story as `completed` +2. Add local commit hash to Notes +3. Update "Stories Complete" and "Last Updated" + +At milestone boundary: + +1. Run lint/typecheck/tests for changed files +2. Commit (no push) +3. Request feedback +4. Apply feedback, re-check changed files, commit again +5. Mark milestone **Approval Status: approved** only after user confirms +6. Continue only after approval + +After all milestones approved: + +- Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/claude-code/.generated-manifest.json b/skills/create-plan/claude-code/.generated-manifest.json new file mode 100644 index 0000000..3c98940 --- /dev/null +++ b/skills/create-plan/claude-code/.generated-manifest.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/create-plan/claude-code", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "21635cb0342626e5adc568d7cf6d10eb95cdce6fad665b6553718640fd5d51ce" + }, + { + "path": "templates/continuation-runbook.md", + "kind": "file", + "mode": "644", + "sha256": "16d72a6d302d22712b1b4cd919bf9d899d6d31775c7183f32c78fe6e28f330d0" + }, + { + "path": "templates/milestone-plan.md", + "kind": "file", + "mode": "644", + "sha256": "76700ac603bc13c585cf9de25861be99dc0988df5925f06609ca60a71bee1b6d" + }, + { + "path": "templates/story-tracker.md", + "kind": "file", + "mode": "644", + "sha256": "6838b4242765e407d1498402b802b04b59c18b5ca3344aff8c33665bad00f28a" + } + ] +} diff --git a/skills/create-plan/claude-code/SKILL.md b/skills/create-plan/claude-code/SKILL.md index f82f703..3645172 100644 --- a/skills/create-plan/claude-code/SKILL.md +++ b/skills/create-plan/claude-code/SKILL.md @@ -3,6 +3,8 @@ name: create-plan description: Use when starting a new feature, project, or complex task that needs structured planning with milestones, bite-sized stories, and resumable execution context. ALWAYS invoke when user says "create a plan", "make a plan", "plan this", "start planning", or similar planning requests. --- + + # Create Plan (Claude Code) Create and maintain a local plan folder under `ai_plan/` at project root. @@ -12,6 +14,7 @@ Create and maintain a local plan folder under `ai_plan/` at project root. This Claude Code variant depends on Superpowers planning skills and explicit sub-skill invocation. Required: + - Superpowers repo: `https://github.com/obra/superpowers` - `brainstorming` skill - `writing-plans` skill @@ -23,10 +26,12 @@ If any dependency is missing, stop immediately and return: ## Process ### Phase 1: Analyze + - Explore the codebase with exploration agents. - Understand existing patterns and context. ### Phase 2: Gather Requirements + - Ask questions ONE AT A TIME until user says ready. - Cover scope, constraints, success criteria, dependencies. - Summarize before proceeding. @@ -45,7 +50,6 @@ For shorthand `pi/`, split only on the first slash when the prefi When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. - If the user has already specified a reviewer CLI and model (e.g., "create a plan, review with codex o4-mini"), use those values. Otherwise, ask: 1. **Which CLI should review the plan?** @@ -66,11 +70,13 @@ If the user has already specified a reviewer CLI and model (e.g., "create a plan Store the chosen `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phase 6 (Iterative Plan Review). ### Phase 4: Design (REQUIRED SUB-SKILL) + - Invoke `superpowers:brainstorming` explicitly. - Present 2-3 approaches and recommend one. - Validate design in sections. ### Phase 5: Plan (REQUIRED SUB-SKILL) + - Invoke `superpowers:writing-plans` explicitly. - Break into milestones and bite-sized stories (2-5 min each). - Story IDs: `S-{milestone}{sequence}`. @@ -88,6 +94,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use for temp artifacts: + - `/tmp/plan-${REVIEW_ID}.md` - `/tmp/plan-review-${REVIEW_ID}.md` - `/tmp/plan-review-${REVIEW_ID}.json` (Cursor only) @@ -143,6 +150,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -165,7 +173,6 @@ Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash sc set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -298,6 +305,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -323,14 +331,14 @@ Fallback is allowed only when the helper is missing or not executable. - `/tmp/plan-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 7 (Initialize workspace) - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 @@ -345,7 +353,7 @@ Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -356,7 +364,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -440,7 +447,7 @@ Return to Step 4. #### Step 7: Present Final Result -``` +```markdown ## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) **Status:** Approved after N round(s) @@ -467,21 +474,25 @@ If the round failed, produced empty output, or reached operator-decision timeout ### Phase 7: Initialize Local Plan Workspace (MANDATORY) At project root: + 1. Ensure `ai_plan/` exists. Create it if missing. 2. Ensure `.gitignore` contains `/ai_plan/`. 3. If `.gitignore` was changed, commit that change immediately (local commit only). Recommended commit message: + - `chore(gitignore): ignore ai_plan local planning artifacts` ### Phase 8: Generate Plan Files (MANDATORY - DO NOT SKIP) **PLAN MODE CHECK:** If currently in plan mode: + 1. Inform user that plan files cannot be written while in plan mode. 2. Instruct user to exit plan mode (approve plan or use ExitPlanMode). 3. Proceed with file generation only after exiting plan mode. Create `ai_plan/YYYY-MM-DD-/` with ALL files: + 1. `original-plan.md` - Copy the plan file from `~/.claude/plans/` as-is. 2. `final-transcript.md` - Copy of final planning transcript for reference. 3. `milestone-plan.md` - Full specification (template-based). @@ -514,6 +525,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -524,12 +536,14 @@ Rules: **ALWAYS update `story-tracker.md` before/after each story. NEVER proceed with stale tracker state.** Before starting any story: + 1. Open `story-tracker.md` 2. Mark story `in-dev` 3. Add notes if relevant 4. Then begin implementation After completing any story: + 1. Mark story `completed` 2. Add commit hash in Notes 3. Review pending stories @@ -568,4 +582,5 @@ After completing any story: - [ ] Telegram notification attempted if configured ## Exit Triggers for Question Phase + User says: "ready", "done", "let's plan", "proceed", "enough questions" diff --git a/skills/create-plan/claude-code/templates/continuation-runbook.md b/skills/create-plan/claude-code/templates/continuation-runbook.md index 013d669..622f5fa 100644 --- a/skills/create-plan/claude-code/templates/continuation-runbook.md +++ b/skills/create-plan/claude-code/templates/continuation-runbook.md @@ -1,3 +1,4 @@ + # Continuation Runbook: [Plan Title] ## Reference Files (START HERE) @@ -58,15 +59,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Full Context Reproduction ### Project Overview + [What this project/feature is about] ### User Requirements + [All gathered requirements] ### Scope + [In scope / out of scope] ### Dependencies + [External dependencies, prerequisites, related systems] --- @@ -74,16 +79,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Key Specifications ### Type Definitions + ```typescript // Copy-paste ready type definitions ``` ### Enums & Constants + ```typescript // All enums/constants needed ``` ### API Endpoints + ```typescript // Request/response shapes ``` @@ -101,16 +109,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Verification Commands ### Lint (changed files first) + ```bash # example: pnpm eslint ``` ### Typecheck + ```bash # example: pnpm tsc --noEmit ``` ### Tests (target changed scope first) + ```bash # example: pnpm test -- ``` diff --git a/skills/create-plan/claude-code/templates/milestone-plan.md b/skills/create-plan/claude-code/templates/milestone-plan.md index 9c9b7e9..4314392 100644 --- a/skills/create-plan/claude-code/templates/milestone-plan.md +++ b/skills/create-plan/claude-code/templates/milestone-plan.md @@ -1,6 +1,8 @@ + # [Plan Title] ## Overview + - **Goal:** [One sentence describing the end state] - **Created:** YYYY-MM-DD - **Status:** In Progress | Complete @@ -8,37 +10,46 @@ ## Context ### Requirements + [Gathered requirements from user questions] ### Constraints + [Technical, business, or timeline constraints] ### Success Criteria + [How we know this is complete] ## Architecture ### Design Decisions + [Key architectural choices and rationale] ### Component Relationships + [How pieces fit together] ### Data Flow + [How data moves through the system] ## Milestones ### M1: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-101, S-102, S-103... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -48,15 +59,18 @@ --- ### M2: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-201, S-202, S-203... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -68,16 +82,19 @@ ## Technical Specifications ### Types & Interfaces + ```typescript // Key type definitions ``` ### API Contracts + ```typescript // Endpoint signatures, request/response shapes ``` ### Constants & Enums + ```typescript // Shared constants ``` @@ -94,6 +111,7 @@ ## Related Plan Files This file is part of the plan folder under `ai_plan/`: + - `original-plan.md` - Original approved plan (reference for original intent) - `final-transcript.md` - Final planning transcript (reference for rationale/context) - `milestone-plan.md` - This file (full specification) diff --git a/skills/create-plan/claude-code/templates/story-tracker.md b/skills/create-plan/claude-code/templates/story-tracker.md index a346cc8..b7a8627 100644 --- a/skills/create-plan/claude-code/templates/story-tracker.md +++ b/skills/create-plan/claude-code/templates/story-tracker.md @@ -1,6 +1,8 @@ + # Story Tracker: [Plan Title] ## Progress Summary + - **Current Milestone:** M1 - **Stories Complete:** 0/N - **Milestones Approved:** 0/M @@ -46,15 +48,18 @@ ## Update Instructions (MANDATORY) Before starting any story: + 1. Mark story as `in-dev` 2. Update "Last Updated" After completing any story: + 1. Mark story as `completed` 2. Add local commit hash to Notes 3. Update "Stories Complete" and "Last Updated" At milestone boundary: + 1. Run lint/typecheck/tests for changed files 2. Commit (no push) 3. Request feedback @@ -63,4 +68,5 @@ At milestone boundary: 6. Continue only after approval After all milestones approved: + - Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/codex/.generated-manifest.json b/skills/create-plan/codex/.generated-manifest.json new file mode 100644 index 0000000..0f1d59b --- /dev/null +++ b/skills/create-plan/codex/.generated-manifest.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/create-plan/codex", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "c30b3e8060c0df498b80bc0190b2993c3aae609ca3e137a71de0ef58615aed9c" + }, + { + "path": "templates/continuation-runbook.md", + "kind": "file", + "mode": "644", + "sha256": "b446958c1c49471dd7844093f94ba8f01439fa8285782127ae002513bbe83086" + }, + { + "path": "templates/milestone-plan.md", + "kind": "file", + "mode": "644", + "sha256": "a1eb885af21821f644d9fa8625cd8a6df018f1650f5269a0499ba86c26867101" + }, + { + "path": "templates/story-tracker.md", + "kind": "file", + "mode": "644", + "sha256": "2ad604c863724df3d189e489f41c578634085e5d9238f9e11f23002b0471aad9" + } + ] +} diff --git a/skills/create-plan/codex/SKILL.md b/skills/create-plan/codex/SKILL.md index dc420dd..07fccba 100644 --- a/skills/create-plan/codex/SKILL.md +++ b/skills/create-plan/codex/SKILL.md @@ -3,6 +3,8 @@ name: create-plan description: Use when a user asks to create or maintain a structured implementation plan in Codex, including milestones, bite-sized stories, and resumable local planning artifacts under ai_plan. --- + + # Create Plan (Codex Native Superpowers) Create and maintain a local plan workspace under `ai_plan/` at project root. @@ -10,6 +12,7 @@ Create and maintain a local plan workspace under `ai_plan/` at project root. ## Overview This skill wraps the current Superpowers flow for Codex: + 1. Design first with `superpowers:brainstorming` 2. Then build an implementation plan with `superpowers:writing-plans` 3. Review the plan iteratively with a second model/provider @@ -20,6 +23,7 @@ This skill wraps the current Superpowers flow for Codex: ## Prerequisite Check (MANDATORY) Required: + - Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` - `superpowers:brainstorming` - `superpowers:writing-plans` @@ -50,9 +54,11 @@ If any dependency is missing, stop and return: ## Process ### Phase 1: Analyze + - Explore the codebase and existing patterns. ### Phase 2: Gather Requirements + - Ask questions one at a time until user says ready. - Confirm scope, constraints, success criteria, dependencies. @@ -70,7 +76,6 @@ For shorthand `pi/`, split only on the first slash when the prefi When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. - If the user has already specified a reviewer CLI and model (e.g., "create a plan, review with claude sonnet"), use those values. Otherwise, ask: 1. **Which CLI should review the plan?** @@ -111,6 +116,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use for temp artifacts: + - `/tmp/plan-${REVIEW_ID}.md` - plan payload - `/tmp/plan-review-${REVIEW_ID}.md` - normalized review text presented to the user - `/tmp/plan-review-${REVIEW_ID}.json` - raw Cursor JSON (only for `cursor`) @@ -166,6 +172,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -188,7 +195,6 @@ Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash sc set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -321,6 +327,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -346,14 +353,14 @@ Fallback is allowed only when the helper is missing or not executable. - `/tmp/plan-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 7 (Initialize workspace) - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 @@ -368,7 +375,7 @@ Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -379,7 +386,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -463,7 +469,7 @@ Return to Step 4. #### Step 7: Present Final Result -``` +```markdown ## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) **Status:** Approved after N round(s) @@ -490,16 +496,19 @@ If the round failed, produced empty output, or reached operator-decision timeout ### Phase 7: Initialize Local Plan Workspace (MANDATORY) At project root: + 1. Ensure `ai_plan/` exists. Create it if missing. 2. Ensure `.gitignore` contains `/ai_plan/`. 3. If `.gitignore` was changed, commit that change immediately (local commit only). Recommended commit message: + - `chore(gitignore): ignore ai_plan local planning artifacts` ### Phase 8: Generate Plan Files (MANDATORY) Create `ai_plan/YYYY-MM-DD-/` with all files below: + 1. `original-plan.md` - copy of original planner-generated plan. 2. `final-transcript.md` - copy of final planning transcript used to reach approved plan. 3. `milestone-plan.md` - full implementation spec (from template). @@ -532,6 +541,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. diff --git a/skills/create-plan/codex/templates/continuation-runbook.md b/skills/create-plan/codex/templates/continuation-runbook.md index 3093ade..b2ee50b 100644 --- a/skills/create-plan/codex/templates/continuation-runbook.md +++ b/skills/create-plan/codex/templates/continuation-runbook.md @@ -1,3 +1,4 @@ + # Continuation Runbook: [Plan Title] ## Reference Files (START HERE) @@ -65,15 +66,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Full Context Reproduction ### Project Overview + [What this project/feature is about] ### User Requirements + [All gathered requirements] ### Scope + [In scope / out of scope] ### Dependencies + [External dependencies, prerequisites, related systems] --- @@ -81,16 +86,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Key Specifications ### Type Definitions + ```typescript // Copy-paste ready type definitions ``` ### Enums & Constants + ```typescript // All enums/constants needed ``` ### API Endpoints + ```typescript // Request/response shapes ``` @@ -108,16 +116,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Verification Commands ### Lint (changed files first) + ```bash # example: ``` ### Typecheck + ```bash # example: ``` ### Tests (target changed scope first) + ```bash # example: ``` diff --git a/skills/create-plan/codex/templates/milestone-plan.md b/skills/create-plan/codex/templates/milestone-plan.md index 78e7e0c..fe55abe 100644 --- a/skills/create-plan/codex/templates/milestone-plan.md +++ b/skills/create-plan/codex/templates/milestone-plan.md @@ -1,11 +1,14 @@ + # [Plan Title] ## Overview + - **Goal:** [One sentence describing the end state] - **Created:** YYYY-MM-DD - **Status:** In Progress | Complete ## Planning Guardrails + - This plan assumes design was validated before implementation planning. - Skills are invoked via native discovery (Codex: `~/.agents/skills/`). - Deprecated CLI wrappers (for example, `superpowers-codex bootstrap` / `use-skill`) are not part of this workflow. @@ -14,37 +17,46 @@ ## Context ### Requirements + [Gathered requirements from user questions] ### Constraints + [Technical, business, or timeline constraints] ### Success Criteria + [How we know this is complete] ## Architecture ### Design Decisions + [Key architectural choices and rationale] ### Component Relationships + [How pieces fit together] ### Data Flow + [How data moves through the system] ## Milestones ### M1: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-101, S-102, S-103... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -54,15 +66,18 @@ --- ### M2: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-201, S-202, S-203... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -74,16 +89,19 @@ ## Technical Specifications ### Types & Interfaces + ```typescript // Key type definitions (or equivalent language constructs) ``` ### API Contracts + ```typescript // Endpoint signatures, request/response shapes (if applicable) ``` ### Constants & Enums + ```typescript // Shared constants (if applicable) ``` @@ -100,6 +118,7 @@ ## Related Plan Files This file is part of the plan folder under `ai_plan/`: + - `original-plan.md` - Original approved plan (reference for original intent) - `final-transcript.md` - Final planning transcript (reference for rationale/context) - `milestone-plan.md` - This file (full specification) diff --git a/skills/create-plan/codex/templates/story-tracker.md b/skills/create-plan/codex/templates/story-tracker.md index 0da4ccd..9c54912 100644 --- a/skills/create-plan/codex/templates/story-tracker.md +++ b/skills/create-plan/codex/templates/story-tracker.md @@ -1,12 +1,15 @@ + # Story Tracker: [Plan Title] ## Progress Summary + - **Current Milestone:** M1 - **Stories Complete:** 0/N - **Milestones Approved:** 0/M - **Last Updated:** YYYY-MM-DD ## Tracking Guardrails + - Update status immediately when work starts (`in-dev`) and when work completes (`completed`). - Require explicit user approval at each milestone boundary before continuing. - Do not push until all milestones are approved and permission is explicitly granted. @@ -52,15 +55,18 @@ ## Update Instructions (MANDATORY) Before starting any story: + 1. Mark story as `in-dev` 2. Update "Last Updated" After completing any story: + 1. Mark story as `completed` 2. Add local commit hash to Notes 3. Update "Stories Complete" and "Last Updated" At milestone boundary: + 1. Run lint/typecheck/tests for changed files 2. Commit (no push) 3. Request feedback @@ -69,4 +75,5 @@ At milestone boundary: 6. Continue only after approval After all milestones approved: + - Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/cursor/.generated-manifest.json b/skills/create-plan/cursor/.generated-manifest.json new file mode 100644 index 0000000..9625b3a --- /dev/null +++ b/skills/create-plan/cursor/.generated-manifest.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/create-plan/cursor", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "f1478478780244adbca57e1723c2055961ff5f1949a185e23d23d406ce4c76ce" + }, + { + "path": "templates/continuation-runbook.md", + "kind": "file", + "mode": "644", + "sha256": "372189876f2d55edcbae8c106c1b0992a48a7061f9033ea5d3f2d329d57baecb" + }, + { + "path": "templates/milestone-plan.md", + "kind": "file", + "mode": "644", + "sha256": "01c7a810c73d9890d29255788815411c6b1605b236e1cf336652f15e444841de" + }, + { + "path": "templates/story-tracker.md", + "kind": "file", + "mode": "644", + "sha256": "969525389a148d5eb3e8a8e5c85647e9273e8309a96a37af194adcb5f89a5630" + } + ] +} diff --git a/skills/create-plan/cursor/SKILL.md b/skills/create-plan/cursor/SKILL.md index f1ac91d..24058b1 100644 --- a/skills/create-plan/cursor/SKILL.md +++ b/skills/create-plan/cursor/SKILL.md @@ -3,6 +3,8 @@ name: create-plan description: Use when starting a new feature, project, or complex task that needs structured planning with milestones, bite-sized stories, and resumable execution context in Cursor Agent CLI workflows. ALWAYS invoke when user says "create a plan", "make a plan", "plan this", "start planning", or similar planning requests. --- + + # Create Plan (Cursor Agent CLI) Create and maintain a local plan folder under `ai_plan/` at project root. @@ -10,6 +12,7 @@ Create and maintain a local plan folder under `ai_plan/` at project root. ## Overview This skill wraps the current Superpowers flow for the Cursor Agent CLI (`cursor-agent`): + 1. Design first with `superpowers:brainstorming` 2. Then build an implementation plan with `superpowers:writing-plans` 3. Review the plan iteratively with a second model/provider @@ -20,6 +23,7 @@ This skill wraps the current Superpowers flow for the Cursor Agent CLI (`cursor- ## Prerequisite Check (MANDATORY) Required: + - Cursor Agent CLI: `cursor-agent --version` (install via `curl https://cursor.com/install -fsS | bash`). The binary is `cursor-agent` (installed to `~/.local/bin/`). Some environments alias it as `cursor agent` (subcommand of the Cursor IDE CLI) — both forms work, but this skill uses `cursor-agent` throughout. - `jq` (required only if using `cursor` as the reviewer CLI): `jq --version` (install via `brew install jq` or your package manager) - Superpowers repo: `https://github.com/obra/superpowers` @@ -51,9 +55,11 @@ If any dependency is missing, stop and return: ## Process ### Phase 1: Analyze + - Explore the codebase and existing patterns. ### Phase 2: Gather Requirements + - Ask questions one at a time until user says ready. - Confirm scope, constraints, success criteria, dependencies. @@ -71,7 +77,6 @@ For shorthand `pi/`, split only on the first slash when the prefi When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. - If the user has already specified a reviewer CLI and model (e.g., "create a plan, review with codex o4-mini"), use those values. Otherwise, ask: 1. **Which CLI should review the plan?** @@ -113,6 +118,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use for temp artifacts: + - `/tmp/plan-${REVIEW_ID}.md` - `/tmp/plan-review-${REVIEW_ID}.md` - `/tmp/plan-review-${REVIEW_ID}.json` (Cursor only) @@ -172,6 +178,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -194,7 +201,6 @@ Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash sc set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -309,6 +315,7 @@ Rules: For `cursor`, the command script writes raw JSON to `/tmp/plan-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. Notes on Cursor flags: + - `--mode=ask` — read-only mode, no file modifications - `--trust` — trust workspace without prompting (required for non-interactive use) - `-p` / `--print` — non-interactive mode, output to stdout @@ -333,6 +340,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -356,14 +364,14 @@ cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md - `/tmp/plan-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 7 (Initialize workspace) - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 @@ -378,7 +386,7 @@ Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -389,7 +397,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -473,7 +480,7 @@ Return to Step 4. #### Step 7: Present Final Result -``` +```markdown ## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) **Status:** Approved after N round(s) @@ -500,16 +507,19 @@ If the round failed, produced empty output, or reached operator-decision timeout ### Phase 7: Initialize Local Plan Workspace (MANDATORY) At project root: + 1. Ensure `ai_plan/` exists. Create it if missing. 2. Ensure `.gitignore` contains `/ai_plan/`. 3. If `.gitignore` was changed, commit that change immediately (local commit only). Recommended commit message: + - `chore(gitignore): ignore ai_plan local planning artifacts` ### Phase 8: Generate Plan Files (MANDATORY) Create `ai_plan/YYYY-MM-DD-/` with all files below: + 1. `original-plan.md` - copy of original planner-generated plan. 2. `final-transcript.md` - copy of final planning transcript used to reach approved plan. 3. `milestone-plan.md` - full implementation spec (from template). @@ -546,6 +556,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -569,12 +580,14 @@ Rules: ## Tracker Discipline (MANDATORY) Before starting any story: + 1. Open `story-tracker.md` 2. Mark story `in-dev` 3. Add notes if relevant 4. Then begin implementation After completing any story: + 1. Mark story `completed` 2. Add commit hash in Notes 3. Review pending stories @@ -634,4 +647,5 @@ After completing any story: - [ ] Telegram notification attempted if configured ## Exit Triggers for Question Phase + User says: "ready", "done", "let's plan", "proceed", "enough questions" diff --git a/skills/create-plan/cursor/templates/continuation-runbook.md b/skills/create-plan/cursor/templates/continuation-runbook.md index d79734d..a2721f0 100644 --- a/skills/create-plan/cursor/templates/continuation-runbook.md +++ b/skills/create-plan/cursor/templates/continuation-runbook.md @@ -1,3 +1,4 @@ + # Continuation Runbook: [Plan Title] ## Reference Files (START HERE) @@ -64,15 +65,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Full Context Reproduction ### Project Overview + [What this project/feature is about] ### User Requirements + [All gathered requirements] ### Scope + [In scope / out of scope] ### Dependencies + [External dependencies, prerequisites, related systems] --- @@ -80,16 +85,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Key Specifications ### Type Definitions + ```typescript // Copy-paste ready type definitions ``` ### Enums & Constants + ```typescript // All enums/constants needed ``` ### API Endpoints + ```typescript // Request/response shapes ``` @@ -107,16 +115,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Verification Commands ### Lint (changed files first) + ```bash # example: ``` ### Typecheck + ```bash # example: ``` ### Tests (target changed scope first) + ```bash # example: ``` diff --git a/skills/create-plan/cursor/templates/milestone-plan.md b/skills/create-plan/cursor/templates/milestone-plan.md index b428a45..1a39473 100644 --- a/skills/create-plan/cursor/templates/milestone-plan.md +++ b/skills/create-plan/cursor/templates/milestone-plan.md @@ -1,11 +1,14 @@ + # [Plan Title] ## Overview + - **Goal:** [One sentence describing the end state] - **Created:** YYYY-MM-DD - **Status:** In Progress | Complete ## Planning Guardrails + - This plan assumes design was validated before implementation planning. - Skills are invoked via workspace discovery (`.cursor/skills/`). - Milestones require verification + local commits + explicit approval before proceeding. @@ -13,37 +16,46 @@ ## Context ### Requirements + [Gathered requirements from user questions] ### Constraints + [Technical, business, or timeline constraints] ### Success Criteria + [How we know this is complete] ## Architecture ### Design Decisions + [Key architectural choices and rationale] ### Component Relationships + [How pieces fit together] ### Data Flow + [How data moves through the system] ## Milestones ### M1: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-101, S-102, S-103... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -53,15 +65,18 @@ --- ### M2: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-201, S-202, S-203... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -73,16 +88,19 @@ ## Technical Specifications ### Types & Interfaces + ```typescript // Key type definitions (or equivalent language constructs) ``` ### API Contracts + ```typescript // Endpoint signatures, request/response shapes (if applicable) ``` ### Constants & Enums + ```typescript // Shared constants (if applicable) ``` @@ -99,6 +117,7 @@ ## Related Plan Files This file is part of the plan folder under `ai_plan/`: + - `original-plan.md` - Original approved plan (reference for original intent) - `final-transcript.md` - Final planning transcript (reference for rationale/context) - `milestone-plan.md` - This file (full specification) diff --git a/skills/create-plan/cursor/templates/story-tracker.md b/skills/create-plan/cursor/templates/story-tracker.md index 0da4ccd..ade654e 100644 --- a/skills/create-plan/cursor/templates/story-tracker.md +++ b/skills/create-plan/cursor/templates/story-tracker.md @@ -1,12 +1,15 @@ + # Story Tracker: [Plan Title] ## Progress Summary + - **Current Milestone:** M1 - **Stories Complete:** 0/N - **Milestones Approved:** 0/M - **Last Updated:** YYYY-MM-DD ## Tracking Guardrails + - Update status immediately when work starts (`in-dev`) and when work completes (`completed`). - Require explicit user approval at each milestone boundary before continuing. - Do not push until all milestones are approved and permission is explicitly granted. @@ -52,15 +55,18 @@ ## Update Instructions (MANDATORY) Before starting any story: + 1. Mark story as `in-dev` 2. Update "Last Updated" After completing any story: + 1. Mark story as `completed` 2. Add local commit hash to Notes 3. Update "Stories Complete" and "Last Updated" At milestone boundary: + 1. Run lint/typecheck/tests for changed files 2. Commit (no push) 3. Request feedback @@ -69,4 +75,5 @@ At milestone boundary: 6. Continue only after approval After all milestones approved: + - Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/opencode/.generated-manifest.json b/skills/create-plan/opencode/.generated-manifest.json new file mode 100644 index 0000000..0d4f22d --- /dev/null +++ b/skills/create-plan/opencode/.generated-manifest.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/create-plan/opencode", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "881c5fb4bb1c75535018d8eb1d557ac6779da8267607d2cb5ae52481bf961b77" + }, + { + "path": "templates/continuation-runbook.md", + "kind": "file", + "mode": "644", + "sha256": "15efb6e1fcfbdcc9c0d5fa1b357dea600afe42a20b761863bece6792f53dbd84" + }, + { + "path": "templates/milestone-plan.md", + "kind": "file", + "mode": "644", + "sha256": "36231230edd506e22a42d82293adefff6b5434fe972fde6767ca0b7ddf6b5dd3" + }, + { + "path": "templates/story-tracker.md", + "kind": "file", + "mode": "644", + "sha256": "2756a718f5de9709347085f6e0a525ec8c0e52dc3b9f67ddc4c226b60df1c967" + } + ] +} diff --git a/skills/create-plan/opencode/SKILL.md b/skills/create-plan/opencode/SKILL.md index 80509a5..0e27da2 100644 --- a/skills/create-plan/opencode/SKILL.md +++ b/skills/create-plan/opencode/SKILL.md @@ -3,6 +3,8 @@ name: create-plan description: Use when starting a new feature, project, or complex task that needs structured planning with milestones, bite-sized stories, and resumable execution context in Opencode workflows. ALWAYS invoke when user says "create a plan", "make a plan", "plan this", "start planning", or similar planning requests. --- + + # Create Plan (OpenCode) Create and maintain a local plan folder under `ai_plan/` at project root. @@ -12,6 +14,7 @@ Create and maintain a local plan folder under `ai_plan/` at project root. This OpenCode variant depends on Superpowers skills being available through OpenCode's native skill system. Required: + - Superpowers repo: `https://github.com/obra/superpowers` - OpenCode Superpowers skills available at `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers` - `superpowers/brainstorming` @@ -33,13 +36,16 @@ If dependencies are missing, stop immediately and return: ### Phase 1: Bootstrap Superpowers Context (REQUIRED) Use OpenCode's native skill tool: + - list skills - verify `superpowers/brainstorming` and `superpowers/writing-plans` are discoverable ### Phase 2: Analyze + - Explore the codebase and existing patterns. ### Phase 3: Gather Requirements + - Ask questions ONE AT A TIME until user says ready. - Cover scope, constraints, success criteria, dependencies. - Summarize before proceeding. @@ -77,10 +83,10 @@ For shorthand `pi/`, split only on the first slash when the prefi When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. - ### Phase 5: Design (REQUIRED SUB-SKILL) Use OpenCode's native skill tool to load: + - `superpowers/brainstorming` Then present 2-3 approaches and recommend one. @@ -88,6 +94,7 @@ Then present 2-3 approaches and recommend one. ### Phase 6: Plan (REQUIRED SUB-SKILL) Use OpenCode's native skill tool to load: + - `superpowers/writing-plans` Then break into milestones and bite-sized stories (2-5 min each). @@ -106,6 +113,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use for temp artifacts: + - `/tmp/plan-${REVIEW_ID}.md` - `/tmp/plan-review-${REVIEW_ID}.md` - `/tmp/plan-review-${REVIEW_ID}.json` (Cursor only) @@ -131,6 +139,9 @@ case "$REVIEWER_CLI" in cursor) HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.json) ;; + opencode) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/plan-review-${REVIEW_ID}.md) + ;; esac ``` @@ -161,6 +172,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -183,7 +195,6 @@ Write the reviewer invocation to `/tmp/plan-review-${REVIEW_ID}.sh` as a bash sc set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -297,6 +308,75 @@ Rules: For `cursor`, the command script writes raw JSON to `/tmp/plan-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode uses `--agent plan` for read-oriented review. Fresh call is the recommended default. + +Round 1: + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/plan-${REVIEW_ID}.md and review the implementation plan. Focus on: +1. Correctness — Will this plan achieve the stated goals? +2. Risks — What could go wrong? Edge cases? Data loss? +3. Missing steps — Is anything forgotten? +4. Alternatives — Is there a simpler or better approach? +5. Security — Any security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use \`- None.\` when a severity has no findings. +- \`P0\` = total blocker, \`P1\` = major risk, \`P2\` = must-fix before approval, \`P3\` = cosmetic / nice to have. +- End with exactly one verdict line: \`VERDICT: APPROVED\` or \`VERDICT: REVISE\` +- \`VERDICT: APPROVED\` is allowed only when there are no \`P0\`, \`P1\`, or \`P2\` findings. \`P3\` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call, recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/plan-review-${REVIEW_ID}.json +``` + +Extract the review body: + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/plan-review-${REVIEW_ID}.json \ + > /tmp/plan-review-${REVIEW_ID}.md \ + || cp /tmp/plan-review-${REVIEW_ID}.json /tmp/plan-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output. On any opencode +CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the +helper-failure escalation in Step 4. + Run the command script through the shared helper when available: ```bash @@ -316,6 +396,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/plan-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -324,6 +405,7 @@ jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_I ``` - If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/plan-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/plan-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=opencode`, the `jq` extraction above covers output capture. If it falls through, copy runner output: `cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md`. On Round 1, also attempt to capture the session id for optional use in subsequent rounds: `OPENCODE_SESSION_ID=$(jq -r 'if type == "array" then (.[0] | (.id? // .session_id?)) else (.id? // .session_id?) end // empty' /tmp/plan-review-${REVIEW_ID}.json 2>/dev/null || true)` - If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: ```bash @@ -339,14 +421,14 @@ cp /tmp/plan-review-${REVIEW_ID}.runner.out /tmp/plan-review-${REVIEW_ID}.md - `/tmp/plan-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Plan Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → proceed to Phase 8 (Initialize workspace) - **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to Step 5 @@ -361,7 +443,7 @@ Address the reviewer findings in priority order (`P0` → `P1` → `P2`, then `P Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -372,7 +454,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/plan-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -450,13 +531,66 @@ jq -r '.result' /tmp/plan-review-${REVIEW_ID}.json > /tmp/plan-review-${REVIEW_I If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. +**If `REVIEWER_CLI` is `opencode`:** + +Fresh call (recommended default — opencode has no guaranteed stable session ID in headless mode): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this plan and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/plan-review-${REVIEW_ID}.json \ + > /tmp/plan-review-${REVIEW_ID}.md \ + || cp /tmp/plan-review-${REVIEW_ID}.json /tmp/plan-review-${REVIEW_ID}.md +``` + +Optional session-resume path (only if `OPENCODE_SESSION_ID` was captured on Round 1 and your installed opencode accepts `-s ` reliably in headless mode): + +```bash +opencode run \ + -s ${OPENCODE_SESSION_ID} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've revised the plan based on your feedback. Updated plan is in /tmp/plan-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/plan-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/plan-review-${REVIEW_ID}.json \ + > /tmp/plan-review-${REVIEW_ID}.md \ + || cp /tmp/plan-review-${REVIEW_ID}.json /tmp/plan-review-${REVIEW_ID}.md +``` + +If session resume fails (session expired or not supported), fall back to the fresh-call path above. + After updating `/tmp/plan-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. Return to Step 4. #### Step 7: Present Final Result -``` +```markdown ## Plan Review — Final (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) **Status:** Approved after N round(s) @@ -483,16 +617,19 @@ If the round failed, produced empty output, or reached operator-decision timeout ### Phase 8: Initialize Local Plan Workspace (MANDATORY) At project root: + 1. Ensure `ai_plan/` exists. Create it if missing. 2. Ensure `.gitignore` contains `/ai_plan/`. 3. If `.gitignore` was changed, commit that change immediately (local commit only). Recommended commit message: + - `chore(gitignore): ignore ai_plan local planning artifacts` ### Phase 9: Generate Plan Files (MANDATORY) Create `ai_plan/YYYY-MM-DD-/` with ALL files: + 1. `original-plan.md` - copy of original planner-generated plan. 2. `final-transcript.md` - copy of final planning transcript used to reach approved plan. 3. `milestone-plan.md` - full implementation spec (template-based). @@ -523,6 +660,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -531,12 +669,14 @@ Rules: ## Tracker Discipline (MANDATORY) Before starting any story: + 1. Open `story-tracker.md` 2. Mark story `in-dev` 3. Add notes if relevant 4. Then begin implementation After completing any story: + 1. Mark story `completed` 2. Add commit hash in Notes 3. Review pending stories @@ -575,4 +715,5 @@ After completing any story: - [ ] Telegram notification attempted if configured ## Exit Triggers for Question Phase + User says: "ready", "done", "let's plan", "proceed", "enough questions" diff --git a/skills/create-plan/opencode/templates/continuation-runbook.md b/skills/create-plan/opencode/templates/continuation-runbook.md index 013d669..94f45ba 100644 --- a/skills/create-plan/opencode/templates/continuation-runbook.md +++ b/skills/create-plan/opencode/templates/continuation-runbook.md @@ -1,3 +1,4 @@ + # Continuation Runbook: [Plan Title] ## Reference Files (START HERE) @@ -58,15 +59,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Full Context Reproduction ### Project Overview + [What this project/feature is about] ### User Requirements + [All gathered requirements] ### Scope + [In scope / out of scope] ### Dependencies + [External dependencies, prerequisites, related systems] --- @@ -74,16 +79,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Key Specifications ### Type Definitions + ```typescript // Copy-paste ready type definitions ``` ### Enums & Constants + ```typescript // All enums/constants needed ``` ### API Endpoints + ```typescript // Request/response shapes ``` @@ -101,16 +109,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Verification Commands ### Lint (changed files first) + ```bash # example: pnpm eslint ``` ### Typecheck + ```bash # example: pnpm tsc --noEmit ``` ### Tests (target changed scope first) + ```bash # example: pnpm test -- ``` diff --git a/skills/create-plan/opencode/templates/milestone-plan.md b/skills/create-plan/opencode/templates/milestone-plan.md index 9c9b7e9..b7adb4d 100644 --- a/skills/create-plan/opencode/templates/milestone-plan.md +++ b/skills/create-plan/opencode/templates/milestone-plan.md @@ -1,6 +1,8 @@ + # [Plan Title] ## Overview + - **Goal:** [One sentence describing the end state] - **Created:** YYYY-MM-DD - **Status:** In Progress | Complete @@ -8,37 +10,46 @@ ## Context ### Requirements + [Gathered requirements from user questions] ### Constraints + [Technical, business, or timeline constraints] ### Success Criteria + [How we know this is complete] ## Architecture ### Design Decisions + [Key architectural choices and rationale] ### Component Relationships + [How pieces fit together] ### Data Flow + [How data moves through the system] ## Milestones ### M1: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-101, S-102, S-103... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -48,15 +59,18 @@ --- ### M2: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-201, S-202, S-203... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -68,16 +82,19 @@ ## Technical Specifications ### Types & Interfaces + ```typescript // Key type definitions ``` ### API Contracts + ```typescript // Endpoint signatures, request/response shapes ``` ### Constants & Enums + ```typescript // Shared constants ``` @@ -94,6 +111,7 @@ ## Related Plan Files This file is part of the plan folder under `ai_plan/`: + - `original-plan.md` - Original approved plan (reference for original intent) - `final-transcript.md` - Final planning transcript (reference for rationale/context) - `milestone-plan.md` - This file (full specification) diff --git a/skills/create-plan/opencode/templates/story-tracker.md b/skills/create-plan/opencode/templates/story-tracker.md index a346cc8..ab415d8 100644 --- a/skills/create-plan/opencode/templates/story-tracker.md +++ b/skills/create-plan/opencode/templates/story-tracker.md @@ -1,6 +1,8 @@ + # Story Tracker: [Plan Title] ## Progress Summary + - **Current Milestone:** M1 - **Stories Complete:** 0/N - **Milestones Approved:** 0/M @@ -46,15 +48,18 @@ ## Update Instructions (MANDATORY) Before starting any story: + 1. Mark story as `in-dev` 2. Update "Last Updated" After completing any story: + 1. Mark story as `completed` 2. Add local commit hash to Notes 3. Update "Stories Complete" and "Last Updated" At milestone boundary: + 1. Run lint/typecheck/tests for changed files 2. Commit (no push) 3. Request feedback @@ -63,4 +68,5 @@ At milestone boundary: 6. Continue only after approval After all milestones approved: + - Ask permission to push and then mark plan completed. diff --git a/skills/create-plan/pi/.generated-manifest.json b/skills/create-plan/pi/.generated-manifest.json new file mode 100644 index 0000000..acd9cd9 --- /dev/null +++ b/skills/create-plan/pi/.generated-manifest.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/create-plan/pi", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "8767db25ce6f03e141ce4c48f37e9d7c4958c3cf3d70729f3bd7214b84f6d065" + }, + { + "path": "templates/continuation-runbook.md", + "kind": "file", + "mode": "644", + "sha256": "1685cded3d4abaf03122a490175ff03b7da593ce60cbca97ae15fadcb706617f" + }, + { + "path": "templates/milestone-plan.md", + "kind": "file", + "mode": "644", + "sha256": "364c08bf0a5ee3738195a0770db72c5a4c9ad7f7fb89eaa064eb8c67f47ad69a" + }, + { + "path": "templates/story-tracker.md", + "kind": "file", + "mode": "644", + "sha256": "ecb550ea9dcd9dde6c813e90af9f538bf5a247fc249e8e323f2b7bf583e52196" + } + ] +} diff --git a/skills/create-plan/pi/SKILL.md b/skills/create-plan/pi/SKILL.md index 3af2db2..6d91443 100644 --- a/skills/create-plan/pi/SKILL.md +++ b/skills/create-plan/pi/SKILL.md @@ -3,6 +3,8 @@ name: create-plan description: Use when a user asks to create or maintain a structured implementation plan in pi, including milestones, bite-sized stories, and resumable local planning artifacts under ai_plan. --- + + # Create Plan (Pi) Create and maintain a local plan workspace under `ai_plan/` at project root. diff --git a/skills/create-plan/pi/templates/continuation-runbook.md b/skills/create-plan/pi/templates/continuation-runbook.md index 78f1b70..1d0deae 100644 --- a/skills/create-plan/pi/templates/continuation-runbook.md +++ b/skills/create-plan/pi/templates/continuation-runbook.md @@ -1,3 +1,4 @@ + # Continuation Runbook: [Plan Title] ## Reference Files (START HERE) @@ -65,15 +66,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Full Context Reproduction ### Project Overview + [What this project/feature is about] ### User Requirements + [All gathered requirements] ### Scope + [In scope / out of scope] ### Dependencies + [External dependencies, prerequisites, related systems] --- @@ -81,16 +86,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Key Specifications ### Type Definitions + ```typescript // Copy-paste ready type definitions ``` ### Enums & Constants + ```typescript // All enums/constants needed ``` ### API Endpoints + ```typescript // Request/response shapes ``` @@ -108,16 +116,19 @@ Work from this folder (`ai_plan/YYYY-MM-DD-/`) and always follow th ## Verification Commands ### Lint (changed files first) + ```bash # example: pnpm eslint ``` ### Typecheck + ```bash # example: pnpm tsc --noEmit ``` ### Tests (target changed scope first) + ```bash # example: pnpm test -- ``` diff --git a/skills/create-plan/pi/templates/milestone-plan.md b/skills/create-plan/pi/templates/milestone-plan.md index 9c9b7e9..1e428c6 100644 --- a/skills/create-plan/pi/templates/milestone-plan.md +++ b/skills/create-plan/pi/templates/milestone-plan.md @@ -1,6 +1,8 @@ + # [Plan Title] ## Overview + - **Goal:** [One sentence describing the end state] - **Created:** YYYY-MM-DD - **Status:** In Progress | Complete @@ -8,37 +10,46 @@ ## Context ### Requirements + [Gathered requirements from user questions] ### Constraints + [Technical, business, or timeline constraints] ### Success Criteria + [How we know this is complete] ## Architecture ### Design Decisions + [Key architectural choices and rationale] ### Component Relationships + [How pieces fit together] ### Data Flow + [How data moves through the system] ## Milestones ### M1: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-101, S-102, S-103... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -48,15 +59,18 @@ --- ### M2: [Name] + **Description:** [What this milestone achieves] **Acceptance Criteria:** + - [ ] [Criterion 1] - [ ] [Criterion 2] **Stories:** S-201, S-202, S-203... **Milestone Completion Rule (MANDATORY):** + - Run lint/typecheck/tests for changed files. - Commit locally (DO NOT push). - Stop and ask user for feedback. @@ -68,16 +82,19 @@ ## Technical Specifications ### Types & Interfaces + ```typescript // Key type definitions ``` ### API Contracts + ```typescript // Endpoint signatures, request/response shapes ``` ### Constants & Enums + ```typescript // Shared constants ``` @@ -94,6 +111,7 @@ ## Related Plan Files This file is part of the plan folder under `ai_plan/`: + - `original-plan.md` - Original approved plan (reference for original intent) - `final-transcript.md` - Final planning transcript (reference for rationale/context) - `milestone-plan.md` - This file (full specification) diff --git a/skills/create-plan/pi/templates/story-tracker.md b/skills/create-plan/pi/templates/story-tracker.md index a346cc8..64a0d1f 100644 --- a/skills/create-plan/pi/templates/story-tracker.md +++ b/skills/create-plan/pi/templates/story-tracker.md @@ -1,6 +1,8 @@ + # Story Tracker: [Plan Title] ## Progress Summary + - **Current Milestone:** M1 - **Stories Complete:** 0/N - **Milestones Approved:** 0/M @@ -46,15 +48,18 @@ ## Update Instructions (MANDATORY) Before starting any story: + 1. Mark story as `in-dev` 2. Update "Last Updated" After completing any story: + 1. Mark story as `completed` 2. Add local commit hash to Notes 3. Update "Stories Complete" and "Last Updated" At milestone boundary: + 1. Run lint/typecheck/tests for changed files 2. Commit (no push) 3. Request feedback @@ -63,4 +68,5 @@ At milestone boundary: 6. Continue only after approval After all milestones approved: + - Ask permission to push and then mark plan completed. diff --git a/skills/do-task/_source/claude-code/SKILL.md b/skills/do-task/_source/claude-code/SKILL.md new file mode 100644 index 0000000..1c61bb9 --- /dev/null +++ b/skills/do-task/_source/claude-code/SKILL.md @@ -0,0 +1,798 @@ +--- +name: do-task +description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review). ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). +--- + +# Do Task (Claude Code) + +Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. + +This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `implement-plan`, `do-task` operates on one persistent `task-plan.md` (not a full milestone plan) and defaults to the **current branch** (not a worktree). + +## Prerequisite Check (MANDATORY) + +Required: + +- Claude Code CLI: `claude --version` +- Superpowers repo: `https://github.com/obra/superpowers` +- `superpowers:brainstorming` +- `superpowers:test-driven-development` +- `superpowers:verification-before-completion` +- `superpowers:finishing-a-development-branch` +- `superpowers:using-git-worktrees` (only when the prompt opts in to a worktree) +- Shared reviewer runtime: `~/.claude/skills/reviewer-runtime/run-review.sh` +- Telegram notifier helper: `~/.claude/skills/reviewer-runtime/notify-telegram.sh` + +If any required dependency is missing, stop immediately and return: + +`Missing dependency: [specific missing item]. Install required Superpowers skills (https://github.com/obra/superpowers) and the reviewer-runtime helper, then retry.` + +This variant depends on explicit sub-skill invocation via the `Skill` tool. Do NOT use shell wrappers. + +## Trigger Phrase Detection + +**Binding triggers** (always invoke this skill): + +- `/do-task` +- "do this task" +- "do task ..." +- "execute this task" +- "make it so" + +**Hint trigger** (invoke unless context clearly maps to another skill): + +- "just do ..." + +**Escape phrases** (skip the Phase 2 clarifying-question loop): + +- `--no-questions` +- `"just do it:"` +- `"just do this:"` +- `"no questions:"` + +**Excluded** (do NOT trigger `do-task`): + +- "implement this" — reserved for `implement-plan`. + +**Dropped defaults** (explicitly NOT binding triggers): + +- "work on ..." +- "handle this" +- "take care of ..." +- "get this done" + +**Worktree opt-in phrases** (Phase 4 takes the worktree branch): + +- "in a worktree" +- "use a worktree" +- "on an isolated branch" +- "on a new branch called X" + +## Process + +### Phase 1: Preflight + +1. Verify git repo: `git rev-parse --is-inside-work-tree`. +2. Verify `/ai_plan/` is present in `.gitignore`. If missing: + - Append `/ai_plan/` to `.gitignore`. + - Commit that infra change immediately with message `chore(gitignore): ignore ai_plan local planning artifacts`. + - This infra commit is EXPLICITLY separate from the task commit in Phase 9. It may occur even when the final task ends up `aborted` or `failed`. +3. Verify required sub-skills are discoverable through the `Skill` tool. Announce each sub-skill before invocation using: + `I've read the [Skill Name] skill and I'm using it to [purpose].` + +### Phase 2: Parse Prompt and Question + +1. Capture the exact user prompt verbatim. +2. Detect trigger phrase (see above) and record which one matched. +3. Detect escape phrase. If set, skip clarifying questions entirely. +4. Apply the ask-first heuristic: + - Skip clarifying questions ONLY if ALL are true: + - Prompt names a concrete target (file, feature, or function). + - Prompt names a concrete outcome (what success looks like). + - Prompt has no ambiguous scope (no "and maybe also ..."). + - All identifiers in the prompt are resolvable against the codebase. + - Otherwise, ask 1-3 clarifying questions, ONE AT A TIME, multiple-choice preferred. + - Empty prompt → ask exactly once: "what task?". +5. Invoke `superpowers:brainstorming` via the `Skill` tool for any **behavior-changing** task — feature creation, bug fix with multiple plausible approaches, refactor, design decision. Present 2-3 approaches and recommend one before finalizing the plan. The ONLY skip conditions are the same ones that allow TDD auto-skip: `pure-documentation` and `pure-comment-whitespace-rename`. When skipping, record the skip reason in the Interpretation section of `task-plan.md`. + +### Phase 3: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "do task X, review with codex gpt-5.4"), use those values. If the user says "use defaults" or otherwise opts out of explicit configuration, proceed with `REVIEWER_CLI=codex`, `REVIEWER_MODEL=gpt-5.4`, and `MAX_ROUNDS=10`. Otherwise, ask: + +1. **Which CLI should review both the plan and the implementation?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `opencode` — OpenCode CLI (`opencode run`) + - `skip` — No external review, proceed with user approval only at each loop. + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `gpt-5.4`, alternatives: `gpt-5.3-codex`, `o4-mini`, `o3`. + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku`. + - For `cursor`: **run `cursor-agent models` first** to see available models. + - For `opencode`: provider-qualified form `/` (e.g., `anthropic/claude-sonnet-4-5`, `openai/gpt-5.4`). Run `opencode models` to list available models. + - Accept any model string the user provides. + +3. **Max review rounds shared across both loops?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 4: Initialize Plan Workspace + +**PLAN MODE CHECK:** If currently in plan mode: + +1. Inform user that `task-plan.md` cannot be written while in plan mode. +2. Instruct user to exit plan mode (approve plan or use `ExitPlanMode`). +3. Proceed with file generation only after exiting plan mode. + +Steps: + +1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). +2. Compute plan folder: `ai_plan//`. +3. **Resume detection:** If the folder already exists, read `task-plan.md`: + - If `Status` is `draft` or `plan-approved` or `implementation-in-progress`: offer to resume, pick a new suffix (`-v2`), or abort. Default is resume. + - If `Status` is any terminal value (`pushed`, `local-only`, `aborted-*`, `failed`): offer a new suffix or abort. Default is new suffix. +4. If not resuming, create the folder and write `task-plan.md` from the template at `templates/task-plan.md` (this skill's template folder; falls back to `~/.claude/skills/do-task/templates/task-plan.md` when installed directly). +5. Fill in: + - `Metadata` block. + - `Prompt` (verbatim). + - `Interpretation`, `Assumptions`, `Files`, `Approach`, `TDD Approach`, `Acceptance Criteria`, `Verification`, `Rollback`. + - Leave `Runtime State`, `Review History`, `Final Status` empty (skill updates these). +6. Set `Status: draft`. + +**Worktree branch:** If the prompt opts in to a worktree (see Trigger Phrase Detection), invoke `superpowers:using-git-worktrees` via the `Skill` tool before proceeding. Otherwise continue on the current branch. + +### Phase 5: Plan Review Loop + +If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = plan +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md +PROMPT_TEMPLATE = PLAN_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_PLAN_SESSION_ID | CURSOR_PLAN_SESSION_ID | OPENCODE_PLAN_SESSION_ID +``` + +Payload is the current `task-plan.md` **with the `Runtime State` and `Review History` blocks stripped** before writing to `PAYLOAD_PATH`. Those two blocks contain reviewer session IDs and scan outcomes that must never be sent back to any reviewer CLI. Reviewers only need the Prompt, Interpretation, Assumptions, Files, Approach, TDD Approach, Acceptance Criteria, Verification, Rollback, and Metadata sections. + +`PLAN_REVIEW_PROMPT`: + +```text +Review this task plan for completeness, correctness, and risk. Focus on: +1. Does the plan match the user's prompt? +2. Are all assumptions surfaced? +3. Are acceptance criteria testable? +4. Is the TDD approach appropriate per the TDD Approach section? +5. Are there missing files, risks, or security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: plan-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 6. + +On MAX_ROUNDS: + +- Set `Status: aborted-plan-review`. +- Send Telegram summary before stopping. +- Ask the user whether to override and proceed, restart, or abort. + +### Phase 6: Execute (TDD-first where applicable) + +Native orchestration — do not invoke `superpowers:executing-plans`. + +1. Set `Status: implementation-in-progress`. +2. For every behavior-changing file edit: + - Invoke `superpowers:test-driven-development` via the `Skill` tool. + - Write the failing test first. Run it. Confirm it fails. + - Implement the minimal code to make it pass. Run the test. Confirm green. + - Do NOT commit yet — a single task commit happens in Phase 9. +3. Auto-skip of TDD is permitted ONLY for tasks classified in `task-plan.md` TDD Approach as: + - `pure-documentation` + - `pure-comment-whitespace-rename` +4. Any other skip (including `pure-config-addition`) requires explicit user approval recorded in `task-plan.md` with an ISO-8601 timestamp. +5. Update `task-plan.md` after each logical step: add notes to `Approach`, check off `Acceptance Criteria` items as they complete. + +### Phase 7: Verification Gate + +Invoke `superpowers:verification-before-completion` via the `Skill` tool. + +Run the commands listed in the `Verification` section of `task-plan.md`: + +- Lint (changed files first). +- Typecheck. +- Tests (targeted first, then broader suite if quick). + +All must pass. If a command fails: + +- Fix the issue. +- Re-run that command. +- Increment `verification_attempts` in Runtime State. + +If `verification_attempts` exceeds 3 without green: + +- Set `Status: aborted-verification`. +- Send Telegram summary. +- Ask the user whether to retry, override, or abort. + +### Phase 8: Implementation Review Loop + +If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = implementation +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID +PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md +PROMPT_TEMPLATE = IMPL_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_IMPL_SESSION_ID | CURSOR_IMPL_SESSION_ID | OPENCODE_IMPL_SESSION_ID +``` + +Payload contents (assembled by the skill): + +```markdown +# Implementation Review: [Short Title] + +## Task Plan (the plan that was approved) + + +## Changes Made (git diff) + + +## Verification Output +### Lint + +### Typecheck + +### Tests + +``` + +`IMPL_REVIEW_PROMPT`: + +```text +Review this implementation against the task plan. Focus on: +1. Correctness — Does the diff satisfy the Acceptance Criteria? +2. Code quality — Clean, maintainable, no obvious issues? +3. Test coverage — Are behavior changes adequately tested (per the plan's TDD Approach)? +4. Security — Any security concerns introduced? +5. Regressions — Does the diff risk breaking unrelated code? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: implementation-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 9. + +On MAX_ROUNDS: + +- Set `Status: aborted-impl-review`. +- Send Telegram summary. +- Ask the user whether to override and commit anyway, restart, or abort. + +### Phase 9: Commit + Push Ask + +Invoke `superpowers:finishing-a-development-branch` via the `Skill` tool. + +1. Stage all changed files explicitly (avoid `git add -A`). +2. Single commit with message derived from the task goal: + - Format: `(): ` + - Example: `feat(auth): add session token rotation` +3. Do NOT push. Update `Status: local-only`. +4. Ask the user: "Push to remote? (yes / no)" + - On explicit `yes` → push, then set `Status: pushed`. + - Any other response → leave `Status: local-only`. + +### Phase 10: Telegram Notification + Finalize + +Resolve the notifier helper: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.claude/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome (`pushed`, `local-only`, `aborted-*`, `failed`), send a Telegram summary if both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are set: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "do-task : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. +- Notification failures are non-blocking but must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +Fill in `Final Status` in `task-plan.md` (include commit hash if any). Do NOT delete the plan folder — it stays as a record. + +--- + +## Review Loop (Shared Subroutine) + +This subroutine is invoked twice per `do-task` run: once in Phase 5 (`REVIEW_KIND=plan`) and once in Phase 8 (`REVIEW_KIND=implementation`). Separate session IDs are used for each loop so reviewer context never leaks across loops. + +### Subroutine Inputs + +| Variable | Purpose | +|----------|---------| +| `REVIEW_KIND` | `plan` or `implementation` | +| `REVIEW_ID` | 8-char hex (from `uuidgen`); reused across rounds of the same loop | +| `PAYLOAD_PATH` | `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` | +| `PROMPT_TEMPLATE` | `PLAN_REVIEW_PROMPT` or `IMPL_REVIEW_PROMPT` | +| `REVIEWER_CLI` | `codex` \| `claude` \| `cursor` \| `opencode` \| `pi` | +| `REVIEWER_MODEL` | Model name | +| `MAX_ROUNDS` | Default 10 | +| `SESSION_ID_VAR` | `CODEX_PLAN_SESSION_ID` \| `CODEX_IMPL_SESSION_ID` \| `CURSOR_PLAN_SESSION_ID` \| `CURSOR_IMPL_SESSION_ID` \| `OPENCODE_PLAN_SESSION_ID` \| `OPENCODE_IMPL_SESSION_ID` | + +Temp artifact paths (per loop): + +- `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` — payload +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md` — normalized review text +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json` — raw Cursor/OpenCode JSON (cursor only, plus opencode when `--format json` is used) +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` + +Resolve the shared helper: + +```bash +REVIEWER_RUNTIME=~/.claude/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) + ;; +esac +``` + +### Step 1: Write Payload + +Write the full payload for this round to `PAYLOAD_PATH`. + +### Step 1a: Secret Scan (per-payload, no caching) + +**BEFORE** sending the payload to any reviewer CLI, scan it for secrets. This scan runs EVERY round — no results are cached. Rationale: Phase 8 payloads include newly-introduced diff content that earlier rounds never saw. + +Run the secret scan with all of these anchored regexes. Use `grep -En` on the payload file: + +```bash +SECRET_REGEX_FILE=$(mktemp) +cat >"$SECRET_REGEX_FILE" <<'EOF' +AKIA[0-9A-Z]{16} +"type"\s*:\s*"service_account" +(ghp|gho|ghs|ghu|ghr)_[A-Za-z0-9]{36,} +xox[abpsr]-[0-9]+-[0-9]+-[0-9]+-[A-Za-z0-9]{24,} +xox[abpsr]-[A-Za-z0-9]{10,48} +sk-(proj-)?[A-Za-z0-9_-]{20,} +sk-ant-(api|admin)[0-9]+-[A-Za-z0-9_-]{20,} +-----BEGIN [A-Z ]+ PRIVATE KEY----- +(TOKEN|SECRET|PASSWORD|API_?KEY|ACCESS_?KEY)\s*=\s*["']?[A-Za-z0-9+/=_-]{8,} +eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ +EOF + +SCAN_MATCHES=$(grep -Ensf "$SECRET_REGEX_FILE" "$PAYLOAD_PATH" || true) +rm -f "$SECRET_REGEX_FILE" +``` + +If `SCAN_MATCHES` is non-empty: + +1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. +2. Present the redacted match summary to the user using this exact wording: + + ```text + SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): + :: [REDACTED::-chars] + ... + Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) + ``` + + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. + +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. + +If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. + +### Step 2: Generate Reviewer Command Script + +Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` as a bash script starting with: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Round 1 — fresh `codex exec`: + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "Review the ${REVIEW_KIND} payload in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +${PROMPT_TEMPLATE}" +``` + +Do not capture the Codex session ID yet. After Round 1 completes, extract it from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` (look for `session id: `) and persist it to Runtime State under `${SESSION_ID_VAR}`. + +Round 2 and later — resume session: + +```bash +codex exec resume ${SESSION_ID_VAR_VALUE} \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before. +Keep findings ordered P0 to P3, use '- None.' when a severity has no findings, and only use VERDICT: APPROVED when no P0, P1, or P2 findings remain." +``` + +If resume fails, fall back to fresh `codex exec` with prior-round context. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call every round (Claude CLI has no session resume): + +```bash +claude -p \ + "${ROUND_PREFIX}Review the following ${REVIEW_KIND} payload. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +${PROMPT_TEMPLATE}" \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +Where `${ROUND_PREFIX}` is empty for Round 1 and `"You previously reviewed this ${REVIEW_KIND} and requested revisions. Previous feedback summary: [key points]. "` for subsequent rounds. + +**If `REVIEWER_CLI` is `cursor`:** + +Round 1: + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later — resume: + +```bash +cursor-agent --resume ${SESSION_ID_VAR_VALUE} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p`. + +After the command completes, extract the session id and review text: + +```bash +CURSOR_SID=$(jq -r '.session_id' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +Persist `CURSOR_SID` to Runtime State under `${SESSION_ID_VAR}` on Round 1. + +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode does not expose a dedicated read-only flag at the CLI level; use the built-in `plan` primary agent (`--agent plan`) for review, which is read-oriented and does not modify files. Session resume is supported via `-s `, but the most reliable pattern for non-interactive review is **fresh call each round** (like `claude`) because opencode's session lifecycle and ID capture are less standardized than codex/cursor for headless runs. Skills MAY opt-in to session resume when they have verified the installed opencode version exposes a stable session id in `--format json` output. + +Round 1 (preferred, fresh call): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call fallback path — recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this ${REVIEW_KIND} and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is below. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Optional session-resume path (only if the installed opencode reliably emits a session id in `--format json` output and accepts it back via `-s`): + +```bash +# Round 2+ with resume +opencode run \ + -s ${SESSION_ID_VAR_VALUE} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've revised. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Extract the review body (the JSON stream emits events; the final assistant message contains the review text): + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + || cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output and surface a warning to the user. On any opencode CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the helper-failure escalation in Step 6. + +### Step 3: Run via `run-review.sh` + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + --status-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + >/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + 2>/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll the `.status` file instead of treating heartbeats as post-hoc-only data. + +### Step 4: Promote Reviewer Output + Capture Session ID + +After the command completes: + +- `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. +- `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `claude` or `pi`: promote `.runner.out` into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. + +On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. + +### Step 5: Parse Verdict + Update Review History + +1. Read `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md`. +2. Append one row to `task-plan.md` Review History: + - Timestamp (ISO-8601 UTC). + - Loop (`plan` or `implementation`). + - Round number. + - Verdict (`APPROVED` or `REVISE`). + - Summary (first line of the `## Summary` section). +3. Increment `plan_review_round` or `implementation_review_round` in Runtime State. + +### Step 6: Branch APPROVED / REVISE / MAX_ROUNDS + +Verdict rules: + +- **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → exit the subroutine with `APPROVED`. +- **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if cheap and safe, then exit with `APPROVED`. +- **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to revision (see below), then return to Step 1 for the next round. +- No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as APPROVED. +- Helper state `completed-empty-output` → treat as failed review attempt, surface `.stderr`/`.status`, fix invocation or prompt handling, then retry. +- Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters. +- Round counter ≥ `MAX_ROUNDS` → exit the subroutine with `MAX_ROUNDS`. Caller decides next action per Phase 5 or Phase 8. + +**Revision:** The caller (Phase 5 for plan, Phase 6/7 for implementation) applies findings in priority order (`P0` → `P1` → `P2` → `P3`). For implementation review revisions, Phase 7 verification must be re-run after every revision before returning to Step 1. + +### Step 7: Liveness Contract (during Step 3) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- Keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +### Step 8: Cleanup (on successful round exit) + +```bash +rm -f /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, KEEP `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them. + +--- + +## Resume Semantics + +1. Detect existing plan folder by slug at Phase 4. +2. Read `task-plan.md` → `Status`. +3. Decide next action: + + | Status | Action | + |--------|--------| + | `draft` | Resume at Phase 5 (plan review) | + | `plan-approved` | Resume at Phase 6 (execute) | + | `implementation-in-progress` | Resume at Phase 6 (continue execute) | + | `implementation-approved` | Resume at Phase 9 (commit + push ask) | + | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | + | `aborted-*` \| `failed` | Offer new suffix or full restart | + +4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. + +--- + +## Tracker Discipline (MANDATORY) + +**ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** + +Before starting any phase: + +1. Update `Status` if it transitions. +2. Update `last_phase_entered` in Runtime State. + +After completing any phase: + +1. Update `Status` if it transitions. +2. Append notes to the relevant section of `task-plan.md`. + +Review History is append-only. + +--- + +## Execution Workflow Rules + +- Current branch is the default; worktree is opt-in only. +- Do NOT push without explicit "yes". +- Secret scan runs **per-payload, no caching** — every round, including revisions. +- Review loops use `MAX_ROUNDS=10` by default, shared across both loops. +- The task commit is a single commit created in Phase 9; interim WIP commits are NOT created. +- The `.gitignore` infra commit in Phase 1 is explicitly separate from the task commit and is allowed even on abort. + +--- + +## Verification Checklist + +- [ ] `ai_plan/` exists and `/ai_plan/` is in `.gitignore` +- [ ] `task-plan.md` created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer CLI + model + `MAX_ROUNDS` configured (or `skip`) +- [ ] Secret scan ran on every outbound reviewer payload +- [ ] Plan review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Phase 6 executed TDD-first for all behavior-changing steps (or documented skip) +- [ ] Phase 7 verification green before Phase 8 +- [ ] Implementation review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Single task commit created locally, no push without explicit yes +- [ ] Telegram notification attempted if configured +- [ ] `task-plan.md` Final Status filled in diff --git a/skills/do-task/_source/claude-code/templates/task-plan.md b/skills/do-task/_source/claude-code/templates/task-plan.md new file mode 100644 index 0000000..f637ecc --- /dev/null +++ b/skills/do-task/_source/claude-code/templates/task-plan.md @@ -0,0 +1,143 @@ +# Task Plan: [Short Title] + +> **Variant guardrail (Claude Code):** When generating or updating this file, the agent MUST be out of plan mode. Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through the `Skill` tool explicitly — no shell wrappers. + +## Metadata + +| Field | Value | +|-------|-------| +| Created | YYYY-MM-DD | +| Slug | YYYY-MM-DD- | +| Runtime | claude-code | +| Reviewer CLI | codex \| claude \| cursor \| opencode \| pi | +| Reviewer Model | | +| MAX_ROUNDS | 10 | +| Branch Strategy | current-branch \| worktree | +| Branch Name | | +| Worktree Path | | +| Status | draft | + +### Status Enum (authoritative) + +| Value | Meaning | +|-------|---------| +| `draft` | Newly created; plan review not yet started | +| `plan-approved` | Plan review loop returned APPROVED | +| `implementation-in-progress` | Phase 6 executing | +| `implementation-approved` | Phase 8 review loop returned APPROVED; awaiting commit | +| `pushed` | Committed + pushed to remote | +| `local-only` | Committed locally; user declined push | +| `aborted-plan-review` | MAX_ROUNDS reached in Phase 5; user aborted | +| `aborted-impl-review` | MAX_ROUNDS reached in Phase 8; user aborted | +| `aborted-verification` | Phase 7 retries exhausted; user aborted | +| `failed` | Hard tooling failure | + +--- + +## Prompt + + + +## Interpretation + + + +## Assumptions + + + +## Files + + + +| Action | Path | Why | +|--------|------|-----| +| | | | + +## Approach + + + +## TDD Approach + + + +## Acceptance Criteria + +- [ ] +- [ ] + +## Verification + + + +## Rollback + + + +--- + +## Runtime State + + + +```yaml +plan_review_round: 0 +implementation_review_round: 0 +CODEX_PLAN_SESSION_ID: +CODEX_IMPL_SESSION_ID: +CURSOR_PLAN_SESSION_ID: +CURSOR_IMPL_SESSION_ID: +OPENCODE_PLAN_SESSION_ID: +OPENCODE_IMPL_SESSION_ID: +last_phase_entered: +last_round_ts: +last_scan_outcome_plan: +last_scan_outcome_impl: +verification_attempts: 0 +tests_added_count: 0 +tdd_used: false +``` + +## Review History + + + +| Timestamp (ISO-8601) | Loop | Round | Verdict | Summary | +|----------------------|------|-------|---------|---------| +| | | | | | + +## Final Status + + + +--- + +## Guardrails (do NOT remove) + +- This file is the single persistent artifact for `do-task`. Do not split it or delete it on success. +- `Status` must always match one of the 10 enum values. +- `Runtime State` is updated by the skill, not by the user. +- Review History is append-only. +- `last_scan_outcome_plan` and `last_scan_outcome_impl` record the most recent secret-scan result for each loop. They are informational; the scan itself runs per-payload with no caching. diff --git a/skills/do-task/_source/codex/SKILL.md b/skills/do-task/_source/codex/SKILL.md new file mode 100644 index 0000000..1a9a172 --- /dev/null +++ b/skills/do-task/_source/codex/SKILL.md @@ -0,0 +1,848 @@ +--- +name: do-task +description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review) in Codex. ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). +--- + +# Do Task (Codex Native Superpowers) + +Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. + +This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `implement-plan`, `do-task` operates on one persistent `task-plan.md` (not a full milestone plan) and defaults to the **current branch** (not a worktree). + +**Core principle:** Codex uses native skill discovery from `~/.agents/skills/`. Do not use deprecated `superpowers-codex bootstrap` or `use-skill` CLI commands. + +## Prerequisite Check (MANDATORY) + +Required: + +- Codex CLI: `codex --version` +- Superpowers repo: `https://github.com/obra/superpowers` +- Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` +- `superpowers:brainstorming` +- `superpowers:test-driven-development` +- `superpowers:verification-before-completion` +- `superpowers:finishing-a-development-branch` +- `superpowers:using-git-worktrees` (only when the prompt opts in to a worktree) +- Shared reviewer runtime: `~/.codex/skills/reviewer-runtime/run-review.sh` +- Telegram notifier helper: `~/.codex/skills/reviewer-runtime/notify-telegram.sh` + +Verify before proceeding: + +```bash +test -L ~/.agents/skills/superpowers +test -f ~/.agents/skills/superpowers/brainstorming/SKILL.md +test -f ~/.agents/skills/superpowers/test-driven-development/SKILL.md +test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md +test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md +``` + +If any required dependency is missing, stop immediately and return: + +`Missing dependency: [specific missing item]. Install required Superpowers skills (https://github.com/obra/superpowers) and the reviewer-runtime helper, then retry.` + +## Required Skill Invocation Rules + +- Invoke relevant skills through native discovery (no CLI wrapper). +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- For skills with checklists, track checklist items with `update_plan` todos. +- Tool mapping for Codex: + - `TodoWrite` -> `update_plan` + - `Task` subagents -> unavailable in Codex; do the work directly and state the limitation + - `Skill` -> use native skill discovery from `~/.agents/skills/` + +## Trigger Phrase Detection + +**Binding triggers** (always invoke this skill): + +- `/do-task` +- "do this task" +- "do task ..." +- "execute this task" +- "make it so" + +**Hint trigger** (invoke unless context clearly maps to another skill): + +- "just do ..." + +**Escape phrases** (skip the Phase 2 clarifying-question loop): + +- `--no-questions` +- `"just do it:"` +- `"just do this:"` +- `"no questions:"` + +**Excluded** (do NOT trigger `do-task`): + +- "implement this" — reserved for `implement-plan`. + +**Dropped defaults** (explicitly NOT binding triggers): + +- "work on ..." +- "handle this" +- "take care of ..." +- "get this done" + +**Worktree opt-in phrases** (Phase 4 takes the worktree branch): + +- "in a worktree" +- "use a worktree" +- "on an isolated branch" +- "on a new branch called X" + +## Process + +### Phase 1: Preflight + +1. Verify git repo: `git rev-parse --is-inside-work-tree`. +2. Verify `/ai_plan/` is present in `.gitignore`. If missing: + - Append `/ai_plan/` to `.gitignore`. + - Commit that infra change immediately with message `chore(gitignore): ignore ai_plan local planning artifacts`. + - This infra commit is EXPLICITLY separate from the task commit in Phase 9. It may occur even when the final task ends up `aborted` or `failed`. +3. Verify required sub-skills are discoverable under `~/.agents/skills/superpowers/`. Announce each sub-skill before invocation using: + `I've read the [Skill Name] skill and I'm using it to [purpose].` + +### Phase 2: Parse Prompt and Question + +1. Capture the exact user prompt verbatim. +2. Detect trigger phrase (see above) and record which one matched. +3. Detect escape phrase. If set, skip clarifying questions entirely. +4. Apply the ask-first heuristic: + - Skip clarifying questions ONLY if ALL are true: + - Prompt names a concrete target (file, feature, or function). + - Prompt names a concrete outcome (what success looks like). + - Prompt has no ambiguous scope (no "and maybe also ..."). + - All identifiers in the prompt are resolvable against the codebase. + - Otherwise, ask 1-3 clarifying questions, ONE AT A TIME, multiple-choice preferred. + - Empty prompt → ask exactly once: "what task?". +5. Invoke `superpowers:brainstorming` via native discovery (`~/.agents/skills/superpowers/brainstorming/SKILL.md`) for any **behavior-changing** task — feature creation, bug fix with multiple plausible approaches, refactor, design decision. Present 2-3 approaches and recommend one before finalizing the plan. The ONLY skip conditions are the same ones that allow TDD auto-skip: `pure-documentation` and `pure-comment-whitespace-rename`. When skipping, record the skip reason in the Interpretation section of `task-plan.md`. + +### Phase 3: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "do task X, review with codex gpt-5.4"), use those values. If the user says "use defaults" or otherwise opts out of explicit configuration, proceed with `REVIEWER_CLI=codex`, `REVIEWER_MODEL=gpt-5.4`, and `MAX_ROUNDS=10`. Otherwise, ask: + +1. **Which CLI should review both the plan and the implementation?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `opencode` — OpenCode CLI (`opencode run`) + - `skip` — No external review, proceed with user approval only at each loop. + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `gpt-5.4`, alternatives: `gpt-5.3-codex`, `o4-mini`, `o3`. + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku`. + - For `cursor`: **run `cursor-agent models` first** to see available models. + - For `opencode`: provider-qualified form `/` (e.g., `anthropic/claude-sonnet-4-5`, `openai/gpt-5.4`). Run `opencode models` to list available models. + - Accept any model string the user provides. + +3. **Max review rounds shared across both loops?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 4: Initialize Plan Workspace + +Codex has no plan-mode concept; there is no plan-mode guard here. + +Steps: + +1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). +2. Compute plan folder: `ai_plan//`. +3. **Resume detection:** If the folder already exists, read `task-plan.md`: + - If `Status` is `draft` or `plan-approved` or `implementation-in-progress`: offer to resume, pick a new suffix (`-v2`), or abort. Default is resume. + - If `Status` is any terminal value (`pushed`, `local-only`, `aborted-*`, `failed`): offer a new suffix or abort. Default is new suffix. +4. If not resuming, create the folder and write `task-plan.md` from the template at `templates/task-plan.md` (this skill's template folder; falls back to `~/.codex/skills/do-task/templates/task-plan.md` when installed directly). +5. Fill in: + - `Metadata` block. + - `Prompt` (verbatim). + - `Interpretation`, `Assumptions`, `Files`, `Approach`, `TDD Approach`, `Acceptance Criteria`, `Verification`, `Rollback`. + - Leave `Runtime State`, `Review History`, `Final Status` empty (skill updates these). +6. Set `Status: draft`. + +**Worktree branch:** If the prompt opts in to a worktree (see Trigger Phrase Detection), invoke `superpowers:using-git-worktrees` via native discovery before proceeding. Otherwise continue on the current branch. + +### Phase 5: Plan Review Loop + +If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = plan +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md +PROMPT_TEMPLATE = PLAN_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_PLAN_SESSION_ID | CURSOR_PLAN_SESSION_ID | OPENCODE_PLAN_SESSION_ID +``` + +Payload is the current `task-plan.md` **with the `Runtime State` and `Review History` blocks stripped** before writing to `PAYLOAD_PATH`. Those two blocks contain reviewer session IDs and scan outcomes that must never be sent back to any reviewer CLI. Reviewers only need the Prompt, Interpretation, Assumptions, Files, Approach, TDD Approach, Acceptance Criteria, Verification, Rollback, and Metadata sections. + +`PLAN_REVIEW_PROMPT`: + +```text +Review this task plan for completeness, correctness, and risk. Focus on: +1. Does the plan match the user's prompt? +2. Are all assumptions surfaced? +3. Are acceptance criteria testable? +4. Is the TDD approach appropriate per the TDD Approach section? +5. Are there missing files, risks, or security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: plan-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 6. + +On MAX_ROUNDS: + +- Set `Status: aborted-plan-review`. +- Send Telegram summary before stopping. +- Ask the user whether to override and proceed, restart, or abort. + +### Phase 6: Execute (TDD-first where applicable) + +Native orchestration — do not invoke `superpowers:executing-plans`. + +1. Set `Status: implementation-in-progress`. +2. For every behavior-changing file edit: + - Invoke `superpowers:test-driven-development` via native discovery. + - Write the failing test first. Run it. Confirm it fails. + - Implement the minimal code to make it pass. Run the test. Confirm green. + - Do NOT commit yet — a single task commit happens in Phase 9. +3. Auto-skip of TDD is permitted ONLY for tasks classified in `task-plan.md` TDD Approach as: + - `pure-documentation` + - `pure-comment-whitespace-rename` +4. Any other skip (including `pure-config-addition`) requires explicit user approval recorded in `task-plan.md` with an ISO-8601 timestamp. +5. Update `task-plan.md` after each logical step: add notes to `Approach`, check off `Acceptance Criteria` items as they complete. + +### Phase 7: Verification Gate + +Invoke `superpowers:verification-before-completion` via native discovery. + +Run the commands listed in the `Verification` section of `task-plan.md`: + +- Lint (changed files first). +- Typecheck. +- Tests (targeted first, then broader suite if quick). + +All must pass. If a command fails: + +- Fix the issue. +- Re-run that command. +- Increment `verification_attempts` in Runtime State. + +If `verification_attempts` exceeds 3 without green: + +- Set `Status: aborted-verification`. +- Send Telegram summary. +- Ask the user whether to retry, override, or abort. + +### Phase 8: Implementation Review Loop + +If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = implementation +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID +PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md +PROMPT_TEMPLATE = IMPL_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_IMPL_SESSION_ID | CURSOR_IMPL_SESSION_ID | OPENCODE_IMPL_SESSION_ID +``` + +Payload contents (assembled by the skill): + +```markdown +# Implementation Review: [Short Title] + +## Task Plan (the plan that was approved) + + +## Changes Made (git diff) + + +## Verification Output +### Lint + +### Typecheck + +### Tests + +``` + +`IMPL_REVIEW_PROMPT`: + +```text +Review this implementation against the task plan. Focus on: +1. Correctness — Does the diff satisfy the Acceptance Criteria? +2. Code quality — Clean, maintainable, no obvious issues? +3. Test coverage — Are behavior changes adequately tested (per the plan's TDD Approach)? +4. Security — Any security concerns introduced? +5. Regressions — Does the diff risk breaking unrelated code? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: implementation-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 9. + +On MAX_ROUNDS: + +- Set `Status: aborted-impl-review`. +- Send Telegram summary. +- Ask the user whether to override and commit anyway, restart, or abort. + +### Phase 9: Commit + Push Ask + +Invoke `superpowers:finishing-a-development-branch` via native discovery. + +1. Stage all changed files explicitly (avoid `git add -A`). +2. Single commit with message derived from the task goal: + - Format: `(): ` + - Example: `feat(auth): add session token rotation` +3. Do NOT push. Update `Status: local-only`. +4. Ask the user: "Push to remote? (yes / no)" + - On explicit `yes` → push, then set `Status: pushed`. + - Any other response → leave `Status: local-only`. + +### Phase 10: Telegram Notification + Finalize + +Resolve the notifier helper: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.codex/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome (`pushed`, `local-only`, `aborted-*`, `failed`), send a Telegram summary if both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are set: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "do-task : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. +- Notification failures are non-blocking but must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +Fill in `Final Status` in `task-plan.md` (include commit hash if any). Do NOT delete the plan folder — it stays as a record. + +--- + +## Review Loop (Shared Subroutine) + +This subroutine is invoked twice per `do-task` run: once in Phase 5 (`REVIEW_KIND=plan`) and once in Phase 8 (`REVIEW_KIND=implementation`). Separate session IDs are used for each loop so reviewer context never leaks across loops. + +### Subroutine Inputs + +| Variable | Purpose | +|----------|---------| +| `REVIEW_KIND` | `plan` or `implementation` | +| `REVIEW_ID` | 8-char hex (from `uuidgen`); reused across rounds of the same loop | +| `PAYLOAD_PATH` | `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` | +| `PROMPT_TEMPLATE` | `PLAN_REVIEW_PROMPT` or `IMPL_REVIEW_PROMPT` | +| `REVIEWER_CLI` | `codex` \| `claude` \| `cursor` \| `opencode` \| `pi` | +| `REVIEWER_MODEL` | Model name | +| `MAX_ROUNDS` | Default 10 | +| `SESSION_ID_VAR` | `CODEX_PLAN_SESSION_ID` \| `CODEX_IMPL_SESSION_ID` \| `CURSOR_PLAN_SESSION_ID` \| `CURSOR_IMPL_SESSION_ID` \| `OPENCODE_PLAN_SESSION_ID` \| `OPENCODE_IMPL_SESSION_ID` | + +Temp artifact paths (per loop): + +- `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` — payload +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md` — normalized review text +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json` — raw Cursor/OpenCode JSON (cursor only, plus opencode when `--format json` is used) +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` + +Resolve the shared helper: + +```bash +REVIEWER_RUNTIME=~/.codex/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) + ;; +esac +``` + +### Step 1: Write Payload + +Write the full payload for this round to `PAYLOAD_PATH`. + +### Step 1a: Secret Scan (per-payload, no caching) + +**BEFORE** sending the payload to any reviewer CLI, scan it for secrets. This scan runs EVERY round — no results are cached. Rationale: Phase 8 payloads include newly-introduced diff content that earlier rounds never saw. + +Run the secret scan with all of these anchored regexes. Use `grep -En` on the payload file: + +```bash +SECRET_REGEX_FILE=$(mktemp) +cat >"$SECRET_REGEX_FILE" <<'EOF' +AKIA[0-9A-Z]{16} +"type"\s*:\s*"service_account" +(ghp|gho|ghs|ghu|ghr)_[A-Za-z0-9]{36,} +xox[abpsr]-[0-9]+-[0-9]+-[0-9]+-[A-Za-z0-9]{24,} +xox[abpsr]-[A-Za-z0-9]{10,48} +sk-(proj-)?[A-Za-z0-9_-]{20,} +sk-ant-(api|admin)[0-9]+-[A-Za-z0-9_-]{20,} +-----BEGIN [A-Z ]+ PRIVATE KEY----- +(TOKEN|SECRET|PASSWORD|API_?KEY|ACCESS_?KEY)\s*=\s*["']?[A-Za-z0-9+/=_-]{8,} +eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ +EOF + +SCAN_MATCHES=$(grep -Ensf "$SECRET_REGEX_FILE" "$PAYLOAD_PATH" || true) +rm -f "$SECRET_REGEX_FILE" +``` + +If `SCAN_MATCHES` is non-empty: + +1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. +2. Present the redacted match summary to the user using this exact wording: + + ```text + SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): + :: [REDACTED::-chars] + ... + Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) + ``` + + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. + +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. + +If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. + +### Step 2: Generate Reviewer Command Script + +Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` as a bash script starting with: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Round 1 — fresh `codex exec`: + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "Review the ${REVIEW_KIND} payload in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +${PROMPT_TEMPLATE}" +``` + +Do not capture the Codex session ID yet. After Round 1 completes, extract it from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` (look for `session id: `) and persist it to Runtime State under `${SESSION_ID_VAR}`. + +Round 2 and later — resume session: + +```bash +codex exec resume ${SESSION_ID_VAR_VALUE} \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before. +Keep findings ordered P0 to P3, use '- None.' when a severity has no findings, and only use VERDICT: APPROVED when no P0, P1, or P2 findings remain." +``` + +If resume fails, fall back to fresh `codex exec` with prior-round context. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call every round (Claude CLI has no session resume): + +```bash +claude -p \ + "${ROUND_PREFIX}Review the following ${REVIEW_KIND} payload. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +${PROMPT_TEMPLATE}" \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +Where `${ROUND_PREFIX}` is empty for Round 1 and `"You previously reviewed this ${REVIEW_KIND} and requested revisions. Previous feedback summary: [key points]. "` for subsequent rounds. + +**If `REVIEWER_CLI` is `cursor`:** + +Round 1: + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later — resume: + +```bash +cursor-agent --resume ${SESSION_ID_VAR_VALUE} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p`. + +After the command completes, extract the session id and review text: + +```bash +CURSOR_SID=$(jq -r '.session_id' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +Persist `CURSOR_SID` to Runtime State under `${SESSION_ID_VAR}` on Round 1. + +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode does not expose a dedicated read-only flag at the CLI level; use the built-in `plan` primary agent (`--agent plan`) for review, which is read-oriented and does not modify files. Session resume is supported via `-s `, but the most reliable pattern for non-interactive review is **fresh call each round** (like `claude`) because opencode's session lifecycle and ID capture are less standardized than codex/cursor for headless runs. Skills MAY opt-in to session resume when they have verified the installed opencode version exposes a stable session id in `--format json` output. + +Round 1 (preferred, fresh call): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call fallback path — recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this ${REVIEW_KIND} and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is below. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Optional session-resume path (only if the installed opencode reliably emits a session id in `--format json` output and accepts it back via `-s`): + +```bash +# Round 2+ with resume +opencode run \ + -s ${SESSION_ID_VAR_VALUE} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've revised. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Extract the review body (the JSON stream emits events; the final assistant message contains the review text): + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + || cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output and surface a warning to the user. On any opencode CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the helper-failure escalation in Step 6. + +### Step 3: Run via `run-review.sh` + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + --status-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + >/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + 2>/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll the `.status` file instead of treating heartbeats as post-hoc-only data. + +### Step 4: Promote Reviewer Output + Capture Session ID + +After the command completes: + +- `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. +- `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `claude` or `pi`: promote `.runner.out` into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. + +On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. + +### Step 5: Parse Verdict + Update Review History + +1. Read `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md`. +2. Append one row to `task-plan.md` Review History: + - Timestamp (ISO-8601 UTC). + - Loop (`plan` or `implementation`). + - Round number. + - Verdict (`APPROVED` or `REVISE`). + - Summary (first line of the `## Summary` section). +3. Increment `plan_review_round` or `implementation_review_round` in Runtime State. + +### Step 6: Branch APPROVED / REVISE / MAX_ROUNDS + +Verdict rules: + +- **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → exit the subroutine with `APPROVED`. +- **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if cheap and safe, then exit with `APPROVED`. +- **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to revision (see below), then return to Step 1 for the next round. +- No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as APPROVED. +- Helper state `completed-empty-output` → treat as failed review attempt, surface `.stderr`/`.status`, fix invocation or prompt handling, then retry. +- Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters. +- Round counter ≥ `MAX_ROUNDS` → exit the subroutine with `MAX_ROUNDS`. Caller decides next action per Phase 5 or Phase 8. + +**Revision:** The caller (Phase 5 for plan, Phase 6/7 for implementation) applies findings in priority order (`P0` → `P1` → `P2` → `P3`). For implementation review revisions, Phase 7 verification must be re-run after every revision before returning to Step 1. + +### Step 7: Liveness Contract (during Step 3) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- Keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +### Step 8: Cleanup (on successful round exit) + +```bash +rm -f /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, KEEP `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them. + +--- + +## Resume Semantics + +1. Detect existing plan folder by slug at Phase 4. +2. Read `task-plan.md` → `Status`. +3. Decide next action: + + | Status | Action | + |--------|--------| + | `draft` | Resume at Phase 5 (plan review) | + | `plan-approved` | Resume at Phase 6 (execute) | + | `implementation-in-progress` | Resume at Phase 6 (continue execute) | + | `implementation-approved` | Resume at Phase 9 (commit + push ask) | + | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | + | `aborted-*` \| `failed` | Offer new suffix or full restart | + +4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. + +--- + +## Tracker Discipline (MANDATORY) + +**ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** + +Before starting any phase: + +1. Update `Status` if it transitions. +2. Update `last_phase_entered` in Runtime State. + +After completing any phase: + +1. Update `Status` if it transitions. +2. Append notes to the relevant section of `task-plan.md`. + +Review History is append-only. + +--- + +## Execution Workflow Rules + +- Current branch is the default; worktree is opt-in only. +- Do NOT push without explicit "yes". +- Secret scan runs **per-payload, no caching** — every round, including revisions. +- Review loops use `MAX_ROUNDS=10` by default, shared across both loops. +- The task commit is a single commit created in Phase 9; interim WIP commits are NOT created. +- The `.gitignore` infra commit in Phase 1 is explicitly separate from the task commit and is allowed even on abort. + +--- + +## Verification Checklist + +- [ ] `ai_plan/` exists and `/ai_plan/` is in `.gitignore` +- [ ] `task-plan.md` created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer CLI + model + `MAX_ROUNDS` configured (or `skip`) +- [ ] Secret scan ran on every outbound reviewer payload +- [ ] Plan review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Phase 6 executed TDD-first for all behavior-changing steps (or documented skip) +- [ ] Phase 7 verification green before Phase 8 +- [ ] Implementation review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Single task commit created locally, no push without explicit yes +- [ ] Telegram notification attempted if configured +- [ ] `task-plan.md` Final Status filled in + +--- + +## Variant Hardening Notes — Codex + +- Must use native skill discovery from `~/.agents/skills/` (no CLI wrappers). +- Must verify Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` +- Must invoke required sub-skills with explicit announcements before any action. +- Must track checklist-driven sub-skills with `update_plan` todos (the Codex equivalent of `TodoWrite`). +- `Task` subagents are unavailable in Codex — do the work directly and state the limitation in the plan if a subagent was expected. +- Deprecated CLI commands (`superpowers-codex bootstrap`, `use-skill`) must NOT be used. +- Helper paths are `~/.codex/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}`. +- No plan-mode guard (Codex has no plan-mode concept). + +## Common Mistakes + +- Using deprecated commands like `superpowers-codex bootstrap` or `superpowers-codex use-skill`. +- Jumping to Phase 6 execution without running `superpowers:brainstorming` on behavior-changing work. +- Asking multiple clarifying questions in a single message. +- Forgetting `update_plan` tracking for sub-skill checklists. +- Forgetting to create/update `.gitignore` for `/ai_plan/`. +- Skipping the per-payload secret scan because "the previous round was clean". +- Pushing the task commit without explicit user approval. + +## Red Flags — Stop and Correct + +- You are about to run any `superpowers-codex` command. +- You are writing `task-plan.md` before the brainstorming step (when required) completes. +- You are pushing commits without user approval. +- You did not announce which skill you invoked and why. +- You are proceeding to implementation review with failing lint/typecheck/tests. +- You are echoing raw secret-scan matches to the user or logs. diff --git a/skills/do-task/_source/codex/templates/task-plan.md b/skills/do-task/_source/codex/templates/task-plan.md new file mode 100644 index 0000000..fb31e06 --- /dev/null +++ b/skills/do-task/_source/codex/templates/task-plan.md @@ -0,0 +1,143 @@ +# Task Plan: [Short Title] + +> **Variant guardrail (Codex):** Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through native skill discovery from `~/.agents/skills/superpowers//SKILL.md` — no `superpowers-codex` CLI wrappers. Checklist-driven sub-skills MUST track items with `update_plan` todos. + +## Metadata + +| Field | Value | +|-------|-------| +| Created | YYYY-MM-DD | +| Slug | YYYY-MM-DD- | +| Runtime | codex | +| Reviewer CLI | codex \| claude \| cursor \| opencode \| pi | +| Reviewer Model | | +| MAX_ROUNDS | 10 | +| Branch Strategy | current-branch \| worktree | +| Branch Name | | +| Worktree Path | | +| Status | draft | + +### Status Enum (authoritative) + +| Value | Meaning | +|-------|---------| +| `draft` | Newly created; plan review not yet started | +| `plan-approved` | Plan review loop returned APPROVED | +| `implementation-in-progress` | Phase 6 executing | +| `implementation-approved` | Phase 8 review loop returned APPROVED; awaiting commit | +| `pushed` | Committed + pushed to remote | +| `local-only` | Committed locally; user declined push | +| `aborted-plan-review` | MAX_ROUNDS reached in Phase 5; user aborted | +| `aborted-impl-review` | MAX_ROUNDS reached in Phase 8; user aborted | +| `aborted-verification` | Phase 7 retries exhausted; user aborted | +| `failed` | Hard tooling failure | + +--- + +## Prompt + + + +## Interpretation + + + +## Assumptions + + + +## Files + + + +| Action | Path | Why | +|--------|------|-----| +| | | | + +## Approach + + + +## TDD Approach + + + +## Acceptance Criteria + +- [ ] +- [ ] + +## Verification + + + +## Rollback + + + +--- + +## Runtime State + + + +```yaml +plan_review_round: 0 +implementation_review_round: 0 +CODEX_PLAN_SESSION_ID: +CODEX_IMPL_SESSION_ID: +CURSOR_PLAN_SESSION_ID: +CURSOR_IMPL_SESSION_ID: +OPENCODE_PLAN_SESSION_ID: +OPENCODE_IMPL_SESSION_ID: +last_phase_entered: +last_round_ts: +last_scan_outcome_plan: +last_scan_outcome_impl: +verification_attempts: 0 +tests_added_count: 0 +tdd_used: false +``` + +## Review History + + + +| Timestamp (ISO-8601) | Loop | Round | Verdict | Summary | +|----------------------|------|-------|---------|---------| +| | | | | | + +## Final Status + + + +--- + +## Guardrails (do NOT remove) + +- This file is the single persistent artifact for `do-task`. Do not split it or delete it on success. +- `Status` must always match one of the 10 enum values. +- `Runtime State` is updated by the skill, not by the user. +- Review History is append-only. +- `last_scan_outcome_plan` and `last_scan_outcome_impl` record the most recent secret-scan result for each loop. They are informational; the scan itself runs per-payload with no caching. diff --git a/skills/do-task/_source/cursor/SKILL.md b/skills/do-task/_source/cursor/SKILL.md new file mode 100644 index 0000000..8f4f6f8 --- /dev/null +++ b/skills/do-task/_source/cursor/SKILL.md @@ -0,0 +1,853 @@ +--- +name: do-task +description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review) in Cursor Agent CLI. ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). +--- + +# Do Task (Cursor Agent CLI) + +Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. + +This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `implement-plan`, `do-task` operates on one persistent `task-plan.md` (not a full milestone plan) and defaults to the **current branch** (not a worktree). + +**Core principle:** Cursor Agent CLI discovers skills from `.cursor/skills/` (repo-local), `~/.cursor/skills/` (global), and installed Cursor plugin cache entries. It also reads `AGENTS.md` at the repo root for additional instructions. + +## Prerequisite Check (MANDATORY) + +Required: + +- Cursor Agent CLI: `cursor-agent --version` (install via `curl https://cursor.com/install -fsS | bash`). Binary is `cursor-agent`; the alias `cursor agent` also works. +- `jq` (**required** — `do-task` always parses JSON output from at least the cursor reviewer branch, and other reviewers may produce JSON). Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. +- Superpowers repo: `https://github.com/obra/superpowers` +- Superpowers skills available from the Cursor plugin cache, `.cursor/skills/` (repo-local), or `~/.cursor/skills/` (global). Do not install both the plugin and a manual Superpowers copy, or Cursor may show duplicate skill entries. +- `superpowers:brainstorming` +- `superpowers:test-driven-development` +- `superpowers:verification-before-completion` +- `superpowers:finishing-a-development-branch` +- `superpowers:using-git-worktrees` (only when the prompt opts in to a worktree) +- Shared reviewer runtime: `.cursor/skills/reviewer-runtime/run-review.sh` (repo-local, preferred) OR `~/.cursor/skills/reviewer-runtime/run-review.sh` (global fallback) +- Telegram notifier helper: `.cursor/skills/reviewer-runtime/notify-telegram.sh` OR `~/.cursor/skills/reviewer-runtime/notify-telegram.sh` + +Verify before proceeding: + +```bash +cursor-agent --version +jq --version +test -f .cursor/skills/superpowers/skills/brainstorming/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/brainstorming/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/brainstorming/SKILL.md' -print -quit 2>/dev/null | grep -q . +test -f .cursor/skills/superpowers/skills/test-driven-development/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/test-driven-development/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/test-driven-development/SKILL.md' -print -quit 2>/dev/null | grep -q . +test -f .cursor/skills/superpowers/skills/verification-before-completion/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/verification-before-completion/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/verification-before-completion/SKILL.md' -print -quit 2>/dev/null | grep -q . +test -f .cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/finishing-a-development-branch/SKILL.md' -print -quit 2>/dev/null | grep -q . +``` + +If any required dependency is missing, stop immediately and return: + +`Missing dependency: [specific missing item]. Install Cursor Agent CLI, jq, and the Cursor Superpowers plugin or Superpowers skills under .cursor/skills/ or ~/.cursor/skills/, then retry.` + +## Required Skill Invocation Rules + +- Invoke relevant skills through Cursor-native discovery (`.cursor/skills/`, `~/.cursor/skills/`, or installed Cursor plugin cache entries). +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- For skills with checklists, track checklist items explicitly in conversation. +- The reviewer CLI branch for `cursor` MUST use `--mode=ask --trust --output-format json`. Never use `--mode=agent` or `--force` for reviewer calls. + +## Trigger Phrase Detection + +**Binding triggers** (always invoke this skill): + +- `/do-task` +- "do this task" +- "do task ..." +- "execute this task" +- "make it so" + +**Hint trigger** (invoke unless context clearly maps to another skill): + +- "just do ..." + +**Escape phrases** (skip the Phase 2 clarifying-question loop): + +- `--no-questions` +- `"just do it:"` +- `"just do this:"` +- `"no questions:"` + +**Excluded** (do NOT trigger `do-task`): + +- "implement this" — reserved for `implement-plan`. + +**Dropped defaults** (explicitly NOT binding triggers): + +- "work on ..." +- "handle this" +- "take care of ..." +- "get this done" + +**Worktree opt-in phrases** (Phase 4 takes the worktree branch): + +- "in a worktree" +- "use a worktree" +- "on an isolated branch" +- "on a new branch called X" + +## Process + +### Phase 1: Preflight + +1. Verify git repo: `git rev-parse --is-inside-work-tree`. +2. Verify `/ai_plan/` is present in `.gitignore`. If missing: + - Append `/ai_plan/` to `.gitignore`. + - Commit that infra change immediately with message `chore(gitignore): ignore ai_plan local planning artifacts`. + - This infra commit is EXPLICITLY separate from the task commit in Phase 9. It may occur even when the final task ends up `aborted` or `failed`. +3. Verify required sub-skills are discoverable through Cursor-native skill discovery: the Cursor Superpowers plugin cache, `.cursor/skills/superpowers/skills/`, or `~/.cursor/skills/superpowers/skills/`. Announce each sub-skill before invocation using: + `I've read the [Skill Name] skill and I'm using it to [purpose].` + +### Phase 2: Parse Prompt and Question + +1. Capture the exact user prompt verbatim. +2. Detect trigger phrase (see above) and record which one matched. +3. Detect escape phrase. If set, skip clarifying questions entirely. +4. Apply the ask-first heuristic: + - Skip clarifying questions ONLY if ALL are true: + - Prompt names a concrete target (file, feature, or function). + - Prompt names a concrete outcome (what success looks like). + - Prompt has no ambiguous scope (no "and maybe also ..."). + - All identifiers in the prompt are resolvable against the codebase. + - Otherwise, ask 1-3 clarifying questions, ONE AT A TIME, multiple-choice preferred. + - Empty prompt → ask exactly once: "what task?". +5. Invoke `superpowers:brainstorming` through Cursor-native skill discovery for any **behavior-changing** task — feature creation, bug fix with multiple plausible approaches, refactor, design decision. Present 2-3 approaches and recommend one before finalizing the plan. The ONLY skip conditions are the same ones that allow TDD auto-skip: `pure-documentation` and `pure-comment-whitespace-rename`. When skipping, record the skip reason in the Interpretation section of `task-plan.md`. + +### Phase 3: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "do task X, review with codex gpt-5.4"), use those values. If the user says "use defaults" or otherwise opts out of explicit configuration, proceed with `REVIEWER_CLI=codex`, `REVIEWER_MODEL=gpt-5.4`, and `MAX_ROUNDS=10`. Otherwise, ask: + +1. **Which CLI should review both the plan and the implementation?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `opencode` — OpenCode CLI (`opencode run`) + - `skip` — No external review, proceed with user approval only at each loop. + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `gpt-5.4`, alternatives: `gpt-5.3-codex`, `o4-mini`, `o3`. + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku`. + - For `cursor`: **run `cursor-agent models` first** to see available models. + - For `opencode`: provider-qualified form `/` (e.g., `anthropic/claude-sonnet-4-5`, `openai/gpt-5.4`). Run `opencode models` to list available models. + - Accept any model string the user provides. + +3. **Max review rounds shared across both loops?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 4: Initialize Plan Workspace + +Cursor Agent CLI has no plan-mode concept; there is no plan-mode guard here. + +Steps: + +1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). +2. Compute plan folder: `ai_plan//`. +3. **Resume detection:** If the folder already exists, read `task-plan.md`: + - If `Status` is `draft` or `plan-approved` or `implementation-in-progress`: offer to resume, pick a new suffix (`-v2`), or abort. Default is resume. + - If `Status` is any terminal value (`pushed`, `local-only`, `aborted-*`, `failed`): offer a new suffix or abort. Default is new suffix. +4. If not resuming, create the folder and write `task-plan.md` from the template at `templates/task-plan.md` (this skill's template folder; resolves to `.cursor/skills/do-task/templates/task-plan.md` repo-local or `~/.cursor/skills/do-task/templates/task-plan.md` global when installed directly). +5. Fill in: + - `Metadata` block. + - `Prompt` (verbatim). + - `Interpretation`, `Assumptions`, `Files`, `Approach`, `TDD Approach`, `Acceptance Criteria`, `Verification`, `Rollback`. + - Leave `Runtime State`, `Review History`, `Final Status` empty (skill updates these). +6. Set `Status: draft`. + +**Worktree branch:** If the prompt opts in to a worktree (see Trigger Phrase Detection), invoke `superpowers:using-git-worktrees` via Cursor-native discovery before proceeding. Otherwise continue on the current branch. + +### Phase 5: Plan Review Loop + +If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = plan +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md +PROMPT_TEMPLATE = PLAN_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_PLAN_SESSION_ID | CURSOR_PLAN_SESSION_ID | OPENCODE_PLAN_SESSION_ID +``` + +Payload is the current `task-plan.md` **with the `Runtime State` and `Review History` blocks stripped** before writing to `PAYLOAD_PATH`. Those two blocks contain reviewer session IDs and scan outcomes that must never be sent back to any reviewer CLI. Reviewers only need the Prompt, Interpretation, Assumptions, Files, Approach, TDD Approach, Acceptance Criteria, Verification, Rollback, and Metadata sections. + +`PLAN_REVIEW_PROMPT`: + +```text +Review this task plan for completeness, correctness, and risk. Focus on: +1. Does the plan match the user's prompt? +2. Are all assumptions surfaced? +3. Are acceptance criteria testable? +4. Is the TDD approach appropriate per the TDD Approach section? +5. Are there missing files, risks, or security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: plan-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 6. + +On MAX_ROUNDS: + +- Set `Status: aborted-plan-review`. +- Send Telegram summary before stopping. +- Ask the user whether to override and proceed, restart, or abort. + +### Phase 6: Execute (TDD-first where applicable) + +Native orchestration — do not invoke `superpowers:executing-plans`. + +1. Set `Status: implementation-in-progress`. +2. For every behavior-changing file edit: + - Invoke `superpowers:test-driven-development` via Cursor-native discovery. + - Write the failing test first. Run it. Confirm it fails. + - Implement the minimal code to make it pass. Run the test. Confirm green. + - Do NOT commit yet — a single task commit happens in Phase 9. +3. Auto-skip of TDD is permitted ONLY for tasks classified in `task-plan.md` TDD Approach as: + - `pure-documentation` + - `pure-comment-whitespace-rename` +4. Any other skip (including `pure-config-addition`) requires explicit user approval recorded in `task-plan.md` with an ISO-8601 timestamp. +5. Update `task-plan.md` after each logical step: add notes to `Approach`, check off `Acceptance Criteria` items as they complete. + +### Phase 7: Verification Gate + +Invoke `superpowers:verification-before-completion` via Cursor-native discovery. + +Run the commands listed in the `Verification` section of `task-plan.md`: + +- Lint (changed files first). +- Typecheck. +- Tests (targeted first, then broader suite if quick). + +All must pass. If a command fails: + +- Fix the issue. +- Re-run that command. +- Increment `verification_attempts` in Runtime State. + +If `verification_attempts` exceeds 3 without green: + +- Set `Status: aborted-verification`. +- Send Telegram summary. +- Ask the user whether to retry, override, or abort. + +### Phase 8: Implementation Review Loop + +If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = implementation +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID +PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md +PROMPT_TEMPLATE = IMPL_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_IMPL_SESSION_ID | CURSOR_IMPL_SESSION_ID | OPENCODE_IMPL_SESSION_ID +``` + +Payload contents (assembled by the skill): + +```markdown +# Implementation Review: [Short Title] + +## Task Plan (the plan that was approved) + + +## Changes Made (git diff) + + +## Verification Output +### Lint + +### Typecheck + +### Tests + +``` + +`IMPL_REVIEW_PROMPT`: + +```text +Review this implementation against the task plan. Focus on: +1. Correctness — Does the diff satisfy the Acceptance Criteria? +2. Code quality — Clean, maintainable, no obvious issues? +3. Test coverage — Are behavior changes adequately tested (per the plan's TDD Approach)? +4. Security — Any security concerns introduced? +5. Regressions — Does the diff risk breaking unrelated code? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: implementation-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 9. + +On MAX_ROUNDS: + +- Set `Status: aborted-impl-review`. +- Send Telegram summary. +- Ask the user whether to override and commit anyway, restart, or abort. + +### Phase 9: Commit + Push Ask + +Invoke `superpowers:finishing-a-development-branch` via Cursor-native discovery. + +1. Stage all changed files explicitly (avoid `git add -A`). +2. Single commit with message derived from the task goal: + - Format: `(): ` + - Example: `feat(auth): add session token rotation` +3. Do NOT push. Update `Status: local-only`. +4. Ask the user: "Push to remote? (yes / no)" + - On explicit `yes` → push, then set `Status: pushed`. + - Any other response → leave `Status: local-only`. + +### Phase 10: Telegram Notification + Finalize + +Resolve the notifier helper (prefer repo-local, fall back to global): + +```bash +if [ -x .cursor/skills/reviewer-runtime/notify-telegram.sh ]; then + TELEGRAM_NOTIFY_RUNTIME=.cursor/skills/reviewer-runtime/notify-telegram.sh +else + TELEGRAM_NOTIFY_RUNTIME=~/.cursor/skills/reviewer-runtime/notify-telegram.sh +fi +``` + +On every terminal outcome (`pushed`, `local-only`, `aborted-*`, `failed`), send a Telegram summary if both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are set: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "do-task : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. +- Notification failures are non-blocking but must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +Fill in `Final Status` in `task-plan.md` (include commit hash if any). Do NOT delete the plan folder — it stays as a record. + +--- + +## Review Loop (Shared Subroutine) + +This subroutine is invoked twice per `do-task` run: once in Phase 5 (`REVIEW_KIND=plan`) and once in Phase 8 (`REVIEW_KIND=implementation`). Separate session IDs are used for each loop so reviewer context never leaks across loops. + +### Subroutine Inputs + +| Variable | Purpose | +|----------|---------| +| `REVIEW_KIND` | `plan` or `implementation` | +| `REVIEW_ID` | 8-char hex (from `uuidgen`); reused across rounds of the same loop | +| `PAYLOAD_PATH` | `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` | +| `PROMPT_TEMPLATE` | `PLAN_REVIEW_PROMPT` or `IMPL_REVIEW_PROMPT` | +| `REVIEWER_CLI` | `codex` \| `claude` \| `cursor` \| `opencode` \| `pi` | +| `REVIEWER_MODEL` | Model name | +| `MAX_ROUNDS` | Default 10 | +| `SESSION_ID_VAR` | `CODEX_PLAN_SESSION_ID` \| `CODEX_IMPL_SESSION_ID` \| `CURSOR_PLAN_SESSION_ID` \| `CURSOR_IMPL_SESSION_ID` \| `OPENCODE_PLAN_SESSION_ID` \| `OPENCODE_IMPL_SESSION_ID` | + +Temp artifact paths (per loop): + +- `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` — payload +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md` — normalized review text +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json` — raw Cursor/OpenCode JSON (cursor only, plus opencode when `--format json` is used) +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` + +Resolve the shared helper (prefer repo-local, fall back to global): + +```bash +if [ -x .cursor/skills/reviewer-runtime/run-review.sh ]; then + REVIEWER_RUNTIME=.cursor/skills/reviewer-runtime/run-review.sh +else + REVIEWER_RUNTIME=~/.cursor/skills/reviewer-runtime/run-review.sh +fi +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) + ;; +esac +``` + +### Step 1: Write Payload + +Write the full payload for this round to `PAYLOAD_PATH`. + +### Step 1a: Secret Scan (per-payload, no caching) + +**BEFORE** sending the payload to any reviewer CLI, scan it for secrets. This scan runs EVERY round — no results are cached. Rationale: Phase 8 payloads include newly-introduced diff content that earlier rounds never saw. + +Run the secret scan with all of these anchored regexes. Use `grep -En` on the payload file: + +```bash +SECRET_REGEX_FILE=$(mktemp) +cat >"$SECRET_REGEX_FILE" <<'EOF' +AKIA[0-9A-Z]{16} +"type"\s*:\s*"service_account" +(ghp|gho|ghs|ghu|ghr)_[A-Za-z0-9]{36,} +xox[abpsr]-[0-9]+-[0-9]+-[0-9]+-[A-Za-z0-9]{24,} +xox[abpsr]-[A-Za-z0-9]{10,48} +sk-(proj-)?[A-Za-z0-9_-]{20,} +sk-ant-(api|admin)[0-9]+-[A-Za-z0-9_-]{20,} +-----BEGIN [A-Z ]+ PRIVATE KEY----- +(TOKEN|SECRET|PASSWORD|API_?KEY|ACCESS_?KEY)\s*=\s*["']?[A-Za-z0-9+/=_-]{8,} +eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ +EOF + +SCAN_MATCHES=$(grep -Ensf "$SECRET_REGEX_FILE" "$PAYLOAD_PATH" || true) +rm -f "$SECRET_REGEX_FILE" +``` + +If `SCAN_MATCHES` is non-empty: + +1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. +2. Present the redacted match summary to the user using this exact wording: + + ```text + SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): + :: [REDACTED::-chars] + ... + Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) + ``` + + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. + +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. + +If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. + +### Step 2: Generate Reviewer Command Script + +Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` as a bash script starting with: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Round 1 — fresh `codex exec`: + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "Review the ${REVIEW_KIND} payload in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +${PROMPT_TEMPLATE}" +``` + +Do not capture the Codex session ID yet. After Round 1 completes, extract it from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` (look for `session id: `) and persist it to Runtime State under `${SESSION_ID_VAR}`. + +Round 2 and later — resume session: + +```bash +codex exec resume ${SESSION_ID_VAR_VALUE} \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before. +Keep findings ordered P0 to P3, use '- None.' when a severity has no findings, and only use VERDICT: APPROVED when no P0, P1, or P2 findings remain." +``` + +If resume fails, fall back to fresh `codex exec` with prior-round context. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call every round (Claude CLI has no session resume): + +```bash +claude -p \ + "${ROUND_PREFIX}Review the following ${REVIEW_KIND} payload. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +${PROMPT_TEMPLATE}" \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +Where `${ROUND_PREFIX}` is empty for Round 1 and `"You previously reviewed this ${REVIEW_KIND} and requested revisions. Previous feedback summary: [key points]. "` for subsequent rounds. + +**If `REVIEWER_CLI` is `cursor`:** + +Round 1: + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later — resume: + +```bash +cursor-agent --resume ${SESSION_ID_VAR_VALUE} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p`. + +After the command completes, extract the session id and review text: + +```bash +CURSOR_SID=$(jq -r '.session_id' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +Persist `CURSOR_SID` to Runtime State under `${SESSION_ID_VAR}` on Round 1. + +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode does not expose a dedicated read-only flag at the CLI level; use the built-in `plan` primary agent (`--agent plan`) for review, which is read-oriented and does not modify files. Session resume is supported via `-s `, but the most reliable pattern for non-interactive review is **fresh call each round** (like `claude`) because opencode's session lifecycle and ID capture are less standardized than codex/cursor for headless runs. Skills MAY opt-in to session resume when they have verified the installed opencode version exposes a stable session id in `--format json` output. + +Round 1 (preferred, fresh call): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call fallback path — recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this ${REVIEW_KIND} and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is below. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Optional session-resume path (only if the installed opencode reliably emits a session id in `--format json` output and accepts it back via `-s`): + +```bash +# Round 2+ with resume +opencode run \ + -s ${SESSION_ID_VAR_VALUE} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've revised. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Extract the review body (the JSON stream emits events; the final assistant message contains the review text): + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + || cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output and surface a warning to the user. On any opencode CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the helper-failure escalation in Step 6. + +### Step 3: Run via `run-review.sh` + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + --status-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + >/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + 2>/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll the `.status` file instead of treating heartbeats as post-hoc-only data. + +### Step 4: Promote Reviewer Output + Capture Session ID + +After the command completes: + +- `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. +- `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `claude` or `pi`: promote `.runner.out` into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. + +On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. + +### Step 5: Parse Verdict + Update Review History + +1. Read `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md`. +2. Append one row to `task-plan.md` Review History: + - Timestamp (ISO-8601 UTC). + - Loop (`plan` or `implementation`). + - Round number. + - Verdict (`APPROVED` or `REVISE`). + - Summary (first line of the `## Summary` section). +3. Increment `plan_review_round` or `implementation_review_round` in Runtime State. + +### Step 6: Branch APPROVED / REVISE / MAX_ROUNDS + +Verdict rules: + +- **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → exit the subroutine with `APPROVED`. +- **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if cheap and safe, then exit with `APPROVED`. +- **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to revision (see below), then return to Step 1 for the next round. +- No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as APPROVED. +- Helper state `completed-empty-output` → treat as failed review attempt, surface `.stderr`/`.status`, fix invocation or prompt handling, then retry. +- Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters. +- Round counter ≥ `MAX_ROUNDS` → exit the subroutine with `MAX_ROUNDS`. Caller decides next action per Phase 5 or Phase 8. + +**Revision:** The caller (Phase 5 for plan, Phase 6/7 for implementation) applies findings in priority order (`P0` → `P1` → `P2` → `P3`). For implementation review revisions, Phase 7 verification must be re-run after every revision before returning to Step 1. + +### Step 7: Liveness Contract (during Step 3) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- Keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +### Step 8: Cleanup (on successful round exit) + +```bash +rm -f /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, KEEP `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them. + +--- + +## Resume Semantics + +1. Detect existing plan folder by slug at Phase 4. +2. Read `task-plan.md` → `Status`. +3. Decide next action: + + | Status | Action | + |--------|--------| + | `draft` | Resume at Phase 5 (plan review) | + | `plan-approved` | Resume at Phase 6 (execute) | + | `implementation-in-progress` | Resume at Phase 6 (continue execute) | + | `implementation-approved` | Resume at Phase 9 (commit + push ask) | + | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | + | `aborted-*` \| `failed` | Offer new suffix or full restart | + +4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. + +--- + +## Tracker Discipline (MANDATORY) + +**ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** + +Before starting any phase: + +1. Update `Status` if it transitions. +2. Update `last_phase_entered` in Runtime State. + +After completing any phase: + +1. Update `Status` if it transitions. +2. Append notes to the relevant section of `task-plan.md`. + +Review History is append-only. + +--- + +## Execution Workflow Rules + +- Current branch is the default; worktree is opt-in only. +- Do NOT push without explicit "yes". +- Secret scan runs **per-payload, no caching** — every round, including revisions. +- Review loops use `MAX_ROUNDS=10` by default, shared across both loops. +- The task commit is a single commit created in Phase 9; interim WIP commits are NOT created. +- The `.gitignore` infra commit in Phase 1 is explicitly separate from the task commit and is allowed even on abort. + +--- + +## Verification Checklist + +- [ ] `ai_plan/` exists and `/ai_plan/` is in `.gitignore` +- [ ] `task-plan.md` created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer CLI + model + `MAX_ROUNDS` configured (or `skip`) +- [ ] Secret scan ran on every outbound reviewer payload +- [ ] Plan review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Phase 6 executed TDD-first for all behavior-changing steps (or documented skip) +- [ ] Phase 7 verification green before Phase 8 +- [ ] Implementation review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Single task commit created locally, no push without explicit yes +- [ ] Telegram notification attempted if configured +- [ ] `task-plan.md` Final Status filled in + +--- + +## Variant Hardening Notes — Cursor + +- Must use Cursor-native discovery from `.cursor/skills/`, `~/.cursor/skills/`, or installed Cursor plugin cache entries. +- Reviewer invocation MUST use `--mode=ask --trust --output-format json`. Never `--mode=agent`, never `--force`, never write-capable modes for reviewer calls. +- `jq` is a hard prerequisite because the cursor reviewer branch always returns JSON that must be parsed for `session_id` and `result`. +- Helper paths are `.cursor/skills/reviewer-runtime/...` preferred, with `~/.cursor/skills/reviewer-runtime/...` as the fallback path. +- Sub-skills are invoked through Cursor-native discovery with explicit announcement — Cursor does not expose a `Skill` tool. +- `cursor-agent --version` must succeed as part of the prerequisite check. The binary is `cursor-agent`; the alias `cursor agent` is equivalent. +- No plan-mode guard (Cursor Agent CLI has no plan-mode concept). + +## Common Mistakes + +- Forgetting `--trust` flag when running `cursor-agent` non-interactively (causes interactive prompt). +- Using `--mode=agent` or `--force` for reviews (reviewer must be read-only, use `--mode=ask`). +- Forgetting to install `jq` (cursor reviewer branch silently breaks). +- Skipping workspace-discovery skill verification in Prerequisite Check. +- Asking multiple clarifying questions in a single message. +- Skipping the per-payload secret scan because "the previous round was clean". +- Pushing the task commit without explicit user approval. + +## Red Flags — Stop and Correct + +- Reviewer CLI is running with `--mode=agent`, `--force`, or any write-capable flag. +- You did not announce which skill you invoked and why. +- You are proceeding to implementation review with failing lint/typecheck/tests. +- You are echoing raw secret-scan matches to the user or logs. +- You are pushing without explicit user approval. diff --git a/skills/do-task/_source/cursor/templates/task-plan.md b/skills/do-task/_source/cursor/templates/task-plan.md new file mode 100644 index 0000000..6691020 --- /dev/null +++ b/skills/do-task/_source/cursor/templates/task-plan.md @@ -0,0 +1,143 @@ +# Task Plan: [Short Title] + +> **Variant guardrail (Cursor):** Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through workspace discovery from `.cursor/skills/superpowers/skills//SKILL.md` or `~/.cursor/skills/superpowers/skills//SKILL.md`. Reviewer invocations MUST use `--mode=ask --trust --output-format json`. `jq` is a hard prerequisite. + +## Metadata + +| Field | Value | +|-------|-------| +| Created | YYYY-MM-DD | +| Slug | YYYY-MM-DD- | +| Runtime | cursor | +| Reviewer CLI | codex \| claude \| cursor \| opencode \| pi | +| Reviewer Model | | +| MAX_ROUNDS | 10 | +| Branch Strategy | current-branch \| worktree | +| Branch Name | | +| Worktree Path | | +| Status | draft | + +### Status Enum (authoritative) + +| Value | Meaning | +|-------|---------| +| `draft` | Newly created; plan review not yet started | +| `plan-approved` | Plan review loop returned APPROVED | +| `implementation-in-progress` | Phase 6 executing | +| `implementation-approved` | Phase 8 review loop returned APPROVED; awaiting commit | +| `pushed` | Committed + pushed to remote | +| `local-only` | Committed locally; user declined push | +| `aborted-plan-review` | MAX_ROUNDS reached in Phase 5; user aborted | +| `aborted-impl-review` | MAX_ROUNDS reached in Phase 8; user aborted | +| `aborted-verification` | Phase 7 retries exhausted; user aborted | +| `failed` | Hard tooling failure | + +--- + +## Prompt + + + +## Interpretation + + + +## Assumptions + + + +## Files + + + +| Action | Path | Why | +|--------|------|-----| +| | | | + +## Approach + + + +## TDD Approach + + + +## Acceptance Criteria + +- [ ] +- [ ] + +## Verification + + + +## Rollback + + + +--- + +## Runtime State + + + +```yaml +plan_review_round: 0 +implementation_review_round: 0 +CODEX_PLAN_SESSION_ID: +CODEX_IMPL_SESSION_ID: +CURSOR_PLAN_SESSION_ID: +CURSOR_IMPL_SESSION_ID: +OPENCODE_PLAN_SESSION_ID: +OPENCODE_IMPL_SESSION_ID: +last_phase_entered: +last_round_ts: +last_scan_outcome_plan: +last_scan_outcome_impl: +verification_attempts: 0 +tests_added_count: 0 +tdd_used: false +``` + +## Review History + + + +| Timestamp (ISO-8601) | Loop | Round | Verdict | Summary | +|----------------------|------|-------|---------|---------| +| | | | | | + +## Final Status + + + +--- + +## Guardrails (do NOT remove) + +- This file is the single persistent artifact for `do-task`. Do not split it or delete it on success. +- `Status` must always match one of the 10 enum values. +- `Runtime State` is updated by the skill, not by the user. +- Review History is append-only. +- `last_scan_outcome_plan` and `last_scan_outcome_impl` record the most recent secret-scan result for each loop. They are informational; the scan itself runs per-payload with no caching. diff --git a/skills/do-task/_source/opencode/SKILL.md b/skills/do-task/_source/opencode/SKILL.md new file mode 100644 index 0000000..759fac9 --- /dev/null +++ b/skills/do-task/_source/opencode/SKILL.md @@ -0,0 +1,848 @@ +--- +name: do-task +description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review) in OpenCode. ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). +--- + +# Do Task (OpenCode) + +Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. + +This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `implement-plan`, `do-task` operates on one persistent `task-plan.md` (not a full milestone plan) and defaults to the **current branch** (not a worktree). + +**Core principle:** OpenCode loads skills through its native skill tool. Local skills live under `~/.config/opencode/skills/`, and OpenCode can also expose shared agent skills from `~/.agents/skills/`. Sub-skill invocations use OpenCode's native mechanism — not Claude's `Skill` tool, not Cursor's discovery mechanism. + +## Prerequisite Check (MANDATORY) + +Required: + +- OpenCode CLI: `opencode --version` (install via your package manager or `brew install opencode`). +- Superpowers repo: `https://github.com/obra/superpowers` +- OpenCode Superpowers skills available at `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers` +- `superpowers/brainstorming` +- `superpowers/test-driven-development` +- `superpowers/verification-before-completion` +- `superpowers/finishing-a-development-branch` +- `superpowers/using-git-worktrees` (only when the prompt opts in to a worktree) +- Shared reviewer runtime: `~/.config/opencode/skills/reviewer-runtime/run-review.sh` +- Telegram notifier helper: `~/.config/opencode/skills/reviewer-runtime/notify-telegram.sh` + +Verify before proceeding: + +```bash +opencode --version +test -f ~/.agents/skills/superpowers/brainstorming/SKILL.md || test -f ~/.config/opencode/skills/superpowers/brainstorming/SKILL.md +test -f ~/.agents/skills/superpowers/test-driven-development/SKILL.md || test -f ~/.config/opencode/skills/superpowers/test-driven-development/SKILL.md +test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md || test -f ~/.config/opencode/skills/superpowers/verification-before-completion/SKILL.md +test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md || test -f ~/.config/opencode/skills/superpowers/finishing-a-development-branch/SKILL.md +``` + +If any required dependency is missing, stop immediately and return: + +`Missing dependency: [specific missing item]. Install required OpenCode Superpowers skills (https://github.com/obra/superpowers, OpenCode setup) and the reviewer-runtime helper, then retry.` + +## Required Skill Invocation Rules + +- Invoke relevant skills through OpenCode's native skill tool. +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- For skills with checklists, track checklist items explicitly in conversation. +- Do NOT use Claude's `Skill` tool syntax or Cursor's discovery mechanism. OpenCode's skill system may expose shared files from `~/.agents/skills/`, but invocation still goes through OpenCode's native skill mechanism. + +## Trigger Phrase Detection + +**Binding triggers** (always invoke this skill): + +- `/do-task` +- "do this task" +- "do task ..." +- "execute this task" +- "make it so" + +**Hint trigger** (invoke unless context clearly maps to another skill): + +- "just do ..." + +**Escape phrases** (skip the Phase 2 clarifying-question loop): + +- `--no-questions` +- `"just do it:"` +- `"just do this:"` +- `"no questions:"` + +**Excluded** (do NOT trigger `do-task`): + +- "implement this" — reserved for `implement-plan`. + +**Dropped defaults** (explicitly NOT binding triggers): + +- "work on ..." +- "handle this" +- "take care of ..." +- "get this done" + +**Worktree opt-in phrases** (Phase 4 takes the worktree branch): + +- "in a worktree" +- "use a worktree" +- "on an isolated branch" +- "on a new branch called X" + +## Process + +### Phase 1: Preflight (includes Bootstrap Superpowers Context) + +1. **Bootstrap Superpowers context** — use OpenCode's native skill tool to list installed skills and confirm `superpowers/brainstorming`, `superpowers/test-driven-development`, `superpowers/verification-before-completion`, and `superpowers/finishing-a-development-branch` are discoverable. If any is missing, stop with the Prerequisite Check error message. +2. Verify git repo: `git rev-parse --is-inside-work-tree`. +3. Verify `/ai_plan/` is present in `.gitignore`. If missing: + - Append `/ai_plan/` to `.gitignore`. + - Commit that infra change immediately with message `chore(gitignore): ignore ai_plan local planning artifacts`. + - This infra commit is EXPLICITLY separate from the task commit in Phase 9. It may occur even when the final task ends up `aborted` or `failed`. +4. Announce each sub-skill before invocation using: + `I've read the [Skill Name] skill and I'm using it to [purpose].` + +### Phase 2: Parse Prompt and Question + +1. Capture the exact user prompt verbatim. +2. Detect trigger phrase (see above) and record which one matched. +3. Detect escape phrase. If set, skip clarifying questions entirely. +4. Apply the ask-first heuristic: + - Skip clarifying questions ONLY if ALL are true: + - Prompt names a concrete target (file, feature, or function). + - Prompt names a concrete outcome (what success looks like). + - Prompt has no ambiguous scope (no "and maybe also ..."). + - All identifiers in the prompt are resolvable against the codebase. + - Otherwise, ask 1-3 clarifying questions, ONE AT A TIME, multiple-choice preferred. + - Empty prompt → ask exactly once: "what task?". +5. Invoke `superpowers/brainstorming` via OpenCode's native skill tool for any **behavior-changing** task — feature creation, bug fix with multiple plausible approaches, refactor, design decision. Present 2-3 approaches and recommend one before finalizing the plan. The ONLY skip conditions are the same ones that allow TDD auto-skip: `pure-documentation` and `pure-comment-whitespace-rename`. When skipping, record the skip reason in the Interpretation section of `task-plan.md`. + +### Phase 3: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "do task X, review with codex gpt-5.4"), use those values. If the user says "use defaults" or otherwise opts out of explicit configuration, proceed with `REVIEWER_CLI=codex`, `REVIEWER_MODEL=gpt-5.4`, and `MAX_ROUNDS=10`. Otherwise, ask: + +1. **Which CLI should review both the plan and the implementation?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `opencode` — OpenCode CLI (`opencode run`) + - `skip` — No external review, proceed with user approval only at each loop. + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `gpt-5.4`, alternatives: `gpt-5.3-codex`, `o4-mini`, `o3`. + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku`. + - For `cursor`: **run `cursor-agent models` first** to see available models. + - For `opencode`: provider-qualified form `/` (e.g., `anthropic/claude-sonnet-4-5`, `openai/gpt-5.4`). Run `opencode models` to list available models. + - Accept any model string the user provides. + +3. **Max review rounds shared across both loops?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 4: Initialize Plan Workspace + +OpenCode has no plan-mode concept; there is no plan-mode guard here. + +Steps: + +1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). +2. Compute plan folder: `ai_plan//`. +3. **Resume detection:** If the folder already exists, read `task-plan.md`: + - If `Status` is `draft` or `plan-approved` or `implementation-in-progress`: offer to resume, pick a new suffix (`-v2`), or abort. Default is resume. + - If `Status` is any terminal value (`pushed`, `local-only`, `aborted-*`, `failed`): offer a new suffix or abort. Default is new suffix. +4. If not resuming, create the folder and write `task-plan.md` from the template at `templates/task-plan.md` (this skill's template folder; falls back to `~/.config/opencode/skills/do-task/templates/task-plan.md` when installed directly). +5. Fill in: + - `Metadata` block. + - `Prompt` (verbatim). + - `Interpretation`, `Assumptions`, `Files`, `Approach`, `TDD Approach`, `Acceptance Criteria`, `Verification`, `Rollback`. + - Leave `Runtime State`, `Review History`, `Final Status` empty (skill updates these). +6. Set `Status: draft`. + +**Worktree branch:** If the prompt opts in to a worktree (see Trigger Phrase Detection), invoke `superpowers/using-git-worktrees` via OpenCode's native skill tool before proceeding. Otherwise continue on the current branch. + +### Phase 5: Plan Review Loop + +If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = plan +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md +PROMPT_TEMPLATE = PLAN_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_PLAN_SESSION_ID | CURSOR_PLAN_SESSION_ID | OPENCODE_PLAN_SESSION_ID +``` + +Payload is the current `task-plan.md` **with the `Runtime State` and `Review History` blocks stripped** before writing to `PAYLOAD_PATH`. Those two blocks contain reviewer session IDs and scan outcomes that must never be sent back to any reviewer CLI. Reviewers only need the Prompt, Interpretation, Assumptions, Files, Approach, TDD Approach, Acceptance Criteria, Verification, Rollback, and Metadata sections. + +`PLAN_REVIEW_PROMPT`: + +```text +Review this task plan for completeness, correctness, and risk. Focus on: +1. Does the plan match the user's prompt? +2. Are all assumptions surfaced? +3. Are acceptance criteria testable? +4. Is the TDD approach appropriate per the TDD Approach section? +5. Are there missing files, risks, or security concerns? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: plan-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 6. + +On MAX_ROUNDS: + +- Set `Status: aborted-plan-review`. +- Send Telegram summary before stopping. +- Ask the user whether to override and proceed, restart, or abort. + +### Phase 6: Execute (TDD-first where applicable) + +Native orchestration — do not invoke `superpowers:executing-plans`. + +1. Set `Status: implementation-in-progress`. +2. For every behavior-changing file edit: + - Invoke `superpowers/test-driven-development` via OpenCode's native skill tool. + - Write the failing test first. Run it. Confirm it fails. + - Implement the minimal code to make it pass. Run the test. Confirm green. + - Do NOT commit yet — a single task commit happens in Phase 9. +3. Auto-skip of TDD is permitted ONLY for tasks classified in `task-plan.md` TDD Approach as: + - `pure-documentation` + - `pure-comment-whitespace-rename` +4. Any other skip (including `pure-config-addition`) requires explicit user approval recorded in `task-plan.md` with an ISO-8601 timestamp. +5. Update `task-plan.md` after each logical step: add notes to `Approach`, check off `Acceptance Criteria` items as they complete. + +### Phase 7: Verification Gate + +Invoke `superpowers/verification-before-completion` via OpenCode's native skill tool. + +Run the commands listed in the `Verification` section of `task-plan.md`: + +- Lint (changed files first). +- Typecheck. +- Tests (targeted first, then broader suite if quick). + +All must pass. If a command fails: + +- Fix the issue. +- Re-run that command. +- Increment `verification_attempts` in Runtime State. + +If `verification_attempts` exceeds 3 without green: + +- Set `Status: aborted-verification`. +- Send Telegram summary. +- Ask the user whether to retry, override, or abort. + +### Phase 8: Implementation Review Loop + +If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and proceed only after explicit user approval. + +Otherwise, invoke the Review Loop (Shared Subroutine) with: + +```text +REVIEW_KIND = implementation +REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID +PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md +PROMPT_TEMPLATE = IMPL_REVIEW_PROMPT (see below) +SESSION_ID_VAR = CODEX_IMPL_SESSION_ID | CURSOR_IMPL_SESSION_ID | OPENCODE_IMPL_SESSION_ID +``` + +Payload contents (assembled by the skill): + +```markdown +# Implementation Review: [Short Title] + +## Task Plan (the plan that was approved) + + +## Changes Made (git diff) + + +## Verification Output +### Lint + +### Typecheck + +### Tests + +``` + +`IMPL_REVIEW_PROMPT`: + +```text +Review this implementation against the task plan. Focus on: +1. Correctness — Does the diff satisfy the Acceptance Criteria? +2. Code quality — Clean, maintainable, no obvious issues? +3. Test coverage — Are behavior changes adequately tested (per the plan's TDD Approach)? +4. Security — Any security concerns introduced? +5. Regressions — Does the diff risk breaking unrelated code? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE`. +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking. +``` + +On APPROVED: + +- Set `Status: implementation-approved`. +- Append APPROVED row to Review History. +- Proceed to Phase 9. + +On MAX_ROUNDS: + +- Set `Status: aborted-impl-review`. +- Send Telegram summary. +- Ask the user whether to override and commit anyway, restart, or abort. + +### Phase 9: Commit + Push Ask + +Invoke `superpowers/finishing-a-development-branch` via OpenCode's native skill tool. + +1. Stage all changed files explicitly (avoid `git add -A`). +2. Single commit with message derived from the task goal: + - Format: `(): ` + - Example: `feat(auth): add session token rotation` +3. Do NOT push. Update `Status: local-only`. +4. Ask the user: "Push to remote? (yes / no)" + - On explicit `yes` → push, then set `Status: pushed`. + - Any other response → leave `Status: local-only`. + +### Phase 10: Telegram Notification + Finalize + +Resolve the notifier helper: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.config/opencode/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome (`pushed`, `local-only`, `aborted-*`, `failed`), send a Telegram summary if both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are set: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "do-task : " +fi +``` + +Rules: + +- Telegram is the only supported notification path. +- Notification failures are non-blocking but must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +Fill in `Final Status` in `task-plan.md` (include commit hash if any). Do NOT delete the plan folder — it stays as a record. + +--- + +## Review Loop (Shared Subroutine) + +This subroutine is invoked twice per `do-task` run: once in Phase 5 (`REVIEW_KIND=plan`) and once in Phase 8 (`REVIEW_KIND=implementation`). Separate session IDs are used for each loop so reviewer context never leaks across loops. + +### Subroutine Inputs + +| Variable | Purpose | +|----------|---------| +| `REVIEW_KIND` | `plan` or `implementation` | +| `REVIEW_ID` | 8-char hex (from `uuidgen`); reused across rounds of the same loop | +| `PAYLOAD_PATH` | `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` | +| `PROMPT_TEMPLATE` | `PLAN_REVIEW_PROMPT` or `IMPL_REVIEW_PROMPT` | +| `REVIEWER_CLI` | `codex` \| `claude` \| `cursor` \| `opencode` \| `pi` | +| `REVIEWER_MODEL` | Model name | +| `MAX_ROUNDS` | Default 10 | +| `SESSION_ID_VAR` | `CODEX_PLAN_SESSION_ID` \| `CODEX_IMPL_SESSION_ID` \| `CURSOR_PLAN_SESSION_ID` \| `CURSOR_IMPL_SESSION_ID` \| `OPENCODE_PLAN_SESSION_ID` \| `OPENCODE_IMPL_SESSION_ID` | + +Temp artifact paths (per loop): + +- `/tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md` — payload +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md` — normalized review text +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json` — raw Cursor/OpenCode JSON (cursor only, plus opencode when `--format json` is used) +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` +- `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` + +Resolve the shared helper: + +```bash +REVIEWER_RUNTIME=~/.config/opencode/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) + ;; +esac +``` + +### Step 1: Write Payload + +Write the full payload for this round to `PAYLOAD_PATH`. + +### Step 1a: Secret Scan (per-payload, no caching) + +**BEFORE** sending the payload to any reviewer CLI, scan it for secrets. This scan runs EVERY round — no results are cached. Rationale: Phase 8 payloads include newly-introduced diff content that earlier rounds never saw. + +Run the secret scan with all of these anchored regexes. Use `grep -En` on the payload file: + +```bash +SECRET_REGEX_FILE=$(mktemp) +cat >"$SECRET_REGEX_FILE" <<'EOF' +AKIA[0-9A-Z]{16} +"type"\s*:\s*"service_account" +(ghp|gho|ghs|ghu|ghr)_[A-Za-z0-9]{36,} +xox[abpsr]-[0-9]+-[0-9]+-[0-9]+-[A-Za-z0-9]{24,} +xox[abpsr]-[A-Za-z0-9]{10,48} +sk-(proj-)?[A-Za-z0-9_-]{20,} +sk-ant-(api|admin)[0-9]+-[A-Za-z0-9_-]{20,} +-----BEGIN [A-Z ]+ PRIVATE KEY----- +(TOKEN|SECRET|PASSWORD|API_?KEY|ACCESS_?KEY)\s*=\s*["']?[A-Za-z0-9+/=_-]{8,} +eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+ +EOF + +SCAN_MATCHES=$(grep -Ensf "$SECRET_REGEX_FILE" "$PAYLOAD_PATH" || true) +rm -f "$SECRET_REGEX_FILE" +``` + +If `SCAN_MATCHES` is non-empty: + +1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. +2. Present the redacted match summary to the user using this exact wording: + + ```text + SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): + :: [REDACTED::-chars] + ... + Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) + ``` + + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. + +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. + +If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. + +### Step 2: Generate Reviewer Command Script + +Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` as a bash script starting with: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Round 1 — fresh `codex exec`: + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "Review the ${REVIEW_KIND} payload in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +${PROMPT_TEMPLATE}" +``` + +Do not capture the Codex session ID yet. After Round 1 completes, extract it from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` (look for `session id: `) and persist it to Runtime State under `${SESSION_ID_VAR}`. + +Round 2 and later — resume session: + +```bash +codex exec resume ${SESSION_ID_VAR_VALUE} \ + -o /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before. +Keep findings ordered P0 to P3, use '- None.' when a severity has no findings, and only use VERDICT: APPROVED when no P0, P1, or P2 findings remain." +``` + +If resume fails, fall back to fresh `codex exec` with prior-round context. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call every round (Claude CLI has no session resume): + +```bash +claude -p \ + "${ROUND_PREFIX}Review the following ${REVIEW_KIND} payload. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +${PROMPT_TEMPLATE}" \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +Where `${ROUND_PREFIX}` is empty for Round 1 and `"You previously reviewed this ${REVIEW_KIND} and requested revisions. Previous feedback summary: [key points]. "` for subsequent rounds. + +**If `REVIEWER_CLI` is `cursor`:** + +Round 1: + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later — resume: + +```bash +cursor-agent --resume ${SESSION_ID_VAR_VALUE} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've revised based on your feedback. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p`. + +After the command completes, extract the session id and review text: + +```bash +CURSOR_SID=$(jq -r '.session_id' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +Persist `CURSOR_SID` to Runtime State under `${SESSION_ID_VAR}` on Round 1. + +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode does not expose a dedicated read-only flag at the CLI level; use the built-in `plan` primary agent (`--agent plan`) for review, which is read-oriented and does not modify files. Session resume is supported via `-s `, but the most reliable pattern for non-interactive review is **fresh call each round** (like `claude`) because opencode's session lifecycle and ID capture are less standardized than codex/cursor for headless runs. Skills MAY opt-in to session resume when they have verified the installed opencode version exposes a stable session id in `--format json` output. + +Round 1 (preferred, fresh call): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review. + +${PROMPT_TEMPLATE}" \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call fallback path — recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this ${REVIEW_KIND} and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated payload is below. + +$(cat /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Optional session-resume path (only if the installed opencode reliably emits a session id in `--format json` output and accepts it back via `-s`): + +```bash +# Round 2+ with resume +opencode run \ + -s ${SESSION_ID_VAR_VALUE} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've revised. Updated payload is in /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json +``` + +Extract the review body (the JSON stream emits events; the final assistant message contains the review text): + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + > /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + || cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output and surface a warning to the user. On any opencode CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the helper-failure escalation in Step 6. + +### Step 3: Run via `run-review.sh` + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + --status-file /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh \ + >/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + 2>/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll the `.status` file instead of treating heartbeats as post-hoc-only data. + +### Step 4: Promote Reviewer Output + Capture Session ID + +After the command completes: + +- `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. +- `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `claude` or `pi`: promote `.runner.out` into the `.md` file: + + ```bash + cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md + ``` + +- `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. + +On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. + +### Step 5: Parse Verdict + Update Review History + +1. Read `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md`. +2. Append one row to `task-plan.md` Review History: + - Timestamp (ISO-8601 UTC). + - Loop (`plan` or `implementation`). + - Round number. + - Verdict (`APPROVED` or `REVISE`). + - Summary (first line of the `## Summary` section). +3. Increment `plan_review_round` or `implementation_review_round` in Runtime State. + +### Step 6: Branch APPROVED / REVISE / MAX_ROUNDS + +Verdict rules: + +- **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings → exit the subroutine with `APPROVED`. +- **VERDICT: APPROVED** with only `P3` findings → optionally fix the `P3` items if cheap and safe, then exit with `APPROVED`. +- **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding → go to revision (see below), then return to Step 1 for the next round. +- No clear verdict but `P0`, `P1`, and `P2` are all `- None.` → treat as APPROVED. +- Helper state `completed-empty-output` → treat as failed review attempt, surface `.stderr`/`.status`, fix invocation or prompt handling, then retry. +- Helper state `needs-operator-decision` → surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters. +- Round counter ≥ `MAX_ROUNDS` → exit the subroutine with `MAX_ROUNDS`. Caller decides next action per Phase 5 or Phase 8. + +**Revision:** The caller (Phase 5 for plan, Phase 6/7 for implementation) applies findings in priority order (`P0` → `P1` → `P2` → `P3`). For implementation review revisions, Phase 7 verification must be re-run after every revision before returning to Step 1. + +### Step 7: Liveness Contract (during Step 3) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- Keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +### Step 8: Cleanup (on successful round exit) + +```bash +rm -f /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.json \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.stderr \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.status \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ + /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, KEEP `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them. + +--- + +## Resume Semantics + +1. Detect existing plan folder by slug at Phase 4. +2. Read `task-plan.md` → `Status`. +3. Decide next action: + + | Status | Action | + |--------|--------| + | `draft` | Resume at Phase 5 (plan review) | + | `plan-approved` | Resume at Phase 6 (execute) | + | `implementation-in-progress` | Resume at Phase 6 (continue execute) | + | `implementation-approved` | Resume at Phase 9 (commit + push ask) | + | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | + | `aborted-*` \| `failed` | Offer new suffix or full restart | + +4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. + +--- + +## Tracker Discipline (MANDATORY) + +**ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** + +Before starting any phase: + +1. Update `Status` if it transitions. +2. Update `last_phase_entered` in Runtime State. + +After completing any phase: + +1. Update `Status` if it transitions. +2. Append notes to the relevant section of `task-plan.md`. + +Review History is append-only. + +--- + +## Execution Workflow Rules + +- Current branch is the default; worktree is opt-in only. +- Do NOT push without explicit "yes". +- Secret scan runs **per-payload, no caching** — every round, including revisions. +- Review loops use `MAX_ROUNDS=10` by default, shared across both loops. +- The task commit is a single commit created in Phase 9; interim WIP commits are NOT created. +- The `.gitignore` infra commit in Phase 1 is explicitly separate from the task commit and is allowed even on abort. + +--- + +## Verification Checklist + +- [ ] `ai_plan/` exists and `/ai_plan/` is in `.gitignore` +- [ ] `task-plan.md` created under `ai_plan/YYYY-MM-DD-/` +- [ ] Reviewer CLI + model + `MAX_ROUNDS` configured (or `skip`) +- [ ] Secret scan ran on every outbound reviewer payload +- [ ] Plan review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Phase 6 executed TDD-first for all behavior-changing steps (or documented skip) +- [ ] Phase 7 verification green before Phase 8 +- [ ] Implementation review completed (APPROVED, MAX_ROUNDS handled, or skipped) +- [ ] Single task commit created locally, no push without explicit yes +- [ ] Telegram notification attempted if configured +- [ ] `task-plan.md` Final Status filled in + +--- + +## Variant Hardening Notes — OpenCode + +- Must use OpenCode's native skill tool for sub-skill invocation. Do NOT use Claude's `Skill` tool syntax. OpenCode may load shared skill files from `~/.agents/skills/`, but invocation is still OpenCode-native. +- Phase 1 includes a Bootstrap Superpowers Context step that lists installed skills and confirms `superpowers/brainstorming`, `superpowers/test-driven-development`, `superpowers/verification-before-completion`, and `superpowers/finishing-a-development-branch` are discoverable before any other phase runs. +- Helper paths are `~/.config/opencode/skills/reviewer-runtime/{run-review.sh,notify-telegram.sh}`. +- OpenCode reviewer CLI branch (when `REVIEWER_CLI=opencode`): + - Binary: `opencode`. Non-interactive: `opencode run ""`. + - Model: `-m /` (e.g., `openai/gpt-5.4`, `anthropic/claude-sonnet-4-5`). + - Read-only posture: `--agent plan` (uses OpenCode's built-in plan primary agent; no explicit `--read-only` flag exists). + - Output: `--format json` for structured output. Extraction uses `jq` against the JSON event stream. + - Session resume: `-s ` or `--continue`. Fresh call each round is the recommended default since session id capture is less standardized than codex/cursor for headless runs. +- No plan-mode guard (OpenCode has no plan-mode concept). + +## Common Mistakes + +- Skipping the Bootstrap Superpowers Context step in Phase 1 (breaks native skill discovery). +- Using Claude `Skill` tool syntax, or treating shared `~/.agents/skills/` files as anything other than OpenCode-native skill entries. +- Forgetting to set `--agent plan` on opencode reviewer calls (would use the default `build` agent which can write files). +- Asking multiple clarifying questions in a single message. +- Skipping the per-payload secret scan because "the previous round was clean". +- Pushing the task commit without explicit user approval. +- Using a non-provider-qualified model string for opencode (e.g., `gpt-5.4` instead of `openai/gpt-5.4`). + +## Red Flags — Stop and Correct + +- You are invoking sub-skills via Claude's `Skill` tool or Codex native-discovery paths instead of OpenCode's native skill tool. +- You are running an opencode reviewer call without `--agent plan`. +- You did not announce which skill you invoked and why. +- You are proceeding to implementation review with failing lint/typecheck/tests. +- You are echoing raw secret-scan matches to the user or logs. +- You are pushing without explicit user approval. diff --git a/skills/do-task/_source/opencode/templates/task-plan.md b/skills/do-task/_source/opencode/templates/task-plan.md new file mode 100644 index 0000000..ce95197 --- /dev/null +++ b/skills/do-task/_source/opencode/templates/task-plan.md @@ -0,0 +1,143 @@ +# Task Plan: [Short Title] + +> **Variant guardrail (OpenCode):** Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through OpenCode's native skill tool from `~/.config/opencode/skills/superpowers//SKILL.md`. Phase 1 MUST include the Bootstrap Superpowers Context step. Opencode reviewer calls MUST use `--agent plan` to stay read-only. + +## Metadata + +| Field | Value | +|-------|-------| +| Created | YYYY-MM-DD | +| Slug | YYYY-MM-DD- | +| Runtime | opencode | +| Reviewer CLI | codex \| claude \| cursor \| opencode \| pi | +| Reviewer Model | | +| MAX_ROUNDS | 10 | +| Branch Strategy | current-branch \| worktree | +| Branch Name | | +| Worktree Path | | +| Status | draft | + +### Status Enum (authoritative) + +| Value | Meaning | +|-------|---------| +| `draft` | Newly created; plan review not yet started | +| `plan-approved` | Plan review loop returned APPROVED | +| `implementation-in-progress` | Phase 6 executing | +| `implementation-approved` | Phase 8 review loop returned APPROVED; awaiting commit | +| `pushed` | Committed + pushed to remote | +| `local-only` | Committed locally; user declined push | +| `aborted-plan-review` | MAX_ROUNDS reached in Phase 5; user aborted | +| `aborted-impl-review` | MAX_ROUNDS reached in Phase 8; user aborted | +| `aborted-verification` | Phase 7 retries exhausted; user aborted | +| `failed` | Hard tooling failure | + +--- + +## Prompt + + + +## Interpretation + + + +## Assumptions + + + +## Files + + + +| Action | Path | Why | +|--------|------|-----| +| | | | + +## Approach + + + +## TDD Approach + + + +## Acceptance Criteria + +- [ ] +- [ ] + +## Verification + + + +## Rollback + + + +--- + +## Runtime State + + + +```yaml +plan_review_round: 0 +implementation_review_round: 0 +CODEX_PLAN_SESSION_ID: +CODEX_IMPL_SESSION_ID: +CURSOR_PLAN_SESSION_ID: +CURSOR_IMPL_SESSION_ID: +OPENCODE_PLAN_SESSION_ID: +OPENCODE_IMPL_SESSION_ID: +last_phase_entered: +last_round_ts: +last_scan_outcome_plan: +last_scan_outcome_impl: +verification_attempts: 0 +tests_added_count: 0 +tdd_used: false +``` + +## Review History + + + +| Timestamp (ISO-8601) | Loop | Round | Verdict | Summary | +|----------------------|------|-------|---------|---------| +| | | | | | + +## Final Status + + + +--- + +## Guardrails (do NOT remove) + +- This file is the single persistent artifact for `do-task`. Do not split it or delete it on success. +- `Status` must always match one of the 10 enum values. +- `Runtime State` is updated by the skill, not by the user. +- Review History is append-only. +- `last_scan_outcome_plan` and `last_scan_outcome_impl` record the most recent secret-scan result for each loop. They are informational; the scan itself runs per-payload with no caching. diff --git a/skills/do-task/_source/pi/SKILL.md b/skills/do-task/_source/pi/SKILL.md new file mode 100644 index 0000000..16afac2 --- /dev/null +++ b/skills/do-task/_source/pi/SKILL.md @@ -0,0 +1,210 @@ +--- +name: do-task +description: Execute a single user-supplied prompt end-to-end in pi with plan review, implementation review, verification, and one persistent task-plan artifact. +--- + +# Do Task (Pi) + +Execute an ad-hoc user prompt end-to-end: parse, clarify, plan, implement, verify, review, commit, and optionally push. + +This variant uses one persistent `task-plan.md` under `ai_plan/` and defaults to the current branch unless the prompt explicitly opts into a worktree workflow. + +## Shared Setup + +Before using this skill, read: + +- [docs/PI-SUPERPOWERS.md](../../../docs/PI-SUPERPOWERS.md) +- [docs/PI-COMMON-REVIEWER.md](../../../docs/PI-COMMON-REVIEWER.md) + +This workflow depends on: + +- Superpowers skills being visible to pi +- the pi reviewer-runtime helper being installed in a supported location + +## Prerequisite Check (MANDATORY) + +Required: + +- `pi --version` +- Superpowers `brainstorming` +- Superpowers `test-driven-development` +- Superpowers `verification-before-completion` +- Superpowers `finishing-a-development-branch` +- Superpowers `using-git-worktrees` when the prompt opts into a worktree +- pi reviewer runtime helper +- pi Telegram notifier helper + +Quick checks for common installs: + +```bash +pi --version +test -f ~/.agents/skills/superpowers/brainstorming/SKILL.md || test -f ~/.pi/agent/skills/superpowers/brainstorming/SKILL.md +test -f ~/.agents/skills/superpowers/test-driven-development/SKILL.md || test -f ~/.pi/agent/skills/superpowers/test-driven-development/SKILL.md +test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md || test -f ~/.pi/agent/skills/superpowers/verification-before-completion/SKILL.md +test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md || test -f ~/.pi/agent/skills/superpowers/finishing-a-development-branch/SKILL.md +test -x .pi/skills/reviewer-runtime/pi/run-review.sh || test -x ~/.pi/agent/skills/reviewer-runtime/pi/run-review.sh +test -x .pi/skills/reviewer-runtime/pi/notify-telegram.sh || test -x ~/.pi/agent/skills/reviewer-runtime/pi/notify-telegram.sh +``` + +If you use a settings-defined skill path for Superpowers, confirm it matches [docs/PI-SUPERPOWERS.md](../../../docs/PI-SUPERPOWERS.md) before continuing. + +If you install the reviewer helper in a nonstandard location, confirm it matches [docs/PI-COMMON-REVIEWER.md](../../../docs/PI-COMMON-REVIEWER.md) before continuing. + +If any required dependency is missing, stop immediately and return: + +`Missing dependency: pi do-task requires the workflow skills and reviewer setup documented in docs/PI-SUPERPOWERS.md and docs/PI-COMMON-REVIEWER.md.` + +## Required Workflow Rules + +- Load the relevant workflow skill before entering its phase. If pi did not auto-load it, use `/skill:`. +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- Keep the `task-plan.md` artifact current as work progresses. +- Do not use deprecated wrapper CLIs. + +## Trigger Detection + +Always use this skill for: + +- `/do-task` +- `do this task` +- `do task ...` +- `execute this task` +- `make it so` +- `just do ...` when another skill is not a better fit + +Use current-branch execution by default. Only switch to a worktree when the prompt explicitly asks for one. + +## Process + +### Phase 1: Preflight + +1. Verify the repo: `git rev-parse --is-inside-work-tree` +2. Ensure `/ai_plan/` exists in `.gitignore` +3. Confirm the required workflow skills are available to pi +4. Announce each workflow skill before using it + +### Phase 2: Parse Prompt And Clarify + +1. Capture the user's prompt verbatim +2. Detect whether the prompt is concrete enough to proceed without questions +3. If needed, ask 1-3 short questions one at a time +4. Load `brainstorming` for behavior-changing work unless the task is pure documentation or pure comment/whitespace/rename work + +### Phase 3: Configure Reviewer + +If the user already specified reviewer settings, use them. Otherwise ask: + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip` + +1. Which CLI should review the plan and implementation? +2. Reviewer model +3. Max rounds, default `10` + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the pi model running this workflow. Use any configured pi model string, including provider-qualified model IDs. If the reviewer model or provider is unavailable, surface the review helper stderr/status and ask for a configured model; use `pi --list-models [search]` to inspect configured models. + +The pi reviewer command rendered into `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.sh` must be isolated and read-only: + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files --model "$REVIEWER_MODEL" --tools read,grep,find,ls -p "Read the file /tmp/do-task-${REVIEW_KIND}-${REVIEW_ID}.md and review." +``` + +The pi reviewer invocation must not load workflow skills and must not include `write`, `edit`, or `bash` tools. + +### Phase 4: Initialize `task-plan.md` + +1. Compute `ai_plan/YYYY-MM-DD-/` +2. Resume if an existing plan folder is active, otherwise create a new one +3. Write `task-plan.md` from this skill's `templates/task-plan.md` +4. Fill `Metadata`, `Prompt`, `Interpretation`, `Assumptions`, `Files`, `Approach`, `TDD Approach`, `Acceptance Criteria`, `Verification`, and `Rollback` +5. Set `Status: draft` + +If the prompt explicitly opts into a worktree, load `using-git-worktrees` before implementation. Otherwise remain on the current branch. + +### Phase 5: Plan Review Loop + +Skip this phase if `REVIEWER_CLI=skip`. + +1. Write a reviewer payload from `task-plan.md` +2. Strip the runtime-only sections before sending it out +3. Run the reviewer through the pi reviewer-runtime helper when available +4. Fix `P0`, `P1`, and `P2` findings before proceeding +5. Keep `P3` findings for optional cleanup +6. Set `Status: plan-approved` when the reviewer approves + +The reviewer response format must be: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +### Phase 6: Execute + +1. Set `Status: implementation-in-progress` +2. Load `test-driven-development` for every behavior-changing edit unless `task-plan.md` explicitly records an allowed skip +3. Update `task-plan.md` as acceptance criteria are completed +4. Do not commit yet + +### Phase 7: Verification Gate + +1. Load `verification-before-completion` +2. Run the commands listed in `task-plan.md` +3. Fix failures and re-run verification until green +4. If verification stalls repeatedly, stop and surface the blocker + +### Phase 8: Implementation Review Loop + +Skip this phase if `REVIEWER_CLI=skip`. + +1. Build a review payload from the approved plan, current diff, and verification output +2. Run the reviewer through the pi reviewer-runtime helper +3. Address `P0`, `P1`, and `P2` findings before approval +4. Fix cheap `P3` findings when safe +5. Set `Status: implementation-approved` when approved + +### Phase 9: Commit And Push Decision + +1. Load `finishing-a-development-branch` +2. Stage only the intended files +3. Create one commit for the task +4. Ask whether to push or keep the work local + +### Phase 10: Telegram Completion Notification + +Resolve the helper in this order: + +```bash +TELEGRAM_NOTIFY_RUNTIME="" +for candidate in ".pi/skills/reviewer-runtime/pi/notify-telegram.sh" "$HOME/.pi/agent/skills/reviewer-runtime/pi/notify-telegram.sh"; do + if [ -x "$candidate" ]; then + TELEGRAM_NOTIFY_RUNTIME="$candidate" + break + fi +done +``` + +If the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured, send a short completion summary. Otherwise state that no Telegram completion notification was sent. diff --git a/skills/do-task/_source/pi/templates/task-plan.md b/skills/do-task/_source/pi/templates/task-plan.md new file mode 100644 index 0000000..4165ce1 --- /dev/null +++ b/skills/do-task/_source/pi/templates/task-plan.md @@ -0,0 +1,128 @@ +# Task Plan: [Short Title] + +> **Variant guardrail (pi):** Required workflow skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) must be available to pi as documented in `docs/PI-SUPERPOWERS.md`. Load the relevant workflow skill before entering its matching phase. + +## Metadata + +| Field | Value | +|-------|-------| +| Created | YYYY-MM-DD | +| Slug | YYYY-MM-DD- | +| Runtime | pi | +| Reviewer CLI | codex \| claude \| cursor \| opencode \| pi | +| Reviewer Model | | +| MAX_ROUNDS | 10 | +| Branch Strategy | current-branch \| worktree | +| Branch Name | | +| Worktree Path | | +| Status | draft | + +### Status Enum (authoritative) + +| Value | Meaning | +|-------|---------| +| `draft` | Newly created; plan review not yet started | +| `plan-approved` | Plan review loop returned APPROVED | +| `implementation-in-progress` | Phase 6 executing | +| `implementation-approved` | Phase 8 review loop returned APPROVED; awaiting commit | +| `pushed` | Committed + pushed to remote | +| `local-only` | Committed locally; user declined push | +| `aborted-plan-review` | MAX_ROUNDS reached in Phase 5; user aborted | +| `aborted-impl-review` | MAX_ROUNDS reached in Phase 8; user aborted | +| `aborted-verification` | Phase 7 retries exhausted; user aborted | +| `failed` | Hard tooling failure | + +--- + +## Prompt + + + +## Interpretation + + + +## Assumptions + + + +## Files + + + +| Action | Path | Why | +|--------|------|-----| +| | | | + +## Approach + + + +## TDD Approach + + + +## Acceptance Criteria + +- [ ] +- [ ] + +## Verification + + + +## Rollback + + + +--- + +## Runtime State + +```yaml +plan_review_round: 0 +implementation_review_round: 0 +CODEX_PLAN_SESSION_ID: +CODEX_IMPL_SESSION_ID: +CURSOR_PLAN_SESSION_ID: +CURSOR_IMPL_SESSION_ID: +OPENCODE_PLAN_SESSION_ID: +OPENCODE_IMPL_SESSION_ID: +last_phase_entered: +last_round_ts: +last_scan_outcome_plan: +last_scan_outcome_impl: +verification_attempts: 0 +tests_added_count: 0 +tdd_used: false +``` + +## Review History + +| Timestamp (ISO-8601) | Loop | Round | Verdict | Summary | +|----------------------|------|-------|---------|---------| +| | | | | | + +## Final Status + + + +--- + +## Guardrails (do NOT remove) + +- This file is the single persistent artifact for `do-task`. Do not split it or delete it on success. +- `Status` must always match one of the enum values. +- `Runtime State` is updated by the skill, not by the user. +- Review History is append-only. diff --git a/skills/do-task/claude-code/.generated-manifest.json b/skills/do-task/claude-code/.generated-manifest.json new file mode 100644 index 0000000..9324dc3 --- /dev/null +++ b/skills/do-task/claude-code/.generated-manifest.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/do-task/claude-code", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "0acbb9e6c130667d5dfb57a3c31cbb5f06a1570e8586dead032a7c3eae6bbc06" + }, + { + "path": "templates/task-plan.md", + "kind": "file", + "mode": "644", + "sha256": "7c34d2c380e9252cf23ae63581ef2c882c6be28b97f75463f2211f7db6e9e0ca" + } + ] +} diff --git a/skills/do-task/claude-code/SKILL.md b/skills/do-task/claude-code/SKILL.md index 663bcbe..7535d9d 100644 --- a/skills/do-task/claude-code/SKILL.md +++ b/skills/do-task/claude-code/SKILL.md @@ -3,6 +3,8 @@ name: do-task description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review). ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). --- + + # Do Task (Claude Code) Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. @@ -12,6 +14,7 @@ This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `i ## Prerequisite Check (MANDATORY) Required: + - Claude Code CLI: `claude --version` - Superpowers repo: `https://github.com/obra/superpowers` - `superpowers:brainstorming` @@ -31,6 +34,7 @@ This variant depends on explicit sub-skill invocation via the `Skill` tool. Do N ## Trigger Phrase Detection **Binding triggers** (always invoke this skill): + - `/do-task` - "do this task" - "do task ..." @@ -38,24 +42,29 @@ This variant depends on explicit sub-skill invocation via the `Skill` tool. Do N - "make it so" **Hint trigger** (invoke unless context clearly maps to another skill): + - "just do ..." **Escape phrases** (skip the Phase 2 clarifying-question loop): + - `--no-questions` - `"just do it:"` - `"just do this:"` - `"no questions:"` **Excluded** (do NOT trigger `do-task`): + - "implement this" — reserved for `implement-plan`. **Dropped defaults** (explicitly NOT binding triggers): + - "work on ..." - "handle this" - "take care of ..." - "get this done" **Worktree opt-in phrases** (Phase 4 takes the worktree branch): + - "in a worktree" - "use a worktree" - "on an isolated branch" @@ -113,7 +122,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -127,11 +135,13 @@ When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the ### Phase 4: Initialize Plan Workspace **PLAN MODE CHECK:** If currently in plan mode: + 1. Inform user that `task-plan.md` cannot be written while in plan mode. 2. Instruct user to exit plan mode (approve plan or use `ExitPlanMode`). 3. Proceed with file generation only after exiting plan mode. Steps: + 1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). 2. Compute plan folder: `ai_plan//`. 3. **Resume detection:** If the folder already exists, read `task-plan.md`: @@ -153,7 +163,7 @@ If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only afte Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = plan REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md @@ -191,11 +201,13 @@ Rules: ``` On APPROVED: + - Set `Status: plan-approved`. - Append APPROVED row to Review History. - Proceed to Phase 6. On MAX_ROUNDS: + - Set `Status: aborted-plan-review`. - Send Telegram summary before stopping. - Ask the user whether to override and proceed, restart, or abort. @@ -221,16 +233,19 @@ Native orchestration — do not invoke `superpowers:executing-plans`. Invoke `superpowers:verification-before-completion` via the `Skill` tool. Run the commands listed in the `Verification` section of `task-plan.md`: + - Lint (changed files first). - Typecheck. - Tests (targeted first, then broader suite if quick). All must pass. If a command fails: + - Fix the issue. - Re-run that command. - Increment `verification_attempts` in Runtime State. If `verification_attempts` exceeds 3 without green: + - Set `Status: aborted-verification`. - Send Telegram summary. - Ask the user whether to retry, override, or abort. @@ -241,7 +256,7 @@ If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and pr Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = implementation REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md @@ -297,11 +312,13 @@ Rules: ``` On APPROVED: + - Set `Status: implementation-approved`. - Append APPROVED row to Review History. - Proceed to Phase 9. On MAX_ROUNDS: + - Set `Status: aborted-impl-review`. - Send Telegram summary. - Ask the user whether to override and commit anyway, restart, or abort. @@ -336,6 +353,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. - Notification failures are non-blocking but must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -426,18 +444,19 @@ If `SCAN_MATCHES` is non-empty: 1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. 2. Present the redacted match summary to the user using this exact wording: - ``` + ```text SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): :: [REDACTED::-chars] ... Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) ``` + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. -2. Wait for user response. -3. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. -4. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. -5. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. @@ -450,7 +469,6 @@ Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -654,15 +672,19 @@ After the command completes: - `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. - `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `claude` or `pi`: promote `.runner.out` into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. @@ -720,6 +742,7 @@ If the round failed, produced empty output, or reached operator-decision timeout 1. Detect existing plan folder by slug at Phase 4. 2. Read `task-plan.md` → `Status`. 3. Decide next action: + | Status | Action | |--------|--------| | `draft` | Resume at Phase 5 (plan review) | @@ -728,6 +751,7 @@ If the round failed, produced empty output, or reached operator-decision timeout | `implementation-approved` | Resume at Phase 9 (commit + push ask) | | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | | `aborted-*` \| `failed` | Offer new suffix or full restart | + 4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. --- @@ -737,10 +761,12 @@ If the round failed, produced empty output, or reached operator-decision timeout **ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** Before starting any phase: + 1. Update `Status` if it transitions. 2. Update `last_phase_entered` in Runtime State. After completing any phase: + 1. Update `Status` if it transitions. 2. Append notes to the relevant section of `task-plan.md`. diff --git a/skills/do-task/claude-code/templates/task-plan.md b/skills/do-task/claude-code/templates/task-plan.md index 263299e..5144c97 100644 --- a/skills/do-task/claude-code/templates/task-plan.md +++ b/skills/do-task/claude-code/templates/task-plan.md @@ -1,3 +1,4 @@ + # Task Plan: [Short Title] > **Variant guardrail (Claude Code):** When generating or updating this file, the agent MUST be out of plan mode. Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through the `Skill` tool explicitly — no shell wrappers. @@ -132,7 +133,6 @@ tdd_used: false - Notes (anything the user should know when revisiting) --> - --- ## Guardrails (do NOT remove) diff --git a/skills/do-task/codex/.generated-manifest.json b/skills/do-task/codex/.generated-manifest.json new file mode 100644 index 0000000..d9328ba --- /dev/null +++ b/skills/do-task/codex/.generated-manifest.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/do-task/codex", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "534d823d34fcfa89935c3fd350726d921a57c806154a44e36e8bfc9bef1a5995" + }, + { + "path": "templates/task-plan.md", + "kind": "file", + "mode": "644", + "sha256": "7e460a5cd7df46daa5b1bf8daa7aaf07f5ac0ee26eee2320826a16aedf1cf39a" + } + ] +} diff --git a/skills/do-task/codex/SKILL.md b/skills/do-task/codex/SKILL.md index 9f42994..cdeda54 100644 --- a/skills/do-task/codex/SKILL.md +++ b/skills/do-task/codex/SKILL.md @@ -3,6 +3,8 @@ name: do-task description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review) in Codex. ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). --- + + # Do Task (Codex Native Superpowers) Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. @@ -14,6 +16,7 @@ This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `i ## Prerequisite Check (MANDATORY) Required: + - Codex CLI: `codex --version` - Superpowers repo: `https://github.com/obra/superpowers` - Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` @@ -53,6 +56,7 @@ If any required dependency is missing, stop immediately and return: ## Trigger Phrase Detection **Binding triggers** (always invoke this skill): + - `/do-task` - "do this task" - "do task ..." @@ -60,24 +64,29 @@ If any required dependency is missing, stop immediately and return: - "make it so" **Hint trigger** (invoke unless context clearly maps to another skill): + - "just do ..." **Escape phrases** (skip the Phase 2 clarifying-question loop): + - `--no-questions` - `"just do it:"` - `"just do this:"` - `"no questions:"` **Excluded** (do NOT trigger `do-task`): + - "implement this" — reserved for `implement-plan`. **Dropped defaults** (explicitly NOT binding triggers): + - "work on ..." - "handle this" - "take care of ..." - "get this done" **Worktree opt-in phrases** (Phase 4 takes the worktree branch): + - "in a worktree" - "use a worktree" - "on an isolated branch" @@ -135,7 +144,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -151,6 +159,7 @@ When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the Codex has no plan-mode concept; there is no plan-mode guard here. Steps: + 1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). 2. Compute plan folder: `ai_plan//`. 3. **Resume detection:** If the folder already exists, read `task-plan.md`: @@ -172,7 +181,7 @@ If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only afte Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = plan REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md @@ -210,11 +219,13 @@ Rules: ``` On APPROVED: + - Set `Status: plan-approved`. - Append APPROVED row to Review History. - Proceed to Phase 6. On MAX_ROUNDS: + - Set `Status: aborted-plan-review`. - Send Telegram summary before stopping. - Ask the user whether to override and proceed, restart, or abort. @@ -240,16 +251,19 @@ Native orchestration — do not invoke `superpowers:executing-plans`. Invoke `superpowers:verification-before-completion` via native discovery. Run the commands listed in the `Verification` section of `task-plan.md`: + - Lint (changed files first). - Typecheck. - Tests (targeted first, then broader suite if quick). All must pass. If a command fails: + - Fix the issue. - Re-run that command. - Increment `verification_attempts` in Runtime State. If `verification_attempts` exceeds 3 without green: + - Set `Status: aborted-verification`. - Send Telegram summary. - Ask the user whether to retry, override, or abort. @@ -260,7 +274,7 @@ If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and pr Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = implementation REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md @@ -316,11 +330,13 @@ Rules: ``` On APPROVED: + - Set `Status: implementation-approved`. - Append APPROVED row to Review History. - Proceed to Phase 9. On MAX_ROUNDS: + - Set `Status: aborted-impl-review`. - Send Telegram summary. - Ask the user whether to override and commit anyway, restart, or abort. @@ -355,6 +371,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. - Notification failures are non-blocking but must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -445,18 +462,19 @@ If `SCAN_MATCHES` is non-empty: 1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. 2. Present the redacted match summary to the user using this exact wording: - ``` + ```text SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): :: [REDACTED::-chars] ... Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) ``` + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. -2. Wait for user response. -3. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. -4. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. -5. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. @@ -469,7 +487,6 @@ Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -673,15 +690,19 @@ After the command completes: - `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. - `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `claude` or `pi`: promote `.runner.out` into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. @@ -739,6 +760,7 @@ If the round failed, produced empty output, or reached operator-decision timeout 1. Detect existing plan folder by slug at Phase 4. 2. Read `task-plan.md` → `Status`. 3. Decide next action: + | Status | Action | |--------|--------| | `draft` | Resume at Phase 5 (plan review) | @@ -747,6 +769,7 @@ If the round failed, produced empty output, or reached operator-decision timeout | `implementation-approved` | Resume at Phase 9 (commit + push ask) | | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | | `aborted-*` \| `failed` | Offer new suffix or full restart | + 4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. --- @@ -756,10 +779,12 @@ If the round failed, produced empty output, or reached operator-decision timeout **ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** Before starting any phase: + 1. Update `Status` if it transitions. 2. Update `last_phase_entered` in Runtime State. After completing any phase: + 1. Update `Status` if it transitions. 2. Append notes to the relevant section of `task-plan.md`. diff --git a/skills/do-task/codex/templates/task-plan.md b/skills/do-task/codex/templates/task-plan.md index 3ca1efa..9130d57 100644 --- a/skills/do-task/codex/templates/task-plan.md +++ b/skills/do-task/codex/templates/task-plan.md @@ -1,3 +1,4 @@ + # Task Plan: [Short Title] > **Variant guardrail (Codex):** Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through native skill discovery from `~/.agents/skills/superpowers//SKILL.md` — no `superpowers-codex` CLI wrappers. Checklist-driven sub-skills MUST track items with `update_plan` todos. @@ -132,7 +133,6 @@ tdd_used: false - Notes (anything the user should know when revisiting) --> - --- ## Guardrails (do NOT remove) diff --git a/skills/do-task/cursor/.generated-manifest.json b/skills/do-task/cursor/.generated-manifest.json new file mode 100644 index 0000000..628586b --- /dev/null +++ b/skills/do-task/cursor/.generated-manifest.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/do-task/cursor", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "3a255d12f67be0eef3c45969befb23e3283a8a91f061053d939714d50e5f8cee" + }, + { + "path": "templates/task-plan.md", + "kind": "file", + "mode": "644", + "sha256": "6af4c73434e932c1705ba13faf47be2152d61971f0b60ee9bece534d22493596" + } + ] +} diff --git a/skills/do-task/cursor/SKILL.md b/skills/do-task/cursor/SKILL.md index 95d8b42..d692ba6 100644 --- a/skills/do-task/cursor/SKILL.md +++ b/skills/do-task/cursor/SKILL.md @@ -3,6 +3,8 @@ name: do-task description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review) in Cursor Agent CLI. ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). --- + + # Do Task (Cursor Agent CLI) Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. @@ -14,6 +16,7 @@ This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `i ## Prerequisite Check (MANDATORY) Required: + - Cursor Agent CLI: `cursor-agent --version` (install via `curl https://cursor.com/install -fsS | bash`). Binary is `cursor-agent`; the alias `cursor agent` also works. - `jq` (**required** — `do-task` always parses JSON output from at least the cursor reviewer branch, and other reviewers may produce JSON). Install via `brew install jq` (macOS) or your package manager. Verify: `jq --version`. - Superpowers repo: `https://github.com/obra/superpowers` @@ -52,6 +55,7 @@ If any required dependency is missing, stop immediately and return: ## Trigger Phrase Detection **Binding triggers** (always invoke this skill): + - `/do-task` - "do this task" - "do task ..." @@ -59,24 +63,29 @@ If any required dependency is missing, stop immediately and return: - "make it so" **Hint trigger** (invoke unless context clearly maps to another skill): + - "just do ..." **Escape phrases** (skip the Phase 2 clarifying-question loop): + - `--no-questions` - `"just do it:"` - `"just do this:"` - `"no questions:"` **Excluded** (do NOT trigger `do-task`): + - "implement this" — reserved for `implement-plan`. **Dropped defaults** (explicitly NOT binding triggers): + - "work on ..." - "handle this" - "take care of ..." - "get this done" **Worktree opt-in phrases** (Phase 4 takes the worktree branch): + - "in a worktree" - "use a worktree" - "on an isolated branch" @@ -134,7 +143,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -150,6 +158,7 @@ When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the Cursor Agent CLI has no plan-mode concept; there is no plan-mode guard here. Steps: + 1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). 2. Compute plan folder: `ai_plan//`. 3. **Resume detection:** If the folder already exists, read `task-plan.md`: @@ -171,7 +180,7 @@ If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only afte Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = plan REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md @@ -209,11 +218,13 @@ Rules: ``` On APPROVED: + - Set `Status: plan-approved`. - Append APPROVED row to Review History. - Proceed to Phase 6. On MAX_ROUNDS: + - Set `Status: aborted-plan-review`. - Send Telegram summary before stopping. - Ask the user whether to override and proceed, restart, or abort. @@ -239,16 +250,19 @@ Native orchestration — do not invoke `superpowers:executing-plans`. Invoke `superpowers:verification-before-completion` via Cursor-native discovery. Run the commands listed in the `Verification` section of `task-plan.md`: + - Lint (changed files first). - Typecheck. - Tests (targeted first, then broader suite if quick). All must pass. If a command fails: + - Fix the issue. - Re-run that command. - Increment `verification_attempts` in Runtime State. If `verification_attempts` exceeds 3 without green: + - Set `Status: aborted-verification`. - Send Telegram summary. - Ask the user whether to retry, override, or abort. @@ -259,7 +273,7 @@ If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and pr Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = implementation REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md @@ -315,11 +329,13 @@ Rules: ``` On APPROVED: + - Set `Status: implementation-approved`. - Append APPROVED row to Review History. - Proceed to Phase 9. On MAX_ROUNDS: + - Set `Status: aborted-impl-review`. - Send Telegram summary. - Ask the user whether to override and commit anyway, restart, or abort. @@ -358,6 +374,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. - Notification failures are non-blocking but must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -452,18 +469,19 @@ If `SCAN_MATCHES` is non-empty: 1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. 2. Present the redacted match summary to the user using this exact wording: - ``` + ```text SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): :: [REDACTED::-chars] ... Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) ``` + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. -2. Wait for user response. -3. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. -4. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. -5. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. @@ -476,7 +494,6 @@ Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -680,15 +697,19 @@ After the command completes: - `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. - `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `claude` or `pi`: promote `.runner.out` into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. @@ -746,6 +767,7 @@ If the round failed, produced empty output, or reached operator-decision timeout 1. Detect existing plan folder by slug at Phase 4. 2. Read `task-plan.md` → `Status`. 3. Decide next action: + | Status | Action | |--------|--------| | `draft` | Resume at Phase 5 (plan review) | @@ -754,6 +776,7 @@ If the round failed, produced empty output, or reached operator-decision timeout | `implementation-approved` | Resume at Phase 9 (commit + push ask) | | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | | `aborted-*` \| `failed` | Offer new suffix or full restart | + 4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. --- @@ -763,10 +786,12 @@ If the round failed, produced empty output, or reached operator-decision timeout **ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** Before starting any phase: + 1. Update `Status` if it transitions. 2. Update `last_phase_entered` in Runtime State. After completing any phase: + 1. Update `Status` if it transitions. 2. Append notes to the relevant section of `task-plan.md`. diff --git a/skills/do-task/cursor/templates/task-plan.md b/skills/do-task/cursor/templates/task-plan.md index 92b79ae..89a664b 100644 --- a/skills/do-task/cursor/templates/task-plan.md +++ b/skills/do-task/cursor/templates/task-plan.md @@ -1,3 +1,4 @@ + # Task Plan: [Short Title] > **Variant guardrail (Cursor):** Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through workspace discovery from `.cursor/skills/superpowers/skills//SKILL.md` or `~/.cursor/skills/superpowers/skills//SKILL.md`. Reviewer invocations MUST use `--mode=ask --trust --output-format json`. `jq` is a hard prerequisite. @@ -132,7 +133,6 @@ tdd_used: false - Notes (anything the user should know when revisiting) --> - --- ## Guardrails (do NOT remove) diff --git a/skills/do-task/opencode/.generated-manifest.json b/skills/do-task/opencode/.generated-manifest.json new file mode 100644 index 0000000..c330b00 --- /dev/null +++ b/skills/do-task/opencode/.generated-manifest.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/do-task/opencode", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "ebbae7c050b3cfe0d1de8722cd71c8c10ba74de709adeec4ebb9645e2f770a03" + }, + { + "path": "templates/task-plan.md", + "kind": "file", + "mode": "644", + "sha256": "a4c0ad9a9faaf738c503b403a285b6a005ee245b6b05f5af973c8e0224f6fefe" + } + ] +} diff --git a/skills/do-task/opencode/SKILL.md b/skills/do-task/opencode/SKILL.md index 60f6a57..1c1c803 100644 --- a/skills/do-task/opencode/SKILL.md +++ b/skills/do-task/opencode/SKILL.md @@ -3,6 +3,8 @@ name: do-task description: Execute a single user-supplied prompt end-to-end with two reviewer loops (plan review + implementation review) in OpenCode. ALWAYS invoke when the user says `/do-task`, "do this task", "do task ...", "execute this task", or "make it so". Also invoke on the hint phrase "just do ...". Do NOT invoke on "implement this" (that phrase is reserved for implement-plan). --- + + # Do Task (OpenCode) Execute an ad-hoc user prompt end-to-end: parse → clarify → plan (with reviewer loop) → implement (TDD-first where applicable) → verify → implementation review loop → commit → optional push → notify. @@ -14,6 +16,7 @@ This is a single-artifact sibling of `create-plan` + `implement-plan`. Unlike `i ## Prerequisite Check (MANDATORY) Required: + - OpenCode CLI: `opencode --version` (install via your package manager or `brew install opencode`). - Superpowers repo: `https://github.com/obra/superpowers` - OpenCode Superpowers skills available at `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers` @@ -50,6 +53,7 @@ If any required dependency is missing, stop immediately and return: ## Trigger Phrase Detection **Binding triggers** (always invoke this skill): + - `/do-task` - "do this task" - "do task ..." @@ -57,24 +61,29 @@ If any required dependency is missing, stop immediately and return: - "make it so" **Hint trigger** (invoke unless context clearly maps to another skill): + - "just do ..." **Escape phrases** (skip the Phase 2 clarifying-question loop): + - `--no-questions` - `"just do it:"` - `"just do this:"` - `"no questions:"` **Excluded** (do NOT trigger `do-task`): + - "implement this" — reserved for `implement-plan`. **Dropped defaults** (explicitly NOT binding triggers): + - "work on ..." - "handle this" - "take care of ..." - "get this done" **Worktree opt-in phrases** (Phase 4 takes the worktree branch): + - "in a worktree" - "use a worktree" - "on an isolated branch" @@ -133,7 +142,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS` for Phases 5 and 8. Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -149,6 +157,7 @@ When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the OpenCode has no plan-mode concept; there is no plan-mode guard here. Steps: + 1. Compute slug: `YYYY-MM-DD-` where `` is a kebab-case hash of the task goal (lowercase, alphanumeric + hyphens only). 2. Compute plan folder: `ai_plan//`. 3. **Resume detection:** If the folder already exists, read `task-plan.md`: @@ -170,7 +179,7 @@ If `REVIEWER_CLI=skip`, present `task-plan.md` to the user and proceed only afte Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = plan REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) PAYLOAD_PATH = /tmp/do-task-plan-${REVIEW_ID}.md @@ -208,11 +217,13 @@ Rules: ``` On APPROVED: + - Set `Status: plan-approved`. - Append APPROVED row to Review History. - Proceed to Phase 6. On MAX_ROUNDS: + - Set `Status: aborted-plan-review`. - Send Telegram summary before stopping. - Ask the user whether to override and proceed, restart, or abort. @@ -238,16 +249,19 @@ Native orchestration — do not invoke `superpowers:executing-plans`. Invoke `superpowers/verification-before-completion` via OpenCode's native skill tool. Run the commands listed in the `Verification` section of `task-plan.md`: + - Lint (changed files first). - Typecheck. - Tests (targeted first, then broader suite if quick). All must pass. If a command fails: + - Fix the issue. - Re-run that command. - Increment `verification_attempts` in Runtime State. If `verification_attempts` exceeds 3 without green: + - Set `Status: aborted-verification`. - Send Telegram summary. - Ask the user whether to retry, override, or abort. @@ -258,7 +272,7 @@ If `REVIEWER_CLI=skip`, present a diff + verification summary to the user and pr Otherwise, invoke the Review Loop (Shared Subroutine) with: -``` +```text REVIEW_KIND = implementation REVIEW_ID = $(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) # distinct from plan-review ID PAYLOAD_PATH = /tmp/do-task-implementation-${REVIEW_ID}.md @@ -314,11 +328,13 @@ Rules: ``` On APPROVED: + - Set `Status: implementation-approved`. - Append APPROVED row to Review History. - Proceed to Phase 9. On MAX_ROUNDS: + - Set `Status: aborted-impl-review`. - Send Telegram summary. - Ask the user whether to override and commit anyway, restart, or abort. @@ -353,6 +369,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. - Notification failures are non-blocking but must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -443,18 +460,19 @@ If `SCAN_MATCHES` is non-empty: 1. **Redact the matched text before surfacing** — never echo the raw secret to the user, chat log, terminal scrollback, or any persistent file. Replace each matched substring with a fixed token that preserves only the fact of a match: `[REDACTED::-chars]`. Example: a matched AWS key becomes `[REDACTED:aws-access-key:20-chars]`. Keep the file path and line number; they are useful for the user and not secret. 2. Present the redacted match summary to the user using this exact wording: - ``` + ```text SECRET-SCAN MATCH in outbound reviewer payload (loop: ${REVIEW_KIND}, round: N): :: [REDACTED::-chars] ... Proceed with sending this payload to ${REVIEWER_CLI}? (yes / no / redact) ``` + Pattern labels: `aws-access-key`, `gcp-service-account`, `github-token`, `slack-token`, `openai-key`, `anthropic-key`, `pem-private-key`, `dotenv-style`, `jwt`. -2. Wait for user response. -3. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. -4. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. -5. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. +3. Wait for user response. +4. On `yes`: record `last_scan_outcome_${REVIEW_KIND}=user-approved-with-matches` in Runtime State, and proceed. +5. On `redact`: ask the user to supply redactions, apply them to `PAYLOAD_PATH`, re-scan (this step), record `last_scan_outcome_${REVIEW_KIND}=redacted-and-approved`. +6. On `no`: stop the loop, set `Status: failed`, send Telegram, return to the user. If `SCAN_MATCHES` is empty, record `last_scan_outcome_${REVIEW_KIND}=clean` and proceed. @@ -467,7 +485,6 @@ Write the reviewer invocation to `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -671,15 +688,19 @@ After the command completes: - `cursor`: already promoted in Step 2 via `jq -r '.result' ...`. Also capture `session_id` if first round. - `codex`: extract `CODEX_SESSION_ID` from `/tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text lives only in `.runner.out`, `cp` it into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `claude` or `pi`: promote `.runner.out` into the `.md` file: + ```bash cp /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.runner.out \ /tmp/do-task-${REVIEW_KIND}-review-${REVIEW_ID}.md ``` + - `opencode`: already promoted in Step 2 via `jq` on the JSON stream. If opt-in session-resume is active and the JSON includes a stable session id, capture it and persist to `${SESSION_ID_VAR}`. On Round 1, persist the captured session ID (if any) into `task-plan.md`'s Runtime State under `${SESSION_ID_VAR}`. @@ -737,6 +758,7 @@ If the round failed, produced empty output, or reached operator-decision timeout 1. Detect existing plan folder by slug at Phase 4. 2. Read `task-plan.md` → `Status`. 3. Decide next action: + | Status | Action | |--------|--------| | `draft` | Resume at Phase 5 (plan review) | @@ -745,6 +767,7 @@ If the round failed, produced empty output, or reached operator-decision timeout | `implementation-approved` | Resume at Phase 9 (commit + push ask) | | `pushed` \| `local-only` | Ask user: new suffix, abort, or replay for reference only | | `aborted-*` \| `failed` | Offer new suffix or full restart | + 4. When resuming, read Runtime State for `CODEX_PLAN_SESSION_ID`, `CODEX_IMPL_SESSION_ID`, `CURSOR_PLAN_SESSION_ID`, `CURSOR_IMPL_SESSION_ID`, `OPENCODE_PLAN_SESSION_ID`, `OPENCODE_IMPL_SESSION_ID`, and the round counters. If a session ID is populated, use it for the first revision round in that loop (Round 2) via `codex exec resume`, `cursor-agent --resume`, or `opencode run -s ` as applicable. --- @@ -754,10 +777,12 @@ If the round failed, produced empty output, or reached operator-decision timeout **ALWAYS update `task-plan.md` before/after each phase transition. NEVER proceed with stale state.** Before starting any phase: + 1. Update `Status` if it transitions. 2. Update `last_phase_entered` in Runtime State. After completing any phase: + 1. Update `Status` if it transitions. 2. Append notes to the relevant section of `task-plan.md`. diff --git a/skills/do-task/opencode/templates/task-plan.md b/skills/do-task/opencode/templates/task-plan.md index dd08da9..d8cdbb5 100644 --- a/skills/do-task/opencode/templates/task-plan.md +++ b/skills/do-task/opencode/templates/task-plan.md @@ -1,3 +1,4 @@ + # Task Plan: [Short Title] > **Variant guardrail (OpenCode):** Sub-skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) MUST be invoked through OpenCode's native skill tool from `~/.config/opencode/skills/superpowers//SKILL.md`. Phase 1 MUST include the Bootstrap Superpowers Context step. Opencode reviewer calls MUST use `--agent plan` to stay read-only. @@ -132,7 +133,6 @@ tdd_used: false - Notes (anything the user should know when revisiting) --> - --- ## Guardrails (do NOT remove) diff --git a/skills/do-task/pi/.generated-manifest.json b/skills/do-task/pi/.generated-manifest.json new file mode 100644 index 0000000..f26f760 --- /dev/null +++ b/skills/do-task/pi/.generated-manifest.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/do-task/pi", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "4920ad0cdeda546b37432c2268159724de54ddb01922308f2df88fcca4db8d31" + }, + { + "path": "templates/task-plan.md", + "kind": "file", + "mode": "644", + "sha256": "fd38213fabf350e14b48c5209910d00c16ff74c455101618063835fa8c19e73e" + } + ] +} diff --git a/skills/do-task/pi/SKILL.md b/skills/do-task/pi/SKILL.md index 16afac2..3e4bb5f 100644 --- a/skills/do-task/pi/SKILL.md +++ b/skills/do-task/pi/SKILL.md @@ -3,6 +3,8 @@ name: do-task description: Execute a single user-supplied prompt end-to-end in pi with plan review, implementation review, verification, and one persistent task-plan artifact. --- + + # Do Task (Pi) Execute an ad-hoc user prompt end-to-end: parse, clarify, plan, implement, verify, review, commit, and optionally push. diff --git a/skills/do-task/pi/templates/task-plan.md b/skills/do-task/pi/templates/task-plan.md index 4165ce1..3ddfee7 100644 --- a/skills/do-task/pi/templates/task-plan.md +++ b/skills/do-task/pi/templates/task-plan.md @@ -1,3 +1,4 @@ + # Task Plan: [Short Title] > **Variant guardrail (pi):** Required workflow skills (`brainstorming`, `test-driven-development`, `verification-before-completion`, `finishing-a-development-branch`, `using-git-worktrees`) must be available to pi as documented in `docs/PI-SUPERPOWERS.md`. Load the relevant workflow skill before entering its matching phase. diff --git a/skills/implement-plan/_source/claude-code/SKILL.md b/skills/implement-plan/_source/claude-code/SKILL.md new file mode 100644 index 0000000..164c5f4 --- /dev/null +++ b/skills/implement-plan/_source/claude-code/SKILL.md @@ -0,0 +1,646 @@ +--- +name: implement-plan +description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. +--- + +# Implement Plan (Claude Code) + +Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. + +## Prerequisite Check (MANDATORY) + +Required: + +- Plan folder exists under `ai_plan/` at project root +- `continuation-runbook.md` exists in plan folder +- `milestone-plan.md` exists in plan folder +- `story-tracker.md` exists in plan folder +- Git repo with worktree support: `git worktree list` +- Superpowers execution skills: + - `superpowers:executing-plans` + - `superpowers:using-git-worktrees` + - `superpowers:verification-before-completion` + - `superpowers:finishing-a-development-branch` + +If any dependency is missing, stop immediately and return: + +"Missing dependency: [specific missing item]. Ensure all prerequisites are met, then retry." + +If no plan folder exists: + +"No plan found under `ai_plan/`. Run `create-plan` first." + +## Process + +### Phase 1: Locate Plan + +1. Scan `ai_plan/` for plan directories (most recent first by date prefix). +2. If multiple plans exist, ask user which one to implement. +3. If no plan exists, stop: "No plan found. Run create-plan first." +4. Read `continuation-runbook.md` first (source of truth). +5. Read `story-tracker.md` to detect resume state (`in-dev` or `completed` stories). +6. Read `milestone-plan.md` for implementation details. + +### Phase 2: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "implement the plan, review with claude sonnet"), use those values. Otherwise, ask: + +1. **Which CLI should review each milestone?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed with user approval only + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see available models + - Accept any model string the user provides + +3. **Max review rounds per milestone?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed for the entire run. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 3: Set Up Worktree (REQUIRED SUB-SKILL) + +Invoke `superpowers:using-git-worktrees` explicitly. + +1. Branch naming: `implement/` (e.g., `implement/2026-03-04-auth-system`). +2. Follow worktree skill's directory priority: `.worktrees/` > `worktrees/` > CLAUDE.md > ask user. +3. Verify `.gitignore` covers worktree directory. +4. Run project setup (auto-detect: `npm install`, `cargo build`, `pip install`, etc.). +5. Verify clean baseline (run tests). + +**Resume detection:** If `story-tracker.md` shows `in-dev` or `completed` stories, check if worktree branch already exists (`git worktree list`). If so, `cd` into existing worktree instead of creating a new one. + +### Phase 4: Execute Milestones (Loop) + +For each milestone (M1, M2, ...): + +#### Step 1: Read Milestone Spec + +Read the milestone section from `milestone-plan.md`. + +#### Step 2: Update Tracker + +Mark first story `in-dev` in `story-tracker.md`. + +#### Step 3: Implement Stories + +Execute each story in order. After completing each story: + +1. Mark `in-dev` -> `completed` in `story-tracker.md` +2. Update counts +3. Mark next story `in-dev` + +Commit hashes are not available yet — they are backfilled in Step 6 after the milestone is approved and committed. + +#### Step 4: Verify Milestone (REQUIRED SUB-SKILL) + +Invoke `superpowers:verification-before-completion` explicitly. + +```bash +# Lint changed files +# Typecheck +# Run tests (targeted first, then full suite) +``` + +All must pass before proceeding. If failures: fix, re-verify. Do NOT proceed to review with failures. + +#### Step 5: Milestone Review Loop + +Send to reviewer for approval **before committing**. See Phase 5 for details. The review payload uses working-tree diffs (`git diff` for unstaged, `git diff --staged` for staged changes). + +**Skip this step if reviewer was set to `skip`.** When skipped, present the milestone summary to the user and ask for approval directly. + +#### Step 6: Commit & Approve + +Only after the reviewer approves (or user overrides at max rounds): + +```bash +git add +git commit -m "feat(): implement milestone M - " +``` + +Do NOT push. After committing: + +1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. +2. Mark milestone as `approved` in `story-tracker.md`. +3. Move to next milestone. + +### Phase 5: Milestone Review Loop (Detail) + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use `REVIEW_ID` for all milestone review temp file paths: + +- `/tmp/milestone-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.json` +- `/tmp/milestone-review-${REVIEW_ID}.stderr` +- `/tmp/milestone-review-${REVIEW_ID}.status` +- `/tmp/milestone-review-${REVIEW_ID}.runner.out` +- `/tmp/milestone-review-${REVIEW_ID}.sh` + +Resolve the shared runtime helper path before writing the command script: + +```bash +REVIEWER_RUNTIME=~/.claude/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.json) + ;; +esac +``` + +#### Step 2: Write Review Payload + +Write to `/tmp/milestone-${REVIEW_ID}.md`: + +```markdown +# Milestone M Review: + +## Milestone Spec (from plan) +[Copy milestone section from milestone-plan.md] + +## Acceptance Criteria +[Copy acceptance criteria checkboxes] + +## Changes Made (git diff) +[Output of: git diff -- for unstaged changes, or git diff --staged for staged changes] + +## Verification Output +### Lint +[lint output] +### Typecheck +[typecheck output] +### Tests +[test output with pass/fail counts] +``` + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/milestone-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "Review this milestone implementation. The spec, acceptance criteria, git diff, and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: <uuid>`), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review this milestone implementation using the following spec, acceptance criteria, git diff, and verification output: + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/milestone-${REVIEW_ID}.md and review this milestone implementation. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/milestone-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/milestone-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/milestone-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/milestone-review-${REVIEW_ID}.stderr \ + --status-file /tmp/milestone-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/milestone-review-${REVIEW_ID}.sh >/tmp/milestone-review-${REVIEW_ID}.runner.out 2>/tmp/milestone-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/milestone-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/milestone-review-${REVIEW_ID}.json > /tmp/milestone-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/milestone-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/milestone-review-${REVIEW_ID}.runner.out /tmp/milestone-review-${REVIEW_ID}.md +``` + +Fallback is allowed only when the helper is missing or not executable. + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/milestone-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/milestone-review-${REVIEW_ID}.stderr` + - `/tmp/milestone-review-${REVIEW_ID}.status` + - `/tmp/milestone-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 4 Step 6 (commit & approve) + - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` -> treat as approved + - Helper state `completed-empty-output` -> treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` -> surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached -> present to user for manual decision (proceed or stop) + +#### Step 5: Address Feedback & Re-verify + +1. Address the reviewer findings in priority order (`P0` -> `P1` -> `P2`, then `P3` when practical) (do NOT commit yet). +2. Re-run verification (lint/typecheck/tests) — all must pass. +3. Update `/tmp/milestone-${REVIEW_ID}.md` with new diff and verification output. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this milestone and requested revisions. Read the updated payload at /tmp/milestone-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed milestone M<N> and requested revisions. + +Previous feedback summary: [key points from last review] + +I've addressed your feedback. Updated diff and verification output are below. + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +Do not run `jq` extraction until after the helper or fallback execution completes, then extract `/tmp/milestone-review-${REVIEW_ID}.md` from the JSON response. + +After updating `/tmp/milestone-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Cleanup Per Milestone + +```bash +rm -f \ + /tmp/milestone-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.json \ + /tmp/milestone-review-${REVIEW_ID}.stderr \ + /tmp/milestone-review-${REVIEW_ID}.status \ + /tmp/milestone-review-${REVIEW_ID}.runner.out \ + /tmp/milestone-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 6: Completion (REQUIRED SUB-SKILL) + +After all milestones are approved and committed: + +1. Invoke `superpowers:finishing-a-development-branch` explicitly. +2. Run full test suite one final time — all must pass. +3. Merge the worktree branch into the parent branch: + +```bash +# From the main repo (not the worktree) +git merge implement/<plan-folder-name> +``` + +1. Delete the worktree and its branch: + +```bash +git worktree remove <worktree-path> +git branch -d implement/<plan-folder-name> +``` + +1. Mark plan status as `completed` in `story-tracker.md`. + +### Phase 7: Final Report + +Present summary: + +```markdown +## Implementation Complete + +**Plan:** <plan-folder-name> +**Milestones:** <N> completed, <N> approved +**Review rounds:** <total across all milestones> +**Branch:** implement/<plan-folder-name> (merged and deleted) +``` + +### Phase 8: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from the installed Claude Code skills directory: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.claude/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome for the implement-plan run (fully completed, stopped after max rounds, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "implement-plan completed for <plan-folder-name>: <status summary>" +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Tracker Discipline (MANDATORY) + +**ALWAYS update `story-tracker.md` before/after each story. NEVER proceed with stale tracker state.** + +Before starting any story: + +1. Open `story-tracker.md` +2. Mark story `in-dev` +3. Add notes if relevant +4. Then begin implementation + +After completing any story: + +1. Mark story `completed` +2. Review pending stories +3. Update Last Updated and Stories Complete counts + +Note: Commit hashes are backfilled into story Notes after the milestone commit (Step 6), not per-story. + +## Verification Checklist + +- [ ] Plan folder located and all required files present +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Worktree created with branch `implement/<plan-folder-name>` +- [ ] Worktree directory verified in .gitignore +- [ ] Baseline tests pass in worktree +- [ ] Each milestone: stories tracked (in-dev -> completed) +- [ ] Each milestone: lint/typecheck/tests pass before review +- [ ] Each milestone: reviewer approved (or max rounds + user override) +- [ ] Each milestone: committed locally only after approval +- [ ] Each milestone: marked approved in story-tracker.md +- [ ] All milestones completed, approved, and committed +- [ ] Final test suite passes +- [ ] Worktree branch merged to parent and worktree deleted +- [ ] Story tracker updated with final status +- [ ] Telegram notification attempted if configured diff --git a/skills/implement-plan/_source/codex/SKILL.md b/skills/implement-plan/_source/codex/SKILL.md new file mode 100644 index 0000000..be6e3f1 --- /dev/null +++ b/skills/implement-plan/_source/codex/SKILL.md @@ -0,0 +1,723 @@ +--- +name: implement-plan +description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. +--- + +# Implement Plan (Codex Native Superpowers) + +Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. + +## Overview + +This skill wraps the Superpowers execution flow for Codex: + +1. Locate plan files under `ai_plan/` +2. Set up an isolated git worktree +3. Execute milestones one-by-one with lint/typecheck/test gates +4. Review each milestone with a second model/provider +5. Commit approved milestones, merge to parent branch, and delete worktree + +**Core principle:** Codex uses native skill discovery from `~/.agents/skills/`. Do not use deprecated `superpowers-codex bootstrap` or `use-skill` CLI commands. + +## Prerequisite Check (MANDATORY) + +Required: + +- Plan folder exists under `ai_plan/` at project root +- `continuation-runbook.md` exists in plan folder +- `milestone-plan.md` exists in plan folder +- `story-tracker.md` exists in plan folder +- Git repo with worktree support: `git worktree list` +- Superpowers skills symlink: `~/.agents/skills/superpowers -> ~/.codex/superpowers/skills` +- Superpowers execution skills: + - `superpowers:executing-plans` + - `superpowers:using-git-worktrees` + - `superpowers:verification-before-completion` + - `superpowers:finishing-a-development-branch` + +Verify before proceeding: + +```bash +test -L ~/.agents/skills/superpowers +test -f ~/.agents/skills/superpowers/executing-plans/SKILL.md +test -f ~/.agents/skills/superpowers/using-git-worktrees/SKILL.md +test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md +test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md +``` + +If any dependency is missing, stop and return: + +`Missing dependency: [specific missing item]. Ensure all prerequisites are met, then retry.` + +If no plan folder exists: + +`No plan found under ai_plan/. Run create-plan first.` + +## Required Skill Invocation Rules + +- Invoke relevant skills through native discovery (no CLI wrapper). +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- For skills with checklists, track checklist items with `update_plan` todos. +- Tool mapping for Codex: + - `TodoWrite` -> `update_plan` + - `Task` subagents -> unavailable in Codex; do the work directly and state the limitation + - `Skill` -> use native skill discovery from `~/.agents/skills/` + +## Process + +### Phase 1: Locate Plan + +1. Scan `ai_plan/` for plan directories (most recent first by date prefix). +2. If multiple plans exist, ask user which one to implement. +3. If no plan exists, stop: "No plan found. Run create-plan first." +4. Read `continuation-runbook.md` first (source of truth). +5. Read `story-tracker.md` to detect resume state (`in-dev` or `completed` stories). +6. Read `milestone-plan.md` for implementation details. + +### Phase 2: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "implement the plan, review with claude sonnet"), use those values. Otherwise, ask: + +1. **Which CLI should review each milestone?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed with user approval only + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see available models + - Accept any model string the user provides + +3. **Max review rounds per milestone?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed for the entire run. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/<pi-model-name>`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 3: Set Up Worktree (REQUIRED SUB-SKILL) + +Invoke `superpowers:using-git-worktrees`. + +1. Branch naming: `implement/<plan-folder-name>` (e.g., `implement/2026-03-04-auth-system`). +2. Follow worktree skill's directory priority: `.worktrees/` > `worktrees/` > CLAUDE.md > ask user. +3. Verify `.gitignore` covers worktree directory. +4. Run project setup (auto-detect: `npm install`, `cargo build`, `pip install`, etc.). +5. Verify clean baseline (run tests). + +**Resume detection:** If `story-tracker.md` shows `in-dev` or `completed` stories, check if worktree branch already exists (`git worktree list`). If so, `cd` into existing worktree instead of creating a new one. + +### Phase 4: Execute Milestones (Loop) + +For each milestone (M1, M2, ...): + +#### Step 1: Read Milestone Spec + +Read the milestone section from `milestone-plan.md`. + +#### Step 2: Update Tracker + +Mark first story `in-dev` in `story-tracker.md`. + +#### Step 3: Implement Stories + +Execute each story in order. After completing each story: + +1. Mark `in-dev` -> `completed` in `story-tracker.md` +2. Update counts +3. Mark next story `in-dev` + +Commit hashes are not available yet — they are backfilled in Step 6 after the milestone is approved and committed. + +#### Step 4: Verify Milestone (REQUIRED SUB-SKILL) + +Invoke `superpowers:verification-before-completion`. + +```bash +# Lint changed files +# Typecheck +# Run tests (targeted first, then full suite) +``` + +All must pass before proceeding. If failures: fix, re-verify. Do NOT proceed to review with failures. + +#### Step 5: Milestone Review Loop + +Send to reviewer for approval **before committing**. See Phase 5 for details. The review payload uses working-tree diffs (`git diff` for unstaged, `git diff --staged` for staged changes). + +**Skip this step if reviewer was set to `skip`.** When skipped, present the milestone summary to the user and ask for approval directly. + +#### Step 6: Commit & Approve + +Only after the reviewer approves (or user overrides at max rounds): + +```bash +git add <changed-files> +git commit -m "feat(<scope>): implement milestone M<N> - <description>" +``` + +Do NOT push. After committing: + +1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. +2. Mark milestone as `approved` in `story-tracker.md`. +3. Move to next milestone. + +### Phase 5: Milestone Review Loop (Detail) + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use `REVIEW_ID` for all milestone review temp file paths: + +- `/tmp/milestone-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.json` +- `/tmp/milestone-review-${REVIEW_ID}.stderr` +- `/tmp/milestone-review-${REVIEW_ID}.status` +- `/tmp/milestone-review-${REVIEW_ID}.runner.out` +- `/tmp/milestone-review-${REVIEW_ID}.sh` + +Resolve the shared runtime helper path before writing the command script: + +```bash +REVIEWER_RUNTIME=~/.codex/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.json) + ;; +esac +``` + +#### Step 2: Write Review Payload + +Write to `/tmp/milestone-${REVIEW_ID}.md`: + +```markdown +# Milestone M<N> Review: <title> + +## Milestone Spec (from plan) +[Copy milestone section from milestone-plan.md] + +## Acceptance Criteria +[Copy acceptance criteria checkboxes] + +## Changes Made (git diff) +[Output of: git diff -- for unstaged changes, or git diff --staged for staged changes] + +## Verification Output +### Lint +[lint output] +### Typecheck +[typecheck output] +### Tests +[test output with pass/fail counts] +``` + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/milestone-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "Review this milestone implementation. The spec, acceptance criteria, git diff, and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: <uuid>`), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review this milestone implementation using the following spec, acceptance criteria, git diff, and verification output: + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/milestone-${REVIEW_ID}.md and review this milestone implementation. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/milestone-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/milestone-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/milestone-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/milestone-review-${REVIEW_ID}.stderr \ + --status-file /tmp/milestone-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/milestone-review-${REVIEW_ID}.sh >/tmp/milestone-review-${REVIEW_ID}.runner.out 2>/tmp/milestone-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/milestone-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/milestone-review-${REVIEW_ID}.json > /tmp/milestone-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/milestone-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/milestone-review-${REVIEW_ID}.runner.out /tmp/milestone-review-${REVIEW_ID}.md +``` + +Fallback is allowed only when the helper is missing or not executable. + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/milestone-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/milestone-review-${REVIEW_ID}.stderr` + - `/tmp/milestone-review-${REVIEW_ID}.status` + - `/tmp/milestone-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 4 Step 6 (commit & approve) + - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` -> treat as approved + - Helper state `completed-empty-output` -> treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` -> surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached -> present to user for manual decision (proceed or stop) + +#### Step 5: Address Feedback & Re-verify + +1. Address the reviewer findings in priority order (`P0` -> `P1` -> `P2`, then `P3` when practical) (do NOT commit yet). +2. Re-run verification (lint/typecheck/tests) — all must pass. +3. Update `/tmp/milestone-${REVIEW_ID}.md` with new diff and verification output. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this milestone and requested revisions. Read the updated payload at /tmp/milestone-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed milestone M<N> and requested revisions. + +Previous feedback summary: [key points from last review] + +I've addressed your feedback. Updated diff and verification output are below. + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +Do not run `jq` extraction until after the helper or fallback execution completes, then extract `/tmp/milestone-review-${REVIEW_ID}.md` from the JSON response. + +After updating `/tmp/milestone-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Cleanup Per Milestone + +```bash +rm -f \ + /tmp/milestone-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.json \ + /tmp/milestone-review-${REVIEW_ID}.stderr \ + /tmp/milestone-review-${REVIEW_ID}.status \ + /tmp/milestone-review-${REVIEW_ID}.runner.out \ + /tmp/milestone-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 6: Completion (REQUIRED SUB-SKILL) + +After all milestones are approved and committed: + +1. Invoke `superpowers:finishing-a-development-branch`. +2. Run full test suite one final time — all must pass. +3. Merge the worktree branch into the parent branch: + +```bash +# From the main repo (not the worktree) +git merge implement/<plan-folder-name> +``` + +1. Delete the worktree and its branch: + +```bash +git worktree remove <worktree-path> +git branch -d implement/<plan-folder-name> +``` + +1. Mark plan status as `completed` in `story-tracker.md`. + +### Phase 7: Final Report + +Present summary: + +```markdown +## Implementation Complete + +**Plan:** <plan-folder-name> +**Milestones:** <N> completed, <N> approved +**Review rounds:** <total across all milestones> +**Branch:** implement/<plan-folder-name> (merged and deleted) +``` + +### Phase 8: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from the installed Codex skills directory: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.codex/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome for the implement-plan run (fully completed, stopped after max rounds, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "implement-plan completed for <plan-folder-name>: <status summary>" +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Quick Reference + +| Phase | Action | Required Output | +|---|---|---| +| 1 | Locate plan in `ai_plan/` | Plan folder identified, files read | +| 2 | Configure reviewer CLI and model | `REVIEWER_CLI`, `REVIEWER_MODEL`, `MAX_ROUNDS` | +| 3 | Invoke `superpowers:using-git-worktrees` | Worktree created, baseline passing | +| 4 | Execute milestones (loop) | Stories tracked, verified, committed, reviewed | +| 5 | Milestone review loop (per milestone) | Reviewer approval or max rounds + user override | +| 6 | Invoke `superpowers:finishing-a-development-branch` | Branch merged to parent, worktree deleted | +| 7 | Final report | Summary presented | +| 8 | Send Telegram notification | User notified or notification status reported | + +## Tracker Discipline (MANDATORY) + +**ALWAYS update `story-tracker.md` before/after each story. NEVER proceed with stale tracker state.** + +Before starting any story: + +1. Open `story-tracker.md` +2. Mark story `in-dev` +3. Add notes if relevant +4. Then begin implementation + +After completing any story: + +1. Mark story `completed` +2. Review pending stories +3. Update Last Updated and Stories Complete counts + +Note: Commit hashes are backfilled into story Notes after the milestone commit (Step 6), not per-story. + +## Common Mistakes + +- Using deprecated commands like `superpowers-codex bootstrap` or `superpowers-codex use-skill`. +- Proceeding to milestone review with failing tests. +- Pushing commits before milestone approval. +- Skipping worktree setup and working directly on the main branch. +- Not capturing the Codex session ID for resume in subsequent review rounds. +- Forgetting to update `story-tracker.md` between stories. +- Creating a new worktree when one already exists for a resumed plan. +- Using any notification path other than Telegram. + +## Rationalizations and Counters + +| Rationalization | Counter | +|---|---| +| "Bootstrap CLI is faster" | Deprecated for Codex; native discovery is the supported path. | +| "I can skip the worktree for small plans" | Worktree isolation is mandatory — it protects the main branch. | +| "Tests passed earlier, I can skip re-verification" | Each milestone must be independently verified before review. | +| "The reviewer approved, I can skip my own validation" | Reviewer feedback supplements but does not replace your own verification. | +| "I can commit before the reviewer approves" | Code must only be committed after milestone approval — reviewers evaluate uncommitted diffs. | + +## Red Flags - Stop and Correct + +- You are about to run any `superpowers-codex` command. +- You are pushing commits without user approval. +- You did not announce which skill you invoked and why. +- You are proceeding to review with failing lint/typecheck/tests. +- You are skipping the worktree and working on the main branch. +- You are applying a reviewer suggestion that contradicts user requirements. + +## Verification Checklist + +- [ ] Plan folder located and all required files present +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Worktree created with branch `implement/<plan-folder-name>` +- [ ] Worktree directory verified in .gitignore +- [ ] Baseline tests pass in worktree +- [ ] Each milestone: stories tracked (in-dev -> completed) +- [ ] Each milestone: lint/typecheck/tests pass before review +- [ ] Each milestone: reviewer approved (or max rounds + user override) +- [ ] Each milestone: committed locally only after approval +- [ ] Each milestone: marked approved in story-tracker.md +- [ ] All milestones completed, approved, and committed +- [ ] Final test suite passes +- [ ] Worktree branch merged to parent and worktree deleted +- [ ] Story tracker updated with final status +- [ ] Telegram notification attempted if configured diff --git a/skills/implement-plan/_source/cursor/SKILL.md b/skills/implement-plan/_source/cursor/SKILL.md new file mode 100644 index 0000000..b2e479b --- /dev/null +++ b/skills/implement-plan/_source/cursor/SKILL.md @@ -0,0 +1,727 @@ +--- +name: implement-plan +description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review in Cursor Agent CLI workflows. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. +--- + +# Implement Plan (Cursor Agent CLI) + +Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. + +## Overview + +This skill wraps the Superpowers execution flow for the Cursor Agent CLI (`cursor-agent`): + +1. Locate plan files under `ai_plan/` +2. Set up an isolated git worktree +3. Execute milestones one-by-one with lint/typecheck/test gates +4. Review each milestone with a second model/provider +5. Commit approved milestones, merge to parent branch, and delete worktree + +**Core principle:** Cursor Agent CLI discovers skills from `.cursor/skills/` (repo-local), `~/.cursor/skills/` (global), and installed Cursor plugin cache entries. It also reads `AGENTS.md` at the repo root for additional instructions. + +## Prerequisite Check (MANDATORY) + +Required: + +- Cursor Agent CLI: `cursor-agent --version` (install via `curl https://cursor.com/install -fsS | bash`). The binary is `cursor-agent` (installed to `~/.local/bin/`). Some environments alias it as `cursor agent` (subcommand of the Cursor IDE CLI) — both forms work, but this skill uses `cursor-agent` throughout. +- `jq` (required only if using `cursor` as the reviewer CLI): `jq --version` (install via `brew install jq` or your package manager) +- Plan folder exists under `ai_plan/` at project root +- `continuation-runbook.md` exists in plan folder +- `milestone-plan.md` exists in plan folder +- `story-tracker.md` exists in plan folder +- Git repo with worktree support: `git worktree list` +- Superpowers skills available from the Cursor plugin cache, `.cursor/skills/` (repo-local), or `~/.cursor/skills/` (global). Do not install both the plugin and a manual Superpowers copy, or Cursor may show duplicate skill entries. +- Superpowers execution skills: + - `superpowers:executing-plans` + - `superpowers:using-git-worktrees` + - `superpowers:verification-before-completion` + - `superpowers:finishing-a-development-branch` + +Verify before proceeding: + +```bash +cursor-agent --version +test -f .cursor/skills/superpowers/skills/executing-plans/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/executing-plans/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/executing-plans/SKILL.md' -print -quit 2>/dev/null | grep -q . +test -f .cursor/skills/superpowers/skills/using-git-worktrees/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/using-git-worktrees/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/using-git-worktrees/SKILL.md' -print -quit 2>/dev/null | grep -q . +test -f .cursor/skills/superpowers/skills/verification-before-completion/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/verification-before-completion/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/verification-before-completion/SKILL.md' -print -quit 2>/dev/null | grep -q . +test -f .cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md || test -f ~/.cursor/skills/superpowers/skills/finishing-a-development-branch/SKILL.md || find ~/.cursor/plugins/cache/cursor-public/superpowers -path '*/skills/finishing-a-development-branch/SKILL.md' -print -quit 2>/dev/null | grep -q . +# Only if using cursor as reviewer CLI: +# jq --version +``` + +If any dependency is missing, stop and return: + +`Missing dependency: [specific missing item]. Install the Cursor Superpowers plugin or install Superpowers under .cursor/skills/ or ~/.cursor/skills/, then retry.` + +If no plan folder exists: + +`No plan found under ai_plan/. Run create-plan first.` + +## Required Skill Invocation Rules + +- Invoke relevant skills through Cursor-native discovery (`.cursor/skills/`, `~/.cursor/skills/`, or installed Cursor plugin cache entries). +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- For skills with checklists, track checklist items explicitly in conversation. + +## Process + +### Phase 1: Locate Plan + +1. Scan `ai_plan/` for plan directories (most recent first by date prefix). +2. If multiple plans exist, ask user which one to implement. +3. If no plan exists, stop: "No plan found. Run create-plan first." +4. Read `continuation-runbook.md` first (source of truth). +5. Read `story-tracker.md` to detect resume state (`in-dev` or `completed` stories). +6. Read `milestone-plan.md` for implementation details. + +### Phase 2: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "implement the plan, review with codex o4-mini"), use those values. Otherwise, ask: + +1. **Which CLI should review each milestone?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed with user approval only + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see available models + - Accept any model string the user provides + +3. **Max review rounds per milestone?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed for the entire run. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/<pi-model-name>`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 3: Set Up Worktree (REQUIRED SUB-SKILL) + +Invoke `superpowers:using-git-worktrees`. + +1. Branch naming: `implement/<plan-folder-name>` (e.g., `implement/2026-03-04-auth-system`). +2. Follow worktree skill's directory priority: `.worktrees/` > `worktrees/` > CLAUDE.md > ask user. +3. Verify `.gitignore` covers worktree directory. +4. Run project setup (auto-detect: `npm install`, `cargo build`, `pip install`, etc.). +5. Verify clean baseline (run tests). + +**Resume detection:** If `story-tracker.md` shows `in-dev` or `completed` stories, check if worktree branch already exists (`git worktree list`). If so, `cd` into existing worktree instead of creating a new one. + +### Phase 4: Execute Milestones (Loop) + +For each milestone (M1, M2, ...): + +#### Step 1: Read Milestone Spec + +Read the milestone section from `milestone-plan.md`. + +#### Step 2: Update Tracker + +Mark first story `in-dev` in `story-tracker.md`. + +#### Step 3: Implement Stories + +Execute each story in order. After completing each story: + +1. Mark `in-dev` -> `completed` in `story-tracker.md` +2. Update counts +3. Mark next story `in-dev` + +Commit hashes are not available yet — they are backfilled in Step 6 after the milestone is approved and committed. + +#### Step 4: Verify Milestone (REQUIRED SUB-SKILL) + +Invoke `superpowers:verification-before-completion`. + +```bash +# Lint changed files +# Typecheck +# Run tests (targeted first, then full suite) +``` + +All must pass before proceeding. If failures: fix, re-verify. Do NOT proceed to review with failures. + +#### Step 5: Milestone Review Loop + +Send to reviewer for approval **before committing**. See Phase 5 for details. The review payload uses working-tree diffs (`git diff` for unstaged, `git diff --staged` for staged changes). + +**Skip this step if reviewer was set to `skip`.** When skipped, present the milestone summary to the user and ask for approval directly. + +#### Step 6: Commit & Approve + +Only after the reviewer approves (or user overrides at max rounds): + +```bash +git add <changed-files> +git commit -m "feat(<scope>): implement milestone M<N> - <description>" +``` + +Do NOT push. After committing: + +1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. +2. Mark milestone as `approved` in `story-tracker.md`. +3. Move to next milestone. + +### Phase 5: Milestone Review Loop (Detail) + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use `REVIEW_ID` for all milestone review temp file paths: + +- `/tmp/milestone-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.json` +- `/tmp/milestone-review-${REVIEW_ID}.stderr` +- `/tmp/milestone-review-${REVIEW_ID}.status` +- `/tmp/milestone-review-${REVIEW_ID}.runner.out` +- `/tmp/milestone-review-${REVIEW_ID}.sh` + +Resolve the shared runtime helper path before writing the command script: + +```bash +if [ -x .cursor/skills/reviewer-runtime/run-review.sh ]; then + REVIEWER_RUNTIME=.cursor/skills/reviewer-runtime/run-review.sh +else + REVIEWER_RUNTIME=~/.cursor/skills/reviewer-runtime/run-review.sh +fi +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.json) + ;; +esac +``` + +#### Step 2: Write Review Payload + +Write to `/tmp/milestone-${REVIEW_ID}.md`: + +```markdown +# Milestone M<N> Review: <title> + +## Milestone Spec (from plan) +[Copy milestone section from milestone-plan.md] + +## Acceptance Criteria +[Copy acceptance criteria checkboxes] + +## Changes Made (git diff) +[Output of: git diff -- for unstaged changes, or git diff --staged for staged changes] + +## Verification Output +### Lint +[lint output] +### Typecheck +[typecheck output] +### Tests +[test output with pass/fail counts] +``` + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/milestone-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "Review this milestone implementation. The spec, acceptance criteria, git diff, and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: <uuid>`), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review this milestone implementation using the following spec, acceptance criteria, git diff, and verification output: + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/milestone-${REVIEW_ID}.md and review this milestone implementation. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/milestone-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. + +Notes on Cursor flags: + +- `--mode=ask` — read-only mode, no file modifications +- `--trust` — trust workspace without prompting (required for non-interactive use) +- `-p` / `--print` — non-interactive mode, output to stdout +- `--output-format json` — structured output with `session_id` and `result` fields + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/milestone-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/milestone-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/milestone-review-${REVIEW_ID}.stderr \ + --status-file /tmp/milestone-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/milestone-review-${REVIEW_ID}.sh >/tmp/milestone-review-${REVIEW_ID}.runner.out 2>/tmp/milestone-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/milestone-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/milestone-review-${REVIEW_ID}.json > /tmp/milestone-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/milestone-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/milestone-review-${REVIEW_ID}.runner.out /tmp/milestone-review-${REVIEW_ID}.md +``` + +Fallback is allowed only when the helper is missing or not executable. + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/milestone-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/milestone-review-${REVIEW_ID}.stderr` + - `/tmp/milestone-review-${REVIEW_ID}.status` + - `/tmp/milestone-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 4 Step 6 (commit & approve) + - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` -> treat as approved + - Helper state `completed-empty-output` -> treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` -> surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached -> present to user for manual decision (proceed or stop) + +#### Step 5: Address Feedback & Re-verify + +1. Address the reviewer findings in priority order (`P0` -> `P1` -> `P2`, then `P3` when practical) (do NOT commit yet). +2. Re-run verification (lint/typecheck/tests) — all must pass. +3. Update `/tmp/milestone-${REVIEW_ID}.md` with new diff and verification output. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this milestone and requested revisions. Read the updated payload at /tmp/milestone-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed milestone M<N> and requested revisions. + +Previous feedback summary: [key points from last review] + +I've addressed your feedback. Updated diff and verification output are below. + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +Do not run `jq` extraction until after the helper or fallback execution completes, then extract `/tmp/milestone-review-${REVIEW_ID}.md` from the JSON response. + +After updating `/tmp/milestone-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Cleanup Per Milestone + +```bash +rm -f \ + /tmp/milestone-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.json \ + /tmp/milestone-review-${REVIEW_ID}.stderr \ + /tmp/milestone-review-${REVIEW_ID}.status \ + /tmp/milestone-review-${REVIEW_ID}.runner.out \ + /tmp/milestone-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 6: Completion (REQUIRED SUB-SKILL) + +After all milestones are approved and committed: + +1. Invoke `superpowers:finishing-a-development-branch`. +2. Run full test suite one final time — all must pass. +3. Merge the worktree branch into the parent branch: + +```bash +# From the main repo (not the worktree) +git merge implement/<plan-folder-name> +``` + +1. Delete the worktree and its branch: + +```bash +git worktree remove <worktree-path> +git branch -d implement/<plan-folder-name> +``` + +1. Mark plan status as `completed` in `story-tracker.md`. + +### Phase 7: Final Report + +Present summary: + +```markdown +## Implementation Complete + +**Plan:** <plan-folder-name> +**Milestones:** <N> completed, <N> approved +**Review rounds:** <total across all milestones> +**Branch:** implement/<plan-folder-name> (merged and deleted) +``` + +### Phase 8: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from Cursor's installed skills directory: + +```bash +if [ -x .cursor/skills/reviewer-runtime/notify-telegram.sh ]; then + TELEGRAM_NOTIFY_RUNTIME=.cursor/skills/reviewer-runtime/notify-telegram.sh +else + TELEGRAM_NOTIFY_RUNTIME=~/.cursor/skills/reviewer-runtime/notify-telegram.sh +fi +``` + +On every terminal outcome for the implement-plan run (fully completed, stopped after max rounds, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "implement-plan completed for <plan-folder-name>: <status summary>" +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Quick Reference + +| Phase | Action | Required Output | +|---|---|---| +| 1 | Locate plan in `ai_plan/` | Plan folder identified, files read | +| 2 | Configure reviewer CLI and model | `REVIEWER_CLI`, `REVIEWER_MODEL`, `MAX_ROUNDS` | +| 3 | Invoke `superpowers:using-git-worktrees` | Worktree created, baseline passing | +| 4 | Execute milestones (loop) | Stories tracked, verified, committed, reviewed | +| 5 | Milestone review loop (per milestone) | Reviewer approval or max rounds + user override | +| 6 | Invoke `superpowers:finishing-a-development-branch` | Branch merged to parent, worktree deleted | +| 7 | Final report | Summary presented | +| 8 | Send Telegram notification | User notified or notification status reported | + +## Tracker Discipline (MANDATORY) + +Before starting any story: + +1. Open `story-tracker.md` +2. Mark story `in-dev` +3. Add notes if relevant +4. Then begin implementation + +After completing any story: + +1. Mark story `completed` +2. Review pending stories +3. Update Last Updated and Stories Complete counts + +Note: Commit hashes are backfilled into story Notes after the milestone commit (Step 6), not per-story. + +## Common Mistakes + +- Forgetting `--trust` flag when running `cursor-agent` non-interactively (causes interactive prompt). +- Using `--mode=agent` or `--force` for reviews (reviewer should be read-only, use `--mode=ask`). +- Proceeding to milestone review with failing tests. +- Pushing commits before milestone approval. +- Skipping worktree setup and working directly on the main branch. +- Forgetting to update `story-tracker.md` between stories. +- Creating a new worktree when one already exists for a resumed plan. +- Using any notification path other than Telegram. + +## Red Flags - Stop and Correct + +- You started implementing without reading `continuation-runbook.md` first. +- You are pushing commits without user approval. +- You did not announce which skill you invoked and why. +- You are proceeding to review with failing lint/typecheck/tests. +- You are skipping the worktree and working on the main branch. +- You are applying a reviewer suggestion that contradicts user requirements. +- Reviewer CLI is running with write permissions (must be read-only). + +## Verification Checklist + +- [ ] Plan folder located and all required files present +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Worktree created with branch `implement/<plan-folder-name>` +- [ ] Worktree directory verified in .gitignore +- [ ] Baseline tests pass in worktree +- [ ] Each milestone: stories tracked (in-dev -> completed) +- [ ] Each milestone: lint/typecheck/tests pass before review +- [ ] Each milestone: reviewer approved (or max rounds + user override) +- [ ] Each milestone: committed locally only after approval +- [ ] Each milestone: marked approved in story-tracker.md +- [ ] All milestones completed, approved, and committed +- [ ] Final test suite passes +- [ ] Worktree branch merged to parent and worktree deleted +- [ ] Story tracker updated with final status +- [ ] Telegram notification attempted if configured diff --git a/skills/implement-plan/_source/opencode/SKILL.md b/skills/implement-plan/_source/opencode/SKILL.md new file mode 100644 index 0000000..d80cdcc --- /dev/null +++ b/skills/implement-plan/_source/opencode/SKILL.md @@ -0,0 +1,797 @@ +--- +name: implement-plan +description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review in OpenCode workflows. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. +--- + +# Implement Plan (OpenCode) + +Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. + +## Prerequisite Check (MANDATORY) + +This OpenCode variant depends on Superpowers execution skills being installed via OpenCode's native skill system. + +Required: + +- Plan folder exists under `ai_plan/` at project root +- `continuation-runbook.md` exists in plan folder +- `milestone-plan.md` exists in plan folder +- `story-tracker.md` exists in plan folder +- Git repo with worktree support: `git worktree list` +- OpenCode Superpowers skills available at `~/.agents/skills/superpowers` or `~/.config/opencode/skills/superpowers` +- Superpowers execution skills: + - `superpowers/executing-plans` + - `superpowers/using-git-worktrees` + - `superpowers/verification-before-completion` + - `superpowers/finishing-a-development-branch` + +Verify before proceeding: + +```bash +test -f ~/.agents/skills/superpowers/executing-plans/SKILL.md || test -f ~/.config/opencode/skills/superpowers/executing-plans/SKILL.md +test -f ~/.agents/skills/superpowers/using-git-worktrees/SKILL.md || test -f ~/.config/opencode/skills/superpowers/using-git-worktrees/SKILL.md +test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md || test -f ~/.config/opencode/skills/superpowers/verification-before-completion/SKILL.md +test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md || test -f ~/.config/opencode/skills/superpowers/finishing-a-development-branch/SKILL.md +``` + +If dependencies are missing, stop immediately and return: + +"Missing dependency: OpenCode Superpowers execution skills are required (`superpowers/executing-plans`, `superpowers/using-git-worktrees`, `superpowers/verification-before-completion`, `superpowers/finishing-a-development-branch`). Install from https://github.com/obra/superpowers (OpenCode setup), then retry." + +If no plan folder exists: + +"No plan found under `ai_plan/`. Run `create-plan` first." + +## Process + +### Phase 1: Bootstrap Superpowers Context (REQUIRED) + +Use OpenCode's native skill tool: + +- list skills +- verify `superpowers/executing-plans`, `superpowers/using-git-worktrees`, `superpowers/verification-before-completion`, and `superpowers/finishing-a-development-branch` are discoverable + +### Phase 2: Locate Plan + +1. Scan `ai_plan/` for plan directories (most recent first by date prefix). +2. If multiple plans exist, ask user which one to implement. +3. If no plan exists, stop: "No plan found. Run create-plan first." +4. Read `continuation-runbook.md` first (source of truth). +5. Read `story-tracker.md` to detect resume state (`in-dev` or `completed` stories). +6. Read `milestone-plan.md` for implementation details. + +### Phase 3: Configure Reviewer + +If the user has already specified a reviewer CLI and model (e.g., "implement the plan, review with codex o4-mini"), use those values. Otherwise, ask: + +1. **Which CLI should review each milestone?** + - `codex` — OpenAI Codex CLI (`codex exec`) + - `claude` — Claude Code CLI (`claude -p`) + - `cursor` — Cursor Agent CLI (`cursor-agent -p`) + - `skip` — No external review, proceed with user approval only + +2. **Which model?** (only if a CLI was chosen) + - For `codex`: default `o4-mini`, alternatives: `gpt-5.3-codex`, `o3` + - For `claude`: default `sonnet`, alternatives: `opus`, `haiku` + - For `cursor`: **run `cursor-agent models` first** to see available models + - Accept any model string the user provides + +3. **Max review rounds per milestone?** (default: 10) + - If the user does not provide a value, set `MAX_ROUNDS=10`. + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed for the entire run. + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/<pi-model-name>`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the model running this workflow. If the model/provider is unavailable, surface helper stderr/status and use `pi --list-models [search]` to inspect configured models. + +### Phase 4: Set Up Worktree (REQUIRED SUB-SKILL) + +Use OpenCode's native skill tool to load: + +- `superpowers/using-git-worktrees` + +Then: + +1. Branch naming: `implement/<plan-folder-name>` (e.g., `implement/2026-03-04-auth-system`). +2. Follow worktree skill's directory priority: `.worktrees/` > `worktrees/` > CLAUDE.md > ask user. +3. Verify `.gitignore` covers worktree directory. +4. Run project setup (auto-detect: `npm install`, `cargo build`, `pip install`, etc.). +5. Verify clean baseline (run tests). + +**Resume detection:** If `story-tracker.md` shows `in-dev` or `completed` stories, check if worktree branch already exists (`git worktree list`). If so, `cd` into existing worktree instead of creating a new one. + +### Phase 5: Execute Milestones (Loop) + +For each milestone (M1, M2, ...): + +#### Step 1: Read Milestone Spec + +Read the milestone section from `milestone-plan.md`. + +#### Step 2: Update Tracker + +Mark first story `in-dev` in `story-tracker.md`. + +#### Step 3: Implement Stories + +Execute each story in order. After completing each story: + +1. Mark `in-dev` -> `completed` in `story-tracker.md` +2. Update counts +3. Mark next story `in-dev` + +Commit hashes are not available yet — they are backfilled in Step 6 after the milestone is approved and committed. + +#### Step 4: Verify Milestone (REQUIRED SUB-SKILL) + +Use OpenCode's native skill tool to load: + +- `superpowers/verification-before-completion` + +```bash +# Lint changed files +# Typecheck +# Run tests (targeted first, then full suite) +``` + +All must pass before proceeding. If failures: fix, re-verify. Do NOT proceed to review with failures. + +#### Step 5: Milestone Review Loop + +Send to reviewer for approval **before committing**. See Phase 6 for details. The review payload uses working-tree diffs (`git diff` for unstaged, `git diff --staged` for staged changes). + +**Skip this step if reviewer was set to `skip`.** When skipped, present the milestone summary to the user and ask for approval directly. + +#### Step 6: Commit & Approve + +Only after the reviewer approves (or user overrides at max rounds): + +```bash +git add <changed-files> +git commit -m "feat(<scope>): implement milestone M<N> - <description>" +``` + +Do NOT push. After committing: + +1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. +2. Mark milestone as `approved` in `story-tracker.md`. +3. Move to next milestone. + +### Phase 6: Milestone Review Loop (Detail) + +**Skip this phase entirely if reviewer was set to `skip`.** + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use `REVIEW_ID` for all milestone review temp file paths: + +- `/tmp/milestone-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.json` +- `/tmp/milestone-review-${REVIEW_ID}.stderr` +- `/tmp/milestone-review-${REVIEW_ID}.status` +- `/tmp/milestone-review-${REVIEW_ID}.runner.out` +- `/tmp/milestone-review-${REVIEW_ID}.sh` + +Resolve the shared runtime helper path before writing the command script: + +```bash +REVIEWER_RUNTIME=~/.config/opencode/skills/reviewer-runtime/run-review.sh +``` + +Set helper success-artifact args before writing the command script: + +```bash +HELPER_SUCCESS_FILE_ARGS=() +case "$REVIEWER_CLI" in + codex) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.md) + ;; + cursor) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.json) + ;; + opencode) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.md) + ;; +esac +``` + +#### Step 2: Write Review Payload + +Write to `/tmp/milestone-${REVIEW_ID}.md`: + +```markdown +# Milestone M<N> Review: <title> + +## Milestone Spec (from plan) +[Copy milestone section from milestone-plan.md] + +## Acceptance Criteria +[Copy acceptance criteria checkboxes] + +## Changes Made (git diff) +[Output of: git diff -- for unstaged changes, or git diff --staged for staged changes] + +## Verification Output +### Lint +[lint output] +### Typecheck +[typecheck output] +### Tests +[test output with pass/fail counts] +``` + +#### Review Contract (Applies to Every Round) + +The reviewer response must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3`. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- Use `- None.` when a severity has no findings. +- `VERDICT: APPROVED` is allowed only when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking. +- The calling agent should still try to fix `P3` findings when they are cheap and safe. + +#### Liveness Contract (Applies While Review Is Running) + +- The shared reviewer runtime emits `state=in-progress note="In progress N"` heartbeats every 60 seconds while the reviewer child is alive. +- The calling agent must keep waiting as long as a fresh `In progress N` heartbeat keeps arriving roughly once per minute. +- Do not abort just because the review is slow, a soft timeout fired, or a `stall-warning` line appears, as long as the `In progress N` heartbeat continues. +- Treat missing heartbeats, `state=failed`, `state=completed-empty-output`, and `state=needs-operator-decision` as escalation signals. + +#### Step 3: Submit to Reviewer (Round 1) + +Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a bash script: + +```bash +#!/usr/bin/env bash +set -euo pipefail +``` + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call every round (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "Read the file /tmp/milestone-${REVIEW_ID}.md and review. Return exactly the required ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +```bash +codex exec \ + -m ${REVIEWER_MODEL} \ + -s read-only \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "Review this milestone implementation. The spec, acceptance criteria, git diff, and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." +``` + +Do not try to capture the Codex session ID yet. When using the helper, extract it from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the command completes (look for `session id: <uuid>`), then store it as `CODEX_SESSION_ID` for resume in subsequent rounds. + +**If `REVIEWER_CLI` is `claude`:** + +```bash +claude -p \ + "Review this milestone implementation using the following spec, acceptance criteria, git diff, and verification output: + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +```bash +cursor-agent -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "Read the file /tmp/milestone-${REVIEW_ID}.md and review this milestone implementation. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use `- None.` when a severity has no findings. +- `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. +- End with exactly one verdict line: `VERDICT: APPROVED` or `VERDICT: REVISE` +- `VERDICT: APPROVED` is allowed only when there are no `P0`, `P1`, or `P2` findings. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +For `cursor`, the command script writes raw JSON to `/tmp/milestone-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. + +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode uses `--agent plan` for read-oriented review. Fresh call is the recommended default. + +Round 1: + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/milestone-${REVIEW_ID}.md and review this milestone implementation. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use \`- None.\` when a severity has no findings. +- \`P0\` = total blocker, \`P1\` = major risk, \`P2\` = must-fix before approval, \`P3\` = cosmetic / nice to have. +- End with exactly one verdict line: \`VERDICT: APPROVED\` or \`VERDICT: REVISE\` +- \`VERDICT: APPROVED\` is allowed only when there are no \`P0\`, \`P1\`, or \`P2\` findings. \`P3\` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call, recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this milestone and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated milestone payload is in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +Extract the review body: + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/milestone-review-${REVIEW_ID}.json \ + > /tmp/milestone-review-${REVIEW_ID}.md \ + || cp /tmp/milestone-review-${REVIEW_ID}.json /tmp/milestone-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output. On any opencode +CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the +helper-failure escalation in Step 4. + +Run the command script through the shared helper when available: + +```bash +if [ -x "$REVIEWER_RUNTIME" ]; then + "$REVIEWER_RUNTIME" \ + --command-file /tmp/milestone-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/milestone-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/milestone-review-${REVIEW_ID}.stderr \ + --status-file /tmp/milestone-review-${REVIEW_ID}.status \ + "${HELPER_SUCCESS_FILE_ARGS[@]}" +else + echo "Warning: reviewer runtime helper not found at $REVIEWER_RUNTIME; falling back to direct synchronous review." >&2 + bash /tmp/milestone-review-${REVIEW_ID}.sh >/tmp/milestone-review-${REVIEW_ID}.runner.out 2>/tmp/milestone-review-${REVIEW_ID}.stderr +fi +``` + +Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. + +After the command completes: + +- If `REVIEWER_CLI=cursor`, extract the final review text: + +```bash +CURSOR_SESSION_ID=$(jq -r '.session_id' /tmp/milestone-review-${REVIEW_ID}.json) +jq -r '.result' /tmp/milestone-review-${REVIEW_ID}.json > /tmp/milestone-review-${REVIEW_ID}.md +``` + +- If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/milestone-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=opencode`, the `jq` extraction above covers output capture. If it falls through, copy runner output: `cp /tmp/milestone-review-${REVIEW_ID}.runner.out /tmp/milestone-review-${REVIEW_ID}.md`. On Round 1, also attempt to capture the session id for optional use in subsequent rounds: `OPENCODE_SESSION_ID=$(jq -r 'if type == "array" then (.[0] | (.id? // .session_id?)) else (.id? // .session_id?) end // empty' /tmp/milestone-review-${REVIEW_ID}.json 2>/dev/null || true)` +- If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: + +```bash +cp /tmp/milestone-review-${REVIEW_ID}.runner.out /tmp/milestone-review-${REVIEW_ID}.md +``` + +Fallback is allowed only when the helper is missing or not executable. + +#### Step 4: Read Review & Check Verdict + +1. Read `/tmp/milestone-review-${REVIEW_ID}.md` +2. If the review failed, produced empty output, or reached helper timeout, also read: + - `/tmp/milestone-review-${REVIEW_ID}.stderr` + - `/tmp/milestone-review-${REVIEW_ID}.status` + - `/tmp/milestone-review-${REVIEW_ID}.runner.out` +3. Present review to the user: + +```markdown +## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) + +[Reviewer feedback] +``` + +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: + - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 5 Step 6 (commit & approve) + - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed + - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 + - No clear verdict but `P0`, `P1`, and `P2` are all `- None.` -> treat as approved + - Helper state `completed-empty-output` -> treat as failed review attempt, surface stderr/status, fix invocation or prompt handling, then retry + - Helper state `needs-operator-decision` -> surface status log and decide whether to extend the timeout, abort, or retry with different helper parameters + - Max rounds (`MAX_ROUNDS`) reached -> present to user for manual decision (proceed or stop) + +#### Step 5: Address Feedback & Re-verify + +1. Address the reviewer findings in priority order (`P0` -> `P1` -> `P2`, then `P3` when practical) (do NOT commit yet). +2. Re-run verification (lint/typecheck/tests) — all must pass. +3. Update `/tmp/milestone-${REVIEW_ID}.md` with new diff and verification output. + +Summarize revisions for the user: + +```markdown +### Revisions (Round N) +- [Change and reason, one bullet per issue addressed] +``` + +If a revision contradicts the user's explicit requirements, skip it and note it for the user. + +#### Step 6: Re-submit to Reviewer (Rounds 2-N) + +Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. + +**If `REVIEWER_CLI` is `pi`:** + +Fresh call with prior-round context (Pi reviewer calls do not use session resume): + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files \ + --model "$REVIEWER_MODEL" \ + --tools read,grep,find,ls \ + -p "You previously reviewed this milestone and requested revisions. Read the updated payload at /tmp/milestone-${REVIEW_ID}.md and re-review using the same ## Summary, ## Findings, and ## Verdict structure." +``` + +**If `REVIEWER_CLI` is `codex`:** + +Resume the existing session: + +```bash +codex exec resume ${CODEX_SESSION_ID} \ + -o /tmp/milestone-review-${REVIEW_ID}.md \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." +``` + +If resume fails (session expired), fall back to fresh `codex exec` with context about prior rounds. + +**If `REVIEWER_CLI` is `claude`:** + +Fresh call with accumulated context (Claude CLI has no session resume): + +```bash +claude -p \ + "You previously reviewed milestone M<N> and requested revisions. + +Previous feedback summary: [key points from last review] + +I've addressed your feedback. Updated diff and verification output are below. + +$(cat /tmp/milestone-${REVIEW_ID}.md) + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + --model ${REVIEWER_MODEL} \ + --strict-mcp-config \ + --setting-sources user +``` + +**If `REVIEWER_CLI` is `cursor`:** + +Resume the existing session: + +```bash +cursor-agent --resume ${CURSOR_SESSION_ID} -p \ + --mode=ask \ + --model ${REVIEWER_MODEL} \ + --trust \ + --output-format json \ + "I've addressed your feedback. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same `## Summary`, `## Findings`, and `## Verdict` structure as before. +Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no findings, and only use `VERDICT: APPROVED` when no `P0`, `P1`, or `P2` findings remain. `P3` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. + +**If `REVIEWER_CLI` is `opencode`:** + +Fresh call (recommended default — opencode has no guaranteed stable session ID in headless mode): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this milestone and requested revisions. + +Previous feedback summary: [key points from last review] + +I've addressed your feedback. Updated milestone payload is in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/milestone-review-${REVIEW_ID}.json \ + > /tmp/milestone-review-${REVIEW_ID}.md \ + || cp /tmp/milestone-review-${REVIEW_ID}.json /tmp/milestone-review-${REVIEW_ID}.md +``` + +Optional session-resume path (only if `OPENCODE_SESSION_ID` was captured on Round 1 and your installed opencode accepts `-s <id>` reliably in headless mode): + +```bash +opencode run \ + -s ${OPENCODE_SESSION_ID} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've addressed your feedback on this milestone. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/milestone-review-${REVIEW_ID}.json \ + > /tmp/milestone-review-${REVIEW_ID}.md \ + || cp /tmp/milestone-review-${REVIEW_ID}.json /tmp/milestone-review-${REVIEW_ID}.md +``` + +If session resume fails (session expired or not supported), fall back to the fresh-call path above. + +Do not run `jq` extraction until after the helper or fallback execution completes, then extract `/tmp/milestone-review-${REVIEW_ID}.md` from the JSON response. + +After updating `/tmp/milestone-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. + +Return to Step 4. + +#### Step 7: Cleanup Per Milestone + +```bash +rm -f \ + /tmp/milestone-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.md \ + /tmp/milestone-review-${REVIEW_ID}.json \ + /tmp/milestone-review-${REVIEW_ID}.stderr \ + /tmp/milestone-review-${REVIEW_ID}.status \ + /tmp/milestone-review-${REVIEW_ID}.runner.out \ + /tmp/milestone-review-${REVIEW_ID}.sh +``` + +If the round failed, produced empty output, or reached operator-decision timeout, keep `.stderr`, `.status`, and `.runner.out` until the issue is diagnosed instead of deleting them immediately. + +### Phase 7: Completion (REQUIRED SUB-SKILL) + +After all milestones are approved and committed: + +1. Use OpenCode's native skill tool to load: `superpowers/finishing-a-development-branch` +2. Run full test suite one final time — all must pass. +3. Merge the worktree branch into the parent branch: + +```bash +# From the main repo (not the worktree) +git merge implement/<plan-folder-name> +``` + +1. Delete the worktree and its branch: + +```bash +git worktree remove <worktree-path> +git branch -d implement/<plan-folder-name> +``` + +1. Mark plan status as `completed` in `story-tracker.md`. + +### Phase 8: Final Report + +Present summary: + +```markdown +## Implementation Complete + +**Plan:** <plan-folder-name> +**Milestones:** <N> completed, <N> approved +**Review rounds:** <total across all milestones> +**Branch:** implement/<plan-folder-name> (merged and deleted) +``` + +### Phase 9: Telegram Notification (MANDATORY) + +Resolve the Telegram notifier helper from the installed OpenCode skills directory: + +```bash +TELEGRAM_NOTIFY_RUNTIME=~/.config/opencode/skills/reviewer-runtime/notify-telegram.sh +``` + +On every terminal outcome for the implement-plan run (fully completed, stopped after max rounds, skipped reviewer, or failure), send a Telegram summary if the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured: + +```bash +if [ -x "$TELEGRAM_NOTIFY_RUNTIME" ] && [ -n "${TELEGRAM_BOT_TOKEN:-}" ] && [ -n "${TELEGRAM_CHAT_ID:-}" ]; then + "$TELEGRAM_NOTIFY_RUNTIME" --message "implement-plan completed for <plan-folder-name>: <status summary>" +fi +``` + +Rules: + +- Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. +- Notification failures are non-blocking, but they must be surfaced to the user. +- Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. +- If Telegram is not configured, state that no Telegram notification was sent. + +## Tracker Discipline (MANDATORY) + +Before starting any story: + +1. Open `story-tracker.md` +2. Mark story `in-dev` +3. Add notes if relevant +4. Then begin implementation + +After completing any story: + +1. Mark story `completed` +2. Review pending stories +3. Update Last Updated and Stories Complete counts + +Note: Commit hashes are backfilled into story Notes after the milestone commit (Step 6), not per-story. + +## Verification Checklist + +- [ ] Plan folder located and all required files present +- [ ] Reviewer configured or explicitly skipped +- [ ] Max review rounds confirmed (default: 10) +- [ ] Worktree created with branch `implement/<plan-folder-name>` +- [ ] Worktree directory verified in .gitignore +- [ ] Baseline tests pass in worktree +- [ ] Each milestone: stories tracked (in-dev -> completed) +- [ ] Each milestone: lint/typecheck/tests pass before review +- [ ] Each milestone: reviewer approved (or max rounds + user override) +- [ ] Each milestone: committed locally only after approval +- [ ] Each milestone: marked approved in story-tracker.md +- [ ] All milestones completed, approved, and committed +- [ ] Final test suite passes +- [ ] Worktree branch merged to parent and worktree deleted +- [ ] Story tracker updated with final status +- [ ] Telegram notification attempted if configured diff --git a/skills/implement-plan/_source/pi/SKILL.md b/skills/implement-plan/_source/pi/SKILL.md new file mode 100644 index 0000000..eb4e77b --- /dev/null +++ b/skills/implement-plan/_source/pi/SKILL.md @@ -0,0 +1,241 @@ +--- +name: implement-plan +description: Use when a plan folder created by create-plan must be executed in pi with milestone verification, reviewer gates, local commits, and resumable tracker updates. +--- + +# Implement Plan (Pi) + +Execute an existing plan under `ai_plan/` milestone by milestone, using verification gates, reviewer approval, and local commits after each approved milestone. + +## Shared Setup + +Before using this skill, read: + +- [docs/PI-SUPERPOWERS.md](../../../docs/PI-SUPERPOWERS.md) +- [docs/PI-COMMON-REVIEWER.md](../../../docs/PI-COMMON-REVIEWER.md) + +This workflow depends on: + +- Superpowers execution skills being visible to pi +- the pi reviewer-runtime helper being installed in a supported location + +## Prerequisite Check (MANDATORY) + +Required: + +- `pi --version` +- a plan folder under `ai_plan/` +- `continuation-runbook.md` +- `milestone-plan.md` +- `story-tracker.md` +- git worktree support +- Superpowers `executing-plans` +- Superpowers `using-git-worktrees` +- Superpowers `verification-before-completion` +- Superpowers `finishing-a-development-branch` +- pi reviewer runtime helper +- pi Telegram notifier helper + +Quick checks for common installs: + +```bash +pi --version +git worktree list +test -f ~/.agents/skills/superpowers/executing-plans/SKILL.md || test -f ~/.pi/agent/skills/superpowers/executing-plans/SKILL.md +test -f ~/.agents/skills/superpowers/using-git-worktrees/SKILL.md || test -f ~/.pi/agent/skills/superpowers/using-git-worktrees/SKILL.md +test -f ~/.agents/skills/superpowers/verification-before-completion/SKILL.md || test -f ~/.pi/agent/skills/superpowers/verification-before-completion/SKILL.md +test -f ~/.agents/skills/superpowers/finishing-a-development-branch/SKILL.md || test -f ~/.pi/agent/skills/superpowers/finishing-a-development-branch/SKILL.md +test -x .pi/skills/reviewer-runtime/pi/run-review.sh || test -x ~/.pi/agent/skills/reviewer-runtime/pi/run-review.sh +test -x .pi/skills/reviewer-runtime/pi/notify-telegram.sh || test -x ~/.pi/agent/skills/reviewer-runtime/pi/notify-telegram.sh +``` + +If you use a settings-defined skill path for Superpowers, confirm it matches [docs/PI-SUPERPOWERS.md](../../../docs/PI-SUPERPOWERS.md) before continuing. + +If you install the reviewer helper in a nonstandard location, confirm it matches [docs/PI-COMMON-REVIEWER.md](../../../docs/PI-COMMON-REVIEWER.md) before continuing. + +If any dependency is missing, stop and return: + +`Missing dependency: pi implement-plan requires the execution skills and reviewer setup documented in docs/PI-SUPERPOWERS.md and docs/PI-COMMON-REVIEWER.md.` + +## Required Workflow Rules + +- Load the relevant workflow skill before entering its phase. If pi did not auto-load it, use `/skill:<name>`. +- Announce skill usage explicitly: + - `I've read the [Skill Name] skill and I'm using it to [purpose].` +- Update `story-tracker.md` before starting and after completing every story. +- Do not use deprecated wrapper CLIs. + +## Process + +### Phase 1: Locate Plan + +1. Scan `ai_plan/` and identify the target plan folder +2. Read `continuation-runbook.md` first +3. Read `story-tracker.md` to identify resume state +4. Read `milestone-plan.md` for the implementation spec + +### Phase 2: Configure Reviewer + +If the user already provided reviewer settings, use them. Otherwise ask: + +Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip` + +1. Which CLI should review milestone implementations? +2. Reviewer model +3. Max rounds, default `10` + +Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. + +If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: + +```bash +pi --version +``` + +For shorthand `pi/<pi-model-name>`, split only on the first slash when the prefix is exactly `pi`; store the complete remainder in `REVIEWER_MODEL`. Examples: `pi/claude-opus-4-7` -> `claude-opus-4-7`, `pi/anthropic/claude-opus-4-7` -> `anthropic/claude-opus-4-7`, and `pi/openrouter/anthropic/claude-opus-4-7` -> `openrouter/anthropic/claude-opus-4-7`. + +When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the pi model running this workflow. Use any configured pi model string, including provider-qualified model IDs. If the reviewer model or provider is unavailable, surface the review helper stderr/status and ask for a configured model; use `pi --list-models [search]` to inspect configured models. + +The pi reviewer command rendered into `/tmp/milestone-review-${REVIEW_ID}.sh` must be isolated and read-only: + +```bash +pi --no-session --no-skills --no-prompt-templates --no-extensions --no-context-files --model "$REVIEWER_MODEL" --tools read,grep,find,ls -p "Read the file /tmp/milestone-${REVIEW_ID}.md and review." +``` + +The pi reviewer invocation must not load workflow skills and must not include `write`, `edit`, or `bash` tools. + +### Phase 3: Set Up Workspace + +1. Load `using-git-worktrees` +2. Create or resume the implementation branch/worktree described by the plan +3. Verify baseline setup and tests before changing code + +### Phase 4: Execute Milestones + +For each milestone: + +1. Mark the next story `in-dev` in `story-tracker.md` +2. Implement the story +3. Mark the story `completed` +4. Continue until the milestone stories are done +5. Load `verification-before-completion` +6. Run lint, typecheck, and tests for the changed scope +7. Send the milestone diff and verification output to the reviewer before committing +8. Commit only after approval + +### Phase 5: Milestone Review Loop + +Skip this phase if `REVIEWER_CLI=skip`. + +#### Step 1: Generate Session ID + +```bash +REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) +``` + +Use these temp artifacts: + +- `/tmp/milestone-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.md` +- `/tmp/milestone-review-${REVIEW_ID}.json` +- `/tmp/milestone-review-${REVIEW_ID}.stderr` +- `/tmp/milestone-review-${REVIEW_ID}.status` +- `/tmp/milestone-review-${REVIEW_ID}.runner.out` +- `/tmp/milestone-review-${REVIEW_ID}.sh` + +Resolve the pi reviewer runtime helper in this order: + +```bash +REVIEWER_RUNTIME="" +for candidate in ".pi/skills/reviewer-runtime/pi/run-review.sh" "$HOME/.pi/agent/skills/reviewer-runtime/pi/run-review.sh"; do + if [ -x "$candidate" ]; then + REVIEWER_RUNTIME="$candidate" + break + fi +done +``` + +#### Step 2: Build Review Payload + +Write the milestone spec, acceptance criteria, diff, and verification output to `/tmp/milestone-${REVIEW_ID}.md`. + +Reviewer responses must use this structure: + +```text +## Summary +... + +## Findings +### P0 +- ... +### P1 +- ... +### P2 +- ... +### P3 +- ... + +## Verdict +VERDICT: APPROVED +``` + +Rules: + +- Order findings from `P0` to `P3` +- Use `- None.` when a severity has no findings +- `VERDICT: APPROVED` is valid only when no `P0`, `P1`, or `P2` findings remain + +#### Step 3: Run Review + +Execute the reviewer command script through the helper when available: + +```bash +"$REVIEWER_RUNTIME" \ + --command-file /tmp/milestone-review-${REVIEW_ID}.sh \ + --stdout-file /tmp/milestone-review-${REVIEW_ID}.runner.out \ + --stderr-file /tmp/milestone-review-${REVIEW_ID}.stderr \ + --status-file /tmp/milestone-review-${REVIEW_ID}.status +``` + +Fallback to direct execution only if the helper is missing. + +#### Step 4: Handle Findings + +- Keep waiting while fresh `state=in-progress note="In progress N"` heartbeats continue +- Fix `P0`, `P1`, and `P2` findings before approval +- Fix cheap `P3` findings when safe +- Re-run verification after each revision + +### Phase 6: Commit And Track Approval + +After milestone approval: + +1. Commit the milestone locally +2. Backfill the commit hash into that milestone's story notes +3. Mark the milestone `approved` in `story-tracker.md` +4. Move to the next milestone + +### Phase 7: Finalization + +After all milestones are approved: + +1. Load `finishing-a-development-branch` +2. Run the full verification suite +3. Ask whether to push or keep the work local +4. Mark the plan completed in `story-tracker.md` + +### Phase 8: Telegram Completion Notification + +Resolve the helper in this order: + +```bash +TELEGRAM_NOTIFY_RUNTIME="" +for candidate in ".pi/skills/reviewer-runtime/pi/notify-telegram.sh" "$HOME/.pi/agent/skills/reviewer-runtime/pi/notify-telegram.sh"; do + if [ -x "$candidate" ]; then + TELEGRAM_NOTIFY_RUNTIME="$candidate" + break + fi +done +``` + +If the helper exists and both `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID` are configured, send a short completion summary. Otherwise state that no Telegram completion notification was sent. diff --git a/skills/implement-plan/claude-code/.generated-manifest.json b/skills/implement-plan/claude-code/.generated-manifest.json new file mode 100644 index 0000000..2df30ff --- /dev/null +++ b/skills/implement-plan/claude-code/.generated-manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/implement-plan/claude-code", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "237d96bf6c8bf9ee4d014cd30607b383839a29d03635e7dd4f44b4804a14d11b" + } + ] +} diff --git a/skills/implement-plan/claude-code/SKILL.md b/skills/implement-plan/claude-code/SKILL.md index 3787a9b..1329776 100644 --- a/skills/implement-plan/claude-code/SKILL.md +++ b/skills/implement-plan/claude-code/SKILL.md @@ -3,6 +3,8 @@ name: implement-plan description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/implement-plan/_source/claude-code/ and run `pnpm run sync:pi`. --> + # Implement Plan (Claude Code) Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. @@ -10,6 +12,7 @@ Execute an existing plan (created by `create-plan`) in an isolated git worktree, ## Prerequisite Check (MANDATORY) Required: + - Plan folder exists under `ai_plan/` at project root - `continuation-runbook.md` exists in plan folder - `milestone-plan.md` exists in plan folder @@ -63,7 +66,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -101,6 +103,7 @@ Mark first story `in-dev` in `story-tracker.md`. #### Step 3: Implement Stories Execute each story in order. After completing each story: + 1. Mark `in-dev` -> `completed` in `story-tracker.md` 2. Update counts 3. Mark next story `in-dev` @@ -135,6 +138,7 @@ git commit -m "feat(<scope>): implement milestone M<N> - <description>" ``` Do NOT push. After committing: + 1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. 2. Mark milestone as `approved` in `story-tracker.md`. 3. Move to next milestone. @@ -150,6 +154,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use `REVIEW_ID` for all milestone review temp file paths: + - `/tmp/milestone-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.json` @@ -226,6 +231,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -248,7 +254,6 @@ Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a ba set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -389,6 +394,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -414,14 +420,14 @@ Fallback is allowed only when the helper is missing or not executable. - `/tmp/milestone-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 4 Step 6 (commit & approve) - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 @@ -438,7 +444,7 @@ Fallback is allowed only when the helper is missing or not executable. Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -449,7 +455,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -559,20 +564,20 @@ After all milestones are approved and committed: git merge implement/<plan-folder-name> ``` -4. Delete the worktree and its branch: +1. Delete the worktree and its branch: ```bash git worktree remove <worktree-path> git branch -d implement/<plan-folder-name> ``` -5. Mark plan status as `completed` in `story-tracker.md`. +1. Mark plan status as `completed` in `story-tracker.md`. ### Phase 7: Final Report Present summary: -``` +```markdown ## Implementation Complete **Plan:** <plan-folder-name> @@ -598,6 +603,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -608,12 +614,14 @@ Rules: **ALWAYS update `story-tracker.md` before/after each story. NEVER proceed with stale tracker state.** Before starting any story: + 1. Open `story-tracker.md` 2. Mark story `in-dev` 3. Add notes if relevant 4. Then begin implementation After completing any story: + 1. Mark story `completed` 2. Review pending stories 3. Update Last Updated and Stories Complete counts diff --git a/skills/implement-plan/codex/.generated-manifest.json b/skills/implement-plan/codex/.generated-manifest.json new file mode 100644 index 0000000..4222241 --- /dev/null +++ b/skills/implement-plan/codex/.generated-manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/implement-plan/codex", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "0e7998dd1161ca305773b572b7c82bceb43e2004dbcb9c817e38e5d974451766" + } + ] +} diff --git a/skills/implement-plan/codex/SKILL.md b/skills/implement-plan/codex/SKILL.md index f4407de..de17cf9 100644 --- a/skills/implement-plan/codex/SKILL.md +++ b/skills/implement-plan/codex/SKILL.md @@ -3,6 +3,8 @@ name: implement-plan description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/implement-plan/_source/codex/ and run `pnpm run sync:pi`. --> + # Implement Plan (Codex Native Superpowers) Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. @@ -10,6 +12,7 @@ Execute an existing plan (created by `create-plan`) in an isolated git worktree, ## Overview This skill wraps the Superpowers execution flow for Codex: + 1. Locate plan files under `ai_plan/` 2. Set up an isolated git worktree 3. Execute milestones one-by-one with lint/typecheck/test gates @@ -21,6 +24,7 @@ This skill wraps the Superpowers execution flow for Codex: ## Prerequisite Check (MANDATORY) Required: + - Plan folder exists under `ai_plan/` at project root - `continuation-runbook.md` exists in plan folder - `milestone-plan.md` exists in plan folder @@ -96,7 +100,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -134,6 +137,7 @@ Mark first story `in-dev` in `story-tracker.md`. #### Step 3: Implement Stories Execute each story in order. After completing each story: + 1. Mark `in-dev` -> `completed` in `story-tracker.md` 2. Update counts 3. Mark next story `in-dev` @@ -168,6 +172,7 @@ git commit -m "feat(<scope>): implement milestone M<N> - <description>" ``` Do NOT push. After committing: + 1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. 2. Mark milestone as `approved` in `story-tracker.md`. 3. Move to next milestone. @@ -183,6 +188,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use `REVIEW_ID` for all milestone review temp file paths: + - `/tmp/milestone-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.json` @@ -259,6 +265,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -281,7 +288,6 @@ Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a ba set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -422,6 +428,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -447,14 +454,14 @@ Fallback is allowed only when the helper is missing or not executable. - `/tmp/milestone-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 4 Step 6 (commit & approve) - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 @@ -471,7 +478,7 @@ Fallback is allowed only when the helper is missing or not executable. Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -482,7 +489,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -592,20 +598,20 @@ After all milestones are approved and committed: git merge implement/<plan-folder-name> ``` -4. Delete the worktree and its branch: +1. Delete the worktree and its branch: ```bash git worktree remove <worktree-path> git branch -d implement/<plan-folder-name> ``` -5. Mark plan status as `completed` in `story-tracker.md`. +1. Mark plan status as `completed` in `story-tracker.md`. ### Phase 7: Final Report Present summary: -``` +```markdown ## Implementation Complete **Plan:** <plan-folder-name> @@ -631,6 +637,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -654,12 +661,14 @@ Rules: **ALWAYS update `story-tracker.md` before/after each story. NEVER proceed with stale tracker state.** Before starting any story: + 1. Open `story-tracker.md` 2. Mark story `in-dev` 3. Add notes if relevant 4. Then begin implementation After completing any story: + 1. Mark story `completed` 2. Review pending stories 3. Update Last Updated and Stories Complete counts diff --git a/skills/implement-plan/cursor/.generated-manifest.json b/skills/implement-plan/cursor/.generated-manifest.json new file mode 100644 index 0000000..01606ae --- /dev/null +++ b/skills/implement-plan/cursor/.generated-manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/implement-plan/cursor", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "8d4e198ccc3ade97ed968b04e07282e9fae56150407bb06e9ee87963f3051cb4" + } + ] +} diff --git a/skills/implement-plan/cursor/SKILL.md b/skills/implement-plan/cursor/SKILL.md index 7803d45..270cc71 100644 --- a/skills/implement-plan/cursor/SKILL.md +++ b/skills/implement-plan/cursor/SKILL.md @@ -3,6 +3,8 @@ name: implement-plan description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review in Cursor Agent CLI workflows. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/implement-plan/_source/cursor/ and run `pnpm run sync:pi`. --> + # Implement Plan (Cursor Agent CLI) Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. @@ -10,6 +12,7 @@ Execute an existing plan (created by `create-plan`) in an isolated git worktree, ## Overview This skill wraps the Superpowers execution flow for the Cursor Agent CLI (`cursor-agent`): + 1. Locate plan files under `ai_plan/` 2. Set up an isolated git worktree 3. Execute milestones one-by-one with lint/typecheck/test gates @@ -21,6 +24,7 @@ This skill wraps the Superpowers execution flow for the Cursor Agent CLI (`curso ## Prerequisite Check (MANDATORY) Required: + - Cursor Agent CLI: `cursor-agent --version` (install via `curl https://cursor.com/install -fsS | bash`). The binary is `cursor-agent` (installed to `~/.local/bin/`). Some environments alias it as `cursor agent` (subcommand of the Cursor IDE CLI) — both forms work, but this skill uses `cursor-agent` throughout. - `jq` (required only if using `cursor` as the reviewer CLI): `jq --version` (install via `brew install jq` or your package manager) - Plan folder exists under `ai_plan/` at project root @@ -96,7 +100,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -134,6 +137,7 @@ Mark first story `in-dev` in `story-tracker.md`. #### Step 3: Implement Stories Execute each story in order. After completing each story: + 1. Mark `in-dev` -> `completed` in `story-tracker.md` 2. Update counts 3. Mark next story `in-dev` @@ -168,6 +172,7 @@ git commit -m "feat(<scope>): implement milestone M<N> - <description>" ``` Do NOT push. After committing: + 1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. 2. Mark milestone as `approved` in `story-tracker.md`. 3. Move to next milestone. @@ -183,6 +188,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use `REVIEW_ID` for all milestone review temp file paths: + - `/tmp/milestone-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.json` @@ -263,6 +269,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -285,7 +292,6 @@ Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a ba set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -408,6 +414,7 @@ Rules: For `cursor`, the command script writes raw JSON to `/tmp/milestone-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. Notes on Cursor flags: + - `--mode=ask` — read-only mode, no file modifications - `--trust` — trust workspace without prompting (required for non-interactive use) - `-p` / `--print` — non-interactive mode, output to stdout @@ -432,6 +439,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -457,14 +465,14 @@ Fallback is allowed only when the helper is missing or not executable. - `/tmp/milestone-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 4 Step 6 (commit & approve) - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 @@ -481,7 +489,7 @@ Fallback is allowed only when the helper is missing or not executable. Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -492,7 +500,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -602,20 +609,20 @@ After all milestones are approved and committed: git merge implement/<plan-folder-name> ``` -4. Delete the worktree and its branch: +1. Delete the worktree and its branch: ```bash git worktree remove <worktree-path> git branch -d implement/<plan-folder-name> ``` -5. Mark plan status as `completed` in `story-tracker.md`. +1. Mark plan status as `completed` in `story-tracker.md`. ### Phase 7: Final Report Present summary: -``` +```markdown ## Implementation Complete **Plan:** <plan-folder-name> @@ -645,6 +652,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -666,12 +674,14 @@ Rules: ## Tracker Discipline (MANDATORY) Before starting any story: + 1. Open `story-tracker.md` 2. Mark story `in-dev` 3. Add notes if relevant 4. Then begin implementation After completing any story: + 1. Mark story `completed` 2. Review pending stories 3. Update Last Updated and Stories Complete counts diff --git a/skills/implement-plan/opencode/.generated-manifest.json b/skills/implement-plan/opencode/.generated-manifest.json new file mode 100644 index 0000000..64fef23 --- /dev/null +++ b/skills/implement-plan/opencode/.generated-manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/implement-plan/opencode", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "ec84e639b79117fd0dc6ceb30329e6e618e2c545271be51ec35335a0a0681758" + } + ] +} diff --git a/skills/implement-plan/opencode/SKILL.md b/skills/implement-plan/opencode/SKILL.md index 442026c..235583e 100644 --- a/skills/implement-plan/opencode/SKILL.md +++ b/skills/implement-plan/opencode/SKILL.md @@ -3,6 +3,8 @@ name: implement-plan description: Use when a plan folder (from create-plan) exists and needs to be executed in an isolated git worktree with iterative cross-model milestone review in OpenCode workflows. ALWAYS invoke when user says "implement the plan", "execute the plan", "start implementation", "resume the plan", or similar execution requests. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/implement-plan/_source/opencode/ and run `pnpm run sync:pi`. --> + # Implement Plan (OpenCode) Execute an existing plan (created by `create-plan`) in an isolated git worktree, with iterative cross-model review at each milestone boundary. @@ -12,6 +14,7 @@ Execute an existing plan (created by `create-plan`) in an isolated git worktree, This OpenCode variant depends on Superpowers execution skills being installed via OpenCode's native skill system. Required: + - Plan folder exists under `ai_plan/` at project root - `continuation-runbook.md` exists in plan folder - `milestone-plan.md` exists in plan folder @@ -46,6 +49,7 @@ If no plan folder exists: ### Phase 1: Bootstrap Superpowers Context (REQUIRED) Use OpenCode's native skill tool: + - list skills - verify `superpowers/executing-plans`, `superpowers/using-git-worktrees`, `superpowers/verification-before-completion`, and `superpowers/finishing-a-development-branch` are discoverable @@ -81,7 +85,6 @@ Store `REVIEWER_CLI`, `REVIEWER_MODEL`, and `MAX_ROUNDS`. These values are fixed Reviewer CLI: `codex`, `claude`, `cursor`, `opencode`, `pi`, or `skip`. - If `REVIEWER_CLI=pi`, verify the Pi reviewer binary before entering the review loop: ```bash @@ -95,9 +98,11 @@ When `REVIEWER_CLI=pi`, the reviewer model is configured independently from the ### Phase 4: Set Up Worktree (REQUIRED SUB-SKILL) Use OpenCode's native skill tool to load: + - `superpowers/using-git-worktrees` Then: + 1. Branch naming: `implement/<plan-folder-name>` (e.g., `implement/2026-03-04-auth-system`). 2. Follow worktree skill's directory priority: `.worktrees/` > `worktrees/` > CLAUDE.md > ask user. 3. Verify `.gitignore` covers worktree directory. @@ -121,6 +126,7 @@ Mark first story `in-dev` in `story-tracker.md`. #### Step 3: Implement Stories Execute each story in order. After completing each story: + 1. Mark `in-dev` -> `completed` in `story-tracker.md` 2. Update counts 3. Mark next story `in-dev` @@ -130,6 +136,7 @@ Commit hashes are not available yet — they are backfilled in Step 6 after the #### Step 4: Verify Milestone (REQUIRED SUB-SKILL) Use OpenCode's native skill tool to load: + - `superpowers/verification-before-completion` ```bash @@ -156,6 +163,7 @@ git commit -m "feat(<scope>): implement milestone M<N> - <description>" ``` Do NOT push. After committing: + 1. Backfill the commit hash into the Notes column for all stories in this milestone in `story-tracker.md`. 2. Mark milestone as `approved` in `story-tracker.md`. 3. Move to next milestone. @@ -171,6 +179,7 @@ REVIEW_ID=$(uuidgen | tr '[:upper:]' '[:lower:]' | head -c 8) ``` Use `REVIEW_ID` for all milestone review temp file paths: + - `/tmp/milestone-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.md` - `/tmp/milestone-review-${REVIEW_ID}.json` @@ -196,6 +205,9 @@ case "$REVIEWER_CLI" in cursor) HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.json) ;; + opencode) + HELPER_SUCCESS_FILE_ARGS+=(--success-file /tmp/milestone-review-${REVIEW_ID}.md) + ;; esac ``` @@ -247,6 +259,7 @@ VERDICT: APPROVED ``` Rules: + - Order findings from `P0` to `P3`. - `P0` = total blocker, `P1` = major risk, `P2` = must-fix before approval, `P3` = cosmetic / nice to have. - Use `- None.` when a severity has no findings. @@ -269,7 +282,6 @@ Write the reviewer invocation to `/tmp/milestone-review-${REVIEW_ID}.sh` as a ba set -euo pipefail ``` - **If `REVIEWER_CLI` is `pi`:** Fresh call every round (Pi reviewer calls do not use session resume): @@ -391,6 +403,77 @@ Rules: For `cursor`, the command script writes raw JSON to `/tmp/milestone-review-${REVIEW_ID}.json`. Do not run `jq` extraction until after the helper or fallback execution completes. If `jq` is not installed, inform the user: `brew install jq` (macOS) or equivalent. +**If `REVIEWER_CLI` is `opencode`:** + +OpenCode uses `--agent plan` for read-oriented review. Fresh call is the recommended default. + +Round 1: + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "Read the file /tmp/milestone-${REVIEW_ID}.md and review this milestone implementation. + +Evaluate: +1. Correctness — Does the implementation match the milestone spec? +2. Acceptance criteria — Are all criteria met? +3. Code quality — Clean, maintainable, no obvious issues? +4. Test coverage — Are changes adequately tested? +5. Security — Any security concerns introduced? + +Return exactly these sections in order: +## Summary +## Findings +### P0 +### P1 +### P2 +### P3 +## Verdict + +Rules: +- Order findings from highest severity to lowest. +- Use \`- None.\` when a severity has no findings. +- \`P0\` = total blocker, \`P1\` = major risk, \`P2\` = must-fix before approval, \`P3\` = cosmetic / nice to have. +- End with exactly one verdict line: \`VERDICT: APPROVED\` or \`VERDICT: REVISE\` +- \`VERDICT: APPROVED\` is allowed only when there are no \`P0\`, \`P1\`, or \`P2\` findings. \`P3\` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +Round 2 and later (fresh-call, recommended default): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this milestone and requested revisions. + +Previous feedback summary: [key points from last review] + +I've revised. Updated milestone payload is in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same ## Summary, ## Findings, and ## Verdict structure as before." \ + > /tmp/milestone-review-${REVIEW_ID}.json +``` + +Extract the review body: + +```bash +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/milestone-review-${REVIEW_ID}.json \ + > /tmp/milestone-review-${REVIEW_ID}.md \ + || cp /tmp/milestone-review-${REVIEW_ID}.json /tmp/milestone-review-${REVIEW_ID}.md +``` + +If the JSON parse falls through, promote the raw JSON file as the review output. On any opencode +CLI or JSON parsing failure, treat this loop round as `completed-empty-output` and follow the +helper-failure escalation in Step 4. + Run the command script through the shared helper when available: ```bash @@ -410,6 +493,7 @@ fi Run the helper in the foreground and watch its live stdout for `state=in-progress` heartbeats. If your agent environment buffers command output until exit, start the helper in the background and poll `/tmp/milestone-review-${REVIEW_ID}.status` separately instead of treating heartbeats as post-hoc-only data. After the command completes: + - If `REVIEWER_CLI=cursor`, extract the final review text: ```bash @@ -418,6 +502,7 @@ jq -r '.result' /tmp/milestone-review-${REVIEW_ID}.json > /tmp/milestone-review- ``` - If `REVIEWER_CLI=codex`, extract `CODEX_SESSION_ID` from `/tmp/milestone-review-${REVIEW_ID}.runner.out` after the helper or fallback run. If the review text is only in `.runner.out`, move or copy the actual review body into `/tmp/milestone-review-${REVIEW_ID}.md` before verdict parsing. +- If `REVIEWER_CLI=opencode`, the `jq` extraction above covers output capture. If it falls through, copy runner output: `cp /tmp/milestone-review-${REVIEW_ID}.runner.out /tmp/milestone-review-${REVIEW_ID}.md`. On Round 1, also attempt to capture the session id for optional use in subsequent rounds: `OPENCODE_SESSION_ID=$(jq -r 'if type == "array" then (.[0] | (.id? // .session_id?)) else (.id? // .session_id?) end // empty' /tmp/milestone-review-${REVIEW_ID}.json 2>/dev/null || true)` - If `REVIEWER_CLI=claude` or `REVIEWER_CLI=pi`, promote stdout captured by the helper or fallback runner into the markdown review file: ```bash @@ -435,14 +520,14 @@ Fallback is allowed only when the helper is missing or not executable. - `/tmp/milestone-review-${REVIEW_ID}.runner.out` 3. Present review to the user: -``` +```markdown ## Milestone Review — Round N (reviewer: ${REVIEWER_CLI} / ${REVIEWER_MODEL}) [Reviewer feedback] ``` -4. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. -5. Check verdict: +1. While the reviewer is still running, keep waiting as long as fresh `state=in-progress note="In progress N"` heartbeats continue to appear roughly once per minute. +2. Check verdict: - **VERDICT: APPROVED** with no `P0`, `P1`, or `P2` findings -> proceed to Phase 5 Step 6 (commit & approve) - **VERDICT: APPROVED** with only `P3` findings -> optionally fix the `P3` items if they are cheap and safe, then proceed - **VERDICT: REVISE** or any `P0`, `P1`, or `P2` finding -> go to Step 5 @@ -459,7 +544,7 @@ Fallback is allowed only when the helper is missing or not executable. Summarize revisions for the user: -``` +```markdown ### Revisions (Round N) - [Change and reason, one bullet per issue addressed] ``` @@ -470,7 +555,6 @@ If a revision contradicts the user's explicit requirements, skip it and note it Rewrite `/tmp/milestone-review-${REVIEW_ID}.sh` for the next round. The script should contain the reviewer invocation only; do not run it directly. - **If `REVIEWER_CLI` is `pi`:** Fresh call with prior-round context (Pi reviewer calls do not use session resume): @@ -546,6 +630,59 @@ Keep findings ordered `P0` to `P3`, use `- None.` when a severity has no finding If resume fails, fall back to fresh `cursor-agent -p` with context about prior rounds. +**If `REVIEWER_CLI` is `opencode`:** + +Fresh call (recommended default — opencode has no guaranteed stable session ID in headless mode): + +```bash +opencode run \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "You previously reviewed this milestone and requested revisions. + +Previous feedback summary: [key points from last review] + +I've addressed your feedback. Updated milestone payload is in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/milestone-review-${REVIEW_ID}.json \ + > /tmp/milestone-review-${REVIEW_ID}.md \ + || cp /tmp/milestone-review-${REVIEW_ID}.json /tmp/milestone-review-${REVIEW_ID}.md +``` + +Optional session-resume path (only if `OPENCODE_SESSION_ID` was captured on Round 1 and your installed opencode accepts `-s <id>` reliably in headless mode): + +```bash +opencode run \ + -s ${OPENCODE_SESSION_ID} \ + -m ${REVIEWER_MODEL} \ + --agent plan \ + --format json \ + "I've addressed your feedback on this milestone. Updated diff and verification output are in /tmp/milestone-${REVIEW_ID}.md. + +Changes made: +[List specific changes] + +Re-review using the same \`## Summary\`, \`## Findings\`, and \`## Verdict\` structure as before. +Keep findings ordered \`P0\` to \`P3\`, use \`- None.\` when a severity has no findings, and only use \`VERDICT: APPROVED\` when no \`P0\`, \`P1\`, or \`P2\` findings remain. \`P3\` findings are non-blocking." \ + > /tmp/milestone-review-${REVIEW_ID}.json + +jq -r '.[] | select(.type == "message" and .role == "assistant") | .content' \ + /tmp/milestone-review-${REVIEW_ID}.json \ + > /tmp/milestone-review-${REVIEW_ID}.md \ + || cp /tmp/milestone-review-${REVIEW_ID}.json /tmp/milestone-review-${REVIEW_ID}.md +``` + +If session resume fails (session expired or not supported), fall back to the fresh-call path above. + Do not run `jq` extraction until after the helper or fallback execution completes, then extract `/tmp/milestone-review-${REVIEW_ID}.md` from the JSON response. After updating `/tmp/milestone-review-${REVIEW_ID}.sh`, run the same helper/fallback flow from Round 1. @@ -580,20 +717,20 @@ After all milestones are approved and committed: git merge implement/<plan-folder-name> ``` -4. Delete the worktree and its branch: +1. Delete the worktree and its branch: ```bash git worktree remove <worktree-path> git branch -d implement/<plan-folder-name> ``` -5. Mark plan status as `completed` in `story-tracker.md`. +1. Mark plan status as `completed` in `story-tracker.md`. ### Phase 8: Final Report Present summary: -``` +```markdown ## Implementation Complete **Plan:** <plan-folder-name> @@ -619,6 +756,7 @@ fi ``` Rules: + - Telegram is the only supported notification path. Do not use desktop notifications, `say`, email, or any other notifier. - Notification failures are non-blocking, but they must be surfaced to the user. - Before stopping for any user interaction, approval, or manual decision, send a Telegram summary first if configured. @@ -627,12 +765,14 @@ Rules: ## Tracker Discipline (MANDATORY) Before starting any story: + 1. Open `story-tracker.md` 2. Mark story `in-dev` 3. Add notes if relevant 4. Then begin implementation After completing any story: + 1. Mark story `completed` 2. Review pending stories 3. Update Last Updated and Stories Complete counts diff --git a/skills/implement-plan/pi/.generated-manifest.json b/skills/implement-plan/pi/.generated-manifest.json new file mode 100644 index 0000000..31f014b --- /dev/null +++ b/skills/implement-plan/pi/.generated-manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/implement-plan/pi", + "files": [ + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "578e5b4fbc443ade486e4aa034b0875ebfa7eefd3a1268852ac1c5cbf71f28bf" + } + ] +} diff --git a/skills/implement-plan/pi/SKILL.md b/skills/implement-plan/pi/SKILL.md index eb4e77b..f458dff 100644 --- a/skills/implement-plan/pi/SKILL.md +++ b/skills/implement-plan/pi/SKILL.md @@ -3,6 +3,8 @@ name: implement-plan description: Use when a plan folder created by create-plan must be executed in pi with milestone verification, reviewer gates, local commits, and resumable tracker updates. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/implement-plan/_source/pi/ and run `pnpm run sync:pi`. --> + # Implement Plan (Pi) Execute an existing plan under `ai_plan/` milestone by milestone, using verification gates, reviewer approval, and local commits after each approved milestone. diff --git a/skills/reviewer-runtime/pi/.generated-manifest.json b/skills/reviewer-runtime/pi/.generated-manifest.json new file mode 100644 index 0000000..cb54e6f --- /dev/null +++ b/skills/reviewer-runtime/pi/.generated-manifest.json @@ -0,0 +1,19 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/reviewer-runtime/pi", + "files": [ + { + "path": "notify-telegram.sh", + "kind": "file", + "mode": "755", + "sha256": "d7e52e3d2f7de83691470467ff3fec230bea10f128d5b188604e1bb5883d6d58" + }, + { + "path": "run-review.sh", + "kind": "file", + "mode": "755", + "sha256": "1af5076f0e4451c0870109216ee5780553ef7d402ec1359f38afefdaf53627c1" + } + ] +} diff --git a/skills/reviewer-runtime/pi/notify-telegram.sh b/skills/reviewer-runtime/pi/notify-telegram.sh index d62931c..91377ec 100755 --- a/skills/reviewer-runtime/pi/notify-telegram.sh +++ b/skills/reviewer-runtime/pi/notify-telegram.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash +# ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/reviewer-runtime/notify-telegram.sh and run `pnpm run sync:pi`. set -euo pipefail -# Keep this file in sync with skills/reviewer-runtime/notify-telegram.sh. - DEFAULT_API_BASE_URL="https://api.telegram.org" DEFAULT_PARSE_MODE="HTML" MAX_MESSAGE_LENGTH=4096 diff --git a/skills/reviewer-runtime/pi/run-review.sh b/skills/reviewer-runtime/pi/run-review.sh index 4476a92..27a88cb 100755 --- a/skills/reviewer-runtime/pi/run-review.sh +++ b/skills/reviewer-runtime/pi/run-review.sh @@ -1,8 +1,7 @@ #!/usr/bin/env bash +# ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/reviewer-runtime/run-review.sh and run `pnpm run sync:pi`. set -euo pipefail -# Keep this file in sync with skills/reviewer-runtime/run-review.sh. - DEFAULT_POLL_SECONDS=10 DEFAULT_HEARTBEAT_SECONDS=60 DEFAULT_SOFT_TIMEOUT_SECONDS=600 @@ -146,6 +145,7 @@ kill_child_process_group() { fi } +# shellcheck disable=SC2317,SC2329 handle_signal() { local signal_name=$1 INTERRUPTED=1 @@ -265,7 +265,6 @@ main() { local last_output_change_time=$START_TIME local last_heartbeat_time=$START_TIME local soft_timeout_logged=0 - local stall_warning_logged=0 local heartbeat_count=0 while kill -0 "$CHILD_PID" 2>/dev/null; do @@ -285,7 +284,6 @@ main() { if [[ "$stdout_bytes" -ne "$last_stdout_bytes" || "$stderr_bytes" -ne "$last_stderr_bytes" ]]; then last_output_change_time=$now - stall_warning_logged=0 state=running-active level=info note="reviewer output changed" @@ -296,7 +294,6 @@ main() { state=stall-warning level=warn note="no output growth for ${silent_for}s; process still alive" - stall_warning_logged=1 else state=running-silent level=info @@ -328,10 +325,9 @@ main() { set -e trap - EXIT - local final_stdout_bytes final_stderr_bytes + local final_stdout_bytes local success_file success_bytes final_stdout_bytes=$(file_bytes "$STDOUT_FILE") - final_stderr_bytes=$(file_bytes "$STDERR_FILE") if [[ "$child_exit_code" -eq 0 ]]; then if [[ "$final_stdout_bytes" -gt 0 ]]; then diff --git a/skills/reviewer-runtime/run-review.sh b/skills/reviewer-runtime/run-review.sh index bc6e3a1..8bdafc6 100755 --- a/skills/reviewer-runtime/run-review.sh +++ b/skills/reviewer-runtime/run-review.sh @@ -144,6 +144,7 @@ kill_child_process_group() { fi } +# shellcheck disable=SC2317,SC2329 handle_signal() { local signal_name=$1 INTERRUPTED=1 @@ -263,7 +264,6 @@ main() { local last_output_change_time=$START_TIME local last_heartbeat_time=$START_TIME local soft_timeout_logged=0 - local stall_warning_logged=0 local heartbeat_count=0 while kill -0 "$CHILD_PID" 2>/dev/null; do @@ -283,7 +283,6 @@ main() { if [[ "$stdout_bytes" -ne "$last_stdout_bytes" || "$stderr_bytes" -ne "$last_stderr_bytes" ]]; then last_output_change_time=$now - stall_warning_logged=0 state=running-active level=info note="reviewer output changed" @@ -294,7 +293,6 @@ main() { state=stall-warning level=warn note="no output growth for ${silent_for}s; process still alive" - stall_warning_logged=1 else state=running-silent level=info @@ -326,10 +324,9 @@ main() { set -e trap - EXIT - local final_stdout_bytes final_stderr_bytes + local final_stdout_bytes local success_file success_bytes final_stdout_bytes=$(file_bytes "$STDOUT_FILE") - final_stderr_bytes=$(file_bytes "$STDERR_FILE") if [[ "$child_exit_code" -eq 0 ]]; then if [[ "$final_stdout_bytes" -gt 0 ]]; then diff --git a/skills/reviewer-runtime/tests/claude-review-template-guard.sh b/skills/reviewer-runtime/tests/claude-review-template-guard.sh index 45a42de..e4a7dd2 100755 --- a/skills/reviewer-runtime/tests/claude-review-template-guard.sh +++ b/skills/reviewer-runtime/tests/claude-review-template-guard.sh @@ -31,6 +31,7 @@ check_skill_file() { local file=$1 assert_contains "$file" "claude -p \\" + # shellcheck disable=SC2016 assert_contains "$file" '$(cat /tmp/' assert_contains "$file" "--strict-mcp-config" assert_contains "$file" "--setting-sources user" diff --git a/skills/reviewer-runtime/tests/smoke-test.sh b/skills/reviewer-runtime/tests/smoke-test.sh index 5597396..993a678 100755 --- a/skills/reviewer-runtime/tests/smoke-test.sh +++ b/skills/reviewer-runtime/tests/smoke-test.sh @@ -328,7 +328,9 @@ main() { local tmp_dir tmp_dir=$(mktemp -d) - trap "rm -rf '$tmp_dir'" EXIT + # Use SMOKE_TMP as a module-level var so the single-quoted trap expands lazily + SMOKE_TMP="$tmp_dir" + trap 'rm -rf "$SMOKE_TMP"' EXIT test_delayed_success "$tmp_dir" test_soft_timeout_continues "$tmp_dir" diff --git a/skills/reviewer-runtime/tests/telegram-notify-test.sh b/skills/reviewer-runtime/tests/telegram-notify-test.sh index d48341d..1b0f51d 100755 --- a/skills/reviewer-runtime/tests/telegram-notify-test.sh +++ b/skills/reviewer-runtime/tests/telegram-notify-test.sh @@ -144,7 +144,9 @@ main() { local tmp_dir tmp_dir=$(mktemp -d) - trap "rm -rf '$tmp_dir'" EXIT + # Use TG_TEST_TMP as a module-level var so the single-quoted trap expands lazily + TG_TEST_TMP="$tmp_dir" + trap 'rm -rf "$TG_TEST_TMP"' EXIT test_missing_credentials "$tmp_dir" test_rejects_message_and_message_file_together "$tmp_dir" diff --git a/skills/web-automation/_source/claude-code/SKILL.md b/skills/web-automation/_source/claude-code/SKILL.md new file mode 100644 index 0000000..86b6764 --- /dev/null +++ b/skills/web-automation/_source/claude-code/SKILL.md @@ -0,0 +1,99 @@ +--- +name: web-automation +description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. +--- + +# Web Automation with CloakBrowser (Claude Code) + +Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: + +- one-shot extraction via `extract.js` +- broader stateful automation via `auth.ts`, `browse.ts`, `flow.ts`, `scan-local-app.ts`, and `scrape.ts` + +## Requirements + +- Node.js 20+ +- pnpm +- Network access to download the CloakBrowser binary on first use + +## First-Time Setup + +```bash +cd ~/.claude/skills/web-automation/scripts +pnpm install +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Updating CloakBrowser + +```bash +cd ~/.claude/skills/web-automation/scripts +pnpm up cloakbrowser playwright-core +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Prerequisite Check (MANDATORY) + +Before running automation, verify CloakBrowser and Playwright Core are installed and wired correctly. + +```bash +cd ~/.claude/skills/web-automation/scripts +node check-install.js +``` + +If the check fails, stop and return: + +"Missing dependency/config: web-automation requires `cloakbrowser` and `playwright-core` with CloakBrowser-based scripts. Run setup in this skill, then retry." + +If runtime fails with missing native bindings for `better-sqlite3` or `esbuild`, run: + +```bash +cd ~/.claude/skills/web-automation/scripts +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## When To Use Which Command + +- Use `node extract.js "<URL>"` for a one-shot rendered fetch with JSON output. +- Use `npx tsx scrape.ts ...` when you need markdown extraction, Readability cleanup, or selector-based scraping. +- Use `npx tsx browse.ts ...`, `auth.ts`, or `flow.ts` when the task needs login handling, persistent sessions, clicks, typing, screenshots, or multi-step navigation. +- Use `npx tsx scan-local-app.ts` when you need a configurable local-app smoke pass driven by `SCAN_*` and `CLOAKBROWSER_*` environment variables. + +## Quick Reference + +- Install check: `node check-install.js` +- One-shot JSON extract: `node extract.js "https://example.com"` +- Browse page: `npx tsx browse.ts --url "https://example.com"` +- Scrape markdown: `npx tsx scrape.ts --url "https://example.com" --mode main --output page.md` +- Authenticate: `npx tsx auth.ts --url "https://example.com/login"` +- Natural-language flow: `npx tsx flow.ts --instruction 'go to https://example.com then click on "Login" then type "user@example.com" in #email then press enter'` +- Local app smoke scan: `SCAN_BASE_URL=http://localhost:3000 SCAN_ROUTES=/,/dashboard npx tsx scan-local-app.ts` + +## Local App Smoke Scan + +`scan-local-app.ts` is intentionally generic. Configure it with environment variables instead of editing the file: + +- `SCAN_BASE_URL` +- `SCAN_LOGIN_PATH` +- `SCAN_USERNAME` +- `SCAN_PASSWORD` +- `SCAN_USERNAME_SELECTOR` +- `SCAN_PASSWORD_SELECTOR` +- `SCAN_SUBMIT_SELECTOR` +- `SCAN_ROUTES` +- `SCAN_REPORT_PATH` +- `SCAN_HEADLESS` + +If `SCAN_USERNAME` or `SCAN_PASSWORD` are omitted, the script falls back to `CLOAKBROWSER_USERNAME` and `CLOAKBROWSER_PASSWORD`. + +## Notes + +- Sessions persist in CloakBrowser profile storage. +- Use `--wait` for dynamic pages. +- Use `--mode selector --selector "..."` for targeted extraction. +- `extract.js` keeps a bounded stealth/rendered fetch path without needing a long-lived automation session. diff --git a/skills/web-automation/_source/codex/SKILL.md b/skills/web-automation/_source/codex/SKILL.md new file mode 100644 index 0000000..86876af --- /dev/null +++ b/skills/web-automation/_source/codex/SKILL.md @@ -0,0 +1,99 @@ +--- +name: web-automation +description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. +--- + +# Web Automation with CloakBrowser (Codex) + +Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: + +- one-shot extraction via `extract.js` +- broader stateful automation via `auth.ts`, `browse.ts`, `flow.ts`, `scan-local-app.ts`, and `scrape.ts` + +## Requirements + +- Node.js 20+ +- pnpm +- Network access to download the CloakBrowser binary on first use + +## First-Time Setup + +```bash +cd ~/.codex/skills/web-automation/scripts +pnpm install +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Updating CloakBrowser + +```bash +cd ~/.codex/skills/web-automation/scripts +pnpm up cloakbrowser playwright-core +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Prerequisite Check (MANDATORY) + +Before running automation, verify CloakBrowser and Playwright Core are installed and wired correctly. + +```bash +cd ~/.codex/skills/web-automation/scripts +node check-install.js +``` + +If the check fails, stop and return: + +"Missing dependency/config: web-automation requires `cloakbrowser` and `playwright-core` with CloakBrowser-based scripts. Run setup in this skill, then retry." + +If runtime fails with missing native bindings for `better-sqlite3` or `esbuild`, run: + +```bash +cd ~/.codex/skills/web-automation/scripts +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## When To Use Which Command + +- Use `node extract.js "<URL>"` for a one-shot rendered fetch with JSON output. +- Use `npx tsx scrape.ts ...` when you need markdown extraction, Readability cleanup, or selector-based scraping. +- Use `npx tsx browse.ts ...`, `auth.ts`, or `flow.ts` when the task needs login handling, persistent sessions, clicks, typing, screenshots, or multi-step navigation. +- Use `npx tsx scan-local-app.ts` when you need a configurable local-app smoke pass driven by `SCAN_*` and `CLOAKBROWSER_*` environment variables. + +## Quick Reference + +- Install check: `node check-install.js` +- One-shot JSON extract: `node extract.js "https://example.com"` +- Browse page: `npx tsx browse.ts --url "https://example.com"` +- Scrape markdown: `npx tsx scrape.ts --url "https://example.com" --mode main --output page.md` +- Authenticate: `npx tsx auth.ts --url "https://example.com/login"` +- Natural-language flow: `npx tsx flow.ts --instruction 'go to https://example.com then click on "Login" then type "user@example.com" in #email then press enter'` +- Local app smoke scan: `SCAN_BASE_URL=http://localhost:3000 SCAN_ROUTES=/,/dashboard npx tsx scan-local-app.ts` + +## Local App Smoke Scan + +`scan-local-app.ts` is intentionally generic. Configure it with environment variables instead of editing the file: + +- `SCAN_BASE_URL` +- `SCAN_LOGIN_PATH` +- `SCAN_USERNAME` +- `SCAN_PASSWORD` +- `SCAN_USERNAME_SELECTOR` +- `SCAN_PASSWORD_SELECTOR` +- `SCAN_SUBMIT_SELECTOR` +- `SCAN_ROUTES` +- `SCAN_REPORT_PATH` +- `SCAN_HEADLESS` + +If `SCAN_USERNAME` or `SCAN_PASSWORD` are omitted, the script falls back to `CLOAKBROWSER_USERNAME` and `CLOAKBROWSER_PASSWORD`. + +## Notes + +- Sessions persist in CloakBrowser profile storage. +- Use `--wait` for dynamic pages. +- Use `--mode selector --selector "..."` for targeted extraction. +- `extract.js` keeps a bounded stealth/rendered fetch path without needing a long-lived automation session. diff --git a/skills/web-automation/_source/cursor/SKILL.md b/skills/web-automation/_source/cursor/SKILL.md new file mode 100644 index 0000000..adeef60 --- /dev/null +++ b/skills/web-automation/_source/cursor/SKILL.md @@ -0,0 +1,112 @@ +--- +name: web-automation +description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. +--- + +# Web Automation with CloakBrowser (Cursor) + +Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: + +- one-shot extraction via `extract.js` +- broader stateful automation via `auth.ts`, `browse.ts`, `flow.ts`, `scan-local-app.ts`, and `scrape.ts` + +## Requirements + +- Node.js 20+ +- pnpm +- Network access to download the CloakBrowser binary on first use + +## First-Time Setup + +Repo-local install: + +```bash +cd .cursor/skills/web-automation/scripts +pnpm install +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +Global install: + +```bash +cd ~/.cursor/skills/web-automation/scripts +pnpm install +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Updating CloakBrowser + +Run from the installed `scripts/` directory: + +```bash +pnpm up cloakbrowser playwright-core +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Prerequisite Check (MANDATORY) + +Before running automation, verify CloakBrowser and Playwright Core are installed and wired correctly. + +```bash +cd .cursor/skills/web-automation/scripts || cd ~/.cursor/skills/web-automation/scripts +node check-install.js +``` + +If the check fails, stop and return: + +"Missing dependency/config: web-automation requires `cloakbrowser` and `playwright-core` with CloakBrowser-based scripts. Run setup in this skill, then retry." + +If runtime fails with missing native bindings for `better-sqlite3` or `esbuild`, run: + +```bash +cd .cursor/skills/web-automation/scripts || cd ~/.cursor/skills/web-automation/scripts +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## When To Use Which Command + +- Use `node extract.js "<URL>"` for a one-shot rendered fetch with JSON output. +- Use `npx tsx scrape.ts ...` when you need markdown extraction, Readability cleanup, or selector-based scraping. +- Use `npx tsx browse.ts ...`, `auth.ts`, or `flow.ts` when the task needs login handling, persistent sessions, clicks, typing, screenshots, or multi-step navigation. +- Use `npx tsx scan-local-app.ts` when you need a configurable local-app smoke pass driven by `SCAN_*` and `CLOAKBROWSER_*` environment variables. + +## Quick Reference + +- Install check: `node check-install.js` +- One-shot JSON extract: `node extract.js "https://example.com"` +- Browse page: `npx tsx browse.ts --url "https://example.com"` +- Scrape markdown: `npx tsx scrape.ts --url "https://example.com" --mode main --output page.md` +- Authenticate: `npx tsx auth.ts --url "https://example.com/login"` +- Natural-language flow: `npx tsx flow.ts --instruction 'go to https://example.com then click on "Login" then type "user@example.com" in #email then press enter'` +- Local app smoke scan: `SCAN_BASE_URL=http://localhost:3000 SCAN_ROUTES=/,/dashboard npx tsx scan-local-app.ts` + +## Local App Smoke Scan + +`scan-local-app.ts` is intentionally generic. Configure it with environment variables instead of editing the file: + +- `SCAN_BASE_URL` +- `SCAN_LOGIN_PATH` +- `SCAN_USERNAME` +- `SCAN_PASSWORD` +- `SCAN_USERNAME_SELECTOR` +- `SCAN_PASSWORD_SELECTOR` +- `SCAN_SUBMIT_SELECTOR` +- `SCAN_ROUTES` +- `SCAN_REPORT_PATH` +- `SCAN_HEADLESS` + +If `SCAN_USERNAME` or `SCAN_PASSWORD` are omitted, the script falls back to `CLOAKBROWSER_USERNAME` and `CLOAKBROWSER_PASSWORD`. + +## Notes + +- Sessions persist in CloakBrowser profile storage. +- Use `--wait` for dynamic pages. +- Use `--mode selector --selector "..."` for targeted extraction. +- `extract.js` keeps a bounded stealth/rendered fetch path without needing a long-lived automation session. diff --git a/skills/web-automation/_source/opencode/SKILL.md b/skills/web-automation/_source/opencode/SKILL.md new file mode 100644 index 0000000..01847ad --- /dev/null +++ b/skills/web-automation/_source/opencode/SKILL.md @@ -0,0 +1,99 @@ +--- +name: web-automation +description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. +--- + +# Web Automation with CloakBrowser (OpenCode) + +Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: + +- one-shot extraction via `extract.js` +- broader stateful automation via `auth.ts`, `browse.ts`, `flow.ts`, `scan-local-app.ts`, and `scrape.ts` + +## Requirements + +- Node.js 20+ +- pnpm +- Network access to download the CloakBrowser binary on first use + +## First-Time Setup + +```bash +cd ~/.config/opencode/skills/web-automation/scripts +pnpm install +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Updating CloakBrowser + +```bash +cd ~/.config/opencode/skills/web-automation/scripts +pnpm up cloakbrowser playwright-core +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Prerequisite Check (MANDATORY) + +Before running automation, verify CloakBrowser and Playwright Core are installed and wired correctly. + +```bash +cd ~/.config/opencode/skills/web-automation/scripts +node check-install.js +``` + +If the check fails, stop and return: + +"Missing dependency/config: web-automation requires `cloakbrowser` and `playwright-core` with CloakBrowser-based scripts. Run setup in this skill, then retry." + +If runtime fails with missing native bindings for `better-sqlite3` or `esbuild`, run: + +```bash +cd ~/.config/opencode/skills/web-automation/scripts +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## When To Use Which Command + +- Use `node extract.js "<URL>"` for a one-shot rendered fetch with JSON output. +- Use `npx tsx scrape.ts ...` when you need markdown extraction, Readability cleanup, or selector-based scraping. +- Use `npx tsx browse.ts ...`, `auth.ts`, or `flow.ts` when the task needs login handling, persistent sessions, clicks, typing, screenshots, or multi-step navigation. +- Use `npx tsx scan-local-app.ts` when you need a configurable local-app smoke pass driven by `SCAN_*` and `CLOAKBROWSER_*` environment variables. + +## Quick Reference + +- Install check: `node check-install.js` +- One-shot JSON extract: `node extract.js "https://example.com"` +- Browse page: `npx tsx browse.ts --url "https://example.com"` +- Scrape markdown: `npx tsx scrape.ts --url "https://example.com" --mode main --output page.md` +- Authenticate: `npx tsx auth.ts --url "https://example.com/login"` +- Natural-language flow: `npx tsx flow.ts --instruction 'go to https://example.com then click on "Login" then type "user@example.com" in #email then press enter'` +- Local app smoke scan: `SCAN_BASE_URL=http://localhost:3000 SCAN_ROUTES=/,/dashboard npx tsx scan-local-app.ts` + +## Local App Smoke Scan + +`scan-local-app.ts` is intentionally generic. Configure it with environment variables instead of editing the file: + +- `SCAN_BASE_URL` +- `SCAN_LOGIN_PATH` +- `SCAN_USERNAME` +- `SCAN_PASSWORD` +- `SCAN_USERNAME_SELECTOR` +- `SCAN_PASSWORD_SELECTOR` +- `SCAN_SUBMIT_SELECTOR` +- `SCAN_ROUTES` +- `SCAN_REPORT_PATH` +- `SCAN_HEADLESS` + +If `SCAN_USERNAME` or `SCAN_PASSWORD` are omitted, the script falls back to `CLOAKBROWSER_USERNAME` and `CLOAKBROWSER_PASSWORD`. + +## Notes + +- Sessions persist in CloakBrowser profile storage. +- Use `--wait` for dynamic pages. +- Use `--mode selector --selector "..."` for targeted extraction. +- `extract.js` keeps a bounded stealth/rendered fetch path without needing a long-lived automation session. diff --git a/skills/web-automation/_source/pi/SKILL.md b/skills/web-automation/_source/pi/SKILL.md new file mode 100644 index 0000000..5a021e7 --- /dev/null +++ b/skills/web-automation/_source/pi/SKILL.md @@ -0,0 +1,122 @@ +--- +name: web-automation +description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. +--- + +# Web Automation with CloakBrowser (Pi) + +Automated web browsing and scraping for pi using the shared runtime bundle in `scripts/`. + +## Requirements + +- Node.js 20+ +- `pnpm` +- Network access to download the CloakBrowser binary on first use + +## First-Time Setup + +Global install: + +```bash +mkdir -p ~/.pi/agent/skills/web-automation +cp -R skills/web-automation/pi/* ~/.pi/agent/skills/web-automation/ +cd ~/.pi/agent/skills/web-automation/scripts +pnpm install +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +Project-local install: + +```bash +mkdir -p .pi/skills/web-automation +cp -R skills/web-automation/pi/* .pi/skills/web-automation/ +cd .pi/skills/web-automation/scripts +pnpm install +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +Pi can also load this repo through settings or package installs as documented in [docs/PI.md](../../../docs/PI.md). + +If you installed this repo from a local checkout with `./scripts/install-pi-package.sh`, the runtime stays in the checkout mirror at `pi-package/skills/web-automation/scripts`. + +## Updating CloakBrowser + +Run inside the installed `scripts/` directory for the pi skill. The commands below work for both global and project-local installs as long as you run them from the installed `scripts/` directory. + +```bash +pnpm up cloakbrowser playwright-core +npx cloakbrowser install +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## Prerequisite Check (MANDATORY) + +Before running automation, verify the runtime from the location that matches your install style: + +- local checkout package install: `pi-package/skills/web-automation/scripts` +- project-local copied install: `.pi/skills/web-automation/scripts` +- global copied install: `~/.pi/agent/skills/web-automation/scripts` + +```bash +cd pi-package/skills/web-automation/scripts +node check-install.js +``` + +If the check fails, stop and return: + +`Missing dependency/config: web-automation requires cloakbrowser and playwright-core with CloakBrowser-based scripts. Run setup in this skill, then retry.` + +If runtime fails with missing native bindings for `better-sqlite3` or `esbuild`, run the same commands from your installed `scripts/` directory: + +```bash +cd pi-package/skills/web-automation/scripts +pnpm approve-builds +pnpm rebuild better-sqlite3 esbuild +``` + +## When To Use Which Command + +- Use `node extract.js "<URL>"` for a one-shot rendered fetch with JSON output. +- Use `npx tsx scrape.ts ...` when you need markdown extraction, Readability cleanup, or selector-based scraping. +- Use `npx tsx browse.ts ...`, `auth.ts`, or `flow.ts` when the task needs login handling, persistent sessions, clicks, typing, screenshots, or multi-step navigation. +- Use `npx tsx scan-local-app.ts` when you need a configurable local-app smoke pass driven by `SCAN_*` and `CLOAKBROWSER_*` environment variables. + +## Quick Reference + +- Install check: `node check-install.js` +- One-shot JSON extract: `node extract.js "https://example.com"` +- Browse page: `npx tsx browse.ts --url "https://example.com"` +- Scrape markdown: `npx tsx scrape.ts --url "https://example.com" --mode main --output page.md` +- Authenticate: `npx tsx auth.ts --url "https://example.com/login"` +- Natural-language flow: `npx tsx flow.ts --instruction 'go to https://example.com then click on "Login" then type "user@example.com" in #email then press enter'` +- Local app smoke scan: `SCAN_BASE_URL=http://localhost:3000 SCAN_ROUTES=/,/dashboard npx tsx scan-local-app.ts` + +## Local App Smoke Scan + +`scan-local-app.ts` is intentionally generic. Configure it with environment variables instead of editing the file: + +- `SCAN_BASE_URL` +- `SCAN_LOGIN_PATH` +- `SCAN_USERNAME` +- `SCAN_PASSWORD` +- `SCAN_USERNAME_SELECTOR` +- `SCAN_PASSWORD_SELECTOR` +- `SCAN_SUBMIT_SELECTOR` +- `SCAN_ROUTES` +- `SCAN_REPORT_PATH` +- `SCAN_HEADLESS` + +If `SCAN_USERNAME` or `SCAN_PASSWORD` are omitted, the script falls back to `CLOAKBROWSER_USERNAME` and `CLOAKBROWSER_PASSWORD`. + +## Notes + +- Sessions persist in CloakBrowser profile storage. +- Use `--wait` for dynamic pages. +- Use `--mode selector --selector "..."` for targeted extraction. +- `extract.js` keeps a bounded stealth/rendered fetch path without needing a long-lived automation session. +- Package installs use the repo's `pi-package/skills/web-automation/` mirror so the installed skill directory name matches `web-automation`. diff --git a/skills/web-automation/claude-code/.generated-manifest.json b/skills/web-automation/claude-code/.generated-manifest.json new file mode 100644 index 0000000..f6a9d6e --- /dev/null +++ b/skills/web-automation/claude-code/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/web-automation/claude-code", + "files": [ + { + "path": "scripts/auth.ts", + "kind": "file", + "mode": "644", + "sha256": "c0940f452437b05b95e58a9a7ab265fb50aa412bd672e82fedd6a37cbfb3d505" + }, + { + "path": "scripts/browse.ts", + "kind": "file", + "mode": "644", + "sha256": "d7e4b4c50116032e5a00f90bca27e069dfc5bbf6eeb06ec8f8edc9e5a9792ab8" + }, + { + "path": "scripts/check-install.js", + "kind": "file", + "mode": "644", + "sha256": "e46ee8cbe103794bf1e9c3466bb0fbd21079ceddc60ad9521299e8bc0150e48f" + }, + { + "path": "scripts/extract.js", + "kind": "file", + "mode": "644", + "sha256": "6fa2a0589de8afd6501e332e5fa263e1344187ea43a33590b431cdee59d04217" + }, + { + "path": "scripts/flow.ts", + "kind": "file", + "mode": "644", + "sha256": "94f3e7987cab253dc3c9e80656a11759fada13b3915608bff7ae08418602f366" + }, + { + "path": "scripts/lib/browser.ts", + "kind": "file", + "mode": "644", + "sha256": "879b5f883ff1f888d45ed20be05c2d9bc3d6fe5305a1972b7d49a7e6c0e24934" + }, + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "8fd46cc1ab9f2b45b8f2b658479276a11a3b79710a530aac7148bc396e0edf35" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "17017e15e8b04311f5d53bdd37065b2f5a514a3119f40a0403148440ed181437" + }, + { + "path": "scripts/scan-local-app.ts", + "kind": "file", + "mode": "644", + "sha256": "9e1818c254a633e087715609152936dcb3613a0aa724d40a8a13460510691dc7" + }, + { + "path": "scripts/scrape.ts", + "kind": "file", + "mode": "644", + "sha256": "a1a3d81d57d9e8ab1854ce3cb230bdd39ae1087ec50c9fe82cc58f5f2663ebeb" + }, + { + "path": "scripts/test-full.ts", + "kind": "file", + "mode": "644", + "sha256": "76a647e840753621445c36894bff62e163f6a2e4d0860fa8e64d8df45fe21e08" + }, + { + "path": "scripts/test-minimal.ts", + "kind": "file", + "mode": "644", + "sha256": "59e0b2319d3f7521b2a8a4fca2d779afaa157bf2d160160fdec8cb56bea30b4f" + }, + { + "path": "scripts/test-profile.ts", + "kind": "file", + "mode": "644", + "sha256": "6cf0141581a9275bfa8a070a36212cef5f6417d64df3df3e614ec682008376b9" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "e5f22d72266068cf410976c880511f2ec1875445256e11739a5e1de6ffedf38d" + }, + { + "path": "scripts/turndown-plugin-gfm.d.ts", + "kind": "file", + "mode": "644", + "sha256": "c5001c059b160eff18a4097a8a0a7b96689b4ebc374543c7d5bf6e40b0d8a5ac" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "18fccff0bceba538cac6491a5ff3e7090549aa13885d0ab5c6a73d4e8ca72f01" + } + ] +} diff --git a/skills/web-automation/claude-code/SKILL.md b/skills/web-automation/claude-code/SKILL.md index 86b6764..abe8476 100644 --- a/skills/web-automation/claude-code/SKILL.md +++ b/skills/web-automation/claude-code/SKILL.md @@ -3,6 +3,8 @@ name: web-automation description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/_source/claude-code/SKILL.md and run `pnpm run sync:pi`. --> + # Web Automation with CloakBrowser (Claude Code) Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: diff --git a/skills/web-automation/claude-code/scripts/auth.ts b/skills/web-automation/claude-code/scripts/auth.ts index e79f23d..b06e846 100644 --- a/skills/web-automation/claude-code/scripts/auth.ts +++ b/skills/web-automation/claude-code/scripts/auth.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Authentication handler for web automation @@ -10,7 +11,7 @@ * npx tsx auth.ts --url "https://example.com" --type auto */ -import { getPage, launchBrowser } from './browse.js'; +import { getPage, launchBrowser } from './lib/browser.js'; import parseArgs from 'minimist'; import type { Page, BrowserContext } from 'playwright-core'; import { createInterface } from 'readline'; diff --git a/skills/web-automation/claude-code/scripts/browse.ts b/skills/web-automation/claude-code/scripts/browse.ts index 01cf098..e270db8 100644 --- a/skills/web-automation/claude-code/scripts/browse.ts +++ b/skills/web-automation/claude-code/scripts/browse.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Browser launcher using CloakBrowser with persistent profile @@ -9,12 +10,13 @@ * npx tsx browse.ts --url "https://example.com" --headless false --wait 5000 */ -import { launchPersistentContext } from 'cloakbrowser'; -import { homedir } from 'os'; -import { join } from 'path'; -import { existsSync, mkdirSync } from 'fs'; import parseArgs from 'minimist'; -import type { Page, BrowserContext } from 'playwright-core'; +import type { BrowserContext } from 'playwright-core'; + +import { getProfilePath, launchBrowser, getPage } from './lib/browser.js'; + +// Re-export shared helpers so existing imports of browse.ts continue to work. +export { getProfilePath, launchBrowser, getPage }; interface BrowseOptions { url: string; @@ -36,36 +38,6 @@ function sleep(ms: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, ms)); } -const getProfilePath = (): string => { - const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; - if (customPath) return customPath; - - const profileDir = join(homedir(), '.cloakbrowser-profile'); - if (!existsSync(profileDir)) { - mkdirSync(profileDir, { recursive: true }); - } - return profileDir; -}; - -export async function launchBrowser(options: { - headless?: boolean; -}): Promise<BrowserContext> { - const profilePath = getProfilePath(); - const envHeadless = process.env.CLOAKBROWSER_HEADLESS; - const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); - - console.log(`Using profile: ${profilePath}`); - console.log(`Headless mode: ${headless}`); - - const context = await launchPersistentContext({ - userDataDir: profilePath, - headless, - humanize: true, - }); - - return context; -} - export async function browse(options: BrowseOptions): Promise<BrowseResult> { const browser = await launchBrowser({ headless: options.headless }); const page = browser.pages()[0] || await browser.newPage(); @@ -111,14 +83,6 @@ export async function browse(options: BrowseOptions): Promise<BrowseResult> { } } -export async function getPage(options?: { - headless?: boolean; -}): Promise<{ page: Page; browser: BrowserContext }> { - const browser = await launchBrowser({ headless: options?.headless }); - const page = browser.pages()[0] || await browser.newPage(); - return { page, browser }; -} - async function main() { const args = parseArgs(process.argv.slice(2), { string: ['url', 'output'], diff --git a/skills/web-automation/claude-code/scripts/check-install.js b/skills/web-automation/claude-code/scripts/check-install.js index 50e4884..cb7197d 100644 --- a/skills/web-automation/claude-code/scripts/check-install.js +++ b/skills/web-automation/claude-code/scripts/check-install.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/claude-code/scripts/extract.js b/skills/web-automation/claude-code/scripts/extract.js old mode 100755 new mode 100644 index 5e3908a..f7b5995 --- a/skills/web-automation/claude-code/scripts/extract.js +++ b/skills/web-automation/claude-code/scripts/extract.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/claude-code/scripts/flow.ts b/skills/web-automation/claude-code/scripts/flow.ts index 5d01e55..6b8b5e6 100644 --- a/skills/web-automation/claude-code/scripts/flow.ts +++ b/skills/web-automation/claude-code/scripts/flow.ts @@ -1,8 +1,9 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import parseArgs from 'minimist'; import type { Page } from 'playwright-core'; -import { launchBrowser } from './browse'; +import { launchBrowser } from './lib/browser.js'; type Step = | { action: 'goto'; url: string } diff --git a/skills/web-automation/claude-code/scripts/lib/browser.ts b/skills/web-automation/claude-code/scripts/lib/browser.ts new file mode 100644 index 0000000..5723bad --- /dev/null +++ b/skills/web-automation/claude-code/scripts/lib/browser.ts @@ -0,0 +1,76 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. +/** + * Shared browser-launch and profile helpers for web-automation scripts. + * + * Centralises the three reusable primitives that every command entry point + * needs: + * - getProfilePath() — resolve the persistent CloakBrowser profile dir + * - launchBrowser() — launch a CloakBrowser persistent context + * - getPage() — get a ready Page + BrowserContext pair + * + * All command entry points (auth.ts, browse.ts, flow.ts, scan-local-app.ts) + * import from here instead of duplicating these bodies. + */ + +import { launchPersistentContext } from 'cloakbrowser'; +import { existsSync, mkdirSync } from 'fs'; +import { homedir } from 'os'; +import { join } from 'path'; +import type { BrowserContext, Page } from 'playwright-core'; + +/** + * Return the path to the persistent CloakBrowser profile directory. + * + * Uses `CLOAKBROWSER_PROFILE_PATH` env var when set; otherwise defaults to + * `~/.cloakbrowser-profile/` and creates it if it does not exist. + */ +export function getProfilePath(): string { + const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; + if (customPath) return customPath; + + const profileDir = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profileDir)) { + mkdirSync(profileDir, { recursive: true }); + } + return profileDir; +} + +/** + * Launch a CloakBrowser persistent context with the shared profile. + * + * Headless mode is resolved in order: + * 1. `options.headless` (explicit caller preference) + * 2. `CLOAKBROWSER_HEADLESS` env var + * 3. `true` (safe default) + */ +export async function launchBrowser(options: { + headless?: boolean; +}): Promise<BrowserContext> { + const profilePath = getProfilePath(); + const envHeadless = process.env.CLOAKBROWSER_HEADLESS; + const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); + + console.log(`Using profile: ${profilePath}`); + console.log(`Headless mode: ${headless}`); + + const context = await launchPersistentContext({ + userDataDir: profilePath, + headless, + humanize: true, + }); + + return context; +} + +/** + * Return a ready `{ page, browser }` pair using the shared persistent profile. + * + * Re-uses the first existing page or opens a new one if the context is empty. + */ +export async function getPage(options?: { + headless?: boolean; +}): Promise<{ page: Page; browser: BrowserContext }> { + const browser = await launchBrowser({ headless: options?.headless }); + const page = browser.pages()[0] || (await browser.newPage()); + return { page, browser }; +} diff --git a/skills/web-automation/claude-code/scripts/package.json b/skills/web-automation/claude-code/scripts/package.json index a2221e8..ce127dc 100644 --- a/skills/web-automation/claude-code/scripts/package.json +++ b/skills/web-automation/claude-code/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "web-automation-scripts", + "name": "@ai-coding-skills/web-automation-claude-code", "version": "1.0.0", "description": "Web browsing and scraping scripts using CloakBrowser", "type": "module", @@ -32,5 +32,6 @@ "tsx": "^4.7.0", "typescript": "^5.3.0" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/web-automation/claude-code/scripts/scan-local-app.ts b/skills/web-automation/claude-code/scripts/scan-local-app.ts index 6a05b35..cf8d190 100644 --- a/skills/web-automation/claude-code/scripts/scan-local-app.ts +++ b/skills/web-automation/claude-code/scripts/scan-local-app.ts @@ -1,8 +1,10 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { mkdirSync, writeFileSync } from 'fs'; import { dirname, resolve } from 'path'; -import { getPage } from './browse.js'; +import type { Page } from 'playwright-core'; +import { getPage } from './lib/browser.js'; type NavResult = { requestedUrl: string; @@ -39,30 +41,34 @@ function getRoutes(baseUrl: string): string[] { return [baseUrl]; } -async function gotoWithStatus(page: any, url: string): Promise<NavResult> { +type GotoError = { error: unknown }; + +async function gotoWithStatus(page: Page, url: string): Promise<NavResult> { const response = await page .goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }) - .catch((error: unknown) => ({ error })); + .catch((error: unknown): GotoError => ({ error })); - if (response?.error) { + if (response !== null && response !== undefined && 'error' in response) { + const gotoError = response as GotoError; return { requestedUrl: url, url: page.url(), status: null, title: await page.title().catch(() => ''), - error: String(response.error), + error: String(gotoError.error), }; } + const httpResponse = response as Awaited<ReturnType<Page['goto']>>; return { requestedUrl: url, url: page.url(), - status: response ? response.status() : null, + status: httpResponse ? httpResponse.status() : null, title: await page.title().catch(() => ''), }; } -async function textOrNull(page: any, selector: string): Promise<string | null> { +async function textOrNull(page: Page, selector: string): Promise<string | null> { const locator = page.locator(selector).first(); try { if ((await locator.count()) === 0) return null; @@ -73,7 +79,7 @@ async function textOrNull(page: any, selector: string): Promise<string | null> { } } -async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { +async function loginIfConfigured(page: Page, baseUrl: string, lines: string[]) { const loginPath = env('SCAN_LOGIN_PATH'); const username = env('SCAN_USERNAME') ?? env('CLOAKBROWSER_USERNAME'); const password = env('SCAN_PASSWORD') ?? env('CLOAKBROWSER_PASSWORD'); @@ -109,7 +115,7 @@ async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { lines.push(''); } -async function checkRoutes(page: any, baseUrl: string, lines: string[]) { +async function checkRoutes(page: Page, baseUrl: string, lines: string[]) { const routes = getRoutes(baseUrl); const routeChecks: RouteCheck[] = []; diff --git a/skills/web-automation/claude-code/scripts/scrape.ts b/skills/web-automation/claude-code/scripts/scrape.ts index 0820de0..2a4b75d 100644 --- a/skills/web-automation/claude-code/scripts/scrape.ts +++ b/skills/web-automation/claude-code/scripts/scrape.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Web scraper that extracts content to markdown diff --git a/skills/web-automation/claude-code/scripts/test-full.ts b/skills/web-automation/claude-code/scripts/test-full.ts index 356bbab..16037ee 100644 --- a/skills/web-automation/claude-code/scripts/test-full.ts +++ b/skills/web-automation/claude-code/scripts/test-full.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/claude-code/scripts/test-minimal.ts b/skills/web-automation/claude-code/scripts/test-minimal.ts index a5412e7..7cef2ce 100644 --- a/skills/web-automation/claude-code/scripts/test-minimal.ts +++ b/skills/web-automation/claude-code/scripts/test-minimal.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launch } from 'cloakbrowser'; async function test() { diff --git a/skills/web-automation/claude-code/scripts/test-profile.ts b/skills/web-automation/claude-code/scripts/test-profile.ts index ec59ddd..604ec55 100644 --- a/skills/web-automation/claude-code/scripts/test-profile.ts +++ b/skills/web-automation/claude-code/scripts/test-profile.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/claude-code/scripts/tsconfig.json b/skills/web-automation/claude-code/scripts/tsconfig.json index 4c23583..689017a 100644 --- a/skills/web-automation/claude-code/scripts/tsconfig.json +++ b/skills/web-automation/claude-code/scripts/tsconfig.json @@ -11,6 +11,6 @@ "outDir": "./dist", "rootDir": "." }, - "include": ["*.ts"], + "include": ["*.ts", "lib/**/*.ts"], "exclude": ["node_modules", "dist"] } diff --git a/skills/web-automation/claude-code/scripts/turndown-plugin-gfm.d.ts b/skills/web-automation/claude-code/scripts/turndown-plugin-gfm.d.ts index 316bed1..113765e 100644 --- a/skills/web-automation/claude-code/scripts/turndown-plugin-gfm.d.ts +++ b/skills/web-automation/claude-code/scripts/turndown-plugin-gfm.d.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. declare module 'turndown-plugin-gfm' { import TurndownService from 'turndown'; diff --git a/skills/web-automation/codex/.generated-manifest.json b/skills/web-automation/codex/.generated-manifest.json new file mode 100644 index 0000000..173482a --- /dev/null +++ b/skills/web-automation/codex/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/web-automation/codex", + "files": [ + { + "path": "scripts/auth.ts", + "kind": "file", + "mode": "644", + "sha256": "c0940f452437b05b95e58a9a7ab265fb50aa412bd672e82fedd6a37cbfb3d505" + }, + { + "path": "scripts/browse.ts", + "kind": "file", + "mode": "644", + "sha256": "d7e4b4c50116032e5a00f90bca27e069dfc5bbf6eeb06ec8f8edc9e5a9792ab8" + }, + { + "path": "scripts/check-install.js", + "kind": "file", + "mode": "644", + "sha256": "e46ee8cbe103794bf1e9c3466bb0fbd21079ceddc60ad9521299e8bc0150e48f" + }, + { + "path": "scripts/extract.js", + "kind": "file", + "mode": "644", + "sha256": "6fa2a0589de8afd6501e332e5fa263e1344187ea43a33590b431cdee59d04217" + }, + { + "path": "scripts/flow.ts", + "kind": "file", + "mode": "644", + "sha256": "94f3e7987cab253dc3c9e80656a11759fada13b3915608bff7ae08418602f366" + }, + { + "path": "scripts/lib/browser.ts", + "kind": "file", + "mode": "644", + "sha256": "879b5f883ff1f888d45ed20be05c2d9bc3d6fe5305a1972b7d49a7e6c0e24934" + }, + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "70316e0d66acdc7554467ba26d8dda2585ea2e92b964fb100ff21d576b8e3b06" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "17017e15e8b04311f5d53bdd37065b2f5a514a3119f40a0403148440ed181437" + }, + { + "path": "scripts/scan-local-app.ts", + "kind": "file", + "mode": "644", + "sha256": "9e1818c254a633e087715609152936dcb3613a0aa724d40a8a13460510691dc7" + }, + { + "path": "scripts/scrape.ts", + "kind": "file", + "mode": "644", + "sha256": "a1a3d81d57d9e8ab1854ce3cb230bdd39ae1087ec50c9fe82cc58f5f2663ebeb" + }, + { + "path": "scripts/test-full.ts", + "kind": "file", + "mode": "644", + "sha256": "76a647e840753621445c36894bff62e163f6a2e4d0860fa8e64d8df45fe21e08" + }, + { + "path": "scripts/test-minimal.ts", + "kind": "file", + "mode": "644", + "sha256": "59e0b2319d3f7521b2a8a4fca2d779afaa157bf2d160160fdec8cb56bea30b4f" + }, + { + "path": "scripts/test-profile.ts", + "kind": "file", + "mode": "644", + "sha256": "6cf0141581a9275bfa8a070a36212cef5f6417d64df3df3e614ec682008376b9" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "e5f22d72266068cf410976c880511f2ec1875445256e11739a5e1de6ffedf38d" + }, + { + "path": "scripts/turndown-plugin-gfm.d.ts", + "kind": "file", + "mode": "644", + "sha256": "c5001c059b160eff18a4097a8a0a7b96689b4ebc374543c7d5bf6e40b0d8a5ac" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "c5e92fbcc9c3b9dba9c571beedea9cf6d60e6eb7cf968ba461552e12a6481761" + } + ] +} diff --git a/skills/web-automation/codex/SKILL.md b/skills/web-automation/codex/SKILL.md index 86876af..638b416 100644 --- a/skills/web-automation/codex/SKILL.md +++ b/skills/web-automation/codex/SKILL.md @@ -3,6 +3,8 @@ name: web-automation description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/_source/codex/SKILL.md and run `pnpm run sync:pi`. --> + # Web Automation with CloakBrowser (Codex) Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: diff --git a/skills/web-automation/codex/scripts/auth.ts b/skills/web-automation/codex/scripts/auth.ts index e79f23d..b06e846 100644 --- a/skills/web-automation/codex/scripts/auth.ts +++ b/skills/web-automation/codex/scripts/auth.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Authentication handler for web automation @@ -10,7 +11,7 @@ * npx tsx auth.ts --url "https://example.com" --type auto */ -import { getPage, launchBrowser } from './browse.js'; +import { getPage, launchBrowser } from './lib/browser.js'; import parseArgs from 'minimist'; import type { Page, BrowserContext } from 'playwright-core'; import { createInterface } from 'readline'; diff --git a/skills/web-automation/codex/scripts/browse.ts b/skills/web-automation/codex/scripts/browse.ts index 01cf098..e270db8 100644 --- a/skills/web-automation/codex/scripts/browse.ts +++ b/skills/web-automation/codex/scripts/browse.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Browser launcher using CloakBrowser with persistent profile @@ -9,12 +10,13 @@ * npx tsx browse.ts --url "https://example.com" --headless false --wait 5000 */ -import { launchPersistentContext } from 'cloakbrowser'; -import { homedir } from 'os'; -import { join } from 'path'; -import { existsSync, mkdirSync } from 'fs'; import parseArgs from 'minimist'; -import type { Page, BrowserContext } from 'playwright-core'; +import type { BrowserContext } from 'playwright-core'; + +import { getProfilePath, launchBrowser, getPage } from './lib/browser.js'; + +// Re-export shared helpers so existing imports of browse.ts continue to work. +export { getProfilePath, launchBrowser, getPage }; interface BrowseOptions { url: string; @@ -36,36 +38,6 @@ function sleep(ms: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, ms)); } -const getProfilePath = (): string => { - const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; - if (customPath) return customPath; - - const profileDir = join(homedir(), '.cloakbrowser-profile'); - if (!existsSync(profileDir)) { - mkdirSync(profileDir, { recursive: true }); - } - return profileDir; -}; - -export async function launchBrowser(options: { - headless?: boolean; -}): Promise<BrowserContext> { - const profilePath = getProfilePath(); - const envHeadless = process.env.CLOAKBROWSER_HEADLESS; - const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); - - console.log(`Using profile: ${profilePath}`); - console.log(`Headless mode: ${headless}`); - - const context = await launchPersistentContext({ - userDataDir: profilePath, - headless, - humanize: true, - }); - - return context; -} - export async function browse(options: BrowseOptions): Promise<BrowseResult> { const browser = await launchBrowser({ headless: options.headless }); const page = browser.pages()[0] || await browser.newPage(); @@ -111,14 +83,6 @@ export async function browse(options: BrowseOptions): Promise<BrowseResult> { } } -export async function getPage(options?: { - headless?: boolean; -}): Promise<{ page: Page; browser: BrowserContext }> { - const browser = await launchBrowser({ headless: options?.headless }); - const page = browser.pages()[0] || await browser.newPage(); - return { page, browser }; -} - async function main() { const args = parseArgs(process.argv.slice(2), { string: ['url', 'output'], diff --git a/skills/web-automation/codex/scripts/check-install.js b/skills/web-automation/codex/scripts/check-install.js index 50e4884..cb7197d 100644 --- a/skills/web-automation/codex/scripts/check-install.js +++ b/skills/web-automation/codex/scripts/check-install.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/codex/scripts/extract.js b/skills/web-automation/codex/scripts/extract.js old mode 100755 new mode 100644 index 5e3908a..f7b5995 --- a/skills/web-automation/codex/scripts/extract.js +++ b/skills/web-automation/codex/scripts/extract.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/codex/scripts/flow.ts b/skills/web-automation/codex/scripts/flow.ts index 5d01e55..6b8b5e6 100644 --- a/skills/web-automation/codex/scripts/flow.ts +++ b/skills/web-automation/codex/scripts/flow.ts @@ -1,8 +1,9 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import parseArgs from 'minimist'; import type { Page } from 'playwright-core'; -import { launchBrowser } from './browse'; +import { launchBrowser } from './lib/browser.js'; type Step = | { action: 'goto'; url: string } diff --git a/skills/web-automation/codex/scripts/lib/browser.ts b/skills/web-automation/codex/scripts/lib/browser.ts new file mode 100644 index 0000000..5723bad --- /dev/null +++ b/skills/web-automation/codex/scripts/lib/browser.ts @@ -0,0 +1,76 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. +/** + * Shared browser-launch and profile helpers for web-automation scripts. + * + * Centralises the three reusable primitives that every command entry point + * needs: + * - getProfilePath() — resolve the persistent CloakBrowser profile dir + * - launchBrowser() — launch a CloakBrowser persistent context + * - getPage() — get a ready Page + BrowserContext pair + * + * All command entry points (auth.ts, browse.ts, flow.ts, scan-local-app.ts) + * import from here instead of duplicating these bodies. + */ + +import { launchPersistentContext } from 'cloakbrowser'; +import { existsSync, mkdirSync } from 'fs'; +import { homedir } from 'os'; +import { join } from 'path'; +import type { BrowserContext, Page } from 'playwright-core'; + +/** + * Return the path to the persistent CloakBrowser profile directory. + * + * Uses `CLOAKBROWSER_PROFILE_PATH` env var when set; otherwise defaults to + * `~/.cloakbrowser-profile/` and creates it if it does not exist. + */ +export function getProfilePath(): string { + const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; + if (customPath) return customPath; + + const profileDir = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profileDir)) { + mkdirSync(profileDir, { recursive: true }); + } + return profileDir; +} + +/** + * Launch a CloakBrowser persistent context with the shared profile. + * + * Headless mode is resolved in order: + * 1. `options.headless` (explicit caller preference) + * 2. `CLOAKBROWSER_HEADLESS` env var + * 3. `true` (safe default) + */ +export async function launchBrowser(options: { + headless?: boolean; +}): Promise<BrowserContext> { + const profilePath = getProfilePath(); + const envHeadless = process.env.CLOAKBROWSER_HEADLESS; + const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); + + console.log(`Using profile: ${profilePath}`); + console.log(`Headless mode: ${headless}`); + + const context = await launchPersistentContext({ + userDataDir: profilePath, + headless, + humanize: true, + }); + + return context; +} + +/** + * Return a ready `{ page, browser }` pair using the shared persistent profile. + * + * Re-uses the first existing page or opens a new one if the context is empty. + */ +export async function getPage(options?: { + headless?: boolean; +}): Promise<{ page: Page; browser: BrowserContext }> { + const browser = await launchBrowser({ headless: options?.headless }); + const page = browser.pages()[0] || (await browser.newPage()); + return { page, browser }; +} diff --git a/skills/web-automation/codex/scripts/package.json b/skills/web-automation/codex/scripts/package.json index a2221e8..7a3e66a 100644 --- a/skills/web-automation/codex/scripts/package.json +++ b/skills/web-automation/codex/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "web-automation-scripts", + "name": "@ai-coding-skills/web-automation-codex", "version": "1.0.0", "description": "Web browsing and scraping scripts using CloakBrowser", "type": "module", @@ -32,5 +32,6 @@ "tsx": "^4.7.0", "typescript": "^5.3.0" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/web-automation/codex/scripts/scan-local-app.ts b/skills/web-automation/codex/scripts/scan-local-app.ts index 6a05b35..cf8d190 100644 --- a/skills/web-automation/codex/scripts/scan-local-app.ts +++ b/skills/web-automation/codex/scripts/scan-local-app.ts @@ -1,8 +1,10 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { mkdirSync, writeFileSync } from 'fs'; import { dirname, resolve } from 'path'; -import { getPage } from './browse.js'; +import type { Page } from 'playwright-core'; +import { getPage } from './lib/browser.js'; type NavResult = { requestedUrl: string; @@ -39,30 +41,34 @@ function getRoutes(baseUrl: string): string[] { return [baseUrl]; } -async function gotoWithStatus(page: any, url: string): Promise<NavResult> { +type GotoError = { error: unknown }; + +async function gotoWithStatus(page: Page, url: string): Promise<NavResult> { const response = await page .goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }) - .catch((error: unknown) => ({ error })); + .catch((error: unknown): GotoError => ({ error })); - if (response?.error) { + if (response !== null && response !== undefined && 'error' in response) { + const gotoError = response as GotoError; return { requestedUrl: url, url: page.url(), status: null, title: await page.title().catch(() => ''), - error: String(response.error), + error: String(gotoError.error), }; } + const httpResponse = response as Awaited<ReturnType<Page['goto']>>; return { requestedUrl: url, url: page.url(), - status: response ? response.status() : null, + status: httpResponse ? httpResponse.status() : null, title: await page.title().catch(() => ''), }; } -async function textOrNull(page: any, selector: string): Promise<string | null> { +async function textOrNull(page: Page, selector: string): Promise<string | null> { const locator = page.locator(selector).first(); try { if ((await locator.count()) === 0) return null; @@ -73,7 +79,7 @@ async function textOrNull(page: any, selector: string): Promise<string | null> { } } -async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { +async function loginIfConfigured(page: Page, baseUrl: string, lines: string[]) { const loginPath = env('SCAN_LOGIN_PATH'); const username = env('SCAN_USERNAME') ?? env('CLOAKBROWSER_USERNAME'); const password = env('SCAN_PASSWORD') ?? env('CLOAKBROWSER_PASSWORD'); @@ -109,7 +115,7 @@ async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { lines.push(''); } -async function checkRoutes(page: any, baseUrl: string, lines: string[]) { +async function checkRoutes(page: Page, baseUrl: string, lines: string[]) { const routes = getRoutes(baseUrl); const routeChecks: RouteCheck[] = []; diff --git a/skills/web-automation/codex/scripts/scrape.ts b/skills/web-automation/codex/scripts/scrape.ts index 0820de0..2a4b75d 100644 --- a/skills/web-automation/codex/scripts/scrape.ts +++ b/skills/web-automation/codex/scripts/scrape.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Web scraper that extracts content to markdown diff --git a/skills/web-automation/codex/scripts/test-full.ts b/skills/web-automation/codex/scripts/test-full.ts index 356bbab..16037ee 100644 --- a/skills/web-automation/codex/scripts/test-full.ts +++ b/skills/web-automation/codex/scripts/test-full.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/codex/scripts/test-minimal.ts b/skills/web-automation/codex/scripts/test-minimal.ts index a5412e7..7cef2ce 100644 --- a/skills/web-automation/codex/scripts/test-minimal.ts +++ b/skills/web-automation/codex/scripts/test-minimal.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launch } from 'cloakbrowser'; async function test() { diff --git a/skills/web-automation/codex/scripts/test-profile.ts b/skills/web-automation/codex/scripts/test-profile.ts index ec59ddd..604ec55 100644 --- a/skills/web-automation/codex/scripts/test-profile.ts +++ b/skills/web-automation/codex/scripts/test-profile.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/codex/scripts/tsconfig.json b/skills/web-automation/codex/scripts/tsconfig.json index 4c23583..689017a 100644 --- a/skills/web-automation/codex/scripts/tsconfig.json +++ b/skills/web-automation/codex/scripts/tsconfig.json @@ -11,6 +11,6 @@ "outDir": "./dist", "rootDir": "." }, - "include": ["*.ts"], + "include": ["*.ts", "lib/**/*.ts"], "exclude": ["node_modules", "dist"] } diff --git a/skills/web-automation/codex/scripts/turndown-plugin-gfm.d.ts b/skills/web-automation/codex/scripts/turndown-plugin-gfm.d.ts index 316bed1..113765e 100644 --- a/skills/web-automation/codex/scripts/turndown-plugin-gfm.d.ts +++ b/skills/web-automation/codex/scripts/turndown-plugin-gfm.d.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. declare module 'turndown-plugin-gfm' { import TurndownService from 'turndown'; diff --git a/skills/web-automation/cursor/.generated-manifest.json b/skills/web-automation/cursor/.generated-manifest.json new file mode 100644 index 0000000..528c904 --- /dev/null +++ b/skills/web-automation/cursor/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/web-automation/cursor", + "files": [ + { + "path": "scripts/auth.ts", + "kind": "file", + "mode": "644", + "sha256": "c0940f452437b05b95e58a9a7ab265fb50aa412bd672e82fedd6a37cbfb3d505" + }, + { + "path": "scripts/browse.ts", + "kind": "file", + "mode": "644", + "sha256": "d7e4b4c50116032e5a00f90bca27e069dfc5bbf6eeb06ec8f8edc9e5a9792ab8" + }, + { + "path": "scripts/check-install.js", + "kind": "file", + "mode": "644", + "sha256": "e46ee8cbe103794bf1e9c3466bb0fbd21079ceddc60ad9521299e8bc0150e48f" + }, + { + "path": "scripts/extract.js", + "kind": "file", + "mode": "644", + "sha256": "6fa2a0589de8afd6501e332e5fa263e1344187ea43a33590b431cdee59d04217" + }, + { + "path": "scripts/flow.ts", + "kind": "file", + "mode": "644", + "sha256": "94f3e7987cab253dc3c9e80656a11759fada13b3915608bff7ae08418602f366" + }, + { + "path": "scripts/lib/browser.ts", + "kind": "file", + "mode": "644", + "sha256": "879b5f883ff1f888d45ed20be05c2d9bc3d6fe5305a1972b7d49a7e6c0e24934" + }, + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "53b20f0df2f15fab39b58375ada434a82d135fd52fb6d0138c16941b8675b631" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "17017e15e8b04311f5d53bdd37065b2f5a514a3119f40a0403148440ed181437" + }, + { + "path": "scripts/scan-local-app.ts", + "kind": "file", + "mode": "644", + "sha256": "9e1818c254a633e087715609152936dcb3613a0aa724d40a8a13460510691dc7" + }, + { + "path": "scripts/scrape.ts", + "kind": "file", + "mode": "644", + "sha256": "a1a3d81d57d9e8ab1854ce3cb230bdd39ae1087ec50c9fe82cc58f5f2663ebeb" + }, + { + "path": "scripts/test-full.ts", + "kind": "file", + "mode": "644", + "sha256": "76a647e840753621445c36894bff62e163f6a2e4d0860fa8e64d8df45fe21e08" + }, + { + "path": "scripts/test-minimal.ts", + "kind": "file", + "mode": "644", + "sha256": "59e0b2319d3f7521b2a8a4fca2d779afaa157bf2d160160fdec8cb56bea30b4f" + }, + { + "path": "scripts/test-profile.ts", + "kind": "file", + "mode": "644", + "sha256": "6cf0141581a9275bfa8a070a36212cef5f6417d64df3df3e614ec682008376b9" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "e5f22d72266068cf410976c880511f2ec1875445256e11739a5e1de6ffedf38d" + }, + { + "path": "scripts/turndown-plugin-gfm.d.ts", + "kind": "file", + "mode": "644", + "sha256": "c5001c059b160eff18a4097a8a0a7b96689b4ebc374543c7d5bf6e40b0d8a5ac" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "3cba6cf3fee80db292440bfc22f0e97c6e3ffd7084000f4291e56ec1d7eb7bab" + } + ] +} diff --git a/skills/web-automation/cursor/SKILL.md b/skills/web-automation/cursor/SKILL.md index adeef60..af2e86b 100644 --- a/skills/web-automation/cursor/SKILL.md +++ b/skills/web-automation/cursor/SKILL.md @@ -3,6 +3,8 @@ name: web-automation description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/_source/cursor/SKILL.md and run `pnpm run sync:pi`. --> + # Web Automation with CloakBrowser (Cursor) Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: diff --git a/skills/web-automation/cursor/scripts/auth.ts b/skills/web-automation/cursor/scripts/auth.ts index e79f23d..b06e846 100644 --- a/skills/web-automation/cursor/scripts/auth.ts +++ b/skills/web-automation/cursor/scripts/auth.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Authentication handler for web automation @@ -10,7 +11,7 @@ * npx tsx auth.ts --url "https://example.com" --type auto */ -import { getPage, launchBrowser } from './browse.js'; +import { getPage, launchBrowser } from './lib/browser.js'; import parseArgs from 'minimist'; import type { Page, BrowserContext } from 'playwright-core'; import { createInterface } from 'readline'; diff --git a/skills/web-automation/cursor/scripts/browse.ts b/skills/web-automation/cursor/scripts/browse.ts index 01cf098..e270db8 100644 --- a/skills/web-automation/cursor/scripts/browse.ts +++ b/skills/web-automation/cursor/scripts/browse.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Browser launcher using CloakBrowser with persistent profile @@ -9,12 +10,13 @@ * npx tsx browse.ts --url "https://example.com" --headless false --wait 5000 */ -import { launchPersistentContext } from 'cloakbrowser'; -import { homedir } from 'os'; -import { join } from 'path'; -import { existsSync, mkdirSync } from 'fs'; import parseArgs from 'minimist'; -import type { Page, BrowserContext } from 'playwright-core'; +import type { BrowserContext } from 'playwright-core'; + +import { getProfilePath, launchBrowser, getPage } from './lib/browser.js'; + +// Re-export shared helpers so existing imports of browse.ts continue to work. +export { getProfilePath, launchBrowser, getPage }; interface BrowseOptions { url: string; @@ -36,36 +38,6 @@ function sleep(ms: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, ms)); } -const getProfilePath = (): string => { - const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; - if (customPath) return customPath; - - const profileDir = join(homedir(), '.cloakbrowser-profile'); - if (!existsSync(profileDir)) { - mkdirSync(profileDir, { recursive: true }); - } - return profileDir; -}; - -export async function launchBrowser(options: { - headless?: boolean; -}): Promise<BrowserContext> { - const profilePath = getProfilePath(); - const envHeadless = process.env.CLOAKBROWSER_HEADLESS; - const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); - - console.log(`Using profile: ${profilePath}`); - console.log(`Headless mode: ${headless}`); - - const context = await launchPersistentContext({ - userDataDir: profilePath, - headless, - humanize: true, - }); - - return context; -} - export async function browse(options: BrowseOptions): Promise<BrowseResult> { const browser = await launchBrowser({ headless: options.headless }); const page = browser.pages()[0] || await browser.newPage(); @@ -111,14 +83,6 @@ export async function browse(options: BrowseOptions): Promise<BrowseResult> { } } -export async function getPage(options?: { - headless?: boolean; -}): Promise<{ page: Page; browser: BrowserContext }> { - const browser = await launchBrowser({ headless: options?.headless }); - const page = browser.pages()[0] || await browser.newPage(); - return { page, browser }; -} - async function main() { const args = parseArgs(process.argv.slice(2), { string: ['url', 'output'], diff --git a/skills/web-automation/cursor/scripts/check-install.js b/skills/web-automation/cursor/scripts/check-install.js index 50e4884..cb7197d 100644 --- a/skills/web-automation/cursor/scripts/check-install.js +++ b/skills/web-automation/cursor/scripts/check-install.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/cursor/scripts/extract.js b/skills/web-automation/cursor/scripts/extract.js old mode 100755 new mode 100644 index 5e3908a..f7b5995 --- a/skills/web-automation/cursor/scripts/extract.js +++ b/skills/web-automation/cursor/scripts/extract.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/cursor/scripts/flow.ts b/skills/web-automation/cursor/scripts/flow.ts index 5d01e55..6b8b5e6 100644 --- a/skills/web-automation/cursor/scripts/flow.ts +++ b/skills/web-automation/cursor/scripts/flow.ts @@ -1,8 +1,9 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import parseArgs from 'minimist'; import type { Page } from 'playwright-core'; -import { launchBrowser } from './browse'; +import { launchBrowser } from './lib/browser.js'; type Step = | { action: 'goto'; url: string } diff --git a/skills/web-automation/cursor/scripts/lib/browser.ts b/skills/web-automation/cursor/scripts/lib/browser.ts new file mode 100644 index 0000000..5723bad --- /dev/null +++ b/skills/web-automation/cursor/scripts/lib/browser.ts @@ -0,0 +1,76 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. +/** + * Shared browser-launch and profile helpers for web-automation scripts. + * + * Centralises the three reusable primitives that every command entry point + * needs: + * - getProfilePath() — resolve the persistent CloakBrowser profile dir + * - launchBrowser() — launch a CloakBrowser persistent context + * - getPage() — get a ready Page + BrowserContext pair + * + * All command entry points (auth.ts, browse.ts, flow.ts, scan-local-app.ts) + * import from here instead of duplicating these bodies. + */ + +import { launchPersistentContext } from 'cloakbrowser'; +import { existsSync, mkdirSync } from 'fs'; +import { homedir } from 'os'; +import { join } from 'path'; +import type { BrowserContext, Page } from 'playwright-core'; + +/** + * Return the path to the persistent CloakBrowser profile directory. + * + * Uses `CLOAKBROWSER_PROFILE_PATH` env var when set; otherwise defaults to + * `~/.cloakbrowser-profile/` and creates it if it does not exist. + */ +export function getProfilePath(): string { + const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; + if (customPath) return customPath; + + const profileDir = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profileDir)) { + mkdirSync(profileDir, { recursive: true }); + } + return profileDir; +} + +/** + * Launch a CloakBrowser persistent context with the shared profile. + * + * Headless mode is resolved in order: + * 1. `options.headless` (explicit caller preference) + * 2. `CLOAKBROWSER_HEADLESS` env var + * 3. `true` (safe default) + */ +export async function launchBrowser(options: { + headless?: boolean; +}): Promise<BrowserContext> { + const profilePath = getProfilePath(); + const envHeadless = process.env.CLOAKBROWSER_HEADLESS; + const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); + + console.log(`Using profile: ${profilePath}`); + console.log(`Headless mode: ${headless}`); + + const context = await launchPersistentContext({ + userDataDir: profilePath, + headless, + humanize: true, + }); + + return context; +} + +/** + * Return a ready `{ page, browser }` pair using the shared persistent profile. + * + * Re-uses the first existing page or opens a new one if the context is empty. + */ +export async function getPage(options?: { + headless?: boolean; +}): Promise<{ page: Page; browser: BrowserContext }> { + const browser = await launchBrowser({ headless: options?.headless }); + const page = browser.pages()[0] || (await browser.newPage()); + return { page, browser }; +} diff --git a/skills/web-automation/cursor/scripts/package.json b/skills/web-automation/cursor/scripts/package.json index a2221e8..1cec30e 100644 --- a/skills/web-automation/cursor/scripts/package.json +++ b/skills/web-automation/cursor/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "web-automation-scripts", + "name": "@ai-coding-skills/web-automation-cursor", "version": "1.0.0", "description": "Web browsing and scraping scripts using CloakBrowser", "type": "module", @@ -32,5 +32,6 @@ "tsx": "^4.7.0", "typescript": "^5.3.0" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/web-automation/cursor/scripts/scan-local-app.ts b/skills/web-automation/cursor/scripts/scan-local-app.ts index 6a05b35..cf8d190 100644 --- a/skills/web-automation/cursor/scripts/scan-local-app.ts +++ b/skills/web-automation/cursor/scripts/scan-local-app.ts @@ -1,8 +1,10 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { mkdirSync, writeFileSync } from 'fs'; import { dirname, resolve } from 'path'; -import { getPage } from './browse.js'; +import type { Page } from 'playwright-core'; +import { getPage } from './lib/browser.js'; type NavResult = { requestedUrl: string; @@ -39,30 +41,34 @@ function getRoutes(baseUrl: string): string[] { return [baseUrl]; } -async function gotoWithStatus(page: any, url: string): Promise<NavResult> { +type GotoError = { error: unknown }; + +async function gotoWithStatus(page: Page, url: string): Promise<NavResult> { const response = await page .goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }) - .catch((error: unknown) => ({ error })); + .catch((error: unknown): GotoError => ({ error })); - if (response?.error) { + if (response !== null && response !== undefined && 'error' in response) { + const gotoError = response as GotoError; return { requestedUrl: url, url: page.url(), status: null, title: await page.title().catch(() => ''), - error: String(response.error), + error: String(gotoError.error), }; } + const httpResponse = response as Awaited<ReturnType<Page['goto']>>; return { requestedUrl: url, url: page.url(), - status: response ? response.status() : null, + status: httpResponse ? httpResponse.status() : null, title: await page.title().catch(() => ''), }; } -async function textOrNull(page: any, selector: string): Promise<string | null> { +async function textOrNull(page: Page, selector: string): Promise<string | null> { const locator = page.locator(selector).first(); try { if ((await locator.count()) === 0) return null; @@ -73,7 +79,7 @@ async function textOrNull(page: any, selector: string): Promise<string | null> { } } -async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { +async function loginIfConfigured(page: Page, baseUrl: string, lines: string[]) { const loginPath = env('SCAN_LOGIN_PATH'); const username = env('SCAN_USERNAME') ?? env('CLOAKBROWSER_USERNAME'); const password = env('SCAN_PASSWORD') ?? env('CLOAKBROWSER_PASSWORD'); @@ -109,7 +115,7 @@ async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { lines.push(''); } -async function checkRoutes(page: any, baseUrl: string, lines: string[]) { +async function checkRoutes(page: Page, baseUrl: string, lines: string[]) { const routes = getRoutes(baseUrl); const routeChecks: RouteCheck[] = []; diff --git a/skills/web-automation/cursor/scripts/scrape.ts b/skills/web-automation/cursor/scripts/scrape.ts index 0820de0..2a4b75d 100644 --- a/skills/web-automation/cursor/scripts/scrape.ts +++ b/skills/web-automation/cursor/scripts/scrape.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Web scraper that extracts content to markdown diff --git a/skills/web-automation/cursor/scripts/test-full.ts b/skills/web-automation/cursor/scripts/test-full.ts index 356bbab..16037ee 100644 --- a/skills/web-automation/cursor/scripts/test-full.ts +++ b/skills/web-automation/cursor/scripts/test-full.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/cursor/scripts/test-minimal.ts b/skills/web-automation/cursor/scripts/test-minimal.ts index a5412e7..7cef2ce 100644 --- a/skills/web-automation/cursor/scripts/test-minimal.ts +++ b/skills/web-automation/cursor/scripts/test-minimal.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launch } from 'cloakbrowser'; async function test() { diff --git a/skills/web-automation/cursor/scripts/test-profile.ts b/skills/web-automation/cursor/scripts/test-profile.ts index ec59ddd..604ec55 100644 --- a/skills/web-automation/cursor/scripts/test-profile.ts +++ b/skills/web-automation/cursor/scripts/test-profile.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/cursor/scripts/tsconfig.json b/skills/web-automation/cursor/scripts/tsconfig.json index 4c23583..689017a 100644 --- a/skills/web-automation/cursor/scripts/tsconfig.json +++ b/skills/web-automation/cursor/scripts/tsconfig.json @@ -11,6 +11,6 @@ "outDir": "./dist", "rootDir": "." }, - "include": ["*.ts"], + "include": ["*.ts", "lib/**/*.ts"], "exclude": ["node_modules", "dist"] } diff --git a/skills/web-automation/cursor/scripts/turndown-plugin-gfm.d.ts b/skills/web-automation/cursor/scripts/turndown-plugin-gfm.d.ts index 316bed1..113765e 100644 --- a/skills/web-automation/cursor/scripts/turndown-plugin-gfm.d.ts +++ b/skills/web-automation/cursor/scripts/turndown-plugin-gfm.d.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. declare module 'turndown-plugin-gfm' { import TurndownService from 'turndown'; diff --git a/skills/web-automation/opencode/.generated-manifest.json b/skills/web-automation/opencode/.generated-manifest.json new file mode 100644 index 0000000..73620b8 --- /dev/null +++ b/skills/web-automation/opencode/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/web-automation/opencode", + "files": [ + { + "path": "scripts/auth.ts", + "kind": "file", + "mode": "644", + "sha256": "c0940f452437b05b95e58a9a7ab265fb50aa412bd672e82fedd6a37cbfb3d505" + }, + { + "path": "scripts/browse.ts", + "kind": "file", + "mode": "644", + "sha256": "d7e4b4c50116032e5a00f90bca27e069dfc5bbf6eeb06ec8f8edc9e5a9792ab8" + }, + { + "path": "scripts/check-install.js", + "kind": "file", + "mode": "644", + "sha256": "e46ee8cbe103794bf1e9c3466bb0fbd21079ceddc60ad9521299e8bc0150e48f" + }, + { + "path": "scripts/extract.js", + "kind": "file", + "mode": "644", + "sha256": "6fa2a0589de8afd6501e332e5fa263e1344187ea43a33590b431cdee59d04217" + }, + { + "path": "scripts/flow.ts", + "kind": "file", + "mode": "644", + "sha256": "94f3e7987cab253dc3c9e80656a11759fada13b3915608bff7ae08418602f366" + }, + { + "path": "scripts/lib/browser.ts", + "kind": "file", + "mode": "644", + "sha256": "879b5f883ff1f888d45ed20be05c2d9bc3d6fe5305a1972b7d49a7e6c0e24934" + }, + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "5f976f168e43948fda29d6749f7fc29991a2aace3d830c54c0184199cec222c4" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "17017e15e8b04311f5d53bdd37065b2f5a514a3119f40a0403148440ed181437" + }, + { + "path": "scripts/scan-local-app.ts", + "kind": "file", + "mode": "644", + "sha256": "9e1818c254a633e087715609152936dcb3613a0aa724d40a8a13460510691dc7" + }, + { + "path": "scripts/scrape.ts", + "kind": "file", + "mode": "644", + "sha256": "a1a3d81d57d9e8ab1854ce3cb230bdd39ae1087ec50c9fe82cc58f5f2663ebeb" + }, + { + "path": "scripts/test-full.ts", + "kind": "file", + "mode": "644", + "sha256": "76a647e840753621445c36894bff62e163f6a2e4d0860fa8e64d8df45fe21e08" + }, + { + "path": "scripts/test-minimal.ts", + "kind": "file", + "mode": "644", + "sha256": "59e0b2319d3f7521b2a8a4fca2d779afaa157bf2d160160fdec8cb56bea30b4f" + }, + { + "path": "scripts/test-profile.ts", + "kind": "file", + "mode": "644", + "sha256": "6cf0141581a9275bfa8a070a36212cef5f6417d64df3df3e614ec682008376b9" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "e5f22d72266068cf410976c880511f2ec1875445256e11739a5e1de6ffedf38d" + }, + { + "path": "scripts/turndown-plugin-gfm.d.ts", + "kind": "file", + "mode": "644", + "sha256": "c5001c059b160eff18a4097a8a0a7b96689b4ebc374543c7d5bf6e40b0d8a5ac" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "43b6fd2cc553ca982ef34f4800594ab1371af1de2f16bd0fc7bc8e2bc85bdff1" + } + ] +} diff --git a/skills/web-automation/opencode/SKILL.md b/skills/web-automation/opencode/SKILL.md index 01847ad..1d7c082 100644 --- a/skills/web-automation/opencode/SKILL.md +++ b/skills/web-automation/opencode/SKILL.md @@ -3,6 +3,8 @@ name: web-automation description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/_source/opencode/SKILL.md and run `pnpm run sync:pi`. --> + # Web Automation with CloakBrowser (OpenCode) Automated web browsing and scraping using Playwright-compatible CloakBrowser with two execution paths: diff --git a/skills/web-automation/opencode/scripts/auth.ts b/skills/web-automation/opencode/scripts/auth.ts index e79f23d..b06e846 100644 --- a/skills/web-automation/opencode/scripts/auth.ts +++ b/skills/web-automation/opencode/scripts/auth.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Authentication handler for web automation @@ -10,7 +11,7 @@ * npx tsx auth.ts --url "https://example.com" --type auto */ -import { getPage, launchBrowser } from './browse.js'; +import { getPage, launchBrowser } from './lib/browser.js'; import parseArgs from 'minimist'; import type { Page, BrowserContext } from 'playwright-core'; import { createInterface } from 'readline'; diff --git a/skills/web-automation/opencode/scripts/browse.ts b/skills/web-automation/opencode/scripts/browse.ts index 01cf098..e270db8 100644 --- a/skills/web-automation/opencode/scripts/browse.ts +++ b/skills/web-automation/opencode/scripts/browse.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Browser launcher using CloakBrowser with persistent profile @@ -9,12 +10,13 @@ * npx tsx browse.ts --url "https://example.com" --headless false --wait 5000 */ -import { launchPersistentContext } from 'cloakbrowser'; -import { homedir } from 'os'; -import { join } from 'path'; -import { existsSync, mkdirSync } from 'fs'; import parseArgs from 'minimist'; -import type { Page, BrowserContext } from 'playwright-core'; +import type { BrowserContext } from 'playwright-core'; + +import { getProfilePath, launchBrowser, getPage } from './lib/browser.js'; + +// Re-export shared helpers so existing imports of browse.ts continue to work. +export { getProfilePath, launchBrowser, getPage }; interface BrowseOptions { url: string; @@ -36,36 +38,6 @@ function sleep(ms: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, ms)); } -const getProfilePath = (): string => { - const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; - if (customPath) return customPath; - - const profileDir = join(homedir(), '.cloakbrowser-profile'); - if (!existsSync(profileDir)) { - mkdirSync(profileDir, { recursive: true }); - } - return profileDir; -}; - -export async function launchBrowser(options: { - headless?: boolean; -}): Promise<BrowserContext> { - const profilePath = getProfilePath(); - const envHeadless = process.env.CLOAKBROWSER_HEADLESS; - const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); - - console.log(`Using profile: ${profilePath}`); - console.log(`Headless mode: ${headless}`); - - const context = await launchPersistentContext({ - userDataDir: profilePath, - headless, - humanize: true, - }); - - return context; -} - export async function browse(options: BrowseOptions): Promise<BrowseResult> { const browser = await launchBrowser({ headless: options.headless }); const page = browser.pages()[0] || await browser.newPage(); @@ -111,14 +83,6 @@ export async function browse(options: BrowseOptions): Promise<BrowseResult> { } } -export async function getPage(options?: { - headless?: boolean; -}): Promise<{ page: Page; browser: BrowserContext }> { - const browser = await launchBrowser({ headless: options?.headless }); - const page = browser.pages()[0] || await browser.newPage(); - return { page, browser }; -} - async function main() { const args = parseArgs(process.argv.slice(2), { string: ['url', 'output'], diff --git a/skills/web-automation/opencode/scripts/check-install.js b/skills/web-automation/opencode/scripts/check-install.js index 50e4884..cb7197d 100644 --- a/skills/web-automation/opencode/scripts/check-install.js +++ b/skills/web-automation/opencode/scripts/check-install.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/opencode/scripts/extract.js b/skills/web-automation/opencode/scripts/extract.js old mode 100755 new mode 100644 index 5e3908a..f7b5995 --- a/skills/web-automation/opencode/scripts/extract.js +++ b/skills/web-automation/opencode/scripts/extract.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/opencode/scripts/flow.ts b/skills/web-automation/opencode/scripts/flow.ts index 5d01e55..6b8b5e6 100644 --- a/skills/web-automation/opencode/scripts/flow.ts +++ b/skills/web-automation/opencode/scripts/flow.ts @@ -1,8 +1,9 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import parseArgs from 'minimist'; import type { Page } from 'playwright-core'; -import { launchBrowser } from './browse'; +import { launchBrowser } from './lib/browser.js'; type Step = | { action: 'goto'; url: string } diff --git a/skills/web-automation/opencode/scripts/lib/browser.ts b/skills/web-automation/opencode/scripts/lib/browser.ts new file mode 100644 index 0000000..5723bad --- /dev/null +++ b/skills/web-automation/opencode/scripts/lib/browser.ts @@ -0,0 +1,76 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. +/** + * Shared browser-launch and profile helpers for web-automation scripts. + * + * Centralises the three reusable primitives that every command entry point + * needs: + * - getProfilePath() — resolve the persistent CloakBrowser profile dir + * - launchBrowser() — launch a CloakBrowser persistent context + * - getPage() — get a ready Page + BrowserContext pair + * + * All command entry points (auth.ts, browse.ts, flow.ts, scan-local-app.ts) + * import from here instead of duplicating these bodies. + */ + +import { launchPersistentContext } from 'cloakbrowser'; +import { existsSync, mkdirSync } from 'fs'; +import { homedir } from 'os'; +import { join } from 'path'; +import type { BrowserContext, Page } from 'playwright-core'; + +/** + * Return the path to the persistent CloakBrowser profile directory. + * + * Uses `CLOAKBROWSER_PROFILE_PATH` env var when set; otherwise defaults to + * `~/.cloakbrowser-profile/` and creates it if it does not exist. + */ +export function getProfilePath(): string { + const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; + if (customPath) return customPath; + + const profileDir = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profileDir)) { + mkdirSync(profileDir, { recursive: true }); + } + return profileDir; +} + +/** + * Launch a CloakBrowser persistent context with the shared profile. + * + * Headless mode is resolved in order: + * 1. `options.headless` (explicit caller preference) + * 2. `CLOAKBROWSER_HEADLESS` env var + * 3. `true` (safe default) + */ +export async function launchBrowser(options: { + headless?: boolean; +}): Promise<BrowserContext> { + const profilePath = getProfilePath(); + const envHeadless = process.env.CLOAKBROWSER_HEADLESS; + const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); + + console.log(`Using profile: ${profilePath}`); + console.log(`Headless mode: ${headless}`); + + const context = await launchPersistentContext({ + userDataDir: profilePath, + headless, + humanize: true, + }); + + return context; +} + +/** + * Return a ready `{ page, browser }` pair using the shared persistent profile. + * + * Re-uses the first existing page or opens a new one if the context is empty. + */ +export async function getPage(options?: { + headless?: boolean; +}): Promise<{ page: Page; browser: BrowserContext }> { + const browser = await launchBrowser({ headless: options?.headless }); + const page = browser.pages()[0] || (await browser.newPage()); + return { page, browser }; +} diff --git a/skills/web-automation/opencode/scripts/package.json b/skills/web-automation/opencode/scripts/package.json index a2221e8..6e8a066 100644 --- a/skills/web-automation/opencode/scripts/package.json +++ b/skills/web-automation/opencode/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "web-automation-scripts", + "name": "@ai-coding-skills/web-automation-opencode", "version": "1.0.0", "description": "Web browsing and scraping scripts using CloakBrowser", "type": "module", @@ -32,5 +32,6 @@ "tsx": "^4.7.0", "typescript": "^5.3.0" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/web-automation/opencode/scripts/scan-local-app.ts b/skills/web-automation/opencode/scripts/scan-local-app.ts index 6a05b35..cf8d190 100644 --- a/skills/web-automation/opencode/scripts/scan-local-app.ts +++ b/skills/web-automation/opencode/scripts/scan-local-app.ts @@ -1,8 +1,10 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { mkdirSync, writeFileSync } from 'fs'; import { dirname, resolve } from 'path'; -import { getPage } from './browse.js'; +import type { Page } from 'playwright-core'; +import { getPage } from './lib/browser.js'; type NavResult = { requestedUrl: string; @@ -39,30 +41,34 @@ function getRoutes(baseUrl: string): string[] { return [baseUrl]; } -async function gotoWithStatus(page: any, url: string): Promise<NavResult> { +type GotoError = { error: unknown }; + +async function gotoWithStatus(page: Page, url: string): Promise<NavResult> { const response = await page .goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }) - .catch((error: unknown) => ({ error })); + .catch((error: unknown): GotoError => ({ error })); - if (response?.error) { + if (response !== null && response !== undefined && 'error' in response) { + const gotoError = response as GotoError; return { requestedUrl: url, url: page.url(), status: null, title: await page.title().catch(() => ''), - error: String(response.error), + error: String(gotoError.error), }; } + const httpResponse = response as Awaited<ReturnType<Page['goto']>>; return { requestedUrl: url, url: page.url(), - status: response ? response.status() : null, + status: httpResponse ? httpResponse.status() : null, title: await page.title().catch(() => ''), }; } -async function textOrNull(page: any, selector: string): Promise<string | null> { +async function textOrNull(page: Page, selector: string): Promise<string | null> { const locator = page.locator(selector).first(); try { if ((await locator.count()) === 0) return null; @@ -73,7 +79,7 @@ async function textOrNull(page: any, selector: string): Promise<string | null> { } } -async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { +async function loginIfConfigured(page: Page, baseUrl: string, lines: string[]) { const loginPath = env('SCAN_LOGIN_PATH'); const username = env('SCAN_USERNAME') ?? env('CLOAKBROWSER_USERNAME'); const password = env('SCAN_PASSWORD') ?? env('CLOAKBROWSER_PASSWORD'); @@ -109,7 +115,7 @@ async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { lines.push(''); } -async function checkRoutes(page: any, baseUrl: string, lines: string[]) { +async function checkRoutes(page: Page, baseUrl: string, lines: string[]) { const routes = getRoutes(baseUrl); const routeChecks: RouteCheck[] = []; diff --git a/skills/web-automation/opencode/scripts/scrape.ts b/skills/web-automation/opencode/scripts/scrape.ts index 0820de0..2a4b75d 100644 --- a/skills/web-automation/opencode/scripts/scrape.ts +++ b/skills/web-automation/opencode/scripts/scrape.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Web scraper that extracts content to markdown diff --git a/skills/web-automation/opencode/scripts/test-full.ts b/skills/web-automation/opencode/scripts/test-full.ts index 356bbab..16037ee 100644 --- a/skills/web-automation/opencode/scripts/test-full.ts +++ b/skills/web-automation/opencode/scripts/test-full.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/opencode/scripts/test-minimal.ts b/skills/web-automation/opencode/scripts/test-minimal.ts index a5412e7..7cef2ce 100644 --- a/skills/web-automation/opencode/scripts/test-minimal.ts +++ b/skills/web-automation/opencode/scripts/test-minimal.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launch } from 'cloakbrowser'; async function test() { diff --git a/skills/web-automation/opencode/scripts/test-profile.ts b/skills/web-automation/opencode/scripts/test-profile.ts index ec59ddd..604ec55 100644 --- a/skills/web-automation/opencode/scripts/test-profile.ts +++ b/skills/web-automation/opencode/scripts/test-profile.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/opencode/scripts/tsconfig.json b/skills/web-automation/opencode/scripts/tsconfig.json index 4c23583..689017a 100644 --- a/skills/web-automation/opencode/scripts/tsconfig.json +++ b/skills/web-automation/opencode/scripts/tsconfig.json @@ -11,6 +11,6 @@ "outDir": "./dist", "rootDir": "." }, - "include": ["*.ts"], + "include": ["*.ts", "lib/**/*.ts"], "exclude": ["node_modules", "dist"] } diff --git a/skills/web-automation/opencode/scripts/turndown-plugin-gfm.d.ts b/skills/web-automation/opencode/scripts/turndown-plugin-gfm.d.ts index 316bed1..113765e 100644 --- a/skills/web-automation/opencode/scripts/turndown-plugin-gfm.d.ts +++ b/skills/web-automation/opencode/scripts/turndown-plugin-gfm.d.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. declare module 'turndown-plugin-gfm' { import TurndownService from 'turndown'; diff --git a/skills/web-automation/pi/.generated-manifest.json b/skills/web-automation/pi/.generated-manifest.json new file mode 100644 index 0000000..a7a7f0d --- /dev/null +++ b/skills/web-automation/pi/.generated-manifest.json @@ -0,0 +1,103 @@ +{ + "$schema": "https://ai-coding-skills.dev/schemas/generated-manifest/v1.json", + "generator": "scripts/generate-skills.mjs", + "generatedRoot": "skills/web-automation/pi", + "files": [ + { + "path": "scripts/auth.ts", + "kind": "file", + "mode": "644", + "sha256": "c0940f452437b05b95e58a9a7ab265fb50aa412bd672e82fedd6a37cbfb3d505" + }, + { + "path": "scripts/browse.ts", + "kind": "file", + "mode": "644", + "sha256": "d7e4b4c50116032e5a00f90bca27e069dfc5bbf6eeb06ec8f8edc9e5a9792ab8" + }, + { + "path": "scripts/check-install.js", + "kind": "file", + "mode": "644", + "sha256": "e46ee8cbe103794bf1e9c3466bb0fbd21079ceddc60ad9521299e8bc0150e48f" + }, + { + "path": "scripts/extract.js", + "kind": "file", + "mode": "644", + "sha256": "6fa2a0589de8afd6501e332e5fa263e1344187ea43a33590b431cdee59d04217" + }, + { + "path": "scripts/flow.ts", + "kind": "file", + "mode": "644", + "sha256": "94f3e7987cab253dc3c9e80656a11759fada13b3915608bff7ae08418602f366" + }, + { + "path": "scripts/lib/browser.ts", + "kind": "file", + "mode": "644", + "sha256": "879b5f883ff1f888d45ed20be05c2d9bc3d6fe5305a1972b7d49a7e6c0e24934" + }, + { + "path": "scripts/package.json", + "kind": "file", + "mode": "644", + "sha256": "0441607db0272fc991c893133cb69560274cbbde4e2104bf50b4ae1ec58fc39a" + }, + { + "path": "scripts/pnpm-lock.yaml", + "kind": "file", + "mode": "644", + "sha256": "17017e15e8b04311f5d53bdd37065b2f5a514a3119f40a0403148440ed181437" + }, + { + "path": "scripts/scan-local-app.ts", + "kind": "file", + "mode": "644", + "sha256": "9e1818c254a633e087715609152936dcb3613a0aa724d40a8a13460510691dc7" + }, + { + "path": "scripts/scrape.ts", + "kind": "file", + "mode": "644", + "sha256": "a1a3d81d57d9e8ab1854ce3cb230bdd39ae1087ec50c9fe82cc58f5f2663ebeb" + }, + { + "path": "scripts/test-full.ts", + "kind": "file", + "mode": "644", + "sha256": "76a647e840753621445c36894bff62e163f6a2e4d0860fa8e64d8df45fe21e08" + }, + { + "path": "scripts/test-minimal.ts", + "kind": "file", + "mode": "644", + "sha256": "59e0b2319d3f7521b2a8a4fca2d779afaa157bf2d160160fdec8cb56bea30b4f" + }, + { + "path": "scripts/test-profile.ts", + "kind": "file", + "mode": "644", + "sha256": "6cf0141581a9275bfa8a070a36212cef5f6417d64df3df3e614ec682008376b9" + }, + { + "path": "scripts/tsconfig.json", + "kind": "file", + "mode": "644", + "sha256": "e5f22d72266068cf410976c880511f2ec1875445256e11739a5e1de6ffedf38d" + }, + { + "path": "scripts/turndown-plugin-gfm.d.ts", + "kind": "file", + "mode": "644", + "sha256": "c5001c059b160eff18a4097a8a0a7b96689b4ebc374543c7d5bf6e40b0d8a5ac" + }, + { + "path": "SKILL.md", + "kind": "file", + "mode": "644", + "sha256": "7ff56c1c50697439875f4dd0a7f7697962c8ba2105a4f66ab7b170f5dcc762bd" + } + ] +} diff --git a/skills/web-automation/pi/SKILL.md b/skills/web-automation/pi/SKILL.md index 5a021e7..53b403a 100644 --- a/skills/web-automation/pi/SKILL.md +++ b/skills/web-automation/pi/SKILL.md @@ -3,6 +3,8 @@ name: web-automation description: Browse and scrape web pages using Playwright-compatible CloakBrowser. Use when automating web workflows, extracting rendered page content, handling authenticated sessions, or running multi-step browser flows. --- +<!-- ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/_source/pi/SKILL.md and run `pnpm run sync:pi`. --> + # Web Automation with CloakBrowser (Pi) Automated web browsing and scraping for pi using the shared runtime bundle in `scripts/`. diff --git a/skills/web-automation/pi/scripts/auth.ts b/skills/web-automation/pi/scripts/auth.ts index e79f23d..b06e846 100644 --- a/skills/web-automation/pi/scripts/auth.ts +++ b/skills/web-automation/pi/scripts/auth.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Authentication handler for web automation @@ -10,7 +11,7 @@ * npx tsx auth.ts --url "https://example.com" --type auto */ -import { getPage, launchBrowser } from './browse.js'; +import { getPage, launchBrowser } from './lib/browser.js'; import parseArgs from 'minimist'; import type { Page, BrowserContext } from 'playwright-core'; import { createInterface } from 'readline'; diff --git a/skills/web-automation/pi/scripts/browse.ts b/skills/web-automation/pi/scripts/browse.ts index 01cf098..e270db8 100644 --- a/skills/web-automation/pi/scripts/browse.ts +++ b/skills/web-automation/pi/scripts/browse.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Browser launcher using CloakBrowser with persistent profile @@ -9,12 +10,13 @@ * npx tsx browse.ts --url "https://example.com" --headless false --wait 5000 */ -import { launchPersistentContext } from 'cloakbrowser'; -import { homedir } from 'os'; -import { join } from 'path'; -import { existsSync, mkdirSync } from 'fs'; import parseArgs from 'minimist'; -import type { Page, BrowserContext } from 'playwright-core'; +import type { BrowserContext } from 'playwright-core'; + +import { getProfilePath, launchBrowser, getPage } from './lib/browser.js'; + +// Re-export shared helpers so existing imports of browse.ts continue to work. +export { getProfilePath, launchBrowser, getPage }; interface BrowseOptions { url: string; @@ -36,36 +38,6 @@ function sleep(ms: number): Promise<void> { return new Promise((resolve) => setTimeout(resolve, ms)); } -const getProfilePath = (): string => { - const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; - if (customPath) return customPath; - - const profileDir = join(homedir(), '.cloakbrowser-profile'); - if (!existsSync(profileDir)) { - mkdirSync(profileDir, { recursive: true }); - } - return profileDir; -}; - -export async function launchBrowser(options: { - headless?: boolean; -}): Promise<BrowserContext> { - const profilePath = getProfilePath(); - const envHeadless = process.env.CLOAKBROWSER_HEADLESS; - const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); - - console.log(`Using profile: ${profilePath}`); - console.log(`Headless mode: ${headless}`); - - const context = await launchPersistentContext({ - userDataDir: profilePath, - headless, - humanize: true, - }); - - return context; -} - export async function browse(options: BrowseOptions): Promise<BrowseResult> { const browser = await launchBrowser({ headless: options.headless }); const page = browser.pages()[0] || await browser.newPage(); @@ -111,14 +83,6 @@ export async function browse(options: BrowseOptions): Promise<BrowseResult> { } } -export async function getPage(options?: { - headless?: boolean; -}): Promise<{ page: Page; browser: BrowserContext }> { - const browser = await launchBrowser({ headless: options?.headless }); - const page = browser.pages()[0] || await browser.newPage(); - return { page, browser }; -} - async function main() { const args = parseArgs(process.argv.slice(2), { string: ['url', 'output'], diff --git a/skills/web-automation/pi/scripts/check-install.js b/skills/web-automation/pi/scripts/check-install.js index 2a60c8a..cb7197d 100644 --- a/skills/web-automation/pi/scripts/check-install.js +++ b/skills/web-automation/pi/scripts/check-install.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; @@ -18,11 +19,9 @@ async function main() { try { await import("cloakbrowser"); await import("playwright-core"); - await import("better-sqlite3"); - await import("esbuild"); } catch (error) { fail( - "Missing dependency/config: web-automation requires cloakbrowser, playwright-core, better-sqlite3, and esbuild.", + "Missing dependency/config: web-automation requires cloakbrowser and playwright-core.", error instanceof Error ? error.message : String(error) ); } @@ -34,7 +33,6 @@ async function main() { } process.stdout.write("OK: cloakbrowser + playwright-core installed\n"); - process.stdout.write("OK: better-sqlite3 + esbuild installed\n"); process.stdout.write("OK: CloakBrowser integration detected in browse.ts\n"); } diff --git a/skills/web-automation/pi/scripts/extract.js b/skills/web-automation/pi/scripts/extract.js old mode 100755 new mode 100644 index 5e3908a..f7b5995 --- a/skills/web-automation/pi/scripts/extract.js +++ b/skills/web-automation/pi/scripts/extract.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import fs from "node:fs"; import path from "node:path"; diff --git a/skills/web-automation/pi/scripts/flow.ts b/skills/web-automation/pi/scripts/flow.ts index 5d01e55..6b8b5e6 100644 --- a/skills/web-automation/pi/scripts/flow.ts +++ b/skills/web-automation/pi/scripts/flow.ts @@ -1,8 +1,9 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import parseArgs from 'minimist'; import type { Page } from 'playwright-core'; -import { launchBrowser } from './browse'; +import { launchBrowser } from './lib/browser.js'; type Step = | { action: 'goto'; url: string } diff --git a/skills/web-automation/pi/scripts/lib/browser.ts b/skills/web-automation/pi/scripts/lib/browser.ts new file mode 100644 index 0000000..5723bad --- /dev/null +++ b/skills/web-automation/pi/scripts/lib/browser.ts @@ -0,0 +1,76 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. +/** + * Shared browser-launch and profile helpers for web-automation scripts. + * + * Centralises the three reusable primitives that every command entry point + * needs: + * - getProfilePath() — resolve the persistent CloakBrowser profile dir + * - launchBrowser() — launch a CloakBrowser persistent context + * - getPage() — get a ready Page + BrowserContext pair + * + * All command entry points (auth.ts, browse.ts, flow.ts, scan-local-app.ts) + * import from here instead of duplicating these bodies. + */ + +import { launchPersistentContext } from 'cloakbrowser'; +import { existsSync, mkdirSync } from 'fs'; +import { homedir } from 'os'; +import { join } from 'path'; +import type { BrowserContext, Page } from 'playwright-core'; + +/** + * Return the path to the persistent CloakBrowser profile directory. + * + * Uses `CLOAKBROWSER_PROFILE_PATH` env var when set; otherwise defaults to + * `~/.cloakbrowser-profile/` and creates it if it does not exist. + */ +export function getProfilePath(): string { + const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; + if (customPath) return customPath; + + const profileDir = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profileDir)) { + mkdirSync(profileDir, { recursive: true }); + } + return profileDir; +} + +/** + * Launch a CloakBrowser persistent context with the shared profile. + * + * Headless mode is resolved in order: + * 1. `options.headless` (explicit caller preference) + * 2. `CLOAKBROWSER_HEADLESS` env var + * 3. `true` (safe default) + */ +export async function launchBrowser(options: { + headless?: boolean; +}): Promise<BrowserContext> { + const profilePath = getProfilePath(); + const envHeadless = process.env.CLOAKBROWSER_HEADLESS; + const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); + + console.log(`Using profile: ${profilePath}`); + console.log(`Headless mode: ${headless}`); + + const context = await launchPersistentContext({ + userDataDir: profilePath, + headless, + humanize: true, + }); + + return context; +} + +/** + * Return a ready `{ page, browser }` pair using the shared persistent profile. + * + * Re-uses the first existing page or opens a new one if the context is empty. + */ +export async function getPage(options?: { + headless?: boolean; +}): Promise<{ page: Page; browser: BrowserContext }> { + const browser = await launchBrowser({ headless: options?.headless }); + const page = browser.pages()[0] || (await browser.newPage()); + return { page, browser }; +} diff --git a/skills/web-automation/pi/scripts/package.json b/skills/web-automation/pi/scripts/package.json index a2221e8..e65f379 100644 --- a/skills/web-automation/pi/scripts/package.json +++ b/skills/web-automation/pi/scripts/package.json @@ -1,5 +1,5 @@ { - "name": "web-automation-scripts", + "name": "@ai-coding-skills/web-automation-pi", "version": "1.0.0", "description": "Web browsing and scraping scripts using CloakBrowser", "type": "module", @@ -32,5 +32,6 @@ "tsx": "^4.7.0", "typescript": "^5.3.0" }, - "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34", + "private": true } diff --git a/skills/web-automation/pi/scripts/scan-local-app.ts b/skills/web-automation/pi/scripts/scan-local-app.ts index 6a05b35..cf8d190 100644 --- a/skills/web-automation/pi/scripts/scan-local-app.ts +++ b/skills/web-automation/pi/scripts/scan-local-app.ts @@ -1,8 +1,10 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { mkdirSync, writeFileSync } from 'fs'; import { dirname, resolve } from 'path'; -import { getPage } from './browse.js'; +import type { Page } from 'playwright-core'; +import { getPage } from './lib/browser.js'; type NavResult = { requestedUrl: string; @@ -39,30 +41,34 @@ function getRoutes(baseUrl: string): string[] { return [baseUrl]; } -async function gotoWithStatus(page: any, url: string): Promise<NavResult> { +type GotoError = { error: unknown }; + +async function gotoWithStatus(page: Page, url: string): Promise<NavResult> { const response = await page .goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }) - .catch((error: unknown) => ({ error })); + .catch((error: unknown): GotoError => ({ error })); - if (response?.error) { + if (response !== null && response !== undefined && 'error' in response) { + const gotoError = response as GotoError; return { requestedUrl: url, url: page.url(), status: null, title: await page.title().catch(() => ''), - error: String(response.error), + error: String(gotoError.error), }; } + const httpResponse = response as Awaited<ReturnType<Page['goto']>>; return { requestedUrl: url, url: page.url(), - status: response ? response.status() : null, + status: httpResponse ? httpResponse.status() : null, title: await page.title().catch(() => ''), }; } -async function textOrNull(page: any, selector: string): Promise<string | null> { +async function textOrNull(page: Page, selector: string): Promise<string | null> { const locator = page.locator(selector).first(); try { if ((await locator.count()) === 0) return null; @@ -73,7 +79,7 @@ async function textOrNull(page: any, selector: string): Promise<string | null> { } } -async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { +async function loginIfConfigured(page: Page, baseUrl: string, lines: string[]) { const loginPath = env('SCAN_LOGIN_PATH'); const username = env('SCAN_USERNAME') ?? env('CLOAKBROWSER_USERNAME'); const password = env('SCAN_PASSWORD') ?? env('CLOAKBROWSER_PASSWORD'); @@ -109,7 +115,7 @@ async function loginIfConfigured(page: any, baseUrl: string, lines: string[]) { lines.push(''); } -async function checkRoutes(page: any, baseUrl: string, lines: string[]) { +async function checkRoutes(page: Page, baseUrl: string, lines: string[]) { const routes = getRoutes(baseUrl); const routeChecks: RouteCheck[] = []; diff --git a/skills/web-automation/pi/scripts/scrape.ts b/skills/web-automation/pi/scripts/scrape.ts index 0820de0..2a4b75d 100644 --- a/skills/web-automation/pi/scripts/scrape.ts +++ b/skills/web-automation/pi/scripts/scrape.ts @@ -1,4 +1,5 @@ #!/usr/bin/env npx tsx +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. /** * Web scraper that extracts content to markdown diff --git a/skills/web-automation/pi/scripts/test-full.ts b/skills/web-automation/pi/scripts/test-full.ts index 356bbab..16037ee 100644 --- a/skills/web-automation/pi/scripts/test-full.ts +++ b/skills/web-automation/pi/scripts/test-full.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/pi/scripts/test-minimal.ts b/skills/web-automation/pi/scripts/test-minimal.ts index a5412e7..7cef2ce 100644 --- a/skills/web-automation/pi/scripts/test-minimal.ts +++ b/skills/web-automation/pi/scripts/test-minimal.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launch } from 'cloakbrowser'; async function test() { diff --git a/skills/web-automation/pi/scripts/test-profile.ts b/skills/web-automation/pi/scripts/test-profile.ts index ec59ddd..604ec55 100644 --- a/skills/web-automation/pi/scripts/test-profile.ts +++ b/skills/web-automation/pi/scripts/test-profile.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. import { launchPersistentContext } from 'cloakbrowser'; import { homedir } from 'os'; import { join } from 'path'; diff --git a/skills/web-automation/pi/scripts/tsconfig.json b/skills/web-automation/pi/scripts/tsconfig.json index 4c23583..689017a 100644 --- a/skills/web-automation/pi/scripts/tsconfig.json +++ b/skills/web-automation/pi/scripts/tsconfig.json @@ -11,6 +11,6 @@ "outDir": "./dist", "rootDir": "." }, - "include": ["*.ts"], + "include": ["*.ts", "lib/**/*.ts"], "exclude": ["node_modules", "dist"] } diff --git a/skills/web-automation/pi/scripts/turndown-plugin-gfm.d.ts b/skills/web-automation/pi/scripts/turndown-plugin-gfm.d.ts index 316bed1..113765e 100644 --- a/skills/web-automation/pi/scripts/turndown-plugin-gfm.d.ts +++ b/skills/web-automation/pi/scripts/turndown-plugin-gfm.d.ts @@ -1,3 +1,4 @@ +// ⚠️ GENERATED FILE – do not edit directly. Edit the canonical source in skills/web-automation/shared/ and run `pnpm run sync:pi`. declare module 'turndown-plugin-gfm' { import TurndownService from 'turndown'; diff --git a/skills/web-automation/shared/auth.ts b/skills/web-automation/shared/auth.ts new file mode 100644 index 0000000..be64b94 --- /dev/null +++ b/skills/web-automation/shared/auth.ts @@ -0,0 +1,575 @@ +#!/usr/bin/env npx tsx + +/** + * Authentication handler for web automation + * Supports generic form login and Microsoft SSO (MSAL) + * + * Usage: + * npx tsx auth.ts --url "https://example.com/login" --type form + * npx tsx auth.ts --url "https://example.com" --type msal + * npx tsx auth.ts --url "https://example.com" --type auto + */ + +import { getPage, launchBrowser } from './lib/browser.js'; +import parseArgs from 'minimist'; +import type { Page, BrowserContext } from 'playwright-core'; +import { createInterface } from 'readline'; + +// Types +type AuthType = 'auto' | 'form' | 'msal'; + +interface AuthOptions { + url: string; + authType: AuthType; + credentials?: { + username: string; + password: string; + }; + headless?: boolean; + timeout?: number; +} + +interface AuthResult { + success: boolean; + finalUrl: string; + authType: AuthType; + message: string; +} + +// Get credentials from environment or options +function getCredentials(options?: { + username?: string; + password?: string; +}): { username: string; password: string } | null { + const username = options?.username || process.env.CLOAKBROWSER_USERNAME; + const password = options?.password || process.env.CLOAKBROWSER_PASSWORD; + + if (!username || !password) { + return null; + } + + return { username, password }; +} + +// Prompt user for input (for MFA or credentials) +async function promptUser(question: string, hidden = false): Promise<string> { + const rl = createInterface({ + input: process.stdin, + output: process.stdout, + }); + + return new Promise((resolve) => { + if (hidden) { + process.stdout.write(question); + // Note: This is a simple implementation. For production, use a proper hidden input library + } + rl.question(question, (answer) => { + rl.close(); + resolve(answer); + }); + }); +} + +// Detect authentication type from page +async function detectAuthType(page: Page): Promise<AuthType> { + const url = page.url(); + + // Check for Microsoft login + if ( + url.includes('login.microsoftonline.com') || + url.includes('login.live.com') || + url.includes('login.windows.net') + ) { + return 'msal'; + } + + // Check for common form login patterns + const hasLoginForm = await page.evaluate(() => { + const passwordField = document.querySelector( + 'input[type="password"], input[name*="password"], input[id*="password"]' + ); + const usernameField = document.querySelector( + 'input[type="email"], input[type="text"][name*="user"], input[type="text"][name*="email"], input[id*="user"], input[id*="email"]' + ); + return !!(passwordField && usernameField); + }); + + if (hasLoginForm) { + return 'form'; + } + + return 'auto'; +} + +// Handle generic form login +async function handleFormLogin( + page: Page, + credentials: { username: string; password: string }, + timeout: number +): Promise<boolean> { + console.log('Attempting form login...'); + + // Find and fill username/email field + const usernameSelectors = [ + 'input[type="email"]', + 'input[name*="user" i]', + 'input[name*="email" i]', + 'input[id*="user" i]', + 'input[id*="email" i]', + 'input[autocomplete="username"]', + 'input[type="text"]:first-of-type', + ]; + + let usernameField = null; + for (const selector of usernameSelectors) { + usernameField = await page.$(selector); + if (usernameField) break; + } + + if (!usernameField) { + console.error('Could not find username/email field'); + return false; + } + + await usernameField.fill(credentials.username); + console.log('Filled username field'); + + // Find and fill password field + const passwordSelectors = [ + 'input[type="password"]', + 'input[name*="password" i]', + 'input[id*="password" i]', + 'input[autocomplete="current-password"]', + ]; + + let passwordField = null; + for (const selector of passwordSelectors) { + passwordField = await page.$(selector); + if (passwordField) break; + } + + if (!passwordField) { + console.error('Could not find password field'); + return false; + } + + await passwordField.fill(credentials.password); + console.log('Filled password field'); + + // Check for "Remember me" checkbox and check it + const rememberCheckbox = await page.$( + 'input[type="checkbox"][name*="remember" i], input[type="checkbox"][id*="remember" i]' + ); + if (rememberCheckbox) { + await rememberCheckbox.check(); + console.log('Checked "Remember me" checkbox'); + } + + // Find and click submit button + const submitSelectors = [ + 'button[type="submit"]', + 'input[type="submit"]', + 'button:has-text("Sign in")', + 'button:has-text("Log in")', + 'button:has-text("Login")', + 'button:has-text("Submit")', + '[role="button"]:has-text("Sign in")', + ]; + + let submitButton = null; + for (const selector of submitSelectors) { + submitButton = await page.$(selector); + if (submitButton) break; + } + + if (!submitButton) { + // Try pressing Enter as fallback + await passwordField.press('Enter'); + } else { + await submitButton.click(); + } + + console.log('Submitted login form'); + + // Wait for navigation or error + try { + await page.waitForNavigation({ timeout, waitUntil: 'domcontentloaded' }); + return true; + } catch { + // Check if we're still on login page with error + const errorMessages = await page.$$eval( + '.error, .alert-danger, [role="alert"], .login-error', + (els) => els.map((el) => el.textContent?.trim()).filter(Boolean) + ); + + if (errorMessages.length > 0) { + console.error('Login error:', errorMessages.join(', ')); + return false; + } + + return true; // Might have succeeded without navigation + } +} + +// Handle Microsoft SSO login +async function handleMsalLogin( + page: Page, + credentials: { username: string; password: string }, + timeout: number +): Promise<boolean> { + console.log('Attempting Microsoft SSO login...'); + + const currentUrl = page.url(); + + // If not already on Microsoft login, wait for redirect + if (!currentUrl.includes('login.microsoftonline.com')) { + try { + await page.waitForURL('**/login.microsoftonline.com/**', { timeout: 10000 }); + } catch { + console.log('Not redirected to Microsoft login'); + return false; + } + } + + // Wait for email input + const emailInput = await page.waitForSelector( + 'input[type="email"], input[name="loginfmt"]', + { timeout } + ); + + if (!emailInput) { + console.error('Could not find email input on Microsoft login'); + return false; + } + + // Fill email and submit + await emailInput.fill(credentials.username); + console.log('Filled email field'); + + const nextButton = await page.$('input[type="submit"], button[type="submit"]'); + if (nextButton) { + await nextButton.click(); + } else { + await emailInput.press('Enter'); + } + + // Wait for password page + try { + await page.waitForSelector( + 'input[type="password"], input[name="passwd"]', + { timeout } + ); + } catch { + // Might be using passwordless auth or different flow + console.log('Password field not found - might be using different auth flow'); + return false; + } + + // Fill password + const passwordInput = await page.$('input[type="password"], input[name="passwd"]'); + if (!passwordInput) { + console.error('Could not find password input'); + return false; + } + + await passwordInput.fill(credentials.password); + console.log('Filled password field'); + + // Submit + const signInButton = await page.$('input[type="submit"], button[type="submit"]'); + if (signInButton) { + await signInButton.click(); + } else { + await passwordInput.press('Enter'); + } + + // Handle "Stay signed in?" prompt + try { + const staySignedInButton = await page.waitForSelector( + 'input[value="Yes"], button:has-text("Yes")', + { timeout: 5000 } + ); + if (staySignedInButton) { + await staySignedInButton.click(); + console.log('Clicked "Stay signed in" button'); + } + } catch { + // Prompt might not appear + } + + // Check for Conditional Access Policy error + const caError = await page.$('text=Conditional Access policy'); + if (caError) { + console.error('Blocked by Conditional Access Policy'); + // Take screenshot for debugging + await page.screenshot({ path: 'ca-policy-error.png' }); + console.log('Screenshot saved: ca-policy-error.png'); + return false; + } + + // Wait for redirect away from Microsoft login + try { + await page.waitForURL( + (url) => !url.href.includes('login.microsoftonline.com'), + { timeout } + ); + return true; + } catch { + return false; + } +} + +// Check if user is already authenticated +async function isAuthenticated(page: Page, targetUrl: string): Promise<boolean> { + const currentUrl = page.url(); + + // If we're on the target URL (not a login page), we're likely authenticated + if (currentUrl.startsWith(targetUrl)) { + // Check for common login page indicators + const isLoginPage = await page.evaluate(() => { + const loginIndicators = [ + 'input[type="password"]', + 'form[action*="login"]', + 'form[action*="signin"]', + '.login-form', + '#login', + ]; + return loginIndicators.some((sel) => document.querySelector(sel) !== null); + }); + + return !isLoginPage; + } + + return false; +} + +// Main authentication function +export async function authenticate(options: AuthOptions): Promise<AuthResult> { + const browser = await launchBrowser({ headless: options.headless ?? true }); + const page = await browser.newPage(); + const timeout = options.timeout ?? 30000; + + try { + // Navigate to URL + console.log(`Navigating to: ${options.url}`); + await page.goto(options.url, { timeout: 60000, waitUntil: 'domcontentloaded' }); + + // Check if already authenticated + if (await isAuthenticated(page, options.url)) { + return { + success: true, + finalUrl: page.url(), + authType: 'auto', + message: 'Already authenticated (session persisted from profile)', + }; + } + + // Get credentials + const credentials = options.credentials + ? options.credentials + : getCredentials(); + + if (!credentials) { + // No credentials - open interactive browser + console.log('\nNo credentials provided. Opening browser for manual login...'); + console.log('Please complete the login process manually.'); + console.log('The session will be saved to your profile.'); + + // Switch to headed mode for manual login + await browser.close(); + const interactiveBrowser = await launchBrowser({ headless: false }); + const interactivePage = await interactiveBrowser.newPage(); + await interactivePage.goto(options.url); + + await promptUser('\nPress Enter when you have completed login...'); + + const finalUrl = interactivePage.url(); + await interactiveBrowser.close(); + + return { + success: true, + finalUrl, + authType: 'auto', + message: 'Manual login completed - session saved to profile', + }; + } + + // Detect auth type if auto + let authType = options.authType; + if (authType === 'auto') { + authType = await detectAuthType(page); + console.log(`Detected auth type: ${authType}`); + } + + // Handle authentication based on type + let success = false; + switch (authType) { + case 'msal': + success = await handleMsalLogin(page, credentials, timeout); + break; + case 'form': + default: + success = await handleFormLogin(page, credentials, timeout); + break; + } + + const finalUrl = page.url(); + + return { + success, + finalUrl, + authType, + message: success + ? `Authentication successful - session saved to profile` + : 'Authentication failed', + }; + } finally { + await browser.close(); + } +} + +// Navigate to authenticated page (handles auth if needed) +export async function navigateAuthenticated( + url: string, + options?: { + credentials?: { username: string; password: string }; + headless?: boolean; + } +): Promise<{ page: Page; browser: BrowserContext }> { + const { page, browser } = await getPage({ headless: options?.headless ?? true }); + + await page.goto(url, { timeout: 60000, waitUntil: 'domcontentloaded' }); + + // Check if we need to authenticate + if (!(await isAuthenticated(page, url))) { + console.log('Session expired or not authenticated. Attempting login...'); + + // Get credentials + const credentials = options?.credentials ?? getCredentials(); + + if (!credentials) { + throw new Error( + 'Authentication required but no credentials provided. ' + + 'Set CLOAKBROWSER_USERNAME and CLOAKBROWSER_PASSWORD environment variables.' + ); + } + + // Detect and handle auth + const authType = await detectAuthType(page); + + let success = false; + if (authType === 'msal') { + success = await handleMsalLogin(page, credentials, 30000); + } else { + success = await handleFormLogin(page, credentials, 30000); + } + + if (!success) { + await browser.close(); + throw new Error('Authentication failed'); + } + + // Navigate back to original URL if we were redirected + if (!page.url().startsWith(url)) { + await page.goto(url, { timeout: 60000, waitUntil: 'domcontentloaded' }); + } + } + + return { page, browser }; +} + +// CLI entry point +async function main() { + const args = parseArgs(process.argv.slice(2), { + string: ['url', 'type', 'username', 'password'], + boolean: ['headless', 'help'], + default: { + type: 'auto', + headless: false, // Default to headed for auth so user can see/interact + }, + alias: { + u: 'url', + t: 'type', + h: 'help', + }, + }); + + if (args.help || !args.url) { + console.log(` +Web Authentication Handler + +Usage: + npx tsx auth.ts --url <url> [options] + +Options: + -u, --url <url> URL to authenticate (required) + -t, --type <type> Auth type: auto, form, or msal (default: auto) + --username <user> Username/email (or set CLOAKBROWSER_USERNAME env var) + --password <pass> Password (or set CLOAKBROWSER_PASSWORD env var) + --headless <bool> Run in headless mode (default: false for auth) + -h, --help Show this help message + +Auth Types: + auto Auto-detect authentication type + form Generic username/password form + msal Microsoft SSO (login.microsoftonline.com) + +Environment Variables: + CLOAKBROWSER_USERNAME Default username/email for authentication + CLOAKBROWSER_PASSWORD Default password for authentication + +Examples: + # Interactive login (no credentials, opens browser) + npx tsx auth.ts --url "https://example.com/login" + + # Form login with credentials + npx tsx auth.ts --url "https://example.com/login" --type form \\ + --username "user@example.com" --password "secret" + + # Microsoft SSO login + CLOAKBROWSER_USERNAME=user@company.com CLOAKBROWSER_PASSWORD=secret \\ + npx tsx auth.ts --url "https://internal.company.com" --type msal + +Notes: + - Session is saved to ~/.cloakbrowser-profile/ for persistence + - After successful auth, subsequent browses will be authenticated + - Use --headless false if you need to handle MFA manually +`); + process.exit(args.help ? 0 : 1); + } + + const authType = args.type as AuthType; + if (!['auto', 'form', 'msal'].includes(authType)) { + console.error(`Invalid auth type: ${authType}. Must be auto, form, or msal.`); + process.exit(1); + } + + try { + const result = await authenticate({ + url: args.url, + authType, + credentials: + args.username && args.password + ? { username: args.username, password: args.password } + : undefined, + headless: args.headless, + }); + + console.log(`\nAuthentication result:`); + console.log(` Success: ${result.success}`); + console.log(` Auth type: ${result.authType}`); + console.log(` Final URL: ${result.finalUrl}`); + console.log(` Message: ${result.message}`); + + process.exit(result.success ? 0 : 1); + } catch (error) { + console.error('Error:', error instanceof Error ? error.message : error); + process.exit(1); + } +} + +// Run if executed directly +const isMainModule = process.argv[1]?.includes('auth.ts'); +if (isMainModule) { + main(); +} diff --git a/skills/web-automation/shared/browse.ts b/skills/web-automation/shared/browse.ts new file mode 100644 index 0000000..5c25c1d --- /dev/null +++ b/skills/web-automation/shared/browse.ts @@ -0,0 +1,151 @@ +#!/usr/bin/env npx tsx + +/** + * Browser launcher using CloakBrowser with persistent profile + * + * Usage: + * npx tsx browse.ts --url "https://example.com" + * npx tsx browse.ts --url "https://example.com" --screenshot --output page.png + * npx tsx browse.ts --url "https://example.com" --headless false --wait 5000 + */ + +import parseArgs from 'minimist'; +import type { BrowserContext } from 'playwright-core'; + +import { getProfilePath, launchBrowser, getPage } from './lib/browser.js'; + +// Re-export shared helpers so existing imports of browse.ts continue to work. +export { getProfilePath, launchBrowser, getPage }; + +interface BrowseOptions { + url: string; + headless?: boolean; + screenshot?: boolean; + output?: string; + wait?: number; + timeout?: number; + interactive?: boolean; +} + +interface BrowseResult { + title: string; + url: string; + screenshotPath?: string; +} + +function sleep(ms: number): Promise<void> { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +export async function browse(options: BrowseOptions): Promise<BrowseResult> { + const browser = await launchBrowser({ headless: options.headless }); + const page = browser.pages()[0] || await browser.newPage(); + + try { + console.log(`Navigating to: ${options.url}`); + await page.goto(options.url, { + timeout: options.timeout ?? 60000, + waitUntil: 'domcontentloaded', + }); + + if (options.wait) { + console.log(`Waiting ${options.wait}ms...`); + await sleep(options.wait); + } + + const result: BrowseResult = { + title: await page.title(), + url: page.url(), + }; + + console.log(`Page title: ${result.title}`); + console.log(`Final URL: ${result.url}`); + + if (options.screenshot) { + const outputPath = options.output ?? 'screenshot.png'; + await page.screenshot({ path: outputPath, fullPage: true }); + result.screenshotPath = outputPath; + console.log(`Screenshot saved: ${outputPath}`); + } + + if (options.interactive) { + console.log('\nInteractive mode - browser will stay open.'); + console.log('Press Ctrl+C to close.'); + await new Promise(() => {}); + } + + return result; + } finally { + if (!options.interactive) { + await browser.close(); + } + } +} + +async function main() { + const args = parseArgs(process.argv.slice(2), { + string: ['url', 'output'], + boolean: ['screenshot', 'headless', 'interactive', 'help'], + default: { + headless: true, + screenshot: false, + interactive: false, + }, + alias: { + u: 'url', + o: 'output', + s: 'screenshot', + h: 'help', + i: 'interactive', + }, + }); + + if (args.help || !args.url) { + console.log(` +Web Browser with CloakBrowser + +Usage: + npx tsx browse.ts --url <url> [options] + +Options: + -u, --url <url> URL to navigate to (required) + -s, --screenshot Take a screenshot of the page + -o, --output <path> Output path for screenshot (default: screenshot.png) + --headless <bool> Run in headless mode (default: true) + --wait <ms> Wait time after page load in milliseconds + --timeout <ms> Navigation timeout (default: 60000) + -i, --interactive Keep browser open for manual interaction + -h, --help Show this help message + +Examples: + npx tsx browse.ts --url "https://example.com" + npx tsx browse.ts --url "https://example.com" --screenshot --output page.png + npx tsx browse.ts --url "https://example.com" --headless false --interactive + +Environment Variables: + CLOAKBROWSER_PROFILE_PATH Custom profile directory (default: ~/.cloakbrowser-profile/) + CLOAKBROWSER_HEADLESS Default headless mode (true/false) +`); + process.exit(args.help ? 0 : 1); + } + + try { + await browse({ + url: args.url, + headless: args.headless, + screenshot: args.screenshot, + output: args.output, + wait: args.wait ? parseInt(args.wait, 10) : undefined, + timeout: args.timeout ? parseInt(args.timeout, 10) : undefined, + interactive: args.interactive, + }); + } catch (error) { + console.error('Error:', error instanceof Error ? error.message : error); + process.exit(1); + } +} + +const isMainModule = process.argv[1]?.includes('browse.ts'); +if (isMainModule) { + main(); +} diff --git a/skills/web-automation/shared/check-install.js b/skills/web-automation/shared/check-install.js new file mode 100644 index 0000000..50e4884 --- /dev/null +++ b/skills/web-automation/shared/check-install.js @@ -0,0 +1,40 @@ +#!/usr/bin/env node + +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +function fail(message, details) { + const payload = { error: message }; + if (details) payload.details = details; + process.stderr.write(`${JSON.stringify(payload)}\n`); + process.exit(1); +} + +async function main() { + try { + await import("cloakbrowser"); + await import("playwright-core"); + } catch (error) { + fail( + "Missing dependency/config: web-automation requires cloakbrowser and playwright-core.", + error instanceof Error ? error.message : String(error) + ); + } + + const browsePath = path.join(__dirname, "browse.ts"); + const browseSource = fs.readFileSync(browsePath, "utf8"); + if (!/launchPersistentContext/.test(browseSource) || !/from ['"]cloakbrowser['"]/.test(browseSource)) { + fail("browse.ts is not configured for CloakBrowser."); + } + + process.stdout.write("OK: cloakbrowser + playwright-core installed\n"); + process.stdout.write("OK: CloakBrowser integration detected in browse.ts\n"); +} + +main().catch((error) => { + fail("Install check failed.", error instanceof Error ? error.message : String(error)); +}); diff --git a/skills/web-automation/shared/extract.js b/skills/web-automation/shared/extract.js new file mode 100755 index 0000000..5e3908a --- /dev/null +++ b/skills/web-automation/shared/extract.js @@ -0,0 +1,188 @@ +#!/usr/bin/env node + +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const DEFAULT_WAIT_MS = 5000; +const MAX_WAIT_MS = 20000; +const NAV_TIMEOUT_MS = 30000; +const EXTRA_CHALLENGE_WAIT_MS = 8000; +const CONTENT_LIMIT = 12000; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +function fail(message, details) { + const payload = { error: message }; + if (details) payload.details = details; + process.stderr.write(`${JSON.stringify(payload)}\n`); + process.exit(1); +} + +function parseWaitTime(raw) { + const value = Number.parseInt(raw || `${DEFAULT_WAIT_MS}`, 10); + if (!Number.isFinite(value) || value < 0) return DEFAULT_WAIT_MS; + return Math.min(value, MAX_WAIT_MS); +} + +function parseTarget(rawUrl) { + if (!rawUrl) { + fail("Missing URL. Usage: node extract.js <URL>"); + } + + let parsed; + try { + parsed = new URL(rawUrl); + } catch (error) { + fail("Invalid URL.", error.message); + } + + if (!["http:", "https:"].includes(parsed.protocol)) { + fail("Only http and https URLs are allowed."); + } + + return parsed.toString(); +} + +function ensureParentDir(filePath) { + if (!filePath) return; + fs.mkdirSync(path.dirname(filePath), { recursive: true }); +} + +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +async function detectChallenge(page) { + try { + return await page.evaluate(() => { + const text = (document.body?.innerText || "").toLowerCase(); + return ( + text.includes("checking your browser") || + text.includes("just a moment") || + text.includes("verify you are human") || + text.includes("press and hold") || + document.querySelector('iframe[src*="challenge"]') !== null || + document.querySelector('iframe[src*="cloudflare"]') !== null + ); + }); + } catch { + return false; + } +} + +async function loadCloakBrowser() { + try { + return await import("cloakbrowser"); + } catch (error) { + fail( + "CloakBrowser is not installed for this skill. Run pnpm install in this skill's scripts directory first.", + error.message + ); + } +} + +async function runWithStderrLogs(fn) { + const originalLog = console.log; + const originalError = console.error; + console.log = (...args) => process.stderr.write(`${args.join(" ")}\n`); + console.error = (...args) => process.stderr.write(`${args.join(" ")}\n`); + try { + return await fn(); + } finally { + console.log = originalLog; + console.error = originalError; + } +} + +async function main() { + const requestedUrl = parseTarget(process.argv[2]); + const waitTime = parseWaitTime(process.env.WAIT_TIME); + const screenshotPath = process.env.SCREENSHOT_PATH || ""; + const saveHtml = process.env.SAVE_HTML === "true"; + const headless = process.env.HEADLESS !== "false"; + const userAgent = process.env.USER_AGENT || undefined; + const startedAt = Date.now(); + const { ensureBinary, launchContext } = await loadCloakBrowser(); + + let context; + try { + await runWithStderrLogs(() => ensureBinary()); + + context = await runWithStderrLogs(() => launchContext({ + headless, + userAgent, + locale: "en-US", + viewport: { width: 1440, height: 900 }, + humanize: true, + })); + + const page = await context.newPage(); + const response = await page.goto(requestedUrl, { + waitUntil: "domcontentloaded", + timeout: NAV_TIMEOUT_MS + }); + + await sleep(waitTime); + + let challengeDetected = await detectChallenge(page); + if (challengeDetected) { + await sleep(EXTRA_CHALLENGE_WAIT_MS); + challengeDetected = await detectChallenge(page); + } + + const extracted = await page.evaluate((contentLimit) => { + const bodyText = document.body?.innerText || ""; + return { + finalUrl: window.location.href, + title: document.title || "", + content: bodyText.slice(0, contentLimit), + metaDescription: + document.querySelector('meta[name="description"]')?.content || + document.querySelector('meta[property="og:description"]')?.content || + "" + }; + }, CONTENT_LIMIT); + + const result = { + requestedUrl, + finalUrl: extracted.finalUrl, + title: extracted.title, + content: extracted.content, + metaDescription: extracted.metaDescription, + status: response ? response.status() : null, + challengeDetected, + elapsedSeconds: ((Date.now() - startedAt) / 1000).toFixed(2) + }; + + if (screenshotPath) { + ensureParentDir(screenshotPath); + await page.screenshot({ path: screenshotPath, fullPage: false, timeout: 10000 }); + result.screenshot = screenshotPath; + } + + if (saveHtml) { + const htmlTarget = screenshotPath + ? screenshotPath.replace(/\.[^.]+$/, ".html") + : path.resolve(__dirname, `page-${Date.now()}.html`); + ensureParentDir(htmlTarget); + fs.writeFileSync(htmlTarget, await page.content()); + result.htmlFile = htmlTarget; + } + + process.stdout.write(`${JSON.stringify(result, null, 2)}\n`); + await context.close(); + } catch (error) { + if (context) { + try { + await context.close(); + } catch { + // Ignore close errors after the primary failure. + } + } + fail("Scrape failed.", error.message); + } +} + +main(); diff --git a/skills/web-automation/shared/flow.ts b/skills/web-automation/shared/flow.ts new file mode 100644 index 0000000..8161a77 --- /dev/null +++ b/skills/web-automation/shared/flow.ts @@ -0,0 +1,329 @@ +#!/usr/bin/env npx tsx + +import parseArgs from 'minimist'; +import type { Page } from 'playwright-core'; +import { launchBrowser } from './lib/browser.js'; + +type Step = + | { action: 'goto'; url: string } + | { action: 'click'; selector?: string; text?: string; role?: string; name?: string } + | { action: 'type'; selector?: string; text: string } + | { action: 'press'; key: string; selector?: string } + | { action: 'wait'; ms: number } + | { action: 'screenshot'; path: string } + | { action: 'extract'; selector: string; count?: number }; + +function normalizeNavigationUrl(rawUrl: string): string { + let parsed: URL; + try { + parsed = new URL(rawUrl); + } catch { + throw new Error(`Invalid navigation URL: ${rawUrl}`); + } + + if (!['http:', 'https:'].includes(parsed.protocol)) { + throw new Error(`Only http and https URLs are allowed in flow steps: ${rawUrl}`); + } + + return parsed.toString(); +} + +function normalizeKey(k: string): string { + if (!k) return 'Enter'; + const lower = k.toLowerCase(); + if (lower === 'enter' || lower === 'return') return 'Enter'; + if (lower === 'tab') return 'Tab'; + if (lower === 'escape' || lower === 'esc') return 'Escape'; + return k; +} + +function splitInstructions(instruction: string): string[] { + return instruction + .split(/\bthen\b|;/gi) + .map((s) => s.trim()) + .filter(Boolean); +} + +function parseInstruction(instruction: string): Step[] { + const parts = splitInstructions(instruction); + const steps: Step[] = []; + + for (const p of parts) { + // go to https://... + const goto = p.match(/^(?:go to|open|navigate to)\s+(https?:\/\/\S+)/i); + if (goto) { + steps.push({ action: 'goto', url: normalizeNavigationUrl(goto[1]) }); + continue; + } + + // click on "text" or click #selector or click button "name" + const clickRole = p.match(/^click\s+(button|link|textbox|img|image|tab)\s+"([^"]+)"$/i); + if (clickRole) { + const role = clickRole[1].toLowerCase() === 'image' ? 'img' : clickRole[1].toLowerCase(); + steps.push({ action: 'click', role, name: clickRole[2] }); + continue; + } + const clickText = p.match(/^click(?: on)?\s+"([^"]+)"/i); + if (clickText) { + steps.push({ action: 'click', text: clickText[1] }); + continue; + } + const clickSelector = p.match(/^click(?: on)?\s+(#[\w-]+|\.[\w-]+|[a-z]+\[[^\]]+\])/i); + if (clickSelector) { + steps.push({ action: 'click', selector: clickSelector[1] }); + continue; + } + + // type "text" [in selector] + const typeInto = p.match(/^type\s+"([^"]+)"\s+in\s+(.+)$/i); + if (typeInto) { + steps.push({ action: 'type', text: typeInto[1], selector: typeInto[2].trim() }); + continue; + } + const typeOnly = p.match(/^type\s+"([^"]+)"$/i); + if (typeOnly) { + steps.push({ action: 'type', text: typeOnly[1] }); + continue; + } + + // press enter [in selector] + const pressIn = p.match(/^press\s+(\w+)\s+in\s+(.+)$/i); + if (pressIn) { + steps.push({ action: 'press', key: normalizeKey(pressIn[1]), selector: pressIn[2].trim() }); + continue; + } + const pressOnly = p.match(/^press\s+(\w+)$/i); + if (pressOnly) { + steps.push({ action: 'press', key: normalizeKey(pressOnly[1]) }); + continue; + } + + // wait 2s / wait 500ms + const waitS = p.match(/^wait\s+(\d+)\s*s(?:ec(?:onds?)?)?$/i); + if (waitS) { + steps.push({ action: 'wait', ms: parseInt(waitS[1], 10) * 1000 }); + continue; + } + const waitMs = p.match(/^wait\s+(\d+)\s*ms$/i); + if (waitMs) { + steps.push({ action: 'wait', ms: parseInt(waitMs[1], 10) }); + continue; + } + + // screenshot path + const shot = p.match(/^screenshot(?: to)?\s+(.+)$/i); + if (shot) { + steps.push({ action: 'screenshot', path: shot[1].trim() }); + continue; + } + + throw new Error(`Could not parse step: "${p}"`); + } + + return steps; +} + +function validateSteps(steps: Step[]): Step[] { + return steps.map((step) => + step.action === 'goto' + ? { + ...step, + url: normalizeNavigationUrl(step.url), + } + : step + ); +} + +function escapeRegExp(value: string): string { + return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} + +function isLikelyLoginText(text: string): boolean { + return /(login|accedi|sign\s*in|entra)/i.test(text); +} + +async function clickByText(page: Page, text: string): Promise<boolean> { + const patterns = [new RegExp(`^${escapeRegExp(text)}$`, 'i'), new RegExp(escapeRegExp(text), 'i')]; + + for (const pattern of patterns) { + const targets = [ + page.getByRole('button', { name: pattern }).first(), + page.getByRole('link', { name: pattern }).first(), + page.getByText(pattern).first(), + ]; + + for (const target of targets) { + if (await target.count()) { + try { + await target.click({ timeout: 8000 }); + return true; + } catch { + // keep trying next candidate + } + } + } + } + + return false; +} + +async function fallbackLoginNavigation(page: Page, requestedText: string): Promise<boolean> { + if (!isLikelyLoginText(requestedText)) return false; + + const current = new URL(page.url()); + + const candidateLinks = await page.evaluate(() => { + const loginTerms = ['login', 'accedi', 'sign in', 'entra']; + const anchors = Array.from(document.querySelectorAll('a[href], a[onclick], button[onclick]')) as Array<HTMLAnchorElement | HTMLButtonElement>; + + return anchors + .map((el) => { + const text = (el.textContent || '').trim().toLowerCase(); + const href = (el as HTMLAnchorElement).getAttribute('href') || ''; + return { text, href }; + }) + .filter((x) => x.text && loginTerms.some((t) => x.text.includes(t))) + .map((x) => x.href) + .filter(Boolean); + }); + + // Prefer real URLs (not javascript:) + const realCandidate = candidateLinks.find((h) => /login|account\/login/i.test(h) && !h.startsWith('javascript:')); + if (realCandidate) { + const target = new URL(realCandidate, page.url()).toString(); + await page.goto(target, { waitUntil: 'domcontentloaded', timeout: 60000 }); + return true; + } + + // Site-specific fallback for Corriere + if (/corriere\.it$/i.test(current.hostname) || /\.corriere\.it$/i.test(current.hostname)) { + await page.goto('https://www.corriere.it/account/login', { + waitUntil: 'domcontentloaded', + timeout: 60000, + }); + return true; + } + + return false; +} + +async function typeInBestTarget(page: Page, text: string, selector?: string) { + if (selector) { + await page.locator(selector).first().click({ timeout: 10000 }); + await page.locator(selector).first().fill(text); + return; + } + const loc = page.locator('input[name="q"], input[type="search"], input[type="text"], textarea').first(); + await loc.click({ timeout: 10000 }); + await loc.fill(text); +} + +async function pressOnTarget(page: Page, key: string, selector?: string) { + if (selector) { + await page.locator(selector).first().press(key); + return; + } + await page.keyboard.press(key); +} + +async function runSteps(page: Page, steps: Step[]) { + for (const step of steps) { + switch (step.action) { + case 'goto': + await page.goto(normalizeNavigationUrl(step.url), { + waitUntil: 'domcontentloaded', + timeout: 60000, + }); + break; + case 'click': + if (step.selector) { + await page.locator(step.selector).first().click({ timeout: 15000 }); + } else if (step.role && step.name) { + await page.getByRole(step.role as any, { name: new RegExp(escapeRegExp(step.name), 'i') }).first().click({ timeout: 15000 }); + } else if (step.text) { + const clicked = await clickByText(page, step.text); + if (!clicked) { + const recovered = await fallbackLoginNavigation(page, step.text); + if (!recovered) { + throw new Error(`Could not click target text: ${step.text}`); + } + } + } else { + throw new Error('click step missing selector/text/role'); + } + try { + await page.waitForLoadState('domcontentloaded', { timeout: 10000 }); + } catch { + // no navigation is fine + } + break; + case 'type': + await typeInBestTarget(page, step.text, step.selector); + break; + case 'press': + await pressOnTarget(page, step.key, step.selector); + break; + case 'wait': + await page.waitForTimeout(step.ms); + break; + case 'screenshot': + await page.screenshot({ path: step.path, fullPage: true }); + break; + case 'extract': { + const items = await page.locator(step.selector).allTextContents(); + const out = items.slice(0, step.count ?? items.length).map((t) => t.trim()).filter(Boolean); + console.log(JSON.stringify(out, null, 2)); + break; + } + default: + throw new Error('Unknown step'); + } + } +} + +async function main() { + const args = parseArgs(process.argv.slice(2), { + string: ['instruction', 'steps'], + boolean: ['headless', 'help'], + default: { headless: true }, + alias: { i: 'instruction', s: 'steps', h: 'help' }, + }); + + if (args.help || (!args.instruction && !args.steps)) { + console.log(` +General Web Flow Runner (CloakBrowser) + +Usage: + npx tsx flow.ts --instruction "go to https://example.com then type \"hello\" then press enter" + npx tsx flow.ts --steps '[{"action":"goto","url":"https://example.com"}]' + +Supported natural steps: + - go to/open/navigate to <url> + - click on "Text" + - click <css-selector> + - type "text" + - type "text" in <css-selector> + - press <key> + - press <key> in <css-selector> + - wait <N>s | wait <N>ms + - screenshot <path> +`); + process.exit(args.help ? 0 : 1); + } + + const steps = validateSteps(args.steps ? JSON.parse(args.steps) : parseInstruction(args.instruction)); + const browser = await launchBrowser({ headless: args.headless }); + const page = await browser.newPage(); + + try { + await runSteps(page, steps); + console.log('Flow complete. Final URL:', page.url()); + } finally { + await browser.close(); + } +} + +main().catch((e) => { + console.error('Error:', e instanceof Error ? e.message : e); + process.exit(1); +}); diff --git a/skills/web-automation/shared/lib/browser.ts b/skills/web-automation/shared/lib/browser.ts new file mode 100644 index 0000000..3cfd664 --- /dev/null +++ b/skills/web-automation/shared/lib/browser.ts @@ -0,0 +1,75 @@ +/** + * Shared browser-launch and profile helpers for web-automation scripts. + * + * Centralises the three reusable primitives that every command entry point + * needs: + * - getProfilePath() — resolve the persistent CloakBrowser profile dir + * - launchBrowser() — launch a CloakBrowser persistent context + * - getPage() — get a ready Page + BrowserContext pair + * + * All command entry points (auth.ts, browse.ts, flow.ts, scan-local-app.ts) + * import from here instead of duplicating these bodies. + */ + +import { launchPersistentContext } from 'cloakbrowser'; +import { existsSync, mkdirSync } from 'fs'; +import { homedir } from 'os'; +import { join } from 'path'; +import type { BrowserContext, Page } from 'playwright-core'; + +/** + * Return the path to the persistent CloakBrowser profile directory. + * + * Uses `CLOAKBROWSER_PROFILE_PATH` env var when set; otherwise defaults to + * `~/.cloakbrowser-profile/` and creates it if it does not exist. + */ +export function getProfilePath(): string { + const customPath = process.env.CLOAKBROWSER_PROFILE_PATH; + if (customPath) return customPath; + + const profileDir = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profileDir)) { + mkdirSync(profileDir, { recursive: true }); + } + return profileDir; +} + +/** + * Launch a CloakBrowser persistent context with the shared profile. + * + * Headless mode is resolved in order: + * 1. `options.headless` (explicit caller preference) + * 2. `CLOAKBROWSER_HEADLESS` env var + * 3. `true` (safe default) + */ +export async function launchBrowser(options: { + headless?: boolean; +}): Promise<BrowserContext> { + const profilePath = getProfilePath(); + const envHeadless = process.env.CLOAKBROWSER_HEADLESS; + const headless = options.headless ?? (envHeadless ? envHeadless === 'true' : true); + + console.log(`Using profile: ${profilePath}`); + console.log(`Headless mode: ${headless}`); + + const context = await launchPersistentContext({ + userDataDir: profilePath, + headless, + humanize: true, + }); + + return context; +} + +/** + * Return a ready `{ page, browser }` pair using the shared persistent profile. + * + * Re-uses the first existing page or opens a new one if the context is empty. + */ +export async function getPage(options?: { + headless?: boolean; +}): Promise<{ page: Page; browser: BrowserContext }> { + const browser = await launchBrowser({ headless: options?.headless }); + const page = browser.pages()[0] || (await browser.newPage()); + return { page, browser }; +} diff --git a/skills/web-automation/shared/package.json b/skills/web-automation/shared/package.json new file mode 100644 index 0000000..a2221e8 --- /dev/null +++ b/skills/web-automation/shared/package.json @@ -0,0 +1,36 @@ +{ + "name": "web-automation-scripts", + "version": "1.0.0", + "description": "Web browsing and scraping scripts using CloakBrowser", + "type": "module", + "scripts": { + "check-install": "node check-install.js", + "extract": "node extract.js", + "browse": "tsx browse.ts", + "auth": "tsx auth.ts", + "flow": "tsx flow.ts", + "scrape": "tsx scrape.ts", + "typecheck": "tsc --noEmit -p tsconfig.json", + "lint": "pnpm run typecheck && node --check check-install.js && node --check extract.js", + "fetch-browser": "npx cloakbrowser install" + }, + "dependencies": { + "@mozilla/readability": "^0.5.0", + "better-sqlite3": "^12.6.2", + "cloakbrowser": "^0.3.22", + "jsdom": "^24.0.0", + "minimist": "^1.2.8", + "playwright-core": "^1.59.1", + "turndown": "^7.1.2", + "turndown-plugin-gfm": "^1.0.2" + }, + "devDependencies": { + "@types/jsdom": "^21.1.6", + "@types/minimist": "^1.2.5", + "@types/turndown": "^5.0.4", + "esbuild": "0.27.0", + "tsx": "^4.7.0", + "typescript": "^5.3.0" + }, + "packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34" +} diff --git a/skills/web-automation/shared/pnpm-lock.yaml b/skills/web-automation/shared/pnpm-lock.yaml new file mode 100644 index 0000000..59dba9c --- /dev/null +++ b/skills/web-automation/shared/pnpm-lock.yaml @@ -0,0 +1,1292 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@mozilla/readability': + specifier: ^0.5.0 + version: 0.5.0 + better-sqlite3: + specifier: ^12.6.2 + version: 12.8.0 + cloakbrowser: + specifier: ^0.3.22 + version: 0.3.22(mmdb-lib@3.0.1)(playwright-core@1.59.1) + jsdom: + specifier: ^24.0.0 + version: 24.1.3 + minimist: + specifier: ^1.2.8 + version: 1.2.8 + playwright-core: + specifier: ^1.59.1 + version: 1.59.1 + turndown: + specifier: ^7.1.2 + version: 7.2.2 + turndown-plugin-gfm: + specifier: ^1.0.2 + version: 1.0.2 + devDependencies: + '@types/jsdom': + specifier: ^21.1.6 + version: 21.1.7 + '@types/minimist': + specifier: ^1.2.5 + version: 1.2.5 + '@types/turndown': + specifier: ^5.0.4 + version: 5.0.6 + esbuild: + specifier: 0.27.0 + version: 0.27.0 + tsx: + specifier: ^4.7.0 + version: 4.21.0 + typescript: + specifier: ^5.3.0 + version: 5.9.3 + +packages: + + '@asamuzakjp/css-color@3.2.0': + resolution: {integrity: sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==} + + '@csstools/color-helpers@5.1.0': + resolution: {integrity: sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==} + engines: {node: '>=18'} + + '@csstools/css-calc@2.1.4': + resolution: {integrity: sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-parser-algorithms': ^3.0.5 + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-color-parser@3.1.0': + resolution: {integrity: sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-parser-algorithms': ^3.0.5 + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-parser-algorithms@3.0.5': + resolution: {integrity: sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-tokenizer@3.0.4': + resolution: {integrity: sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==} + engines: {node: '>=18'} + + '@esbuild/aix-ppc64@0.27.0': + resolution: {integrity: sha512-KuZrd2hRjz01y5JK9mEBSD3Vj3mbCvemhT466rSuJYeE/hjuBrHfjjcjMdTm/sz7au+++sdbJZJmuBwQLuw68A==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + + '@esbuild/android-arm64@0.27.0': + resolution: {integrity: sha512-CC3vt4+1xZrs97/PKDkl0yN7w8edvU2vZvAFGD16n9F0Cvniy5qvzRXjfO1l94efczkkQE6g1x0i73Qf5uthOQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.27.0': + resolution: {integrity: sha512-j67aezrPNYWJEOHUNLPj9maeJte7uSMM6gMoxfPC9hOg8N02JuQi/T7ewumf4tNvJadFkvLZMlAq73b9uwdMyQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.27.0': + resolution: {integrity: sha512-wurMkF1nmQajBO1+0CJmcN17U4BP6GqNSROP8t0X/Jiw2ltYGLHpEksp9MpoBqkrFR3kv2/te6Sha26k3+yZ9Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.27.0': + resolution: {integrity: sha512-uJOQKYCcHhg07DL7i8MzjvS2LaP7W7Pn/7uA0B5S1EnqAirJtbyw4yC5jQ5qcFjHK9l6o/MX9QisBg12kNkdHg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.27.0': + resolution: {integrity: sha512-8mG6arH3yB/4ZXiEnXof5MK72dE6zM9cDvUcPtxhUZsDjESl9JipZYW60C3JGreKCEP+p8P/72r69m4AZGJd5g==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.27.0': + resolution: {integrity: sha512-9FHtyO988CwNMMOE3YIeci+UV+x5Zy8fI2qHNpsEtSF83YPBmE8UWmfYAQg6Ux7Gsmd4FejZqnEUZCMGaNQHQw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.27.0': + resolution: {integrity: sha512-zCMeMXI4HS/tXvJz8vWGexpZj2YVtRAihHLk1imZj4efx1BQzN76YFeKqlDr3bUWI26wHwLWPd3rwh6pe4EV7g==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.27.0': + resolution: {integrity: sha512-AS18v0V+vZiLJyi/4LphvBE+OIX682Pu7ZYNsdUHyUKSoRwdnOsMf6FDekwoAFKej14WAkOef3zAORJgAtXnlQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.27.0': + resolution: {integrity: sha512-t76XLQDpxgmq2cNXKTVEB7O7YMb42atj2Re2Haf45HkaUpjM2J0UuJZDuaGbPbamzZ7bawyGFUkodL+zcE+jvQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.27.0': + resolution: {integrity: sha512-Mz1jxqm/kfgKkc/KLHC5qIujMvnnarD9ra1cEcrs7qshTUSksPihGrWHVG5+osAIQ68577Zpww7SGapmzSt4Nw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.27.0': + resolution: {integrity: sha512-QbEREjdJeIreIAbdG2hLU1yXm1uu+LTdzoq1KCo4G4pFOLlvIspBm36QrQOar9LFduavoWX2msNFAAAY9j4BDg==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.27.0': + resolution: {integrity: sha512-sJz3zRNe4tO2wxvDpH/HYJilb6+2YJxo/ZNbVdtFiKDufzWq4JmKAiHy9iGoLjAV7r/W32VgaHGkk35cUXlNOg==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.27.0': + resolution: {integrity: sha512-z9N10FBD0DCS2dmSABDBb5TLAyF1/ydVb+N4pi88T45efQ/w4ohr/F/QYCkxDPnkhkp6AIpIcQKQ8F0ANoA2JA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.27.0': + resolution: {integrity: sha512-pQdyAIZ0BWIC5GyvVFn5awDiO14TkT/19FTmFcPdDec94KJ1uZcmFs21Fo8auMXzD4Tt+diXu1LW1gHus9fhFQ==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.27.0': + resolution: {integrity: sha512-hPlRWR4eIDDEci953RI1BLZitgi5uqcsjKMxwYfmi4LcwyWo2IcRP+lThVnKjNtk90pLS8nKdroXYOqW+QQH+w==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.27.0': + resolution: {integrity: sha512-1hBWx4OUJE2cab++aVZ7pObD6s+DK4mPGpemtnAORBvb5l/g5xFGk0vc0PjSkrDs0XaXj9yyob3d14XqvnQ4gw==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-arm64@0.27.0': + resolution: {integrity: sha512-6m0sfQfxfQfy1qRuecMkJlf1cIzTOgyaeXaiVaaki8/v+WB+U4hc6ik15ZW6TAllRlg/WuQXxWj1jx6C+dfy3w==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + + '@esbuild/netbsd-x64@0.27.0': + resolution: {integrity: sha512-xbbOdfn06FtcJ9d0ShxxvSn2iUsGd/lgPIO2V3VZIPDbEaIj1/3nBBe1AwuEZKXVXkMmpr6LUAgMkLD/4D2PPA==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-arm64@0.27.0': + resolution: {integrity: sha512-fWgqR8uNbCQ/GGv0yhzttj6sU/9Z5/Sv/VGU3F5OuXK6J6SlriONKrQ7tNlwBrJZXRYk5jUhuWvF7GYzGguBZQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + + '@esbuild/openbsd-x64@0.27.0': + resolution: {integrity: sha512-aCwlRdSNMNxkGGqQajMUza6uXzR/U0dIl1QmLjPtRbLOx3Gy3otfFu/VjATy4yQzo9yFDGTxYDo1FfAD9oRD2A==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + + '@esbuild/openharmony-arm64@0.27.0': + resolution: {integrity: sha512-nyvsBccxNAsNYz2jVFYwEGuRRomqZ149A39SHWk4hV0jWxKM0hjBPm3AmdxcbHiFLbBSwG6SbpIcUbXjgyECfA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + + '@esbuild/sunos-x64@0.27.0': + resolution: {integrity: sha512-Q1KY1iJafM+UX6CFEL+F4HRTgygmEW568YMqDA5UV97AuZSm21b7SXIrRJDwXWPzr8MGr75fUZPV67FdtMHlHA==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.27.0': + resolution: {integrity: sha512-W1eyGNi6d+8kOmZIwi/EDjrL9nxQIQ0MiGqe/AWc6+IaHloxHSGoeRgDRKHFISThLmsewZ5nHFvGFWdBYlgKPg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.27.0': + resolution: {integrity: sha512-30z1aKL9h22kQhilnYkORFYt+3wp7yZsHWus+wSKAJR8JtdfI76LJ4SBdMsCopTR3z/ORqVu5L1vtnHZWVj4cQ==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.27.0': + resolution: {integrity: sha512-aIitBcjQeyOhMTImhLZmtxfdOcuNRpwlPNmlFKPcHQYPhEssw75Cl1TSXJXpMkzaua9FUetx/4OQKq7eJul5Cg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@isaacs/fs-minipass@4.0.1': + resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} + engines: {node: '>=18.0.0'} + + '@mixmark-io/domino@2.2.0': + resolution: {integrity: sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==} + + '@mozilla/readability@0.5.0': + resolution: {integrity: sha512-Z+CZ3QaosfFaTqvhQsIktyGrjFjSC0Fa4EMph4mqKnWhmyoGICsV/8QK+8HpXut6zV7zwfWwqDmEjtk1Qf6EgQ==} + engines: {node: '>=14.0.0'} + + '@types/jsdom@21.1.7': + resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==} + + '@types/minimist@1.2.5': + resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} + + '@types/node@25.0.6': + resolution: {integrity: sha512-NNu0sjyNxpoiW3YuVFfNz7mxSQ+S4X2G28uqg2s+CzoqoQjLPsWSbsFFyztIAqt2vb8kfEAsJNepMGPTxFDx3Q==} + + '@types/tough-cookie@4.0.5': + resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} + + '@types/turndown@5.0.6': + resolution: {integrity: sha512-ru00MoyeeouE5BX4gRL+6m/BsDfbRayOskWqUvh7CLGW+UXxHQItqALa38kKnOiZPqJrtzJUgAC2+F0rL1S4Pg==} + + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + better-sqlite3@12.8.0: + resolution: {integrity: sha512-RxD2Vd96sQDjQr20kdP+F+dK/1OUNiVOl200vKBZY8u0vTwysfolF6Hq+3ZK2+h8My9YvZhHsF+RSGZW2VYrPQ==} + engines: {node: 20.x || 22.x || 23.x || 24.x || 25.x} + + bindings@1.5.0: + resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} + + bl@4.1.0: + resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} + + buffer@5.7.1: + resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + + chownr@1.1.4: + resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==} + + chownr@3.0.0: + resolution: {integrity: sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==} + engines: {node: '>=18'} + + cloakbrowser@0.3.22: + resolution: {integrity: sha512-L2CWQiVdunhKslTli8HCe4INhaAt4npbvsM2Ox4/idqiRmT2BADndQ05eDS8TonNSWeWqbjsh04UhSZOD3B6mg==} + engines: {node: '>=18.0.0'} + hasBin: true + peerDependencies: + mmdb-lib: '>=2.0.0' + playwright-core: '>=1.40.0' + puppeteer-core: '>=21.0.0' + peerDependenciesMeta: + mmdb-lib: + optional: true + playwright-core: + optional: true + puppeteer-core: + optional: true + + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + + cssstyle@4.6.0: + resolution: {integrity: sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==} + engines: {node: '>=18'} + + data-urls@5.0.0: + resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} + engines: {node: '>=18'} + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decimal.js@10.6.0: + resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==} + + decompress-response@6.0.0: + resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} + engines: {node: '>=10'} + + deep-extend@0.6.0: + resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} + engines: {node: '>=4.0.0'} + + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + end-of-stream@1.4.5: + resolution: {integrity: sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==} + + entities@6.0.1: + resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==} + engines: {node: '>=0.12'} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-object-atoms@1.1.1: + resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + + esbuild@0.27.0: + resolution: {integrity: sha512-jd0f4NHbD6cALCyGElNpGAOtWxSq46l9X/sWB0Nzd5er4Kz2YTm+Vl0qKFT9KUJvD8+fiO8AvoHhFvEatfVixA==} + engines: {node: '>=18'} + hasBin: true + + expand-template@2.0.3: + resolution: {integrity: sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==} + engines: {node: '>=6'} + + file-uri-to-path@1.0.0: + resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==} + + form-data@4.0.5: + resolution: {integrity: sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==} + engines: {node: '>= 6'} + + fs-constants@1.0.0: + resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + get-tsconfig@4.13.0: + resolution: {integrity: sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==} + + github-from-package@0.0.0: + resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hasown@2.0.2: + resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} + engines: {node: '>= 0.4'} + + html-encoding-sniffer@4.0.0: + resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} + engines: {node: '>=18'} + + http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + + iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + ini@1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + + is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + + jsdom@24.1.3: + resolution: {integrity: sha512-MyL55p3Ut3cXbeBEG7Hcv0mVM8pp8PBNWxRqchZnSfAiES1v1mRnMeFfaHWIPULpwsYfvO+ZmMZz5tGCnjzDUQ==} + engines: {node: '>=18'} + peerDependencies: + canvas: ^2.11.2 + peerDependenciesMeta: + canvas: + optional: true + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mimic-response@3.1.0: + resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} + engines: {node: '>=10'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + + minizlib@3.1.0: + resolution: {integrity: sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==} + engines: {node: '>= 18'} + + mkdirp-classic@0.5.3: + resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} + + mmdb-lib@3.0.1: + resolution: {integrity: sha512-dyAyMR+cRykZd1mw5altC9f4vKpCsuywPwo8l/L5fKqDay2zmqT0mF/BvUoXnQiqGn+nceO914rkPKJoyFnGxA==} + engines: {node: '>=10', npm: '>=6'} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + napi-build-utils@2.0.0: + resolution: {integrity: sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==} + + node-abi@3.85.0: + resolution: {integrity: sha512-zsFhmbkAzwhTft6nd3VxcG0cvJsT70rL+BIGHWVq5fi6MwGrHwzqKaxXE+Hl2GmnGItnDKPPkO5/LQqjVkIdFg==} + engines: {node: '>=10'} + + nwsapi@2.2.23: + resolution: {integrity: sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ==} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + parse5@7.3.0: + resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==} + + playwright-core@1.59.1: + resolution: {integrity: sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==} + engines: {node: '>=18'} + hasBin: true + + prebuild-install@7.1.3: + resolution: {integrity: sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==} + engines: {node: '>=10'} + deprecated: No longer maintained. Please contact the author of the relevant native addon; alternatives are available. + hasBin: true + + psl@1.15.0: + resolution: {integrity: sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==} + + pump@3.0.3: + resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + + rc@1.2.8: + resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} + hasBin: true + + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + + requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + + rrweb-cssom@0.7.1: + resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==} + + rrweb-cssom@0.8.0: + resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + + semver@7.7.3: + resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} + engines: {node: '>=10'} + hasBin: true + + simple-concat@1.0.1: + resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} + + simple-get@4.0.1: + resolution: {integrity: sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-json-comments@2.0.1: + resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} + engines: {node: '>=0.10.0'} + + symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + + tar-fs@2.1.4: + resolution: {integrity: sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==} + + tar-stream@2.2.0: + resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==} + engines: {node: '>=6'} + + tar@7.5.13: + resolution: {integrity: sha512-tOG/7GyXpFevhXVh8jOPJrmtRpOTsYqUIkVdVooZYJS/z8WhfQUX8RJILmeuJNinGAMSu1veBr4asSHFt5/hng==} + engines: {node: '>=18'} + + tough-cookie@4.1.4: + resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==} + engines: {node: '>=6'} + + tr46@5.1.1: + resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==} + engines: {node: '>=18'} + + tsx@4.21.0: + resolution: {integrity: sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==} + engines: {node: '>=18.0.0'} + hasBin: true + + tunnel-agent@0.6.0: + resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} + + turndown-plugin-gfm@1.0.2: + resolution: {integrity: sha512-vwz9tfvF7XN/jE0dGoBei3FXWuvll78ohzCZQuOb+ZjWrs3a0XhQVomJEb2Qh4VHTPNRO4GPZh0V7VRbiWwkRg==} + + turndown@7.2.2: + resolution: {integrity: sha512-1F7db8BiExOKxjSMU2b7if62D/XOyQyZbPKq/nUwopfgnHlqXHqQ0lvfUTeUIr1lZJzOPFn43dODyMSIfvWRKQ==} + + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + + undici-types@7.16.0: + resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} + + universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + + url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + w3c-xmlserializer@5.0.0: + resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} + engines: {node: '>=18'} + + webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + + whatwg-encoding@3.1.1: + resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} + engines: {node: '>=18'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation + + whatwg-mimetype@4.0.0: + resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} + engines: {node: '>=18'} + + whatwg-url@14.2.0: + resolution: {integrity: sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==} + engines: {node: '>=18'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + ws@8.19.0: + resolution: {integrity: sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + xml-name-validator@5.0.0: + resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} + engines: {node: '>=18'} + + xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + + yallist@5.0.0: + resolution: {integrity: sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==} + engines: {node: '>=18'} + +snapshots: + + '@asamuzakjp/css-color@3.2.0': + dependencies: + '@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-color-parser': 3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + lru-cache: 10.4.3 + + '@csstools/color-helpers@5.1.0': {} + + '@csstools/css-calc@2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-color-parser@3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/color-helpers': 5.1.0 + '@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-tokenizer@3.0.4': {} + + '@esbuild/aix-ppc64@0.27.0': + optional: true + + '@esbuild/android-arm64@0.27.0': + optional: true + + '@esbuild/android-arm@0.27.0': + optional: true + + '@esbuild/android-x64@0.27.0': + optional: true + + '@esbuild/darwin-arm64@0.27.0': + optional: true + + '@esbuild/darwin-x64@0.27.0': + optional: true + + '@esbuild/freebsd-arm64@0.27.0': + optional: true + + '@esbuild/freebsd-x64@0.27.0': + optional: true + + '@esbuild/linux-arm64@0.27.0': + optional: true + + '@esbuild/linux-arm@0.27.0': + optional: true + + '@esbuild/linux-ia32@0.27.0': + optional: true + + '@esbuild/linux-loong64@0.27.0': + optional: true + + '@esbuild/linux-mips64el@0.27.0': + optional: true + + '@esbuild/linux-ppc64@0.27.0': + optional: true + + '@esbuild/linux-riscv64@0.27.0': + optional: true + + '@esbuild/linux-s390x@0.27.0': + optional: true + + '@esbuild/linux-x64@0.27.0': + optional: true + + '@esbuild/netbsd-arm64@0.27.0': + optional: true + + '@esbuild/netbsd-x64@0.27.0': + optional: true + + '@esbuild/openbsd-arm64@0.27.0': + optional: true + + '@esbuild/openbsd-x64@0.27.0': + optional: true + + '@esbuild/openharmony-arm64@0.27.0': + optional: true + + '@esbuild/sunos-x64@0.27.0': + optional: true + + '@esbuild/win32-arm64@0.27.0': + optional: true + + '@esbuild/win32-ia32@0.27.0': + optional: true + + '@esbuild/win32-x64@0.27.0': + optional: true + + '@isaacs/fs-minipass@4.0.1': + dependencies: + minipass: 7.1.2 + + '@mixmark-io/domino@2.2.0': {} + + '@mozilla/readability@0.5.0': {} + + '@types/jsdom@21.1.7': + dependencies: + '@types/node': 25.0.6 + '@types/tough-cookie': 4.0.5 + parse5: 7.3.0 + + '@types/minimist@1.2.5': {} + + '@types/node@25.0.6': + dependencies: + undici-types: 7.16.0 + + '@types/tough-cookie@4.0.5': {} + + '@types/turndown@5.0.6': {} + + agent-base@7.1.4: {} + + asynckit@0.4.0: {} + + base64-js@1.5.1: {} + + better-sqlite3@12.8.0: + dependencies: + bindings: 1.5.0 + prebuild-install: 7.1.3 + + bindings@1.5.0: + dependencies: + file-uri-to-path: 1.0.0 + + bl@4.1.0: + dependencies: + buffer: 5.7.1 + inherits: 2.0.4 + readable-stream: 3.6.2 + + buffer@5.7.1: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + chownr@1.1.4: {} + + chownr@3.0.0: {} + + cloakbrowser@0.3.22(mmdb-lib@3.0.1)(playwright-core@1.59.1): + dependencies: + tar: 7.5.13 + optionalDependencies: + mmdb-lib: 3.0.1 + playwright-core: 1.59.1 + + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + + cssstyle@4.6.0: + dependencies: + '@asamuzakjp/css-color': 3.2.0 + rrweb-cssom: 0.8.0 + + data-urls@5.0.0: + dependencies: + whatwg-mimetype: 4.0.0 + whatwg-url: 14.2.0 + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + decimal.js@10.6.0: {} + + decompress-response@6.0.0: + dependencies: + mimic-response: 3.1.0 + + deep-extend@0.6.0: {} + + delayed-stream@1.0.0: {} + + detect-libc@2.1.2: {} + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + end-of-stream@1.4.5: + dependencies: + once: 1.4.0 + + entities@6.0.1: {} + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-object-atoms@1.1.1: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + + esbuild@0.27.0: + optionalDependencies: + '@esbuild/aix-ppc64': 0.27.0 + '@esbuild/android-arm': 0.27.0 + '@esbuild/android-arm64': 0.27.0 + '@esbuild/android-x64': 0.27.0 + '@esbuild/darwin-arm64': 0.27.0 + '@esbuild/darwin-x64': 0.27.0 + '@esbuild/freebsd-arm64': 0.27.0 + '@esbuild/freebsd-x64': 0.27.0 + '@esbuild/linux-arm': 0.27.0 + '@esbuild/linux-arm64': 0.27.0 + '@esbuild/linux-ia32': 0.27.0 + '@esbuild/linux-loong64': 0.27.0 + '@esbuild/linux-mips64el': 0.27.0 + '@esbuild/linux-ppc64': 0.27.0 + '@esbuild/linux-riscv64': 0.27.0 + '@esbuild/linux-s390x': 0.27.0 + '@esbuild/linux-x64': 0.27.0 + '@esbuild/netbsd-arm64': 0.27.0 + '@esbuild/netbsd-x64': 0.27.0 + '@esbuild/openbsd-arm64': 0.27.0 + '@esbuild/openbsd-x64': 0.27.0 + '@esbuild/openharmony-arm64': 0.27.0 + '@esbuild/sunos-x64': 0.27.0 + '@esbuild/win32-arm64': 0.27.0 + '@esbuild/win32-ia32': 0.27.0 + '@esbuild/win32-x64': 0.27.0 + + expand-template@2.0.3: {} + + file-uri-to-path@1.0.0: {} + + form-data@4.0.5: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.2 + mime-types: 2.1.35 + + fs-constants@1.0.0: {} + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.1 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.1 + + get-tsconfig@4.13.0: + dependencies: + resolve-pkg-maps: 1.0.0 + + github-from-package@0.0.0: {} + + gopd@1.2.0: {} + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + hasown@2.0.2: + dependencies: + function-bind: 1.1.2 + + html-encoding-sniffer@4.0.0: + dependencies: + whatwg-encoding: 3.1.1 + + http-proxy-agent@7.0.2: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + iconv-lite@0.6.3: + dependencies: + safer-buffer: 2.1.2 + + ieee754@1.2.1: {} + + inherits@2.0.4: {} + + ini@1.3.8: {} + + is-potential-custom-element-name@1.0.1: {} + + jsdom@24.1.3: + dependencies: + cssstyle: 4.6.0 + data-urls: 5.0.0 + decimal.js: 10.6.0 + form-data: 4.0.5 + html-encoding-sniffer: 4.0.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.23 + parse5: 7.3.0 + rrweb-cssom: 0.7.1 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 4.1.4 + w3c-xmlserializer: 5.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 3.1.1 + whatwg-mimetype: 4.0.0 + whatwg-url: 14.2.0 + ws: 8.19.0 + xml-name-validator: 5.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + lru-cache@10.4.3: {} + + math-intrinsics@1.1.0: {} + + mime-db@1.52.0: {} + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mimic-response@3.1.0: {} + + minimist@1.2.8: {} + + minipass@7.1.2: {} + + minizlib@3.1.0: + dependencies: + minipass: 7.1.2 + + mkdirp-classic@0.5.3: {} + + mmdb-lib@3.0.1: + optional: true + + ms@2.1.3: {} + + napi-build-utils@2.0.0: {} + + node-abi@3.85.0: + dependencies: + semver: 7.7.3 + + nwsapi@2.2.23: {} + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + parse5@7.3.0: + dependencies: + entities: 6.0.1 + + playwright-core@1.59.1: {} + + prebuild-install@7.1.3: + dependencies: + detect-libc: 2.1.2 + expand-template: 2.0.3 + github-from-package: 0.0.0 + minimist: 1.2.8 + mkdirp-classic: 0.5.3 + napi-build-utils: 2.0.0 + node-abi: 3.85.0 + pump: 3.0.3 + rc: 1.2.8 + simple-get: 4.0.1 + tar-fs: 2.1.4 + tunnel-agent: 0.6.0 + + psl@1.15.0: + dependencies: + punycode: 2.3.1 + + pump@3.0.3: + dependencies: + end-of-stream: 1.4.5 + once: 1.4.0 + + punycode@2.3.1: {} + + querystringify@2.2.0: {} + + rc@1.2.8: + dependencies: + deep-extend: 0.6.0 + ini: 1.3.8 + minimist: 1.2.8 + strip-json-comments: 2.0.1 + + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + + requires-port@1.0.0: {} + + resolve-pkg-maps@1.0.0: {} + + rrweb-cssom@0.7.1: {} + + rrweb-cssom@0.8.0: {} + + safe-buffer@5.2.1: {} + + safer-buffer@2.1.2: {} + + saxes@6.0.0: + dependencies: + xmlchars: 2.2.0 + + semver@7.7.3: {} + + simple-concat@1.0.1: {} + + simple-get@4.0.1: + dependencies: + decompress-response: 6.0.0 + once: 1.4.0 + simple-concat: 1.0.1 + + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + + strip-json-comments@2.0.1: {} + + symbol-tree@3.2.4: {} + + tar-fs@2.1.4: + dependencies: + chownr: 1.1.4 + mkdirp-classic: 0.5.3 + pump: 3.0.3 + tar-stream: 2.2.0 + + tar-stream@2.2.0: + dependencies: + bl: 4.1.0 + end-of-stream: 1.4.5 + fs-constants: 1.0.0 + inherits: 2.0.4 + readable-stream: 3.6.2 + + tar@7.5.13: + dependencies: + '@isaacs/fs-minipass': 4.0.1 + chownr: 3.0.0 + minipass: 7.1.2 + minizlib: 3.1.0 + yallist: 5.0.0 + + tough-cookie@4.1.4: + dependencies: + psl: 1.15.0 + punycode: 2.3.1 + universalify: 0.2.0 + url-parse: 1.5.10 + + tr46@5.1.1: + dependencies: + punycode: 2.3.1 + + tsx@4.21.0: + dependencies: + esbuild: 0.27.0 + get-tsconfig: 4.13.0 + optionalDependencies: + fsevents: 2.3.3 + + tunnel-agent@0.6.0: + dependencies: + safe-buffer: 5.2.1 + + turndown-plugin-gfm@1.0.2: {} + + turndown@7.2.2: + dependencies: + '@mixmark-io/domino': 2.2.0 + + typescript@5.9.3: {} + + undici-types@7.16.0: {} + + universalify@0.2.0: {} + + url-parse@1.5.10: + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + + util-deprecate@1.0.2: {} + + w3c-xmlserializer@5.0.0: + dependencies: + xml-name-validator: 5.0.0 + + webidl-conversions@7.0.0: {} + + whatwg-encoding@3.1.1: + dependencies: + iconv-lite: 0.6.3 + + whatwg-mimetype@4.0.0: {} + + whatwg-url@14.2.0: + dependencies: + tr46: 5.1.1 + webidl-conversions: 7.0.0 + + wrappy@1.0.2: {} + + ws@8.19.0: {} + + xml-name-validator@5.0.0: {} + + xmlchars@2.2.0: {} + + yallist@5.0.0: {} diff --git a/skills/web-automation/shared/scan-local-app.ts b/skills/web-automation/shared/scan-local-app.ts new file mode 100644 index 0000000..9865339 --- /dev/null +++ b/skills/web-automation/shared/scan-local-app.ts @@ -0,0 +1,179 @@ +#!/usr/bin/env npx tsx + +import { mkdirSync, writeFileSync } from 'fs'; +import { dirname, resolve } from 'path'; +import type { Page } from 'playwright-core'; +import { getPage } from './lib/browser.js'; + +type NavResult = { + requestedUrl: string; + url: string; + status: number | null; + title: string; + error?: string; +}; + +type RouteCheck = { + route: string; + result: NavResult; + heading: string | null; +}; + +const DEFAULT_BASE_URL = 'http://localhost:3000'; +const DEFAULT_REPORT_PATH = resolve(process.cwd(), 'scan-local-app.md'); + +function env(name: string): string | undefined { + const value = process.env[name]?.trim(); + return value ? value : undefined; +} + +function getRoutes(baseUrl: string): string[] { + const routeList = env('SCAN_ROUTES'); + if (routeList) { + return routeList + .split(',') + .map((route) => route.trim()) + .filter(Boolean) + .map((route) => new URL(route, baseUrl).toString()); + } + + return [baseUrl]; +} + +type GotoError = { error: unknown }; + +async function gotoWithStatus(page: Page, url: string): Promise<NavResult> { + const response = await page + .goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 }) + .catch((error: unknown): GotoError => ({ error })); + + if (response !== null && response !== undefined && 'error' in response) { + const gotoError = response as GotoError; + return { + requestedUrl: url, + url: page.url(), + status: null, + title: await page.title().catch(() => ''), + error: String(gotoError.error), + }; + } + + const httpResponse = response as Awaited<ReturnType<Page['goto']>>; + return { + requestedUrl: url, + url: page.url(), + status: httpResponse ? httpResponse.status() : null, + title: await page.title().catch(() => ''), + }; +} + +async function textOrNull(page: Page, selector: string): Promise<string | null> { + const locator = page.locator(selector).first(); + try { + if ((await locator.count()) === 0) return null; + const value = await locator.textContent(); + return value ? value.trim().replace(/\s+/g, ' ') : null; + } catch { + return null; + } +} + +async function loginIfConfigured(page: Page, baseUrl: string, lines: string[]) { + const loginPath = env('SCAN_LOGIN_PATH'); + const username = env('SCAN_USERNAME') ?? env('CLOAKBROWSER_USERNAME'); + const password = env('SCAN_PASSWORD') ?? env('CLOAKBROWSER_PASSWORD'); + const usernameSelector = env('SCAN_USERNAME_SELECTOR') ?? 'input[type="email"], input[name="email"]'; + const passwordSelector = env('SCAN_PASSWORD_SELECTOR') ?? 'input[type="password"], input[name="password"]'; + const submitSelector = env('SCAN_SUBMIT_SELECTOR') ?? 'button[type="submit"], input[type="submit"]'; + + if (!loginPath) { + lines.push('## Login'); + lines.push('- Skipped: set `SCAN_LOGIN_PATH` to enable login smoke checks.'); + lines.push(''); + return; + } + + const loginUrl = new URL(loginPath, baseUrl).toString(); + lines.push('## Login'); + lines.push(`- Login URL: ${loginUrl}`); + await gotoWithStatus(page, loginUrl); + + if (!username || !password) { + lines.push('- Skipped: set `SCAN_USERNAME`/`SCAN_PASSWORD` or `CLOAKBROWSER_USERNAME`/`CLOAKBROWSER_PASSWORD`.'); + lines.push(''); + return; + } + + await page.locator(usernameSelector).first().fill(username); + await page.locator(passwordSelector).first().fill(password); + await page.locator(submitSelector).first().click(); + await page.waitForTimeout(2500); + + lines.push(`- After submit URL: ${page.url()}`); + lines.push(`- Cookie count: ${(await page.context().cookies()).length}`); + lines.push(''); +} + +async function checkRoutes(page: Page, baseUrl: string, lines: string[]) { + const routes = getRoutes(baseUrl); + const routeChecks: RouteCheck[] = []; + + for (const url of routes) { + const result = await gotoWithStatus(page, url); + const heading = await textOrNull(page, 'h1'); + routeChecks.push({ + route: url, + result, + heading, + }); + } + + lines.push('## Route Checks'); + for (const check of routeChecks) { + const relativeUrl = check.route.startsWith(baseUrl) ? check.route.slice(baseUrl.length) || '/' : check.route; + const finalPath = check.result.url.startsWith(baseUrl) + ? check.result.url.slice(baseUrl.length) || '/' + : check.result.url; + const suffix = check.heading ? `, h1="${check.heading}"` : ''; + const errorSuffix = check.result.error ? `, error="${check.result.error}"` : ''; + lines.push( + `- ${relativeUrl} → status ${check.result.status ?? 'ERR'} (final ${finalPath})${suffix}${errorSuffix}` + ); + } + lines.push(''); +} + +async function main() { + const baseUrl = env('SCAN_BASE_URL') ?? DEFAULT_BASE_URL; + const reportPath = resolve(env('SCAN_REPORT_PATH') ?? DEFAULT_REPORT_PATH); + const headless = (env('SCAN_HEADLESS') ?? env('CLOAKBROWSER_HEADLESS') ?? 'true') === 'true'; + const { page, browser } = await getPage({ headless }); + const lines: string[] = []; + + lines.push('# Web Automation Scan (local)'); + lines.push(''); + lines.push(`- Base URL: ${baseUrl}`); + lines.push(`- Timestamp: ${new Date().toISOString()}`); + lines.push(`- Headless: ${headless}`); + lines.push(`- Report Path: ${reportPath}`); + lines.push(''); + + try { + await loginIfConfigured(page, baseUrl, lines); + await checkRoutes(page, baseUrl, lines); + lines.push('## Notes'); + lines.push('- This generic smoke helper records route availability and top-level headings for a local app.'); + lines.push('- Configure login and route coverage with `SCAN_*` environment variables.'); + } finally { + await browser.close(); + } + + mkdirSync(dirname(reportPath), { recursive: true }); + writeFileSync(reportPath, `${lines.join('\n')}\n`, 'utf-8'); + console.log(`Report written to ${reportPath}`); +} + +main().catch((error) => { + console.error(error); + process.exitCode = 1; +}); diff --git a/skills/web-automation/shared/scrape.ts b/skills/web-automation/shared/scrape.ts new file mode 100644 index 0000000..0820de0 --- /dev/null +++ b/skills/web-automation/shared/scrape.ts @@ -0,0 +1,351 @@ +#!/usr/bin/env npx tsx + +/** + * Web scraper that extracts content to markdown + * + * Usage: + * npx tsx scrape.ts --url "https://example.com" --mode main + * npx tsx scrape.ts --url "https://example.com" --mode full --output page.md + * npx tsx scrape.ts --url "https://example.com" --mode selector --selector ".content" + */ + +import TurndownService from 'turndown'; +import * as turndownPluginGfm from 'turndown-plugin-gfm'; +import { Readability } from '@mozilla/readability'; +import { JSDOM } from 'jsdom'; +import { writeFileSync } from 'fs'; +import parseArgs from 'minimist'; +import { getPage } from './browse.js'; + +// Types +type ScrapeMode = 'main' | 'full' | 'selector'; + +interface ScrapeOptions { + url: string; + mode: ScrapeMode; + selector?: string; + output?: string; + includeLinks?: boolean; + includeTables?: boolean; + includeImages?: boolean; + headless?: boolean; + wait?: number; +} + +interface ScrapeResult { + title: string; + url: string; + markdown: string; + byline?: string; + excerpt?: string; +} + +// Configure Turndown for markdown conversion +function createTurndownService(options: { + includeLinks?: boolean; + includeTables?: boolean; + includeImages?: boolean; +}): TurndownService { + const turndown = new TurndownService({ + headingStyle: 'atx', + hr: '---', + bulletListMarker: '-', + codeBlockStyle: 'fenced', + fence: '```', + emDelimiter: '*', + strongDelimiter: '**', + linkStyle: 'inlined', + }); + + // Add GFM support (tables, strikethrough, task lists) + turndown.use(turndownPluginGfm.gfm); + + // Custom rule for code blocks with language detection + turndown.addRule('codeBlockWithLanguage', { + filter: (node) => { + return ( + node.nodeName === 'PRE' && + node.firstChild?.nodeName === 'CODE' + ); + }, + replacement: (_content, node) => { + const codeNode = node.firstChild as HTMLElement; + const className = codeNode.getAttribute('class') || ''; + const langMatch = className.match(/language-(\w+)/); + const lang = langMatch ? langMatch[1] : ''; + const code = codeNode.textContent || ''; + return `\n\n\`\`\`${lang}\n${code}\n\`\`\`\n\n`; + }, + }); + + // Remove images if not included + if (!options.includeImages) { + turndown.addRule('removeImages', { + filter: 'img', + replacement: () => '', + }); + } + + // Remove links but keep text if not included + if (!options.includeLinks) { + turndown.addRule('removeLinks', { + filter: 'a', + replacement: (content) => content, + }); + } + + // Remove script, style, nav, footer, aside elements + turndown.remove(['script', 'style', 'nav', 'footer', 'aside', 'noscript']); + + return turndown; +} + +// Extract main content using Readability +function extractMainContent(html: string, url: string): { + content: string; + title: string; + byline?: string; + excerpt?: string; +} { + const dom = new JSDOM(html, { url }); + const reader = new Readability(dom.window.document); + const article = reader.parse(); + + if (!article) { + throw new Error('Could not extract main content from page'); + } + + return { + content: article.content, + title: article.title, + byline: article.byline || undefined, + excerpt: article.excerpt || undefined, + }; +} + +// Scrape a URL and return markdown +export async function scrape(options: ScrapeOptions): Promise<ScrapeResult> { + const { page, browser } = await getPage({ headless: options.headless ?? true }); + + try { + // Navigate to URL + console.log(`Navigating to: ${options.url}`); + await page.goto(options.url, { + timeout: 60000, + waitUntil: 'domcontentloaded', + }); + + // Wait if specified + if (options.wait) { + console.log(`Waiting ${options.wait}ms for dynamic content...`); + await page.waitForTimeout(options.wait); + } + + const pageTitle = await page.title(); + const pageUrl = page.url(); + + let html: string; + let title = pageTitle; + let byline: string | undefined; + let excerpt: string | undefined; + + // Get HTML based on mode + switch (options.mode) { + case 'main': { + // Get full page HTML and extract with Readability + const fullHtml = await page.content(); + const extracted = extractMainContent(fullHtml, pageUrl); + html = extracted.content; + title = extracted.title || pageTitle; + byline = extracted.byline; + excerpt = extracted.excerpt; + break; + } + + case 'selector': { + if (!options.selector) { + throw new Error('Selector mode requires --selector option'); + } + const element = await page.$(options.selector); + if (!element) { + throw new Error(`Selector not found: ${options.selector}`); + } + html = await element.innerHTML(); + break; + } + + case 'full': + default: { + // Get body content, excluding common non-content elements + html = await page.evaluate(() => { + // Remove common non-content elements + const selectorsToRemove = [ + 'script', 'style', 'noscript', 'iframe', + 'nav', 'header', 'footer', '.cookie-banner', + '.advertisement', '.ads', '#ads', '.social-share', + '.comments', '#comments', '.sidebar' + ]; + + selectorsToRemove.forEach(selector => { + document.querySelectorAll(selector).forEach(el => el.remove()); + }); + + return document.body.innerHTML; + }); + break; + } + } + + // Convert to markdown + const turndown = createTurndownService({ + includeLinks: options.includeLinks ?? true, + includeTables: options.includeTables ?? true, + includeImages: options.includeImages ?? false, + }); + + let markdown = turndown.turndown(html); + + // Add title as H1 if not already present + if (!markdown.startsWith('# ')) { + markdown = `# ${title}\n\n${markdown}`; + } + + // Add metadata header + const metadataLines = [ + `<!-- Scraped from: ${pageUrl} -->`, + byline ? `<!-- Author: ${byline} -->` : null, + excerpt ? `<!-- Excerpt: ${excerpt} -->` : null, + `<!-- Scraped at: ${new Date().toISOString()} -->`, + '', + ].filter(Boolean); + + markdown = metadataLines.join('\n') + '\n' + markdown; + + // Clean up excessive whitespace + markdown = markdown + .replace(/\n{4,}/g, '\n\n\n') + .replace(/[ \t]+$/gm, '') + .trim(); + + const result: ScrapeResult = { + title, + url: pageUrl, + markdown, + byline, + excerpt, + }; + + // Save to file if output specified + if (options.output) { + writeFileSync(options.output, markdown, 'utf-8'); + console.log(`Markdown saved to: ${options.output}`); + } + + return result; + } finally { + await browser.close(); + } +} + +// CLI entry point +async function main() { + const args = parseArgs(process.argv.slice(2), { + string: ['url', 'mode', 'selector', 'output'], + boolean: ['headless', 'links', 'tables', 'images', 'help'], + default: { + mode: 'main', + headless: true, + links: true, + tables: true, + images: false, + }, + alias: { + u: 'url', + m: 'mode', + s: 'selector', + o: 'output', + h: 'help', + }, + }); + + if (args.help || !args.url) { + console.log(` +Web Scraper - Extract content to Markdown + +Usage: + npx tsx scrape.ts --url <url> [options] + +Options: + -u, --url <url> URL to scrape (required) + -m, --mode <mode> Scrape mode: main, full, or selector (default: main) + -s, --selector <sel> CSS selector for selector mode + -o, --output <path> Output file path for markdown + --headless <bool> Run in headless mode (default: true) + --wait <ms> Wait time for dynamic content + --links Include links in output (default: true) + --tables Include tables in output (default: true) + --images Include images in output (default: false) + -h, --help Show this help message + +Scrape Modes: + main Extract main article content using Readability (best for articles) + full Full page content with common elements removed + selector Extract specific element by CSS selector + +Examples: + npx tsx scrape.ts --url "https://docs.example.com/guide" --mode main + npx tsx scrape.ts --url "https://example.com" --mode full --output page.md + npx tsx scrape.ts --url "https://example.com" --mode selector --selector ".api-docs" + npx tsx scrape.ts --url "https://example.com" --mode main --no-links --output clean.md + +Output Format: + - GitHub Flavored Markdown (tables, strikethrough, task lists) + - Proper heading hierarchy + - Code blocks with language detection + - Metadata comments at top (source URL, date) +`); + process.exit(args.help ? 0 : 1); + } + + const mode = args.mode as ScrapeMode; + if (!['main', 'full', 'selector'].includes(mode)) { + console.error(`Invalid mode: ${mode}. Must be main, full, or selector.`); + process.exit(1); + } + + try { + const result = await scrape({ + url: args.url, + mode, + selector: args.selector, + output: args.output, + includeLinks: args.links, + includeTables: args.tables, + includeImages: args.images, + headless: args.headless, + wait: args.wait ? parseInt(args.wait, 10) : undefined, + }); + + // Print result summary + console.log(`\nScrape complete:`); + console.log(` Title: ${result.title}`); + console.log(` URL: ${result.url}`); + if (result.byline) console.log(` Author: ${result.byline}`); + console.log(` Markdown length: ${result.markdown.length} chars`); + + // Print markdown if not saved to file + if (!args.output) { + console.log('\n--- Markdown Output ---\n'); + console.log(result.markdown); + } + } catch (error) { + console.error('Error:', error instanceof Error ? error.message : error); + process.exit(1); + } +} + +// Run if executed directly +const isMainModule = process.argv[1]?.includes('scrape.ts'); +if (isMainModule) { + main(); +} diff --git a/skills/web-automation/shared/test-full.ts b/skills/web-automation/shared/test-full.ts new file mode 100644 index 0000000..356bbab --- /dev/null +++ b/skills/web-automation/shared/test-full.ts @@ -0,0 +1,36 @@ +import { launchPersistentContext } from 'cloakbrowser'; +import { homedir } from 'os'; +import { join } from 'path'; +import { mkdirSync, existsSync } from 'fs'; + +async function test() { + const profilePath = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profilePath)) { + mkdirSync(profilePath, { recursive: true }); + } + + console.log('Profile path:', profilePath); + console.log('Launching CloakBrowser with full options...'); + + const browser = await launchPersistentContext({ + headless: true, + userDataDir: profilePath, + humanize: true, + }); + + console.log('Browser launched'); + const page = browser.pages()[0] || await browser.newPage(); + console.log('Page created'); + + await page.goto('https://github.com', { timeout: 30000 }); + console.log('Navigated to:', page.url()); + console.log('Title:', await page.title()); + + await page.screenshot({ path: '/tmp/github-test.png' }); + console.log('Screenshot saved'); + + await browser.close(); + console.log('Done'); +} + +test().catch(console.error); diff --git a/skills/web-automation/shared/test-minimal.ts b/skills/web-automation/shared/test-minimal.ts new file mode 100644 index 0000000..a5412e7 --- /dev/null +++ b/skills/web-automation/shared/test-minimal.ts @@ -0,0 +1,23 @@ +import { launch } from 'cloakbrowser'; + +async function test() { + console.log('Launching CloakBrowser with minimal config...'); + + const browser = await launch({ + headless: true, + humanize: true, + }); + + console.log('Browser launched'); + const page = await browser.newPage(); + console.log('Page created'); + + await page.goto('https://example.com', { timeout: 30000 }); + console.log('Navigated to:', page.url()); + console.log('Title:', await page.title()); + + await browser.close(); + console.log('Done'); +} + +test().catch(console.error); diff --git a/skills/web-automation/shared/test-profile.ts b/skills/web-automation/shared/test-profile.ts new file mode 100644 index 0000000..ec59ddd --- /dev/null +++ b/skills/web-automation/shared/test-profile.ts @@ -0,0 +1,33 @@ +import { launchPersistentContext } from 'cloakbrowser'; +import { homedir } from 'os'; +import { join } from 'path'; +import { mkdirSync, existsSync } from 'fs'; + +async function test() { + const profilePath = join(homedir(), '.cloakbrowser-profile'); + if (!existsSync(profilePath)) { + mkdirSync(profilePath, { recursive: true }); + } + + console.log('Profile path:', profilePath); + console.log('Launching with persistent userDataDir...'); + + const browser = await launchPersistentContext({ + headless: true, + userDataDir: profilePath, + humanize: true, + }); + + console.log('Browser launched'); + const page = browser.pages()[0] || await browser.newPage(); + console.log('Page created'); + + await page.goto('https://example.com', { timeout: 30000 }); + console.log('Navigated to:', page.url()); + console.log('Title:', await page.title()); + + await browser.close(); + console.log('Done'); +} + +test().catch(console.error); diff --git a/skills/web-automation/shared/tsconfig.json b/skills/web-automation/shared/tsconfig.json new file mode 100644 index 0000000..689017a --- /dev/null +++ b/skills/web-automation/shared/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "skipLibCheck": true, + "resolveJsonModule": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["*.ts", "lib/**/*.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/skills/web-automation/shared/turndown-plugin-gfm.d.ts b/skills/web-automation/shared/turndown-plugin-gfm.d.ts new file mode 100644 index 0000000..316bed1 --- /dev/null +++ b/skills/web-automation/shared/turndown-plugin-gfm.d.ts @@ -0,0 +1,8 @@ +declare module 'turndown-plugin-gfm' { + import TurndownService from 'turndown'; + + export function gfm(turndownService: TurndownService): void; + export function strikethrough(turndownService: TurndownService): void; + export function tables(turndownService: TurndownService): void; + export function taskListItems(turndownService: TurndownService): void; +}