@shrkcrft/inspector 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/acceptance-replay.d.ts +63 -0
- package/dist/acceptance-replay.d.ts.map +1 -0
- package/dist/acceptance-replay.js +240 -0
- package/dist/action-hint-diagnostics.d.ts +32 -0
- package/dist/action-hint-diagnostics.d.ts.map +1 -0
- package/dist/action-hint-diagnostics.js +133 -0
- package/dist/adoption-check.d.ts +28 -0
- package/dist/adoption-check.d.ts.map +1 -0
- package/dist/adoption-check.js +181 -0
- package/dist/adoption-checkpoint.d.ts +97 -0
- package/dist/adoption-checkpoint.d.ts.map +1 -0
- package/dist/adoption-checkpoint.js +209 -0
- package/dist/adoption-merge-preview.d.ts +28 -0
- package/dist/adoption-merge-preview.d.ts.map +1 -0
- package/dist/adoption-merge-preview.js +254 -0
- package/dist/adoption-report-renderer.d.ts +33 -0
- package/dist/adoption-report-renderer.d.ts.map +1 -0
- package/dist/adoption-report-renderer.js +257 -0
- package/dist/adoption-state.d.ts +100 -0
- package/dist/adoption-state.d.ts.map +1 -0
- package/dist/adoption-state.js +296 -0
- package/dist/adoption-three-way.d.ts +46 -0
- package/dist/adoption-three-way.d.ts.map +1 -0
- package/dist/adoption-three-way.js +181 -0
- package/dist/agent-brief.d.ts +77 -0
- package/dist/agent-brief.d.ts.map +1 -0
- package/dist/agent-brief.js +490 -0
- package/dist/agent-contract-gate.d.ts +108 -0
- package/dist/agent-contract-gate.d.ts.map +1 -0
- package/dist/agent-contract-gate.js +412 -0
- package/dist/agent-contract-templates.d.ts +63 -0
- package/dist/agent-contract-templates.d.ts.map +1 -0
- package/dist/agent-contract-templates.js +346 -0
- package/dist/agent-contract.d.ts +65 -0
- package/dist/agent-contract.d.ts.map +1 -0
- package/dist/agent-contract.js +555 -0
- package/dist/agent-handoff.d.ts +123 -0
- package/dist/agent-handoff.d.ts.map +1 -0
- package/dist/agent-handoff.js +470 -0
- package/dist/agent-instructions.d.ts +2 -0
- package/dist/agent-instructions.d.ts.map +1 -0
- package/dist/agent-instructions.js +21 -0
- package/dist/agent-orchestration.d.ts +61 -0
- package/dist/agent-orchestration.d.ts.map +1 -0
- package/dist/agent-orchestration.js +285 -0
- package/dist/agent-task-prep.d.ts +31 -0
- package/dist/agent-task-prep.d.ts.map +1 -0
- package/dist/agent-task-prep.js +73 -0
- package/dist/ai-readiness.d.ts +30 -0
- package/dist/ai-readiness.d.ts.map +1 -0
- package/dist/ai-readiness.js +279 -0
- package/dist/api-report.d.ts +51 -0
- package/dist/api-report.d.ts.map +1 -0
- package/dist/api-report.js +254 -0
- package/dist/apply-dispatch-trace.d.ts +93 -0
- package/dist/apply-dispatch-trace.d.ts.map +1 -0
- package/dist/apply-dispatch-trace.js +283 -0
- package/dist/apply-gate-result.d.ts +52 -0
- package/dist/apply-gate-result.d.ts.map +1 -0
- package/dist/apply-gate-result.js +44 -0
- package/dist/architecture-map.d.ts +118 -0
- package/dist/architecture-map.d.ts.map +1 -0
- package/dist/architecture-map.js +543 -0
- package/dist/area-explore.d.ts +75 -0
- package/dist/area-explore.d.ts.map +1 -0
- package/dist/area-explore.js +438 -0
- package/dist/area-map.d.ts +57 -0
- package/dist/area-map.d.ts.map +1 -0
- package/dist/area-map.js +214 -0
- package/dist/asset-provenance.d.ts +123 -0
- package/dist/asset-provenance.d.ts.map +1 -0
- package/dist/asset-provenance.js +209 -0
- package/dist/barrel-operations.d.ts +45 -0
- package/dist/barrel-operations.d.ts.map +1 -0
- package/dist/barrel-operations.js +159 -0
- package/dist/boundaries-changed-only.d.ts +62 -0
- package/dist/boundaries-changed-only.d.ts.map +1 -0
- package/dist/boundaries-changed-only.js +97 -0
- package/dist/boundary-suggestions.d.ts +20 -0
- package/dist/boundary-suggestions.d.ts.map +1 -0
- package/dist/boundary-suggestions.js +51 -0
- package/dist/bundle-diff.d.ts +98 -0
- package/dist/bundle-diff.d.ts.map +1 -0
- package/dist/bundle-diff.js +531 -0
- package/dist/bundle-replay.d.ts +68 -0
- package/dist/bundle-replay.d.ts.map +1 -0
- package/dist/bundle-replay.js +273 -0
- package/dist/bundle-validate-html.d.ts +11 -0
- package/dist/bundle-validate-html.d.ts.map +1 -0
- package/dist/bundle-validate-html.js +60 -0
- package/dist/change-intent.d.ts +36 -0
- package/dist/change-intent.d.ts.map +1 -0
- package/dist/change-intent.js +259 -0
- package/dist/changed-preflight.d.ts +59 -0
- package/dist/changed-preflight.d.ts.map +1 -0
- package/dist/changed-preflight.js +358 -0
- package/dist/changed-scope.d.ts +112 -0
- package/dist/changed-scope.d.ts.map +1 -0
- package/dist/changed-scope.js +172 -0
- package/dist/changes-summary.d.ts +87 -0
- package/dist/changes-summary.d.ts.map +1 -0
- package/dist/changes-summary.js +323 -0
- package/dist/check-result-v1.d.ts +90 -0
- package/dist/check-result-v1.d.ts.map +1 -0
- package/dist/check-result-v1.js +335 -0
- package/dist/ci-integrity-report.d.ts +38 -0
- package/dist/ci-integrity-report.d.ts.map +1 -0
- package/dist/ci-integrity-report.js +324 -0
- package/dist/ci-permissions-fix.d.ts +38 -0
- package/dist/ci-permissions-fix.d.ts.map +1 -0
- package/dist/ci-permissions-fix.js +382 -0
- package/dist/ci-permissions.d.ts +51 -0
- package/dist/ci-permissions.d.ts.map +1 -0
- package/dist/ci-permissions.js +431 -0
- package/dist/ci-predict.d.ts +42 -0
- package/dist/ci-predict.d.ts.map +1 -0
- package/dist/ci-predict.js +300 -0
- package/dist/ci-scaffold.d.ts +47 -0
- package/dist/ci-scaffold.d.ts.map +1 -0
- package/dist/ci-scaffold.js +638 -0
- package/dist/codemod-assist.d.ts +97 -0
- package/dist/codemod-assist.d.ts.map +1 -0
- package/dist/codemod-assist.js +261 -0
- package/dist/command-recommender.d.ts +25 -0
- package/dist/command-recommender.d.ts.map +1 -0
- package/dist/command-recommender.js +145 -0
- package/dist/command-suggester.d.ts +61 -0
- package/dist/command-suggester.d.ts.map +1 -0
- package/dist/command-suggester.js +159 -0
- package/dist/command-taxonomy.d.ts +38 -0
- package/dist/command-taxonomy.d.ts.map +1 -0
- package/dist/command-taxonomy.js +164 -0
- package/dist/compliance-evidence.d.ts +58 -0
- package/dist/compliance-evidence.d.ts.map +1 -0
- package/dist/compliance-evidence.js +260 -0
- package/dist/compliance-profiles.d.ts +42 -0
- package/dist/compliance-profiles.d.ts.map +1 -0
- package/dist/compliance-profiles.js +171 -0
- package/dist/construct-adoption-diff.d.ts +55 -0
- package/dist/construct-adoption-diff.d.ts.map +1 -0
- package/dist/construct-adoption-diff.js +331 -0
- package/dist/construct-adoption.d.ts +71 -0
- package/dist/construct-adoption.d.ts.map +1 -0
- package/dist/construct-adoption.js +331 -0
- package/dist/construct-inference.d.ts +44 -0
- package/dist/construct-inference.d.ts.map +1 -0
- package/dist/construct-inference.js +391 -0
- package/dist/construct-registry.d.ts +32 -0
- package/dist/construct-registry.d.ts.map +1 -0
- package/dist/construct-registry.js +198 -0
- package/dist/contract-file-rule.d.ts +37 -0
- package/dist/contract-file-rule.d.ts.map +1 -0
- package/dist/contract-file-rule.js +99 -0
- package/dist/contract-template-registry.d.ts +28 -0
- package/dist/contract-template-registry.d.ts.map +1 -0
- package/dist/contract-template-registry.js +161 -0
- package/dist/contradictions.d.ts +52 -0
- package/dist/contradictions.d.ts.map +1 -0
- package/dist/contradictions.js +391 -0
- package/dist/convention-registry.d.ts +44 -0
- package/dist/convention-registry.d.ts.map +1 -0
- package/dist/convention-registry.js +195 -0
- package/dist/coverage-report.d.ts +25 -0
- package/dist/coverage-report.d.ts.map +1 -0
- package/dist/coverage-report.js +190 -0
- package/dist/custom-checks.d.ts +146 -0
- package/dist/custom-checks.d.ts.map +1 -0
- package/dist/custom-checks.js +260 -0
- package/dist/dashboard/dashboard-data.d.ts +59 -0
- package/dist/dashboard/dashboard-data.d.ts.map +1 -0
- package/dist/dashboard/dashboard-data.js +653 -0
- package/dist/dashboard-export.d.ts +67 -0
- package/dist/dashboard-export.d.ts.map +1 -0
- package/dist/dashboard-export.js +203 -0
- package/dist/decision-records.d.ts +47 -0
- package/dist/decision-records.d.ts.map +1 -0
- package/dist/decision-records.js +255 -0
- package/dist/demo-package.d.ts +49 -0
- package/dist/demo-package.d.ts.map +1 -0
- package/dist/demo-package.js +305 -0
- package/dist/demo-script.d.ts +25 -0
- package/dist/demo-script.d.ts.map +1 -0
- package/dist/demo-script.js +198 -0
- package/dist/demo-workflow.d.ts +28 -0
- package/dist/demo-workflow.d.ts.map +1 -0
- package/dist/demo-workflow.js +178 -0
- package/dist/dev-cycle.d.ts +41 -0
- package/dist/dev-cycle.d.ts.map +1 -0
- package/dist/dev-cycle.js +94 -0
- package/dist/dev-session-html.d.ts +13 -0
- package/dist/dev-session-html.d.ts.map +1 -0
- package/dist/dev-session-html.js +223 -0
- package/dist/dev-session-report.d.ts +11 -0
- package/dist/dev-session-report.d.ts.map +1 -0
- package/dist/dev-session-report.js +206 -0
- package/dist/dev-session.d.ts +257 -0
- package/dist/dev-session.d.ts.map +1 -0
- package/dist/dev-session.js +568 -0
- package/dist/diagnostics-suggest.d.ts +17 -0
- package/dist/diagnostics-suggest.d.ts.map +1 -0
- package/dist/diagnostics-suggest.js +69 -0
- package/dist/docs-check.d.ts +40 -0
- package/dist/docs-check.d.ts.map +1 -0
- package/dist/docs-check.js +221 -0
- package/dist/doctor-acknowledgements.d.ts +69 -0
- package/dist/doctor-acknowledgements.d.ts.map +1 -0
- package/dist/doctor-acknowledgements.js +150 -0
- package/dist/doctor-result.d.ts +51 -0
- package/dist/doctor-result.d.ts.map +1 -0
- package/dist/doctor-result.js +7 -0
- package/dist/doctor-suppressions.d.ts +91 -0
- package/dist/doctor-suppressions.d.ts.map +1 -0
- package/dist/doctor-suppressions.js +238 -0
- package/dist/drift-baseline.d.ts +29 -0
- package/dist/drift-baseline.d.ts.map +1 -0
- package/dist/drift-baseline.js +80 -0
- package/dist/drift.d.ts +38 -0
- package/dist/drift.d.ts.map +1 -0
- package/dist/drift.js +107 -0
- package/dist/entrypoint-matrix.d.ts +61 -0
- package/dist/entrypoint-matrix.d.ts.map +1 -0
- package/dist/entrypoint-matrix.js +221 -0
- package/dist/examples-check.d.ts +36 -0
- package/dist/examples-check.d.ts.map +1 -0
- package/dist/examples-check.js +168 -0
- package/dist/execution-graph.d.ts +98 -0
- package/dist/execution-graph.d.ts.map +1 -0
- package/dist/execution-graph.js +484 -0
- package/dist/export-bundle.d.ts +10 -0
- package/dist/export-bundle.d.ts.map +1 -0
- package/dist/export-bundle.js +90 -0
- package/dist/failure-diagnostics.d.ts +63 -0
- package/dist/failure-diagnostics.d.ts.map +1 -0
- package/dist/failure-diagnostics.js +243 -0
- package/dist/feature-bundle.d.ts +111 -0
- package/dist/feature-bundle.d.ts.map +1 -0
- package/dist/feature-bundle.js +211 -0
- package/dist/feedback-actions-v2.d.ts +65 -0
- package/dist/feedback-actions-v2.d.ts.map +1 -0
- package/dist/feedback-actions-v2.js +183 -0
- package/dist/feedback-ingestion.d.ts +96 -0
- package/dist/feedback-ingestion.d.ts.map +1 -0
- package/dist/feedback-ingestion.js +400 -0
- package/dist/fix-preview.d.ts +82 -0
- package/dist/fix-preview.d.ts.map +1 -0
- package/dist/fix-preview.js +365 -0
- package/dist/fuzzy-impact.d.ts +50 -0
- package/dist/fuzzy-impact.d.ts.map +1 -0
- package/dist/fuzzy-impact.js +446 -0
- package/dist/generated-code.d.ts +97 -0
- package/dist/generated-code.d.ts.map +1 -0
- package/dist/generated-code.js +395 -0
- package/dist/git-helpers.d.ts +38 -0
- package/dist/git-helpers.d.ts.map +1 -0
- package/dist/git-helpers.js +173 -0
- package/dist/golden-output.d.ts +33 -0
- package/dist/golden-output.d.ts.map +1 -0
- package/dist/golden-output.js +92 -0
- package/dist/grounding/build-grounding.d.ts +53 -0
- package/dist/grounding/build-grounding.d.ts.map +1 -0
- package/dist/grounding/build-grounding.js +51 -0
- package/dist/grounding/nx-projects.d.ts +29 -0
- package/dist/grounding/nx-projects.d.ts.map +1 -0
- package/dist/grounding/nx-projects.js +109 -0
- package/dist/grounding/validate-extracted-plan.d.ts +20 -0
- package/dist/grounding/validate-extracted-plan.d.ts.map +1 -0
- package/dist/grounding/validate-extracted-plan.js +127 -0
- package/dist/healing-plan.d.ts +33 -0
- package/dist/healing-plan.d.ts.map +1 -0
- package/dist/healing-plan.js +346 -0
- package/dist/helper-registry.d.ts +90 -0
- package/dist/helper-registry.d.ts.map +1 -0
- package/dist/helper-registry.js +529 -0
- package/dist/impact-analysis.d.ts +150 -0
- package/dist/impact-analysis.d.ts.map +1 -0
- package/dist/impact-analysis.js +697 -0
- package/dist/impact-graph-render.d.ts +51 -0
- package/dist/impact-graph-render.d.ts.map +1 -0
- package/dist/impact-graph-render.js +139 -0
- package/dist/impact-graph.d.ts +17 -0
- package/dist/impact-graph.d.ts.map +1 -0
- package/dist/impact-graph.js +119 -0
- package/dist/impact-render.d.ts +22 -0
- package/dist/impact-render.d.ts.map +1 -0
- package/dist/impact-render.js +422 -0
- package/dist/import-graph-analysis.d.ts +28 -0
- package/dist/import-graph-analysis.d.ts.map +1 -0
- package/dist/import-graph-analysis.js +193 -0
- package/dist/import-hygiene.d.ts +93 -0
- package/dist/import-hygiene.d.ts.map +1 -0
- package/dist/import-hygiene.js +366 -0
- package/dist/index.d.ts +224 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +234 -0
- package/dist/ingest-adoption.d.ts +50 -0
- package/dist/ingest-adoption.d.ts.map +1 -0
- package/dist/ingest-adoption.js +183 -0
- package/dist/ingest-apply.d.ts +80 -0
- package/dist/ingest-apply.d.ts.map +1 -0
- package/dist/ingest-apply.js +227 -0
- package/dist/ingest-body-extractor.d.ts +28 -0
- package/dist/ingest-body-extractor.d.ts.map +1 -0
- package/dist/ingest-body-extractor.js +129 -0
- package/dist/ingest-drafts.d.ts +16 -0
- package/dist/ingest-drafts.d.ts.map +1 -0
- package/dist/ingest-drafts.js +482 -0
- package/dist/inspector-cache.d.ts +41 -0
- package/dist/inspector-cache.d.ts.map +1 -0
- package/dist/inspector-cache.js +104 -0
- package/dist/install-smoke.d.ts +44 -0
- package/dist/install-smoke.d.ts.map +1 -0
- package/dist/install-smoke.js +31 -0
- package/dist/knowledge-authoring.d.ts +151 -0
- package/dist/knowledge-authoring.d.ts.map +1 -0
- package/dist/knowledge-authoring.js +586 -0
- package/dist/knowledge-graph.d.ts +76 -0
- package/dist/knowledge-graph.d.ts.map +1 -0
- package/dist/knowledge-graph.js +336 -0
- package/dist/knowledge-lint.d.ts +97 -0
- package/dist/knowledge-lint.d.ts.map +1 -0
- package/dist/knowledge-lint.js +302 -0
- package/dist/knowledge-rename.d.ts +38 -0
- package/dist/knowledge-rename.d.ts.map +1 -0
- package/dist/knowledge-rename.js +88 -0
- package/dist/knowledge-stale.d.ts +124 -0
- package/dist/knowledge-stale.d.ts.map +1 -0
- package/dist/knowledge-stale.js +892 -0
- package/dist/languages/command-inference.d.ts +27 -0
- package/dist/languages/command-inference.d.ts.map +1 -0
- package/dist/languages/command-inference.js +214 -0
- package/dist/languages/dependency-scan.d.ts +33 -0
- package/dist/languages/dependency-scan.d.ts.map +1 -0
- package/dist/languages/dependency-scan.js +343 -0
- package/dist/languages/index.d.ts +14 -0
- package/dist/languages/index.d.ts.map +1 -0
- package/dist/languages/index.js +13 -0
- package/dist/languages/language-boundaries.d.ts +30 -0
- package/dist/languages/language-boundaries.d.ts.map +1 -0
- package/dist/languages/language-boundaries.js +176 -0
- package/dist/languages/language-cache.d.ts +54 -0
- package/dist/languages/language-cache.d.ts.map +1 -0
- package/dist/languages/language-cache.js +236 -0
- package/dist/languages/language-detection.d.ts +30 -0
- package/dist/languages/language-detection.d.ts.map +1 -0
- package/dist/languages/language-detection.js +584 -0
- package/dist/languages/language-id.d.ts +15 -0
- package/dist/languages/language-id.d.ts.map +1 -0
- package/dist/languages/language-id.js +15 -0
- package/dist/languages/language-runner.d.ts +90 -0
- package/dist/languages/language-runner.d.ts.map +1 -0
- package/dist/languages/language-runner.js +346 -0
- package/dist/languages/polyglot-boundary.d.ts +80 -0
- package/dist/languages/polyglot-boundary.d.ts.map +1 -0
- package/dist/languages/polyglot-boundary.js +373 -0
- package/dist/languages/polyglot-ci.d.ts +25 -0
- package/dist/languages/polyglot-ci.d.ts.map +1 -0
- package/dist/languages/polyglot-ci.js +278 -0
- package/dist/languages/test-impact.d.ts +19 -0
- package/dist/languages/test-impact.d.ts.map +1 -0
- package/dist/languages/test-impact.js +157 -0
- package/dist/loader-diagnostics.d.ts +40 -0
- package/dist/loader-diagnostics.d.ts.map +1 -0
- package/dist/loader-diagnostics.js +49 -0
- package/dist/memory-diff.d.ts +60 -0
- package/dist/memory-diff.d.ts.map +1 -0
- package/dist/memory-diff.js +302 -0
- package/dist/migration-profile-registry.d.ts +26 -0
- package/dist/migration-profile-registry.d.ts.map +1 -0
- package/dist/migration-profile-registry.js +135 -0
- package/dist/migration-readiness.d.ts +101 -0
- package/dist/migration-readiness.d.ts.map +1 -0
- package/dist/migration-readiness.js +253 -0
- package/dist/monorepo-onboarding.d.ts +51 -0
- package/dist/monorepo-onboarding.d.ts.map +1 -0
- package/dist/monorepo-onboarding.js +235 -0
- package/dist/onboarding-adoption-diff.d.ts +53 -0
- package/dist/onboarding-adoption-diff.d.ts.map +1 -0
- package/dist/onboarding-adoption-diff.js +285 -0
- package/dist/onboarding-adoption.d.ts +136 -0
- package/dist/onboarding-adoption.d.ts.map +1 -0
- package/dist/onboarding-adoption.js +702 -0
- package/dist/onboarding-agent-import.d.ts +40 -0
- package/dist/onboarding-agent-import.d.ts.map +1 -0
- package/dist/onboarding-agent-import.js +114 -0
- package/dist/onboarding-diff.d.ts +39 -0
- package/dist/onboarding-diff.d.ts.map +1 -0
- package/dist/onboarding-diff.js +240 -0
- package/dist/onboarding-drafts-merge.d.ts +71 -0
- package/dist/onboarding-drafts-merge.d.ts.map +1 -0
- package/dist/onboarding-drafts-merge.js +174 -0
- package/dist/onboarding-drafts.d.ts +42 -0
- package/dist/onboarding-drafts.d.ts.map +1 -0
- package/dist/onboarding-drafts.js +268 -0
- package/dist/onboarding-report.d.ts +8 -0
- package/dist/onboarding-report.d.ts.map +1 -0
- package/dist/onboarding-report.js +239 -0
- package/dist/onboarding.d.ts +134 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +729 -0
- package/dist/ownership.d.ts +38 -0
- package/dist/ownership.d.ts.map +1 -0
- package/dist/ownership.js +102 -0
- package/dist/pack-author-ux.d.ts +58 -0
- package/dist/pack-author-ux.d.ts.map +1 -0
- package/dist/pack-author-ux.js +219 -0
- package/dist/pack-author.d.ts +94 -0
- package/dist/pack-author.d.ts.map +1 -0
- package/dist/pack-author.js +208 -0
- package/dist/pack-compatibility.d.ts +21 -0
- package/dist/pack-compatibility.d.ts.map +1 -0
- package/dist/pack-compatibility.js +114 -0
- package/dist/pack-contributions-inventory.d.ts +121 -0
- package/dist/pack-contributions-inventory.d.ts.map +1 -0
- package/dist/pack-contributions-inventory.js +732 -0
- package/dist/pack-docs.d.ts +11 -0
- package/dist/pack-docs.d.ts.map +1 -0
- package/dist/pack-docs.js +101 -0
- package/dist/pack-doctor.d.ts +50 -0
- package/dist/pack-doctor.d.ts.map +1 -0
- package/dist/pack-doctor.js +302 -0
- package/dist/pack-helper-registry.d.ts +29 -0
- package/dist/pack-helper-registry.d.ts.map +1 -0
- package/dist/pack-helper-registry.js +144 -0
- package/dist/pack-pending.d.ts +68 -0
- package/dist/pack-pending.d.ts.map +1 -0
- package/dist/pack-pending.js +189 -0
- package/dist/pack-quality-score.d.ts +44 -0
- package/dist/pack-quality-score.d.ts.map +1 -0
- package/dist/pack-quality-score.js +155 -0
- package/dist/pack-release-check.d.ts +24 -0
- package/dist/pack-release-check.d.ts.map +1 -0
- package/dist/pack-release-check.js +258 -0
- package/dist/pack-signature-status.d.ts +72 -0
- package/dist/pack-signature-status.d.ts.map +1 -0
- package/dist/pack-signature-status.js +222 -0
- package/dist/pack-symbol-compat.d.ts +73 -0
- package/dist/pack-symbol-compat.d.ts.map +1 -0
- package/dist/pack-symbol-compat.js +519 -0
- package/dist/pack-test-runner.d.ts +59 -0
- package/dist/pack-test-runner.d.ts.map +1 -0
- package/dist/pack-test-runner.js +211 -0
- package/dist/pipeline-command-dictionary.d.ts +2 -0
- package/dist/pipeline-command-dictionary.d.ts.map +1 -0
- package/dist/pipeline-command-dictionary.js +20 -0
- package/dist/pipeline-lint.d.ts +30 -0
- package/dist/pipeline-lint.d.ts.map +1 -0
- package/dist/pipeline-lint.js +134 -0
- package/dist/plan-dependency-graph.d.ts +25 -0
- package/dist/plan-dependency-graph.d.ts.map +1 -0
- package/dist/plan-dependency-graph.js +195 -0
- package/dist/plan-review.d.ts +64 -0
- package/dist/plan-review.d.ts.map +1 -0
- package/dist/plan-review.js +242 -0
- package/dist/plan-simulation.d.ts +108 -0
- package/dist/plan-simulation.d.ts.map +1 -0
- package/dist/plan-simulation.js +767 -0
- package/dist/playbook-registry.d.ts +25 -0
- package/dist/playbook-registry.d.ts.map +1 -0
- package/dist/playbook-registry.js +148 -0
- package/dist/playbook-script.d.ts +60 -0
- package/dist/playbook-script.d.ts.map +1 -0
- package/dist/playbook-script.js +161 -0
- package/dist/plugin-lifecycle-profile-registry.d.ts +52 -0
- package/dist/plugin-lifecycle-profile-registry.d.ts.map +1 -0
- package/dist/plugin-lifecycle-profile-registry.js +202 -0
- package/dist/plugin-lifecycle.d.ts +132 -0
- package/dist/plugin-lifecycle.d.ts.map +1 -0
- package/dist/plugin-lifecycle.js +477 -0
- package/dist/policy-engine.d.ts +101 -0
- package/dist/policy-engine.d.ts.map +1 -0
- package/dist/policy-engine.js +321 -0
- package/dist/policy-override-audit.d.ts +18 -0
- package/dist/policy-override-audit.d.ts.map +1 -0
- package/dist/policy-override-audit.js +54 -0
- package/dist/policy-overrides.d.ts +35 -0
- package/dist/policy-overrides.d.ts.map +1 -0
- package/dist/policy-overrides.js +84 -0
- package/dist/policy-test.d.ts +83 -0
- package/dist/policy-test.d.ts.map +1 -0
- package/dist/policy-test.js +342 -0
- package/dist/pr-summary.d.ts +34 -0
- package/dist/pr-summary.d.ts.map +1 -0
- package/dist/pr-summary.js +220 -0
- package/dist/product-coherence.d.ts +21 -0
- package/dist/product-coherence.d.ts.map +1 -0
- package/dist/product-coherence.js +158 -0
- package/dist/profile-registry.d.ts +42 -0
- package/dist/profile-registry.d.ts.map +1 -0
- package/dist/profile-registry.js +104 -0
- package/dist/project-coupling-audit.d.ts +64 -0
- package/dist/project-coupling-audit.d.ts.map +1 -0
- package/dist/project-coupling-audit.js +282 -0
- package/dist/project-overview.d.ts +14 -0
- package/dist/project-overview.d.ts.map +1 -0
- package/dist/project-overview.js +27 -0
- package/dist/propose-knowledge.d.ts +64 -0
- package/dist/propose-knowledge.d.ts.map +1 -0
- package/dist/propose-knowledge.js +367 -0
- package/dist/quality-baseline.d.ts +123 -0
- package/dist/quality-baseline.d.ts.map +1 -0
- package/dist/quality-baseline.js +433 -0
- package/dist/quality-html.d.ts +7 -0
- package/dist/quality-html.d.ts.map +1 -0
- package/dist/quality-html.js +64 -0
- package/dist/quality-report.d.ts +49 -0
- package/dist/quality-report.d.ts.map +1 -0
- package/dist/quality-report.js +296 -0
- package/dist/query-resolver.d.ts +38 -0
- package/dist/query-resolver.d.ts.map +1 -0
- package/dist/query-resolver.js +163 -0
- package/dist/ranker-explainability.d.ts +91 -0
- package/dist/ranker-explainability.d.ts.map +1 -0
- package/dist/ranker-explainability.js +550 -0
- package/dist/reference-lookup.d.ts +8 -0
- package/dist/reference-lookup.d.ts.map +1 -0
- package/dist/reference-lookup.js +18 -0
- package/dist/registration-hint-registry.d.ts +55 -0
- package/dist/registration-hint-registry.d.ts.map +1 -0
- package/dist/registration-hint-registry.js +327 -0
- package/dist/registry-lifecycle.d.ts +47 -0
- package/dist/registry-lifecycle.d.ts.map +1 -0
- package/dist/registry-lifecycle.js +214 -0
- package/dist/release-readiness.d.ts +64 -0
- package/dist/release-readiness.d.ts.map +1 -0
- package/dist/release-readiness.js +456 -0
- package/dist/release-smoke.d.ts +138 -0
- package/dist/release-smoke.d.ts.map +1 -0
- package/dist/release-smoke.js +459 -0
- package/dist/release-train.d.ts +33 -0
- package/dist/release-train.d.ts.map +1 -0
- package/dist/release-train.js +104 -0
- package/dist/repo-memory.d.ts +95 -0
- package/dist/repo-memory.d.ts.map +1 -0
- package/dist/repo-memory.js +614 -0
- package/dist/report-site.d.ts +92 -0
- package/dist/report-site.d.ts.map +1 -0
- package/dist/report-site.js +658 -0
- package/dist/reposet.d.ts +56 -0
- package/dist/reposet.d.ts.map +1 -0
- package/dist/reposet.js +160 -0
- package/dist/repository-intelligence.d.ts +145 -0
- package/dist/repository-intelligence.d.ts.map +1 -0
- package/dist/repository-intelligence.js +729 -0
- package/dist/repository-knowledge-model.d.ts +218 -0
- package/dist/repository-knowledge-model.d.ts.map +1 -0
- package/dist/repository-knowledge-model.js +939 -0
- package/dist/repository-map.d.ts +72 -0
- package/dist/repository-map.d.ts.map +1 -0
- package/dist/repository-map.js +332 -0
- package/dist/repository-stats.d.ts +66 -0
- package/dist/repository-stats.d.ts.map +1 -0
- package/dist/repository-stats.js +329 -0
- package/dist/review-comment-renderer.d.ts +59 -0
- package/dist/review-comment-renderer.d.ts.map +1 -0
- package/dist/review-comment-renderer.js +181 -0
- package/dist/review-comment-v2.d.ts +9 -0
- package/dist/review-comment-v2.d.ts.map +1 -0
- package/dist/review-comment-v2.js +178 -0
- package/dist/review-html.d.ts +13 -0
- package/dist/review-html.d.ts.map +1 -0
- package/dist/review-html.js +79 -0
- package/dist/review-packet-v2.d.ts +29 -0
- package/dist/review-packet-v2.d.ts.map +1 -0
- package/dist/review-packet-v2.js +81 -0
- package/dist/review-packet-v3.d.ts +22 -0
- package/dist/review-packet-v3.d.ts.map +1 -0
- package/dist/review-packet-v3.js +181 -0
- package/dist/review-packet.d.ts +49 -0
- package/dist/review-packet.d.ts.map +1 -0
- package/dist/review-packet.js +129 -0
- package/dist/risk-signals.d.ts +28 -0
- package/dist/risk-signals.d.ts.map +1 -0
- package/dist/risk-signals.js +68 -0
- package/dist/role-views.d.ts +50 -0
- package/dist/role-views.d.ts.map +1 -0
- package/dist/role-views.js +334 -0
- package/dist/rounds.d.ts +52 -0
- package/dist/rounds.d.ts.map +1 -0
- package/dist/rounds.js +172 -0
- package/dist/rule-drift.d.ts +42 -0
- package/dist/rule-drift.d.ts.map +1 -0
- package/dist/rule-drift.js +148 -0
- package/dist/rule-quality.d.ts +73 -0
- package/dist/rule-quality.d.ts.map +1 -0
- package/dist/rule-quality.js +356 -0
- package/dist/rule-scaffold.d.ts +71 -0
- package/dist/rule-scaffold.d.ts.map +1 -0
- package/dist/rule-scaffold.js +258 -0
- package/dist/safety-audit-deep.d.ts +38 -0
- package/dist/safety-audit-deep.d.ts.map +1 -0
- package/dist/safety-audit-deep.js +162 -0
- package/dist/safety-audit.d.ts +91 -0
- package/dist/safety-audit.d.ts.map +1 -0
- package/dist/safety-audit.js +138 -0
- package/dist/safety-html.d.ts +7 -0
- package/dist/safety-html.d.ts.map +1 -0
- package/dist/safety-html.js +70 -0
- package/dist/scaffold-coverage.d.ts +46 -0
- package/dist/scaffold-coverage.d.ts.map +1 -0
- package/dist/scaffold-coverage.js +273 -0
- package/dist/scaffold-patterns.d.ts +38 -0
- package/dist/scaffold-patterns.d.ts.map +1 -0
- package/dist/scaffold-patterns.js +282 -0
- package/dist/schema-inventory.d.ts +55 -0
- package/dist/schema-inventory.d.ts.map +1 -0
- package/dist/schema-inventory.js +301 -0
- package/dist/search-index.d.ts +75 -0
- package/dist/search-index.d.ts.map +1 -0
- package/dist/search-index.js +531 -0
- package/dist/search-tuning-explain.d.ts +68 -0
- package/dist/search-tuning-explain.d.ts.map +1 -0
- package/dist/search-tuning-explain.js +207 -0
- package/dist/search-tuning-registry.d.ts +54 -0
- package/dist/search-tuning-registry.d.ts.map +1 -0
- package/dist/search-tuning-registry.js +303 -0
- package/dist/self-audit.d.ts +59 -0
- package/dist/self-audit.d.ts.map +1 -0
- package/dist/self-audit.js +192 -0
- package/dist/self-config-doctor-v2.d.ts +57 -0
- package/dist/self-config-doctor-v2.d.ts.map +1 -0
- package/dist/self-config-doctor-v2.js +653 -0
- package/dist/self-config-doctor.d.ts +47 -0
- package/dist/self-config-doctor.d.ts.map +1 -0
- package/dist/self-config-doctor.js +432 -0
- package/dist/sharkcraft-inspector.d.ts +73 -0
- package/dist/sharkcraft-inspector.d.ts.map +1 -0
- package/dist/sharkcraft-inspector.js +745 -0
- package/dist/spec/spec-cross-validate.d.ts +17 -0
- package/dist/spec/spec-cross-validate.d.ts.map +1 -0
- package/dist/spec/spec-cross-validate.js +53 -0
- package/dist/spec/spec-discovery.d.ts +27 -0
- package/dist/spec/spec-discovery.d.ts.map +1 -0
- package/dist/spec/spec-discovery.js +78 -0
- package/dist/spec/spec-review.d.ts +36 -0
- package/dist/spec/spec-review.d.ts.map +1 -0
- package/dist/spec/spec-review.js +37 -0
- package/dist/stability-map.d.ts +62 -0
- package/dist/stability-map.d.ts.map +1 -0
- package/dist/stability-map.js +404 -0
- package/dist/start-here.d.ts +49 -0
- package/dist/start-here.d.ts.map +1 -0
- package/dist/start-here.js +259 -0
- package/dist/surface-profile-detect.d.ts +42 -0
- package/dist/surface-profile-detect.d.ts.map +1 -0
- package/dist/surface-profile-detect.js +76 -0
- package/dist/symbol-index.d.ts +108 -0
- package/dist/symbol-index.d.ts.map +1 -0
- package/dist/symbol-index.js +483 -0
- package/dist/task-decompose.d.ts +38 -0
- package/dist/task-decompose.d.ts.map +1 -0
- package/dist/task-decompose.js +154 -0
- package/dist/task-packet.d.ts +104 -0
- package/dist/task-packet.d.ts.map +1 -0
- package/dist/task-packet.js +156 -0
- package/dist/task-ranker.d.ts +51 -0
- package/dist/task-ranker.d.ts.map +1 -0
- package/dist/task-ranker.js +410 -0
- package/dist/task-risk.d.ts +84 -0
- package/dist/task-risk.d.ts.map +1 -0
- package/dist/task-risk.js +731 -0
- package/dist/task-routing-hint-registry.d.ts +36 -0
- package/dist/task-routing-hint-registry.d.ts.map +1 -0
- package/dist/task-routing-hint-registry.js +186 -0
- package/dist/template-authoring.d.ts +113 -0
- package/dist/template-authoring.d.ts.map +1 -0
- package/dist/template-authoring.js +521 -0
- package/dist/template-body-inference-v2.d.ts +19 -0
- package/dist/template-body-inference-v2.d.ts.map +1 -0
- package/dist/template-body-inference-v2.js +468 -0
- package/dist/template-body-inference.d.ts +59 -0
- package/dist/template-body-inference.d.ts.map +1 -0
- package/dist/template-body-inference.js +277 -0
- package/dist/template-drift.d.ts +39 -0
- package/dist/template-drift.d.ts.map +1 -0
- package/dist/template-drift.js +353 -0
- package/dist/template-lint.d.ts +31 -0
- package/dist/template-lint.d.ts.map +1 -0
- package/dist/template-lint.js +113 -0
- package/dist/test-definitions.d.ts +41 -0
- package/dist/test-definitions.d.ts.map +1 -0
- package/dist/test-definitions.js +6 -0
- package/dist/test-impact.d.ts +30 -0
- package/dist/test-impact.d.ts.map +1 -0
- package/dist/test-impact.js +173 -0
- package/dist/test-runner.d.ts +87 -0
- package/dist/test-runner.d.ts.map +1 -0
- package/dist/test-runner.js +560 -0
- package/dist/uncertainty-report.d.ts +46 -0
- package/dist/uncertainty-report.d.ts.map +1 -0
- package/dist/uncertainty-report.js +108 -0
- package/dist/uncertainty.d.ts +38 -0
- package/dist/uncertainty.d.ts.map +1 -0
- package/dist/uncertainty.js +115 -0
- package/dist/universal-search.d.ts +64 -0
- package/dist/universal-search.d.ts.map +1 -0
- package/dist/universal-search.js +347 -0
- package/dist/upgrade-advisor.d.ts +22 -0
- package/dist/upgrade-advisor.d.ts.map +1 -0
- package/dist/upgrade-advisor.js +109 -0
- package/dist/why-file.d.ts +75 -0
- package/dist/why-file.d.ts.map +1 -0
- package/dist/why-file.js +202 -0
- package/dist/workflow-simulation.d.ts +46 -0
- package/dist/workflow-simulation.d.ts.map +1 -0
- package/dist/workflow-simulation.js +154 -0
- package/package.json +65 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { findFiles } from '@shrkcrft/workspace';
|
|
4
|
+
export const GENERATED_CODE_SCHEMA = 'sharkcraft.generated-code/v1';
|
|
5
|
+
export var GeneratedConfidence;
|
|
6
|
+
(function (GeneratedConfidence) {
|
|
7
|
+
GeneratedConfidence["High"] = "high";
|
|
8
|
+
GeneratedConfidence["Medium"] = "medium";
|
|
9
|
+
GeneratedConfidence["Low"] = "low";
|
|
10
|
+
})(GeneratedConfidence || (GeneratedConfidence = {}));
|
|
11
|
+
export var GeneratedKind;
|
|
12
|
+
(function (GeneratedKind) {
|
|
13
|
+
GeneratedKind["Marker"] = "marker";
|
|
14
|
+
GeneratedKind["OpenApi"] = "openapi";
|
|
15
|
+
GeneratedKind["GraphQL"] = "graphql";
|
|
16
|
+
GeneratedKind["Protobuf"] = "protobuf";
|
|
17
|
+
GeneratedKind["PrismaClient"] = "prisma-client";
|
|
18
|
+
GeneratedKind["AngularEnv"] = "angular-environment";
|
|
19
|
+
GeneratedKind["AngularRouter"] = "angular-router";
|
|
20
|
+
GeneratedKind["Dist"] = "dist";
|
|
21
|
+
GeneratedKind["Lockfile"] = "lockfile";
|
|
22
|
+
GeneratedKind["Vendor"] = "vendor";
|
|
23
|
+
GeneratedKind["Snapshot"] = "snapshot";
|
|
24
|
+
/** Per-language markers. */
|
|
25
|
+
GeneratedKind["JavaGenerated"] = "java-generated";
|
|
26
|
+
GeneratedKind["CSharpGenerated"] = "csharp-generated";
|
|
27
|
+
GeneratedKind["PythonGenerated"] = "python-generated";
|
|
28
|
+
GeneratedKind["GoGenerated"] = "go-generated";
|
|
29
|
+
GeneratedKind["RustGenerated"] = "rust-generated";
|
|
30
|
+
GeneratedKind["Unknown"] = "unknown";
|
|
31
|
+
})(GeneratedKind || (GeneratedKind = {}));
|
|
32
|
+
/** Scan depth selector for generated-code detection. */
|
|
33
|
+
export var GeneratedScanDepth;
|
|
34
|
+
(function (GeneratedScanDepth) {
|
|
35
|
+
/** 4096 bytes / 30 lines per file, 600 files (existing default). */
|
|
36
|
+
GeneratedScanDepth["Standard"] = "standard";
|
|
37
|
+
/** 16384 bytes / 200 lines per file, 2000 files. */
|
|
38
|
+
GeneratedScanDepth["Deep"] = "deep";
|
|
39
|
+
/** 65536 bytes / capped full scan per file, 5000 files. */
|
|
40
|
+
GeneratedScanDepth["Extreme"] = "extreme";
|
|
41
|
+
})(GeneratedScanDepth || (GeneratedScanDepth = {}));
|
|
42
|
+
const DEFAULT_SCAN_LIMIT = 600;
|
|
43
|
+
const DEFAULT_HEAD_BYTES = 4096;
|
|
44
|
+
const DEFAULT_HEAD_LINES = 30;
|
|
45
|
+
const DEPTH_LIMITS = {
|
|
46
|
+
[GeneratedScanDepth.Standard]: { scanLimit: 600, headBytes: 4096, headLines: 30 },
|
|
47
|
+
[GeneratedScanDepth.Deep]: { scanLimit: 2000, headBytes: 16384, headLines: 200 },
|
|
48
|
+
[GeneratedScanDepth.Extreme]: { scanLimit: 5000, headBytes: 65536, headLines: 600 },
|
|
49
|
+
};
|
|
50
|
+
const GENERATED_DIR_HINTS = [
|
|
51
|
+
{ re: /(^|\/)dist(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.High, reason: 'Compiled build output directory.' },
|
|
52
|
+
{ re: /(^|\/)build(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.Medium, reason: 'Common build output directory.' },
|
|
53
|
+
{ re: /(^|\/)out(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.Low, reason: 'Sometimes a build output directory.' },
|
|
54
|
+
{ re: /(^|\/)\.next(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.High, reason: 'Next.js build output.' },
|
|
55
|
+
{ re: /(^|\/)\.nuxt(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.High, reason: 'Nuxt build output.' },
|
|
56
|
+
{ re: /(^|\/)\.angular(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.High, reason: 'Angular CLI cache output.' },
|
|
57
|
+
{ re: /(^|\/)\.svelte-kit(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.High, reason: 'SvelteKit build output.' },
|
|
58
|
+
{ re: /(^|\/)coverage(\/|$)/, kind: GeneratedKind.Snapshot, confidence: GeneratedConfidence.High, reason: 'Test coverage report.' },
|
|
59
|
+
{ re: /(^|\/)__snapshots__(\/|$)/, kind: GeneratedKind.Snapshot, confidence: GeneratedConfidence.High, reason: 'Test snapshots — auto-managed by the test runner.' },
|
|
60
|
+
{ re: /(^|\/)generated(\/|$)/, kind: GeneratedKind.Marker, confidence: GeneratedConfidence.High, reason: 'Folder explicitly named generated.' },
|
|
61
|
+
{ re: /(^|\/)__generated__(\/|$)/, kind: GeneratedKind.Marker, confidence: GeneratedConfidence.High, reason: 'Folder explicitly named __generated__.' },
|
|
62
|
+
{ re: /(^|\/)gen(\/|$)/, kind: GeneratedKind.Marker, confidence: GeneratedConfidence.Medium, reason: 'Folder named gen (often a generated code root).' },
|
|
63
|
+
// Per-language generated source roots.
|
|
64
|
+
{ re: /(^|\/)target\/generated-sources(\/|$)/, kind: GeneratedKind.JavaGenerated, confidence: GeneratedConfidence.High, reason: 'Maven generated-sources root.' },
|
|
65
|
+
{ re: /(^|\/)target\/generated-test-sources(\/|$)/, kind: GeneratedKind.JavaGenerated, confidence: GeneratedConfidence.High, reason: 'Maven generated-test-sources root.' },
|
|
66
|
+
{ re: /(^|\/)build\/generated(\/|$)/, kind: GeneratedKind.JavaGenerated, confidence: GeneratedConfidence.High, reason: 'Gradle build/generated root.' },
|
|
67
|
+
{ re: /(^|\/)obj(\/|$)/, kind: GeneratedKind.CSharpGenerated, confidence: GeneratedConfidence.High, reason: 'C# obj/ build artifacts.' },
|
|
68
|
+
{ re: /(^|\/)\.openapi-generator(\/|$)/, kind: GeneratedKind.OpenApi, confidence: GeneratedConfidence.High, reason: 'OpenAPI generator cache.' },
|
|
69
|
+
{ re: /(^|\/)prisma\/generated(\/|$)/, kind: GeneratedKind.PrismaClient, confidence: GeneratedConfidence.High, reason: 'Prisma generated client root.' },
|
|
70
|
+
{ re: /(^|\/)proto(\/|$)/, kind: GeneratedKind.Protobuf, confidence: GeneratedConfidence.Medium, reason: 'Proto-buffers folder.' },
|
|
71
|
+
{ re: /(^|\/)graphql(\/|$)/, kind: GeneratedKind.GraphQL, confidence: GeneratedConfidence.Low, reason: 'May contain generated GraphQL types.' },
|
|
72
|
+
{ re: /node_modules(\/|$)/, kind: GeneratedKind.Vendor, confidence: GeneratedConfidence.High, reason: 'Vendored dependency tree — never hand-edit.' },
|
|
73
|
+
{ re: /\.nx\/cache(\/|$)/, kind: GeneratedKind.Dist, confidence: GeneratedConfidence.High, reason: 'Nx cache.' },
|
|
74
|
+
];
|
|
75
|
+
const LOCKFILES = new Set([
|
|
76
|
+
'package-lock.json',
|
|
77
|
+
'pnpm-lock.yaml',
|
|
78
|
+
'yarn.lock',
|
|
79
|
+
'bun.lockb',
|
|
80
|
+
'bun.lock',
|
|
81
|
+
'composer.lock',
|
|
82
|
+
'Gemfile.lock',
|
|
83
|
+
'Cargo.lock',
|
|
84
|
+
'poetry.lock',
|
|
85
|
+
'go.sum',
|
|
86
|
+
]);
|
|
87
|
+
const ENV_FILE_RE = /(^|\/)src\/environments\/environment(\.[^/]+)?\.ts$/;
|
|
88
|
+
const ANGULAR_ROUTES_GEN_RE = /(^|\/)\.angular\//;
|
|
89
|
+
const FILE_MARKERS = [
|
|
90
|
+
{ re: /\bDO NOT EDIT\b/i, kind: GeneratedKind.Marker, reason: '"DO NOT EDIT" header.' },
|
|
91
|
+
{ re: /@generated\b/i, kind: GeneratedKind.Marker, reason: '@generated marker.' },
|
|
92
|
+
{ re: /auto-?generated/i, kind: GeneratedKind.Marker, reason: '"auto-generated" header.' },
|
|
93
|
+
{ re: /\bgenerated by\b/i, kind: GeneratedKind.Marker, reason: '"generated by ..." attribution.' },
|
|
94
|
+
{ re: /this file was automatically generated/i, kind: GeneratedKind.Marker, reason: 'Auto-generation banner.' },
|
|
95
|
+
{ re: /Code generated by .*; DO NOT EDIT/i, kind: GeneratedKind.GoGenerated, reason: 'Go-style generated banner.', ext: ['.go'] },
|
|
96
|
+
{ re: /openapi-generator/i, kind: GeneratedKind.OpenApi, reason: 'OpenAPI generator banner.' },
|
|
97
|
+
{ re: /swagger-codegen/i, kind: GeneratedKind.OpenApi, reason: 'Swagger codegen banner.' },
|
|
98
|
+
{ re: /graphql-code-generator/i, kind: GeneratedKind.GraphQL, reason: 'graphql-codegen banner.' },
|
|
99
|
+
{ re: /protoc-gen-/i, kind: GeneratedKind.Protobuf, reason: 'protoc-gen banner.' },
|
|
100
|
+
{ re: /prisma-client-js/i, kind: GeneratedKind.PrismaClient, reason: 'Prisma client banner.' },
|
|
101
|
+
// Per-language markers.
|
|
102
|
+
{ re: /@javax\.annotation\.Generated\b/, kind: GeneratedKind.JavaGenerated, reason: 'javax.annotation.Generated annotation.', ext: ['.java'] },
|
|
103
|
+
{ re: /@jakarta\.annotation\.Generated\b/, kind: GeneratedKind.JavaGenerated, reason: 'jakarta.annotation.Generated annotation.', ext: ['.java'] },
|
|
104
|
+
{ re: /@Generated\s*\(/, kind: GeneratedKind.JavaGenerated, reason: 'Java @Generated annotation.', ext: ['.java'] },
|
|
105
|
+
{ re: /\[GeneratedCode\s*\(/i, kind: GeneratedKind.CSharpGenerated, reason: '[GeneratedCode] attribute.', ext: ['.cs'] },
|
|
106
|
+
{ re: /<auto-generated[^>]*>/i, kind: GeneratedKind.CSharpGenerated, reason: '<auto-generated/> doc comment.', ext: ['.cs'] },
|
|
107
|
+
{ re: /^\s*#\s*@generated\b/m, kind: GeneratedKind.PythonGenerated, reason: 'Python @generated comment.', ext: ['.py'] },
|
|
108
|
+
{ re: /generated by protoc/i, kind: GeneratedKind.Protobuf, reason: 'protoc generated banner.' },
|
|
109
|
+
{ re: /generated by bindgen/i, kind: GeneratedKind.RustGenerated, reason: 'rust-bindgen generated banner.', ext: ['.rs'] },
|
|
110
|
+
];
|
|
111
|
+
const SOURCE_EXTS = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.go', '.py', '.rs', '.cs', '.java', '.kt', '.swift', '.proto', '.graphql', '.gql']);
|
|
112
|
+
export function buildGeneratedCodeReport(options) {
|
|
113
|
+
const inspection = options.inspection;
|
|
114
|
+
const depth = options.depth ?? GeneratedScanDepth.Standard;
|
|
115
|
+
const depthLimits = DEPTH_LIMITS[depth];
|
|
116
|
+
const scanLimit = options.fileScanLimit ?? depthLimits.scanLimit;
|
|
117
|
+
const headBytes = options.headBytes ?? depthLimits.headBytes;
|
|
118
|
+
const headLines = depthLimits.headLines;
|
|
119
|
+
const projectRoot = inspection.projectRoot;
|
|
120
|
+
const limitations = [];
|
|
121
|
+
const generatedFiles = [];
|
|
122
|
+
const handwrittenFiles = [];
|
|
123
|
+
const mixedFiles = [];
|
|
124
|
+
const rootCounts = new Map();
|
|
125
|
+
const recordRoot = (path, kind, confidence, reason) => {
|
|
126
|
+
const key = `${path}|${kind}`;
|
|
127
|
+
const prev = rootCounts.get(key);
|
|
128
|
+
if (prev) {
|
|
129
|
+
rootCounts.set(key, { ...prev, fileCount: prev.fileCount + 1 });
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
rootCounts.set(key, { path, kind, confidence, reason, fileCount: 1 });
|
|
133
|
+
};
|
|
134
|
+
let scanned = 0;
|
|
135
|
+
const files = enumerateRepoFiles(inspection);
|
|
136
|
+
for (const file of files) {
|
|
137
|
+
const rel = file;
|
|
138
|
+
const abs = nodePath.isAbsolute(rel) ? rel : nodePath.join(projectRoot, rel);
|
|
139
|
+
// Lockfiles + Angular environment.
|
|
140
|
+
const base = nodePath.basename(rel);
|
|
141
|
+
if (LOCKFILES.has(base)) {
|
|
142
|
+
generatedFiles.push({
|
|
143
|
+
path: rel,
|
|
144
|
+
kind: GeneratedKind.Lockfile,
|
|
145
|
+
confidence: GeneratedConfidence.High,
|
|
146
|
+
reason: 'Package-manager lockfile.',
|
|
147
|
+
});
|
|
148
|
+
recordRoot(nodePath.dirname(rel), GeneratedKind.Lockfile, GeneratedConfidence.High, 'Lockfile location.');
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (ENV_FILE_RE.test(rel)) {
|
|
152
|
+
generatedFiles.push({
|
|
153
|
+
path: rel,
|
|
154
|
+
kind: GeneratedKind.AngularEnv,
|
|
155
|
+
confidence: GeneratedConfidence.Medium,
|
|
156
|
+
reason: 'Angular environment file (often substituted at build time).',
|
|
157
|
+
});
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (ANGULAR_ROUTES_GEN_RE.test(rel)) {
|
|
161
|
+
generatedFiles.push({
|
|
162
|
+
path: rel,
|
|
163
|
+
kind: GeneratedKind.AngularRouter,
|
|
164
|
+
confidence: GeneratedConfidence.High,
|
|
165
|
+
reason: 'Under .angular/ build directory.',
|
|
166
|
+
});
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
let matchedDir;
|
|
170
|
+
for (const hint of GENERATED_DIR_HINTS) {
|
|
171
|
+
if (hint.re.test(rel)) {
|
|
172
|
+
matchedDir = { kind: hint.kind, confidence: hint.confidence, reason: hint.reason };
|
|
173
|
+
// Find segment that triggered the match for root attribution.
|
|
174
|
+
const m = rel.match(hint.re);
|
|
175
|
+
if (m) {
|
|
176
|
+
const idx = rel.indexOf(m[0]);
|
|
177
|
+
const root = rel.slice(0, idx + m[0].length).replace(/\/$/, '');
|
|
178
|
+
recordRoot(root, hint.kind, hint.confidence, hint.reason);
|
|
179
|
+
}
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (matchedDir) {
|
|
184
|
+
generatedFiles.push({
|
|
185
|
+
path: rel,
|
|
186
|
+
kind: matchedDir.kind,
|
|
187
|
+
confidence: matchedDir.confidence,
|
|
188
|
+
reason: matchedDir.reason,
|
|
189
|
+
});
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const ext = nodePath.extname(rel).toLowerCase();
|
|
193
|
+
if (!SOURCE_EXTS.has(ext)) {
|
|
194
|
+
handwrittenFiles.push(rel);
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
// Peek at file head.
|
|
198
|
+
if (scanned >= scanLimit) {
|
|
199
|
+
handwrittenFiles.push(rel);
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
let head = '';
|
|
203
|
+
try {
|
|
204
|
+
if (existsSync(abs) && statSync(abs).isFile()) {
|
|
205
|
+
const fd = readFileSync(abs);
|
|
206
|
+
head = fd.slice(0, headBytes).toString('utf8');
|
|
207
|
+
scanned += 1;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
head = '';
|
|
212
|
+
}
|
|
213
|
+
if (!head) {
|
|
214
|
+
handwrittenFiles.push(rel);
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
let matched;
|
|
218
|
+
const lines = head.split(/\r?\n/);
|
|
219
|
+
const scanLines = lines.slice(0, headLines);
|
|
220
|
+
const lowerExt = ext;
|
|
221
|
+
for (let i = 0; i < scanLines.length; i += 1) {
|
|
222
|
+
const line = scanLines[i] ?? '';
|
|
223
|
+
for (const marker of FILE_MARKERS) {
|
|
224
|
+
if (marker.ext && !marker.ext.includes(lowerExt))
|
|
225
|
+
continue;
|
|
226
|
+
if (marker.re.test(line)) {
|
|
227
|
+
matched = { kind: marker.kind, reason: marker.reason, line: i + 1 };
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (matched)
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
if (matched) {
|
|
235
|
+
generatedFiles.push({
|
|
236
|
+
path: rel,
|
|
237
|
+
kind: matched.kind,
|
|
238
|
+
confidence: GeneratedConfidence.High,
|
|
239
|
+
reason: matched.reason,
|
|
240
|
+
markerLine: matched.line,
|
|
241
|
+
});
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
handwrittenFiles.push(rel);
|
|
245
|
+
}
|
|
246
|
+
if (scanned >= scanLimit) {
|
|
247
|
+
limitations.push(`File-content scan limited to ${scanLimit} files; some generated headers may be missed.`);
|
|
248
|
+
}
|
|
249
|
+
const generatedRoots = Array.from(rootCounts.values()).sort((a, b) => b.fileCount - a.fileCount);
|
|
250
|
+
const protectedRules = [];
|
|
251
|
+
if (generatedRoots.length > 0) {
|
|
252
|
+
protectedRules.push({
|
|
253
|
+
id: 'generated.no-manual-edit',
|
|
254
|
+
title: 'Do not hand-edit generated files',
|
|
255
|
+
content: 'Files under generated roots are produced by tooling. Manual edits will be lost on the next regeneration. If a change is needed, modify the generator input (schema/template/config) and re-run codegen.',
|
|
256
|
+
patterns: generatedRoots.map((r) => `${r.path}/**`),
|
|
257
|
+
reason: 'Generated-code policy boundary; avoids silent regressions.',
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (generatedFiles.some((f) => f.kind === GeneratedKind.Marker || f.kind === GeneratedKind.OpenApi || f.kind === GeneratedKind.GraphQL || f.kind === GeneratedKind.Protobuf || f.kind === GeneratedKind.PrismaClient)) {
|
|
261
|
+
protectedRules.push({
|
|
262
|
+
id: 'generated.respect-do-not-edit',
|
|
263
|
+
title: 'Respect @generated / DO NOT EDIT markers',
|
|
264
|
+
content: 'Files annotated with @generated, "DO NOT EDIT", or a code-generator banner must not be edited by hand. The change belongs in the generator source.',
|
|
265
|
+
patterns: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.go', '**/*.rs'],
|
|
266
|
+
reason: 'Marker-driven generated-code protection.',
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
const recommendedPolicyRules = [];
|
|
270
|
+
if (generatedRoots.length > 0) {
|
|
271
|
+
recommendedPolicyRules.push({
|
|
272
|
+
id: 'policy.generated-roots-readonly',
|
|
273
|
+
title: 'Treat generated roots as read-only by default',
|
|
274
|
+
description: 'Plans that modify files under generated roots require an explicit "generated" intent on the task contract. Otherwise the plan is rejected at review.',
|
|
275
|
+
suggestedId: 'policy.generated-readonly',
|
|
276
|
+
patterns: generatedRoots.map((r) => `${r.path}/**`),
|
|
277
|
+
reason: 'Prevents agents from silently overwriting generated output.',
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
schema: GENERATED_CODE_SCHEMA,
|
|
282
|
+
projectRoot,
|
|
283
|
+
generatedFiles,
|
|
284
|
+
handwrittenFiles,
|
|
285
|
+
mixedFiles,
|
|
286
|
+
generatedRoots,
|
|
287
|
+
protectedRules,
|
|
288
|
+
recommendedPolicyRules,
|
|
289
|
+
filesScanned: scanned,
|
|
290
|
+
limitations,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function enumerateRepoFiles(inspection) {
|
|
294
|
+
const found = findFiles(inspection.projectRoot, /\.(ts|tsx|js|jsx|mjs|cjs|go|py|rs|cs|java|kt|swift|proto|graphql|gql|d\.ts)$/i, { maxDepth: 6 });
|
|
295
|
+
const rel = found.map((f) => nodePath.relative(inspection.projectRoot, f));
|
|
296
|
+
const set = new Set(rel);
|
|
297
|
+
for (const f of inspection.sourceFiles) {
|
|
298
|
+
// Drop any path that escapes the project root (e.g. absolute paths inside
|
|
299
|
+
// node_modules that the knowledge loader picked up via pack discovery).
|
|
300
|
+
if (nodePath.isAbsolute(f)) {
|
|
301
|
+
const r = nodePath.relative(inspection.projectRoot, f);
|
|
302
|
+
if (r.startsWith('..'))
|
|
303
|
+
continue;
|
|
304
|
+
if (r.includes('node_modules'))
|
|
305
|
+
continue;
|
|
306
|
+
set.add(r);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
if (f.includes('node_modules'))
|
|
310
|
+
continue;
|
|
311
|
+
set.add(f);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return Array.from(set).sort();
|
|
315
|
+
}
|
|
316
|
+
export function renderGeneratedCodeReportText(report) {
|
|
317
|
+
const lines = [];
|
|
318
|
+
lines.push(`=== Generated-code report ===`);
|
|
319
|
+
lines.push(` generated files ${report.generatedFiles.length}`);
|
|
320
|
+
lines.push(` handwritten files ${report.handwrittenFiles.length}`);
|
|
321
|
+
lines.push(` generated roots ${report.generatedRoots.length}`);
|
|
322
|
+
lines.push(` files scanned ${report.filesScanned}`);
|
|
323
|
+
if (report.generatedRoots.length > 0) {
|
|
324
|
+
lines.push('');
|
|
325
|
+
lines.push('Generated roots:');
|
|
326
|
+
for (const r of report.generatedRoots.slice(0, 25)) {
|
|
327
|
+
lines.push(` - ${r.path} [${r.kind} / ${r.confidence}] ${r.reason} (${r.fileCount} files)`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (report.protectedRules.length > 0) {
|
|
331
|
+
lines.push('');
|
|
332
|
+
lines.push('Protected rules:');
|
|
333
|
+
for (const rule of report.protectedRules) {
|
|
334
|
+
lines.push(` - ${rule.id} — ${rule.title}`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (report.limitations.length > 0) {
|
|
338
|
+
lines.push('');
|
|
339
|
+
lines.push('Limitations:');
|
|
340
|
+
for (const l of report.limitations)
|
|
341
|
+
lines.push(` - ${l}`);
|
|
342
|
+
}
|
|
343
|
+
return lines.join('\n');
|
|
344
|
+
}
|
|
345
|
+
export function renderGeneratedCodeReportMarkdown(report) {
|
|
346
|
+
const lines = [];
|
|
347
|
+
lines.push('# Generated-code report');
|
|
348
|
+
lines.push('');
|
|
349
|
+
lines.push(`- Generated files: **${report.generatedFiles.length}**`);
|
|
350
|
+
lines.push(`- Handwritten files: **${report.handwrittenFiles.length}**`);
|
|
351
|
+
lines.push(`- Generated roots: **${report.generatedRoots.length}**`);
|
|
352
|
+
lines.push(`- Files scanned for markers: **${report.filesScanned}**`);
|
|
353
|
+
if (report.generatedRoots.length > 0) {
|
|
354
|
+
lines.push('');
|
|
355
|
+
lines.push('## Roots');
|
|
356
|
+
lines.push('');
|
|
357
|
+
lines.push('| Path | Kind | Confidence | Files | Reason |');
|
|
358
|
+
lines.push('|---|---|---|---|---|');
|
|
359
|
+
for (const r of report.generatedRoots) {
|
|
360
|
+
lines.push(`| \`${r.path}\` | ${r.kind} | ${r.confidence} | ${r.fileCount} | ${r.reason} |`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (report.protectedRules.length > 0) {
|
|
364
|
+
lines.push('');
|
|
365
|
+
lines.push('## Recommended protected rules');
|
|
366
|
+
lines.push('');
|
|
367
|
+
for (const r of report.protectedRules) {
|
|
368
|
+
lines.push(`### ${r.title}`);
|
|
369
|
+
lines.push('');
|
|
370
|
+
lines.push(r.content);
|
|
371
|
+
lines.push('');
|
|
372
|
+
lines.push(`Applies to: ${r.patterns.map((p) => `\`${p}\``).join(', ')}`);
|
|
373
|
+
lines.push('');
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
if (report.recommendedPolicyRules.length > 0) {
|
|
377
|
+
lines.push('');
|
|
378
|
+
lines.push('## Recommended policy rules');
|
|
379
|
+
lines.push('');
|
|
380
|
+
for (const r of report.recommendedPolicyRules) {
|
|
381
|
+
lines.push(`- **${r.title}** (\`${r.suggestedId}\`) — ${r.description}`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (report.limitations.length > 0) {
|
|
385
|
+
lines.push('');
|
|
386
|
+
lines.push('## Limitations');
|
|
387
|
+
lines.push('');
|
|
388
|
+
for (const l of report.limitations)
|
|
389
|
+
lines.push(`- ${l}`);
|
|
390
|
+
}
|
|
391
|
+
return lines.join('\n');
|
|
392
|
+
}
|
|
393
|
+
export function renderGeneratedCodeReportJson(report) {
|
|
394
|
+
return JSON.stringify(report, null, 2);
|
|
395
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface IGitChangedOptions {
|
|
2
|
+
/** Compare against the given ref (HEAD, origin/main, a SHA, …). */
|
|
3
|
+
since?: string;
|
|
4
|
+
/** When true, only staged (index) changes. */
|
|
5
|
+
staged?: boolean;
|
|
6
|
+
/** When true, include the unstaged working-tree changes too. */
|
|
7
|
+
includeWorktree?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IGitStatusSummary {
|
|
10
|
+
branch: string | null;
|
|
11
|
+
root: string | null;
|
|
12
|
+
ahead: number;
|
|
13
|
+
behind: number;
|
|
14
|
+
staged: number;
|
|
15
|
+
modified: number;
|
|
16
|
+
untracked: number;
|
|
17
|
+
conflicts: number;
|
|
18
|
+
clean: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function isGitRepo(cwd: string): boolean;
|
|
21
|
+
export declare function getGitRoot(cwd: string): string | null;
|
|
22
|
+
export declare function getGitBranch(cwd: string): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Verify that `ref` resolves to a commit. Returns `{ valid: true }` on
|
|
25
|
+
* success, otherwise `{ valid: false, suggestions }` listing nearby
|
|
26
|
+
* branch / tag names so the caller can offer a did-you-mean.
|
|
27
|
+
*
|
|
28
|
+
* Cheap (`git rev-parse --verify` + `git for-each-ref`) — only run when
|
|
29
|
+
* the user passes an explicit ref.
|
|
30
|
+
*/
|
|
31
|
+
export declare function verifyGitRef(cwd: string, ref: string): {
|
|
32
|
+
valid: boolean;
|
|
33
|
+
suggestions?: string[];
|
|
34
|
+
};
|
|
35
|
+
export declare function getChangedFiles(cwd: string, opts?: IGitChangedOptions): string[];
|
|
36
|
+
export declare function getStatusSummary(cwd: string): IGitStatusSummary;
|
|
37
|
+
export declare function parseLines(text: string): string[];
|
|
38
|
+
//# sourceMappingURL=git-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-helpers.d.ts","sourceRoot":"","sources":["../src/git-helpers.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gEAAgE;IAChE,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB;AAWD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAI9C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKrD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKvD;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAQ5C;AA2CD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,kBAAuB,GAAG,MAAM,EAAE,CAkBpF;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAyC/D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKjD"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import * as nodePath from 'node:path';
|
|
4
|
+
function runGit(cwd, args) {
|
|
5
|
+
const res = spawnSync('git', args, { cwd, encoding: 'utf8' });
|
|
6
|
+
return {
|
|
7
|
+
ok: res.status === 0,
|
|
8
|
+
stdout: (res.stdout ?? '').toString(),
|
|
9
|
+
stderr: (res.stderr ?? '').toString(),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function isGitRepo(cwd) {
|
|
13
|
+
if (existsSync(nodePath.join(cwd, '.git')))
|
|
14
|
+
return true;
|
|
15
|
+
const r = runGit(cwd, ['rev-parse', '--is-inside-work-tree']);
|
|
16
|
+
return r.ok && r.stdout.trim() === 'true';
|
|
17
|
+
}
|
|
18
|
+
export function getGitRoot(cwd) {
|
|
19
|
+
const r = runGit(cwd, ['rev-parse', '--show-toplevel']);
|
|
20
|
+
if (!r.ok)
|
|
21
|
+
return null;
|
|
22
|
+
const out = r.stdout.trim();
|
|
23
|
+
return out.length > 0 ? out : null;
|
|
24
|
+
}
|
|
25
|
+
export function getGitBranch(cwd) {
|
|
26
|
+
const r = runGit(cwd, ['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
27
|
+
if (!r.ok)
|
|
28
|
+
return null;
|
|
29
|
+
const out = r.stdout.trim();
|
|
30
|
+
return out.length > 0 ? out : null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Verify that `ref` resolves to a commit. Returns `{ valid: true }` on
|
|
34
|
+
* success, otherwise `{ valid: false, suggestions }` listing nearby
|
|
35
|
+
* branch / tag names so the caller can offer a did-you-mean.
|
|
36
|
+
*
|
|
37
|
+
* Cheap (`git rev-parse --verify` + `git for-each-ref`) — only run when
|
|
38
|
+
* the user passes an explicit ref.
|
|
39
|
+
*/
|
|
40
|
+
export function verifyGitRef(cwd, ref) {
|
|
41
|
+
if (!isGitRepo(cwd))
|
|
42
|
+
return { valid: false, suggestions: [] };
|
|
43
|
+
const r = runGit(cwd, ['rev-parse', '--verify', '--quiet', `${ref}^{commit}`]);
|
|
44
|
+
if (r.ok)
|
|
45
|
+
return { valid: true };
|
|
46
|
+
// Collect candidate names from local + remote refs, then rank by Levenshtein.
|
|
47
|
+
const candidates = listRefNames(cwd);
|
|
48
|
+
const suggestions = nearestRefs(ref, candidates, 3);
|
|
49
|
+
return { valid: false, suggestions };
|
|
50
|
+
}
|
|
51
|
+
function listRefNames(cwd) {
|
|
52
|
+
const out = new Set();
|
|
53
|
+
const local = runGit(cwd, ['for-each-ref', '--format=%(refname:short)', 'refs/heads']);
|
|
54
|
+
if (local.ok)
|
|
55
|
+
for (const line of parseLines(local.stdout))
|
|
56
|
+
out.add(line);
|
|
57
|
+
const remote = runGit(cwd, ['for-each-ref', '--format=%(refname:short)', 'refs/remotes']);
|
|
58
|
+
if (remote.ok)
|
|
59
|
+
for (const line of parseLines(remote.stdout))
|
|
60
|
+
out.add(line);
|
|
61
|
+
const tags = runGit(cwd, ['for-each-ref', '--format=%(refname:short)', 'refs/tags']);
|
|
62
|
+
if (tags.ok)
|
|
63
|
+
for (const line of parseLines(tags.stdout))
|
|
64
|
+
out.add(line);
|
|
65
|
+
return [...out];
|
|
66
|
+
}
|
|
67
|
+
function nearestRefs(query, refs, k) {
|
|
68
|
+
const scored = refs.map((r) => ({ r, d: levenshtein(query, r) }));
|
|
69
|
+
scored.sort((a, b) => a.d - b.d);
|
|
70
|
+
return scored.slice(0, k).map((s) => s.r);
|
|
71
|
+
}
|
|
72
|
+
function levenshtein(a, b) {
|
|
73
|
+
if (a === b)
|
|
74
|
+
return 0;
|
|
75
|
+
const al = a.length;
|
|
76
|
+
const bl = b.length;
|
|
77
|
+
if (al === 0)
|
|
78
|
+
return bl;
|
|
79
|
+
if (bl === 0)
|
|
80
|
+
return al;
|
|
81
|
+
let prev = new Array(bl + 1);
|
|
82
|
+
let curr = new Array(bl + 1);
|
|
83
|
+
for (let j = 0; j <= bl; j += 1)
|
|
84
|
+
prev[j] = j;
|
|
85
|
+
for (let i = 1; i <= al; i += 1) {
|
|
86
|
+
curr[0] = i;
|
|
87
|
+
for (let j = 1; j <= bl; j += 1) {
|
|
88
|
+
const cost = a.charCodeAt(i - 1) === b.charCodeAt(j - 1) ? 0 : 1;
|
|
89
|
+
curr[j] = Math.min((prev[j] ?? 0) + 1, (curr[j - 1] ?? 0) + 1, (prev[j - 1] ?? 0) + cost);
|
|
90
|
+
}
|
|
91
|
+
[prev, curr] = [curr, prev];
|
|
92
|
+
}
|
|
93
|
+
return prev[bl] ?? Math.max(al, bl);
|
|
94
|
+
}
|
|
95
|
+
export function getChangedFiles(cwd, opts = {}) {
|
|
96
|
+
if (!isGitRepo(cwd))
|
|
97
|
+
return [];
|
|
98
|
+
const args = ['diff', '--name-only'];
|
|
99
|
+
if (opts.staged)
|
|
100
|
+
args.push('--cached');
|
|
101
|
+
if (opts.since)
|
|
102
|
+
args.push(opts.since);
|
|
103
|
+
const a = runGit(cwd, args);
|
|
104
|
+
const set = new Set(parseLines(a.stdout));
|
|
105
|
+
if (opts.includeWorktree && !opts.staged && !opts.since) {
|
|
106
|
+
// Include untracked + working-tree changes via `git status --porcelain`.
|
|
107
|
+
const s = runGit(cwd, ['status', '--porcelain']);
|
|
108
|
+
if (s.ok) {
|
|
109
|
+
for (const line of s.stdout.split('\n')) {
|
|
110
|
+
const trimmed = line.slice(3).trim();
|
|
111
|
+
if (trimmed)
|
|
112
|
+
set.add(trimmed);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return [...set].sort();
|
|
117
|
+
}
|
|
118
|
+
export function getStatusSummary(cwd) {
|
|
119
|
+
const empty = {
|
|
120
|
+
branch: null,
|
|
121
|
+
root: null,
|
|
122
|
+
ahead: 0,
|
|
123
|
+
behind: 0,
|
|
124
|
+
staged: 0,
|
|
125
|
+
modified: 0,
|
|
126
|
+
untracked: 0,
|
|
127
|
+
conflicts: 0,
|
|
128
|
+
clean: true,
|
|
129
|
+
};
|
|
130
|
+
if (!isGitRepo(cwd))
|
|
131
|
+
return empty;
|
|
132
|
+
const r = runGit(cwd, ['status', '--porcelain=2', '--branch']);
|
|
133
|
+
if (!r.ok)
|
|
134
|
+
return empty;
|
|
135
|
+
const out = { ...empty };
|
|
136
|
+
out.root = getGitRoot(cwd);
|
|
137
|
+
for (const line of r.stdout.split('\n')) {
|
|
138
|
+
if (line.startsWith('# branch.head')) {
|
|
139
|
+
out.branch = line.slice('# branch.head'.length).trim();
|
|
140
|
+
}
|
|
141
|
+
else if (line.startsWith('# branch.ab')) {
|
|
142
|
+
const m = /\+(\d+)\s+-(\d+)/.exec(line);
|
|
143
|
+
if (m) {
|
|
144
|
+
out.ahead = Number(m[1]);
|
|
145
|
+
out.behind = Number(m[2]);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else if (line.startsWith('1 ') || line.startsWith('2 ')) {
|
|
149
|
+
const xy = line.split(' ')[1] ?? '..';
|
|
150
|
+
const x = xy[0] ?? '.';
|
|
151
|
+
const y = xy[1] ?? '.';
|
|
152
|
+
if (x !== '.')
|
|
153
|
+
out.staged += 1;
|
|
154
|
+
if (y !== '.')
|
|
155
|
+
out.modified += 1;
|
|
156
|
+
}
|
|
157
|
+
else if (line.startsWith('u ')) {
|
|
158
|
+
out.conflicts += 1;
|
|
159
|
+
}
|
|
160
|
+
else if (line.startsWith('? ')) {
|
|
161
|
+
out.untracked += 1;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
out.clean =
|
|
165
|
+
out.staged === 0 && out.modified === 0 && out.untracked === 0 && out.conflicts === 0;
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
168
|
+
export function parseLines(text) {
|
|
169
|
+
return text
|
|
170
|
+
.split('\n')
|
|
171
|
+
.map((s) => s.trim())
|
|
172
|
+
.filter((s) => s.length > 0);
|
|
173
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const GOLDEN_OUTPUT_SCHEMA = "sharkcraft.golden-output/v1";
|
|
2
|
+
export interface IGoldenOutputCase {
|
|
3
|
+
id: string;
|
|
4
|
+
command: string;
|
|
5
|
+
goldenFile: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IGoldenOutputCompareResult {
|
|
8
|
+
id: string;
|
|
9
|
+
match: boolean;
|
|
10
|
+
diff?: string;
|
|
11
|
+
goldenPresent: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface IGoldenOutputReport {
|
|
14
|
+
schema: typeof GOLDEN_OUTPUT_SCHEMA;
|
|
15
|
+
generatedAt: string;
|
|
16
|
+
cases: readonly IGoldenOutputCompareResult[];
|
|
17
|
+
summary: {
|
|
18
|
+
total: number;
|
|
19
|
+
matches: number;
|
|
20
|
+
mismatches: number;
|
|
21
|
+
missing: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare function listGoldenCases(): readonly IGoldenOutputCase[];
|
|
25
|
+
/**
|
|
26
|
+
* Normalize an output blob so timestamps, durations, and absolute paths
|
|
27
|
+
* don't cause spurious diffs.
|
|
28
|
+
*/
|
|
29
|
+
export declare function normalizeOutput(raw: string): string;
|
|
30
|
+
export declare function compareGoldenOutput(projectRoot: string, caseEntry: IGoldenOutputCase, currentOutput: string): IGoldenOutputCompareResult;
|
|
31
|
+
export declare function writeGoldenOutput(projectRoot: string, caseEntry: IGoldenOutputCase, currentOutput: string): string;
|
|
32
|
+
export declare function summarizeGoldenResults(results: readonly IGoldenOutputCompareResult[]): IGoldenOutputReport['summary'];
|
|
33
|
+
//# sourceMappingURL=golden-output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"golden-output.d.ts","sourceRoot":"","sources":["../src/golden-output.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,oBAAoB,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAC7C,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAClF;AAUD,wBAAgB,eAAe,IAAI,SAAS,iBAAiB,EAAE,CAE9D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUnD;AAqBD,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,iBAAiB,EAC5B,aAAa,EAAE,MAAM,GACpB,0BAA0B,CAc5B;AAED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,iBAAiB,EAC5B,aAAa,EAAE,MAAM,GACpB,MAAM,CAMR;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,0BAA0B,EAAE,GAC7C,mBAAmB,CAAC,SAAS,CAAC,CAUhC"}
|