@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,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command discovery + did-you-mean.
|
|
3
|
+
*
|
|
4
|
+
* Provides typo-tolerant ranking over a SharkCraft command catalog. Used by
|
|
5
|
+
* `shrk commands suggest <partial>`, `shrk commands explain <cmd>`, and the
|
|
6
|
+
* "Unknown subcommand → did you mean …" path in `runCli`.
|
|
7
|
+
*
|
|
8
|
+
* Pure, deterministic, fixture-friendly.
|
|
9
|
+
*
|
|
10
|
+
* Schema: sharkcraft.command-suggestions/v1
|
|
11
|
+
*/
|
|
12
|
+
export const COMMAND_SUGGESTIONS_SCHEMA = 'sharkcraft.command-suggestions/v1';
|
|
13
|
+
function lev(a, b) {
|
|
14
|
+
const m = a.length;
|
|
15
|
+
const n = b.length;
|
|
16
|
+
if (m === 0)
|
|
17
|
+
return n;
|
|
18
|
+
if (n === 0)
|
|
19
|
+
return m;
|
|
20
|
+
const dp = new Array(n + 1);
|
|
21
|
+
for (let j = 0; j <= n; j += 1)
|
|
22
|
+
dp[j] = j;
|
|
23
|
+
for (let i = 1; i <= m; i += 1) {
|
|
24
|
+
let prev = dp[0];
|
|
25
|
+
dp[0] = i;
|
|
26
|
+
for (let j = 1; j <= n; j += 1) {
|
|
27
|
+
const tmp = dp[j];
|
|
28
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
29
|
+
dp[j] = Math.min(dp[j] + 1, dp[j - 1] + 1, prev + cost);
|
|
30
|
+
prev = tmp;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return dp[n];
|
|
34
|
+
}
|
|
35
|
+
function tokenize(s) {
|
|
36
|
+
return s
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.split(/[^a-z0-9-]+/)
|
|
39
|
+
.filter((t) => t.length > 0);
|
|
40
|
+
}
|
|
41
|
+
function unique(arr) {
|
|
42
|
+
return Array.from(new Set(arr));
|
|
43
|
+
}
|
|
44
|
+
function bestFuzzyHit(token, candidates) {
|
|
45
|
+
let bestHit;
|
|
46
|
+
let bestDistance = Infinity;
|
|
47
|
+
for (const cand of candidates) {
|
|
48
|
+
if (cand.length === 0)
|
|
49
|
+
continue;
|
|
50
|
+
// exact substring → distance 0
|
|
51
|
+
if (cand.includes(token) || token.includes(cand)) {
|
|
52
|
+
bestHit = cand;
|
|
53
|
+
bestDistance = 0;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const d = lev(token, cand);
|
|
57
|
+
if (d < bestDistance) {
|
|
58
|
+
bestDistance = d;
|
|
59
|
+
bestHit = cand;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return { hit: bestHit, distance: bestDistance };
|
|
63
|
+
}
|
|
64
|
+
function scoreCommandForQuery(command, queryTokens) {
|
|
65
|
+
let score = 0;
|
|
66
|
+
const reasons = [];
|
|
67
|
+
const cmdLower = command.command.toLowerCase();
|
|
68
|
+
const cmdTokens = unique([
|
|
69
|
+
...tokenize(command.command),
|
|
70
|
+
...command.aliases.flatMap((a) => tokenize(a)),
|
|
71
|
+
]);
|
|
72
|
+
const descTokens = tokenize(command.description);
|
|
73
|
+
for (const q of queryTokens) {
|
|
74
|
+
const qLower = q.toLowerCase();
|
|
75
|
+
// Exact substring of full command string.
|
|
76
|
+
if (cmdLower.includes(qLower)) {
|
|
77
|
+
score += 10;
|
|
78
|
+
reasons.push(`substring "${qLower}" in command`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const tokenHit = bestFuzzyHit(qLower, cmdTokens);
|
|
82
|
+
if (tokenHit.hit && tokenHit.distance <= 1) {
|
|
83
|
+
score += tokenHit.distance === 0 ? 8 : 5;
|
|
84
|
+
reasons.push(tokenHit.distance === 0
|
|
85
|
+
? `exact token "${tokenHit.hit}"`
|
|
86
|
+
: `near-match "${tokenHit.hit}" (≈"${qLower}")`);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (tokenHit.hit && tokenHit.distance <= Math.max(2, Math.floor(qLower.length * 0.4))) {
|
|
90
|
+
score += 3;
|
|
91
|
+
reasons.push(`fuzzy "${tokenHit.hit}" (~"${qLower}")`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// Description match.
|
|
95
|
+
if (descTokens.includes(qLower)) {
|
|
96
|
+
score += 2;
|
|
97
|
+
reasons.push(`description contains "${qLower}"`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const descHit = bestFuzzyHit(qLower, descTokens);
|
|
101
|
+
if (descHit.hit && descHit.distance <= 1) {
|
|
102
|
+
score += 1;
|
|
103
|
+
reasons.push(`description near-match "${descHit.hit}"`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { score, reasons };
|
|
107
|
+
}
|
|
108
|
+
export function suggestCommands(catalog, partial, options = {}) {
|
|
109
|
+
const limit = options.limit ?? 10;
|
|
110
|
+
const tokens = tokenize(partial);
|
|
111
|
+
let entries = catalog;
|
|
112
|
+
if (options.safeOnly)
|
|
113
|
+
entries = entries.filter((c) => !c.writesSource);
|
|
114
|
+
if (options.mcpSafeOnly)
|
|
115
|
+
entries = entries.filter((c) => c.mcpAvailable);
|
|
116
|
+
if (options.category)
|
|
117
|
+
entries = entries.filter((c) => c.category === options.category);
|
|
118
|
+
const scored = [];
|
|
119
|
+
for (const e of entries) {
|
|
120
|
+
const { score, reasons } = scoreCommandForQuery(e, tokens);
|
|
121
|
+
if (score <= 0)
|
|
122
|
+
continue;
|
|
123
|
+
scored.push({
|
|
124
|
+
command: e.command,
|
|
125
|
+
category: e.category,
|
|
126
|
+
description: e.description,
|
|
127
|
+
safetyLevel: e.safetyLevel,
|
|
128
|
+
score,
|
|
129
|
+
reasons,
|
|
130
|
+
writesSource: e.writesSource,
|
|
131
|
+
mcpAvailable: e.mcpAvailable,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
scored.sort((a, b) => b.score - a.score || a.command.localeCompare(b.command));
|
|
135
|
+
return {
|
|
136
|
+
schema: COMMAND_SUGGESTIONS_SCHEMA,
|
|
137
|
+
query: partial,
|
|
138
|
+
suggestions: scored.slice(0, limit),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** Suggests at most `limit` did-you-mean candidates for an unknown command path. */
|
|
142
|
+
export function suggestDidYouMean(catalog, attempted, limit = 3) {
|
|
143
|
+
const joined = attempted.join(' ').trim();
|
|
144
|
+
if (!joined)
|
|
145
|
+
return [];
|
|
146
|
+
const { suggestions } = suggestCommands(catalog, joined, { limit });
|
|
147
|
+
return suggestions;
|
|
148
|
+
}
|
|
149
|
+
export function explainCommand(catalog, query) {
|
|
150
|
+
const trimmed = query.trim();
|
|
151
|
+
const exact = catalog.find((c) => c.command === trimmed);
|
|
152
|
+
const { suggestions } = suggestCommands(catalog, trimmed, { limit: 5 });
|
|
153
|
+
return {
|
|
154
|
+
schema: 'sharkcraft.command-explain/v1',
|
|
155
|
+
query: trimmed,
|
|
156
|
+
...(exact ? { exact } : {}),
|
|
157
|
+
candidates: suggestions,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command taxonomy report.
|
|
3
|
+
*
|
|
4
|
+
* Groups CLI commands into a human-friendly hierarchy. Built from the
|
|
5
|
+
* shared command-catalog (passed in to avoid an inspector → CLI cycle).
|
|
6
|
+
*/
|
|
7
|
+
export declare const COMMAND_TAXONOMY_SCHEMA = "sharkcraft.command-taxonomy/v1";
|
|
8
|
+
export interface ICommandTaxonomyEntry {
|
|
9
|
+
command: string;
|
|
10
|
+
description: string;
|
|
11
|
+
safetyLevel: string;
|
|
12
|
+
primary: boolean;
|
|
13
|
+
docsLink?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ICommandTaxonomyGroup {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
commands: readonly ICommandTaxonomyEntry[];
|
|
20
|
+
}
|
|
21
|
+
export interface ICommandTaxonomyReport {
|
|
22
|
+
schema: typeof COMMAND_TAXONOMY_SCHEMA;
|
|
23
|
+
generatedAt: string;
|
|
24
|
+
groups: readonly ICommandTaxonomyGroup[];
|
|
25
|
+
uncategorised: readonly ICommandTaxonomyEntry[];
|
|
26
|
+
}
|
|
27
|
+
export interface IBuildCommandTaxonomyInput {
|
|
28
|
+
catalog: readonly {
|
|
29
|
+
command: string;
|
|
30
|
+
description: string;
|
|
31
|
+
category?: string;
|
|
32
|
+
safetyLevel?: string;
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
export declare function buildCommandTaxonomy(input: IBuildCommandTaxonomyInput): ICommandTaxonomyReport;
|
|
36
|
+
export declare function renderCommandTaxonomyText(report: ICommandTaxonomyReport): string;
|
|
37
|
+
export declare function renderCommandTaxonomyMarkdown(report: ICommandTaxonomyReport): string;
|
|
38
|
+
//# sourceMappingURL=command-taxonomy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-taxonomy.d.ts","sourceRoot":"","sources":["../src/command-taxonomy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AAExE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,qBAAqB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,uBAAuB,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACzC,aAAa,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACjD;AAkFD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,SAAS;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,0BAA0B,GAAG,sBAAsB,CAsC9F;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAgBhF;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAgBpF"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command taxonomy report.
|
|
3
|
+
*
|
|
4
|
+
* Groups CLI commands into a human-friendly hierarchy. Built from the
|
|
5
|
+
* shared command-catalog (passed in to avoid an inspector → CLI cycle).
|
|
6
|
+
*/
|
|
7
|
+
export const COMMAND_TAXONOMY_SCHEMA = 'sharkcraft.command-taxonomy/v1';
|
|
8
|
+
const GROUP_DEFS = [
|
|
9
|
+
{
|
|
10
|
+
id: 'start-here',
|
|
11
|
+
title: 'Start here',
|
|
12
|
+
description: 'First-time orientation.',
|
|
13
|
+
match: /^(start-here|doctor|commands(\s|$)|commands primary|map|version)/,
|
|
14
|
+
primary: ['start-here', 'doctor', 'commands primary', 'map'],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'daily-development',
|
|
18
|
+
title: 'Daily development',
|
|
19
|
+
description: 'The agentic write flow.',
|
|
20
|
+
match: /^(brief|dev start|dev report|dev open|gen|apply|plan(\s|$)|plan review)/,
|
|
21
|
+
primary: ['brief', 'dev start', 'gen', 'plan review', 'apply'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'ai-agent-context',
|
|
25
|
+
title: 'AI agent context',
|
|
26
|
+
description: 'Brief / handoff / orchestrate / simulate / intent / recommend.',
|
|
27
|
+
match: /^(brief|handoff|orchestrate|simulate|intent|recommend|context|task)/,
|
|
28
|
+
primary: ['brief', 'handoff', 'orchestrate', 'simulate'],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'review-impact',
|
|
32
|
+
title: 'Review and impact',
|
|
33
|
+
description: 'Review packets, impact graphs, tests impact.',
|
|
34
|
+
match: /^(review|impact|tests (impact|missing|suggest)|owners |ownership )/,
|
|
35
|
+
primary: ['review packet', 'impact', 'tests impact'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'architecture',
|
|
39
|
+
title: 'Architecture intelligence',
|
|
40
|
+
description: 'Architecture map / intelligence graph / boundaries / drift / coverage.',
|
|
41
|
+
match: /^(architecture|intelligence|check boundaries|drift|coverage|boundaries|graph|constructs)/,
|
|
42
|
+
primary: ['architecture map', 'intelligence graph', 'check boundaries'],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'governance-compliance',
|
|
46
|
+
title: 'Governance and compliance',
|
|
47
|
+
description: 'Safety audit, compliance, policy, decisions.',
|
|
48
|
+
match: /^(safety|compliance|policy|decisions)/,
|
|
49
|
+
primary: ['safety audit', 'compliance check', 'policy run', 'decisions list'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'packs',
|
|
53
|
+
title: 'Packs and ecosystem',
|
|
54
|
+
description: 'Pack discovery, doctor, release-check, quality, compat.',
|
|
55
|
+
match: /^(packs)/,
|
|
56
|
+
primary: ['packs doctor', 'packs release-check', 'packs quality'],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'ci-reports',
|
|
60
|
+
title: 'CI and reports',
|
|
61
|
+
description: 'CI scaffold, report site, dashboard export, demo workflows.',
|
|
62
|
+
match: /^(ci|report|dashboard|demo)/,
|
|
63
|
+
primary: ['report site', 'ci scaffold github-actions', 'demo workflow pr-review'],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'release-readiness',
|
|
67
|
+
title: 'Release readiness',
|
|
68
|
+
description: 'release readiness / smoke / install smoke / train / runtime doctor.',
|
|
69
|
+
match: /^(release|install|runtime|train|version)/,
|
|
70
|
+
primary: ['release readiness', 'release smoke', 'install smoke'],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 'diagnostics',
|
|
74
|
+
title: 'Diagnostics and troubleshooting',
|
|
75
|
+
description: 'self audit, diagnostics, upgrade.',
|
|
76
|
+
match: /^(self audit|diagnostics|upgrade|api)/,
|
|
77
|
+
primary: ['self audit', 'diagnostics suggest', 'upgrade check'],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'advanced',
|
|
81
|
+
title: 'Advanced / internal',
|
|
82
|
+
description: 'Schemas, exports, imports, ask.',
|
|
83
|
+
match: /^(ask|export|import|schemas|infer|init|presets|scaffolds|pipelines|playbooks|knowledge|rules|paths|templates|git |session|inspect|find|next|explain|reposet|view|quality |watch|search|owners)/,
|
|
84
|
+
primary: [],
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
export function buildCommandTaxonomy(input) {
|
|
88
|
+
const groups = GROUP_DEFS.map((g) => ({
|
|
89
|
+
id: g.id,
|
|
90
|
+
title: g.title,
|
|
91
|
+
description: g.description,
|
|
92
|
+
commands: [],
|
|
93
|
+
}));
|
|
94
|
+
const groupedCommands = groups.map((g) => g.commands);
|
|
95
|
+
const uncategorised = [];
|
|
96
|
+
for (const e of input.catalog) {
|
|
97
|
+
const entry = {
|
|
98
|
+
command: e.command,
|
|
99
|
+
description: e.description,
|
|
100
|
+
safetyLevel: e.safetyLevel ?? 'read-only',
|
|
101
|
+
primary: false,
|
|
102
|
+
};
|
|
103
|
+
let placed = false;
|
|
104
|
+
for (let i = 0; i < GROUP_DEFS.length; i++) {
|
|
105
|
+
const g = GROUP_DEFS[i];
|
|
106
|
+
const target = groupedCommands[i];
|
|
107
|
+
if (!target)
|
|
108
|
+
continue;
|
|
109
|
+
if (g.match.test(e.command)) {
|
|
110
|
+
entry.primary = g.primary.some((p) => e.command === p || e.command.startsWith(p));
|
|
111
|
+
target.push(entry);
|
|
112
|
+
placed = true;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (!placed)
|
|
117
|
+
uncategorised.push(entry);
|
|
118
|
+
}
|
|
119
|
+
for (const arr of groupedCommands)
|
|
120
|
+
arr.sort((a, b) => a.command.localeCompare(b.command));
|
|
121
|
+
return {
|
|
122
|
+
schema: COMMAND_TAXONOMY_SCHEMA,
|
|
123
|
+
generatedAt: new Date().toISOString(),
|
|
124
|
+
groups,
|
|
125
|
+
uncategorised,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
export function renderCommandTaxonomyText(report) {
|
|
129
|
+
const lines = [];
|
|
130
|
+
lines.push('=== Command taxonomy ===');
|
|
131
|
+
for (const g of report.groups) {
|
|
132
|
+
lines.push(`\n## ${g.title} (${g.commands.length})`);
|
|
133
|
+
if (g.description)
|
|
134
|
+
lines.push(` ${g.description}`);
|
|
135
|
+
for (const c of g.commands) {
|
|
136
|
+
const star = c.primary ? '★ ' : ' ';
|
|
137
|
+
lines.push(` ${star}shrk ${c.command.padEnd(36)} [${c.safetyLevel}]`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (report.uncategorised.length > 0) {
|
|
141
|
+
lines.push(`\n## Uncategorised (${report.uncategorised.length})`);
|
|
142
|
+
for (const c of report.uncategorised)
|
|
143
|
+
lines.push(` shrk ${c.command}`);
|
|
144
|
+
}
|
|
145
|
+
return lines.join('\n') + '\n';
|
|
146
|
+
}
|
|
147
|
+
export function renderCommandTaxonomyMarkdown(report) {
|
|
148
|
+
const lines = [];
|
|
149
|
+
lines.push('# SharkCraft command taxonomy');
|
|
150
|
+
lines.push('');
|
|
151
|
+
for (const g of report.groups) {
|
|
152
|
+
lines.push(`## ${g.title}`);
|
|
153
|
+
lines.push('');
|
|
154
|
+
if (g.description)
|
|
155
|
+
lines.push(`_${g.description}_`);
|
|
156
|
+
lines.push('');
|
|
157
|
+
for (const c of g.commands) {
|
|
158
|
+
const star = c.primary ? '**★** ' : '';
|
|
159
|
+
lines.push(`- ${star}\`shrk ${c.command}\` — ${c.description} _(${c.safetyLevel})_`);
|
|
160
|
+
}
|
|
161
|
+
lines.push('');
|
|
162
|
+
}
|
|
163
|
+
return lines.join('\n');
|
|
164
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type IComplianceCheckReport } from './compliance-profiles.js';
|
|
2
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
3
|
+
export declare const COMPLIANCE_EVIDENCE_SCHEMA = "sharkcraft.compliance-evidence/v1";
|
|
4
|
+
export interface IComplianceEvidenceManifestEntry {
|
|
5
|
+
kind: string;
|
|
6
|
+
file: string;
|
|
7
|
+
bytes: number;
|
|
8
|
+
sha256: string;
|
|
9
|
+
source?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IComplianceEvidenceManifest {
|
|
12
|
+
schema: typeof COMPLIANCE_EVIDENCE_SCHEMA;
|
|
13
|
+
generatedAt: string;
|
|
14
|
+
profileId: string;
|
|
15
|
+
sharkcraftVersion: string;
|
|
16
|
+
gitCommit?: string;
|
|
17
|
+
entries: readonly IComplianceEvidenceManifestEntry[];
|
|
18
|
+
signature?: {
|
|
19
|
+
algorithm: 'hmac-sha256';
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface IComplianceEvidencePacket {
|
|
24
|
+
schema: typeof COMPLIANCE_EVIDENCE_SCHEMA;
|
|
25
|
+
generatedAt: string;
|
|
26
|
+
profileId: string;
|
|
27
|
+
outputDir: string;
|
|
28
|
+
manifest: readonly IComplianceEvidenceManifestEntry[];
|
|
29
|
+
report: IComplianceCheckReport;
|
|
30
|
+
zipFile?: string;
|
|
31
|
+
signed: boolean;
|
|
32
|
+
warnings: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
export interface IBuildComplianceEvidenceOptions {
|
|
35
|
+
zip?: boolean;
|
|
36
|
+
sign?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare function buildComplianceEvidencePacket(inspection: ISharkcraftInspection, profileId: string, outputDir: string, options?: IBuildComplianceEvidenceOptions): Promise<IComplianceEvidencePacket>;
|
|
39
|
+
export declare function previewComplianceEvidencePacket(profileId: string): {
|
|
40
|
+
plannedFiles: readonly string[];
|
|
41
|
+
nextCommand: string;
|
|
42
|
+
};
|
|
43
|
+
export interface IComplianceEvidenceVerification {
|
|
44
|
+
manifestPath: string;
|
|
45
|
+
ok: boolean;
|
|
46
|
+
errors: readonly string[];
|
|
47
|
+
warnings: readonly string[];
|
|
48
|
+
fileResults: readonly {
|
|
49
|
+
file: string;
|
|
50
|
+
expectedSha256: string;
|
|
51
|
+
actualSha256: string;
|
|
52
|
+
ok: boolean;
|
|
53
|
+
}[];
|
|
54
|
+
signatureChecked: boolean;
|
|
55
|
+
signatureOk?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare function verifyComplianceEvidencePacket(targetPathOrDir: string): IComplianceEvidenceVerification;
|
|
58
|
+
//# sourceMappingURL=compliance-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compliance-evidence.d.ts","sourceRoot":"","sources":["../src/compliance-evidence.ts"],"names":[],"mappings":"AAqBA,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,eAAO,MAAM,0BAA0B,sCAAsC,CAAC;AAE9E,MAAM,WAAW,gCAAgC;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,OAAO,0BAA0B,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,SAAS,gCAAgC,EAAE,CAAC;IACrD,SAAS,CAAC,EAAE;QAAE,SAAS,EAAE,aAAa,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,OAAO,0BAA0B,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,gCAAgC,EAAE,CAAC;IACtD,MAAM,EAAE,sBAAsB,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,+BAA+B;IAC9C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AA+CD,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,qBAAqB,EACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,+BAAoC,GAC5C,OAAO,CAAC,yBAAyB,CAAC,CA0GpC;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,GAChB;IAAE,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAe1D;AAED,MAAM,WAAW,+BAA+B;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,SAAS;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,EAAE,EAAE,OAAO,CAAC;KACb,EAAE,CAAC;IACJ,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,8BAA8B,CAC5C,eAAe,EAAE,MAAM,GACtB,+BAA+B,CA8EjC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compliance evidence packets.
|
|
3
|
+
*
|
|
4
|
+
* Produces a directory of read-only evidence for a compliance profile:
|
|
5
|
+
* the compliance report, plus copies of available local artefacts
|
|
6
|
+
* (safety audit, release readiness, packs doctor JSON when present),
|
|
7
|
+
* a docs-presence list, and a manifest.
|
|
8
|
+
*
|
|
9
|
+
* Manifest includes per-file SHA-256 + git commit hash + SharkCraft
|
|
10
|
+
* version. `--sign` adds an HMAC-SHA256 signature over the manifest
|
|
11
|
+
* (secret from `SHARKCRAFT_EVIDENCE_SECRET`). `--verify` recomputes
|
|
12
|
+
* file hashes and (when present) the manifest signature. `--zip`
|
|
13
|
+
* produces a single archive when `tar` is available locally; when
|
|
14
|
+
* unavailable, the directory output is returned with a clear warning.
|
|
15
|
+
*
|
|
16
|
+
* No external network. No certification claims.
|
|
17
|
+
*/
|
|
18
|
+
import { spawnSync } from 'node:child_process';
|
|
19
|
+
import { createHash, createHmac, timingSafeEqual } from 'node:crypto';
|
|
20
|
+
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
21
|
+
import * as nodePath from 'node:path';
|
|
22
|
+
import { runComplianceCheck, } from "./compliance-profiles.js";
|
|
23
|
+
import { getGitRoot } from "./git-helpers.js";
|
|
24
|
+
export const COMPLIANCE_EVIDENCE_SCHEMA = 'sharkcraft.compliance-evidence/v1';
|
|
25
|
+
function sha256(buffer) {
|
|
26
|
+
return createHash('sha256').update(buffer).digest('hex');
|
|
27
|
+
}
|
|
28
|
+
function readSharkcraftVersion(inspection) {
|
|
29
|
+
try {
|
|
30
|
+
const pkgPath = nodePath.join(inspection.projectRoot, 'package.json');
|
|
31
|
+
if (!existsSync(pkgPath))
|
|
32
|
+
return 'unknown';
|
|
33
|
+
const parsed = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
34
|
+
return parsed.version ?? 'unknown';
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return 'unknown';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function readGitCommit(projectRoot) {
|
|
41
|
+
const root = getGitRoot(projectRoot);
|
|
42
|
+
if (!root)
|
|
43
|
+
return undefined;
|
|
44
|
+
const res = spawnSync('git', ['rev-parse', 'HEAD'], { cwd: projectRoot, encoding: 'utf8' });
|
|
45
|
+
if (res.status !== 0)
|
|
46
|
+
return undefined;
|
|
47
|
+
const out = (res.stdout ?? '').trim();
|
|
48
|
+
return out.length > 0 ? out : undefined;
|
|
49
|
+
}
|
|
50
|
+
function copyIfExists(inspection, outDir, rel, kindLabel, entries) {
|
|
51
|
+
const abs = nodePath.join(inspection.projectRoot, rel);
|
|
52
|
+
if (!existsSync(abs))
|
|
53
|
+
return;
|
|
54
|
+
const target = nodePath.join(outDir, nodePath.basename(rel));
|
|
55
|
+
const body = readFileSync(abs);
|
|
56
|
+
writeFileSync(target, body);
|
|
57
|
+
entries.push({
|
|
58
|
+
kind: kindLabel,
|
|
59
|
+
file: target,
|
|
60
|
+
bytes: body.byteLength,
|
|
61
|
+
sha256: sha256(body),
|
|
62
|
+
source: rel,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export async function buildComplianceEvidencePacket(inspection, profileId, outputDir, options = {}) {
|
|
66
|
+
const dir = nodePath.isAbsolute(outputDir)
|
|
67
|
+
? outputDir
|
|
68
|
+
: nodePath.resolve(inspection.projectRoot, outputDir);
|
|
69
|
+
mkdirSync(dir, { recursive: true });
|
|
70
|
+
const report = await runComplianceCheck(inspection, profileId);
|
|
71
|
+
const entries = [];
|
|
72
|
+
const warnings = [];
|
|
73
|
+
// 1. Compliance report
|
|
74
|
+
const reportFile = nodePath.join(dir, 'compliance-report.json');
|
|
75
|
+
const reportBody = JSON.stringify(report, null, 2);
|
|
76
|
+
writeFileSync(reportFile, reportBody, 'utf8');
|
|
77
|
+
const reportBuf = Buffer.from(reportBody, 'utf8');
|
|
78
|
+
entries.push({
|
|
79
|
+
kind: 'compliance-report',
|
|
80
|
+
file: reportFile,
|
|
81
|
+
bytes: reportBuf.byteLength,
|
|
82
|
+
sha256: sha256(reportBuf),
|
|
83
|
+
});
|
|
84
|
+
// 2. Fold local artefacts
|
|
85
|
+
copyIfExists(inspection, dir, '.sharkcraft/reports/safety-audit.json', 'safety-audit', entries);
|
|
86
|
+
copyIfExists(inspection, dir, '.sharkcraft/reports/release-readiness.json', 'release-readiness', entries);
|
|
87
|
+
copyIfExists(inspection, dir, '.sharkcraft/reports/packs-doctor.json', 'packs-doctor', entries);
|
|
88
|
+
copyIfExists(inspection, dir, '.sharkcraft/reports/quality.json', 'quality', entries);
|
|
89
|
+
copyIfExists(inspection, dir, '.sharkcraft/reports/release-smoke.json', 'release-smoke', entries);
|
|
90
|
+
copyIfExists(inspection, dir, '.sharkcraft/reports/self-audit.json', 'self-audit', entries);
|
|
91
|
+
// 3. Docs evidence
|
|
92
|
+
const docsList = [
|
|
93
|
+
'docs/safety-model.md',
|
|
94
|
+
'docs/security.md',
|
|
95
|
+
'docs/plan-review.md',
|
|
96
|
+
'docs/ci-scaffold.md',
|
|
97
|
+
'docs/release-readiness.md',
|
|
98
|
+
].filter((d) => existsSync(nodePath.join(inspection.projectRoot, d)));
|
|
99
|
+
const docsFile = nodePath.join(dir, 'docs-evidence.json');
|
|
100
|
+
const docsBody = JSON.stringify({ docs: docsList }, null, 2);
|
|
101
|
+
writeFileSync(docsFile, docsBody, 'utf8');
|
|
102
|
+
const docsBuf = Buffer.from(docsBody, 'utf8');
|
|
103
|
+
entries.push({
|
|
104
|
+
kind: 'docs-evidence',
|
|
105
|
+
file: docsFile,
|
|
106
|
+
bytes: docsBuf.byteLength,
|
|
107
|
+
sha256: sha256(docsBuf),
|
|
108
|
+
});
|
|
109
|
+
// 4. Manifest
|
|
110
|
+
const gitCommit = readGitCommit(inspection.projectRoot);
|
|
111
|
+
const sharkcraftVersion = readSharkcraftVersion(inspection);
|
|
112
|
+
const manifest = {
|
|
113
|
+
schema: COMPLIANCE_EVIDENCE_SCHEMA,
|
|
114
|
+
generatedAt: new Date().toISOString(),
|
|
115
|
+
profileId,
|
|
116
|
+
sharkcraftVersion,
|
|
117
|
+
...(gitCommit ? { gitCommit } : {}),
|
|
118
|
+
entries,
|
|
119
|
+
};
|
|
120
|
+
// 5. Sign (optional)
|
|
121
|
+
let signed = false;
|
|
122
|
+
if (options.sign === true) {
|
|
123
|
+
const secret = process.env['SHARKCRAFT_EVIDENCE_SECRET'];
|
|
124
|
+
if (!secret) {
|
|
125
|
+
warnings.push('Sign requested but `SHARKCRAFT_EVIDENCE_SECRET` is not set — manifest written without signature.');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const payload = JSON.stringify({ ...manifest, signature: undefined });
|
|
129
|
+
const hmac = createHmac('sha256', secret).update(payload).digest('hex');
|
|
130
|
+
manifest.signature = { algorithm: 'hmac-sha256', value: hmac };
|
|
131
|
+
signed = true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const manifestFile = nodePath.join(dir, 'manifest.json');
|
|
135
|
+
writeFileSync(manifestFile, JSON.stringify(manifest, null, 2), 'utf8');
|
|
136
|
+
// 6. Zip (optional, best-effort via `tar`)
|
|
137
|
+
let zipFile;
|
|
138
|
+
if (options.zip === true) {
|
|
139
|
+
const archiveName = `evidence-${profileId}.tar.gz`;
|
|
140
|
+
const archivePath = nodePath.resolve(nodePath.dirname(dir), archiveName);
|
|
141
|
+
const res = spawnSync('tar', ['czf', archivePath, '-C', nodePath.dirname(dir), nodePath.basename(dir)], {
|
|
142
|
+
encoding: 'utf8',
|
|
143
|
+
});
|
|
144
|
+
if (res.status === 0) {
|
|
145
|
+
zipFile = archivePath;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
warnings.push(`Archive creation failed (tar exit ${res.status ?? 'unknown'}): ${(res.stderr ?? '').trim() || 'binary not available'}.`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
schema: COMPLIANCE_EVIDENCE_SCHEMA,
|
|
153
|
+
generatedAt: manifest.generatedAt,
|
|
154
|
+
profileId,
|
|
155
|
+
outputDir: dir,
|
|
156
|
+
manifest: entries,
|
|
157
|
+
report,
|
|
158
|
+
...(zipFile ? { zipFile } : {}),
|
|
159
|
+
signed,
|
|
160
|
+
warnings,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
export function previewComplianceEvidencePacket(profileId) {
|
|
164
|
+
return {
|
|
165
|
+
plannedFiles: [
|
|
166
|
+
'compliance-report.json',
|
|
167
|
+
'docs-evidence.json',
|
|
168
|
+
'manifest.json',
|
|
169
|
+
'(if present) safety-audit.json',
|
|
170
|
+
'(if present) release-readiness.json',
|
|
171
|
+
'(if present) packs-doctor.json',
|
|
172
|
+
'(if present) quality.json',
|
|
173
|
+
'(if present) release-smoke.json',
|
|
174
|
+
'(if present) self-audit.json',
|
|
175
|
+
],
|
|
176
|
+
nextCommand: `shrk compliance evidence ${profileId} --output .sharkcraft/compliance-evidence/${profileId}`,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export function verifyComplianceEvidencePacket(targetPathOrDir) {
|
|
180
|
+
const stat = statSync(targetPathOrDir);
|
|
181
|
+
let manifestPath;
|
|
182
|
+
if (stat.isDirectory()) {
|
|
183
|
+
manifestPath = nodePath.join(targetPathOrDir, 'manifest.json');
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
manifestPath = targetPathOrDir;
|
|
187
|
+
}
|
|
188
|
+
const errors = [];
|
|
189
|
+
const warnings = [];
|
|
190
|
+
if (!existsSync(manifestPath)) {
|
|
191
|
+
return {
|
|
192
|
+
manifestPath,
|
|
193
|
+
ok: false,
|
|
194
|
+
errors: [`Manifest not found at ${manifestPath}`],
|
|
195
|
+
warnings,
|
|
196
|
+
fileResults: [],
|
|
197
|
+
signatureChecked: false,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
let manifest;
|
|
201
|
+
try {
|
|
202
|
+
manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
203
|
+
}
|
|
204
|
+
catch (e) {
|
|
205
|
+
return {
|
|
206
|
+
manifestPath,
|
|
207
|
+
ok: false,
|
|
208
|
+
errors: [`Manifest JSON parse failed: ${e.message}`],
|
|
209
|
+
warnings,
|
|
210
|
+
fileResults: [],
|
|
211
|
+
signatureChecked: false,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const dir = nodePath.dirname(manifestPath);
|
|
215
|
+
const fileResults = [];
|
|
216
|
+
for (const entry of manifest.entries) {
|
|
217
|
+
const filePath = nodePath.isAbsolute(entry.file)
|
|
218
|
+
? entry.file
|
|
219
|
+
: nodePath.join(dir, nodePath.basename(entry.file));
|
|
220
|
+
if (!existsSync(filePath)) {
|
|
221
|
+
errors.push(`Listed file not found: ${entry.file}`);
|
|
222
|
+
fileResults.push({ file: entry.file, expectedSha256: entry.sha256, actualSha256: '', ok: false });
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
const actual = sha256(readFileSync(filePath));
|
|
226
|
+
const ok = actual === entry.sha256;
|
|
227
|
+
if (!ok)
|
|
228
|
+
errors.push(`SHA256 mismatch for ${entry.file}`);
|
|
229
|
+
fileResults.push({ file: entry.file, expectedSha256: entry.sha256, actualSha256: actual, ok });
|
|
230
|
+
}
|
|
231
|
+
let signatureChecked = false;
|
|
232
|
+
let signatureOk;
|
|
233
|
+
if (manifest.signature) {
|
|
234
|
+
signatureChecked = true;
|
|
235
|
+
const secret = process.env['SHARKCRAFT_EVIDENCE_SECRET'];
|
|
236
|
+
if (!secret) {
|
|
237
|
+
warnings.push('Signature present but `SHARKCRAFT_EVIDENCE_SECRET` not set — cannot verify.');
|
|
238
|
+
signatureOk = false;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
const { signature, ...rest } = manifest;
|
|
242
|
+
const payload = JSON.stringify({ ...rest, signature: undefined });
|
|
243
|
+
const expected = createHmac('sha256', secret).update(payload).digest('hex');
|
|
244
|
+
const a = Buffer.from(expected, 'hex');
|
|
245
|
+
const b = Buffer.from(signature.value, 'hex');
|
|
246
|
+
signatureOk = a.length === b.length && timingSafeEqual(a, b);
|
|
247
|
+
if (!signatureOk)
|
|
248
|
+
errors.push('Manifest signature does not match.');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
manifestPath,
|
|
253
|
+
ok: errors.length === 0,
|
|
254
|
+
errors,
|
|
255
|
+
warnings,
|
|
256
|
+
fileResults,
|
|
257
|
+
signatureChecked,
|
|
258
|
+
...(signatureOk !== undefined ? { signatureOk } : {}),
|
|
259
|
+
};
|
|
260
|
+
}
|