@shrkcrft/cli 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/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 +314 -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 +553 -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 +3242 -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 +681 -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 +127 -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 +301 -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 +74 -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 +650 -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 +958 -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 +354 -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 +699 -0
- package/dist/output/failure-hints.d.ts +55 -0
- package/dist/output/failure-hints.d.ts.map +1 -0
- package/dist/output/failure-hints.js +159 -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 +53 -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 +36 -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 +73 -0
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared entry-aware mutation primitives.
|
|
3
|
+
*
|
|
4
|
+
* Three apply paths (knowledge-stale, template-drift, templates-update)
|
|
5
|
+
* all need the same primitive: find an object literal by `id`, walk to
|
|
6
|
+
* its `{...}` range, then replace / insert / remove fields inside.
|
|
7
|
+
*
|
|
8
|
+
* Pure functions over file text. No IO. No inspector imports — operates
|
|
9
|
+
* on raw TS source.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Locate `{...}` range for an entry whose `id: '<id>'` appears in body.
|
|
13
|
+
* Returns null when not found.
|
|
14
|
+
*
|
|
15
|
+
* Heuristic: locate the `id: 'entryId'` line (single or double quotes),
|
|
16
|
+
* walk backwards to the nearest `{`, then walk forwards counting `{`/`}`
|
|
17
|
+
* with string-literal awareness so braces inside strings don't unbalance
|
|
18
|
+
* the count.
|
|
19
|
+
*/
|
|
20
|
+
export function findEntryRange(body, entryId) {
|
|
21
|
+
const escaped = entryId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
22
|
+
const idLineRe = new RegExp(`\\bid\\s*:\\s*['"]${escaped}['"]`);
|
|
23
|
+
const m = idLineRe.exec(body);
|
|
24
|
+
if (!m)
|
|
25
|
+
return null;
|
|
26
|
+
const idIdx = m.index;
|
|
27
|
+
// Walk back to find the nearest `{`.
|
|
28
|
+
let openIdx = -1;
|
|
29
|
+
for (let i = idIdx; i >= 0; i--) {
|
|
30
|
+
if (body[i] === '{') {
|
|
31
|
+
openIdx = i;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (openIdx === -1)
|
|
36
|
+
return null;
|
|
37
|
+
// Walk forward to find the matching `}` accounting for nesting.
|
|
38
|
+
let depth = 0;
|
|
39
|
+
let closeIdx = -1;
|
|
40
|
+
let inString = null;
|
|
41
|
+
let escape = false;
|
|
42
|
+
for (let i = openIdx; i < body.length; i++) {
|
|
43
|
+
const c = body[i];
|
|
44
|
+
if (escape) {
|
|
45
|
+
escape = false;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (inString) {
|
|
49
|
+
if (c === '\\') {
|
|
50
|
+
escape = true;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (c === inString)
|
|
54
|
+
inString = null;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
58
|
+
inString = c;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (c === '{')
|
|
62
|
+
depth++;
|
|
63
|
+
else if (c === '}') {
|
|
64
|
+
depth--;
|
|
65
|
+
if (depth === 0) {
|
|
66
|
+
closeIdx = i;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (closeIdx === -1)
|
|
72
|
+
return null;
|
|
73
|
+
const lineStart = body.lastIndexOf('\n', closeIdx);
|
|
74
|
+
const closingIndent = body.slice(lineStart + 1, closeIdx);
|
|
75
|
+
return {
|
|
76
|
+
open: openIdx,
|
|
77
|
+
close: closeIdx,
|
|
78
|
+
indent: closingIndent.replace(/[^ \t]/g, ''),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** True if the entry literal already declares a top-level field. */
|
|
82
|
+
export function entryHasField(body, range, fieldName) {
|
|
83
|
+
const slice = body.slice(range.open, range.close + 1);
|
|
84
|
+
const escaped = fieldName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
85
|
+
return new RegExp(`\\b${escaped}\\s*:`).test(slice);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Insert a top-level field (TS source fragment) just before the closing
|
|
89
|
+
* `}` of the entry literal. Indents the fragment to match the entry.
|
|
90
|
+
*
|
|
91
|
+
* The caller is responsible for ensuring `body[range.close] === '}'`.
|
|
92
|
+
*
|
|
93
|
+
* The inserted line ends with `\n + range.indent` so the closing `}`
|
|
94
|
+
* re-lands on a properly indented line. `after` is preserved
|
|
95
|
+
* verbatim — slicing the indent off here would strip the closing
|
|
96
|
+
* `}` whenever it lived on its own indented line.
|
|
97
|
+
*/
|
|
98
|
+
export function insertField(body, range, fieldFragment) {
|
|
99
|
+
const childIndent = range.indent + ' ';
|
|
100
|
+
const indented = fieldFragment
|
|
101
|
+
.split('\n')
|
|
102
|
+
.map((l) => (l.length > 0 ? childIndent + l.replace(/^ {2}/, '') : l))
|
|
103
|
+
.join('\n');
|
|
104
|
+
const before = body.slice(0, range.close);
|
|
105
|
+
const after = body.slice(range.close);
|
|
106
|
+
const trimmedBefore = before.replace(/[ \t]*$/, '');
|
|
107
|
+
const ensuredComma = /[,{][ \t\r\n]*$/.test(trimmedBefore)
|
|
108
|
+
? trimmedBefore
|
|
109
|
+
: trimmedBefore.replace(/[ \t\r\n]*$/, '') + ',';
|
|
110
|
+
const insertedLine = (ensuredComma.length > 0 && !ensuredComma.endsWith('\n') ? '\n' : '') +
|
|
111
|
+
indented +
|
|
112
|
+
'\n' +
|
|
113
|
+
range.indent;
|
|
114
|
+
return ensuredComma + insertedLine + after;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Replace the value of a top-level scalar field inside the entry.
|
|
118
|
+
* Matches `<fieldName>: <value>,` (single-line) and replaces the value.
|
|
119
|
+
*
|
|
120
|
+
* Returns `null` when the field isn't present or isn't single-line.
|
|
121
|
+
*/
|
|
122
|
+
export function replaceScalarField(body, range, fieldName, newLiteral) {
|
|
123
|
+
const escaped = fieldName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
124
|
+
// Match `<indent><fieldName>: <value>,` on one line within the range.
|
|
125
|
+
const slice = body.slice(range.open, range.close + 1);
|
|
126
|
+
const re = new RegExp(`(\\n[ \\t]*${escaped}\\s*:\\s*)([^\\n]+?)(,?)(?=\\n)`, 'm');
|
|
127
|
+
const m = re.exec(slice);
|
|
128
|
+
if (!m)
|
|
129
|
+
return null;
|
|
130
|
+
const start = range.open + m.index;
|
|
131
|
+
const end = start + m[0].length;
|
|
132
|
+
const head = m[1] ?? '';
|
|
133
|
+
const trailingComma = m[3] ?? ',';
|
|
134
|
+
const replacement = head + newLiteral + (trailingComma || ',');
|
|
135
|
+
return body.slice(0, start) + replacement + body.slice(end);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Upsert: replace the field if present (single-line scalar), insert
|
|
139
|
+
* otherwise. `fragmentForInsert` is the full `fieldName: value,` line
|
|
140
|
+
* used when the field is absent. `newLiteralForReplace` is the value
|
|
141
|
+
* portion used when the field is present.
|
|
142
|
+
*/
|
|
143
|
+
export function upsertScalarField(body, range, fieldName, newLiteralForReplace, fragmentForInsert) {
|
|
144
|
+
if (entryHasField(body, range, fieldName)) {
|
|
145
|
+
const next = replaceScalarField(body, range, fieldName, newLiteralForReplace);
|
|
146
|
+
if (next !== null)
|
|
147
|
+
return { body: next, mode: 'replace' };
|
|
148
|
+
// Field is present but multi-line — fall through to insert (caller
|
|
149
|
+
// can decide whether to refuse). Conservative: insert anyway and let
|
|
150
|
+
// the human review the duplicate.
|
|
151
|
+
}
|
|
152
|
+
return { body: insertField(body, range, fragmentForInsert), mode: 'insert' };
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Remove an element from a top-level array field by predicate on the
|
|
156
|
+
* raw element text. The array is parsed shallowly — elements are split
|
|
157
|
+
* at top-level commas (not inside nested `{}` / `[]` / strings).
|
|
158
|
+
*
|
|
159
|
+
* Returns `{ body, removedCount }`. Refuses (returns null) if the field
|
|
160
|
+
* isn't a single-line OR brace-delimited array. Idempotent — calling
|
|
161
|
+
* twice removes nothing on the second pass.
|
|
162
|
+
*/
|
|
163
|
+
export function removeArrayEntries(body, range, fieldName, predicate) {
|
|
164
|
+
const escaped = fieldName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
165
|
+
// Find `<fieldName>: [` inside the entry.
|
|
166
|
+
const slice = body.slice(range.open, range.close + 1);
|
|
167
|
+
const fieldRe = new RegExp(`\\b${escaped}\\s*:\\s*\\[`);
|
|
168
|
+
const fm = fieldRe.exec(slice);
|
|
169
|
+
if (!fm)
|
|
170
|
+
return null;
|
|
171
|
+
const arrayOpenIdxInSlice = fm.index + fm[0].length - 1;
|
|
172
|
+
const arrayOpenIdx = range.open + arrayOpenIdxInSlice;
|
|
173
|
+
// Walk to the matching `]`, accounting for strings and nested
|
|
174
|
+
// brackets.
|
|
175
|
+
let depth = 0;
|
|
176
|
+
let arrayCloseIdx = -1;
|
|
177
|
+
let inString = null;
|
|
178
|
+
let escapeFlag = false;
|
|
179
|
+
for (let i = arrayOpenIdx; i < body.length; i++) {
|
|
180
|
+
const c = body[i];
|
|
181
|
+
if (escapeFlag) {
|
|
182
|
+
escapeFlag = false;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
if (inString) {
|
|
186
|
+
if (c === '\\') {
|
|
187
|
+
escapeFlag = true;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (c === inString)
|
|
191
|
+
inString = null;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
195
|
+
inString = c;
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (c === '[' || c === '{' || c === '(')
|
|
199
|
+
depth++;
|
|
200
|
+
else if (c === ']' || c === '}' || c === ')') {
|
|
201
|
+
depth--;
|
|
202
|
+
if (depth === 0 && c === ']') {
|
|
203
|
+
arrayCloseIdx = i;
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (arrayCloseIdx === -1)
|
|
209
|
+
return null;
|
|
210
|
+
const inner = body.slice(arrayOpenIdx + 1, arrayCloseIdx);
|
|
211
|
+
const elements = splitTopLevelCommas(inner);
|
|
212
|
+
let removed = 0;
|
|
213
|
+
const kept = [];
|
|
214
|
+
for (const e of elements) {
|
|
215
|
+
const trimmed = e.trim();
|
|
216
|
+
if (trimmed.length === 0) {
|
|
217
|
+
// Preserve trailing-comma-only segments verbatim.
|
|
218
|
+
kept.push(e);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (predicate(trimmed)) {
|
|
222
|
+
removed++;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
kept.push(e);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (removed === 0)
|
|
229
|
+
return { body, removedCount: 0 };
|
|
230
|
+
// Recompose. Strip leading/trailing empty kept segments so we don't
|
|
231
|
+
// double up commas.
|
|
232
|
+
const trimmedKept = kept.map((k) => k).filter((k) => k.trim().length > 0);
|
|
233
|
+
// If the original had a trailing newline + indent before `]`, preserve
|
|
234
|
+
// it; otherwise collapse to a single line.
|
|
235
|
+
const closingLineStart = body.lastIndexOf('\n', arrayCloseIdx);
|
|
236
|
+
const closingIndent = closingLineStart === -1 ? '' : body.slice(closingLineStart + 1, arrayCloseIdx);
|
|
237
|
+
const openLineEnd = body.indexOf('\n', arrayOpenIdx);
|
|
238
|
+
const wasMultiline = openLineEnd !== -1 && openLineEnd < arrayCloseIdx && /^\s*$/.test(closingIndent);
|
|
239
|
+
const newInner = wasMultiline
|
|
240
|
+
? '\n' + trimmedKept.map((e) => e.trim()).map((e) => closingIndent + ' ' + e).join(',\n') +
|
|
241
|
+
(trimmedKept.length > 0 ? ',\n' + closingIndent : closingIndent)
|
|
242
|
+
: trimmedKept.map((e) => e.trim()).join(', ');
|
|
243
|
+
const nextBody = body.slice(0, arrayOpenIdx + 1) + newInner + body.slice(arrayCloseIdx);
|
|
244
|
+
return { body: nextBody, removedCount: removed };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Remove an element from a top-level array of strings by exact value.
|
|
248
|
+
* Convenience wrapper over `removeArrayEntries`.
|
|
249
|
+
*/
|
|
250
|
+
export function removeStringFromArray(body, range, fieldName, value) {
|
|
251
|
+
return removeArrayEntries(body, range, fieldName, (el) => {
|
|
252
|
+
const trimmed = el.trim().replace(/[,]$/, '').trim();
|
|
253
|
+
// Strip quotes.
|
|
254
|
+
const m = /^['"`](.*)['"`]$/.exec(trimmed);
|
|
255
|
+
if (!m)
|
|
256
|
+
return trimmed === value;
|
|
257
|
+
return m[1] === value;
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Find the `{...}` range of a nested object literal addressed by
|
|
262
|
+
* `<fieldName>: {` within the enclosing entry range. Returns null when
|
|
263
|
+
* the field is missing OR is not an object literal.
|
|
264
|
+
*
|
|
265
|
+
* Used by templates-update --apply to merge into `metadata.*` without
|
|
266
|
+
* touching the surrounding entry.
|
|
267
|
+
*/
|
|
268
|
+
export function findNestedObjectRange(body, parentRange, fieldName) {
|
|
269
|
+
const escaped = fieldName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
270
|
+
const slice = body.slice(parentRange.open, parentRange.close + 1);
|
|
271
|
+
const fieldRe = new RegExp(`\\b${escaped}\\s*:\\s*\\{`);
|
|
272
|
+
const m = fieldRe.exec(slice);
|
|
273
|
+
if (!m)
|
|
274
|
+
return null;
|
|
275
|
+
const openInSlice = m.index + m[0].length - 1;
|
|
276
|
+
const openIdx = parentRange.open + openInSlice;
|
|
277
|
+
let depth = 0;
|
|
278
|
+
let closeIdx = -1;
|
|
279
|
+
let inString = null;
|
|
280
|
+
let escape = false;
|
|
281
|
+
for (let i = openIdx; i < body.length; i++) {
|
|
282
|
+
const c = body[i];
|
|
283
|
+
if (escape) {
|
|
284
|
+
escape = false;
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
if (inString) {
|
|
288
|
+
if (c === '\\') {
|
|
289
|
+
escape = true;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
if (c === inString)
|
|
293
|
+
inString = null;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
297
|
+
inString = c;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (c === '{')
|
|
301
|
+
depth++;
|
|
302
|
+
else if (c === '}') {
|
|
303
|
+
depth--;
|
|
304
|
+
if (depth === 0) {
|
|
305
|
+
closeIdx = i;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (closeIdx === -1)
|
|
311
|
+
return null;
|
|
312
|
+
const lineStart = body.lastIndexOf('\n', closeIdx);
|
|
313
|
+
const closingIndent = body.slice(lineStart + 1, closeIdx);
|
|
314
|
+
return {
|
|
315
|
+
open: openIdx,
|
|
316
|
+
close: closeIdx,
|
|
317
|
+
indent: closingIndent.replace(/[^ \t]/g, ''),
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Read a top-level string array field's current values from the
|
|
322
|
+
* entry literal. Returns the unquoted string values in source order, or
|
|
323
|
+
* null when the field isn't a single-line OR brace-delimited array.
|
|
324
|
+
*
|
|
325
|
+
* Tolerates nested string-quoted commas and surrounding whitespace.
|
|
326
|
+
* Used by templates-update --apply for `--add-tag` / `--remove-tag`
|
|
327
|
+
* merge math.
|
|
328
|
+
*/
|
|
329
|
+
export function readStringArrayField(body, range, fieldName) {
|
|
330
|
+
const escaped = fieldName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
331
|
+
const slice = body.slice(range.open, range.close + 1);
|
|
332
|
+
const fieldRe = new RegExp(`\\b${escaped}\\s*:\\s*\\[`);
|
|
333
|
+
const m = fieldRe.exec(slice);
|
|
334
|
+
if (!m)
|
|
335
|
+
return null;
|
|
336
|
+
const arrayOpenIdxInSlice = m.index + m[0].length - 1;
|
|
337
|
+
const arrayOpenIdx = range.open + arrayOpenIdxInSlice;
|
|
338
|
+
let depth = 0;
|
|
339
|
+
let arrayCloseIdx = -1;
|
|
340
|
+
let inString = null;
|
|
341
|
+
let escapeFlag = false;
|
|
342
|
+
for (let i = arrayOpenIdx; i < body.length; i++) {
|
|
343
|
+
const c = body[i];
|
|
344
|
+
if (escapeFlag) {
|
|
345
|
+
escapeFlag = false;
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
if (inString) {
|
|
349
|
+
if (c === '\\') {
|
|
350
|
+
escapeFlag = true;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
if (c === inString)
|
|
354
|
+
inString = null;
|
|
355
|
+
continue;
|
|
356
|
+
}
|
|
357
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
358
|
+
inString = c;
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
if (c === '[' || c === '{' || c === '(')
|
|
362
|
+
depth++;
|
|
363
|
+
else if (c === ']' || c === '}' || c === ')') {
|
|
364
|
+
depth--;
|
|
365
|
+
if (depth === 0 && c === ']') {
|
|
366
|
+
arrayCloseIdx = i;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (arrayCloseIdx === -1)
|
|
372
|
+
return null;
|
|
373
|
+
const inner = body.slice(arrayOpenIdx + 1, arrayCloseIdx);
|
|
374
|
+
const elements = splitTopLevelCommas(inner);
|
|
375
|
+
const out = [];
|
|
376
|
+
for (const e of elements) {
|
|
377
|
+
const trimmed = e.trim().replace(/,$/, '').trim();
|
|
378
|
+
if (trimmed.length === 0)
|
|
379
|
+
continue;
|
|
380
|
+
const sm = /^['"`](.*)['"`]$/.exec(trimmed);
|
|
381
|
+
if (!sm)
|
|
382
|
+
return null;
|
|
383
|
+
out.push(sm[1] ?? '');
|
|
384
|
+
}
|
|
385
|
+
return out;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Split a comma-separated string at top-level commas (not inside
|
|
389
|
+
* strings or nested brackets). Preserves the original spacing inside
|
|
390
|
+
* each element so the caller can decide how to re-render.
|
|
391
|
+
*/
|
|
392
|
+
export function splitTopLevelCommas(inner) {
|
|
393
|
+
const out = [];
|
|
394
|
+
let depth = 0;
|
|
395
|
+
let inString = null;
|
|
396
|
+
let escape = false;
|
|
397
|
+
let start = 0;
|
|
398
|
+
for (let i = 0; i < inner.length; i++) {
|
|
399
|
+
const c = inner[i];
|
|
400
|
+
if (escape) {
|
|
401
|
+
escape = false;
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
if (inString) {
|
|
405
|
+
if (c === '\\') {
|
|
406
|
+
escape = true;
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
if (c === inString)
|
|
410
|
+
inString = null;
|
|
411
|
+
continue;
|
|
412
|
+
}
|
|
413
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
414
|
+
inString = c;
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
if (c === '[' || c === '{' || c === '(')
|
|
418
|
+
depth++;
|
|
419
|
+
else if (c === ']' || c === '}' || c === ')')
|
|
420
|
+
depth--;
|
|
421
|
+
else if (c === ',' && depth === 0) {
|
|
422
|
+
out.push(inner.slice(start, i));
|
|
423
|
+
start = i + 1;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
out.push(inner.slice(start));
|
|
427
|
+
return out;
|
|
428
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IKnowledgeReference } from '@shrkcrft/knowledge';
|
|
2
|
+
import { AssetProvenanceSource } from '@shrkcrft/inspector';
|
|
3
|
+
import { type ParsedArgs } from '../command-registry.js';
|
|
4
|
+
export interface IAuthoringSource {
|
|
5
|
+
source: AssetProvenanceSource;
|
|
6
|
+
author?: string;
|
|
7
|
+
sessionId?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Derive the provenance source from environment. Agent-driven sessions
|
|
11
|
+
* set `SHARKCRAFT_AGENT` / `CLAUDE_CODE_SESSION` / `ANTHROPIC_AGENT`;
|
|
12
|
+
* otherwise we treat the invocation as CLI-driven.
|
|
13
|
+
*/
|
|
14
|
+
export declare function detectAuthoringSource(): IAuthoringSource;
|
|
15
|
+
/**
|
|
16
|
+
* Write draft files to disk. Refuses any path outside
|
|
17
|
+
* `.sharkcraft/authoring/` or `.sharkcraft/fixes/`. Returns the list of
|
|
18
|
+
* project-relative paths that were actually written.
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeAuthoringDrafts(cwd: string, files: ReadonlyArray<{
|
|
21
|
+
path: string;
|
|
22
|
+
body: string;
|
|
23
|
+
}>): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Accept both repeated flags (`--reference a --reference b`) and
|
|
26
|
+
* comma-form (`--reference a,b`). When the flag is passed multiple
|
|
27
|
+
* times, occurrences stay verbatim so structured values like `kind:foo,bar`
|
|
28
|
+
* aren't split.
|
|
29
|
+
*/
|
|
30
|
+
export declare function multiFlagValues(args: ParsedArgs, name: string): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Parse a `kind:value[:required]` reference spec. Returns null on
|
|
33
|
+
* invalid input so callers can filter.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseReferenceSpec(spec: string): IKnowledgeReference | null;
|
|
36
|
+
//# sourceMappingURL=authoring-kit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-kit.d.ts","sourceRoot":"","sources":["../../src/authoring/authoring-kit.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EACL,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,gBAAgB,CAgBxD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GACnD,MAAM,EAAE,CAiBV;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAExE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CA6B3E"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared authoring kit for CLI commands.
|
|
3
|
+
*
|
|
4
|
+
* Extracts the CLI-side helpers that were duplicated across knowledge,
|
|
5
|
+
* rules, and templates authoring. The DOMAIN builders stay in
|
|
6
|
+
* `@shrkcrft/inspector` (`buildKnowledgeAuthoringPreview`, future
|
|
7
|
+
* `buildTemplateAuthoringPreview`). This module is the **adapter**:
|
|
8
|
+
*
|
|
9
|
+
* - resolve provenance source from env (agent vs. CLI)
|
|
10
|
+
* - write draft files under .sharkcraft/authoring/ only (refuse escape)
|
|
11
|
+
* - parse `--reference kind:value[:required]` specs
|
|
12
|
+
* - parse repeated / comma-form flag values
|
|
13
|
+
*
|
|
14
|
+
* Layer order: cli only (no inspector imports needed — these are pure
|
|
15
|
+
* Node + ParsedArgs helpers).
|
|
16
|
+
*/
|
|
17
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
18
|
+
import * as nodePath from 'node:path';
|
|
19
|
+
import { AssetProvenanceSource, } from '@shrkcrft/inspector';
|
|
20
|
+
import { flagList } from "../command-registry.js";
|
|
21
|
+
/**
|
|
22
|
+
* Derive the provenance source from environment. Agent-driven sessions
|
|
23
|
+
* set `SHARKCRAFT_AGENT` / `CLAUDE_CODE_SESSION` / `ANTHROPIC_AGENT`;
|
|
24
|
+
* otherwise we treat the invocation as CLI-driven.
|
|
25
|
+
*/
|
|
26
|
+
export function detectAuthoringSource() {
|
|
27
|
+
const isAgent = Boolean(process.env['SHARKCRAFT_AGENT']) ||
|
|
28
|
+
Boolean(process.env['CLAUDE_CODE_SESSION']) ||
|
|
29
|
+
Boolean(process.env['ANTHROPIC_AGENT']);
|
|
30
|
+
const sessionId = process.env['SHARKCRAFT_SESSION_ID'] ||
|
|
31
|
+
process.env['CLAUDE_CODE_SESSION'] ||
|
|
32
|
+
undefined;
|
|
33
|
+
const author = process.env['SHARKCRAFT_AUTHOR'] || process.env['USER'] || undefined;
|
|
34
|
+
return {
|
|
35
|
+
source: isAgent ? AssetProvenanceSource.Agent : AssetProvenanceSource.Cli,
|
|
36
|
+
...(author ? { author } : {}),
|
|
37
|
+
...(sessionId ? { sessionId } : {}),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Write draft files to disk. Refuses any path outside
|
|
42
|
+
* `.sharkcraft/authoring/` or `.sharkcraft/fixes/`. Returns the list of
|
|
43
|
+
* project-relative paths that were actually written.
|
|
44
|
+
*/
|
|
45
|
+
export function writeAuthoringDrafts(cwd, files) {
|
|
46
|
+
const written = [];
|
|
47
|
+
const authoringRoot = nodePath.resolve(cwd, '.sharkcraft', 'authoring');
|
|
48
|
+
const fixesRoot = nodePath.resolve(cwd, '.sharkcraft', 'fixes');
|
|
49
|
+
for (const f of files) {
|
|
50
|
+
const abs = nodePath.resolve(cwd, f.path);
|
|
51
|
+
if (!abs.startsWith(authoringRoot + nodePath.sep) &&
|
|
52
|
+
!abs.startsWith(fixesRoot + nodePath.sep)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
mkdirSync(nodePath.dirname(abs), { recursive: true });
|
|
56
|
+
writeFileSync(abs, f.body, 'utf8');
|
|
57
|
+
written.push(f.path);
|
|
58
|
+
}
|
|
59
|
+
return written;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Accept both repeated flags (`--reference a --reference b`) and
|
|
63
|
+
* comma-form (`--reference a,b`). When the flag is passed multiple
|
|
64
|
+
* times, occurrences stay verbatim so structured values like `kind:foo,bar`
|
|
65
|
+
* aren't split.
|
|
66
|
+
*/
|
|
67
|
+
export function multiFlagValues(args, name) {
|
|
68
|
+
return flagList(args, name, { dedupe: true, split: 'auto' });
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Parse a `kind:value[:required]` reference spec. Returns null on
|
|
72
|
+
* invalid input so callers can filter.
|
|
73
|
+
*/
|
|
74
|
+
export function parseReferenceSpec(spec) {
|
|
75
|
+
const parts = spec.split(':');
|
|
76
|
+
if (parts.length < 2)
|
|
77
|
+
return null;
|
|
78
|
+
const [kindRaw, ...rest] = parts;
|
|
79
|
+
const kind = kindRaw;
|
|
80
|
+
const required = rest[rest.length - 1] === 'required';
|
|
81
|
+
if (required)
|
|
82
|
+
rest.pop();
|
|
83
|
+
const value = rest.join(':');
|
|
84
|
+
if (!value)
|
|
85
|
+
return null;
|
|
86
|
+
switch (kind) {
|
|
87
|
+
case 'file':
|
|
88
|
+
case 'directory':
|
|
89
|
+
return { kind, path: value, ...(required ? { required: true } : {}) };
|
|
90
|
+
case 'symbol':
|
|
91
|
+
return { kind, symbol: value, ...(required ? { required: true } : {}) };
|
|
92
|
+
case 'command':
|
|
93
|
+
case 'template':
|
|
94
|
+
case 'playbook':
|
|
95
|
+
case 'construct':
|
|
96
|
+
case 'helper':
|
|
97
|
+
case 'policy':
|
|
98
|
+
case 'boundary-rule':
|
|
99
|
+
case 'path-convention':
|
|
100
|
+
case 'package':
|
|
101
|
+
case 'url':
|
|
102
|
+
return { kind, id: value, ...(required ? { required: true } : {}) };
|
|
103
|
+
default:
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|