@1aboveio/skills 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -2
- package/bin/cli.mjs +14 -0
- package/bin/select-core.mjs +172 -0
- package/package.json +146 -4
- package/skills/app-dev/airflow/LICENSE +3 -0
- package/skills/app-dev/airflow/SKILL.md +199 -0
- package/skills/app-dev/airflow/release-check.mjs +93 -0
- package/skills/app-dev/android-foundation/LICENSE +3 -0
- package/skills/app-dev/android-foundation/SKILL.md +192 -0
- package/skills/app-dev/android-foundation/assets/android-ci-job.yml +217 -0
- package/skills/app-dev/android-foundation/references/ci.md +87 -0
- package/skills/app-dev/android-foundation/references/gotchas.md +221 -0
- package/skills/app-dev/android-foundation/references/setup.md +164 -0
- package/skills/app-dev/android-foundation/release-check.mjs +93 -0
- package/skills/app-dev/android-foundation/scripts/device-run.sh +176 -0
- package/skills/app-dev/android-foundation/scripts/device-run.test.mjs +172 -0
- package/skills/app-dev/app-debug/LICENSE +3 -0
- package/skills/app-dev/app-debug/SKILL.md +110 -0
- package/skills/app-dev/app-debug/references/common-errors.md +128 -0
- package/skills/app-dev/app-debug/release-check.mjs +93 -0
- package/skills/app-dev/better-auth/LICENSE +3 -0
- package/skills/app-dev/better-auth/SKILL.md +598 -0
- package/skills/app-dev/better-auth/references/feishu-api.md +270 -0
- package/skills/app-dev/better-auth/release-check.mjs +93 -0
- package/skills/app-dev/data-catalog/LICENSE +3 -0
- package/skills/app-dev/data-catalog/SKILL.md +204 -0
- package/skills/app-dev/data-catalog/agents/openai.yaml +3 -0
- package/skills/app-dev/data-catalog/references/data-catalog-conventions.md +75 -0
- package/skills/app-dev/data-catalog/references/field-definitions.md +116 -0
- package/skills/app-dev/data-catalog/references/format.md +121 -0
- package/skills/app-dev/data-catalog/release-check.mjs +93 -0
- package/skills/app-dev/data-catalog/scripts/data-catalog.test.mjs +36 -0
- package/skills/app-dev/data-catalog/scripts/data_catalog.py +1392 -0
- package/skills/app-dev/data-catalog/scripts/persist-conventions-core.mjs +117 -0
- package/skills/app-dev/data-catalog/scripts/persist-conventions.mjs +17 -0
- package/skills/app-dev/data-catalog/scripts/test_data_catalog.py +571 -0
- package/skills/app-dev/ios-foundation/LICENSE +3 -0
- package/skills/app-dev/ios-foundation/SKILL.md +184 -0
- package/skills/app-dev/ios-foundation/references/setup.md +243 -0
- package/skills/app-dev/ios-foundation/release-check.mjs +93 -0
- package/skills/app-dev/monorepo/LICENSE +3 -0
- package/skills/app-dev/monorepo/SKILL.md +462 -0
- package/skills/app-dev/monorepo/release-check.mjs +93 -0
- package/skills/app-dev/nextjs-fullstack/LICENSE +3 -0
- package/skills/app-dev/nextjs-fullstack/SKILL.md +211 -0
- package/skills/app-dev/nextjs-fullstack/conventions.md +318 -0
- package/skills/app-dev/nextjs-fullstack/frontend-conventions.md +61 -0
- package/skills/app-dev/nextjs-fullstack/nextjs16.md +287 -0
- package/skills/app-dev/nextjs-fullstack/release-check.mjs +93 -0
- package/skills/app-dev/nextjs-fullstack/server-actions.md +409 -0
- package/skills/app-dev/prisma-setup/LICENSE +3 -0
- package/skills/app-dev/prisma-setup/SKILL.md +181 -0
- package/skills/app-dev/prisma-setup/nextjs.md +258 -0
- package/skills/app-dev/prisma-setup/release-check.mjs +93 -0
- package/skills/app-dev/prisma-setup/turborepo.md +301 -0
- package/skills/app-dev/pyspark/LICENSE +3 -0
- package/skills/app-dev/pyspark/SKILL.md +127 -0
- package/skills/app-dev/pyspark/assets/templates/etl.py +748 -0
- package/skills/app-dev/pyspark/assets/templates/utils/__init__.py +1 -0
- package/skills/app-dev/pyspark/assets/templates/utils/hudi_metadata.py +14 -0
- package/skills/app-dev/pyspark/references/diagnosis-and-profiling.md +169 -0
- package/skills/app-dev/pyspark/references/etl-contract.md +129 -0
- package/skills/app-dev/pyspark/references/production-validation.md +131 -0
- package/skills/app-dev/pyspark/references/reconciliation.md +38 -0
- package/skills/app-dev/pyspark/references/transformation-design.md +190 -0
- package/skills/app-dev/pyspark/references/velocity-feature-calculation.md +193 -0
- package/skills/app-dev/pyspark/release-check.mjs +93 -0
- package/skills/app-dev/pyspark/scripts/spark_eventlog_summary.py +223 -0
- package/skills/app-dev/python-backend/LICENSE +3 -0
- package/skills/app-dev/python-backend/SKILL.md +325 -0
- package/skills/app-dev/python-backend/assets/uv-install.sh +48 -0
- package/skills/app-dev/python-backend/references/uv-installs.md +83 -0
- package/skills/app-dev/python-backend/release-check.mjs +93 -0
- package/skills/app-dev/shadcn/LICENSE +3 -0
- package/skills/app-dev/shadcn/SKILL.md +120 -0
- package/skills/app-dev/shadcn/assets/shadcn-small.png +0 -0
- package/skills/app-dev/shadcn/assets/shadcn.png +0 -0
- package/skills/app-dev/shadcn/cli.md +411 -0
- package/skills/app-dev/shadcn/customization.md +224 -0
- package/skills/app-dev/shadcn/mcp.md +101 -0
- package/skills/app-dev/shadcn/release-check.mjs +93 -0
- package/skills/app-dev/shadcn/rules/base-vs-radix.md +323 -0
- package/skills/app-dev/shadcn/rules/component-selection.md +67 -0
- package/skills/app-dev/shadcn/rules/composition.md +195 -0
- package/skills/app-dev/shadcn/rules/data-table.md +201 -0
- package/skills/app-dev/shadcn/rules/forms.md +255 -0
- package/skills/app-dev/shadcn/rules/icons.md +103 -0
- package/skills/app-dev/shadcn/rules/styling.md +167 -0
- package/skills/app-dev/zod-v4/LICENSE +3 -0
- package/skills/app-dev/zod-v4/SKILL.md +286 -0
- package/skills/app-dev/zod-v4/release-check.mjs +93 -0
- package/skills/cicd/cloud-build/LICENSE +3 -0
- package/skills/cicd/cloud-build/SKILL.md +707 -0
- package/skills/cicd/cloud-build/release-check.mjs +93 -0
- package/skills/cicd/cloud-debug/LICENSE +3 -0
- package/skills/cicd/cloud-debug/SKILL.md +315 -0
- package/skills/cicd/cloud-debug/references/build-failures.md +238 -0
- package/skills/cicd/cloud-debug/references/deploy-failures.md +376 -0
- package/skills/cicd/cloud-debug/references/pipeline-failures.md +378 -0
- package/skills/cicd/cloud-debug/release-check.mjs +93 -0
- package/skills/cicd/cloud-deploy/LICENSE +3 -0
- package/skills/cicd/cloud-deploy/SKILL.md +230 -0
- package/skills/cicd/cloud-deploy/references/config-templates.md +257 -0
- package/skills/cicd/cloud-deploy/release-check.mjs +93 -0
- package/skills/cicd/docker/LICENSE +3 -0
- package/skills/cicd/docker/SKILL.md +151 -0
- package/skills/cicd/docker/release-check.mjs +93 -0
- package/skills/cicd/github-actions/LICENSE +3 -0
- package/skills/cicd/github-actions/SKILL.md +111 -0
- package/skills/cicd/github-actions/references/audit-profile-optimize.md +150 -0
- package/skills/cicd/github-actions/references/ci-case-studies.md +141 -0
- package/skills/cicd/github-actions/references/conditional-ci.md +214 -0
- package/skills/cicd/github-actions/references/debugging.md +13 -0
- package/skills/cicd/github-actions/references/pipeline.md +87 -0
- package/skills/cicd/github-actions/references/post-deploy-and-publishing.md +33 -0
- package/skills/cicd/github-actions/references/runners.md +253 -0
- package/skills/cicd/github-actions/references/security.md +29 -0
- package/skills/cicd/github-actions/references/speed-and-audit.md +115 -0
- package/skills/cicd/github-actions/references/two-pass-reading.md +92 -0
- package/skills/cicd/github-actions/release-check.mjs +93 -0
- package/skills/cicd/github-actions/scripts/ci-run-audit-core.mjs +612 -0
- package/skills/cicd/github-actions/scripts/ci-run-audit.mjs +4 -0
- package/skills/cicd/github-actions/scripts/ci-run-audit.test.mjs +637 -0
- package/skills/cicd/github-flow/LICENSE +3 -0
- package/skills/cicd/github-flow/SKILL.md +123 -0
- package/skills/cicd/github-flow/references/ci-conventions.md +14 -0
- package/skills/cicd/github-flow/release-check.mjs +93 -0
- package/skills/cicd/github-flow/scripts/flow-core.mjs +105 -0
- package/skills/cicd/github-flow/scripts/flow.mjs +81 -0
- package/skills/cicd/github-flow/scripts/flow.test.mjs +114 -0
- package/skills/cicd/github-flow/scripts/persist-conventions-core.mjs +117 -0
- package/skills/cicd/github-flow/scripts/persist-conventions.mjs +49 -0
- package/skills/cicd/github-flow/scripts/persist-conventions.test.mjs +108 -0
- package/skills/cicd/google-cloud/LICENSE +3 -0
- package/skills/cicd/google-cloud/SKILL.md +119 -0
- package/skills/cicd/google-cloud/references/gcs.md +469 -0
- package/skills/cicd/google-cloud/references/iam.md +451 -0
- package/skills/cicd/google-cloud/references/project.md +349 -0
- package/skills/cicd/google-cloud/references/secrets.md +336 -0
- package/skills/cicd/google-cloud/references/vpc.md +312 -0
- package/skills/cicd/google-cloud/release-check.mjs +93 -0
- package/skills/cicd/google-cloud/scripts/create-sa.sh +36 -0
- package/skills/cicd/google-cloud/scripts/gcp-config.sh +31 -0
- package/skills/cicd/google-cloud/scripts/grant-iap.sh +41 -0
- package/skills/cicd/google-cloud/scripts/setup-secrets.sh +48 -0
- package/skills/cicd/mergify/LICENSE +3 -0
- package/skills/cicd/mergify/SKILL.md +102 -0
- package/skills/cicd/mergify/assets/templates/mergify.yml +215 -0
- package/skills/cicd/mergify/assets/templates/ruleset.json +46 -0
- package/skills/cicd/mergify/references/branch-protection.md +282 -0
- package/skills/cicd/mergify/references/configuration.md +274 -0
- package/skills/cicd/mergify/references/diagnosis.md +109 -0
- package/skills/cicd/mergify/references/stacks.md +84 -0
- package/skills/cicd/mergify/references/traps.md +119 -0
- package/skills/cicd/mergify/references/watch-contract.md +274 -0
- package/skills/cicd/mergify/release-check.mjs +93 -0
- package/skills/cicd/mergify/scripts/audit-core.mjs +208 -0
- package/skills/cicd/mergify/scripts/audit.mjs +4 -0
- package/skills/cicd/mergify/scripts/audit.test.mjs +201 -0
- package/skills/cicd/mergify/scripts/entrypoints.test.mjs +106 -0
- package/skills/cicd/mergify/scripts/pr-620-mergify-comments.fixture.json +30 -0
- package/skills/cicd/mergify/scripts/stack-push-core.mjs +258 -0
- package/skills/cicd/mergify/scripts/stack-push.mjs +4 -0
- package/skills/cicd/mergify/scripts/stack-push.test.mjs +233 -0
- package/skills/cicd/mergify/scripts/watch-pr-delivery-core.mjs +1065 -0
- package/skills/cicd/mergify/scripts/watch-pr-delivery.mjs +4 -0
- package/skills/cicd/mergify/scripts/watch-pr-delivery.test.mjs +1826 -0
- package/skills/cicd/podman/LICENSE +3 -0
- package/skills/cicd/podman/SKILL.md +71 -0
- package/skills/cicd/podman/agents/openai.yaml +4 -0
- package/skills/cicd/podman/assets/templates/podman-compose-socket-directory.yml +6 -0
- package/skills/cicd/podman/assets/templates/podman-service-override.conf +3 -0
- package/skills/cicd/podman/references/compose-compatibility.md +70 -0
- package/skills/cicd/podman/references/networking-and-ports.md +74 -0
- package/skills/cicd/podman/references/rootless-services-and-sockets.md +156 -0
- package/skills/cicd/podman/references/troubleshooting.md +98 -0
- package/skills/cicd/podman/release-check.mjs +93 -0
- package/skills/content/article-review/LICENSE +3 -0
- package/skills/content/article-review/SKILL.md +66 -0
- package/skills/content/article-review/references/report-format.md +68 -0
- package/skills/content/article-review/references/template-guide.md +79 -0
- package/skills/content/article-review/references/template-wechat-payments.md +125 -0
- package/skills/content/article-review/release-check.mjs +93 -0
- package/skills/content/article-to-image/LICENSE +3 -0
- package/skills/content/article-to-image/SKILL.md +91 -0
- package/skills/content/article-to-image/references/formats.md +53 -0
- package/skills/content/article-to-image/release-check.mjs +93 -0
- package/skills/content/flowchart-svg/LICENSE +3 -0
- package/skills/content/flowchart-svg/SKILL.md +43 -0
- package/skills/content/flowchart-svg/release-check.mjs +93 -0
- package/skills/content/flowchart-svg/scripts/export_png.sh +8 -0
- package/skills/content/image-gen/LICENSE +3 -0
- package/skills/content/image-gen/SKILL.md +192 -0
- package/skills/content/image-gen/release-check.mjs +93 -0
- package/skills/content/image-gen/scripts/credentials.mjs +217 -0
- package/skills/content/image-gen/scripts/credentials.test.mjs +212 -0
- package/skills/content/image-gen/scripts/generate.mjs +240 -0
- package/skills/content/image-gen/scripts/options.mjs +293 -0
- package/skills/content/image-gen/scripts/options.test.mjs +245 -0
- package/skills/content/mermaid/LICENSE +3 -0
- package/skills/content/mermaid/SKILL.md +635 -0
- package/skills/content/mermaid/release-check.mjs +93 -0
- package/skills/content/wechat-article-writer/LICENSE +3 -0
- package/skills/content/wechat-article-writer/SKILL.md +92 -0
- package/skills/content/wechat-article-writer/references/style-selector.md +133 -0
- package/skills/content/wechat-article-writer/references/writing-rules.md +152 -0
- package/skills/content/wechat-article-writer/release-check.mjs +93 -0
- package/skills/content/wechat-article-writer/templates/wechat-comparison.md +52 -0
- package/skills/content/wechat-article-writer/templates/wechat-howto.md +51 -0
- package/skills/content/wechat-article-writer/templates/wechat-insight.md +50 -0
- package/skills/content/wechat-article-writer/templates/wechat-pitfall.md +52 -0
- package/skills/content/wechat-publisher/LICENSE +3 -0
- package/skills/content/wechat-publisher/SKILL.md +171 -0
- package/skills/content/wechat-publisher/references/api.md +105 -0
- package/skills/content/wechat-publisher/references/layout-rules.md +57 -0
- package/skills/content/wechat-publisher/references/wechat-safe-template.html +86 -0
- package/skills/content/wechat-publisher/release-check.mjs +93 -0
- package/skills/content/wechat-publisher/scripts/md_to_wechat_html.py +194 -0
- package/skills/content/wechat-publisher/scripts/publish.py +239 -0
- package/skills/content/wechat-search/LICENSE +3 -0
- package/skills/content/wechat-search/SKILL.md +211 -0
- package/skills/content/wechat-search/release-check.mjs +93 -0
- package/skills/content/wechat-search/scripts/start-chrome.sh +83 -0
- package/skills/content/xai-search/LICENSE +3 -0
- package/skills/content/xai-search/SKILL.md +79 -0
- package/skills/content/xai-search/release-check.mjs +93 -0
- package/skills/content/xai-search/scripts/xai_search.sh +187 -0
- package/skills/content/xai-search/tests/smoke_test.sh +36 -0
- package/skills/core/distill-writing/LICENSE +3 -0
- package/skills/core/distill-writing/SKILL.md +74 -0
- package/skills/core/distill-writing/references/extraction.md +95 -0
- package/skills/core/distill-writing/references/updating.md +46 -0
- package/skills/core/distill-writing/release-check.mjs +93 -0
- package/skills/core/doc-to-md/LICENSE +3 -0
- package/skills/core/doc-to-md/SKILL.md +78 -0
- package/skills/core/doc-to-md/release-check.mjs +93 -0
- package/skills/core/doc-to-md/scripts/convert.py +157 -0
- package/skills/core/editorial-review/LICENSE +3 -0
- package/skills/core/editorial-review/SKILL.md +79 -0
- package/skills/core/editorial-review/references/checklist.md +94 -0
- package/skills/core/editorial-review/release-check.mjs +93 -0
- package/skills/core/house-style/LICENSE +3 -0
- package/skills/core/house-style/SKILL.md +33 -0
- package/skills/core/house-style/references/defaults.md +66 -0
- package/skills/core/house-style/references/rules.md +267 -0
- package/skills/core/house-style/references/sources.md +27 -0
- package/skills/core/house-style/references/style-en.md +131 -0
- package/skills/core/house-style/references/style-zh.md +141 -0
- package/skills/core/house-style/references/terminology-zh.md +223 -0
- package/skills/core/house-style/release-check.mjs +93 -0
- package/skills/core/house-style/templates/brd.md +103 -0
- package/skills/core/house-style/templates/commercial-proposal.md +93 -0
- package/skills/core/house-style/templates/compliance-policy.md +109 -0
- package/skills/core/house-style/templates/gap-analysis.md +105 -0
- package/skills/core/house-style/templates/general.md +63 -0
- package/skills/core/house-style/templates/integration-guide.md +98 -0
- package/skills/core/house-style/templates/prd.md +81 -0
- package/skills/core/house-style/templates/risk-operations-procedure.md +94 -0
- package/skills/core/house-style/templates/technical-spec.md +96 -0
- package/skills/core/polish-cn/LICENSE +3 -0
- package/skills/core/polish-cn/SKILL.md +102 -0
- package/skills/core/polish-cn/references/brief.md +93 -0
- package/skills/core/polish-cn/references/models.md +76 -0
- package/skills/core/polish-cn/release-check.mjs +93 -0
- package/skills/core/polish-cn/scripts/polish-cn.test.mjs +244 -0
- package/skills/core/polish-cn/scripts/polish_blocks.py +489 -0
- package/skills/core/reg-parser/LICENSE +3 -0
- package/skills/core/reg-parser/SKILL.md +212 -0
- package/skills/core/reg-parser/references/checklist-schema.md +223 -0
- package/skills/core/reg-parser/references/checklists/hk-amlo-checklist.json +1306 -0
- package/skills/core/reg-parser/references/checklists/hk-amlo-checklist.md +469 -0
- package/skills/core/reg-parser/references/checklists/hk-fi-corporate-onboarding-cdd-checklist.json +634 -0
- package/skills/core/reg-parser/references/checklists/hk-fi-corporate-onboarding-cdd-checklist.md +233 -0
- package/skills/core/reg-parser/references/checklists/hk-mso-guideline-checklist.json +2194 -0
- package/skills/core/reg-parser/references/checklists/hk-mso-guideline-checklist.md +771 -0
- package/skills/core/reg-parser/references/checklists/kyc-aml-checklist.md +258 -0
- package/skills/core/reg-parser/references/checklists/visa-vars-checklist.md +1058 -0
- package/skills/core/reg-parser/references/mandates/hk-amlo-cap615.md +389 -0
- package/skills/core/reg-parser/references/mandates/visa-vars.md +205 -0
- package/skills/core/reg-parser/release-check.mjs +93 -0
- package/skills/core/reg-parser/scripts/compare_checklist.py +230 -0
- package/skills/core/reg-parser/scripts/dump_checklist.py +361 -0
- package/skills/core/reg-parser/scripts/preprocess-mandate.sh +187 -0
- package/skills/core/reg-parser/scripts/reg-parser.test.mjs +165 -0
- package/skills/core/reg-parser/scripts/test_quarantine.sh +105 -0
- package/skills/core/reg-parser/scripts/validate_checklist.py +563 -0
- package/skills/core/reg-parser/scripts/validate_mandate.py +273 -0
- package/skills/core/terminology/LICENSE +3 -0
- package/skills/core/terminology/SKILL.md +62 -0
- package/skills/core/terminology/references/format.md +50 -0
- package/skills/core/terminology/references/init.md +32 -0
- package/skills/core/terminology/release-check.mjs +93 -0
- package/skills/core/write-doc/LICENSE +3 -0
- package/skills/core/write-doc/SKILL.md +141 -0
- package/skills/core/write-doc/references/bilingual.md +60 -0
- package/skills/core/write-doc/release-check.mjs +93 -0
- package/skills/engineering/better-review/LICENSE +3 -0
- package/skills/engineering/better-review/SKILL.md +249 -0
- package/skills/engineering/better-review/agents/openai.yaml +9 -0
- package/skills/engineering/better-review/references/domain-hazards.md +53 -0
- package/skills/engineering/better-review/references/passes.md +147 -0
- package/skills/engineering/better-review/references/result.md +151 -0
- package/skills/engineering/better-review/release-check.mjs +93 -0
- package/skills/engineering/better-review/scripts/pr-context.mjs +212 -0
- package/skills/engineering/better-review/scripts/pr-context.test.mjs +168 -0
- package/skills/engineering/better-review/scripts/rereview-scope.mjs +503 -0
- package/skills/engineering/better-review/scripts/rereview-scope.test.mjs +587 -0
- package/skills/engineering/better-review/scripts/scan-diff.mjs +365 -0
- package/skills/engineering/better-review/scripts/scan-diff.test.mjs +414 -0
- package/skills/engineering/better-review/scripts/vendor-sync.test.mjs +96 -0
- package/skills/engineering/e2e-test/LICENSE +3 -0
- package/skills/engineering/e2e-test/SKILL.md +98 -0
- package/skills/engineering/e2e-test/assets/ci-gates.cloudbuild.yaml +24 -0
- package/skills/engineering/e2e-test/references/authoring/auth-flows.md +159 -0
- package/skills/engineering/e2e-test/references/authoring/playwright-config.md +73 -0
- package/skills/engineering/e2e-test/references/authoring/playwright-patterns.md +144 -0
- package/skills/engineering/e2e-test/references/ci-integration.md +25 -0
- package/skills/engineering/e2e-test/references/ci-playwright-container.md +290 -0
- package/skills/engineering/e2e-test/references/presentation-sweep.md +104 -0
- package/skills/engineering/e2e-test/references/reviewing.md +41 -0
- package/skills/engineering/e2e-test/references/route-manifest.md +51 -0
- package/skills/engineering/e2e-test/release-check.mjs +93 -0
- package/skills/engineering/e2e-test/scripts/detect-routes-nextjs.mjs +200 -0
- package/skills/engineering/e2e-test/scripts/presentation-checks.mjs +171 -0
- package/skills/engineering/e2e-test/scripts/presentation-checks.test.mjs +106 -0
- package/skills/engineering/e2e-test/scripts/presentation-perceivability.mjs +179 -0
- package/skills/engineering/e2e-test/scripts/presentation-perceivability.test.mjs +117 -0
- package/skills/engineering/e2e-test/scripts/presentation-reachability.mjs +154 -0
- package/skills/engineering/e2e-test/scripts/presentation-reachability.test.mjs +69 -0
- package/skills/engineering/e2e-test/scripts/presentation-render-health.mjs +141 -0
- package/skills/engineering/e2e-test/scripts/presentation-render-health.test.mjs +98 -0
- package/skills/engineering/e2e-test/scripts/presentation-sweep.mjs +147 -0
- package/skills/engineering/e2e-test/scripts/presentation-sweep.test.mjs +71 -0
- package/skills/engineering/e2e-test/scripts/presentation-temporal.mjs +127 -0
- package/skills/engineering/e2e-test/scripts/presentation-temporal.test.mjs +59 -0
- package/skills/engineering/e2e-test/scripts/project-route-manifest.mjs +82 -0
- package/skills/engineering/e2e-test/scripts/project-route-manifest.test.mjs +76 -0
- package/skills/engineering/e2e-test/scripts/validate-manifest.mjs +106 -0
- package/skills/engineering/engineering-runtime/LICENSE +3 -0
- package/skills/engineering/engineering-runtime/SKILL.md +11 -0
- package/skills/engineering/engineering-runtime/agents/openai.yaml +6 -0
- package/skills/engineering/engineering-runtime/coherence/workflow.json +597 -0
- package/skills/engineering/engineering-runtime/engineering-runtime.test.mjs +68 -0
- package/skills/engineering/engineering-runtime/release-check.mjs +93 -0
- package/skills/engineering/engineering-runtime/scripts/exact-head-artifact.mjs +131 -0
- package/skills/engineering/engineering-runtime/scripts/head-check-set.mjs +398 -0
- package/skills/engineering/engineering-runtime/scripts/invocation-policy.mjs +187 -0
- package/skills/engineering/engineering-runtime/scripts/invocation-policy.test.mjs +95 -0
- package/skills/engineering/engineering-runtime/scripts/main-module.mjs +79 -0
- package/skills/engineering/engineering-runtime/scripts/main-module.test.mjs +288 -0
- package/skills/engineering/engineering-runtime/scripts/mergify-yaml.mjs +11 -0
- package/skills/engineering/engineering-runtime/scripts/package-lock.json +43 -0
- package/skills/engineering/engineering-runtime/scripts/package.json +10 -0
- package/skills/engineering/engineering-runtime/scripts/required-check-plan.mjs +223 -0
- package/skills/engineering/engineering-runtime/scripts/required-check-plan.test.mjs +96 -0
- package/skills/engineering/engineering-runtime/scripts/review-completion.mjs +56 -0
- package/skills/engineering/engineering-runtime/scripts/workflow-coherence.mjs +595 -0
- package/skills/engineering/engineering-runtime/scripts/workflow-policy.mjs +189 -0
- package/skills/engineering/engineering-runtime/scripts/yaml-mapping.mjs +18 -0
- package/skills/engineering/ensure-coverage/LICENSE +3 -0
- package/skills/engineering/ensure-coverage/SKILL.md +129 -0
- package/skills/engineering/ensure-coverage/references/breadth/coverage-ledger.md +92 -0
- package/skills/engineering/ensure-coverage/references/breadth/inventory-contract.md +85 -0
- package/skills/engineering/ensure-coverage/references/breadth/surface-baseline.md +44 -0
- package/skills/engineering/ensure-coverage/references/breadth/surface-discovery.md +16 -0
- package/skills/engineering/ensure-coverage/references/depth/characterization.md +68 -0
- package/skills/engineering/ensure-coverage/references/depth/coverage.config.example.json +19 -0
- package/skills/engineering/ensure-coverage/references/depth/grading.md +35 -0
- package/skills/engineering/ensure-coverage/references/depth/mock-policy.md +57 -0
- package/skills/engineering/ensure-coverage/references/depth/test-smells.md +39 -0
- package/skills/engineering/ensure-coverage/references/enforcement/ci-contract.md +44 -0
- package/skills/engineering/ensure-coverage/references/examples/coverage-ledger.md +110 -0
- package/skills/engineering/ensure-coverage/references/examples/refund-flow.md +35 -0
- package/skills/engineering/ensure-coverage/references/presentation/axis.md +64 -0
- package/skills/engineering/ensure-coverage/references/process/audit-mode.md +27 -0
- package/skills/engineering/ensure-coverage/references/process/output-template.md +139 -0
- package/skills/engineering/ensure-coverage/references/process/test-strategy.md +56 -0
- package/skills/engineering/ensure-coverage/release-check.mjs +93 -0
- package/skills/engineering/ensure-coverage/schemas/coverage-config.schema.json +67 -0
- package/skills/engineering/ensure-coverage/schemas/coverage-file.schema.json +140 -0
- package/skills/engineering/ensure-coverage/scripts/README.md +99 -0
- package/skills/engineering/ensure-coverage/scripts/adapters/nextjs-inventory.mjs +182 -0
- package/skills/engineering/ensure-coverage/scripts/adapters/nextjs-inventory.test.mjs +96 -0
- package/skills/engineering/ensure-coverage/scripts/check-quarantine-expiry.mjs +105 -0
- package/skills/engineering/ensure-coverage/scripts/check-quarantine-expiry.test.mjs +47 -0
- package/skills/engineering/ensure-coverage/scripts/ci-audit.mjs +137 -0
- package/skills/engineering/ensure-coverage/scripts/ci-audit.test.mjs +86 -0
- package/skills/engineering/ensure-coverage/scripts/coverage-ledger.mjs +674 -0
- package/skills/engineering/ensure-coverage/scripts/coverage-ledger.test.mjs +447 -0
- package/skills/engineering/ensure-coverage/scripts/design-parity.mjs +591 -0
- package/skills/engineering/ensure-coverage/scripts/design-parity.test.mjs +552 -0
- package/skills/engineering/ensure-coverage/scripts/lint-tests.mjs +282 -0
- package/skills/engineering/ensure-coverage/scripts/lint-tests.test.mjs +289 -0
- package/skills/engineering/ensure-coverage/scripts/mock-policy-config.mjs +176 -0
- package/skills/engineering/ensure-coverage/scripts/mock-policy-config.test.mjs +119 -0
- package/skills/engineering/ensure-coverage/scripts/package.json +19 -0
- package/skills/engineering/golden-path/LICENSE +3 -0
- package/skills/engineering/golden-path/SKILL.md +230 -0
- package/skills/engineering/golden-path/agents/openai.yaml +3 -0
- package/skills/engineering/golden-path/assets/golden-paths.example.json +57 -0
- package/skills/engineering/golden-path/references/contract.md +239 -0
- package/skills/engineering/golden-path/references/migration.md +111 -0
- package/skills/engineering/golden-path/release-check.mjs +93 -0
- package/skills/engineering/golden-path/scripts/golden-path-core.mjs +1779 -0
- package/skills/engineering/golden-path/scripts/golden-path.mjs +6 -0
- package/skills/engineering/golden-path/scripts/golden-path.test.mjs +1457 -0
- package/skills/engineering/harness-runtime/LICENSE +3 -0
- package/skills/engineering/harness-runtime/SKILL.md +19 -0
- package/skills/engineering/harness-runtime/agents/openai.yaml +6 -0
- package/skills/engineering/harness-runtime/bin/discover-models.mjs +4 -0
- package/skills/engineering/harness-runtime/bin/model-catalog.mjs +4 -0
- package/skills/engineering/harness-runtime/contracts.md +15 -0
- package/skills/engineering/harness-runtime/discover-models.mjs +392 -0
- package/skills/engineering/harness-runtime/discover-models.test.mjs +363 -0
- package/skills/engineering/harness-runtime/fixtures/native-question-schemas.json +33 -0
- package/skills/engineering/harness-runtime/fixtures/question-responses.json +54 -0
- package/skills/engineering/harness-runtime/harness-runtime.test.mjs +967 -0
- package/skills/engineering/harness-runtime/index.mjs +767 -0
- package/skills/engineering/harness-runtime/model-catalog-seed.test.mjs +829 -0
- package/skills/engineering/harness-runtime/model-catalog.mjs +787 -0
- package/skills/engineering/harness-runtime/model-catalog.test.mjs +366 -0
- package/skills/engineering/harness-runtime/native-question-contracts.md +37 -0
- package/skills/engineering/harness-runtime/references/model-catalog-seed.json +408 -0
- package/skills/engineering/harness-runtime/references/model-catalog.md +57 -0
- package/skills/engineering/harness-runtime/release-check.mjs +93 -0
- package/skills/engineering/resolve-issues/LICENSE +3 -0
- package/skills/engineering/resolve-issues/SKILL.md +250 -0
- package/skills/engineering/resolve-issues/agents/openai.yaml +9 -0
- package/skills/engineering/resolve-issues/plugin-hooks.json +17 -0
- package/skills/engineering/resolve-issues/references/canary.md +28 -0
- package/skills/engineering/resolve-issues/references/ci.md +105 -0
- package/skills/engineering/resolve-issues/references/done.md +25 -0
- package/skills/engineering/resolve-issues/references/dropbox.md +90 -0
- package/skills/engineering/resolve-issues/references/expire.md +318 -0
- package/skills/engineering/resolve-issues/references/exploration.md +202 -0
- package/skills/engineering/resolve-issues/references/implementation.md +303 -0
- package/skills/engineering/resolve-issues/references/preflight.md +445 -0
- package/skills/engineering/resolve-issues/references/review.md +228 -0
- package/skills/engineering/resolve-issues/references/shared-modules.md +44 -0
- package/skills/engineering/resolve-issues/references/task-plan.md +264 -0
- package/skills/engineering/resolve-issues/release-check.mjs +93 -0
- package/skills/engineering/resolve-issues/scripts/cleanup-runs.mjs +364 -0
- package/skills/engineering/resolve-issues/scripts/cleanup-runs.test.mjs +280 -0
- package/skills/engineering/resolve-issues/scripts/discover-models.mjs +9 -0
- package/skills/engineering/resolve-issues/scripts/dropbox.mjs +473 -0
- package/skills/engineering/resolve-issues/scripts/dropbox.test.mjs +346 -0
- package/skills/engineering/resolve-issues/scripts/findings-reuse.mjs +98 -0
- package/skills/engineering/resolve-issues/scripts/findings-reuse.test.mjs +88 -0
- package/skills/engineering/resolve-issues/scripts/github-reviews.mjs +384 -0
- package/skills/engineering/resolve-issues/scripts/github-reviews.test.mjs +264 -0
- package/skills/engineering/resolve-issues/scripts/install-hooks.mjs +135 -0
- package/skills/engineering/resolve-issues/scripts/install-hooks.test.mjs +79 -0
- package/skills/engineering/resolve-issues/scripts/issue-tree.mjs +162 -0
- package/skills/engineering/resolve-issues/scripts/issue-tree.test.mjs +107 -0
- package/skills/engineering/resolve-issues/scripts/manual-invocation.test.mjs +14 -0
- package/skills/engineering/resolve-issues/scripts/model-catalog.mjs +9 -0
- package/skills/engineering/resolve-issues/scripts/next-actions-capacity.test.mjs +149 -0
- package/skills/engineering/resolve-issues/scripts/next-actions.mjs +856 -0
- package/skills/engineering/resolve-issues/scripts/next-actions.test.mjs +915 -0
- package/skills/engineering/resolve-issues/scripts/plan-sync.mjs +269 -0
- package/skills/engineering/resolve-issues/scripts/plan-sync.test.mjs +156 -0
- package/skills/engineering/resolve-issues/scripts/preflight-models.mjs +736 -0
- package/skills/engineering/resolve-issues/scripts/preflight-models.test.mjs +448 -0
- package/skills/engineering/resolve-issues/scripts/ready-check.mjs +185 -0
- package/skills/engineering/resolve-issues/scripts/ready-check.test.mjs +217 -0
- package/skills/engineering/resolve-issues/scripts/rehydrate.mjs +98 -0
- package/skills/engineering/resolve-issues/scripts/rehydrate.test.mjs +91 -0
- package/skills/engineering/resolve-issues/scripts/review-verdict.mjs +509 -0
- package/skills/engineering/resolve-issues/scripts/review-verdict.test.mjs +1060 -0
- package/skills/engineering/resolve-issues/scripts/size-check.mjs +492 -0
- package/skills/engineering/resolve-issues/scripts/size-check.test.mjs +458 -0
- package/skills/engineering/resolve-release/LICENSE +3 -0
- package/skills/engineering/resolve-release/SKILL.md +215 -0
- package/skills/engineering/resolve-release/agents/openai.yaml +8 -0
- package/skills/engineering/resolve-release/flows/cloud-run-canary.md +13 -0
- package/skills/engineering/resolve-release/flows/cloud-run.md +7 -0
- package/skills/engineering/resolve-release/flows/root-tag-npm.md +13 -0
- package/skills/engineering/resolve-release/flows/workspace-npm.md +22 -0
- package/skills/engineering/resolve-release/references/canary.md +51 -0
- package/skills/engineering/resolve-release/references/candidate.md +41 -0
- package/skills/engineering/resolve-release/references/cut.md +131 -0
- package/skills/engineering/resolve-release/references/dark-launch.md +66 -0
- package/skills/engineering/resolve-release/references/flows.md +150 -0
- package/skills/engineering/resolve-release/references/preflight.md +154 -0
- package/skills/engineering/resolve-release/references/prepared-metadata.md +260 -0
- package/skills/engineering/resolve-release/references/promotion.md +82 -0
- package/skills/engineering/resolve-release/references/publish.md +232 -0
- package/skills/engineering/resolve-release/references/workspace-npm.md +103 -0
- package/skills/engineering/resolve-release/release-check.mjs +93 -0
- package/skills/engineering/resolve-release/scripts/apply.mjs +212 -0
- package/skills/engineering/resolve-release/scripts/apply.test.mjs +99 -0
- package/skills/engineering/resolve-release/scripts/dark-flags.mjs +134 -0
- package/skills/engineering/resolve-release/scripts/dark-flags.test.mjs +100 -0
- package/skills/engineering/resolve-release/scripts/flow.mjs +500 -0
- package/skills/engineering/resolve-release/scripts/flow.test.mjs +340 -0
- package/skills/engineering/resolve-release/scripts/green-head.mjs +231 -0
- package/skills/engineering/resolve-release/scripts/green-head.test.mjs +101 -0
- package/skills/engineering/resolve-release/scripts/npm-version-absence.mjs +138 -0
- package/skills/engineering/resolve-release/scripts/npm-version-absence.test.mjs +426 -0
- package/skills/engineering/resolve-release/scripts/plan-npm.test.mjs +659 -0
- package/skills/engineering/resolve-release/scripts/plan-toml-boundary.test.mjs +317 -0
- package/skills/engineering/resolve-release/scripts/plan-uv.test.mjs +291 -0
- package/skills/engineering/resolve-release/scripts/plan.mjs +806 -0
- package/skills/engineering/resolve-release/scripts/plan.test.mjs +428 -0
- package/skills/engineering/rush-issues/LICENSE +3 -0
- package/skills/engineering/rush-issues/SKILL.md +58 -0
- package/skills/engineering/rush-issues/agents/openai.yaml +8 -0
- package/skills/engineering/rush-issues/rehydrate.mjs +10 -0
- package/skills/engineering/rush-issues/release-check.mjs +93 -0
- package/skills/engineering/rush-release/LICENSE +3 -0
- package/skills/engineering/rush-release/SKILL.md +35 -0
- package/skills/engineering/rush-release/agents/openai.yaml +8 -0
- package/skills/engineering/rush-release/release-check.mjs +93 -0
- package/skills/engineering/test-quality/LICENSE +3 -0
- package/skills/engineering/test-quality/SKILL.md +79 -0
- package/skills/engineering/test-quality/references/audit.md +80 -0
- package/skills/engineering/test-quality/references/lint.md +24 -0
- package/skills/engineering/test-quality/references/principles.md +143 -0
- package/skills/engineering/test-quality/references/testing-conventions.md +9 -0
- package/skills/engineering/test-quality/release-check.mjs +93 -0
- package/skills/engineering/test-quality/scripts/lint-tests.mjs +574 -0
- package/skills/engineering/test-quality/scripts/lint-tests.test.mjs +591 -0
- package/skills/engineering/test-quality/scripts/mock-policy-config.mjs +176 -0
- package/skills/engineering/test-quality/scripts/mock-policy-config.test.mjs +119 -0
- package/skills/engineering/test-quality/scripts/persist-conventions-core.mjs +117 -0
- package/skills/engineering/test-quality/scripts/persist-conventions.mjs +17 -0
- package/skills/engineering/test-quality/scripts/persist-conventions.test.mjs +104 -0
- package/skills/risk-compliance/compliance-audit/LICENSE +3 -0
- package/skills/risk-compliance/compliance-audit/SKILL.md +439 -0
- package/skills/risk-compliance/compliance-audit/references/findings-schema.md +293 -0
- package/skills/risk-compliance/compliance-audit/references/normalization-rules.md +45 -0
- package/skills/risk-compliance/compliance-audit/references/vars-checklist.md +1068 -0
- package/skills/risk-compliance/compliance-audit/references/vars-findings-schema.md +398 -0
- package/skills/risk-compliance/compliance-audit/release-check.mjs +93 -0
- package/skills/risk-compliance/compliance-audit/scripts/compliance-audit.test.mjs +14 -0
- package/skills/risk-compliance/compliance-audit/scripts/export_tracker_xlsx.py +221 -0
- package/skills/risk-compliance/compliance-audit/scripts/reconcile_tracker.py +458 -0
- package/skills/risk-compliance/compliance-audit/scripts/test_export_tracker_xlsx.py +97 -0
- package/skills/risk-compliance/compliance-audit/scripts/test_validate_tracker.py +157 -0
- package/skills/risk-compliance/compliance-audit/scripts/validate_tracker.py +829 -0
- package/skills/risk-compliance/contract-compare/LICENSE +3 -0
- package/skills/risk-compliance/contract-compare/SKILL.md +199 -0
- package/skills/risk-compliance/contract-compare/references/comparison-dimensions.md +209 -0
- package/skills/risk-compliance/contract-compare/release-check.mjs +93 -0
- package/skills/risk-compliance/contract-review/LICENSE +3 -0
- package/skills/risk-compliance/contract-review/SKILL.md +240 -0
- package/skills/risk-compliance/contract-review/references/review-criteria.md +223 -0
- package/skills/risk-compliance/contract-review/release-check.mjs +93 -0
- package/skills/risk-compliance/doc-authenticity/LICENSE +3 -0
- package/skills/risk-compliance/doc-authenticity/SKILL.md +160 -0
- package/skills/risk-compliance/doc-authenticity/agents/openai.yaml +8 -0
- package/skills/risk-compliance/doc-authenticity/manual-invocation.test.mjs +12 -0
- package/skills/risk-compliance/doc-authenticity/references/agreement.md +66 -0
- package/skills/risk-compliance/doc-authenticity/references/bank-statement.md +150 -0
- package/skills/risk-compliance/doc-authenticity/references/forensic-signals.md +157 -0
- package/skills/risk-compliance/doc-authenticity/references/image-signals.md +114 -0
- package/skills/risk-compliance/doc-authenticity/references/invoice.md +66 -0
- package/skills/risk-compliance/doc-authenticity/references/issuer-profiles.md +86 -0
- package/skills/risk-compliance/doc-authenticity/references/verdict-and-report.md +95 -0
- package/skills/risk-compliance/doc-authenticity/references/verdict.schema.json +81 -0
- package/skills/risk-compliance/doc-authenticity/release-check.mjs +93 -0
- package/skills/risk-compliance/doc-authenticity/scripts/image_forensics.py +294 -0
- package/skills/risk-compliance/doc-authenticity/scripts/pdf_forensics.py +401 -0
- package/skills/risk-compliance/doc-authenticity/scripts/validate_codes.py +224 -0
- package/skills/risk-compliance/doc-authenticity/scripts/validate_verdict.py +308 -0
- package/skills/risk-compliance/doc-authenticity/scripts/validate_verdict.test.mjs +212 -0
- package/skills/risk-compliance/fraud-analysis/LICENSE +3 -0
- package/skills/risk-compliance/fraud-analysis/SKILL.md +114 -0
- package/skills/risk-compliance/fraud-analysis/references/archetypes/authorized-payment-scam.md +41 -0
- package/skills/risk-compliance/fraud-analysis/references/archetypes/first-party-fraud.md +44 -0
- package/skills/risk-compliance/fraud-analysis/references/archetypes/third-party-fraud.md +27 -0
- package/skills/risk-compliance/fraud-analysis/references/contexts/bank-transfer.md +24 -0
- package/skills/risk-compliance/fraud-analysis/references/contexts/card-payment.md +30 -0
- package/skills/risk-compliance/fraud-analysis/references/contexts/payment-collection.md +20 -0
- package/skills/risk-compliance/fraud-analysis/references/contexts/payout.md +20 -0
- package/skills/risk-compliance/fraud-analysis/references/feature-engineering.md +158 -0
- package/skills/risk-compliance/fraud-analysis/references/mechanisms/account-takeover.md +36 -0
- package/skills/risk-compliance/fraud-analysis/references/report-rationale.md +45 -0
- package/skills/risk-compliance/fraud-analysis/references/report-template.md +190 -0
- package/skills/risk-compliance/fraud-analysis/references/review-checklist.md +175 -0
- package/skills/risk-compliance/fraud-analysis/references/taxonomy.md +79 -0
- package/skills/risk-compliance/fraud-analysis/references/terminology.md +108 -0
- package/skills/risk-compliance/fraud-analysis/references/workflow.md +175 -0
- package/skills/risk-compliance/fraud-analysis/release-check.mjs +93 -0
- package/skills/risk-compliance/payment-analysis/LICENSE +3 -0
- package/skills/risk-compliance/payment-analysis/SKILL.md +180 -0
- package/skills/risk-compliance/payment-analysis/references/auth-rate-actions.md +30 -0
- package/skills/risk-compliance/payment-analysis/references/chargebacks.md +208 -0
- package/skills/risk-compliance/payment-analysis/references/chinese-polish.md +51 -0
- package/skills/risk-compliance/payment-analysis/references/event-layers.md +127 -0
- package/skills/risk-compliance/payment-analysis/references/fx.md +59 -0
- package/skills/risk-compliance/payment-analysis/references/journey.md +79 -0
- package/skills/risk-compliance/payment-analysis/references/metrics.md +67 -0
- package/skills/risk-compliance/payment-analysis/references/report-template.md +119 -0
- package/skills/risk-compliance/payment-analysis/references/terminology.md +95 -0
- package/skills/risk-compliance/payment-analysis/references/visualization.md +56 -0
- package/skills/risk-compliance/payment-analysis/release-check.mjs +93 -0
- package/skills/risk-compliance/report-writing/LICENSE +3 -0
- package/skills/risk-compliance/report-writing/SKILL.md +220 -0
- package/skills/risk-compliance/report-writing/references/audit-report-template.md +121 -0
- package/skills/risk-compliance/report-writing/references/external-assessment-template.md +167 -0
- package/skills/risk-compliance/report-writing/references/management-report-template.md +145 -0
- package/skills/risk-compliance/report-writing/references/vars-report-template.md +224 -0
- package/skills/risk-compliance/report-writing/release-check.mjs +93 -0
- package/skills/risk-compliance/similar-domain/LICENSE +3 -0
- package/skills/risk-compliance/similar-domain/SKILL.md +203 -0
- package/skills/risk-compliance/similar-domain/references/entities.md +67 -0
- package/skills/risk-compliance/similar-domain/references/fingerprints.md +134 -0
- package/skills/risk-compliance/similar-domain/references/pivots.md +82 -0
- package/skills/risk-compliance/similar-domain/references/report-template.md +93 -0
- package/skills/risk-compliance/similar-domain/references/scoring.md +130 -0
- package/skills/risk-compliance/similar-domain/references/terminology.md +41 -0
- package/skills/risk-compliance/similar-domain/references/workflow.md +85 -0
- package/skills/risk-compliance/similar-domain/release-check.mjs +93 -0
- package/skills/risk-compliance/tld-detection/LICENSE +3 -0
- package/skills/risk-compliance/tld-detection/SKILL.md +245 -0
- package/skills/risk-compliance/tld-detection/agents/openai.yaml +9 -0
- package/skills/risk-compliance/tld-detection/references/chinese-polish.md +55 -0
- package/skills/risk-compliance/tld-detection/references/clean.md +51 -0
- package/skills/risk-compliance/tld-detection/references/clustering.md +235 -0
- package/skills/risk-compliance/tld-detection/references/decision.md +189 -0
- package/skills/risk-compliance/tld-detection/references/fx-conversion.md +232 -0
- package/skills/risk-compliance/tld-detection/references/report-template.md +272 -0
- package/skills/risk-compliance/tld-detection/references/streams.md +141 -0
- package/skills/risk-compliance/tld-detection/references/terminology.md +95 -0
- package/skills/risk-compliance/tld-detection/references/workflow.md +95 -0
- package/skills/risk-compliance/tld-detection/release-check.mjs +93 -0
- package/skills/risk-compliance/tld-detection/scripts/detect_ladders.py +390 -0
- package/skills/risk-compliance/tld-detection/scripts/detect_ladders.test.mjs +14 -0
- package/skills/risk-compliance/tld-detection/scripts/detect_streams.py +650 -0
- package/skills/risk-compliance/tld-detection/scripts/detect_streams.test.mjs +14 -0
- package/skills/risk-compliance/tld-detection/tests/test_detect_ladders.py +134 -0
- package/skills/risk-compliance/tld-detection/tests/test_detect_streams.py +520 -0
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { test } from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
import { execFileSync, spawnSync } from 'node:child_process'
|
|
4
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
|
|
5
|
+
import { tmpdir } from 'node:os'
|
|
6
|
+
import { dirname, join } from 'node:path'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
|
|
9
|
+
import { addEntry, changedRanges, emptyDropbox, fingerprint, fromReview, groupEntries, inUnitDiff, issueFor, markEntry, pendingRuns, planPost, post, sanitize } from './dropbox.mjs'
|
|
10
|
+
|
|
11
|
+
const script = join(dirname(fileURLToPath(import.meta.url)), 'dropbox.mjs')
|
|
12
|
+
const tmp = () => mkdtempSync(join(tmpdir(), 'dropbox-'))
|
|
13
|
+
|
|
14
|
+
// A repository on `main` with a.ts (10 lines) and a unit branch that edits line 3 and adds b.ts.
|
|
15
|
+
function unitRepo() {
|
|
16
|
+
const dir = tmp()
|
|
17
|
+
const git = (...args) => execFileSync('git', ['-C', dir, ...args], { encoding: 'utf8' })
|
|
18
|
+
git('init', '-q', '-b', 'main')
|
|
19
|
+
git('config', 'user.email', 't@example.com')
|
|
20
|
+
git('config', 'user.name', 't')
|
|
21
|
+
writeFileSync(join(dir, 'a.ts'), Array.from({ length: 10 }, (_, i) => `line ${i + 1}`).join('\n') + '\n')
|
|
22
|
+
git('add', '.')
|
|
23
|
+
git('commit', '-qm', 'base')
|
|
24
|
+
git('checkout', '-qb', 'unit')
|
|
25
|
+
const lines = readFileSync(join(dir, 'a.ts'), 'utf8').split('\n')
|
|
26
|
+
lines[2] = 'changed 3'
|
|
27
|
+
writeFileSync(join(dir, 'a.ts'), lines.join('\n'))
|
|
28
|
+
writeFileSync(join(dir, 'b.ts'), 'new\n')
|
|
29
|
+
git('add', '.')
|
|
30
|
+
git('commit', '-qm', 'unit')
|
|
31
|
+
return dir
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const entry = (over = {}) => ({ unit: '12', source: 'review', kind: 'docs', file: 'docs/a.md', line: 4, summary: 'typo in heading', ...over })
|
|
35
|
+
|
|
36
|
+
test('hunk ranges come from the new side; a pure deletion adds none', () => {
|
|
37
|
+
assert.deepEqual(changedRanges('@@ -3 +3 @@\n@@ -7,0 +8,2 @@\n@@ -12,3 +13,0 @@\n'), [[3, 3], [8, 9]])
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('the unit diff covers changed lines and added files, not untouched lines', () => {
|
|
41
|
+
const dir = unitRepo()
|
|
42
|
+
assert.equal(inUnitDiff({ dir, base: 'main', file: 'a.ts', line: 3 }), true)
|
|
43
|
+
assert.equal(inUnitDiff({ dir, base: 'main', file: 'a.ts', line: 7 }), false)
|
|
44
|
+
assert.equal(inUnitDiff({ dir, base: 'main', file: 'a.ts' }), true, 'without a line, any change to the file counts')
|
|
45
|
+
assert.equal(inUnitDiff({ dir, base: 'main', file: 'b.ts', line: 1 }), true)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('uncommitted work in the workspace counts as the unit\'s change', () => {
|
|
49
|
+
const dir = unitRepo()
|
|
50
|
+
const lines = readFileSync(join(dir, 'a.ts'), 'utf8').split('\n')
|
|
51
|
+
lines[8] = 'edited 9'
|
|
52
|
+
writeFileSync(join(dir, 'a.ts'), lines.join('\n'))
|
|
53
|
+
assert.equal(inUnitDiff({ dir, base: 'main', file: 'a.ts', line: 9 }), true)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('check exits 0 and reports inDiff true inside the diff and false outside', () => {
|
|
57
|
+
const dir = unitRepo()
|
|
58
|
+
const inside = spawnSync('node', [script, 'check', '--git', dir, '--base', 'main', '--file', 'a.ts', '--line', '3'], { encoding: 'utf8' })
|
|
59
|
+
assert.equal(inside.status, 0, inside.stderr)
|
|
60
|
+
assert.deepEqual([JSON.parse(inside.stdout).inDiff, JSON.parse(inside.stdout).do], [true, 'fix it in this unit'])
|
|
61
|
+
const outside = spawnSync('node', [script, 'check', '--git', dir, '--base', 'main', '--file', 'a.ts', '--line', '7'], { encoding: 'utf8' })
|
|
62
|
+
assert.equal(outside.status, 0, outside.stderr)
|
|
63
|
+
assert.equal(JSON.parse(outside.stdout).inDiff, false)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('an implementer entry inside its own diff is refused; a review entry there is kept and marked', () => {
|
|
67
|
+
const box = emptyDropbox()
|
|
68
|
+
assert.equal(addEntry(box, entry({ source: 'implementer' }), true).refused, true)
|
|
69
|
+
assert.equal(box.entries.length, 0)
|
|
70
|
+
const kept = addEntry(box, entry({ source: 'review', finding: 'R2', severity: 'P2' }), true)
|
|
71
|
+
assert.equal(kept.inDiff, true)
|
|
72
|
+
assert.equal(box.entries[0].inDiff, true)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test('a P3 is skipped: add refuses it and from-review never adds it', () => {
|
|
76
|
+
const box = emptyDropbox()
|
|
77
|
+
assert.throws(() => addEntry(box, entry({ source: 'review', finding: 'R3', severity: 'P3' }), false), /a P3 is skipped/)
|
|
78
|
+
const review = { unit: '12', findings: [{ id: 'R3', severity: 'P3', summary: 'tidy comment', file: 'a.ts', line: 2 }] }
|
|
79
|
+
assert.deepEqual(fromReview(box, review), [])
|
|
80
|
+
assert.equal(review.findings[0].dropboxId, undefined)
|
|
81
|
+
assert.equal(box.entries.length, 0)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('the CLI add refuses an implementer entry inside the diff with `refused` (exit 0) and writes nothing', () => {
|
|
85
|
+
const dir = unitRepo()
|
|
86
|
+
const path = join(tmp(), 'dropbox.json')
|
|
87
|
+
const args = ['add', '--dropbox', path, '--unit', '7', '--source', 'implementer', '--kind', 'bug', '--file', 'a.ts', '--line', '3', '--summary', 's', '--git', dir, '--base', 'main']
|
|
88
|
+
const refused = spawnSync('node', [script, ...args], { encoding: 'utf8' })
|
|
89
|
+
assert.equal(refused.status, 0, refused.stderr)
|
|
90
|
+
assert.ok(JSON.parse(refused.stdout).refused)
|
|
91
|
+
assert.equal(existsSync(path), false)
|
|
92
|
+
const ok = spawnSync('node', [script, ...args.map((a) => (a === '3' ? '7' : a))], { encoding: 'utf8' })
|
|
93
|
+
assert.equal(ok.status, 0, ok.stderr)
|
|
94
|
+
assert.equal(JSON.parse(readFileSync(path, 'utf8')).entries[0].inDiff, false)
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
test('a P0/P1, a missing location, or an unknown kind is rejected', () => {
|
|
98
|
+
const box = emptyDropbox()
|
|
99
|
+
assert.throws(() => addEntry(box, entry({ severity: 'P1' })), /never goes in the dropbox/)
|
|
100
|
+
assert.throws(() => addEntry(box, entry({ file: undefined })), /--file is required/)
|
|
101
|
+
assert.throws(() => addEntry(box, entry({ kind: 'nit' })), /--kind must be/)
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
test('the same problem is one entry, and a review finding id is one entry across rounds', () => {
|
|
105
|
+
const box = emptyDropbox()
|
|
106
|
+
const first = addEntry(box, entry())
|
|
107
|
+
assert.deepEqual(addEntry(box, entry({ summary: ' Typo in heading ' })), { id: first.id, duplicate: true, inDiff: null })
|
|
108
|
+
const r = addEntry(box, entry({ finding: 'R3', file: 'x.ts', summary: 'one wording' }))
|
|
109
|
+
assert.equal(addEntry(box, entry({ finding: 'R3', file: 'x.ts', line: 9, summary: 'reworded next round' })).id, r.id)
|
|
110
|
+
assert.equal(box.entries.length, 2)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
test('local absolute paths never reach an issue, and summaries are capped', () => {
|
|
114
|
+
assert.equal(sanitize('see /Users/someone/run/a.log and /tmp/x'), 'see <local path> and <local path>')
|
|
115
|
+
assert.equal(sanitize('see src/tmp/cache.ts and app/home/page.tsx'), 'see src/tmp/cache.ts and app/home/page.tsx', 'repository paths stay')
|
|
116
|
+
assert.ok(sanitize('x'.repeat(400)).length <= 280)
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
test('entries group by parent PR and by file and kind across PRs', () => {
|
|
120
|
+
const box = emptyDropbox()
|
|
121
|
+
addEntry(box, entry({ file: 'a.ts', kind: 'test', summary: '1', pr: 'https://github.com/o/r/pull/5' }))
|
|
122
|
+
addEntry(box, entry({ file: 'b.ts', kind: 'docs', summary: '2', pr: 'https://github.com/o/r/pull/5' }))
|
|
123
|
+
addEntry(box, entry({ file: 'a.ts', kind: 'test', summary: '3', pr: 'https://github.com/o/r/pull/6' }))
|
|
124
|
+
addEntry(box, entry({ file: 'z.ts', kind: 'ci', summary: '4', pr: 'https://github.com/o/r/pull/7' }))
|
|
125
|
+
const groups = groupEntries(box.entries)
|
|
126
|
+
assert.deepEqual(groups.map((g) => [g.id, g.entries.map((e) => e.summary)]), [['G1', ['1', '2', '3']], ['G4', ['4']]])
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
test('the issue lists each location, its parent PR, what it blocks, and a fingerprint marker', () => {
|
|
130
|
+
const box = emptyDropbox()
|
|
131
|
+
addEntry(box, entry({ file: 'a.ts', line: 3, kind: 'test', summary: 'weak assert', pr: 'https://github.com/o/r/pull/5', finding: 'R2', blocks: ['https://github.com/o/r/issues/44'] }))
|
|
132
|
+
addEntry(box, entry({ file: 'a.ts', line: 9, kind: 'test', summary: 'no failure case', pr: 'https://github.com/o/r/pull/5' }))
|
|
133
|
+
const { title, body } = issueFor(groupEntries(box.entries)[0])
|
|
134
|
+
assert.equal(title, '2 test follow-ups in a.ts')
|
|
135
|
+
assert.match(body, /`a\.ts:3` \(test\) weak assert \(from #5, finding R2\)/)
|
|
136
|
+
assert.match(body, /Blocks o\/r#44/)
|
|
137
|
+
for (const e of box.entries) assert.ok(body.includes(`dropbox-fp:${e.fingerprint}`))
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
test('plan drops an entry whose file is gone and never posts decisions', () => {
|
|
141
|
+
const dir = unitRepo()
|
|
142
|
+
const box = emptyDropbox()
|
|
143
|
+
addEntry(box, entry({ file: 'a.ts', summary: 'kept' }))
|
|
144
|
+
addEntry(box, entry({ file: 'gone.ts', summary: 'gone' }))
|
|
145
|
+
addEntry(box, { unit: '12', source: 'implementer', decision: true, summary: 'should refunds round half-even?' })
|
|
146
|
+
const plan = planPost(box, { dir, ref: 'unit' })
|
|
147
|
+
assert.deepEqual(plan.dropped, ['D2'])
|
|
148
|
+
assert.deepEqual(plan.groups.flatMap((g) => g.entries.map((e) => e.summary)), ['kept'])
|
|
149
|
+
assert.deepEqual(plan.decisions.map((d) => d.summary), ['should refunds round half-even?'])
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
function fakeGh(openIssues = []) {
|
|
153
|
+
const calls = []
|
|
154
|
+
return {
|
|
155
|
+
calls,
|
|
156
|
+
gh: (args, input) => {
|
|
157
|
+
calls.push({ args, input })
|
|
158
|
+
if (args[1] === 'list') return JSON.stringify(openIssues)
|
|
159
|
+
if (args[1] === 'create') return `https://github.com/o/r/issues/${100 + calls.length}\n`
|
|
160
|
+
throw new Error(`unexpected gh ${args.join(' ')}`)
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
test('post files one labeled issue per group and records each entry\'s URL', () => {
|
|
166
|
+
const box = emptyDropbox()
|
|
167
|
+
addEntry(box, entry({ file: 'a.ts', summary: '1', pr: 'https://github.com/o/r/pull/5' }))
|
|
168
|
+
addEntry(box, entry({ file: 'b.ts', summary: '2', pr: 'https://github.com/o/r/pull/5' }))
|
|
169
|
+
addEntry(box, entry({ file: 'c.ts', kind: 'ci', summary: '3' }))
|
|
170
|
+
const { gh, calls } = fakeGh()
|
|
171
|
+
const result = post(box, { repo: 'o/r' }, { gh })
|
|
172
|
+
const creates = calls.filter((c) => c.args[1] === 'create')
|
|
173
|
+
assert.equal(creates.length, 2)
|
|
174
|
+
for (const c of creates) assert.deepEqual(c.args.slice(c.args.indexOf('--label'), c.args.indexOf('--label') + 2), ['--label', 'ready-for-agent'])
|
|
175
|
+
assert.equal(result.posted.length, 2)
|
|
176
|
+
assert.ok(box.entries.every((e) => e.status === 'posted' && e.postedUrl.startsWith('https://github.com/o/r/issues/')))
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
test('post skips an entry an open issue already carries, and --only limits the groups', () => {
|
|
180
|
+
const box = emptyDropbox()
|
|
181
|
+
addEntry(box, entry({ file: 'a.ts', summary: '1' }))
|
|
182
|
+
addEntry(box, entry({ file: 'c.ts', kind: 'ci', summary: '3' }))
|
|
183
|
+
addEntry(box, entry({ file: 'd.ts', kind: 'perf', summary: '4' }))
|
|
184
|
+
const filed = { url: 'https://github.com/o/r/issues/9', body: `<!-- dropbox-fp:${box.entries[0].fingerprint} -->` }
|
|
185
|
+
const { gh, calls } = fakeGh([filed])
|
|
186
|
+
const result = post(box, { repo: 'o/r', only: ['G2'] }, { gh })
|
|
187
|
+
assert.deepEqual(result.alreadyFiled, ['D1'])
|
|
188
|
+
assert.equal(box.entries[0].postedUrl, filed.url)
|
|
189
|
+
assert.equal(calls.filter((c) => c.args[1] === 'create').length, 1)
|
|
190
|
+
assert.equal(box.entries[1].status, 'posted')
|
|
191
|
+
assert.equal(box.entries[2].status, 'pending', 'G3 was not asked for')
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
test('from-review adds each undisposed P2 and writes its dropboxId back', () => {
|
|
195
|
+
const box = emptyDropbox()
|
|
196
|
+
const review = { unit: '12', findings: [
|
|
197
|
+
{ id: 'R1', severity: 'P1', summary: 'blocker', file: 'a.ts', line: 1 },
|
|
198
|
+
{ id: 'R2', severity: 'P2', pass: 'tests', summary: 'weak test', file: 'a.ts', line: 3 },
|
|
199
|
+
{ id: 'R3', severity: 'P2', summary: 'filed already', file: 'a.ts', followUpUrl: 'https://github.com/o/r/issues/1' },
|
|
200
|
+
] }
|
|
201
|
+
const added = fromReview(box, review, { pr: 'https://github.com/o/r/pull/5', inDiffOf: (file, line) => line === 3 })
|
|
202
|
+
assert.deepEqual(added, ['D1'])
|
|
203
|
+
assert.equal(review.findings[1].dropboxId, 'D1')
|
|
204
|
+
assert.equal(review.findings[0].dropboxId, undefined)
|
|
205
|
+
assert.deepEqual([box.entries[0].kind, box.entries[0].inDiff, box.entries[0].finding], ['test', true, 'R2'])
|
|
206
|
+
assert.deepEqual(fromReview(box, review), [], 'a second run adds nothing')
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
test('pending lists runs with unposted entries and exits 0 either way', () => {
|
|
210
|
+
const runs = tmp()
|
|
211
|
+
mkdirSync(join(runs, 'r1'))
|
|
212
|
+
mkdirSync(join(runs, 'r2'))
|
|
213
|
+
const box = emptyDropbox()
|
|
214
|
+
addEntry(box, entry())
|
|
215
|
+
writeFileSync(join(runs, 'r1', 'dropbox.json'), JSON.stringify(box))
|
|
216
|
+
writeFileSync(join(runs, 'r2', 'dropbox.json'), JSON.stringify(emptyDropbox()))
|
|
217
|
+
assert.deepEqual(pendingRuns(runs).map((r) => [r.run, r.pending]), [['r1', 1]])
|
|
218
|
+
const cli = spawnSync('node', [script, 'pending', '--runs', runs], { encoding: 'utf8' })
|
|
219
|
+
assert.equal(cli.status, 0, cli.stderr)
|
|
220
|
+
assert.equal(JSON.parse(cli.stdout).runs.length, 1)
|
|
221
|
+
const none = spawnSync('node', [script, 'pending', '--runs', join(runs, 'none')], { encoding: 'utf8' })
|
|
222
|
+
assert.equal(none.status, 0, none.stderr)
|
|
223
|
+
assert.deepEqual(JSON.parse(none.stdout).runs, [])
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
test('a problem found again at a shifted line is the same problem', () => {
|
|
227
|
+
assert.equal(fingerprint(entry({ line: 4 })), fingerprint(entry({ line: 40 })))
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
test('the diff can be taken at a given head, whatever the checkout', () => {
|
|
231
|
+
const dir = unitRepo()
|
|
232
|
+
const head = execFileSync('git', ['-C', dir, 'rev-parse', 'unit'], { encoding: 'utf8' }).trim()
|
|
233
|
+
execFileSync('git', ['-C', dir, 'checkout', '-q', 'main'])
|
|
234
|
+
assert.equal(inUnitDiff({ dir, base: 'main', file: 'a.ts', line: 3 }), false, 'the checkout is main')
|
|
235
|
+
assert.equal(inUnitDiff({ dir, base: 'main', head, file: 'a.ts', line: 3 }), true)
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
test('from-review takes the unit diff at the review head', () => {
|
|
239
|
+
const box = emptyDropbox()
|
|
240
|
+
const seen = []
|
|
241
|
+
fromReview(box, { unit: '1', head: 'abc', findings: [{ id: 'R2', severity: 'P2', summary: 's', file: 'a.ts', line: 3 }] }, { inDiffOf: (...args) => { seen.push(args); return false } })
|
|
242
|
+
assert.deepEqual(seen, [['a.ts', 3, 'abc']])
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
test('an urgent entry is filed alone with --ids, and is not filed again at the end', () => {
|
|
246
|
+
const box = emptyDropbox()
|
|
247
|
+
addEntry(box, entry({ file: 'a.ts', summary: 'nit', pr: 'https://github.com/o/r/pull/5' }))
|
|
248
|
+
addEntry(box, entry({ file: 'b.ts', kind: 'bug', summary: 'cross-org role change', pr: 'https://github.com/o/r/pull/5' }))
|
|
249
|
+
const first = fakeGh()
|
|
250
|
+
post(box, { repo: 'o/r', ids: ['D2'] }, { gh: first.gh })
|
|
251
|
+
const created = first.calls.filter((c) => c.args[1] === 'create')
|
|
252
|
+
assert.equal(created.length, 1)
|
|
253
|
+
assert.match(created[0].input, /cross-org role change/)
|
|
254
|
+
assert.doesNotMatch(created[0].input, /nit/, 'its PR group-mate stays for the end')
|
|
255
|
+
const end = fakeGh()
|
|
256
|
+
post(box, { repo: 'o/r' }, { gh: end.gh })
|
|
257
|
+
const bodies = end.calls.filter((c) => c.args[1] === 'create').map((c) => c.input)
|
|
258
|
+
assert.equal(bodies.length, 1)
|
|
259
|
+
assert.doesNotMatch(bodies[0], /cross-org/)
|
|
260
|
+
assert.throws(() => post(box, { repo: 'o/r', ids: ['D9'] }, { gh: end.gh }), /no entry D9/)
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
test('post finds already-filed entries among open issues carrying its label', () => {
|
|
264
|
+
const { gh, calls } = fakeGh()
|
|
265
|
+
post(emptyDropbox(), { repo: 'o/r', label: 'agent-ready' }, { gh })
|
|
266
|
+
const list = calls.find((c) => c.args[1] === 'list').args
|
|
267
|
+
assert.deepEqual(list.slice(list.indexOf('--label'), list.indexOf('--label') + 2), ['--label', 'agent-ready'])
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
test('mark drops an entry or turns it into a decision; a posted entry cannot change', () => {
|
|
271
|
+
const box = emptyDropbox()
|
|
272
|
+
addEntry(box, entry({ file: 'a.ts', summary: '1' }))
|
|
273
|
+
addEntry(box, entry({ file: 'b.ts', summary: '2' }))
|
|
274
|
+
markEntry(box, { id: 'D1', drop: 'file removed by epic #40' })
|
|
275
|
+
markEntry(box, { id: 'D2', decision: true })
|
|
276
|
+
assert.deepEqual(box.entries.map((e) => [e.status, e.route]), [['dropped', 'dropbox'], ['pending', 'decision']])
|
|
277
|
+
assert.deepEqual(planPost(box).groups, [])
|
|
278
|
+
assert.throws(() => markEntry(box, { id: 'D1' }), /--drop <reason> or --decision/)
|
|
279
|
+
box.entries[1].status = 'posted'
|
|
280
|
+
assert.throws(() => markEntry(box, { id: 'D2', drop: 'x' }), /already posted/)
|
|
281
|
+
})
|
|
282
|
+
|
|
283
|
+
test('pending ignores decisions, which their own run reports', () => {
|
|
284
|
+
const runs = tmp()
|
|
285
|
+
mkdirSync(join(runs, 'r1'))
|
|
286
|
+
const box = emptyDropbox()
|
|
287
|
+
addEntry(box, { unit: '1', source: 'implementer', decision: true, summary: 'which period?' })
|
|
288
|
+
writeFileSync(join(runs, 'r1', 'dropbox.json'), JSON.stringify(box))
|
|
289
|
+
assert.deepEqual(pendingRuns(runs), [])
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
test('a file the unit deleted is inside its diff; a path that never existed is an error', () => {
|
|
293
|
+
const dir = unitRepo()
|
|
294
|
+
execFileSync('git', ['-C', dir, 'rm', '-q', 'a.ts'])
|
|
295
|
+
execFileSync('git', ['-C', dir, 'commit', '-qm', 'drop a'])
|
|
296
|
+
assert.equal(inUnitDiff({ dir, base: 'main', file: 'a.ts', line: 7 }), true)
|
|
297
|
+
assert.throws(() => inUnitDiff({ dir, base: 'main', file: 'nope.ts', line: 1 }), /exists neither/)
|
|
298
|
+
assert.throws(() => inUnitDiff({ dir, base: 'main', file: 'b.ts', line: Number('abc') }), /positive integer/)
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
test('check and add refuse bad input instead of calling it outside the diff', () => {
|
|
302
|
+
const dir = unitRepo()
|
|
303
|
+
const run = (...args) => spawnSync('node', [script, ...args], { encoding: 'utf8' })
|
|
304
|
+
assert.equal(run('check', '--git', dir, '--base', 'main', '--file', 'a.ts', '--line', 'abc').status, 2)
|
|
305
|
+
assert.equal(run('check', '--git', dir, '--base', 'main', '--file', 'a.ts:5').status, 2)
|
|
306
|
+
assert.equal(run('check', '--git', dir, '--base', 'main', '--file', 'a.tss', '--line', '1').status, 2)
|
|
307
|
+
const path = join(tmp(), 'dropbox.json')
|
|
308
|
+
const noDiff = run('add', '--dropbox', path, '--unit', '7', '--source', 'implementer', '--kind', 'bug', '--file', 'a.ts', '--line', '3', '--summary', 's')
|
|
309
|
+
assert.equal(noDiff.status, 2, 'an implementer entry needs the diff check')
|
|
310
|
+
assert.match(noDiff.stderr, /--git, --base/)
|
|
311
|
+
assert.throws(() => addEntry(emptyDropbox(), entry({ file: join(dir, 'a.ts') })), /repository-relative/)
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
test('a bare issue number in --blocks becomes a link', () => {
|
|
315
|
+
const box = emptyDropbox()
|
|
316
|
+
addEntry(box, entry({ blocks: ['55'] }))
|
|
317
|
+
assert.match(issueFor(groupEntries(box.entries)[0]).body, /Blocks #55/)
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
test('post drops entries whose file is gone at --ref and posts --only groups by plan id', () => {
|
|
321
|
+
const dir = unitRepo()
|
|
322
|
+
const path = join(tmp(), 'dropbox.json')
|
|
323
|
+
const box = emptyDropbox()
|
|
324
|
+
addEntry(box, entry({ file: 'gone.ts', summary: 'gone' }))
|
|
325
|
+
addEntry(box, entry({ file: 'a.ts', kind: 'test', summary: 'kept 1' }))
|
|
326
|
+
addEntry(box, entry({ file: 'b.ts', kind: 'ci', summary: 'kept 2' }))
|
|
327
|
+
writeFileSync(path, JSON.stringify(box))
|
|
328
|
+
const bin = tmp()
|
|
329
|
+
const log = join(bin, 'log')
|
|
330
|
+
writeFileSync(join(bin, 'gh'), `#!/bin/sh\necho "$@" >> ${log}\ncat >> ${log}\ncase "$2" in list) echo '[]';; create) echo https://github.com/o/r/issues/101;; esac\n`, { mode: 0o755 })
|
|
331
|
+
const env = { ...process.env, PATH: `${bin}:${process.env.PATH}` }
|
|
332
|
+
const planned = JSON.parse(spawnSync('node', [script, 'plan', '--dropbox', path, '--git', dir, '--ref', 'unit'], { encoding: 'utf8' }).stdout)
|
|
333
|
+
assert.deepEqual(planned.groups.map((g) => g.id), ['G2', 'G3'])
|
|
334
|
+
const result = spawnSync('node', [script, 'post', '--dropbox', path, '--repo', 'o/r', '--git', dir, '--ref', 'unit', '--only', 'G3'], { encoding: 'utf8', env })
|
|
335
|
+
assert.equal(result.status, 0, result.stderr)
|
|
336
|
+
const after = JSON.parse(readFileSync(path, 'utf8')).entries
|
|
337
|
+
assert.deepEqual(after.map((e) => e.status), ['dropped', 'pending', 'posted'])
|
|
338
|
+
assert.doesNotMatch(readFileSync(log, 'utf8'), /gone/)
|
|
339
|
+
assert.equal(spawnSync('node', [script, 'plan', '--dropbox', path, '--ref', 'unit'], { encoding: 'utf8' }).status, 2, '--ref needs --git')
|
|
340
|
+
})
|
|
341
|
+
|
|
342
|
+
test('post --ids names a decision as one', () => {
|
|
343
|
+
const box = emptyDropbox()
|
|
344
|
+
addEntry(box, { unit: '1', source: 'implementer', decision: true, summary: 'which period?' })
|
|
345
|
+
assert.throws(() => post(box, { repo: 'o/r', ids: ['D1'] }, { gh: fakeGh().gh }), /D1 is a decision/)
|
|
346
|
+
})
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Decide which units' prior exploration findings still hold on the current HEAD, so an
|
|
3
|
+
// explorer rechecks only what changed instead of exploring every unit again.
|
|
4
|
+
//
|
|
5
|
+
// findings-reuse.mjs --prior <findings.json> [--units <id,id,...>] [--head HEAD]
|
|
6
|
+
//
|
|
7
|
+
// A unit's findings are reusable when no file its evidence names changed between the
|
|
8
|
+
// prior findings' `base` and HEAD. Evidence paths come from its prerequisites' evidence,
|
|
9
|
+
// `readFirst` (or legacy `start`), and its suite's evidence and check; a directory path
|
|
10
|
+
// matches any changed file under it. A unit with no prior entry is new. When the prior
|
|
11
|
+
// base is unknown or not in this repository, every unit is rechecked.
|
|
12
|
+
//
|
|
13
|
+
// Prints JSON { base, head, reuse: [ids], recheck: [{ id, changed: [paths] }], new: [ids] }.
|
|
14
|
+
// Exit codes: 0 printed, 2 usage error or unreadable prior findings.
|
|
15
|
+
|
|
16
|
+
import { execFileSync } from 'node:child_process'
|
|
17
|
+
import { readFileSync } from 'node:fs'
|
|
18
|
+
|
|
19
|
+
import { isMainModule } from '../../engineering-runtime/scripts/main-module.mjs'
|
|
20
|
+
|
|
21
|
+
export class FindingsReuseError extends Error {}
|
|
22
|
+
|
|
23
|
+
const USAGE = 'usage: findings-reuse.mjs --prior <findings.json> [--units <id,id,...>] [--head HEAD]'
|
|
24
|
+
const PATH = /(?:^|[\s(`'"])((?:\.{0,2}\/)?[\w@.-]+(?:\/[\w@.-]+)+\/?|[\w@-]+\.[a-z][\w]{0,7})(?::\d+(?:-\d+)?)?(?=$|[\s)`'",;])/gi
|
|
25
|
+
|
|
26
|
+
// Repository paths named in free text: `packages/core/page.ts:12`, `not in db/schema.sql`.
|
|
27
|
+
export function pathsIn(text) {
|
|
28
|
+
const out = new Set()
|
|
29
|
+
for (const m of String(text ?? '').matchAll(PATH)) out.add(m[1].replace(/^\.\//, ''))
|
|
30
|
+
return [...out]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function evidencePaths(entry) {
|
|
34
|
+
const texts = [
|
|
35
|
+
...(entry?.slice?.prerequisites ?? []).map((p) => p?.evidence),
|
|
36
|
+
...(entry?.readFirst ?? entry?.start ?? []),
|
|
37
|
+
entry?.proof?.suite?.evidence,
|
|
38
|
+
entry?.proof?.suite?.check,
|
|
39
|
+
entry?.proof?.suite?.local,
|
|
40
|
+
]
|
|
41
|
+
return [...new Set(texts.flatMap(pathsIn))].sort()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const touches = (path, changed) => changed.filter((f) => f === path || f.startsWith(path.endsWith('/') ? path : `${path}/`))
|
|
45
|
+
|
|
46
|
+
// Pure decision, from the prior findings, the units to plan, and the changed files.
|
|
47
|
+
export function decideReuse(prior, units, changed, baseKnown) {
|
|
48
|
+
const result = { reuse: [], recheck: [], new: [] }
|
|
49
|
+
for (const id of units) {
|
|
50
|
+
const entry = prior?.units?.[id]
|
|
51
|
+
if (!entry) { result.new.push(id); continue }
|
|
52
|
+
if (!baseKnown) { result.recheck.push({ id, changed: ['(prior base unknown)'] }); continue }
|
|
53
|
+
const hits = [...new Set(evidencePaths(entry).flatMap((p) => touches(p, changed)))].sort()
|
|
54
|
+
if (hits.length) result.recheck.push({ id, changed: hits })
|
|
55
|
+
else result.reuse.push(id)
|
|
56
|
+
}
|
|
57
|
+
return result
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function git(args) {
|
|
61
|
+
return execFileSync('git', args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], maxBuffer: 64 * 1024 * 1024 }).trim()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function findingsReuse({ prior, units, head = 'HEAD' }) {
|
|
65
|
+
const headSha = git(['rev-parse', head])
|
|
66
|
+
let baseKnown = typeof prior?.base === 'string' && prior.base.trim() !== ''
|
|
67
|
+
let changed = []
|
|
68
|
+
if (baseKnown) {
|
|
69
|
+
try { changed = git(['diff', '--name-only', prior.base, headSha]).split('\n').filter(Boolean) } catch { baseKnown = false }
|
|
70
|
+
}
|
|
71
|
+
const ids = units?.length ? units : Object.keys(prior?.units ?? {})
|
|
72
|
+
return { base: prior?.base ?? null, head: headSha, ...decideReuse(prior, ids, changed, baseKnown) }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function parseCliArgs(argv) {
|
|
76
|
+
const opts = { head: 'HEAD' }
|
|
77
|
+
for (let i = 0; i < argv.length; i += 2) {
|
|
78
|
+
const flag = argv[i]
|
|
79
|
+
if (!['--prior', '--units', '--head'].includes(flag) || argv[i + 1] === undefined) throw new FindingsReuseError(USAGE)
|
|
80
|
+
opts[flag.slice(2)] = argv[i + 1]
|
|
81
|
+
}
|
|
82
|
+
if (!opts.prior) throw new FindingsReuseError(USAGE)
|
|
83
|
+
return { ...opts, units: opts.units ? opts.units.split(',').map((s) => s.trim()).filter(Boolean) : null }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (isMainModule(import.meta.url)) {
|
|
87
|
+
try {
|
|
88
|
+
const opts = parseCliArgs(process.argv.slice(2))
|
|
89
|
+
let prior
|
|
90
|
+
try { prior = JSON.parse(readFileSync(opts.prior, 'utf8')) } catch (error) {
|
|
91
|
+
throw new FindingsReuseError(`cannot read prior findings ${opts.prior}: ${error.message}`)
|
|
92
|
+
}
|
|
93
|
+
process.stdout.write(`${JSON.stringify(findingsReuse({ prior, units: opts.units, head: opts.head }), null, 2)}\n`)
|
|
94
|
+
} catch (error) {
|
|
95
|
+
process.stderr.write(`findings-reuse: ${error.message}\n`)
|
|
96
|
+
process.exitCode = 2
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { test } from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
import { execFileSync, spawnSync } from 'node:child_process'
|
|
4
|
+
import fs from 'node:fs'
|
|
5
|
+
import os from 'node:os'
|
|
6
|
+
import path from 'node:path'
|
|
7
|
+
import { fileURLToPath } from 'node:url'
|
|
8
|
+
|
|
9
|
+
import { pathsIn, evidencePaths, decideReuse, parseCliArgs, FindingsReuseError } from './findings-reuse.mjs'
|
|
10
|
+
|
|
11
|
+
const SCRIPT = path.join(path.dirname(fileURLToPath(import.meta.url)), 'findings-reuse.mjs')
|
|
12
|
+
|
|
13
|
+
// A repo at `base`; then `src/charge/layout.ts` changes on main.
|
|
14
|
+
function fixture(t) {
|
|
15
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'findings-reuse-'))
|
|
16
|
+
t.after(() => fs.rmSync(dir, { recursive: true, force: true }))
|
|
17
|
+
const git = (...a) => execFileSync('git', a, { cwd: dir, encoding: 'utf8' }).trim()
|
|
18
|
+
const write = (f, text) => { fs.mkdirSync(path.dirname(path.join(dir, f)), { recursive: true }); fs.writeFileSync(path.join(dir, f), text) }
|
|
19
|
+
git('init', '-q', '-b', 'main'); git('config', 'user.email', 't@e.com'); git('config', 'user.name', 'T')
|
|
20
|
+
write('src/charge/layout.ts', 'a\n'); write('src/history/list.ts', 'b\n'); write('db/schema.sql', 'c\n')
|
|
21
|
+
git('add', '-A'); git('commit', '-qm', 'base')
|
|
22
|
+
const base = git('rev-parse', 'HEAD')
|
|
23
|
+
write('src/charge/layout.ts', 'a2\n'); git('commit', '-qam', 'earlier units merged')
|
|
24
|
+
const prior = {
|
|
25
|
+
version: 2, base,
|
|
26
|
+
units: {
|
|
27
|
+
charge: { slice: { prerequisites: [{ what: 'layout store', status: 'present', evidence: 'src/charge/layout.ts:3' }] }, readFirst: [] },
|
|
28
|
+
history: { slice: { prerequisites: [{ what: 'list view', status: 'present', evidence: 'src/history/list.ts:1' }] }, readFirst: ['src/history/'] },
|
|
29
|
+
migrate: { slice: { prerequisites: [{ what: 'cursor column', status: 'missing', separate: false, evidence: 'not in db/schema.sql' }] } },
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
const priorFile = path.join(dir, '..', `${path.basename(dir)}-prior.json`)
|
|
33
|
+
fs.writeFileSync(priorFile, JSON.stringify(prior))
|
|
34
|
+
t.after(() => fs.rmSync(priorFile, { force: true }))
|
|
35
|
+
const run = (...args) => spawnSync('node', [SCRIPT, '--prior', priorFile, ...args], { cwd: dir, encoding: 'utf8' })
|
|
36
|
+
return { dir, git, write, base, prior, run }
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
test('pathsIn finds repository paths in evidence prose, without line numbers', () => {
|
|
40
|
+
assert.deepEqual(pathsIn('packages/core/page.ts:12'), ['packages/core/page.ts'])
|
|
41
|
+
assert.deepEqual(pathsIn('not in db/schema.sql'), ['db/schema.sql'])
|
|
42
|
+
assert.deepEqual(pathsIn('no authority in backend/services'), ['backend/services'])
|
|
43
|
+
assert.deepEqual(pathsIn('e2e job green'), [])
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('evidencePaths reads prerequisites, readFirst (or legacy start), and the suite', () => {
|
|
47
|
+
const entry = {
|
|
48
|
+
slice: { prerequisites: [{ evidence: 'a/b.ts:1' }] },
|
|
49
|
+
start: ['c/d.ts'],
|
|
50
|
+
proof: { suite: { evidence: 'scripts/journey.py; green in CI', check: 'gh workflow run android.yml', local: 'bash scripts/charge-journey.sh' } },
|
|
51
|
+
}
|
|
52
|
+
// A renamed local journey script invalidates the reuse, like any other evidence path.
|
|
53
|
+
assert.deepEqual(evidencePaths(entry), ['a/b.ts', 'android.yml', 'c/d.ts', 'scripts/charge-journey.sh', 'scripts/journey.py'])
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('a unit is reused unless a file its evidence names changed; directories match files under them', () => {
|
|
57
|
+
const prior = { units: { a: { slice: { prerequisites: [{ evidence: 'src/x.ts:1' }] } }, b: { readFirst: ['src/y/'] } } }
|
|
58
|
+
assert.deepEqual(decideReuse(prior, ['a', 'b', 'c'], ['src/y/z.ts'], true), { reuse: ['a'], recheck: [{ id: 'b', changed: ['src/y/z.ts'] }], new: ['c'] })
|
|
59
|
+
assert.deepEqual(decideReuse(prior, ['a'], [], false).recheck.map((r) => r.id), ['a'], 'unknown base rechecks everything')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('CLI: after an earlier unit changed the charge layout, only the charge unit is rechecked', (t) => {
|
|
63
|
+
const f = fixture(t)
|
|
64
|
+
const out = JSON.parse(f.run().stdout)
|
|
65
|
+
assert.deepEqual(out.reuse, ['history', 'migrate'])
|
|
66
|
+
assert.deepEqual(out.recheck, [{ id: 'charge', changed: ['src/charge/layout.ts'] }])
|
|
67
|
+
assert.deepEqual(out.new, [])
|
|
68
|
+
const only = JSON.parse(f.run('--units', 'history,newunit').stdout)
|
|
69
|
+
assert.deepEqual(only.reuse, ['history'])
|
|
70
|
+
assert.deepEqual(only.new, ['newunit'])
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test('CLI: a missing prerequisite whose evidence file changed is rechecked (it may now exist)', (t) => {
|
|
74
|
+
const f = fixture(t)
|
|
75
|
+
f.write('db/schema.sql', 'c\ncursor\n'); f.git('commit', '-qam', 'add cursor')
|
|
76
|
+
assert.deepEqual(JSON.parse(f.run().stdout).recheck.map((r) => r.id), ['charge', 'migrate'])
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test('CLI: a prior base not in this repository rechecks every unit; bad input exits 2', (t) => {
|
|
80
|
+
const f = fixture(t)
|
|
81
|
+
const priorFile = path.join(f.dir, 'gone.json')
|
|
82
|
+
fs.writeFileSync(priorFile, JSON.stringify({ ...f.prior, base: '0'.repeat(40) }))
|
|
83
|
+
const out = JSON.parse(spawnSync('node', [SCRIPT, '--prior', priorFile], { cwd: f.dir, encoding: 'utf8' }).stdout)
|
|
84
|
+
assert.deepEqual(out.reuse, [])
|
|
85
|
+
assert.equal(out.recheck.length, 3)
|
|
86
|
+
assert.equal(spawnSync('node', [SCRIPT, '--prior', path.join(f.dir, 'missing.json')], { cwd: f.dir }).status, 2)
|
|
87
|
+
assert.throws(() => parseCliArgs([]), FindingsReuseError)
|
|
88
|
+
})
|