@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,42 @@
|
|
|
1
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
2
|
+
export declare const COMPLIANCE_SCHEMA = "sharkcraft.compliance/v1";
|
|
3
|
+
export interface IComplianceProfile {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
tags: readonly string[];
|
|
8
|
+
requiredDocs: readonly string[];
|
|
9
|
+
requiredCommands: readonly string[];
|
|
10
|
+
requiredOwnership: boolean;
|
|
11
|
+
requiredQualityThresholds: {
|
|
12
|
+
minDoctorOk?: number;
|
|
13
|
+
minAiReadiness?: number;
|
|
14
|
+
};
|
|
15
|
+
requiredPackSignatures: boolean;
|
|
16
|
+
requiredMcpReadOnly: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IComplianceCheckFinding {
|
|
19
|
+
profileId: string;
|
|
20
|
+
ruleId: string;
|
|
21
|
+
severity: 'info' | 'warning' | 'error';
|
|
22
|
+
message: string;
|
|
23
|
+
evidence?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IComplianceCheckReport {
|
|
26
|
+
schema: typeof COMPLIANCE_SCHEMA;
|
|
27
|
+
generatedAt: string;
|
|
28
|
+
profileId: string;
|
|
29
|
+
pass: boolean;
|
|
30
|
+
findings: readonly IComplianceCheckFinding[];
|
|
31
|
+
summary: {
|
|
32
|
+
errors: number;
|
|
33
|
+
warnings: number;
|
|
34
|
+
info: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare const BUILTIN_COMPLIANCE_PROFILES: readonly IComplianceProfile[];
|
|
38
|
+
export declare function listComplianceProfiles(): readonly IComplianceProfile[];
|
|
39
|
+
export declare function getComplianceProfile(id: string): IComplianceProfile | undefined;
|
|
40
|
+
export declare function runComplianceCheck(inspection: ISharkcraftInspection, profileId: string): Promise<IComplianceCheckReport>;
|
|
41
|
+
export declare function renderComplianceReportText(report: IComplianceCheckReport): string;
|
|
42
|
+
//# sourceMappingURL=compliance-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compliance-profiles.d.ts","sourceRoot":"","sources":["../src/compliance-profiles.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,yBAAyB,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7E,sBAAsB,EAAE,OAAO,CAAC;IAChC,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,iBAAiB,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC7C,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7D;AAED,eAAO,MAAM,2BAA2B,EAAE,SAAS,kBAAkB,EAiDnE,CAAC;AAEH,wBAAgB,sBAAsB,IAAI,SAAS,kBAAkB,EAAE,CAEtE;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAE/E;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,qBAAqB,EACjC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,sBAAsB,CAAC,CAsFjC;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAejF"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-first compliance profiles.
|
|
3
|
+
*
|
|
4
|
+
* Not legal advice, not external standards certification. Structured
|
|
5
|
+
* local checks: required policies, boundaries, docs, commands,
|
|
6
|
+
* ownership, quality thresholds, pack signatures.
|
|
7
|
+
*
|
|
8
|
+
* Built-in profiles:
|
|
9
|
+
* - ai-safe-development
|
|
10
|
+
* - signed-pack-workflow
|
|
11
|
+
* - review-gated-codegen
|
|
12
|
+
* - ci-governed-repository
|
|
13
|
+
*/
|
|
14
|
+
import { existsSync } from 'node:fs';
|
|
15
|
+
import * as nodePath from 'node:path';
|
|
16
|
+
export const COMPLIANCE_SCHEMA = 'sharkcraft.compliance/v1';
|
|
17
|
+
export const BUILTIN_COMPLIANCE_PROFILES = Object.freeze([
|
|
18
|
+
{
|
|
19
|
+
id: 'ai-safe-development',
|
|
20
|
+
title: 'AI-safe development',
|
|
21
|
+
description: 'MCP is read-only, plans are reviewed, demo is non-destructive, dashboard has no write endpoints.',
|
|
22
|
+
tags: ['safety', 'mcp', 'ai-agent'],
|
|
23
|
+
requiredDocs: ['docs/safety-model.md'],
|
|
24
|
+
requiredCommands: ['shrk safety audit', 'shrk doctor'],
|
|
25
|
+
requiredOwnership: false,
|
|
26
|
+
requiredQualityThresholds: {},
|
|
27
|
+
requiredPackSignatures: false,
|
|
28
|
+
requiredMcpReadOnly: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'signed-pack-workflow',
|
|
32
|
+
title: 'Signed pack workflow',
|
|
33
|
+
description: 'Discovered packs all carry verified HMAC signatures.',
|
|
34
|
+
tags: ['pack', 'signing'],
|
|
35
|
+
requiredDocs: ['docs/security.md'],
|
|
36
|
+
requiredCommands: ['shrk packs doctor --release --require-signatures'],
|
|
37
|
+
requiredOwnership: false,
|
|
38
|
+
requiredQualityThresholds: {},
|
|
39
|
+
requiredPackSignatures: true,
|
|
40
|
+
requiredMcpReadOnly: false,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 'review-gated-codegen',
|
|
44
|
+
title: 'Review-gated codegen',
|
|
45
|
+
description: 'Generation is dry-run by default; apply requires signature verification.',
|
|
46
|
+
tags: ['generation', 'review'],
|
|
47
|
+
requiredDocs: ['docs/plan-review.md', 'docs/safety-model.md'],
|
|
48
|
+
requiredCommands: ['shrk plan review', 'shrk apply --verify-signature'],
|
|
49
|
+
requiredOwnership: false,
|
|
50
|
+
requiredQualityThresholds: {},
|
|
51
|
+
requiredPackSignatures: false,
|
|
52
|
+
requiredMcpReadOnly: true,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'ci-governed-repository',
|
|
56
|
+
title: 'CI-governed repository',
|
|
57
|
+
description: 'CI scaffolds + release readiness + preflight gates are documented and validated.',
|
|
58
|
+
tags: ['ci', 'release', 'governance'],
|
|
59
|
+
requiredDocs: ['docs/ci-scaffold.md', 'docs/release-readiness.md'],
|
|
60
|
+
requiredCommands: ['shrk release readiness --strict', 'bun run release:preflight'],
|
|
61
|
+
requiredOwnership: false,
|
|
62
|
+
requiredQualityThresholds: {},
|
|
63
|
+
requiredPackSignatures: false,
|
|
64
|
+
requiredMcpReadOnly: false,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
export function listComplianceProfiles() {
|
|
68
|
+
return BUILTIN_COMPLIANCE_PROFILES;
|
|
69
|
+
}
|
|
70
|
+
export function getComplianceProfile(id) {
|
|
71
|
+
return BUILTIN_COMPLIANCE_PROFILES.find((p) => p.id === id);
|
|
72
|
+
}
|
|
73
|
+
export async function runComplianceCheck(inspection, profileId) {
|
|
74
|
+
const profile = getComplianceProfile(profileId);
|
|
75
|
+
if (!profile) {
|
|
76
|
+
return {
|
|
77
|
+
schema: COMPLIANCE_SCHEMA,
|
|
78
|
+
generatedAt: new Date().toISOString(),
|
|
79
|
+
profileId,
|
|
80
|
+
pass: false,
|
|
81
|
+
findings: [
|
|
82
|
+
{
|
|
83
|
+
profileId,
|
|
84
|
+
ruleId: 'unknown-profile',
|
|
85
|
+
severity: 'error',
|
|
86
|
+
message: `Compliance profile "${profileId}" not found. Use \`shrk compliance profiles\`.`,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
summary: { errors: 1, warnings: 0, info: 0 },
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const findings = [];
|
|
93
|
+
// Required docs.
|
|
94
|
+
for (const d of profile.requiredDocs) {
|
|
95
|
+
const abs = nodePath.join(inspection.projectRoot, d);
|
|
96
|
+
if (!existsSync(abs)) {
|
|
97
|
+
findings.push({
|
|
98
|
+
profileId: profile.id,
|
|
99
|
+
ruleId: `required-doc:${d}`,
|
|
100
|
+
severity: 'warning',
|
|
101
|
+
message: `Required doc missing: ${d}`,
|
|
102
|
+
evidence: abs,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// MCP read-only contract — info only; the canonical check is the
|
|
107
|
+
// separate `shrk safety audit` command, which has access to the MCP
|
|
108
|
+
// tool list. We surface a hint here so adopters know to run it.
|
|
109
|
+
if (profile.requiredMcpReadOnly) {
|
|
110
|
+
findings.push({
|
|
111
|
+
profileId: profile.id,
|
|
112
|
+
ruleId: 'mcp-no-write-hint',
|
|
113
|
+
severity: 'info',
|
|
114
|
+
message: 'Run `shrk safety audit` to confirm MCP has zero write tools (this profile requires it).',
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
// Pack signatures — only checks discovered packs.
|
|
118
|
+
if (profile.requiredPackSignatures) {
|
|
119
|
+
for (const p of inspection.packs.validPacks ?? []) {
|
|
120
|
+
const status = p.signatureStatus ?? 'not-checked';
|
|
121
|
+
if (status === 'invalid-signature' || status === 'missing-signature') {
|
|
122
|
+
findings.push({
|
|
123
|
+
profileId: profile.id,
|
|
124
|
+
ruleId: `pack-signature:${p.packageName}`,
|
|
125
|
+
severity: 'error',
|
|
126
|
+
message: `Pack ${p.packageName} signature status: ${status}.`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else if (status === 'not-checked') {
|
|
130
|
+
findings.push({
|
|
131
|
+
profileId: profile.id,
|
|
132
|
+
ruleId: `pack-signature:${p.packageName}`,
|
|
133
|
+
severity: 'warning',
|
|
134
|
+
message: `Pack ${p.packageName} signature was not verified — re-run with --require-signatures.`,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Required-commands check is a docstring check — the commands must
|
|
140
|
+
// exist in the catalog. We don't run them.
|
|
141
|
+
// (Catalog parity is exercised separately by `shrk commands doctor`.)
|
|
142
|
+
const errors = findings.filter((f) => f.severity === 'error').length;
|
|
143
|
+
const warnings = findings.filter((f) => f.severity === 'warning').length;
|
|
144
|
+
const info = findings.filter((f) => f.severity === 'info').length;
|
|
145
|
+
return {
|
|
146
|
+
schema: COMPLIANCE_SCHEMA,
|
|
147
|
+
generatedAt: new Date().toISOString(),
|
|
148
|
+
profileId,
|
|
149
|
+
pass: errors === 0,
|
|
150
|
+
findings,
|
|
151
|
+
summary: { errors, warnings, info },
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export function renderComplianceReportText(report) {
|
|
155
|
+
const lines = [];
|
|
156
|
+
lines.push(`=== Compliance: ${report.profileId} ===`);
|
|
157
|
+
lines.push(` pass ${report.pass ? 'yes' : 'no'}`);
|
|
158
|
+
lines.push(` errors ${report.summary.errors}`);
|
|
159
|
+
lines.push(` warnings ${report.summary.warnings}`);
|
|
160
|
+
if (report.findings.length === 0) {
|
|
161
|
+
lines.push('No findings.');
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
for (const f of report.findings) {
|
|
165
|
+
lines.push(` [${f.severity.padEnd(7)}] ${f.ruleId} — ${f.message}`);
|
|
166
|
+
if (f.evidence)
|
|
167
|
+
lines.push(` evidence: ${f.evidence}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return lines.join('\n') + '\n';
|
|
171
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
2
|
+
export declare const CONSTRUCT_ADOPTION_DIFF_SCHEMA = "sharkcraft.construct-adoption-diff/v1";
|
|
3
|
+
export type ConstructAdoptionDiffFormat = 'text' | 'markdown' | 'html' | 'json';
|
|
4
|
+
export declare enum ConstructDiffBlockKind {
|
|
5
|
+
NewConstruct = "new-construct",
|
|
6
|
+
NewFacet = "new-facet",
|
|
7
|
+
FieldAdded = "field-added",
|
|
8
|
+
FieldConflict = "field-conflict",
|
|
9
|
+
AlreadyCovered = "already-covered",
|
|
10
|
+
Conflict = "conflict"
|
|
11
|
+
}
|
|
12
|
+
export interface IConstructDiffLine {
|
|
13
|
+
/** `'+'` add, `'-'` remove, `' '` context, `'~'` conflict marker. */
|
|
14
|
+
marker: '+' | '-' | ' ' | '~';
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
export interface IConstructDiffBlock {
|
|
18
|
+
kind: ConstructDiffBlockKind;
|
|
19
|
+
/** Construct id this block belongs to. */
|
|
20
|
+
constructId: string;
|
|
21
|
+
/** Optional facet sub-id (when kind is NewFacet). */
|
|
22
|
+
facetKind?: string;
|
|
23
|
+
/** A short title for human readers. */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Optional notes / reasons. */
|
|
26
|
+
notes?: readonly string[];
|
|
27
|
+
/** Line-level preview. Empty when the block is purely informational. */
|
|
28
|
+
lines: readonly IConstructDiffLine[];
|
|
29
|
+
}
|
|
30
|
+
export interface IConstructAdoptionDiff {
|
|
31
|
+
schema: typeof CONSTRUCT_ADOPTION_DIFF_SCHEMA;
|
|
32
|
+
generatedAt: string;
|
|
33
|
+
projectRoot: string;
|
|
34
|
+
constructsFile: string | null;
|
|
35
|
+
/** Whether the live constructs.ts exists at the moment of generation. */
|
|
36
|
+
constructsFileExists: boolean;
|
|
37
|
+
/** Whole-file preview of the proposed constructs.ts (or unchanged when none). */
|
|
38
|
+
proposedFilePreview: string;
|
|
39
|
+
blocks: readonly IConstructDiffBlock[];
|
|
40
|
+
summary: {
|
|
41
|
+
newConstructs: number;
|
|
42
|
+
newFacets: number;
|
|
43
|
+
fieldsAdded: number;
|
|
44
|
+
fieldConflicts: number;
|
|
45
|
+
alreadyCovered: number;
|
|
46
|
+
conflicts: number;
|
|
47
|
+
};
|
|
48
|
+
warnings: readonly string[];
|
|
49
|
+
}
|
|
50
|
+
export declare function buildConstructAdoptionDiff(inspection: ISharkcraftInspection): Promise<IConstructAdoptionDiff>;
|
|
51
|
+
export declare function renderConstructAdoptionDiffText(diff: IConstructAdoptionDiff): string;
|
|
52
|
+
export declare function renderConstructAdoptionDiffMarkdown(diff: IConstructAdoptionDiff): string;
|
|
53
|
+
export declare function renderConstructAdoptionDiffHtml(diff: IConstructAdoptionDiff): string;
|
|
54
|
+
export declare function renderConstructAdoptionDiff(diff: IConstructAdoptionDiff, format: ConstructAdoptionDiffFormat): string;
|
|
55
|
+
//# sourceMappingURL=construct-adoption-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"construct-adoption-diff.d.ts","sourceRoot":"","sources":["../src/construct-adoption-diff.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,8BAA8B,0CAA0C,CAAC;AAEtF,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhF,oBAAY,sBAAsB;IAChC,YAAY,kBAAkB;IAC9B,QAAQ,cAAc;IACtB,UAAU,gBAAgB;IAC1B,aAAa,mBAAmB;IAChC,cAAc,oBAAoB;IAClC,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,wEAAwE;IACxE,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,8BAA8B,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,yEAAyE;IACzE,oBAAoB,EAAE,OAAO,CAAC;IAC9B,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACvC,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AA8KD,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAAC,sBAAsB,CAAC,CA2CjC;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAmBpF;AAED,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAuCxF;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAwCpF;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,sBAAsB,EAC5B,MAAM,EAAE,2BAA2B,GAClC,MAAM,CAKR"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
import { buildConstructAdoptionPlan, ConstructAdoptionCategory, } from "./construct-adoption.js";
|
|
4
|
+
import { listConstructs } from "./construct-registry.js";
|
|
5
|
+
export const CONSTRUCT_ADOPTION_DIFF_SCHEMA = 'sharkcraft.construct-adoption-diff/v1';
|
|
6
|
+
export var ConstructDiffBlockKind;
|
|
7
|
+
(function (ConstructDiffBlockKind) {
|
|
8
|
+
ConstructDiffBlockKind["NewConstruct"] = "new-construct";
|
|
9
|
+
ConstructDiffBlockKind["NewFacet"] = "new-facet";
|
|
10
|
+
ConstructDiffBlockKind["FieldAdded"] = "field-added";
|
|
11
|
+
ConstructDiffBlockKind["FieldConflict"] = "field-conflict";
|
|
12
|
+
ConstructDiffBlockKind["AlreadyCovered"] = "already-covered";
|
|
13
|
+
ConstructDiffBlockKind["Conflict"] = "conflict";
|
|
14
|
+
})(ConstructDiffBlockKind || (ConstructDiffBlockKind = {}));
|
|
15
|
+
function esc(s) {
|
|
16
|
+
return s
|
|
17
|
+
.replace(/&/g, '&')
|
|
18
|
+
.replace(/</g, '<')
|
|
19
|
+
.replace(/>/g, '>')
|
|
20
|
+
.replace(/"/g, '"');
|
|
21
|
+
}
|
|
22
|
+
/** Render an inferred construct entry as a TypeScript object literal — only
|
|
23
|
+
* the fields we know about, never speculative ones. */
|
|
24
|
+
function renderConstructLiteral(entry) {
|
|
25
|
+
const lines = [];
|
|
26
|
+
lines.push('{');
|
|
27
|
+
lines.push(` id: '${entry.id}',`);
|
|
28
|
+
lines.push(` type: '${entry.type}',`);
|
|
29
|
+
lines.push(` title: '${entry.title.replace(/'/g, "\\'")}',`);
|
|
30
|
+
const files = entry.inferred.files ?? [];
|
|
31
|
+
if (files.length > 0) {
|
|
32
|
+
lines.push(` files: [${files.map((f) => "'" + f + "'").join(', ')}],`);
|
|
33
|
+
}
|
|
34
|
+
const publicApi = entry.inferred.publicApi ?? [];
|
|
35
|
+
if (publicApi.length > 0) {
|
|
36
|
+
lines.push(` publicApi: [${publicApi.map((a) => "'" + a + "'").join(', ')}],`);
|
|
37
|
+
}
|
|
38
|
+
const events = entry.inferred.events ?? [];
|
|
39
|
+
if (events.length > 0) {
|
|
40
|
+
lines.push(` events: [${events.map((e) => "'" + e + "'").join(', ')}],`);
|
|
41
|
+
}
|
|
42
|
+
const tokens = entry.inferred.tokens ?? [];
|
|
43
|
+
if (tokens.length > 0) {
|
|
44
|
+
lines.push(` tokens: [${tokens.map((t) => "'" + t + "'").join(', ')}],`);
|
|
45
|
+
}
|
|
46
|
+
lines.push('},');
|
|
47
|
+
return lines;
|
|
48
|
+
}
|
|
49
|
+
function buildBlocks(plan, existingById) {
|
|
50
|
+
const blocks = [];
|
|
51
|
+
for (const entry of plan.entries) {
|
|
52
|
+
if (entry.category === ConstructAdoptionCategory.AlreadyCovered) {
|
|
53
|
+
blocks.push({
|
|
54
|
+
kind: ConstructDiffBlockKind.AlreadyCovered,
|
|
55
|
+
constructId: entry.id,
|
|
56
|
+
title: `${entry.id} is already covered`,
|
|
57
|
+
notes: entry.reasons,
|
|
58
|
+
lines: [],
|
|
59
|
+
});
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (entry.category === ConstructAdoptionCategory.Conflict) {
|
|
63
|
+
const existing = existingById.get(entry.id);
|
|
64
|
+
const lines = [];
|
|
65
|
+
if (existing) {
|
|
66
|
+
lines.push({ marker: '-', text: `existing type: ${existing.type}` });
|
|
67
|
+
}
|
|
68
|
+
lines.push({ marker: '+', text: `inferred type: ${entry.type}` });
|
|
69
|
+
lines.push({ marker: '~', text: `id collision — manual review required` });
|
|
70
|
+
blocks.push({
|
|
71
|
+
kind: ConstructDiffBlockKind.Conflict,
|
|
72
|
+
constructId: entry.id,
|
|
73
|
+
title: `${entry.id} CONFLICT`,
|
|
74
|
+
notes: entry.reasons,
|
|
75
|
+
lines,
|
|
76
|
+
});
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const existing = existingById.get(entry.id);
|
|
80
|
+
if (!existing) {
|
|
81
|
+
const literal = renderConstructLiteral(entry);
|
|
82
|
+
const lines = literal.map((l) => ({ marker: '+', text: l }));
|
|
83
|
+
blocks.push({
|
|
84
|
+
kind: ConstructDiffBlockKind.NewConstruct,
|
|
85
|
+
constructId: entry.id,
|
|
86
|
+
title: `Add construct ${entry.id} (${entry.type})`,
|
|
87
|
+
notes: entry.reasons,
|
|
88
|
+
lines,
|
|
89
|
+
});
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
// Existing construct, same type → diff additive fields field-by-field.
|
|
93
|
+
const existingFiles = new Set(existing.files ?? []);
|
|
94
|
+
const newFiles = (entry.inferred.files ?? []).filter((f) => !existingFiles.has(f));
|
|
95
|
+
if (newFiles.length > 0) {
|
|
96
|
+
blocks.push({
|
|
97
|
+
kind: ConstructDiffBlockKind.FieldAdded,
|
|
98
|
+
constructId: entry.id,
|
|
99
|
+
title: `Add files to ${entry.id}`,
|
|
100
|
+
lines: newFiles.map((f) => ({ marker: '+', text: ` '${f}',` })),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const existingApi = new Set(existing.publicApi ?? []);
|
|
104
|
+
const newApi = (entry.inferred.publicApi ?? []).filter((a) => !existingApi.has(a));
|
|
105
|
+
if (newApi.length > 0) {
|
|
106
|
+
blocks.push({
|
|
107
|
+
kind: ConstructDiffBlockKind.FieldAdded,
|
|
108
|
+
constructId: entry.id,
|
|
109
|
+
title: `Add publicApi entries to ${entry.id}`,
|
|
110
|
+
lines: newApi.map((a) => ({ marker: '+', text: ` '${a}',` })),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const existingEvents = new Set(existing.events ?? []);
|
|
114
|
+
const newEvents = (entry.inferred.events ?? []).filter((e) => !existingEvents.has(e));
|
|
115
|
+
if (newEvents.length > 0) {
|
|
116
|
+
blocks.push({
|
|
117
|
+
kind: ConstructDiffBlockKind.FieldAdded,
|
|
118
|
+
constructId: entry.id,
|
|
119
|
+
title: `Add events to ${entry.id}`,
|
|
120
|
+
lines: newEvents.map((e) => ({ marker: '+', text: ` '${e}',` })),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const existingTokens = new Set(existing.tokens ?? []);
|
|
124
|
+
const newTokens = (entry.inferred.tokens ?? []).filter((t) => !existingTokens.has(t));
|
|
125
|
+
if (newTokens.length > 0) {
|
|
126
|
+
blocks.push({
|
|
127
|
+
kind: ConstructDiffBlockKind.FieldAdded,
|
|
128
|
+
constructId: entry.id,
|
|
129
|
+
title: `Add tokens to ${entry.id}`,
|
|
130
|
+
lines: newTokens.map((t) => ({ marker: '+', text: ` '${t}',` })),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// Title conflict — flag if the inferred title differs from the live one.
|
|
134
|
+
if (existing.title && entry.title && existing.title !== entry.title) {
|
|
135
|
+
blocks.push({
|
|
136
|
+
kind: ConstructDiffBlockKind.FieldConflict,
|
|
137
|
+
constructId: entry.id,
|
|
138
|
+
title: `${entry.id} title differs`,
|
|
139
|
+
lines: [
|
|
140
|
+
{ marker: '-', text: `title: '${existing.title}'` },
|
|
141
|
+
{ marker: '+', text: `title: '${entry.title}'` },
|
|
142
|
+
{ marker: '~', text: 'manual review — pick one' },
|
|
143
|
+
],
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return blocks;
|
|
148
|
+
}
|
|
149
|
+
function renderProposedFilePreview(existingSource, plan) {
|
|
150
|
+
// Only render literals for entries that aren't already-covered/conflict so the
|
|
151
|
+
// preview matches what `--write-patch` would suggest copying in.
|
|
152
|
+
const additions = plan.entries.filter((e) => e.category !== ConstructAdoptionCategory.AlreadyCovered &&
|
|
153
|
+
e.category !== ConstructAdoptionCategory.Conflict);
|
|
154
|
+
if (additions.length === 0) {
|
|
155
|
+
return existingSource ?? '';
|
|
156
|
+
}
|
|
157
|
+
const additionBlock = additions
|
|
158
|
+
.map((e) => ' ' + renderConstructLiteral(e).join('\n '))
|
|
159
|
+
.join('\n');
|
|
160
|
+
if (!existingSource) {
|
|
161
|
+
return [
|
|
162
|
+
"import { defineConstruct } from '@shrkcrft/plugin-api';",
|
|
163
|
+
'',
|
|
164
|
+
'export default [',
|
|
165
|
+
additionBlock,
|
|
166
|
+
'];',
|
|
167
|
+
'',
|
|
168
|
+
].join('\n');
|
|
169
|
+
}
|
|
170
|
+
// Naive: append before the trailing `];` or just at the end.
|
|
171
|
+
const trimmed = existingSource.replace(/\n+$/, '');
|
|
172
|
+
return [trimmed, '// Added by `shrk constructs adopt --write-patch`:', additionBlock, ''].join('\n');
|
|
173
|
+
}
|
|
174
|
+
export async function buildConstructAdoptionDiff(inspection) {
|
|
175
|
+
const plan = await buildConstructAdoptionPlan(inspection);
|
|
176
|
+
const existing = listConstructs(inspection);
|
|
177
|
+
const existingById = new Map();
|
|
178
|
+
for (const c of existing)
|
|
179
|
+
existingById.set(c.id, c);
|
|
180
|
+
const constructsFile = inspection.sharkcraftDir
|
|
181
|
+
? nodePath.join(inspection.sharkcraftDir, 'constructs.ts')
|
|
182
|
+
: null;
|
|
183
|
+
const exists = !!constructsFile && existsSync(constructsFile);
|
|
184
|
+
let existingSource = null;
|
|
185
|
+
if (exists && constructsFile) {
|
|
186
|
+
try {
|
|
187
|
+
existingSource = readFileSync(constructsFile, 'utf8');
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
existingSource = null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const blocks = buildBlocks(plan, existingById);
|
|
194
|
+
const summary = {
|
|
195
|
+
newConstructs: blocks.filter((b) => b.kind === ConstructDiffBlockKind.NewConstruct).length,
|
|
196
|
+
newFacets: blocks.filter((b) => b.kind === ConstructDiffBlockKind.NewFacet).length,
|
|
197
|
+
fieldsAdded: blocks.filter((b) => b.kind === ConstructDiffBlockKind.FieldAdded).length,
|
|
198
|
+
fieldConflicts: blocks.filter((b) => b.kind === ConstructDiffBlockKind.FieldConflict).length,
|
|
199
|
+
alreadyCovered: blocks.filter((b) => b.kind === ConstructDiffBlockKind.AlreadyCovered).length,
|
|
200
|
+
conflicts: blocks.filter((b) => b.kind === ConstructDiffBlockKind.Conflict).length,
|
|
201
|
+
};
|
|
202
|
+
const warnings = [...plan.warnings];
|
|
203
|
+
if (!exists && constructsFile) {
|
|
204
|
+
warnings.push(`No live constructs.ts yet at ${constructsFile} — diff shows a clean creation.`);
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
schema: CONSTRUCT_ADOPTION_DIFF_SCHEMA,
|
|
208
|
+
generatedAt: new Date().toISOString(),
|
|
209
|
+
projectRoot: inspection.projectRoot,
|
|
210
|
+
constructsFile,
|
|
211
|
+
constructsFileExists: exists,
|
|
212
|
+
proposedFilePreview: renderProposedFilePreview(existingSource, plan),
|
|
213
|
+
blocks,
|
|
214
|
+
summary,
|
|
215
|
+
warnings,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
export function renderConstructAdoptionDiffText(diff) {
|
|
219
|
+
const lines = [];
|
|
220
|
+
lines.push(`Construct adoption diff — generated ${diff.generatedAt}`);
|
|
221
|
+
lines.push(`Live constructs.ts: ${diff.constructsFile ?? '(no sharkcraft dir)'}`);
|
|
222
|
+
lines.push(`Summary: +constructs=${diff.summary.newConstructs} +fields=${diff.summary.fieldsAdded} ~conflicts=${diff.summary.conflicts} covered=${diff.summary.alreadyCovered}`);
|
|
223
|
+
for (const b of diff.blocks) {
|
|
224
|
+
lines.push('');
|
|
225
|
+
lines.push(`-- ${b.title} [${b.kind}]`);
|
|
226
|
+
for (const n of b.notes ?? [])
|
|
227
|
+
lines.push(` note: ${n}`);
|
|
228
|
+
for (const ln of b.lines)
|
|
229
|
+
lines.push(`${ln.marker} ${ln.text}`);
|
|
230
|
+
}
|
|
231
|
+
if (diff.warnings.length > 0) {
|
|
232
|
+
lines.push('');
|
|
233
|
+
lines.push('Warnings:');
|
|
234
|
+
for (const w of diff.warnings)
|
|
235
|
+
lines.push(` ! ${w}`);
|
|
236
|
+
}
|
|
237
|
+
return lines.join('\n') + '\n';
|
|
238
|
+
}
|
|
239
|
+
export function renderConstructAdoptionDiffMarkdown(diff) {
|
|
240
|
+
const lines = [];
|
|
241
|
+
lines.push('# Construct adoption diff');
|
|
242
|
+
lines.push('');
|
|
243
|
+
lines.push(`Generated: ${diff.generatedAt}`);
|
|
244
|
+
lines.push(`Live constructs.ts: \`${diff.constructsFile ?? '(none)'}\``);
|
|
245
|
+
lines.push('');
|
|
246
|
+
lines.push('## Summary');
|
|
247
|
+
lines.push('');
|
|
248
|
+
lines.push(`- New constructs: ${diff.summary.newConstructs}`);
|
|
249
|
+
lines.push(`- Fields added to existing: ${diff.summary.fieldsAdded}`);
|
|
250
|
+
lines.push(`- Conflicts: ${diff.summary.conflicts}`);
|
|
251
|
+
lines.push(`- Already covered: ${diff.summary.alreadyCovered}`);
|
|
252
|
+
lines.push('');
|
|
253
|
+
for (const b of diff.blocks) {
|
|
254
|
+
lines.push(`## ${b.title} _[${b.kind}]_`);
|
|
255
|
+
lines.push('');
|
|
256
|
+
if (b.notes && b.notes.length > 0) {
|
|
257
|
+
for (const n of b.notes)
|
|
258
|
+
lines.push(`- ${n}`);
|
|
259
|
+
lines.push('');
|
|
260
|
+
}
|
|
261
|
+
if (b.lines.length > 0) {
|
|
262
|
+
lines.push('```diff');
|
|
263
|
+
for (const ln of b.lines)
|
|
264
|
+
lines.push(`${ln.marker} ${ln.text}`);
|
|
265
|
+
lines.push('```');
|
|
266
|
+
lines.push('');
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (diff.warnings.length > 0) {
|
|
270
|
+
lines.push('## Warnings');
|
|
271
|
+
lines.push('');
|
|
272
|
+
for (const w of diff.warnings)
|
|
273
|
+
lines.push(`- ${w}`);
|
|
274
|
+
lines.push('');
|
|
275
|
+
}
|
|
276
|
+
lines.push('## Next steps');
|
|
277
|
+
lines.push('');
|
|
278
|
+
lines.push('SharkCraft never modifies `constructs.ts` automatically.');
|
|
279
|
+
lines.push('Copy entries from the proposed file preview into your `sharkcraft/constructs.ts`.');
|
|
280
|
+
return lines.join('\n') + '\n';
|
|
281
|
+
}
|
|
282
|
+
export function renderConstructAdoptionDiffHtml(diff) {
|
|
283
|
+
const out = [];
|
|
284
|
+
out.push('<!doctype html><html><head><meta charset="utf-8"><title>Construct adoption diff</title>');
|
|
285
|
+
out.push('<style>');
|
|
286
|
+
out.push('body{font:14px/1.5 -apple-system,system-ui,sans-serif;max-width:920px;margin:24px auto;padding:0 16px;color:#1a1a1a;background:#fff}');
|
|
287
|
+
out.push('h1{font-size:24px;margin-bottom:8px}h2{font-size:18px;margin-top:24px;border-bottom:1px solid #e1e4e8;padding-bottom:4px}');
|
|
288
|
+
out.push('.diff{background:#f7f7f9;border:1px solid #d0d0d6;border-radius:6px;padding:8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;white-space:pre;overflow-x:auto}');
|
|
289
|
+
out.push('.add{color:#22863a;background:#eaffea;display:block}.del{color:#b31d28;background:#ffeef0;display:block}.ctx{color:#586069;display:block}.cnf{color:#b08800;background:#fff8d6;display:block}');
|
|
290
|
+
out.push('.muted{color:#586069}.tag{display:inline-block;padding:2px 6px;border-radius:4px;font-size:11px;background:#eef2f6}');
|
|
291
|
+
out.push('@media (prefers-color-scheme: dark){body{background:#0d1117;color:#c9d1d9}.diff{background:#161b22;border-color:#30363d}.add{background:#0c3a1c}.del{background:#3d1a1e}.cnf{background:#3a2f0c}.muted{color:#8b949e}.tag{background:#21262d}}');
|
|
292
|
+
out.push('</style></head><body>');
|
|
293
|
+
out.push('<h1>Construct adoption diff</h1>');
|
|
294
|
+
out.push(`<p class="muted">Generated ${esc(diff.generatedAt)} — Live <code>${esc(diff.constructsFile ?? '(none)')}</code></p>`);
|
|
295
|
+
out.push(`<p>Summary: +constructs=${diff.summary.newConstructs} · +fields=${diff.summary.fieldsAdded} · ~conflicts=${diff.summary.conflicts} · covered=${diff.summary.alreadyCovered}</p>`);
|
|
296
|
+
for (const b of diff.blocks) {
|
|
297
|
+
out.push(`<h2>${esc(b.title)} <span class="tag">${esc(b.kind)}</span></h2>`);
|
|
298
|
+
if (b.notes && b.notes.length > 0) {
|
|
299
|
+
out.push('<ul>');
|
|
300
|
+
for (const n of b.notes)
|
|
301
|
+
out.push(`<li>${esc(n)}</li>`);
|
|
302
|
+
out.push('</ul>');
|
|
303
|
+
}
|
|
304
|
+
if (b.lines.length > 0) {
|
|
305
|
+
out.push('<div class="diff">');
|
|
306
|
+
for (const ln of b.lines) {
|
|
307
|
+
const cls = ln.marker === '+' ? 'add' : ln.marker === '-' ? 'del' : ln.marker === '~' ? 'cnf' : 'ctx';
|
|
308
|
+
out.push(`<span class="${cls}">${esc(ln.marker + ' ' + ln.text)}</span>`);
|
|
309
|
+
}
|
|
310
|
+
out.push('</div>');
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (diff.warnings.length > 0) {
|
|
314
|
+
out.push('<h2>Warnings</h2><ul>');
|
|
315
|
+
for (const w of diff.warnings)
|
|
316
|
+
out.push(`<li>${esc(w)}</li>`);
|
|
317
|
+
out.push('</ul>');
|
|
318
|
+
}
|
|
319
|
+
out.push('<p class="muted">SharkCraft never modifies <code>constructs.ts</code> automatically. Copy the highlighted entries into your config when you are ready.</p>');
|
|
320
|
+
out.push('</body></html>');
|
|
321
|
+
return out.join('\n') + '\n';
|
|
322
|
+
}
|
|
323
|
+
export function renderConstructAdoptionDiff(diff, format) {
|
|
324
|
+
if (format === 'markdown')
|
|
325
|
+
return renderConstructAdoptionDiffMarkdown(diff);
|
|
326
|
+
if (format === 'html')
|
|
327
|
+
return renderConstructAdoptionDiffHtml(diff);
|
|
328
|
+
if (format === 'json')
|
|
329
|
+
return JSON.stringify(diff, null, 2) + '\n';
|
|
330
|
+
return renderConstructAdoptionDiffText(diff);
|
|
331
|
+
}
|