@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,183 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as nodePath from 'node:path';
|
|
3
|
+
export const INGEST_ADOPTION_SCHEMA = 'sharkcraft.ingest-adoption/v1';
|
|
4
|
+
export var IngestAdoptionStatus;
|
|
5
|
+
(function (IngestAdoptionStatus) {
|
|
6
|
+
IngestAdoptionStatus["SafeAppend"] = "safe-append";
|
|
7
|
+
IngestAdoptionStatus["ManualReview"] = "manual-review";
|
|
8
|
+
IngestAdoptionStatus["LowConfidence"] = "low-confidence";
|
|
9
|
+
IngestAdoptionStatus["AlreadyCovered"] = "already-covered";
|
|
10
|
+
IngestAdoptionStatus["GeneratedProtected"] = "generated-protected";
|
|
11
|
+
})(IngestAdoptionStatus || (IngestAdoptionStatus = {}));
|
|
12
|
+
const LIVE_FILES = [
|
|
13
|
+
'sharkcraft/rules.ts',
|
|
14
|
+
'sharkcraft/paths.ts',
|
|
15
|
+
'sharkcraft/templates.ts',
|
|
16
|
+
'sharkcraft/pipelines.ts',
|
|
17
|
+
'sharkcraft/boundaries.ts',
|
|
18
|
+
'sharkcraft/knowledge.ts',
|
|
19
|
+
'sharkcraft/constructs.ts',
|
|
20
|
+
'sharkcraft/policies.ts',
|
|
21
|
+
'sharkcraft/playbooks.ts',
|
|
22
|
+
'sharkcraft/presets.ts',
|
|
23
|
+
];
|
|
24
|
+
export function buildIngestAdoptionPlan(options) {
|
|
25
|
+
const model = options.model;
|
|
26
|
+
const excluded = new Set(options.excludeTargets ?? []);
|
|
27
|
+
const entries = [];
|
|
28
|
+
const counts = {
|
|
29
|
+
[IngestAdoptionStatus.SafeAppend]: 0,
|
|
30
|
+
[IngestAdoptionStatus.ManualReview]: 0,
|
|
31
|
+
[IngestAdoptionStatus.LowConfidence]: 0,
|
|
32
|
+
[IngestAdoptionStatus.AlreadyCovered]: 0,
|
|
33
|
+
[IngestAdoptionStatus.GeneratedProtected]: 0,
|
|
34
|
+
};
|
|
35
|
+
const liveContent = readLiveFiles(model.projectRoot);
|
|
36
|
+
const generatedPathSet = new Set();
|
|
37
|
+
for (const root of model.generatedVsHandwritten.generatedRoots)
|
|
38
|
+
generatedPathSet.add(root.path);
|
|
39
|
+
for (const file of model.recommendedSharkCraftFiles) {
|
|
40
|
+
if (excluded.has(file.target))
|
|
41
|
+
continue;
|
|
42
|
+
const liveBody = liveContent.get(file.target) ?? '';
|
|
43
|
+
for (const entry of file.entries) {
|
|
44
|
+
const isGenerated = isUnderGenerated(entry.id, generatedPathSet);
|
|
45
|
+
let status;
|
|
46
|
+
if (isGenerated) {
|
|
47
|
+
status = IngestAdoptionStatus.GeneratedProtected;
|
|
48
|
+
}
|
|
49
|
+
else if (liveBody.includes(`'${entry.id}'`) || liveBody.includes(`"${entry.id}"`)) {
|
|
50
|
+
status = IngestAdoptionStatus.AlreadyCovered;
|
|
51
|
+
}
|
|
52
|
+
else if ((entry.reason ?? '').toLowerCase().includes('low confidence')) {
|
|
53
|
+
status = IngestAdoptionStatus.LowConfidence;
|
|
54
|
+
}
|
|
55
|
+
else if (options.strict !== false && needsManualReview(file.target, entry.kind)) {
|
|
56
|
+
status = IngestAdoptionStatus.ManualReview;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
status = IngestAdoptionStatus.SafeAppend;
|
|
60
|
+
}
|
|
61
|
+
entries.push({
|
|
62
|
+
target: file.target,
|
|
63
|
+
kind: entry.kind,
|
|
64
|
+
id: entry.id,
|
|
65
|
+
status,
|
|
66
|
+
reason: entry.reason,
|
|
67
|
+
});
|
|
68
|
+
counts[status] += 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const reviewRequired = counts[IngestAdoptionStatus.ManualReview] > 0 || counts[IngestAdoptionStatus.LowConfidence] > 0;
|
|
72
|
+
return {
|
|
73
|
+
schema: INGEST_ADOPTION_SCHEMA,
|
|
74
|
+
projectRoot: model.projectRoot,
|
|
75
|
+
entries,
|
|
76
|
+
counts,
|
|
77
|
+
reviewRequired,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function writeIngestAdoption(opts) {
|
|
81
|
+
const outDir = nodePath.resolve(opts.outDir ?? nodePath.join(opts.plan.projectRoot, 'sharkcraft', 'ingestion', 'adoption'));
|
|
82
|
+
if (!existsSync(outDir))
|
|
83
|
+
mkdirSync(outDir, { recursive: true });
|
|
84
|
+
const files = [];
|
|
85
|
+
const write = (rel, body) => {
|
|
86
|
+
const full = nodePath.join(outDir, rel);
|
|
87
|
+
if (!full.startsWith(outDir + nodePath.sep))
|
|
88
|
+
throw new Error(`escapes outDir: ${rel}`);
|
|
89
|
+
writeFileSync(full, body, 'utf8');
|
|
90
|
+
files.push({ path: full, bytes: Buffer.byteLength(body, 'utf8') });
|
|
91
|
+
};
|
|
92
|
+
write('ingest-adoption-state.json', JSON.stringify(opts.plan, null, 2));
|
|
93
|
+
write('ingest-adopt-summary.json', JSON.stringify({
|
|
94
|
+
schema: 'sharkcraft.ingest-adopt-summary/v1',
|
|
95
|
+
counts: opts.plan.counts,
|
|
96
|
+
reviewRequired: opts.plan.reviewRequired,
|
|
97
|
+
}, null, 2));
|
|
98
|
+
write('ingest-adoption-plan.md', renderIngestAdoptionPlanMarkdown(opts.plan));
|
|
99
|
+
write('ingest-adopt.patch', renderIngestAdoptionPatch(opts.plan));
|
|
100
|
+
return { outDir, files };
|
|
101
|
+
}
|
|
102
|
+
function readLiveFiles(projectRoot) {
|
|
103
|
+
const out = new Map();
|
|
104
|
+
for (const rel of LIVE_FILES) {
|
|
105
|
+
const abs = nodePath.join(projectRoot, rel);
|
|
106
|
+
if (existsSync(abs)) {
|
|
107
|
+
try {
|
|
108
|
+
out.set(rel, readFileSync(abs, 'utf8'));
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
out.set(rel, '');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
out.set(rel, '');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
function isUnderGenerated(id, generatedPaths) {
|
|
121
|
+
for (const p of generatedPaths) {
|
|
122
|
+
if (id.includes(p))
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
function needsManualReview(target, kind) {
|
|
128
|
+
if (target === 'sharkcraft/templates.ts')
|
|
129
|
+
return true; // Always manual.
|
|
130
|
+
if (target === 'sharkcraft/policies.ts' && kind === 'policy')
|
|
131
|
+
return false; // Safe append.
|
|
132
|
+
if (target === 'sharkcraft/boundaries.ts')
|
|
133
|
+
return false; // Safe append.
|
|
134
|
+
if (target === 'sharkcraft/constructs.ts')
|
|
135
|
+
return false; // Safe append.
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
export function renderIngestAdoptionPlanMarkdown(plan) {
|
|
139
|
+
const lines = [];
|
|
140
|
+
lines.push('# Ingest adoption plan');
|
|
141
|
+
lines.push('');
|
|
142
|
+
lines.push(`Review required: **${plan.reviewRequired ? 'yes' : 'no'}**`);
|
|
143
|
+
lines.push('');
|
|
144
|
+
lines.push('| Status | Count |');
|
|
145
|
+
lines.push('|---|---|');
|
|
146
|
+
for (const [k, v] of Object.entries(plan.counts))
|
|
147
|
+
lines.push(`| ${k} | ${v} |`);
|
|
148
|
+
lines.push('');
|
|
149
|
+
lines.push('## Entries');
|
|
150
|
+
lines.push('');
|
|
151
|
+
lines.push('| Target | Kind | Id | Status | Reason |');
|
|
152
|
+
lines.push('|---|---|---|---|---|');
|
|
153
|
+
for (const e of plan.entries) {
|
|
154
|
+
lines.push(`| \`${e.target}\` | ${e.kind} | \`${e.id}\` | ${e.status} | ${e.reason} |`);
|
|
155
|
+
}
|
|
156
|
+
return lines.join('\n');
|
|
157
|
+
}
|
|
158
|
+
export function renderIngestAdoptionPatch(plan) {
|
|
159
|
+
const lines = [];
|
|
160
|
+
lines.push('# Generated by `shrk ingest adopt --write-patch`. Apply manually:');
|
|
161
|
+
lines.push('# 1) Review each block.');
|
|
162
|
+
lines.push('# 2) Copy the safe-append blocks into the corresponding sharkcraft/*.ts file.');
|
|
163
|
+
lines.push('# 3) Resolve manual-review entries by hand.');
|
|
164
|
+
lines.push('');
|
|
165
|
+
const grouped = new Map();
|
|
166
|
+
for (const e of plan.entries) {
|
|
167
|
+
if (e.status === IngestAdoptionStatus.GeneratedProtected || e.status === IngestAdoptionStatus.AlreadyCovered)
|
|
168
|
+
continue;
|
|
169
|
+
const list = grouped.get(e.target) ?? [];
|
|
170
|
+
list.push(e);
|
|
171
|
+
grouped.set(e.target, list);
|
|
172
|
+
}
|
|
173
|
+
for (const [target, list] of grouped) {
|
|
174
|
+
lines.push(`## ${target}`);
|
|
175
|
+
lines.push('');
|
|
176
|
+
for (const e of list) {
|
|
177
|
+
lines.push(`### ${e.status} — \`${e.id}\` (${e.kind})`);
|
|
178
|
+
lines.push(`> ${e.reason}`);
|
|
179
|
+
lines.push('');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return lines.join('\n');
|
|
183
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { IngestAdoptionStatus, type IIngestAdoptionPlan } from './ingest-adoption.js';
|
|
2
|
+
export declare const INGEST_APPLY_PLAN_SCHEMA = "sharkcraft.plan/v1";
|
|
3
|
+
export type IngestApplyChangeType = 'create' | 'append';
|
|
4
|
+
export interface IIngestApplyExpectedChange {
|
|
5
|
+
type: IngestApplyChangeType;
|
|
6
|
+
relativePath: string;
|
|
7
|
+
sizeBytes: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IIngestApplyPlan {
|
|
10
|
+
schema: typeof INGEST_APPLY_PLAN_SCHEMA;
|
|
11
|
+
templateId: 'ingest.adopt';
|
|
12
|
+
variables: Readonly<Record<string, string>>;
|
|
13
|
+
projectRoot: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
expectedChanges: readonly IIngestApplyExpectedChange[];
|
|
16
|
+
note?: string;
|
|
17
|
+
signature?: {
|
|
18
|
+
algo: 'sha256';
|
|
19
|
+
hmac: string;
|
|
20
|
+
signedAt: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface IBuildIngestApplyPlanOptions {
|
|
24
|
+
plan: IIngestAdoptionPlan;
|
|
25
|
+
/** Statuses that are eligible — default ['safe-append']. */
|
|
26
|
+
include?: readonly IngestAdoptionStatus[];
|
|
27
|
+
/** Optional: include manual-review entries (will appear in the plan but with operation note). */
|
|
28
|
+
includeManualReview?: boolean;
|
|
29
|
+
/** Note that lands inside the plan file. */
|
|
30
|
+
note?: string;
|
|
31
|
+
/**
|
|
32
|
+
* When true, attempt to extract the real entry body from the
|
|
33
|
+
* originating draft TS file (sharkcraft/ingestion/generated/<X>.draft.ts).
|
|
34
|
+
* Falls back to the comment stub if extraction is unsafe.
|
|
35
|
+
*/
|
|
36
|
+
includeBody?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface IIngestBodyStatus {
|
|
39
|
+
entryId: string;
|
|
40
|
+
target: string;
|
|
41
|
+
status: 'materialised' | 'stubbed' | 'skipped' | 'conflict';
|
|
42
|
+
reason?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface IBuildIngestApplyPlanResult {
|
|
45
|
+
plan: IIngestApplyPlan;
|
|
46
|
+
/** Bodies the apply step should write, keyed by relative path. */
|
|
47
|
+
files: Readonly<Record<string, string>>;
|
|
48
|
+
/** Entries that were skipped, with a reason. */
|
|
49
|
+
skipped: readonly {
|
|
50
|
+
entryId: string;
|
|
51
|
+
target: string;
|
|
52
|
+
reason: string;
|
|
53
|
+
}[];
|
|
54
|
+
/** Per-entry body extraction status. */
|
|
55
|
+
bodyStatuses?: readonly IIngestBodyStatus[];
|
|
56
|
+
}
|
|
57
|
+
export declare function buildIngestApplyPlan(options: IBuildIngestApplyPlanOptions): IBuildIngestApplyPlanResult;
|
|
58
|
+
export declare function signIngestApplyPlan(plan: IIngestApplyPlan, secret: string): IIngestApplyPlan;
|
|
59
|
+
export declare function verifyIngestApplyPlan(plan: IIngestApplyPlan, secret: string): boolean;
|
|
60
|
+
export declare function saveIngestApplyPlan(plan: IIngestApplyPlan, file: string): void;
|
|
61
|
+
export declare function loadIngestApplyPlan(file: string): IIngestApplyPlan | null;
|
|
62
|
+
export declare function renderIngestApplyReviewMarkdown(plan: IIngestApplyPlan): string;
|
|
63
|
+
export interface IApplyIngestPlanOptions {
|
|
64
|
+
plan: IIngestApplyPlan;
|
|
65
|
+
files: Readonly<Record<string, string>>;
|
|
66
|
+
requireSignature?: boolean;
|
|
67
|
+
secret?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface IApplyIngestPlanResult {
|
|
70
|
+
applied: readonly {
|
|
71
|
+
path: string;
|
|
72
|
+
bytesWritten: number;
|
|
73
|
+
}[];
|
|
74
|
+
skipped: readonly {
|
|
75
|
+
path: string;
|
|
76
|
+
reason: string;
|
|
77
|
+
}[];
|
|
78
|
+
}
|
|
79
|
+
export declare function applyIngestPlan(opts: IApplyIngestPlanOptions): IApplyIngestPlanResult;
|
|
80
|
+
//# sourceMappingURL=ingest-apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest-apply.d.ts","sourceRoot":"","sources":["../src/ingest-apply.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,oBAAoB,EACpB,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAE7D,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExD,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,wBAAwB,CAAC;IACxC,UAAU,EAAE,cAAc,CAAC;IAC3B,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,SAAS,0BAA0B,EAAE,CAAC;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE;QACV,IAAI,EAAE,QAAQ,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAOD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,mBAAmB,CAAC;IAC1B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC1C,iGAAiG;IACjG,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,gBAAgB,CAAC;IACvB,kEAAkE;IAClE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxC,gDAAgD;IAChD,OAAO,EAAE,SAAS;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxE,wCAAwC;IACxC,YAAY,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAC7C;AAwBD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,4BAA4B,GACpC,2BAA2B,CAuE7B;AAoBD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAO5F;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAKrF;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAI9E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAWzE;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAsB9E;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3D,OAAO,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACtD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,uBAAuB,GAAG,sBAAsB,CA2BrF"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ingest adoption apply plan.
|
|
3
|
+
*
|
|
4
|
+
* Builds a `sharkcraft.plan/v1` plan (compatible with the existing
|
|
5
|
+
* generator + apply pipeline) that materialises selected entries from an
|
|
6
|
+
* `IIngestAdoptionPlan`. The plan only targets `sharkcraft/**` and
|
|
7
|
+
* `sharkcraft/docs/tasks/**` — nothing else.
|
|
8
|
+
*
|
|
9
|
+
* Default is dry-run. `shrk ingest adopt apply <plan>` is the explicit
|
|
10
|
+
* write step and goes through `shrk apply --verify-signature`, inheriting
|
|
11
|
+
* every existing plan-safety guarantee.
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import * as nodePath from 'node:path';
|
|
15
|
+
import { createHmac } from 'node:crypto';
|
|
16
|
+
import { IngestAdoptionStatus, } from "./ingest-adoption.js";
|
|
17
|
+
import { extractIngestBody } from "./ingest-body-extractor.js";
|
|
18
|
+
export const INGEST_APPLY_PLAN_SCHEMA = 'sharkcraft.plan/v1';
|
|
19
|
+
const ALLOWED_TARGET_DIRS = [
|
|
20
|
+
'sharkcraft/',
|
|
21
|
+
'sharkcraft/docs/tasks/',
|
|
22
|
+
];
|
|
23
|
+
function ensureSafeTarget(target) {
|
|
24
|
+
const normalized = target.replace(/\\/g, '/');
|
|
25
|
+
if (normalized.includes('..'))
|
|
26
|
+
return false;
|
|
27
|
+
if (nodePath.isAbsolute(normalized))
|
|
28
|
+
return false;
|
|
29
|
+
for (const prefix of ALLOWED_TARGET_DIRS) {
|
|
30
|
+
if (normalized.startsWith(prefix))
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
function bodyFor(entry) {
|
|
36
|
+
if (entry.bodyExcerpt && entry.bodyExcerpt.length > 0)
|
|
37
|
+
return entry.bodyExcerpt + '\n';
|
|
38
|
+
// Conservative inline snippet: record the entry id + reason as a comment so
|
|
39
|
+
// append is always safe to read by humans.
|
|
40
|
+
const safeReason = entry.reason.replace(/\*\//g, '*\\/');
|
|
41
|
+
return [
|
|
42
|
+
`// ingest-adopt — ${entry.id} (${entry.kind})`,
|
|
43
|
+
`// reason: ${safeReason}`,
|
|
44
|
+
'',
|
|
45
|
+
].join('\n');
|
|
46
|
+
}
|
|
47
|
+
export function buildIngestApplyPlan(options) {
|
|
48
|
+
const include = new Set(options.include ?? [IngestAdoptionStatus.SafeAppend]);
|
|
49
|
+
if (options.includeManualReview)
|
|
50
|
+
include.add(IngestAdoptionStatus.ManualReview);
|
|
51
|
+
const files = {};
|
|
52
|
+
const skipped = [];
|
|
53
|
+
const bodyStatuses = [];
|
|
54
|
+
const grouped = new Map();
|
|
55
|
+
for (const entry of options.plan.entries) {
|
|
56
|
+
if (!include.has(entry.status)) {
|
|
57
|
+
skipped.push({ entryId: entry.id, target: entry.target, reason: `status ${entry.status} not in include set` });
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!ensureSafeTarget(entry.target)) {
|
|
61
|
+
skipped.push({ entryId: entry.id, target: entry.target, reason: 'target outside sharkcraft/ — refused' });
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// When --include-body is requested, attempt to materialise the
|
|
65
|
+
// real entry body from the draft TS file.
|
|
66
|
+
let resolved = entry;
|
|
67
|
+
if (options.includeBody) {
|
|
68
|
+
const ext = extractIngestBody({
|
|
69
|
+
projectRoot: options.plan.projectRoot,
|
|
70
|
+
target: entry.target,
|
|
71
|
+
entryId: entry.id,
|
|
72
|
+
});
|
|
73
|
+
if (ext.status === 'materialised' && ext.body) {
|
|
74
|
+
resolved = { ...entry, bodyExcerpt: ext.body };
|
|
75
|
+
bodyStatuses.push({ entryId: entry.id, target: entry.target, status: 'materialised' });
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
bodyStatuses.push({
|
|
79
|
+
entryId: entry.id,
|
|
80
|
+
target: entry.target,
|
|
81
|
+
status: ext.status === 'materialised' ? 'stubbed' : ext.status,
|
|
82
|
+
...(ext.reason ? { reason: ext.reason } : {}),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const cur = grouped.get(entry.target) ?? [];
|
|
87
|
+
cur.push(bodyFor(resolved));
|
|
88
|
+
grouped.set(entry.target, cur);
|
|
89
|
+
}
|
|
90
|
+
const expectedChanges = [];
|
|
91
|
+
for (const [target, chunks] of grouped) {
|
|
92
|
+
const body = chunks.join('\n');
|
|
93
|
+
files[target] = body;
|
|
94
|
+
expectedChanges.push({
|
|
95
|
+
type: 'append',
|
|
96
|
+
relativePath: target,
|
|
97
|
+
sizeBytes: Buffer.byteLength(body, 'utf8'),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const plan = {
|
|
101
|
+
schema: INGEST_APPLY_PLAN_SCHEMA,
|
|
102
|
+
templateId: 'ingest.adopt',
|
|
103
|
+
variables: { source: 'ingest-adopt' },
|
|
104
|
+
projectRoot: options.plan.projectRoot,
|
|
105
|
+
createdAt: new Date().toISOString(),
|
|
106
|
+
expectedChanges,
|
|
107
|
+
...(options.note ? { note: options.note } : {}),
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
plan,
|
|
111
|
+
files,
|
|
112
|
+
skipped,
|
|
113
|
+
...(bodyStatuses.length > 0 ? { bodyStatuses } : {}),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function canonicalJson(plan) {
|
|
117
|
+
// Strip signature; sort keys for deterministic HMAC.
|
|
118
|
+
const { signature: _sig, ...rest } = plan;
|
|
119
|
+
void _sig;
|
|
120
|
+
const sortKeys = (v) => {
|
|
121
|
+
if (Array.isArray(v))
|
|
122
|
+
return v.map(sortKeys);
|
|
123
|
+
if (v !== null && typeof v === 'object') {
|
|
124
|
+
const out = {};
|
|
125
|
+
for (const k of Object.keys(v).sort()) {
|
|
126
|
+
out[k] = sortKeys(v[k]);
|
|
127
|
+
}
|
|
128
|
+
return out;
|
|
129
|
+
}
|
|
130
|
+
return v;
|
|
131
|
+
};
|
|
132
|
+
return JSON.stringify(sortKeys(rest));
|
|
133
|
+
}
|
|
134
|
+
export function signIngestApplyPlan(plan, secret) {
|
|
135
|
+
const body = canonicalJson(plan);
|
|
136
|
+
const hmac = createHmac('sha256', secret).update(body).digest('hex');
|
|
137
|
+
return {
|
|
138
|
+
...plan,
|
|
139
|
+
signature: { algo: 'sha256', hmac, signedAt: new Date().toISOString() },
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
export function verifyIngestApplyPlan(plan, secret) {
|
|
143
|
+
if (!plan.signature)
|
|
144
|
+
return false;
|
|
145
|
+
const body = canonicalJson(plan);
|
|
146
|
+
const expected = createHmac('sha256', secret).update(body).digest('hex');
|
|
147
|
+
return expected === plan.signature.hmac;
|
|
148
|
+
}
|
|
149
|
+
export function saveIngestApplyPlan(plan, file) {
|
|
150
|
+
const dir = nodePath.dirname(file);
|
|
151
|
+
if (!existsSync(dir))
|
|
152
|
+
mkdirSync(dir, { recursive: true });
|
|
153
|
+
writeFileSync(file, JSON.stringify(plan, null, 2) + '\n', 'utf8');
|
|
154
|
+
}
|
|
155
|
+
export function loadIngestApplyPlan(file) {
|
|
156
|
+
if (!existsSync(file))
|
|
157
|
+
return null;
|
|
158
|
+
try {
|
|
159
|
+
const raw = readFileSync(file, 'utf8');
|
|
160
|
+
const parsed = JSON.parse(raw);
|
|
161
|
+
if (!parsed || typeof parsed !== 'object')
|
|
162
|
+
return null;
|
|
163
|
+
if (parsed.schema !== INGEST_APPLY_PLAN_SCHEMA)
|
|
164
|
+
return null;
|
|
165
|
+
return parsed;
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export function renderIngestApplyReviewMarkdown(plan) {
|
|
172
|
+
const lines = [];
|
|
173
|
+
lines.push('# Ingest adopt — review');
|
|
174
|
+
lines.push('');
|
|
175
|
+
lines.push(`- Project root: \`${plan.projectRoot}\``);
|
|
176
|
+
lines.push(`- Template: \`${plan.templateId}\``);
|
|
177
|
+
lines.push(`- Files touched: **${plan.expectedChanges.length}**`);
|
|
178
|
+
if (plan.signature)
|
|
179
|
+
lines.push(`- Signature: \`${plan.signature.algo}\` (signed at ${plan.signature.signedAt})`);
|
|
180
|
+
else
|
|
181
|
+
lines.push(`- Signature: _none — set SHARKCRAFT_PLAN_SECRET to sign_`);
|
|
182
|
+
lines.push('');
|
|
183
|
+
lines.push('| Target | Op | Bytes |');
|
|
184
|
+
lines.push('|---|---|---|');
|
|
185
|
+
for (const c of plan.expectedChanges) {
|
|
186
|
+
lines.push(`| \`${c.relativePath}\` | ${c.type} | ${c.sizeBytes} |`);
|
|
187
|
+
}
|
|
188
|
+
lines.push('');
|
|
189
|
+
lines.push('Apply with:');
|
|
190
|
+
lines.push('');
|
|
191
|
+
lines.push('```');
|
|
192
|
+
lines.push('shrk ingest adopt apply <plan.json> --verify-signature');
|
|
193
|
+
lines.push('```');
|
|
194
|
+
return lines.join('\n');
|
|
195
|
+
}
|
|
196
|
+
export function applyIngestPlan(opts) {
|
|
197
|
+
if (opts.requireSignature) {
|
|
198
|
+
if (!opts.secret)
|
|
199
|
+
throw new Error('signature required but SHARKCRAFT_PLAN_SECRET is not set');
|
|
200
|
+
if (!verifyIngestApplyPlan(opts.plan, opts.secret))
|
|
201
|
+
throw new Error('plan signature invalid');
|
|
202
|
+
}
|
|
203
|
+
const applied = [];
|
|
204
|
+
const skipped = [];
|
|
205
|
+
for (const change of opts.plan.expectedChanges) {
|
|
206
|
+
if (!ensureSafeTarget(change.relativePath)) {
|
|
207
|
+
skipped.push({ path: change.relativePath, reason: 'unsafe target — refused' });
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const abs = nodePath.join(opts.plan.projectRoot, change.relativePath);
|
|
211
|
+
const dir = nodePath.dirname(abs);
|
|
212
|
+
if (!existsSync(dir))
|
|
213
|
+
mkdirSync(dir, { recursive: true });
|
|
214
|
+
const body = opts.files[change.relativePath] ?? '';
|
|
215
|
+
if (change.type === 'append' && existsSync(abs)) {
|
|
216
|
+
const current = readFileSync(abs, 'utf8');
|
|
217
|
+
const next = current.endsWith('\n') ? current + body : current + '\n' + body;
|
|
218
|
+
writeFileSync(abs, next, 'utf8');
|
|
219
|
+
applied.push({ path: abs, bytesWritten: Buffer.byteLength(body, 'utf8') });
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
writeFileSync(abs, body, 'utf8');
|
|
223
|
+
applied.push({ path: abs, bytesWritten: Buffer.byteLength(body, 'utf8') });
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return { applied, skipped };
|
|
227
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract a draft entry body from a `sharkcraft/ingestion/generated/<X>.draft.ts`
|
|
3
|
+
* file for a given entry id.
|
|
4
|
+
*
|
|
5
|
+
* Extraction strategy:
|
|
6
|
+
* 1. Find the line containing `id: '<id>'`.
|
|
7
|
+
* 2. Walk outwards to find the enclosing `{ ... }` object literal.
|
|
8
|
+
* 3. Return the object literal text (without the leading whitespace) plus a
|
|
9
|
+
* trailing comma. The caller appends it to the live sharkcraft/<file>.ts.
|
|
10
|
+
* 4. If multiple `id: '<id>'` matches exist, or the enclosing block cannot
|
|
11
|
+
* be unambiguously identified, return `null` and let the caller fall back
|
|
12
|
+
* to the comment-stub body.
|
|
13
|
+
*
|
|
14
|
+
* Imports are NOT preserved by this extractor — the caller decides whether
|
|
15
|
+
* to surface a manual checklist for missing imports. Most draft entries are
|
|
16
|
+
* plain object literals with no extra imports.
|
|
17
|
+
*/
|
|
18
|
+
export interface IIngestBodyExtractionResult {
|
|
19
|
+
status: 'materialised' | 'stubbed' | 'skipped' | 'conflict';
|
|
20
|
+
body: string | null;
|
|
21
|
+
reason?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function extractIngestBody(input: {
|
|
24
|
+
projectRoot: string;
|
|
25
|
+
target: string;
|
|
26
|
+
entryId: string;
|
|
27
|
+
}): IIngestBodyExtractionResult;
|
|
28
|
+
//# sourceMappingURL=ingest-body-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest-body-extractor.d.ts","sourceRoot":"","sources":["../src/ingest-body-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAyFD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,2BAA2B,CAoB9B"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract a draft entry body from a `sharkcraft/ingestion/generated/<X>.draft.ts`
|
|
3
|
+
* file for a given entry id.
|
|
4
|
+
*
|
|
5
|
+
* Extraction strategy:
|
|
6
|
+
* 1. Find the line containing `id: '<id>'`.
|
|
7
|
+
* 2. Walk outwards to find the enclosing `{ ... }` object literal.
|
|
8
|
+
* 3. Return the object literal text (without the leading whitespace) plus a
|
|
9
|
+
* trailing comma. The caller appends it to the live sharkcraft/<file>.ts.
|
|
10
|
+
* 4. If multiple `id: '<id>'` matches exist, or the enclosing block cannot
|
|
11
|
+
* be unambiguously identified, return `null` and let the caller fall back
|
|
12
|
+
* to the comment-stub body.
|
|
13
|
+
*
|
|
14
|
+
* Imports are NOT preserved by this extractor — the caller decides whether
|
|
15
|
+
* to surface a manual checklist for missing imports. Most draft entries are
|
|
16
|
+
* plain object literals with no extra imports.
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
const DRAFT_FILE_CANDIDATES = (target) => {
|
|
21
|
+
// target is `sharkcraft/<file>.ts`; the draft is typically at
|
|
22
|
+
// `sharkcraft/ingestion/generated/<file>.draft.ts`. We try both.
|
|
23
|
+
const base = target.replace(/^sharkcraft\//, '').replace(/\.ts$/, '');
|
|
24
|
+
return [
|
|
25
|
+
`sharkcraft/ingestion/generated/${base}.draft.ts`,
|
|
26
|
+
`sharkcraft/ingestion/drafts/${base}.draft.ts`,
|
|
27
|
+
`sharkcraft/${base}.draft.ts`,
|
|
28
|
+
];
|
|
29
|
+
};
|
|
30
|
+
function findDraftFile(projectRoot, target) {
|
|
31
|
+
for (const rel of DRAFT_FILE_CANDIDATES(target)) {
|
|
32
|
+
const abs = join(projectRoot, rel);
|
|
33
|
+
if (existsSync(abs))
|
|
34
|
+
return abs;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
function extractObjectBlock(content, entryId) {
|
|
39
|
+
// Find every occurrence of `id: '<entryId>'` (allow double quotes too).
|
|
40
|
+
const idRe = new RegExp(`id:\\s*['"]${entryId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}['"]`, 'g');
|
|
41
|
+
const matches = [];
|
|
42
|
+
let m;
|
|
43
|
+
while ((m = idRe.exec(content)) !== null)
|
|
44
|
+
matches.push(m.index);
|
|
45
|
+
if (matches.length === 0) {
|
|
46
|
+
return { status: 'skipped', body: null, reason: `id "${entryId}" not found in draft file` };
|
|
47
|
+
}
|
|
48
|
+
if (matches.length > 1) {
|
|
49
|
+
return {
|
|
50
|
+
status: 'conflict',
|
|
51
|
+
body: null,
|
|
52
|
+
reason: `id "${entryId}" matched ${matches.length} times in draft file — ambiguous, falling back to stub`,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// Walk backwards to find the enclosing `{`.
|
|
56
|
+
const idx = matches[0];
|
|
57
|
+
let openIdx = -1;
|
|
58
|
+
let depth = 0;
|
|
59
|
+
for (let i = idx - 1; i >= 0; i--) {
|
|
60
|
+
const ch = content[i];
|
|
61
|
+
if (ch === '}')
|
|
62
|
+
depth += 1;
|
|
63
|
+
else if (ch === '{') {
|
|
64
|
+
if (depth === 0) {
|
|
65
|
+
openIdx = i;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
depth -= 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (openIdx === -1) {
|
|
72
|
+
return {
|
|
73
|
+
status: 'conflict',
|
|
74
|
+
body: null,
|
|
75
|
+
reason: `Could not find opening brace before "id: ${entryId}".`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Walk forwards from openIdx to find matching `}`.
|
|
79
|
+
let closeIdx = -1;
|
|
80
|
+
depth = 0;
|
|
81
|
+
for (let i = openIdx; i < content.length; i++) {
|
|
82
|
+
const ch = content[i];
|
|
83
|
+
if (ch === '{')
|
|
84
|
+
depth += 1;
|
|
85
|
+
else if (ch === '}') {
|
|
86
|
+
depth -= 1;
|
|
87
|
+
if (depth === 0) {
|
|
88
|
+
closeIdx = i;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (closeIdx === -1) {
|
|
94
|
+
return {
|
|
95
|
+
status: 'conflict',
|
|
96
|
+
body: null,
|
|
97
|
+
reason: `Could not find closing brace for entry "${entryId}".`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const block = content.slice(openIdx, closeIdx + 1);
|
|
101
|
+
// Append a trailing comma if the block does not already have one in context.
|
|
102
|
+
// The live file is an array; entries are object literals separated by commas.
|
|
103
|
+
return {
|
|
104
|
+
status: 'materialised',
|
|
105
|
+
body: block + ',',
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export function extractIngestBody(input) {
|
|
109
|
+
const draftFile = findDraftFile(input.projectRoot, input.target);
|
|
110
|
+
if (!draftFile) {
|
|
111
|
+
return {
|
|
112
|
+
status: 'skipped',
|
|
113
|
+
body: null,
|
|
114
|
+
reason: `No draft file found for target "${input.target}". Use comment stub.`,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
let content;
|
|
118
|
+
try {
|
|
119
|
+
content = readFileSync(draftFile, 'utf8');
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
return {
|
|
123
|
+
status: 'skipped',
|
|
124
|
+
body: null,
|
|
125
|
+
reason: `Failed to read draft file: ${e.message}`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return extractObjectBlock(content, input.entryId);
|
|
129
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type IRepositoryKnowledgeModel } from './repository-knowledge-model.js';
|
|
2
|
+
export interface IWrittenIngestFile {
|
|
3
|
+
path: string;
|
|
4
|
+
bytes: number;
|
|
5
|
+
}
|
|
6
|
+
export interface IWriteIngestDraftsOptions {
|
|
7
|
+
projectRoot: string;
|
|
8
|
+
/** Override the output directory. Default: `<projectRoot>/sharkcraft/ingestion`. */
|
|
9
|
+
outDir?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IWriteIngestDraftsResult {
|
|
12
|
+
outDir: string;
|
|
13
|
+
files: readonly IWrittenIngestFile[];
|
|
14
|
+
}
|
|
15
|
+
export declare function writeIngestDrafts(model: IRepositoryKnowledgeModel, options: IWriteIngestDraftsOptions): IWriteIngestDraftsResult;
|
|
16
|
+
//# sourceMappingURL=ingest-drafts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest-drafts.d.ts","sourceRoot":"","sources":["../src/ingest-drafts.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,iCAAiC,CAAC;AAKzC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,oFAAoF;IACpF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACtC;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,yBAAyB,EAChC,OAAO,EAAE,yBAAyB,GACjC,wBAAwB,CAiD1B"}
|