@shrkcrft/inspector 0.1.0-alpha.2
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 +43 -0
- package/dist/area-map.d.ts.map +1 -0
- package/dist/area-map.js +197 -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 +201 -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 +26 -0
- package/dist/git-helpers.d.ts.map +1 -0
- package/dist/git-helpers.js +110 -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 +413 -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 +223 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +233 -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.d.ts +28 -0
- package/dist/onboarding-drafts.d.ts.map +1 -0
- package/dist/onboarding-drafts.js +234 -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 +60 -0
- package/dist/pack-symbol-compat.d.ts.map +1 -0
- package/dist/pack-symbol-compat.js +371 -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 +71 -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 +66 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { scanImports } from '@shrkcrft/boundaries';
|
|
4
|
+
import { listConstructs } from "./construct-registry.js";
|
|
5
|
+
export const CONSTRUCT_INFERENCE_SCHEMA = 'sharkcraft.construct-inference/v1';
|
|
6
|
+
export var InferredConstructConfidence;
|
|
7
|
+
(function (InferredConstructConfidence) {
|
|
8
|
+
InferredConstructConfidence["High"] = "high";
|
|
9
|
+
InferredConstructConfidence["Medium"] = "medium";
|
|
10
|
+
InferredConstructConfidence["Low"] = "low";
|
|
11
|
+
})(InferredConstructConfidence || (InferredConstructConfidence = {}));
|
|
12
|
+
const FOLDER_HINTS = [
|
|
13
|
+
{ match: /(^|\/)services?($|\/)/, type: 'service', title: (_r, n) => `${n} service`, confidence: InferredConstructConfidence.High },
|
|
14
|
+
{ match: /(^|\/)plugins?($|\/)/, type: 'plugin', title: (_r, n) => `${n} plugin`, confidence: InferredConstructConfidence.High },
|
|
15
|
+
{ match: /(^|\/)policies?($|\/)/, type: 'policy', title: (_r, n) => `${n} policy`, confidence: InferredConstructConfidence.High },
|
|
16
|
+
{ match: /(^|\/)capabilities?($|\/)/, type: 'capability', title: (_r, n) => `${n} capability`, confidence: InferredConstructConfidence.High },
|
|
17
|
+
{ match: /(^|\/)adapters?($|\/)/, type: 'adapter', title: (_r, n) => `${n} adapter`, confidence: InferredConstructConfidence.Medium },
|
|
18
|
+
{ match: /(^|\/)(routes?|controllers?)($|\/)/, type: 'route', title: (_r, n) => `${n} route`, confidence: InferredConstructConfidence.Medium },
|
|
19
|
+
{ match: /(^|\/)components?($|\/)/, type: 'component', title: (_r, n) => `${n} component`, confidence: InferredConstructConfidence.Medium },
|
|
20
|
+
{ match: /(^|\/)features?($|\/)/, type: 'feature', title: (_r, n) => `${n} feature`, confidence: InferredConstructConfidence.Medium },
|
|
21
|
+
{ match: /(^|\/)modules?($|\/)/, type: 'module', title: (_r, n) => `${n} module`, confidence: InferredConstructConfidence.Low },
|
|
22
|
+
];
|
|
23
|
+
const FILE_SUFFIX_HINTS = [
|
|
24
|
+
{ suffix: /\.service\.(ts|tsx|js)$/, type: 'service', title: (n) => `${n} service`, confidence: InferredConstructConfidence.High },
|
|
25
|
+
{ suffix: /\.plugin\.(ts|tsx|js)$/, type: 'plugin', title: (n) => `${n} plugin`, confidence: InferredConstructConfidence.High },
|
|
26
|
+
{ suffix: /\.policy\.(ts|tsx|js)$/, type: 'policy', title: (n) => `${n} policy`, confidence: InferredConstructConfidence.High },
|
|
27
|
+
{ suffix: /\.controller\.(ts|tsx|js)$/, type: 'controller', title: (n) => `${n} controller`, confidence: InferredConstructConfidence.Medium },
|
|
28
|
+
{ suffix: /\.adapter\.(ts|tsx|js)$/, type: 'adapter', title: (n) => `${n} adapter`, confidence: InferredConstructConfidence.Medium },
|
|
29
|
+
];
|
|
30
|
+
const IGNORE_DIRS = new Set([
|
|
31
|
+
'node_modules',
|
|
32
|
+
'.git',
|
|
33
|
+
'.sharkcraft',
|
|
34
|
+
'dist',
|
|
35
|
+
'build',
|
|
36
|
+
'.cache',
|
|
37
|
+
'.turbo',
|
|
38
|
+
'.nx',
|
|
39
|
+
'.next',
|
|
40
|
+
'coverage',
|
|
41
|
+
]);
|
|
42
|
+
function walk(root, current = '') {
|
|
43
|
+
const out = [];
|
|
44
|
+
const dir = current ? nodePath.join(root, current) : root;
|
|
45
|
+
let entries;
|
|
46
|
+
try {
|
|
47
|
+
entries = readdirSync(dir);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return out;
|
|
51
|
+
}
|
|
52
|
+
for (const name of entries) {
|
|
53
|
+
if (name.startsWith('.') && name !== '.github')
|
|
54
|
+
continue;
|
|
55
|
+
if (IGNORE_DIRS.has(name))
|
|
56
|
+
continue;
|
|
57
|
+
const rel = current ? `${current}/${name}` : name;
|
|
58
|
+
let stat;
|
|
59
|
+
try {
|
|
60
|
+
stat = statSync(nodePath.join(root, rel));
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (stat.isDirectory())
|
|
66
|
+
out.push(...walk(root, rel));
|
|
67
|
+
else if (stat.isFile())
|
|
68
|
+
out.push(rel);
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
function basenameNoExt(file) {
|
|
73
|
+
const base = file.split('/').pop() ?? file;
|
|
74
|
+
const dotIdx = base.indexOf('.');
|
|
75
|
+
return dotIdx >= 0 ? base.slice(0, dotIdx) : base;
|
|
76
|
+
}
|
|
77
|
+
function kebabize(s) {
|
|
78
|
+
return s
|
|
79
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
80
|
+
.replace(/[_\s]+/g, '-')
|
|
81
|
+
.toLowerCase();
|
|
82
|
+
}
|
|
83
|
+
function newBuilder(type, baseId, title, confidence) {
|
|
84
|
+
return {
|
|
85
|
+
type,
|
|
86
|
+
baseId,
|
|
87
|
+
title,
|
|
88
|
+
files: new Set(),
|
|
89
|
+
publicApi: new Set(),
|
|
90
|
+
evidence: new Set(),
|
|
91
|
+
events: new Set(),
|
|
92
|
+
tokens: new Set(),
|
|
93
|
+
confidence,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function safeId(s) {
|
|
97
|
+
return s.replace(/[^a-z0-9-]+/gi, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').toLowerCase();
|
|
98
|
+
}
|
|
99
|
+
/** Extract simple string-constant style events/tokens from a file. */
|
|
100
|
+
function scanFacets(absPath) {
|
|
101
|
+
const events = [];
|
|
102
|
+
const tokens = [];
|
|
103
|
+
let text;
|
|
104
|
+
try {
|
|
105
|
+
text = readFileSync(absPath, 'utf8');
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return { events, tokens };
|
|
109
|
+
}
|
|
110
|
+
// Event-like: 'foo.bar' / "foo.bar" with a dot in the middle.
|
|
111
|
+
const evRe = /['"`]([a-z0-9_-]+(?:\.[a-z0-9_-]+){1,3})['"`]/gi;
|
|
112
|
+
let m;
|
|
113
|
+
while ((m = evRe.exec(text)) !== null) {
|
|
114
|
+
const val = m[1];
|
|
115
|
+
if (/^[a-z0-9_-]+\.[a-z0-9_-]+/i.test(val) && val.length < 60) {
|
|
116
|
+
events.push(val);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Token-like: UPPER_SNAKE_CASE identifiers exported or referenced.
|
|
120
|
+
const tokRe = /\b([A-Z][A-Z0-9_]{3,})\b/g;
|
|
121
|
+
while ((m = tokRe.exec(text)) !== null) {
|
|
122
|
+
tokens.push(m[1]);
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
events: [...new Set(events)].slice(0, 6),
|
|
126
|
+
tokens: [...new Set(tokens)].slice(0, 6),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function buildPublicApi(files) {
|
|
130
|
+
const out = [];
|
|
131
|
+
for (const f of files) {
|
|
132
|
+
const base = f.split('/').pop() ?? '';
|
|
133
|
+
if (base === 'index.ts' || base === 'index.tsx' || base === 'index.js') {
|
|
134
|
+
out.push(f);
|
|
135
|
+
}
|
|
136
|
+
if (/\.public\.(ts|tsx|js)$/.test(base))
|
|
137
|
+
out.push(f);
|
|
138
|
+
}
|
|
139
|
+
return [...new Set(out)];
|
|
140
|
+
}
|
|
141
|
+
function relatedAssets(inspection, files) {
|
|
142
|
+
const templates = new Set();
|
|
143
|
+
const pipelines = new Set();
|
|
144
|
+
const paths = new Set();
|
|
145
|
+
// Templates with targetPath overlap.
|
|
146
|
+
for (const t of inspection.templateRegistry.list()) {
|
|
147
|
+
const tp = t.targetPath;
|
|
148
|
+
const pathLike = typeof tp === 'string' ? tp : '';
|
|
149
|
+
if (!pathLike)
|
|
150
|
+
continue;
|
|
151
|
+
if (files.some((f) => f.includes(pathLike) || pathLike.includes(f.split('/').pop() ?? ''))) {
|
|
152
|
+
templates.add(t.id);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Pipelines that mention these files (heuristic).
|
|
156
|
+
for (const p of inspection.pipelineRegistry.list()) {
|
|
157
|
+
const blob = JSON.stringify(p.steps ?? []).toLowerCase();
|
|
158
|
+
if (files.some((f) => blob.includes(f.toLowerCase())))
|
|
159
|
+
pipelines.add(p.id);
|
|
160
|
+
}
|
|
161
|
+
// Path conventions covering folders.
|
|
162
|
+
for (const p of inspection.pathService.list()) {
|
|
163
|
+
const meta = (p.metadata ?? {});
|
|
164
|
+
const segment = (meta.path ?? '').replace(/\*+/g, '');
|
|
165
|
+
if (!segment)
|
|
166
|
+
continue;
|
|
167
|
+
if (files.some((f) => f.includes(segment)))
|
|
168
|
+
paths.add(p.id);
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
templates: [...templates].sort(),
|
|
172
|
+
pipelines: [...pipelines].sort(),
|
|
173
|
+
pathConventions: [...paths].sort(),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
function buildDraft(c) {
|
|
177
|
+
const lines = [];
|
|
178
|
+
lines.push(`defineConstruct({`);
|
|
179
|
+
lines.push(` id: '${c.id}',`);
|
|
180
|
+
lines.push(` type: '${c.type}',`);
|
|
181
|
+
lines.push(` title: '${c.title.replace(/'/g, "\\'")}',`);
|
|
182
|
+
lines.push(` description: 'Inferred (${c.confidence} confidence). Replace with a real description.',`);
|
|
183
|
+
if (c.files.length) {
|
|
184
|
+
lines.push(' files: [');
|
|
185
|
+
for (const f of c.files.slice(0, 12))
|
|
186
|
+
lines.push(` '${f}',`);
|
|
187
|
+
lines.push(' ],');
|
|
188
|
+
}
|
|
189
|
+
if (c.publicApi.length) {
|
|
190
|
+
lines.push(' publicApi: [');
|
|
191
|
+
for (const a of c.publicApi.slice(0, 8))
|
|
192
|
+
lines.push(` '${a}',`);
|
|
193
|
+
lines.push(' ],');
|
|
194
|
+
}
|
|
195
|
+
if (c.events?.length) {
|
|
196
|
+
lines.push(` events: [${c.events.map((e) => `'${e}'`).join(', ')}],`);
|
|
197
|
+
}
|
|
198
|
+
if (c.tokens?.length) {
|
|
199
|
+
lines.push(` tokens: [${c.tokens.map((e) => `'${e}'`).join(', ')}],`);
|
|
200
|
+
}
|
|
201
|
+
if (c.relatedTemplates?.length) {
|
|
202
|
+
lines.push(` relatedTemplates: [${c.relatedTemplates.map((e) => `'${e}'`).join(', ')}],`);
|
|
203
|
+
}
|
|
204
|
+
if (c.relatedPipelines?.length) {
|
|
205
|
+
lines.push(` relatedPipelines: [${c.relatedPipelines.map((e) => `'${e}'`).join(', ')}],`);
|
|
206
|
+
}
|
|
207
|
+
if (c.relatedPathConventions?.length) {
|
|
208
|
+
lines.push(` relatedPathConventions: [${c.relatedPathConventions.map((e) => `'${e}'`).join(', ')}],`);
|
|
209
|
+
}
|
|
210
|
+
lines.push(`}),`);
|
|
211
|
+
return lines.join('\n');
|
|
212
|
+
}
|
|
213
|
+
function confidenceRank(c) {
|
|
214
|
+
if (c === InferredConstructConfidence.High)
|
|
215
|
+
return 3;
|
|
216
|
+
if (c === InferredConstructConfidence.Medium)
|
|
217
|
+
return 2;
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
220
|
+
export async function inferConstructs(inspection, input = {}) {
|
|
221
|
+
const warnings = [];
|
|
222
|
+
const builders = new Map();
|
|
223
|
+
const projectRoot = inspection.projectRoot;
|
|
224
|
+
const allFiles = existsSync(projectRoot) ? walk(projectRoot) : [];
|
|
225
|
+
// Pass 1: folder + filename hints.
|
|
226
|
+
for (const file of allFiles) {
|
|
227
|
+
if (!/\.(ts|tsx|js|jsx)$/.test(file))
|
|
228
|
+
continue;
|
|
229
|
+
if (file.includes('.spec.') || file.includes('.test.') || file.includes('__tests__/')) {
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
// Filename suffix hints (e.g. user.service.ts).
|
|
233
|
+
const base = file.split('/').pop() ?? '';
|
|
234
|
+
let matched = false;
|
|
235
|
+
for (const fh of FILE_SUFFIX_HINTS) {
|
|
236
|
+
if (fh.suffix.test(base)) {
|
|
237
|
+
const name = base.replace(fh.suffix, '');
|
|
238
|
+
const id = `${fh.type}.${safeId(kebabize(name))}`;
|
|
239
|
+
let b = builders.get(id);
|
|
240
|
+
if (!b) {
|
|
241
|
+
b = newBuilder(fh.type, id, fh.title(name), fh.confidence);
|
|
242
|
+
builders.set(id, b);
|
|
243
|
+
}
|
|
244
|
+
b.files.add(file);
|
|
245
|
+
b.evidence.add(`filename matches /${fh.suffix.source}/`);
|
|
246
|
+
matched = true;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (matched)
|
|
250
|
+
continue;
|
|
251
|
+
// Folder hints.
|
|
252
|
+
for (const fh of FOLDER_HINTS) {
|
|
253
|
+
if (!fh.match.test(file))
|
|
254
|
+
continue;
|
|
255
|
+
// Group by parent folder under the matched segment.
|
|
256
|
+
const segments = file.split('/');
|
|
257
|
+
const matchIdx = segments.findIndex((s) => fh.match.test('/' + s + '/'));
|
|
258
|
+
if (matchIdx < 0 || matchIdx + 1 >= segments.length)
|
|
259
|
+
continue;
|
|
260
|
+
const next = segments[matchIdx + 1];
|
|
261
|
+
// If `next` is also the filename, use the bare name; otherwise treat the folder as the group.
|
|
262
|
+
const group = next.includes('.') ? basenameNoExt(next) : next;
|
|
263
|
+
const id = `${fh.type}.${safeId(kebabize(group))}`;
|
|
264
|
+
let b = builders.get(id);
|
|
265
|
+
if (!b) {
|
|
266
|
+
b = newBuilder(fh.type, id, fh.title(projectRoot, group), fh.confidence);
|
|
267
|
+
builders.set(id, b);
|
|
268
|
+
}
|
|
269
|
+
b.files.add(file);
|
|
270
|
+
b.evidence.add(`folder matches ${fh.match.source}`);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Pass 2: aggregate by import-graph clusters around publicApi candidates.
|
|
275
|
+
try {
|
|
276
|
+
const scan = scanImports({ projectRoot });
|
|
277
|
+
const importsByTarget = new Map();
|
|
278
|
+
for (const e of scan.edges) {
|
|
279
|
+
if (e.kind !== 'internal')
|
|
280
|
+
continue;
|
|
281
|
+
if (!e.importSpecifier.startsWith('.'))
|
|
282
|
+
continue;
|
|
283
|
+
const target = nodePath.posix.normalize(nodePath.posix.join(nodePath.posix.dirname(e.from), e.importSpecifier));
|
|
284
|
+
const set = importsByTarget.get(target) ?? new Set();
|
|
285
|
+
set.add(e.from);
|
|
286
|
+
importsByTarget.set(target, set);
|
|
287
|
+
}
|
|
288
|
+
for (const b of builders.values()) {
|
|
289
|
+
// Add files that import any of the builder's files as "publicApi" hints.
|
|
290
|
+
for (const f of [...b.files]) {
|
|
291
|
+
const target = f.replace(/\.(ts|tsx|js|jsx)$/, '');
|
|
292
|
+
for (const t of [target, target + '.ts', target + '.tsx', target + '/index.ts']) {
|
|
293
|
+
const importers = importsByTarget.get(t);
|
|
294
|
+
if (!importers)
|
|
295
|
+
continue;
|
|
296
|
+
if (importers.size > 0) {
|
|
297
|
+
b.publicApi.add(f);
|
|
298
|
+
b.evidence.add(`imported by ${importers.size} file(s)`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
warnings.push('Import graph scan failed; some confidence hints unavailable.');
|
|
306
|
+
}
|
|
307
|
+
// Pass 3: facet detection (events/tokens).
|
|
308
|
+
for (const b of builders.values()) {
|
|
309
|
+
for (const f of [...b.files].slice(0, 8)) {
|
|
310
|
+
const abs = nodePath.join(projectRoot, f);
|
|
311
|
+
const facets = scanFacets(abs);
|
|
312
|
+
for (const e of facets.events)
|
|
313
|
+
b.events.add(e);
|
|
314
|
+
for (const t of facets.tokens)
|
|
315
|
+
b.tokens.add(t);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// Drop builders without files.
|
|
319
|
+
const existingIds = new Set(listConstructs(inspection).map((c) => c.id));
|
|
320
|
+
const candidatesAll = [];
|
|
321
|
+
for (const b of builders.values()) {
|
|
322
|
+
if (b.files.size === 0)
|
|
323
|
+
continue;
|
|
324
|
+
if (existingIds.has(b.baseId)) {
|
|
325
|
+
// Skip if construct is already defined locally; still allow drafts via --include-existing.
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
const relAssets = relatedAssets(inspection, [...b.files]);
|
|
329
|
+
const publicApi = b.publicApi.size > 0 ? [...b.publicApi] : buildPublicApi([...b.files]);
|
|
330
|
+
const c = {
|
|
331
|
+
id: b.baseId,
|
|
332
|
+
type: b.type,
|
|
333
|
+
title: b.title,
|
|
334
|
+
confidence: b.confidence,
|
|
335
|
+
evidence: [...b.evidence].sort(),
|
|
336
|
+
files: [...b.files].sort(),
|
|
337
|
+
publicApi: publicApi.sort(),
|
|
338
|
+
events: [...b.events].slice(0, 6),
|
|
339
|
+
tokens: [...b.tokens].slice(0, 6),
|
|
340
|
+
...(relAssets.templates.length ? { relatedTemplates: relAssets.templates } : {}),
|
|
341
|
+
...(relAssets.pipelines.length ? { relatedPipelines: relAssets.pipelines } : {}),
|
|
342
|
+
...(relAssets.pathConventions.length
|
|
343
|
+
? { relatedPathConventions: relAssets.pathConventions }
|
|
344
|
+
: {}),
|
|
345
|
+
draft: '',
|
|
346
|
+
};
|
|
347
|
+
c.draft = buildDraft(c);
|
|
348
|
+
candidatesAll.push(c);
|
|
349
|
+
}
|
|
350
|
+
// Sort by confidence desc then file count desc.
|
|
351
|
+
candidatesAll.sort((a, b) => confidenceRank(b.confidence) - confidenceRank(a.confidence) ||
|
|
352
|
+
b.files.length - a.files.length ||
|
|
353
|
+
a.id.localeCompare(b.id));
|
|
354
|
+
let candidates = candidatesAll;
|
|
355
|
+
if (input.type)
|
|
356
|
+
candidates = candidates.filter((c) => c.type === input.type);
|
|
357
|
+
if (input.minConfidence) {
|
|
358
|
+
const min = confidenceRank(input.minConfidence);
|
|
359
|
+
candidates = candidates.filter((c) => confidenceRank(c.confidence) >= min);
|
|
360
|
+
}
|
|
361
|
+
if (input.limit && input.limit > 0) {
|
|
362
|
+
candidates = candidates.slice(0, input.limit);
|
|
363
|
+
}
|
|
364
|
+
return {
|
|
365
|
+
schema: CONSTRUCT_INFERENCE_SCHEMA,
|
|
366
|
+
generatedAt: new Date().toISOString(),
|
|
367
|
+
projectRoot,
|
|
368
|
+
candidates,
|
|
369
|
+
warnings,
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
export function renderConstructDraftsModule(result) {
|
|
373
|
+
const lines = [];
|
|
374
|
+
lines.push("/**");
|
|
375
|
+
lines.push(" * Inferred SharkCraft construct drafts.");
|
|
376
|
+
lines.push(" *");
|
|
377
|
+
lines.push(" * This file is written by `shrk constructs infer --write-drafts`.");
|
|
378
|
+
lines.push(" * Review carefully and copy the bits you want into `sharkcraft/constructs.ts`.");
|
|
379
|
+
lines.push(" * SharkCraft does NOT load this file automatically.");
|
|
380
|
+
lines.push(` * Generated: ${result.generatedAt}`);
|
|
381
|
+
lines.push(" */");
|
|
382
|
+
lines.push("import { defineConstruct } from '@shrkcrft/plugin-api';");
|
|
383
|
+
lines.push('');
|
|
384
|
+
lines.push('export default [');
|
|
385
|
+
for (const c of result.candidates) {
|
|
386
|
+
for (const line of c.draft.split('\n'))
|
|
387
|
+
lines.push(' ' + line);
|
|
388
|
+
}
|
|
389
|
+
lines.push('];');
|
|
390
|
+
return lines.join('\n') + '\n';
|
|
391
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IConstructFacetInput, IConstructFacetValue, IConstructInput } from '@shrkcrft/plugin-api';
|
|
2
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
3
|
+
export declare const CONSTRUCT_REGISTRY_SCHEMA = "sharkcraft.construct-registry/v1";
|
|
4
|
+
export interface IConstruct extends IConstructInput {
|
|
5
|
+
source: 'local' | 'pack';
|
|
6
|
+
packageName?: string;
|
|
7
|
+
sourceFile?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IConstructFacet extends IConstructFacetInput {
|
|
10
|
+
}
|
|
11
|
+
export declare function loadConstructs(inspection: ISharkcraftInspection): Promise<readonly IConstruct[]>;
|
|
12
|
+
/** Synchronous accessor — falls back to a snapshot cached from the last
|
|
13
|
+
* async load. Used by search-index which needs to be sync-friendly. */
|
|
14
|
+
export declare function listConstructs(inspection: ISharkcraftInspection): readonly IConstruct[];
|
|
15
|
+
/** Pre-warm the cache so subsequent sync reads see a populated list. */
|
|
16
|
+
export declare function warmConstructCache(inspection: ISharkcraftInspection): Promise<void>;
|
|
17
|
+
export interface IConstructTrace {
|
|
18
|
+
construct: IConstruct;
|
|
19
|
+
files: readonly string[];
|
|
20
|
+
publicApi: readonly string[];
|
|
21
|
+
events: readonly string[];
|
|
22
|
+
tokens: readonly string[];
|
|
23
|
+
commands: readonly string[];
|
|
24
|
+
relatedKnowledge: readonly string[];
|
|
25
|
+
relatedRules: readonly string[];
|
|
26
|
+
relatedTemplates: readonly string[];
|
|
27
|
+
relatedPipelines: readonly string[];
|
|
28
|
+
facets: Record<string, readonly IConstructFacetValue[]>;
|
|
29
|
+
warnings: readonly string[];
|
|
30
|
+
}
|
|
31
|
+
export declare function traceConstruct(construct: IConstruct): IConstructTrace;
|
|
32
|
+
//# sourceMappingURL=construct-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct-registry.d.ts","sourceRoot":"","sources":["../src/construct-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,yBAAyB,qCAAqC,CAAC;AAE5E,MAAM,WAAW,UAAW,SAAQ,eAAe;IACjD,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;CAAG;AA+DhE,wBAAsB,cAAc,CAClC,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAwFhC;AAED;wEACwE;AACxE,wBAAgB,cAAc,CAAC,UAAU,EAAE,qBAAqB,GAAG,SAAS,UAAU,EAAE,CAGvF;AAED,wEAAwE;AACxE,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzF;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,UAAU,CAAC;IACtB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC,CAAC;IACxD,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,UAAU,GAAG,eAAe,CAmBrE"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
10
|
+
import * as nodePath from 'node:path';
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
12
|
+
export const CONSTRUCT_REGISTRY_SCHEMA = 'sharkcraft.construct-registry/v1';
|
|
13
|
+
const CACHE = new Map();
|
|
14
|
+
function readJsonOrEmpty(file) {
|
|
15
|
+
if (!existsSync(file))
|
|
16
|
+
return null;
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(readFileSync(file, 'utf8'));
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function importDefault(file) {
|
|
25
|
+
const mod = (await import(__rewriteRelativeImportExtension(pathToFileURL(file).href)));
|
|
26
|
+
const def = mod.default;
|
|
27
|
+
if (Array.isArray(def))
|
|
28
|
+
return def;
|
|
29
|
+
if (def && typeof def === 'object')
|
|
30
|
+
return [def];
|
|
31
|
+
if (Array.isArray(mod.constructs))
|
|
32
|
+
return mod.constructs;
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
function localConstructFiles(inspection) {
|
|
36
|
+
const out = [];
|
|
37
|
+
const dir = inspection.sharkcraftDir;
|
|
38
|
+
if (!dir)
|
|
39
|
+
return [];
|
|
40
|
+
const defaults = ['constructs.ts', 'constructs.js', 'constructs/index.ts'];
|
|
41
|
+
for (const f of defaults) {
|
|
42
|
+
const full = nodePath.join(dir, f);
|
|
43
|
+
if (existsSync(full))
|
|
44
|
+
out.push(full);
|
|
45
|
+
}
|
|
46
|
+
const cfg = inspection.config;
|
|
47
|
+
if (cfg?.constructFiles) {
|
|
48
|
+
for (const rel of cfg.constructFiles)
|
|
49
|
+
out.push(nodePath.join(dir, rel));
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
function localFacetFiles(inspection) {
|
|
54
|
+
const out = [];
|
|
55
|
+
const dir = inspection.sharkcraftDir;
|
|
56
|
+
if (!dir)
|
|
57
|
+
return [];
|
|
58
|
+
const defaults = ['construct-facets.ts', 'construct-facets/index.ts'];
|
|
59
|
+
for (const f of defaults) {
|
|
60
|
+
const full = nodePath.join(dir, f);
|
|
61
|
+
if (existsSync(full))
|
|
62
|
+
out.push(full);
|
|
63
|
+
}
|
|
64
|
+
const cfg = inspection.config;
|
|
65
|
+
if (cfg?.constructFacetFiles) {
|
|
66
|
+
for (const rel of cfg.constructFacetFiles)
|
|
67
|
+
out.push(nodePath.join(dir, rel));
|
|
68
|
+
}
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
export async function loadConstructs(inspection) {
|
|
72
|
+
const cacheKey = `${inspection.projectRoot}:${inspection.packs.validPacks
|
|
73
|
+
.map((p) => p.packageName + '@' + p.packageVersion)
|
|
74
|
+
.join(',')}`;
|
|
75
|
+
const cached = CACHE.get(inspection.projectRoot);
|
|
76
|
+
if (cached && cached.cacheKey === cacheKey)
|
|
77
|
+
return cached.list;
|
|
78
|
+
const out = [];
|
|
79
|
+
// Local definitions.
|
|
80
|
+
for (const file of localConstructFiles(inspection)) {
|
|
81
|
+
try {
|
|
82
|
+
const list = await importDefault(file);
|
|
83
|
+
for (const c of list) {
|
|
84
|
+
if (!c?.id)
|
|
85
|
+
continue;
|
|
86
|
+
const entry = { ...c, source: 'local' };
|
|
87
|
+
entry.sourceFile = nodePath.relative(inspection.projectRoot, file);
|
|
88
|
+
out.push(entry);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
/* ignore — packs are best-effort */
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Standalone facet files (folded into matching constructs).
|
|
96
|
+
const looseFacets = [];
|
|
97
|
+
for (const file of localFacetFiles(inspection)) {
|
|
98
|
+
try {
|
|
99
|
+
const list = await importDefault(file);
|
|
100
|
+
for (const f of list) {
|
|
101
|
+
looseFacets.push(f);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
/* ignore */
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Pack contributions.
|
|
109
|
+
for (const pack of inspection.packs.validPacks ?? []) {
|
|
110
|
+
const contributions = (pack.manifest?.contributions ?? {});
|
|
111
|
+
const packRoot = pack.packageRoot;
|
|
112
|
+
if (!packRoot)
|
|
113
|
+
continue;
|
|
114
|
+
for (const rel of contributions.constructFiles ?? []) {
|
|
115
|
+
const file = nodePath.resolve(packRoot, rel);
|
|
116
|
+
if (!existsSync(file))
|
|
117
|
+
continue;
|
|
118
|
+
try {
|
|
119
|
+
const list = await importDefault(file);
|
|
120
|
+
for (const c of list) {
|
|
121
|
+
if (!c?.id)
|
|
122
|
+
continue;
|
|
123
|
+
out.push({
|
|
124
|
+
...c,
|
|
125
|
+
source: 'pack',
|
|
126
|
+
packageName: pack.packageName,
|
|
127
|
+
sourceFile: rel,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
/* ignore */
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const rel of contributions.constructFacetFiles ?? []) {
|
|
136
|
+
const file = nodePath.resolve(packRoot, rel);
|
|
137
|
+
if (!existsSync(file))
|
|
138
|
+
continue;
|
|
139
|
+
try {
|
|
140
|
+
const list = await importDefault(file);
|
|
141
|
+
for (const f of list)
|
|
142
|
+
looseFacets.push(f);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
/* ignore */
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Fold loose facets into their target construct.
|
|
150
|
+
for (const f of looseFacets) {
|
|
151
|
+
const target = out.find((c) => c.id === f.constructId);
|
|
152
|
+
if (!target)
|
|
153
|
+
continue;
|
|
154
|
+
const facets = (target.facets ?? {});
|
|
155
|
+
const list = facets[f.kind] ?? [];
|
|
156
|
+
list.push({
|
|
157
|
+
id: f.id,
|
|
158
|
+
value: f.value,
|
|
159
|
+
...(f.description ? { description: f.description } : {}),
|
|
160
|
+
...(f.source ? { source: f.source } : {}),
|
|
161
|
+
});
|
|
162
|
+
facets[f.kind] = list;
|
|
163
|
+
target.facets = facets;
|
|
164
|
+
}
|
|
165
|
+
CACHE.set(inspection.projectRoot, { cacheKey, list: out });
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
168
|
+
/** Synchronous accessor — falls back to a snapshot cached from the last
|
|
169
|
+
* async load. Used by search-index which needs to be sync-friendly. */
|
|
170
|
+
export function listConstructs(inspection) {
|
|
171
|
+
const cached = CACHE.get(inspection.projectRoot);
|
|
172
|
+
return cached?.list ?? [];
|
|
173
|
+
}
|
|
174
|
+
/** Pre-warm the cache so subsequent sync reads see a populated list. */
|
|
175
|
+
export async function warmConstructCache(inspection) {
|
|
176
|
+
await loadConstructs(inspection);
|
|
177
|
+
}
|
|
178
|
+
export function traceConstruct(construct) {
|
|
179
|
+
const warnings = [];
|
|
180
|
+
if ((construct.publicApi ?? []).length === 0) {
|
|
181
|
+
warnings.push('No publicApi entries declared — `shrk constructs api` will be empty.');
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
construct,
|
|
185
|
+
files: construct.files ?? [],
|
|
186
|
+
publicApi: construct.publicApi ?? [],
|
|
187
|
+
events: construct.events ?? [],
|
|
188
|
+
tokens: construct.tokens ?? [],
|
|
189
|
+
commands: construct.commands ?? [],
|
|
190
|
+
relatedKnowledge: construct.relatedKnowledge ?? [],
|
|
191
|
+
relatedRules: construct.relatedRules ?? [],
|
|
192
|
+
relatedTemplates: construct.relatedTemplates ?? [],
|
|
193
|
+
relatedPipelines: construct.relatedPipelines ?? [],
|
|
194
|
+
facets: (construct.facets ?? {}),
|
|
195
|
+
warnings,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
void readJsonOrEmpty;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `IContractFileRule` lets contracts express precise scope: glob,
|
|
3
|
+
* path-prefix, exact, contains. The legacy `forbiddenFiles: string[]`
|
|
4
|
+
* field is kept and treated as `kind: 'contains'` for back-compat.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ContractFileRuleKind {
|
|
7
|
+
Glob = "glob",
|
|
8
|
+
PathPrefix = "path-prefix",
|
|
9
|
+
Exact = "exact",
|
|
10
|
+
Contains = "contains"
|
|
11
|
+
}
|
|
12
|
+
export declare enum ContractFileRuleSeverity {
|
|
13
|
+
Error = "error",
|
|
14
|
+
Warning = "warning"
|
|
15
|
+
}
|
|
16
|
+
export interface IContractFileRule {
|
|
17
|
+
pattern: string;
|
|
18
|
+
kind: ContractFileRuleKind;
|
|
19
|
+
reason?: string;
|
|
20
|
+
severity?: ContractFileRuleSeverity;
|
|
21
|
+
}
|
|
22
|
+
/** Pure matcher — returns true when `file` is covered by `rule`. */
|
|
23
|
+
export declare function matchContractFileRule(rule: IContractFileRule, file: string): boolean;
|
|
24
|
+
export interface IContractFileRuleMatch {
|
|
25
|
+
file: string;
|
|
26
|
+
rule: IContractFileRule;
|
|
27
|
+
}
|
|
28
|
+
/** Returns every (file, rule) pair where the rule covers the file. */
|
|
29
|
+
export declare function matchContractFileRules(rules: readonly IContractFileRule[], files: readonly string[]): readonly IContractFileRuleMatch[];
|
|
30
|
+
/**
|
|
31
|
+
* Compatibility helper: legacy `forbiddenFiles: string[]` is wrapped as
|
|
32
|
+
* `kind: 'contains'` rules so the two pathways evaluate identically.
|
|
33
|
+
*/
|
|
34
|
+
export declare function rulesFromLegacyStrings(patterns: readonly string[]): readonly IContractFileRule[];
|
|
35
|
+
/** Detect intended `kind` for a free-text legacy pattern. */
|
|
36
|
+
export declare function inferContractFileRule(pattern: string): IContractFileRule;
|
|
37
|
+
//# sourceMappingURL=contract-file-rule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-file-rule.d.ts","sourceRoot":"","sources":["../src/contract-file-rule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,UAAU,gBAAgB;IAC1B,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAED,oBAAY,wBAAwB;IAClC,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CACrC;AAyCD,oEAAoE;AACpE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAapF;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,iBAAiB,EAAE,EACnC,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,SAAS,sBAAsB,EAAE,CAQnC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,SAAS,iBAAiB,EAAE,CAE9B;AAED,6DAA6D;AAC7D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAQxE"}
|