@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,586 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge authoring preview.
|
|
3
|
+
*
|
|
4
|
+
* Pure, deterministic builders that take a structured authoring request
|
|
5
|
+
* (add / update / remove) and return a draft + patch preview. Preview-only:
|
|
6
|
+
* this module never writes — the CLI adapter materialises the preview under
|
|
7
|
+
* `.sharkcraft/authoring/` (drafts) or `.sharkcraft/fixes/` (lint output).
|
|
8
|
+
*
|
|
9
|
+
* Hard rules:
|
|
10
|
+
* - No mutation of `sharkcraft/knowledge.ts` or any pack `assets/knowledge.ts`.
|
|
11
|
+
* - Generated content references real, deterministic IKnowledgeEntry fields.
|
|
12
|
+
* - Add refuses to overwrite an existing id unless told to.
|
|
13
|
+
* - Update preserves all unspecified fields verbatim.
|
|
14
|
+
* - Remove always reports reverse references and refuses by default if any
|
|
15
|
+
* remain.
|
|
16
|
+
*/
|
|
17
|
+
export const KNOWLEDGE_AUTHORING_SCHEMA = 'sharkcraft.knowledge-authoring/v1';
|
|
18
|
+
export var KnowledgeAuthoringOperation;
|
|
19
|
+
(function (KnowledgeAuthoringOperation) {
|
|
20
|
+
KnowledgeAuthoringOperation["Add"] = "add";
|
|
21
|
+
KnowledgeAuthoringOperation["Update"] = "update";
|
|
22
|
+
KnowledgeAuthoringOperation["Remove"] = "remove";
|
|
23
|
+
})(KnowledgeAuthoringOperation || (KnowledgeAuthoringOperation = {}));
|
|
24
|
+
const ID_RE = /^[a-z0-9]+([.\-][a-z0-9]+)*$/;
|
|
25
|
+
function nowIso() {
|
|
26
|
+
return new Date().toISOString();
|
|
27
|
+
}
|
|
28
|
+
function clone(v) {
|
|
29
|
+
return JSON.parse(JSON.stringify(v));
|
|
30
|
+
}
|
|
31
|
+
function idToConst(id) {
|
|
32
|
+
return id
|
|
33
|
+
.split(/[.\-]/)
|
|
34
|
+
.map((p, i) => (i === 0 ? p : p.charAt(0).toUpperCase() + p.slice(1)))
|
|
35
|
+
.join('');
|
|
36
|
+
}
|
|
37
|
+
function fileSafeId(id) {
|
|
38
|
+
return id.replace(/[^a-zA-Z0-9]+/g, '-');
|
|
39
|
+
}
|
|
40
|
+
function tsScalar(v) {
|
|
41
|
+
return JSON.stringify(v ?? null);
|
|
42
|
+
}
|
|
43
|
+
function tsArray(items, indent) {
|
|
44
|
+
if (items.length === 0)
|
|
45
|
+
return '[]';
|
|
46
|
+
return ('[\n' +
|
|
47
|
+
items.map((it) => `${indent} ${JSON.stringify(it)},`).join('\n') +
|
|
48
|
+
`\n${indent}]`);
|
|
49
|
+
}
|
|
50
|
+
function tsObject(value, indent) {
|
|
51
|
+
// We keep this conservative — the goal is a TS-pasteable literal, not a
|
|
52
|
+
// full TS pretty-printer. JSON-compatible values only.
|
|
53
|
+
return (JSON.stringify(value, null, 2)
|
|
54
|
+
.split('\n')
|
|
55
|
+
.map((line, idx) => (idx === 0 ? line : indent + line))
|
|
56
|
+
.join('\n'));
|
|
57
|
+
}
|
|
58
|
+
function findReverseReferences(entries, targetId) {
|
|
59
|
+
const out = [];
|
|
60
|
+
for (const e of entries) {
|
|
61
|
+
if (e.id === targetId)
|
|
62
|
+
continue;
|
|
63
|
+
for (const r of e.related ?? []) {
|
|
64
|
+
if (r === targetId) {
|
|
65
|
+
out.push({ fromEntryId: e.id, field: 'related' });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
for (const ref of e.references ?? []) {
|
|
69
|
+
if (ref.id === targetId) {
|
|
70
|
+
out.push({ fromEntryId: e.id, field: 'reference.id', note: ref.note });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
for (const a of e.anchors ?? []) {
|
|
74
|
+
if (a.targetId === targetId) {
|
|
75
|
+
out.push({ fromEntryId: e.id, field: 'anchor.targetId', note: a.description });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
function buildEntryFromAdd(input) {
|
|
82
|
+
return {
|
|
83
|
+
id: input.id,
|
|
84
|
+
title: input.title ?? input.id,
|
|
85
|
+
type: input.type ?? 'documentation',
|
|
86
|
+
priority: input.priority ?? 'medium',
|
|
87
|
+
scope: input.scope ? [...input.scope] : [],
|
|
88
|
+
tags: input.tags ? [...input.tags] : [],
|
|
89
|
+
appliesWhen: input.appliesWhen ? [...input.appliesWhen] : [],
|
|
90
|
+
content: input.content ?? `TODO: describe ${input.id}.`,
|
|
91
|
+
...(input.summary ? { summary: input.summary } : {}),
|
|
92
|
+
...(input.related ? { related: [...input.related] } : {}),
|
|
93
|
+
...(input.references ? { references: input.references.map(clone) } : {}),
|
|
94
|
+
...(input.anchors ? { anchors: input.anchors.map(clone) } : {}),
|
|
95
|
+
...(input.actionHints ? { actionHints: clone(input.actionHints) } : {}),
|
|
96
|
+
...(input.reason
|
|
97
|
+
? { metadata: { authoring: { reason: input.reason, generatedAt: nowIso() } } }
|
|
98
|
+
: {}),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function applyUpdateOps(current, ops, changes) {
|
|
102
|
+
const next = clone(current);
|
|
103
|
+
if (ops.setSummary !== undefined) {
|
|
104
|
+
changes.push({ op: 'replace', field: 'summary', before: current.summary, after: ops.setSummary });
|
|
105
|
+
next.summary = ops.setSummary;
|
|
106
|
+
}
|
|
107
|
+
if (ops.setContent !== undefined) {
|
|
108
|
+
changes.push({ op: 'replace', field: 'content', before: current.content, after: ops.setContent });
|
|
109
|
+
next.content = ops.setContent;
|
|
110
|
+
}
|
|
111
|
+
if (ops.setPriority !== undefined) {
|
|
112
|
+
changes.push({ op: 'replace', field: 'priority', before: current.priority, after: ops.setPriority });
|
|
113
|
+
next.priority = ops.setPriority;
|
|
114
|
+
}
|
|
115
|
+
if (ops.addRelated && ops.addRelated.length > 0) {
|
|
116
|
+
const existing = new Set(next.related ?? []);
|
|
117
|
+
const added = [];
|
|
118
|
+
for (const r of ops.addRelated) {
|
|
119
|
+
if (!existing.has(r)) {
|
|
120
|
+
existing.add(r);
|
|
121
|
+
added.push(r);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
next.related = [...existing];
|
|
125
|
+
if (added.length > 0) {
|
|
126
|
+
changes.push({ op: 'add', field: 'related', after: added });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (ops.removeRelated && ops.removeRelated.length > 0) {
|
|
130
|
+
const keep = (next.related ?? []).filter((r) => !ops.removeRelated.includes(r));
|
|
131
|
+
const removed = (next.related ?? []).filter((r) => ops.removeRelated.includes(r));
|
|
132
|
+
next.related = keep;
|
|
133
|
+
if (removed.length > 0) {
|
|
134
|
+
changes.push({ op: 'remove', field: 'related', before: removed });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (ops.addReferences && ops.addReferences.length > 0) {
|
|
138
|
+
const merged = [...(next.references ?? [])];
|
|
139
|
+
const added = [];
|
|
140
|
+
for (const r of ops.addReferences) {
|
|
141
|
+
const dup = merged.find((m) => m.kind === r.kind &&
|
|
142
|
+
(m.id ?? '') === (r.id ?? '') &&
|
|
143
|
+
(m.path ?? '') === (r.path ?? '') &&
|
|
144
|
+
(m.symbol ?? '') === (r.symbol ?? ''));
|
|
145
|
+
if (!dup) {
|
|
146
|
+
merged.push(clone(r));
|
|
147
|
+
added.push(r);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
next.references = merged;
|
|
151
|
+
if (added.length > 0) {
|
|
152
|
+
changes.push({ op: 'add', field: 'references', after: added });
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (ops.removeReferences && ops.removeReferences.length > 0) {
|
|
156
|
+
const before = next.references ?? [];
|
|
157
|
+
const keep = before.filter((m) => {
|
|
158
|
+
return !ops.removeReferences.some((rm) => m.kind === rm.kind &&
|
|
159
|
+
(m.id ?? '') === (rm.id ?? '') &&
|
|
160
|
+
(m.path ?? '') === (rm.path ?? '') &&
|
|
161
|
+
(m.symbol ?? '') === (rm.symbol ?? ''));
|
|
162
|
+
});
|
|
163
|
+
const removed = before.filter((m) => !keep.includes(m));
|
|
164
|
+
next.references = keep;
|
|
165
|
+
if (removed.length > 0) {
|
|
166
|
+
changes.push({ op: 'remove', field: 'references', before: removed });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (ops.addAnchors && ops.addAnchors.length > 0) {
|
|
170
|
+
const merged = [...(next.anchors ?? [])];
|
|
171
|
+
const added = [];
|
|
172
|
+
for (const a of ops.addAnchors) {
|
|
173
|
+
if (!merged.some((m) => m.id === a.id)) {
|
|
174
|
+
merged.push(clone(a));
|
|
175
|
+
added.push(a);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
next.anchors = merged;
|
|
179
|
+
if (added.length > 0) {
|
|
180
|
+
changes.push({ op: 'add', field: 'anchors', after: added });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (ops.removeAnchorIds && ops.removeAnchorIds.length > 0) {
|
|
184
|
+
const before = next.anchors ?? [];
|
|
185
|
+
const keep = before.filter((a) => !ops.removeAnchorIds.includes(a.id));
|
|
186
|
+
const removed = before.filter((a) => ops.removeAnchorIds.includes(a.id));
|
|
187
|
+
next.anchors = keep;
|
|
188
|
+
if (removed.length > 0) {
|
|
189
|
+
changes.push({ op: 'remove', field: 'anchors', before: removed });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
if (ops.markDeprecated) {
|
|
193
|
+
const md = (next.metadata ?? {});
|
|
194
|
+
if (!md.deprecated) {
|
|
195
|
+
next.metadata = { ...md, deprecated: true };
|
|
196
|
+
changes.push({ op: 'add', field: 'metadata.deprecated', after: true });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (ops.unmarkDeprecated) {
|
|
200
|
+
const md = (next.metadata ?? {});
|
|
201
|
+
if (md.deprecated) {
|
|
202
|
+
const { deprecated, ...rest } = md;
|
|
203
|
+
void deprecated;
|
|
204
|
+
next.metadata = rest;
|
|
205
|
+
changes.push({ op: 'remove', field: 'metadata.deprecated', before: true });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return next;
|
|
209
|
+
}
|
|
210
|
+
function buildTsDraft(entry, op) {
|
|
211
|
+
const constName = idToConst(entry.id);
|
|
212
|
+
const fields = [];
|
|
213
|
+
fields.push(` id: ${tsScalar(entry.id)},`);
|
|
214
|
+
fields.push(` title: ${tsScalar(entry.title)},`);
|
|
215
|
+
fields.push(` type: ${tsScalar(entry.type)},`);
|
|
216
|
+
fields.push(` priority: ${tsScalar(entry.priority)},`);
|
|
217
|
+
fields.push(` scope: ${tsArray(entry.scope, ' ')},`);
|
|
218
|
+
fields.push(` tags: ${tsArray(entry.tags, ' ')},`);
|
|
219
|
+
fields.push(` appliesWhen: ${tsArray(entry.appliesWhen, ' ')},`);
|
|
220
|
+
if (entry.summary)
|
|
221
|
+
fields.push(` summary: ${tsScalar(entry.summary)},`);
|
|
222
|
+
fields.push(` content: ${tsScalar(entry.content)},`);
|
|
223
|
+
if (entry.related && entry.related.length > 0)
|
|
224
|
+
fields.push(` related: ${tsArray(entry.related, ' ')},`);
|
|
225
|
+
if (entry.references && entry.references.length > 0)
|
|
226
|
+
fields.push(` references: ${tsObject(entry.references, ' ')},`);
|
|
227
|
+
if (entry.anchors && entry.anchors.length > 0)
|
|
228
|
+
fields.push(` anchors: ${tsObject(entry.anchors, ' ')},`);
|
|
229
|
+
if (entry.actionHints)
|
|
230
|
+
fields.push(` actionHints: ${tsObject(entry.actionHints, ' ')},`);
|
|
231
|
+
if (entry.metadata)
|
|
232
|
+
fields.push(` metadata: ${tsObject(entry.metadata, ' ')},`);
|
|
233
|
+
return (`// Generated by \`shrk knowledge ${op}\` (preview only — not yet written).\n` +
|
|
234
|
+
`// Paste into sharkcraft/knowledge.ts or a pack's assets/knowledge.ts.\n` +
|
|
235
|
+
`\n` +
|
|
236
|
+
`export const ${constName} = {\n` +
|
|
237
|
+
fields.join('\n') +
|
|
238
|
+
'\n};\n');
|
|
239
|
+
}
|
|
240
|
+
function buildJsonManifest(result) {
|
|
241
|
+
return JSON.stringify(result, null, 2) + '\n';
|
|
242
|
+
}
|
|
243
|
+
function buildExplainer(input, result) {
|
|
244
|
+
const op = result.operation;
|
|
245
|
+
const lines = [];
|
|
246
|
+
lines.push(`# Knowledge authoring preview — ${op} ${result.entryId}`);
|
|
247
|
+
lines.push('');
|
|
248
|
+
if (!result.ok) {
|
|
249
|
+
lines.push(`> Refused: ${result.refusal ?? 'unknown reason'}.`);
|
|
250
|
+
lines.push('');
|
|
251
|
+
}
|
|
252
|
+
lines.push(`Generated: ${nowIso()}`);
|
|
253
|
+
lines.push('');
|
|
254
|
+
lines.push(`## What this preview is`);
|
|
255
|
+
lines.push('');
|
|
256
|
+
lines.push(`Preview-only. Nothing was written to \`sharkcraft/knowledge.ts\` or to any pack's \`assets/knowledge.ts\`. ` +
|
|
257
|
+
'The TypeScript draft on disk is a copy you (or an agent) can paste into the canonical file.');
|
|
258
|
+
lines.push('');
|
|
259
|
+
if (input.reason) {
|
|
260
|
+
lines.push(`## Reason`);
|
|
261
|
+
lines.push('');
|
|
262
|
+
lines.push(input.reason);
|
|
263
|
+
lines.push('');
|
|
264
|
+
}
|
|
265
|
+
if (result.reverseReferences && result.reverseReferences.length > 0) {
|
|
266
|
+
lines.push(`## Reverse references`);
|
|
267
|
+
lines.push('');
|
|
268
|
+
for (const rr of result.reverseReferences) {
|
|
269
|
+
lines.push(`- \`${rr.fromEntryId}\` → \`${rr.field}\`${rr.note ? ` — ${rr.note}` : ''}`);
|
|
270
|
+
}
|
|
271
|
+
lines.push('');
|
|
272
|
+
}
|
|
273
|
+
if (result.suggestedDeprecationInstead) {
|
|
274
|
+
lines.push(`## Suggested safer alternative`);
|
|
275
|
+
lines.push('');
|
|
276
|
+
lines.push('This entry is referenced elsewhere. Removing it can produce stale references. ' +
|
|
277
|
+
`Consider marking it deprecated instead by running:\n\n` +
|
|
278
|
+
'```\n' +
|
|
279
|
+
`shrk knowledge update ${result.entryId} --mark-deprecated --reason "<why>"\n` +
|
|
280
|
+
'```');
|
|
281
|
+
lines.push('');
|
|
282
|
+
}
|
|
283
|
+
lines.push(`## Next commands`);
|
|
284
|
+
lines.push('');
|
|
285
|
+
for (const c of result.nextCommands)
|
|
286
|
+
lines.push(`- \`${c}\``);
|
|
287
|
+
lines.push('');
|
|
288
|
+
return lines.join('\n');
|
|
289
|
+
}
|
|
290
|
+
function buildResultFiles(entryId, op, tsBody, manifestBody, explainerBody) {
|
|
291
|
+
const slug = fileSafeId(entryId);
|
|
292
|
+
return {
|
|
293
|
+
tsDraft: {
|
|
294
|
+
path: `.sharkcraft/authoring/knowledge-${op}-${slug}.draft.ts`,
|
|
295
|
+
body: tsBody,
|
|
296
|
+
language: 'typescript',
|
|
297
|
+
},
|
|
298
|
+
jsonManifest: {
|
|
299
|
+
path: `.sharkcraft/authoring/knowledge-${op}-${slug}.manifest.json`,
|
|
300
|
+
body: manifestBody,
|
|
301
|
+
language: 'json',
|
|
302
|
+
},
|
|
303
|
+
explainer: {
|
|
304
|
+
path: `.sharkcraft/authoring/knowledge-${op}-${slug}.md`,
|
|
305
|
+
body: explainerBody,
|
|
306
|
+
language: 'markdown',
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
export function buildKnowledgeAuthoringPreview(input, context) {
|
|
311
|
+
const warnings = [];
|
|
312
|
+
if (!ID_RE.test(input.id)) {
|
|
313
|
+
warnings.push(`id "${input.id}" does not match the recommended pattern <namespace>.<kebab-id>.`);
|
|
314
|
+
}
|
|
315
|
+
const existing = context.entries.find((e) => e.id === input.id);
|
|
316
|
+
switch (input.operation) {
|
|
317
|
+
case KnowledgeAuthoringOperation.Add: {
|
|
318
|
+
if (existing && !input.allowOverwrite) {
|
|
319
|
+
const refused = {
|
|
320
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
321
|
+
generatedAt: nowIso(),
|
|
322
|
+
operation: input.operation,
|
|
323
|
+
entryId: input.id,
|
|
324
|
+
ok: false,
|
|
325
|
+
refusal: `An entry with id "${input.id}" already exists. Use \`shrk knowledge update ${input.id}\` instead, or pass --allow-overwrite to draft a replacement.`,
|
|
326
|
+
tsDraft: emptyDraftFile(input.id, input.operation, 'typescript'),
|
|
327
|
+
jsonManifest: emptyDraftFile(input.id, input.operation, 'json'),
|
|
328
|
+
explainer: emptyDraftFile(input.id, input.operation, 'markdown'),
|
|
329
|
+
warnings,
|
|
330
|
+
nextCommands: [`shrk knowledge update ${input.id} --reason "<why>"`],
|
|
331
|
+
current: existing,
|
|
332
|
+
};
|
|
333
|
+
const files = buildResultFiles(input.id, input.operation, '// Refused — entry already exists.\n', buildJsonManifest(refused), buildExplainer(input, refused));
|
|
334
|
+
refused.tsDraft = files.tsDraft;
|
|
335
|
+
refused.jsonManifest = files.jsonManifest;
|
|
336
|
+
refused.explainer = files.explainer;
|
|
337
|
+
return refused;
|
|
338
|
+
}
|
|
339
|
+
const next = buildEntryFromAdd(input);
|
|
340
|
+
if (!input.reason)
|
|
341
|
+
warnings.push('No --reason provided. Provenance entry will record source only.');
|
|
342
|
+
if (!input.summary && !input.content)
|
|
343
|
+
warnings.push('Neither --summary nor --content provided. Body is a TODO stub.');
|
|
344
|
+
const result = {
|
|
345
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
346
|
+
generatedAt: nowIso(),
|
|
347
|
+
operation: input.operation,
|
|
348
|
+
entryId: input.id,
|
|
349
|
+
ok: true,
|
|
350
|
+
tsDraft: emptyDraftFile(input.id, input.operation, 'typescript'),
|
|
351
|
+
jsonManifest: emptyDraftFile(input.id, input.operation, 'json'),
|
|
352
|
+
explainer: emptyDraftFile(input.id, input.operation, 'markdown'),
|
|
353
|
+
warnings,
|
|
354
|
+
next,
|
|
355
|
+
nextCommands: nextCommandsForAdd(input),
|
|
356
|
+
};
|
|
357
|
+
const files = buildResultFiles(input.id, input.operation, buildTsDraft(next, input.operation), buildJsonManifest({
|
|
358
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
359
|
+
generatedAt: result.generatedAt,
|
|
360
|
+
operation: result.operation,
|
|
361
|
+
entryId: result.entryId,
|
|
362
|
+
ok: true,
|
|
363
|
+
next,
|
|
364
|
+
warnings,
|
|
365
|
+
}), buildExplainer(input, result));
|
|
366
|
+
result.tsDraft = files.tsDraft;
|
|
367
|
+
result.jsonManifest = files.jsonManifest;
|
|
368
|
+
result.explainer = files.explainer;
|
|
369
|
+
return result;
|
|
370
|
+
}
|
|
371
|
+
case KnowledgeAuthoringOperation.Update: {
|
|
372
|
+
if (!existing) {
|
|
373
|
+
const refused = {
|
|
374
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
375
|
+
generatedAt: nowIso(),
|
|
376
|
+
operation: input.operation,
|
|
377
|
+
entryId: input.id,
|
|
378
|
+
ok: false,
|
|
379
|
+
refusal: `No entry with id "${input.id}" exists. Use \`shrk knowledge add\` instead.`,
|
|
380
|
+
tsDraft: emptyDraftFile(input.id, input.operation, 'typescript'),
|
|
381
|
+
jsonManifest: emptyDraftFile(input.id, input.operation, 'json'),
|
|
382
|
+
explainer: emptyDraftFile(input.id, input.operation, 'markdown'),
|
|
383
|
+
warnings,
|
|
384
|
+
nextCommands: [`shrk knowledge add --id ${input.id}`],
|
|
385
|
+
};
|
|
386
|
+
const files = buildResultFiles(input.id, input.operation, '// Refused — entry does not exist.\n', buildJsonManifest(refused), buildExplainer(input, refused));
|
|
387
|
+
refused.tsDraft = files.tsDraft;
|
|
388
|
+
refused.jsonManifest = files.jsonManifest;
|
|
389
|
+
refused.explainer = files.explainer;
|
|
390
|
+
return refused;
|
|
391
|
+
}
|
|
392
|
+
const changes = [];
|
|
393
|
+
const next = input.updateOps
|
|
394
|
+
? applyUpdateOps(existing, input.updateOps, changes)
|
|
395
|
+
: applyUpdateOps(existing, deriveOpsFromInput(input), changes);
|
|
396
|
+
if (changes.length === 0) {
|
|
397
|
+
warnings.push('No updateOps produced changes. Preview will mirror the existing entry.');
|
|
398
|
+
}
|
|
399
|
+
const result = {
|
|
400
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
401
|
+
generatedAt: nowIso(),
|
|
402
|
+
operation: input.operation,
|
|
403
|
+
entryId: input.id,
|
|
404
|
+
ok: true,
|
|
405
|
+
tsDraft: emptyDraftFile(input.id, input.operation, 'typescript'),
|
|
406
|
+
jsonManifest: emptyDraftFile(input.id, input.operation, 'json'),
|
|
407
|
+
explainer: emptyDraftFile(input.id, input.operation, 'markdown'),
|
|
408
|
+
warnings,
|
|
409
|
+
current: existing,
|
|
410
|
+
next,
|
|
411
|
+
patch: {
|
|
412
|
+
schema: 'sharkcraft.knowledge-authoring-patch/v1',
|
|
413
|
+
operation: input.operation,
|
|
414
|
+
entryId: input.id,
|
|
415
|
+
changes,
|
|
416
|
+
},
|
|
417
|
+
nextCommands: nextCommandsForUpdate(input),
|
|
418
|
+
};
|
|
419
|
+
const files = buildResultFiles(input.id, input.operation, buildTsDraft(next, input.operation), buildJsonManifest({
|
|
420
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
421
|
+
generatedAt: result.generatedAt,
|
|
422
|
+
operation: result.operation,
|
|
423
|
+
entryId: result.entryId,
|
|
424
|
+
ok: true,
|
|
425
|
+
current: existing,
|
|
426
|
+
next,
|
|
427
|
+
patch: result.patch,
|
|
428
|
+
warnings,
|
|
429
|
+
}), buildExplainer(input, result));
|
|
430
|
+
result.tsDraft = files.tsDraft;
|
|
431
|
+
result.jsonManifest = files.jsonManifest;
|
|
432
|
+
result.explainer = files.explainer;
|
|
433
|
+
return result;
|
|
434
|
+
}
|
|
435
|
+
case KnowledgeAuthoringOperation.Remove: {
|
|
436
|
+
if (!existing) {
|
|
437
|
+
const refused = {
|
|
438
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
439
|
+
generatedAt: nowIso(),
|
|
440
|
+
operation: input.operation,
|
|
441
|
+
entryId: input.id,
|
|
442
|
+
ok: false,
|
|
443
|
+
refusal: `No entry with id "${input.id}" exists — nothing to remove.`,
|
|
444
|
+
tsDraft: emptyDraftFile(input.id, input.operation, 'typescript'),
|
|
445
|
+
jsonManifest: emptyDraftFile(input.id, input.operation, 'json'),
|
|
446
|
+
explainer: emptyDraftFile(input.id, input.operation, 'markdown'),
|
|
447
|
+
warnings,
|
|
448
|
+
nextCommands: [],
|
|
449
|
+
};
|
|
450
|
+
const files = buildResultFiles(input.id, input.operation, '// Refused — entry does not exist.\n', buildJsonManifest(refused), buildExplainer(input, refused));
|
|
451
|
+
refused.tsDraft = files.tsDraft;
|
|
452
|
+
refused.jsonManifest = files.jsonManifest;
|
|
453
|
+
refused.explainer = files.explainer;
|
|
454
|
+
return refused;
|
|
455
|
+
}
|
|
456
|
+
const reverseReferences = findReverseReferences(context.entries, input.id);
|
|
457
|
+
if (reverseReferences.length > 0 && !input.forcePreview) {
|
|
458
|
+
const refused = {
|
|
459
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
460
|
+
generatedAt: nowIso(),
|
|
461
|
+
operation: input.operation,
|
|
462
|
+
entryId: input.id,
|
|
463
|
+
ok: false,
|
|
464
|
+
refusal: `Refused: ${reverseReferences.length} other entr${reverseReferences.length === 1 ? 'y references' : 'ies reference'} "${input.id}". Pass --force-preview to preview removal anyway, or prefer deprecation via \`shrk knowledge update ${input.id} --mark-deprecated\`.`,
|
|
465
|
+
tsDraft: emptyDraftFile(input.id, input.operation, 'typescript'),
|
|
466
|
+
jsonManifest: emptyDraftFile(input.id, input.operation, 'json'),
|
|
467
|
+
explainer: emptyDraftFile(input.id, input.operation, 'markdown'),
|
|
468
|
+
warnings,
|
|
469
|
+
reverseReferences,
|
|
470
|
+
suggestedDeprecationInstead: true,
|
|
471
|
+
current: existing,
|
|
472
|
+
nextCommands: [
|
|
473
|
+
`shrk knowledge update ${input.id} --mark-deprecated --reason "${input.reason ?? '<why>'}"`,
|
|
474
|
+
`shrk knowledge remove ${input.id} --force-preview --reason "${input.reason ?? '<why>'}"`,
|
|
475
|
+
],
|
|
476
|
+
};
|
|
477
|
+
const files = buildResultFiles(input.id, input.operation, `// Refused — ${reverseReferences.length} reverse reference(s). See manifest.\n`, buildJsonManifest(refused), buildExplainer(input, refused));
|
|
478
|
+
refused.tsDraft = files.tsDraft;
|
|
479
|
+
refused.jsonManifest = files.jsonManifest;
|
|
480
|
+
refused.explainer = files.explainer;
|
|
481
|
+
return refused;
|
|
482
|
+
}
|
|
483
|
+
const result = {
|
|
484
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
485
|
+
generatedAt: nowIso(),
|
|
486
|
+
operation: input.operation,
|
|
487
|
+
entryId: input.id,
|
|
488
|
+
ok: true,
|
|
489
|
+
tsDraft: emptyDraftFile(input.id, input.operation, 'typescript'),
|
|
490
|
+
jsonManifest: emptyDraftFile(input.id, input.operation, 'json'),
|
|
491
|
+
explainer: emptyDraftFile(input.id, input.operation, 'markdown'),
|
|
492
|
+
warnings,
|
|
493
|
+
reverseReferences,
|
|
494
|
+
current: existing,
|
|
495
|
+
patch: {
|
|
496
|
+
schema: 'sharkcraft.knowledge-authoring-patch/v1',
|
|
497
|
+
operation: input.operation,
|
|
498
|
+
entryId: input.id,
|
|
499
|
+
changes: [{ op: 'remove', field: '*', before: existing }],
|
|
500
|
+
},
|
|
501
|
+
nextCommands: nextCommandsForRemove(input),
|
|
502
|
+
};
|
|
503
|
+
const files = buildResultFiles(input.id, input.operation, buildRemovalNotice(existing), buildJsonManifest({
|
|
504
|
+
schema: KNOWLEDGE_AUTHORING_SCHEMA,
|
|
505
|
+
generatedAt: result.generatedAt,
|
|
506
|
+
operation: result.operation,
|
|
507
|
+
entryId: result.entryId,
|
|
508
|
+
ok: true,
|
|
509
|
+
current: existing,
|
|
510
|
+
reverseReferences,
|
|
511
|
+
warnings,
|
|
512
|
+
}), buildExplainer(input, result));
|
|
513
|
+
result.tsDraft = files.tsDraft;
|
|
514
|
+
result.jsonManifest = files.jsonManifest;
|
|
515
|
+
result.explainer = files.explainer;
|
|
516
|
+
return result;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function buildRemovalNotice(entry) {
|
|
521
|
+
return (`// Knowledge removal preview for ${entry.id}.\n` +
|
|
522
|
+
`// Delete the following const from the knowledge file:\n` +
|
|
523
|
+
`//\n` +
|
|
524
|
+
entry.content
|
|
525
|
+
.split('\n')
|
|
526
|
+
.slice(0, 6)
|
|
527
|
+
.map((l) => `// ${l}`)
|
|
528
|
+
.join('\n') +
|
|
529
|
+
`\n`);
|
|
530
|
+
}
|
|
531
|
+
function deriveOpsFromInput(input) {
|
|
532
|
+
// When the caller passes flat fields instead of an explicit updateOps
|
|
533
|
+
// block, derive the conservative ops it implies. We only set fields the
|
|
534
|
+
// caller explicitly provided.
|
|
535
|
+
const ops = {};
|
|
536
|
+
if (input.summary !== undefined)
|
|
537
|
+
ops.setSummary = input.summary;
|
|
538
|
+
if (input.content !== undefined)
|
|
539
|
+
ops.setContent = input.content;
|
|
540
|
+
if (input.priority !== undefined)
|
|
541
|
+
ops.setPriority = input.priority;
|
|
542
|
+
if (input.references && input.references.length > 0)
|
|
543
|
+
ops.addReferences = input.references;
|
|
544
|
+
if (input.anchors && input.anchors.length > 0)
|
|
545
|
+
ops.addAnchors = input.anchors;
|
|
546
|
+
if (input.related && input.related.length > 0)
|
|
547
|
+
ops.addRelated = input.related;
|
|
548
|
+
return ops;
|
|
549
|
+
}
|
|
550
|
+
function nextCommandsForAdd(input) {
|
|
551
|
+
const targetHint = input.target?.filePath
|
|
552
|
+
? `# Target: ${input.target.filePath}`
|
|
553
|
+
: '# Target: sharkcraft/knowledge.ts (or a pack assets/knowledge.ts)';
|
|
554
|
+
return [
|
|
555
|
+
targetHint,
|
|
556
|
+
`shrk knowledge stale-check --ci`,
|
|
557
|
+
`shrk self-config doctor`,
|
|
558
|
+
`shrk packs signature-status`,
|
|
559
|
+
`# Pack edits make signatures stale — see \`shrk packs sign --print-command\` when secret is available.`,
|
|
560
|
+
];
|
|
561
|
+
}
|
|
562
|
+
function nextCommandsForUpdate(input) {
|
|
563
|
+
return [
|
|
564
|
+
`# Apply the patch to ${input.target?.filePath ?? 'the knowledge file that owns this entry'}.`,
|
|
565
|
+
`shrk knowledge stale-check --ci`,
|
|
566
|
+
`shrk self-config doctor`,
|
|
567
|
+
`shrk packs signature-status`,
|
|
568
|
+
];
|
|
569
|
+
}
|
|
570
|
+
function nextCommandsForRemove(input) {
|
|
571
|
+
return [
|
|
572
|
+
`# Delete the entry from ${input.target?.filePath ?? 'the knowledge file that owns this entry'}.`,
|
|
573
|
+
`shrk knowledge stale-check --ci`,
|
|
574
|
+
`shrk self-config doctor`,
|
|
575
|
+
`shrk packs signature-status`,
|
|
576
|
+
];
|
|
577
|
+
}
|
|
578
|
+
function emptyDraftFile(id, op, language) {
|
|
579
|
+
const slug = fileSafeId(id);
|
|
580
|
+
const ext = language === 'typescript' ? 'draft.ts' : language === 'json' ? 'manifest.json' : 'md';
|
|
581
|
+
return {
|
|
582
|
+
path: `.sharkcraft/authoring/knowledge-${op}-${slug}.${ext}`,
|
|
583
|
+
body: '',
|
|
584
|
+
language,
|
|
585
|
+
};
|
|
586
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ISharkcraftInspection } from './sharkcraft-inspector.js';
|
|
2
|
+
export type GraphNodeKind = 'knowledge' | 'rule' | 'path' | 'template' | 'pipeline' | 'preset' | 'pack' | 'boundary' | 'doc';
|
|
3
|
+
export interface IGraphNode {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: GraphNodeKind;
|
|
6
|
+
title: string;
|
|
7
|
+
/** Optional one-line summary. */
|
|
8
|
+
summary?: string;
|
|
9
|
+
/** Source: builtin | local | pack:<name> */
|
|
10
|
+
source: string;
|
|
11
|
+
}
|
|
12
|
+
export type GraphEdgeRelation = 'related-template' | 'related-path' | 'related-rule' | 'preset-includes' | 'preset-references' | 'pipeline-step-references' | 'pack-contributes' | 'boundary-related-rule' | 'boundary-related-path' | 'composes';
|
|
13
|
+
export interface IGraphEdge {
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
relation: GraphEdgeRelation;
|
|
17
|
+
/** Free-form note explaining why the edge exists. */
|
|
18
|
+
why: string;
|
|
19
|
+
}
|
|
20
|
+
export interface IKnowledgeGraph {
|
|
21
|
+
nodes: IGraphNode[];
|
|
22
|
+
edges: IGraphEdge[];
|
|
23
|
+
/** Convenience: lookup by composite id (kind:id). */
|
|
24
|
+
byId: ReadonlyMap<string, IGraphNode>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build the full SharkCraft knowledge graph for the current inspection.
|
|
28
|
+
* Pure — no I/O beyond what the inspection already cached.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildKnowledgeGraph(inspection: ISharkcraftInspection): IKnowledgeGraph;
|
|
31
|
+
export interface IGraphPathStep {
|
|
32
|
+
/** Composite node key `kind:id`. */
|
|
33
|
+
node: string;
|
|
34
|
+
/** Edge that led into this node (undefined for the start). */
|
|
35
|
+
via?: {
|
|
36
|
+
relation: GraphEdgeRelation;
|
|
37
|
+
why: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface IGraphPath {
|
|
41
|
+
found: boolean;
|
|
42
|
+
steps: IGraphPathStep[];
|
|
43
|
+
/** When found=false: short reason ("from missing", "to missing", "no path"). */
|
|
44
|
+
reason?: string;
|
|
45
|
+
/**
|
|
46
|
+
* When found=false: a longer, kind-aware explanation that says why
|
|
47
|
+
* the path doesn't exist and what to try instead. Renderers prefer
|
|
48
|
+
* this over `reason` when present. Optional for back-compat — JSON
|
|
49
|
+
* consumers that pin `reason` keep working.
|
|
50
|
+
*/
|
|
51
|
+
explanation?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Find the shortest directed path (BFS) between two graph nodes. Edges are
|
|
55
|
+
* treated in the direction they were added. Returns the node sequence with
|
|
56
|
+
* the edge that landed on each step explained.
|
|
57
|
+
*/
|
|
58
|
+
export declare function findGraphPath(graph: IKnowledgeGraph, fromRef: {
|
|
59
|
+
kind?: GraphNodeKind;
|
|
60
|
+
id: string;
|
|
61
|
+
}, toRef: {
|
|
62
|
+
kind?: GraphNodeKind;
|
|
63
|
+
id: string;
|
|
64
|
+
}): IGraphPath;
|
|
65
|
+
/**
|
|
66
|
+
* Get a node + its incoming/outgoing edges grouped by kind.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getGraphNode(graph: IKnowledgeGraph, ref: {
|
|
69
|
+
kind?: GraphNodeKind;
|
|
70
|
+
id: string;
|
|
71
|
+
}): {
|
|
72
|
+
node: IGraphNode | null;
|
|
73
|
+
incoming: IGraphEdge[];
|
|
74
|
+
outgoing: IGraphEdge[];
|
|
75
|
+
} | null;
|
|
76
|
+
//# sourceMappingURL=knowledge-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-graph.d.ts","sourceRoot":"","sources":["../src/knowledge-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAEvE,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,MAAM,GACN,UAAU,GACV,KAAK,CAAC;AAEV,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,iBAAiB,GACzB,kBAAkB,GAClB,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,mBAAmB,GACnB,0BAA0B,GAC1B,kBAAkB,GAClB,uBAAuB,GACvB,uBAAuB,GACvB,UAAU,CAAC;AAEf,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,qDAAqD;IACrD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACvC;AAMD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,qBAAqB,GAAG,eAAe,CAyQtF;AAED,MAAM,WAAW,cAAc;IAC7B,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,8DAA8D;IAC9D,GAAG,CAAC,EAAE;QAAE,QAAQ,EAAE,iBAAiB,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACpD;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAC7C,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAC1C,UAAU,CA+DZ;AAgDD;;GAEG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE;IAAE,IAAI,CAAC,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACxC;IACD,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB,GAAG,IAAI,CA+BP"}
|