@shrkcrft/cli 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/asset-preview/apply-action-hint-stub.d.ts +28 -0
- package/dist/asset-preview/apply-action-hint-stub.d.ts.map +1 -0
- package/dist/asset-preview/apply-action-hint-stub.js +170 -0
- package/dist/asset-preview/apply-asset-preview.d.ts +31 -0
- package/dist/asset-preview/apply-asset-preview.d.ts.map +1 -0
- package/dist/asset-preview/apply-asset-preview.js +210 -0
- package/dist/asset-preview/apply-knowledge-stale-fix.d.ts +37 -0
- package/dist/asset-preview/apply-knowledge-stale-fix.d.ts.map +1 -0
- package/dist/asset-preview/apply-knowledge-stale-fix.js +344 -0
- package/dist/asset-preview/apply-missing-barrel.d.ts +15 -0
- package/dist/asset-preview/apply-missing-barrel.d.ts.map +1 -0
- package/dist/asset-preview/apply-missing-barrel.js +65 -0
- package/dist/asset-preview/apply-template-drift-fix.d.ts +21 -0
- package/dist/asset-preview/apply-template-drift-fix.d.ts.map +1 -0
- package/dist/asset-preview/apply-template-drift-fix.js +125 -0
- package/dist/asset-preview/apply-template-update.d.ts +43 -0
- package/dist/asset-preview/apply-template-update.d.ts.map +1 -0
- package/dist/asset-preview/apply-template-update.js +257 -0
- package/dist/asset-preview/entry-mutator.d.ts +106 -0
- package/dist/asset-preview/entry-mutator.d.ts.map +1 -0
- package/dist/asset-preview/entry-mutator.js +428 -0
- package/dist/authoring/authoring-kit.d.ts +36 -0
- package/dist/authoring/authoring-kit.d.ts.map +1 -0
- package/dist/authoring/authoring-kit.js +106 -0
- package/dist/command-registry.d.ts +158 -0
- package/dist/command-registry.d.ts.map +1 -0
- package/dist/command-registry.js +348 -0
- package/dist/commands/apply.command.d.ts +3 -0
- package/dist/commands/apply.command.d.ts.map +1 -0
- package/dist/commands/apply.command.js +879 -0
- package/dist/commands/architecture.command.d.ts +5 -0
- package/dist/commands/architecture.command.d.ts.map +1 -0
- package/dist/commands/architecture.command.js +141 -0
- package/dist/commands/ask.command.d.ts +3 -0
- package/dist/commands/ask.command.d.ts.map +1 -0
- package/dist/commands/ask.command.js +58 -0
- package/dist/commands/audit.command.d.ts +3 -0
- package/dist/commands/audit.command.d.ts.map +1 -0
- package/dist/commands/audit.command.js +141 -0
- package/dist/commands/biome.command.d.ts +7 -0
- package/dist/commands/biome.command.d.ts.map +1 -0
- package/dist/commands/biome.command.js +350 -0
- package/dist/commands/boundaries.command.d.ts +9 -0
- package/dist/commands/boundaries.command.d.ts.map +1 -0
- package/dist/commands/boundaries.command.js +326 -0
- package/dist/commands/brief.command.d.ts +3 -0
- package/dist/commands/brief.command.d.ts.map +1 -0
- package/dist/commands/brief.command.js +206 -0
- package/dist/commands/bundle.command.d.ts +3 -0
- package/dist/commands/bundle.command.d.ts.map +1 -0
- package/dist/commands/bundle.command.js +1183 -0
- package/dist/commands/changes.command.d.ts +3 -0
- package/dist/commands/changes.command.d.ts.map +1 -0
- package/dist/commands/changes.command.js +155 -0
- package/dist/commands/check.command.d.ts +3 -0
- package/dist/commands/check.command.d.ts.map +1 -0
- package/dist/commands/check.command.js +580 -0
- package/dist/commands/checks.command.d.ts +29 -0
- package/dist/commands/checks.command.d.ts.map +1 -0
- package/dist/commands/checks.command.js +521 -0
- package/dist/commands/ci.command.d.ts +3 -0
- package/dist/commands/ci.command.d.ts.map +1 -0
- package/dist/commands/ci.command.js +680 -0
- package/dist/commands/codemod.command.d.ts +3 -0
- package/dist/commands/codemod.command.d.ts.map +1 -0
- package/dist/commands/codemod.command.js +130 -0
- package/dist/commands/command-catalog.d.ts +265 -0
- package/dist/commands/command-catalog.d.ts.map +1 -0
- package/dist/commands/command-catalog.js +3255 -0
- package/dist/commands/commands.command.d.ts +92 -0
- package/dist/commands/commands.command.d.ts.map +1 -0
- package/dist/commands/commands.command.js +1208 -0
- package/dist/commands/constructs.command.d.ts +15 -0
- package/dist/commands/constructs.command.d.ts.map +1 -0
- package/dist/commands/constructs.command.js +669 -0
- package/dist/commands/context.command.d.ts +3 -0
- package/dist/commands/context.command.d.ts.map +1 -0
- package/dist/commands/context.command.js +120 -0
- package/dist/commands/contract-gate.command.d.ts +5 -0
- package/dist/commands/contract-gate.command.d.ts.map +1 -0
- package/dist/commands/contract-gate.command.js +208 -0
- package/dist/commands/contract-templates.command.d.ts +8 -0
- package/dist/commands/contract-templates.command.d.ts.map +1 -0
- package/dist/commands/contract-templates.command.js +151 -0
- package/dist/commands/contract.command.d.ts +3 -0
- package/dist/commands/contract.command.d.ts.map +1 -0
- package/dist/commands/contract.command.js +105 -0
- package/dist/commands/conventions.command.d.ts +8 -0
- package/dist/commands/conventions.command.d.ts.map +1 -0
- package/dist/commands/conventions.command.js +169 -0
- package/dist/commands/coverage.command.d.ts +3 -0
- package/dist/commands/coverage.command.d.ts.map +1 -0
- package/dist/commands/coverage.command.js +56 -0
- package/dist/commands/daily.commands.d.ts +5 -0
- package/dist/commands/daily.commands.d.ts.map +1 -0
- package/dist/commands/daily.commands.js +224 -0
- package/dist/commands/dashboard-export.command.d.ts +4 -0
- package/dist/commands/dashboard-export.command.d.ts.map +1 -0
- package/dist/commands/dashboard-export.command.js +86 -0
- package/dist/commands/dashboard.command.d.ts +3 -0
- package/dist/commands/dashboard.command.d.ts.map +1 -0
- package/dist/commands/dashboard.command.js +106 -0
- package/dist/commands/dev.command.d.ts +3 -0
- package/dist/commands/dev.command.d.ts.map +1 -0
- package/dist/commands/dev.command.js +1392 -0
- package/dist/commands/diagnostics.command.d.ts +5 -0
- package/dist/commands/diagnostics.command.d.ts.map +1 -0
- package/dist/commands/diagnostics.command.js +97 -0
- package/dist/commands/docs.command.d.ts +4 -0
- package/dist/commands/docs.command.d.ts.map +1 -0
- package/dist/commands/docs.command.js +34 -0
- package/dist/commands/doctor.command.d.ts +7 -0
- package/dist/commands/doctor.command.d.ts.map +1 -0
- package/dist/commands/doctor.command.js +682 -0
- package/dist/commands/drift.command.d.ts +3 -0
- package/dist/commands/drift.command.d.ts.map +1 -0
- package/dist/commands/drift.command.js +124 -0
- package/dist/commands/eslint.command.d.ts +7 -0
- package/dist/commands/eslint.command.d.ts.map +1 -0
- package/dist/commands/eslint.command.js +423 -0
- package/dist/commands/explore.command.d.ts +3 -0
- package/dist/commands/explore.command.d.ts.map +1 -0
- package/dist/commands/explore.command.js +65 -0
- package/dist/commands/export-bundle.command.d.ts +6 -0
- package/dist/commands/export-bundle.command.d.ts.map +1 -0
- package/dist/commands/export-bundle.command.js +96 -0
- package/dist/commands/export.command.d.ts +3 -0
- package/dist/commands/export.command.d.ts.map +1 -0
- package/dist/commands/export.command.js +83 -0
- package/dist/commands/feedback-dispatch.command.d.ts +12 -0
- package/dist/commands/feedback-dispatch.command.d.ts.map +1 -0
- package/dist/commands/feedback-dispatch.command.js +63 -0
- package/dist/commands/feedback.command.d.ts +11 -0
- package/dist/commands/feedback.command.d.ts.map +1 -0
- package/dist/commands/feedback.command.js +336 -0
- package/dist/commands/fix.command.d.ts +3 -0
- package/dist/commands/fix.command.d.ts.map +1 -0
- package/dist/commands/fix.command.js +776 -0
- package/dist/commands/gen.command.d.ts +3 -0
- package/dist/commands/gen.command.d.ts.map +1 -0
- package/dist/commands/gen.command.js +136 -0
- package/dist/commands/git.command.d.ts +6 -0
- package/dist/commands/git.command.d.ts.map +1 -0
- package/dist/commands/git.command.js +81 -0
- package/dist/commands/graph.command.d.ts +3 -0
- package/dist/commands/graph.command.d.ts.map +1 -0
- package/dist/commands/graph.command.js +287 -0
- package/dist/commands/grounding.command.d.ts +7 -0
- package/dist/commands/grounding.command.d.ts.map +1 -0
- package/dist/commands/grounding.command.js +54 -0
- package/dist/commands/help.command.d.ts +20 -0
- package/dist/commands/help.command.d.ts.map +1 -0
- package/dist/commands/help.command.js +129 -0
- package/dist/commands/helper.command.d.ts +6 -0
- package/dist/commands/helper.command.d.ts.map +1 -0
- package/dist/commands/helper.command.js +170 -0
- package/dist/commands/ide.command.d.ts +6 -0
- package/dist/commands/ide.command.d.ts.map +1 -0
- package/dist/commands/ide.command.js +340 -0
- package/dist/commands/impact.command.d.ts +3 -0
- package/dist/commands/impact.command.d.ts.map +1 -0
- package/dist/commands/impact.command.js +819 -0
- package/dist/commands/import.command.d.ts +3 -0
- package/dist/commands/import.command.d.ts.map +1 -0
- package/dist/commands/import.command.js +115 -0
- package/dist/commands/infer.command.d.ts +3 -0
- package/dist/commands/infer.command.d.ts.map +1 -0
- package/dist/commands/infer.command.js +227 -0
- package/dist/commands/ingest.command.d.ts +6 -0
- package/dist/commands/ingest.command.d.ts.map +1 -0
- package/dist/commands/ingest.command.js +532 -0
- package/dist/commands/init.command.d.ts +3 -0
- package/dist/commands/init.command.d.ts.map +1 -0
- package/dist/commands/init.command.js +300 -0
- package/dist/commands/inspect.command.d.ts +3 -0
- package/dist/commands/inspect.command.d.ts.map +1 -0
- package/dist/commands/inspect.command.js +122 -0
- package/dist/commands/knowledge-author.command.d.ts +22 -0
- package/dist/commands/knowledge-author.command.d.ts.map +1 -0
- package/dist/commands/knowledge-author.command.js +366 -0
- package/dist/commands/knowledge-propose.command.d.ts +3 -0
- package/dist/commands/knowledge-propose.command.d.ts.map +1 -0
- package/dist/commands/knowledge-propose.command.js +125 -0
- package/dist/commands/knowledge.command.d.ts +18 -0
- package/dist/commands/knowledge.command.d.ts.map +1 -0
- package/dist/commands/knowledge.command.js +538 -0
- package/dist/commands/languages.command.d.ts +3 -0
- package/dist/commands/languages.command.d.ts.map +1 -0
- package/dist/commands/languages.command.js +300 -0
- package/dist/commands/lint.command.d.ts +15 -0
- package/dist/commands/lint.command.d.ts.map +1 -0
- package/dist/commands/lint.command.js +194 -0
- package/dist/commands/mcp.command.d.ts +3 -0
- package/dist/commands/mcp.command.d.ts.map +1 -0
- package/dist/commands/mcp.command.js +203 -0
- package/dist/commands/memory.command.d.ts +11 -0
- package/dist/commands/memory.command.d.ts.map +1 -0
- package/dist/commands/memory.command.js +264 -0
- package/dist/commands/onboard.command.d.ts +3 -0
- package/dist/commands/onboard.command.d.ts.map +1 -0
- package/dist/commands/onboard.command.js +662 -0
- package/dist/commands/orchestrate.command.d.ts +3 -0
- package/dist/commands/orchestrate.command.d.ts.map +1 -0
- package/dist/commands/orchestrate.command.js +49 -0
- package/dist/commands/owners.command.d.ts +5 -0
- package/dist/commands/owners.command.d.ts.map +1 -0
- package/dist/commands/owners.command.js +113 -0
- package/dist/commands/ownership.command.d.ts +5 -0
- package/dist/commands/ownership.command.d.ts.map +1 -0
- package/dist/commands/ownership.command.js +117 -0
- package/dist/commands/pack-author.command.d.ts +30 -0
- package/dist/commands/pack-author.command.d.ts.map +1 -0
- package/dist/commands/pack-author.command.js +242 -0
- package/dist/commands/packs-new.d.ts +27 -0
- package/dist/commands/packs-new.d.ts.map +1 -0
- package/dist/commands/packs-new.js +805 -0
- package/dist/commands/packs.command.d.ts +15 -0
- package/dist/commands/packs.command.d.ts.map +1 -0
- package/dist/commands/packs.command.js +964 -0
- package/dist/commands/paths.command.d.ts +6 -0
- package/dist/commands/paths.command.d.ts.map +1 -0
- package/dist/commands/paths.command.js +97 -0
- package/dist/commands/pipelines.command.d.ts +9 -0
- package/dist/commands/pipelines.command.d.ts.map +1 -0
- package/dist/commands/pipelines.command.js +308 -0
- package/dist/commands/plan-check.command.d.ts +27 -0
- package/dist/commands/plan-check.command.d.ts.map +1 -0
- package/dist/commands/plan-check.command.js +150 -0
- package/dist/commands/plan-simulate.command.d.ts +3 -0
- package/dist/commands/plan-simulate.command.d.ts.map +1 -0
- package/dist/commands/plan-simulate.command.js +60 -0
- package/dist/commands/plan.command.d.ts +8 -0
- package/dist/commands/plan.command.d.ts.map +1 -0
- package/dist/commands/plan.command.js +139 -0
- package/dist/commands/playbooks.command.d.ts +10 -0
- package/dist/commands/playbooks.command.d.ts.map +1 -0
- package/dist/commands/playbooks.command.js +296 -0
- package/dist/commands/plugin.command.d.ts +11 -0
- package/dist/commands/plugin.command.d.ts.map +1 -0
- package/dist/commands/plugin.command.js +394 -0
- package/dist/commands/policy.command.d.ts +8 -0
- package/dist/commands/policy.command.d.ts.map +1 -0
- package/dist/commands/policy.command.js +451 -0
- package/dist/commands/pr.command.d.ts +3 -0
- package/dist/commands/pr.command.d.ts.map +1 -0
- package/dist/commands/pr.command.js +132 -0
- package/dist/commands/preflight.command.d.ts +3 -0
- package/dist/commands/preflight.command.d.ts.map +1 -0
- package/dist/commands/preflight.command.js +102 -0
- package/dist/commands/presets.command.d.ts +17 -0
- package/dist/commands/presets.command.d.ts.map +1 -0
- package/dist/commands/presets.command.js +647 -0
- package/dist/commands/profiles.command.d.ts +7 -0
- package/dist/commands/profiles.command.d.ts.map +1 -0
- package/dist/commands/profiles.command.js +151 -0
- package/dist/commands/provenance.command.d.ts +26 -0
- package/dist/commands/provenance.command.d.ts.map +1 -0
- package/dist/commands/provenance.command.js +237 -0
- package/dist/commands/quality.command.d.ts +5 -0
- package/dist/commands/quality.command.d.ts.map +1 -0
- package/dist/commands/quality.command.js +69 -0
- package/dist/commands/recommend.command.d.ts +4 -0
- package/dist/commands/recommend.command.d.ts.map +1 -0
- package/dist/commands/recommend.command.js +270 -0
- package/dist/commands/registrations.command.d.ts +3 -0
- package/dist/commands/registrations.command.d.ts.map +1 -0
- package/dist/commands/registrations.command.js +300 -0
- package/dist/commands/registry.command.d.ts +4 -0
- package/dist/commands/registry.command.d.ts.map +1 -0
- package/dist/commands/registry.command.js +37 -0
- package/dist/commands/release.command.d.ts +4 -0
- package/dist/commands/release.command.d.ts.map +1 -0
- package/dist/commands/release.command.js +639 -0
- package/dist/commands/repo.command.d.ts +3 -0
- package/dist/commands/repo.command.d.ts.map +1 -0
- package/dist/commands/repo.command.js +24 -0
- package/dist/commands/report.command.d.ts +3 -0
- package/dist/commands/report.command.d.ts.map +1 -0
- package/dist/commands/report.command.js +511 -0
- package/dist/commands/reposet.command.d.ts +6 -0
- package/dist/commands/reposet.command.d.ts.map +1 -0
- package/dist/commands/reposet.command.js +120 -0
- package/dist/commands/review.command.d.ts +3 -0
- package/dist/commands/review.command.d.ts.map +1 -0
- package/dist/commands/review.command.js +380 -0
- package/dist/commands/risk.command.d.ts +3 -0
- package/dist/commands/risk.command.d.ts.map +1 -0
- package/dist/commands/risk.command.js +56 -0
- package/dist/commands/rounds.command.d.ts +8 -0
- package/dist/commands/rounds.command.d.ts.map +1 -0
- package/dist/commands/rounds.command.js +180 -0
- package/dist/commands/rules.command.d.ts +49 -0
- package/dist/commands/rules.command.d.ts.map +1 -0
- package/dist/commands/rules.command.js +435 -0
- package/dist/commands/runtime.command.d.ts +3 -0
- package/dist/commands/runtime.command.d.ts.map +1 -0
- package/dist/commands/runtime.command.js +56 -0
- package/dist/commands/safety.command.d.ts +3 -0
- package/dist/commands/safety.command.d.ts.map +1 -0
- package/dist/commands/safety.command.js +117 -0
- package/dist/commands/scaffolds.command.d.ts +5 -0
- package/dist/commands/scaffolds.command.d.ts.map +1 -0
- package/dist/commands/scaffolds.command.js +122 -0
- package/dist/commands/schemas.command.d.ts +21 -0
- package/dist/commands/schemas.command.d.ts.map +1 -0
- package/dist/commands/schemas.command.js +296 -0
- package/dist/commands/search.command.d.ts +12 -0
- package/dist/commands/search.command.d.ts.map +1 -0
- package/dist/commands/search.command.js +275 -0
- package/dist/commands/self-config.command.d.ts +7 -0
- package/dist/commands/self-config.command.d.ts.map +1 -0
- package/dist/commands/self-config.command.js +156 -0
- package/dist/commands/self.command.d.ts +3 -0
- package/dist/commands/self.command.d.ts.map +1 -0
- package/dist/commands/self.command.js +117 -0
- package/dist/commands/simulate.command.d.ts +3 -0
- package/dist/commands/simulate.command.d.ts.map +1 -0
- package/dist/commands/simulate.command.js +54 -0
- package/dist/commands/spec.command.d.ts +29 -0
- package/dist/commands/spec.command.d.ts.map +1 -0
- package/dist/commands/spec.command.js +985 -0
- package/dist/commands/start-here.command.d.ts +3 -0
- package/dist/commands/start-here.command.d.ts.map +1 -0
- package/dist/commands/start-here.command.js +35 -0
- package/dist/commands/stats.command.d.ts +3 -0
- package/dist/commands/stats.command.d.ts.map +1 -0
- package/dist/commands/stats.command.js +88 -0
- package/dist/commands/surface.command.d.ts +15 -0
- package/dist/commands/surface.command.d.ts.map +1 -0
- package/dist/commands/surface.command.js +328 -0
- package/dist/commands/task-context.command.d.ts +7 -0
- package/dist/commands/task-context.command.d.ts.map +1 -0
- package/dist/commands/task-context.command.js +646 -0
- package/dist/commands/task.command.d.ts +3 -0
- package/dist/commands/task.command.d.ts.map +1 -0
- package/dist/commands/task.command.js +301 -0
- package/dist/commands/template-quality.command.d.ts +5 -0
- package/dist/commands/template-quality.command.d.ts.map +1 -0
- package/dist/commands/template-quality.command.js +128 -0
- package/dist/commands/templates.command.d.ts +26 -0
- package/dist/commands/templates.command.d.ts.map +1 -0
- package/dist/commands/templates.command.js +964 -0
- package/dist/commands/test.command.d.ts +3 -0
- package/dist/commands/test.command.d.ts.map +1 -0
- package/dist/commands/test.command.js +262 -0
- package/dist/commands/tests.command.d.ts +5 -0
- package/dist/commands/tests.command.d.ts.map +1 -0
- package/dist/commands/tests.command.js +97 -0
- package/dist/commands/trace.command.d.ts +3 -0
- package/dist/commands/trace.command.d.ts.map +1 -0
- package/dist/commands/trace.command.js +121 -0
- package/dist/commands/upgrade.command.d.ts +4 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -0
- package/dist/commands/upgrade.command.js +43 -0
- package/dist/commands/version.command.d.ts +3 -0
- package/dist/commands/version.command.d.ts.map +1 -0
- package/dist/commands/version.command.js +10 -0
- package/dist/commands/why.command.d.ts +24 -0
- package/dist/commands/why.command.d.ts.map +1 -0
- package/dist/commands/why.command.js +119 -0
- package/dist/dashboard/dashboard-api-server.d.ts +21 -0
- package/dist/dashboard/dashboard-api-server.d.ts.map +1 -0
- package/dist/dashboard/dashboard-api-server.js +410 -0
- package/dist/dashboard/live-session-server.d.ts +18 -0
- package/dist/dashboard/live-session-server.d.ts.map +1 -0
- package/dist/dashboard/live-session-server.js +133 -0
- package/dist/diff/collect-changed-paths.d.ts +27 -0
- package/dist/diff/collect-changed-paths.d.ts.map +1 -0
- package/dist/diff/collect-changed-paths.js +68 -0
- package/dist/doctor/doctor-tags.d.ts +63 -0
- package/dist/doctor/doctor-tags.d.ts.map +1 -0
- package/dist/doctor/doctor-tags.js +146 -0
- package/dist/export/export-formats.d.ts +22 -0
- package/dist/export/export-formats.d.ts.map +1 -0
- package/dist/export/export-formats.js +135 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/init/detected-block.d.ts +57 -0
- package/dist/init/detected-block.d.ts.map +1 -0
- package/dist/init/detected-block.js +197 -0
- package/dist/init/gitignore.d.ts +30 -0
- package/dist/init/gitignore.d.ts.map +1 -0
- package/dist/init/gitignore.js +110 -0
- package/dist/init/init-templates.d.ts +6 -0
- package/dist/init/init-templates.d.ts.map +1 -0
- package/dist/init/init-templates.js +413 -0
- package/dist/main.d.ts +18 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +721 -0
- package/dist/output/failure-hints.d.ts +63 -0
- package/dist/output/failure-hints.d.ts.map +1 -0
- package/dist/output/failure-hints.js +165 -0
- package/dist/output/format-output.d.ts +9 -0
- package/dist/output/format-output.d.ts.map +1 -0
- package/dist/output/format-output.js +26 -0
- package/dist/output/print-error.d.ts +3 -0
- package/dist/output/print-error.d.ts.map +1 -0
- package/dist/output/print-error.js +14 -0
- package/dist/output/watch-loop.d.ts +37 -0
- package/dist/output/watch-loop.d.ts.map +1 -0
- package/dist/output/watch-loop.js +115 -0
- package/dist/schemas/json-schemas.d.ts +1630 -0
- package/dist/schemas/json-schemas.d.ts.map +1 -0
- package/dist/schemas/json-schemas.js +811 -0
- package/dist/surface/about.d.ts +10 -0
- package/dist/surface/about.d.ts.map +1 -0
- package/dist/surface/about.js +31 -0
- package/dist/surface/load-surface-context.d.ts +34 -0
- package/dist/surface/load-surface-context.d.ts.map +1 -0
- package/dist/surface/load-surface-context.js +100 -0
- package/dist/surface/no-args-landing.d.ts +7 -0
- package/dist/surface/no-args-landing.d.ts.map +1 -0
- package/dist/surface/no-args-landing.js +40 -0
- package/dist/surface/not-enabled-error.d.ts +24 -0
- package/dist/surface/not-enabled-error.d.ts.map +1 -0
- package/dist/surface/not-enabled-error.js +36 -0
- package/dist/surface/profiles.d.ts +37 -0
- package/dist/surface/profiles.d.ts.map +1 -0
- package/dist/surface/profiles.js +151 -0
- package/dist/surface/shape-defaults.d.ts +21 -0
- package/dist/surface/shape-defaults.d.ts.map +1 -0
- package/dist/surface/shape-defaults.js +50 -0
- package/dist/surface/spine-extractor.d.ts +38 -0
- package/dist/surface/spine-extractor.d.ts.map +1 -0
- package/dist/surface/spine-extractor.js +100 -0
- package/dist/surface/surface-config-writer.d.ts +59 -0
- package/dist/surface/surface-config-writer.d.ts.map +1 -0
- package/dist/surface/surface-config-writer.js +135 -0
- package/dist/surface/surface-summary.d.ts +66 -0
- package/dist/surface/surface-summary.d.ts.map +1 -0
- package/dist/surface/surface-summary.js +162 -0
- package/dist/surface/tier.d.ts +100 -0
- package/dist/surface/tier.d.ts.map +1 -0
- package/dist/surface/tier.js +172 -0
- package/dist/task-next/apply-batch-runner.d.ts +42 -0
- package/dist/task-next/apply-batch-runner.d.ts.map +1 -0
- package/dist/task-next/apply-batch-runner.js +192 -0
- package/dist/task-next/task-next-ranker.d.ts +75 -0
- package/dist/task-next/task-next-ranker.d.ts.map +1 -0
- package/dist/task-next/task-next-ranker.js +179 -0
- package/dist/usage/usage-log.d.ts +54 -0
- package/dist/usage/usage-log.d.ts.map +1 -0
- package/dist/usage/usage-log.js +105 -0
- package/dist/validation/run-validation-loop.d.ts +38 -0
- package/dist/validation/run-validation-loop.d.ts.map +1 -0
- package/dist/validation/run-validation-loop.js +100 -0
- package/package.json +72 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Knowledge-stale apply splicer.
|
|
3
|
+
*
|
|
4
|
+
* Removes a single stale / missing reference from a knowledge entry's
|
|
5
|
+
* `references[]` array. Pure-text mutation; preview-first under the
|
|
6
|
+
* hood (callers compute the patch with `write: false` for every target
|
|
7
|
+
* before writing).
|
|
8
|
+
*
|
|
9
|
+
* Supports both "drop the reference" and "rename in place" paths;
|
|
10
|
+
* the latter activates when the caller supplies a `renameTo` payload.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import * as nodePath from 'node:path';
|
|
14
|
+
import { findEntryRange, removeArrayEntries } from "./entry-mutator.js";
|
|
15
|
+
function escapesCwd(cwd, absPath) {
|
|
16
|
+
const rel = nodePath.relative(cwd, absPath);
|
|
17
|
+
return rel.startsWith('..') || nodePath.isAbsolute(rel);
|
|
18
|
+
}
|
|
19
|
+
function buildUnifiedDiff(rel, a, b) {
|
|
20
|
+
const aLines = a.split('\n');
|
|
21
|
+
const bLines = b.split('\n');
|
|
22
|
+
let prefix = 0;
|
|
23
|
+
while (prefix < aLines.length && prefix < bLines.length && aLines[prefix] === bLines[prefix]) {
|
|
24
|
+
prefix += 1;
|
|
25
|
+
}
|
|
26
|
+
let suffix = 0;
|
|
27
|
+
while (suffix < aLines.length - prefix &&
|
|
28
|
+
suffix < bLines.length - prefix &&
|
|
29
|
+
aLines[aLines.length - 1 - suffix] === bLines[bLines.length - 1 - suffix]) {
|
|
30
|
+
suffix += 1;
|
|
31
|
+
}
|
|
32
|
+
const aMid = aLines.slice(prefix, aLines.length - suffix);
|
|
33
|
+
const bMid = bLines.slice(prefix, bLines.length - suffix);
|
|
34
|
+
const head = `--- ${rel}\n+++ ${rel}\n@@ -${prefix + 1},${aMid.length} +${prefix + 1},${bMid.length} @@\n`;
|
|
35
|
+
return (head +
|
|
36
|
+
aMid.map((l) => `-${l}`).join('\n') +
|
|
37
|
+
(aMid.length ? '\n' : '') +
|
|
38
|
+
bMid.map((l) => `+${l}`).join('\n'));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Match a `references[]` element string against an `IKnowledgeReference`
|
|
42
|
+
* by `kind` and every identifying field the reference carries (`id`,
|
|
43
|
+
* `path`, `symbol`). When the reference has multiple identifying fields
|
|
44
|
+
* (e.g. symbol refs typically have both `symbol` and `path`), the
|
|
45
|
+
* element must match ALL of them — otherwise we risk matching the
|
|
46
|
+
* wrong neighbor.
|
|
47
|
+
*/
|
|
48
|
+
function elementMatchesReference(element, ref) {
|
|
49
|
+
const escapedKind = ref.kind.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
50
|
+
const kindRe = new RegExp(`\\bkind\\s*:\\s*['"]${escapedKind}['"]`);
|
|
51
|
+
if (!kindRe.test(element))
|
|
52
|
+
return false;
|
|
53
|
+
const id = ref.id;
|
|
54
|
+
const path = ref.path;
|
|
55
|
+
const symbol = ref.symbol;
|
|
56
|
+
// Each present identifying field must match.
|
|
57
|
+
const checks = [];
|
|
58
|
+
if (id !== undefined)
|
|
59
|
+
checks.push({ key: 'id', value: id });
|
|
60
|
+
if (path !== undefined)
|
|
61
|
+
checks.push({ key: 'path', value: path });
|
|
62
|
+
if (symbol !== undefined)
|
|
63
|
+
checks.push({ key: 'symbol', value: symbol });
|
|
64
|
+
if (checks.length === 0)
|
|
65
|
+
return false;
|
|
66
|
+
for (const c of checks) {
|
|
67
|
+
const escapedValue = c.value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
68
|
+
const re = new RegExp(`\\b${c.key}\\s*:\\s*['"]${escapedValue}['"]`);
|
|
69
|
+
if (!re.test(element))
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Rewrite a matching reference element's identifying field
|
|
76
|
+
* in place. Returns the new body and whether the rewrite landed.
|
|
77
|
+
*
|
|
78
|
+
* The rewrite is intentionally narrow: it operates on the single
|
|
79
|
+
* element string identified by `elementMatchesReference` and swaps
|
|
80
|
+
* the relevant field's quoted value. The rest of the entry (kind,
|
|
81
|
+
* other fields, surrounding entries) is untouched.
|
|
82
|
+
*/
|
|
83
|
+
function renameReferenceInElement(element, ref, renameTo) {
|
|
84
|
+
let next = element;
|
|
85
|
+
let renamed = false;
|
|
86
|
+
const rewrite = (key, oldValue, newValue) => {
|
|
87
|
+
if (!newValue || !oldValue)
|
|
88
|
+
return;
|
|
89
|
+
const escapedKey = key;
|
|
90
|
+
const escapedOld = oldValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
91
|
+
const re = new RegExp(`(\\b${escapedKey}\\s*:\\s*['"])${escapedOld}(['"])`);
|
|
92
|
+
if (re.test(next)) {
|
|
93
|
+
next = next.replace(re, (_m, head, tail) => head + newValue + tail);
|
|
94
|
+
renamed = true;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const id = ref.id;
|
|
98
|
+
const path = ref.path;
|
|
99
|
+
const symbol = ref.symbol;
|
|
100
|
+
if (renameTo.path !== undefined)
|
|
101
|
+
rewrite('path', path, renameTo.path);
|
|
102
|
+
if (renameTo.id !== undefined)
|
|
103
|
+
rewrite('id', id, renameTo.id);
|
|
104
|
+
if (renameTo.symbol !== undefined)
|
|
105
|
+
rewrite('symbol', symbol, renameTo.symbol);
|
|
106
|
+
return { next, renamed };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Replace the matching reference element inside an entry's
|
|
110
|
+
* `references[]` array. The bracket-balanced scan is intentional —
|
|
111
|
+
* the same parsing rules as `removeArrayEntries` so we don't break
|
|
112
|
+
* on nested objects or strings containing commas.
|
|
113
|
+
*/
|
|
114
|
+
function replaceReferenceElement(body, open, close, ref, renameTo) {
|
|
115
|
+
// Find `references: [` inside [open..close].
|
|
116
|
+
const slice = body.slice(open, close + 1);
|
|
117
|
+
const fm = /\breferences\s*:\s*\[/.exec(slice);
|
|
118
|
+
if (!fm)
|
|
119
|
+
return { body, renamed: false };
|
|
120
|
+
const arrayOpenIdx = open + fm.index + fm[0].length - 1;
|
|
121
|
+
// Walk to matching `]` with string + bracket awareness.
|
|
122
|
+
let depth = 0;
|
|
123
|
+
let arrayCloseIdx = -1;
|
|
124
|
+
let inString = null;
|
|
125
|
+
let escape = false;
|
|
126
|
+
for (let i = arrayOpenIdx; i < body.length; i++) {
|
|
127
|
+
const c = body[i];
|
|
128
|
+
if (escape) {
|
|
129
|
+
escape = false;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (inString) {
|
|
133
|
+
if (c === '\\') {
|
|
134
|
+
escape = true;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (c === inString)
|
|
138
|
+
inString = null;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
142
|
+
inString = c;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (c === '[' || c === '{' || c === '(')
|
|
146
|
+
depth++;
|
|
147
|
+
else if (c === ']' || c === '}' || c === ')') {
|
|
148
|
+
depth--;
|
|
149
|
+
if (depth === 0 && c === ']') {
|
|
150
|
+
arrayCloseIdx = i;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (arrayCloseIdx === -1)
|
|
156
|
+
return { body, renamed: false };
|
|
157
|
+
const inner = body.slice(arrayOpenIdx + 1, arrayCloseIdx);
|
|
158
|
+
// Split at top-level commas (lightweight inline implementation —
|
|
159
|
+
// keeps this module self-contained).
|
|
160
|
+
const parts = [];
|
|
161
|
+
{
|
|
162
|
+
let d = 0;
|
|
163
|
+
let s = null;
|
|
164
|
+
let e = false;
|
|
165
|
+
let start = 0;
|
|
166
|
+
for (let i = 0; i < inner.length; i++) {
|
|
167
|
+
const c = inner[i];
|
|
168
|
+
if (e) {
|
|
169
|
+
e = false;
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (s) {
|
|
173
|
+
if (c === '\\') {
|
|
174
|
+
e = true;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (c === s)
|
|
178
|
+
s = null;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
182
|
+
s = c;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (c === '[' || c === '{' || c === '(')
|
|
186
|
+
d++;
|
|
187
|
+
else if (c === ']' || c === '}' || c === ')')
|
|
188
|
+
d--;
|
|
189
|
+
else if (c === ',' && d === 0) {
|
|
190
|
+
parts.push(inner.slice(start, i));
|
|
191
|
+
start = i + 1;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
parts.push(inner.slice(start));
|
|
195
|
+
}
|
|
196
|
+
let renamed = false;
|
|
197
|
+
const next = [];
|
|
198
|
+
for (const p of parts) {
|
|
199
|
+
if (!renamed && elementMatchesReference(p, ref)) {
|
|
200
|
+
const r = renameReferenceInElement(p, ref, renameTo);
|
|
201
|
+
next.push(r.next);
|
|
202
|
+
renamed = r.renamed;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
next.push(p);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (!renamed)
|
|
209
|
+
return { body, renamed: false };
|
|
210
|
+
const newInner = next.join(',');
|
|
211
|
+
return {
|
|
212
|
+
body: body.slice(0, arrayOpenIdx + 1) + newInner + body.slice(arrayCloseIdx),
|
|
213
|
+
renamed: true,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
export function applyKnowledgeStaleFix(input) {
|
|
217
|
+
const cwd = nodePath.resolve(input.cwd);
|
|
218
|
+
const targetAbs = nodePath.resolve(cwd, input.targetPath);
|
|
219
|
+
if (escapesCwd(cwd, targetAbs)) {
|
|
220
|
+
return {
|
|
221
|
+
ok: false,
|
|
222
|
+
refusal: `Target path escapes the project root (cwd=${cwd}).`,
|
|
223
|
+
targetAbs,
|
|
224
|
+
entryId: input.entryId,
|
|
225
|
+
originalLength: 0,
|
|
226
|
+
nextLength: 0,
|
|
227
|
+
removedCount: 0,
|
|
228
|
+
mode: 'drop',
|
|
229
|
+
wrote: false,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (!existsSync(targetAbs)) {
|
|
233
|
+
return {
|
|
234
|
+
ok: false,
|
|
235
|
+
refusal: `Target file not found: ${targetAbs}`,
|
|
236
|
+
targetAbs,
|
|
237
|
+
entryId: input.entryId,
|
|
238
|
+
originalLength: 0,
|
|
239
|
+
nextLength: 0,
|
|
240
|
+
removedCount: 0,
|
|
241
|
+
mode: 'drop',
|
|
242
|
+
wrote: false,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
const body = readFileSync(targetAbs, 'utf8');
|
|
246
|
+
const range = findEntryRange(body, input.entryId);
|
|
247
|
+
if (!range) {
|
|
248
|
+
return {
|
|
249
|
+
ok: false,
|
|
250
|
+
refusal: `Entry "${input.entryId}" not found in ${nodePath.relative(cwd, targetAbs)}.`,
|
|
251
|
+
targetAbs,
|
|
252
|
+
entryId: input.entryId,
|
|
253
|
+
originalLength: body.length,
|
|
254
|
+
nextLength: body.length,
|
|
255
|
+
removedCount: 0,
|
|
256
|
+
mode: input.renameTo ? 'rename' : 'drop',
|
|
257
|
+
wrote: false,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
// Rename path takes precedence when the caller supplied a
|
|
261
|
+
// replacement. Migration is strictly safer than drop.
|
|
262
|
+
if (input.renameTo) {
|
|
263
|
+
const renameResult = replaceReferenceElement(body, range.open, range.close, input.reference, input.renameTo);
|
|
264
|
+
if (!renameResult.renamed) {
|
|
265
|
+
return {
|
|
266
|
+
ok: false,
|
|
267
|
+
refusal: `Reference not found (or already at the new location) in entry "${input.entryId}".`,
|
|
268
|
+
targetAbs,
|
|
269
|
+
entryId: input.entryId,
|
|
270
|
+
originalLength: body.length,
|
|
271
|
+
nextLength: body.length,
|
|
272
|
+
removedCount: 0,
|
|
273
|
+
mode: 'rename',
|
|
274
|
+
wrote: false,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
const nextBody = renameResult.body;
|
|
278
|
+
let wrote = false;
|
|
279
|
+
if (input.write && nextBody !== body) {
|
|
280
|
+
writeFileSync(targetAbs, nextBody, 'utf8');
|
|
281
|
+
wrote = true;
|
|
282
|
+
}
|
|
283
|
+
const rel = nodePath.relative(cwd, targetAbs) || nodePath.basename(targetAbs);
|
|
284
|
+
const diff = buildUnifiedDiff(rel, body, nextBody);
|
|
285
|
+
return {
|
|
286
|
+
ok: true,
|
|
287
|
+
targetAbs,
|
|
288
|
+
entryId: input.entryId,
|
|
289
|
+
originalLength: body.length,
|
|
290
|
+
nextLength: nextBody.length,
|
|
291
|
+
removedCount: 0,
|
|
292
|
+
mode: 'rename',
|
|
293
|
+
diff,
|
|
294
|
+
wrote,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
// Default — drop the reference.
|
|
298
|
+
const result = removeArrayEntries(body, range, 'references', (element) => elementMatchesReference(element, input.reference));
|
|
299
|
+
if (!result) {
|
|
300
|
+
return {
|
|
301
|
+
ok: false,
|
|
302
|
+
refusal: `Entry "${input.entryId}" has no \`references\` array (or it's not a simple bracket form).`,
|
|
303
|
+
targetAbs,
|
|
304
|
+
entryId: input.entryId,
|
|
305
|
+
originalLength: body.length,
|
|
306
|
+
nextLength: body.length,
|
|
307
|
+
removedCount: 0,
|
|
308
|
+
mode: 'drop',
|
|
309
|
+
wrote: false,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
if (result.removedCount === 0) {
|
|
313
|
+
return {
|
|
314
|
+
ok: false,
|
|
315
|
+
refusal: `Reference not found in entry "${input.entryId}" — already removed?`,
|
|
316
|
+
targetAbs,
|
|
317
|
+
entryId: input.entryId,
|
|
318
|
+
originalLength: body.length,
|
|
319
|
+
nextLength: body.length,
|
|
320
|
+
removedCount: 0,
|
|
321
|
+
mode: 'drop',
|
|
322
|
+
wrote: false,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
const nextBody = result.body;
|
|
326
|
+
let wrote = false;
|
|
327
|
+
if (input.write && nextBody !== body) {
|
|
328
|
+
writeFileSync(targetAbs, nextBody, 'utf8');
|
|
329
|
+
wrote = true;
|
|
330
|
+
}
|
|
331
|
+
const rel = nodePath.relative(cwd, targetAbs) || nodePath.basename(targetAbs);
|
|
332
|
+
const diff = buildUnifiedDiff(rel, body, nextBody);
|
|
333
|
+
return {
|
|
334
|
+
ok: true,
|
|
335
|
+
targetAbs,
|
|
336
|
+
entryId: input.entryId,
|
|
337
|
+
originalLength: body.length,
|
|
338
|
+
nextLength: nextBody.length,
|
|
339
|
+
removedCount: result.removedCount,
|
|
340
|
+
mode: 'drop',
|
|
341
|
+
diff,
|
|
342
|
+
wrote,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface IMissingBarrelInput {
|
|
2
|
+
readonly cwd: string;
|
|
3
|
+
/** Project-relative path of the barrel to create. */
|
|
4
|
+
readonly barrelPath: string;
|
|
5
|
+
readonly write: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface IMissingBarrelResult {
|
|
8
|
+
readonly ok: boolean;
|
|
9
|
+
readonly refusal?: string;
|
|
10
|
+
readonly barrelAbs: string;
|
|
11
|
+
readonly bodyWritten?: string;
|
|
12
|
+
readonly wrote: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function applyMissingBarrelFix(input: IMissingBarrelInput): IMissingBarrelResult;
|
|
15
|
+
//# sourceMappingURL=apply-missing-barrel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-missing-barrel.d.ts","sourceRoot":"","sources":["../../src/asset-preview/apply-missing-barrel.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAYD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,mBAAmB,GACzB,oBAAoB,CAwCtB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Missing-barrel auto-create.
|
|
3
|
+
*
|
|
4
|
+
* When `templates drift` flags `missing-barrel` (template's `changes`
|
|
5
|
+
* list has an `export` op pointing at a non-existent index file), the
|
|
6
|
+
* fix is mechanical: create the missing file with a placeholder
|
|
7
|
+
* `export {};` body. The drift warning flips off because the file
|
|
8
|
+
* exists; the human still has to populate the re-exports.
|
|
9
|
+
*
|
|
10
|
+
* Hard rules:
|
|
11
|
+
* - Refuses path-escape on the barrel target.
|
|
12
|
+
* - Refuses pack targets (`node_modules/` or `dist/`).
|
|
13
|
+
* - Idempotent — refuses if the file already exists.
|
|
14
|
+
* - Creates parent directories as needed.
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import * as nodePath from 'node:path';
|
|
18
|
+
const PLACEHOLDER_BODY = '// AUTO-CREATED by `shrk fix --template-drift --apply`.\n' +
|
|
19
|
+
'// Populate with the expected re-exports before the next drift run.\n' +
|
|
20
|
+
'export {};\n';
|
|
21
|
+
function escapesCwd(cwd, absPath) {
|
|
22
|
+
const rel = nodePath.relative(cwd, absPath);
|
|
23
|
+
return rel.startsWith('..') || nodePath.isAbsolute(rel);
|
|
24
|
+
}
|
|
25
|
+
export function applyMissingBarrelFix(input) {
|
|
26
|
+
const cwd = nodePath.resolve(input.cwd);
|
|
27
|
+
const barrelAbs = nodePath.resolve(cwd, input.barrelPath);
|
|
28
|
+
if (escapesCwd(cwd, barrelAbs)) {
|
|
29
|
+
return {
|
|
30
|
+
ok: false,
|
|
31
|
+
refusal: `Barrel path escapes the project root (cwd=${cwd}).`,
|
|
32
|
+
barrelAbs,
|
|
33
|
+
wrote: false,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const rel = nodePath.relative(cwd, barrelAbs);
|
|
37
|
+
if (rel.startsWith('node_modules' + nodePath.sep) || /\bdist\b/.test(rel)) {
|
|
38
|
+
return {
|
|
39
|
+
ok: false,
|
|
40
|
+
refusal: `Barrel target lives in a pack / build artifact (${rel}) — edit the source pack and re-sign instead.`,
|
|
41
|
+
barrelAbs,
|
|
42
|
+
wrote: false,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (existsSync(barrelAbs)) {
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
refusal: `Barrel already exists at ${rel} — nothing to create.`,
|
|
49
|
+
barrelAbs,
|
|
50
|
+
wrote: false,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
let wrote = false;
|
|
54
|
+
if (input.write) {
|
|
55
|
+
mkdirSync(nodePath.dirname(barrelAbs), { recursive: true });
|
|
56
|
+
writeFileSync(barrelAbs, PLACEHOLDER_BODY, 'utf8');
|
|
57
|
+
wrote = true;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
ok: true,
|
|
61
|
+
barrelAbs,
|
|
62
|
+
bodyWritten: PLACEHOLDER_BODY,
|
|
63
|
+
wrote,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ITemplateDriftFixInput {
|
|
2
|
+
readonly cwd: string;
|
|
3
|
+
readonly targetPath: string;
|
|
4
|
+
readonly templateId: string;
|
|
5
|
+
/** Which `related[]` id to drop. */
|
|
6
|
+
readonly droppedRelatedId: string;
|
|
7
|
+
readonly write: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ITemplateDriftFixResult {
|
|
10
|
+
readonly ok: boolean;
|
|
11
|
+
readonly refusal?: string;
|
|
12
|
+
readonly targetAbs: string;
|
|
13
|
+
readonly templateId: string;
|
|
14
|
+
readonly originalLength: number;
|
|
15
|
+
readonly nextLength: number;
|
|
16
|
+
readonly removedCount: number;
|
|
17
|
+
readonly diff?: string;
|
|
18
|
+
readonly wrote: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function applyTemplateDriftFix(input: ITemplateDriftFixInput): ITemplateDriftFixResult;
|
|
21
|
+
//# sourceMappingURL=apply-template-drift-fix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-template-drift-fix.d.ts","sourceRoot":"","sources":["../../src/asset-preview/apply-template-drift-fix.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAiCD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,sBAAsB,GAC5B,uBAAuB,CAoFzB"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template-drift apply splicer.
|
|
3
|
+
*
|
|
4
|
+
* Scope: the `related-id-unresolved` code only.
|
|
5
|
+
* Most template-drift findings (`forbidden-legacy-path`,
|
|
6
|
+
* `missing-anchor`, `missing-produced-anchor`, `missing-barrel`, etc.)
|
|
7
|
+
* are template *body* issues — the `files()` / `changes()` resolver
|
|
8
|
+
* functions need to be edited. Those stay preview-only.
|
|
9
|
+
*
|
|
10
|
+
* For `related-id-unresolved`, the fix is mechanical: drop the
|
|
11
|
+
* unresolved id from the template's `related[]` array.
|
|
12
|
+
*/
|
|
13
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
14
|
+
import * as nodePath from 'node:path';
|
|
15
|
+
import { findEntryRange, removeStringFromArray } from "./entry-mutator.js";
|
|
16
|
+
function escapesCwd(cwd, absPath) {
|
|
17
|
+
const rel = nodePath.relative(cwd, absPath);
|
|
18
|
+
return rel.startsWith('..') || nodePath.isAbsolute(rel);
|
|
19
|
+
}
|
|
20
|
+
function buildUnifiedDiff(rel, a, b) {
|
|
21
|
+
const aLines = a.split('\n');
|
|
22
|
+
const bLines = b.split('\n');
|
|
23
|
+
let prefix = 0;
|
|
24
|
+
while (prefix < aLines.length && prefix < bLines.length && aLines[prefix] === bLines[prefix]) {
|
|
25
|
+
prefix += 1;
|
|
26
|
+
}
|
|
27
|
+
let suffix = 0;
|
|
28
|
+
while (suffix < aLines.length - prefix &&
|
|
29
|
+
suffix < bLines.length - prefix &&
|
|
30
|
+
aLines[aLines.length - 1 - suffix] === bLines[bLines.length - 1 - suffix]) {
|
|
31
|
+
suffix += 1;
|
|
32
|
+
}
|
|
33
|
+
const aMid = aLines.slice(prefix, aLines.length - suffix);
|
|
34
|
+
const bMid = bLines.slice(prefix, bLines.length - suffix);
|
|
35
|
+
const head = `--- ${rel}\n+++ ${rel}\n@@ -${prefix + 1},${aMid.length} +${prefix + 1},${bMid.length} @@\n`;
|
|
36
|
+
return (head +
|
|
37
|
+
aMid.map((l) => `-${l}`).join('\n') +
|
|
38
|
+
(aMid.length ? '\n' : '') +
|
|
39
|
+
bMid.map((l) => `+${l}`).join('\n'));
|
|
40
|
+
}
|
|
41
|
+
export function applyTemplateDriftFix(input) {
|
|
42
|
+
const cwd = nodePath.resolve(input.cwd);
|
|
43
|
+
const targetAbs = nodePath.resolve(cwd, input.targetPath);
|
|
44
|
+
if (escapesCwd(cwd, targetAbs)) {
|
|
45
|
+
return {
|
|
46
|
+
ok: false,
|
|
47
|
+
refusal: `Target path escapes the project root (cwd=${cwd}).`,
|
|
48
|
+
targetAbs,
|
|
49
|
+
templateId: input.templateId,
|
|
50
|
+
originalLength: 0,
|
|
51
|
+
nextLength: 0,
|
|
52
|
+
removedCount: 0,
|
|
53
|
+
wrote: false,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (!existsSync(targetAbs)) {
|
|
57
|
+
return {
|
|
58
|
+
ok: false,
|
|
59
|
+
refusal: `Target file not found: ${targetAbs}`,
|
|
60
|
+
targetAbs,
|
|
61
|
+
templateId: input.templateId,
|
|
62
|
+
originalLength: 0,
|
|
63
|
+
nextLength: 0,
|
|
64
|
+
removedCount: 0,
|
|
65
|
+
wrote: false,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const body = readFileSync(targetAbs, 'utf8');
|
|
69
|
+
const range = findEntryRange(body, input.templateId);
|
|
70
|
+
if (!range) {
|
|
71
|
+
return {
|
|
72
|
+
ok: false,
|
|
73
|
+
refusal: `Template "${input.templateId}" not found in ${nodePath.relative(cwd, targetAbs)}.`,
|
|
74
|
+
targetAbs,
|
|
75
|
+
templateId: input.templateId,
|
|
76
|
+
originalLength: body.length,
|
|
77
|
+
nextLength: body.length,
|
|
78
|
+
removedCount: 0,
|
|
79
|
+
wrote: false,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const result = removeStringFromArray(body, range, 'related', input.droppedRelatedId);
|
|
83
|
+
if (!result) {
|
|
84
|
+
return {
|
|
85
|
+
ok: false,
|
|
86
|
+
refusal: `Template "${input.templateId}" has no \`related\` array (or it's not a simple bracket form).`,
|
|
87
|
+
targetAbs,
|
|
88
|
+
templateId: input.templateId,
|
|
89
|
+
originalLength: body.length,
|
|
90
|
+
nextLength: body.length,
|
|
91
|
+
removedCount: 0,
|
|
92
|
+
wrote: false,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
if (result.removedCount === 0) {
|
|
96
|
+
return {
|
|
97
|
+
ok: false,
|
|
98
|
+
refusal: `Related id "${input.droppedRelatedId}" not present in "${input.templateId}" — already removed?`,
|
|
99
|
+
targetAbs,
|
|
100
|
+
templateId: input.templateId,
|
|
101
|
+
originalLength: body.length,
|
|
102
|
+
nextLength: body.length,
|
|
103
|
+
removedCount: 0,
|
|
104
|
+
wrote: false,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const nextBody = result.body;
|
|
108
|
+
let wrote = false;
|
|
109
|
+
if (input.write && nextBody !== body) {
|
|
110
|
+
writeFileSync(targetAbs, nextBody, 'utf8');
|
|
111
|
+
wrote = true;
|
|
112
|
+
}
|
|
113
|
+
const rel = nodePath.relative(cwd, targetAbs) || nodePath.basename(targetAbs);
|
|
114
|
+
const diff = buildUnifiedDiff(rel, body, nextBody);
|
|
115
|
+
return {
|
|
116
|
+
ok: true,
|
|
117
|
+
targetAbs,
|
|
118
|
+
templateId: input.templateId,
|
|
119
|
+
originalLength: body.length,
|
|
120
|
+
nextLength: nextBody.length,
|
|
121
|
+
removedCount: result.removedCount,
|
|
122
|
+
diff,
|
|
123
|
+
wrote,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type StringArrayOp = readonly string[] | {
|
|
2
|
+
readonly mode: 'add' | 'remove' | 'set';
|
|
3
|
+
readonly values: readonly string[];
|
|
4
|
+
};
|
|
5
|
+
export type MetadataArrayField = 'requiredAnchors' | 'requiredProfileIds' | 'forbiddenPathFragments' | 'requiredVerificationCommandIds';
|
|
6
|
+
export type MetadataScalarField = 'priority' | 'maturity' | 'dryRunOnly' | 'requiresApproval';
|
|
7
|
+
export interface ITemplateUpdateApplyInput {
|
|
8
|
+
readonly cwd: string;
|
|
9
|
+
readonly targetPath: string;
|
|
10
|
+
readonly templateId: string;
|
|
11
|
+
readonly fields: {
|
|
12
|
+
readonly name?: string;
|
|
13
|
+
readonly description?: string;
|
|
14
|
+
readonly tags?: StringArrayOp;
|
|
15
|
+
readonly scope?: StringArrayOp;
|
|
16
|
+
readonly appliesWhen?: StringArrayOp;
|
|
17
|
+
readonly related?: StringArrayOp;
|
|
18
|
+
readonly metadata?: {
|
|
19
|
+
readonly [K in MetadataScalarField]?: string | number | boolean;
|
|
20
|
+
} & {
|
|
21
|
+
readonly [K in MetadataArrayField]?: StringArrayOp;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
readonly write: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface ITemplateUpdateApplyResult {
|
|
27
|
+
readonly ok: boolean;
|
|
28
|
+
readonly refusal?: string;
|
|
29
|
+
readonly targetAbs: string;
|
|
30
|
+
readonly templateId: string;
|
|
31
|
+
readonly originalLength: number;
|
|
32
|
+
readonly nextLength: number;
|
|
33
|
+
readonly fieldChanges: ReadonlyArray<{
|
|
34
|
+
field: string;
|
|
35
|
+
mode: 'replace' | 'insert';
|
|
36
|
+
/** For arrays, the merge mode the caller asked for. */
|
|
37
|
+
arrayMode?: 'add' | 'remove' | 'set';
|
|
38
|
+
}>;
|
|
39
|
+
readonly diff?: string;
|
|
40
|
+
readonly wrote: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare function applyTemplateUpdate(input: ITemplateUpdateApplyInput): ITemplateUpdateApplyResult;
|
|
43
|
+
//# sourceMappingURL=apply-template-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-template-update.d.ts","sourceRoot":"","sources":["../../src/asset-preview/apply-template-update.ts"],"names":[],"mappings":"AAmCA,MAAM,MAAM,aAAa,GACrB,SAAS,MAAM,EAAE,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,oBAAoB,GACpB,wBAAwB,GACxB,gCAAgC,CAAC;AAErC,MAAM,MAAM,mBAAmB,GAC3B,UAAU,GACV,UAAU,GACV,YAAY,GACZ,kBAAkB,CAAC;AAEvB,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC;QAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;QAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC;QACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC;QACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAClB,QAAQ,EAAE,CAAC,IAAI,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO;SAChE,GAAG;YACF,QAAQ,EAAE,CAAC,IAAI,kBAAkB,CAAC,CAAC,EAAE,aAAa;SACnD,CAAC;KACH,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;QACnC,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;QAC3B,uDAAuD;QACvD,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,CAAC;KACtC,CAAC,CAAC;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AA6DD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,yBAAyB,GAC/B,0BAA0B,CAuL5B"}
|