project-tiny-context-harness 0.8.17 → 0.11.0
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/README.md +93 -30
- package/assets/README.md +158 -44
- package/assets/README.zh-CN.md +88 -29
- package/assets/agents/AGENTS_CORE.md +2 -2
- package/assets/context_templates/context.toml +6 -1
- package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_helpers.cs +301 -0
- package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_run.cs +197 -0
- package/assets/runtime/windows-job-supervisor/formal_process_supervisor_native_types.cs +215 -0
- package/assets/runtime/windows-job-supervisor/windows_job_process_supervisor.ps1 +117 -0
- package/assets/skills/design-resource-authoring/SKILL.md +6 -3
- package/assets/skills/design-resource-authoring/references/authority-delta-assessment.md +52 -0
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +5 -1
- package/assets/skills/design-system-authoring/SKILL.md +23 -17
- package/assets/skills/design-system-authoring/references/authority-adoption.md +19 -9
- package/assets/skills/design-system-authoring/references/open-design-design-system-provider.md +4 -0
- package/assets/skills/long-task-workflow/SKILL.md +6 -6
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +10 -4
- package/assets/skills/long-task-workflow/references/contract-authoring.md +5 -5
- package/assets/skills/long-task-workflow/references/evidence-design.md +14 -3
- package/assets/skills/long-task-workflow/references/source-authoring.md +11 -8
- package/assets/tools/context_rules.json +53 -0
- package/assets/tools/validate_context.py +302 -77
- package/dist/cli.js +2 -1
- package/dist/commands/context-create.d.ts +1 -0
- package/dist/commands/context-create.js +90 -0
- package/dist/commands/context-inspect.d.ts +1 -0
- package/dist/commands/context-inspect.js +98 -0
- package/dist/commands/context-move.d.ts +1 -0
- package/dist/commands/context-move.js +78 -0
- package/dist/commands/context-register.d.ts +1 -0
- package/dist/commands/context-register.js +110 -0
- package/dist/commands/context-transaction.d.ts +1 -0
- package/dist/commands/context-transaction.js +84 -0
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/context.js +36 -0
- package/dist/commands/design-authority-delta.d.ts +1 -0
- package/dist/commands/design-authority-delta.js +53 -0
- package/dist/commands/design-authority.d.ts +1 -0
- package/dist/commands/design-authority.js +104 -0
- package/dist/commands/design-resource.js +8 -1
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.js +61 -3
- package/dist/commands/index.js +19 -2
- package/dist/commands/long-task-authoring.js +20 -2
- package/dist/commands/long-task-workdir.d.ts +2 -0
- package/dist/commands/long-task-workdir.js +23 -0
- package/dist/commands/long-task.js +75 -6
- package/dist/commands/route.d.ts +15 -0
- package/dist/commands/route.js +142 -0
- package/dist/index.d.ts +3 -13
- package/dist/index.js +3 -12
- package/dist/lib/cli-exit.d.ts +14 -0
- package/dist/lib/cli-exit.js +19 -0
- package/dist/lib/context-catalog/catalog-default-footprint.d.ts +3 -0
- package/dist/lib/context-catalog/catalog-default-footprint.js +53 -0
- package/dist/lib/context-catalog/catalog-diagnostics.d.ts +9 -0
- package/dist/lib/context-catalog/catalog-diagnostics.js +34 -0
- package/dist/lib/context-catalog/catalog-discovery.d.ts +7 -0
- package/dist/lib/context-catalog/catalog-discovery.js +81 -0
- package/dist/lib/context-catalog/catalog-load.d.ts +8 -0
- package/dist/lib/context-catalog/catalog-load.js +187 -0
- package/dist/lib/context-catalog/catalog-path-validation.d.ts +7 -0
- package/dist/lib/context-catalog/catalog-path-validation.js +62 -0
- package/dist/lib/context-catalog/catalog-paths.d.ts +11 -0
- package/dist/lib/context-catalog/catalog-paths.js +41 -0
- package/dist/lib/context-catalog/catalog-portable-contract.d.ts +15 -0
- package/dist/lib/context-catalog/catalog-portable-contract.js +68 -0
- package/dist/lib/context-catalog/catalog-staged-path-safety.d.ts +1 -0
- package/dist/lib/context-catalog/catalog-staged-path-safety.js +36 -0
- package/dist/lib/context-catalog/catalog-types.d.ts +40 -0
- package/dist/lib/context-catalog/catalog-types.js +1 -0
- package/dist/lib/context-catalog/catalog-validation.d.ts +9 -0
- package/dist/lib/context-catalog/catalog-validation.js +148 -0
- package/dist/lib/context-create/context-create-path.d.ts +2 -0
- package/dist/lib/context-create/context-create-path.js +30 -0
- package/dist/lib/context-create/context-create-template.d.ts +2 -0
- package/dist/lib/context-create/context-create-template.js +95 -0
- package/dist/lib/context-create/context-create-types.d.ts +28 -0
- package/dist/lib/context-create/context-create-types.js +1 -0
- package/dist/lib/context-create/context-create-write.d.ts +1 -0
- package/dist/lib/context-create/context-create-write.js +85 -0
- package/dist/lib/context-create/context-create.d.ts +2 -0
- package/dist/lib/context-create/context-create.js +84 -0
- package/dist/lib/context-default-footprint.d.ts +2 -3
- package/dist/lib/context-default-footprint.js +49 -57
- package/dist/lib/context-doctor/context-doctor-types.d.ts +16 -0
- package/dist/lib/context-doctor/context-doctor-types.js +15 -0
- package/dist/lib/context-doctor/context-doctor.d.ts +2 -0
- package/dist/lib/context-doctor/context-doctor.js +130 -0
- package/dist/lib/context-graph-snapshot.d.ts +5 -0
- package/dist/lib/context-graph-snapshot.js +46 -25
- package/dist/lib/context-inspect/context-inspect-projection.d.ts +9 -0
- package/dist/lib/context-inspect/context-inspect-projection.js +49 -0
- package/dist/lib/context-inspect/context-inspect-render.d.ts +2 -0
- package/dist/lib/context-inspect/context-inspect-render.js +29 -0
- package/dist/lib/context-inspect/context-inspect-types.d.ts +43 -0
- package/dist/lib/context-inspect/context-inspect-types.js +1 -0
- package/dist/lib/context-inspect/context-inspect.d.ts +2 -0
- package/dist/lib/context-inspect/context-inspect.js +104 -0
- package/dist/lib/context-manifest-schema.d.ts +1 -1
- package/dist/lib/context-manifest-schema.js +4 -20
- package/dist/lib/context-markdown/context-markdown-analysis.d.ts +15 -0
- package/dist/lib/context-markdown/context-markdown-analysis.js +245 -0
- package/dist/lib/context-markdown/context-markdown-extract.d.ts +7 -0
- package/dist/lib/context-markdown/context-markdown-extract.js +114 -0
- package/dist/lib/context-markdown/context-markdown-types.d.ts +57 -0
- package/dist/lib/context-markdown/context-markdown-types.js +1 -0
- package/dist/lib/context-move/context-move-input.d.ts +8 -0
- package/dist/lib/context-move/context-move-input.js +17 -0
- package/dist/lib/context-move/context-move-literal-scan.d.ts +20 -0
- package/dist/lib/context-move/context-move-literal-scan.js +213 -0
- package/dist/lib/context-move/context-move-live-validation.d.ts +3 -0
- package/dist/lib/context-move/context-move-live-validation.js +56 -0
- package/dist/lib/context-move/context-move-markdown-plan.d.ts +22 -0
- package/dist/lib/context-move/context-move-markdown-plan.js +39 -0
- package/dist/lib/context-move/context-move-projection.d.ts +3 -0
- package/dist/lib/context-move/context-move-projection.js +11 -0
- package/dist/lib/context-move/context-move-reference-validation.d.ts +11 -0
- package/dist/lib/context-move/context-move-reference-validation.js +64 -0
- package/dist/lib/context-move/context-move-render.d.ts +2 -0
- package/dist/lib/context-move/context-move-render.js +24 -0
- package/dist/lib/context-move/context-move-support.d.ts +10 -0
- package/dist/lib/context-move/context-move-support.js +88 -0
- package/dist/lib/context-move/context-move-transaction-plan.d.ts +24 -0
- package/dist/lib/context-move/context-move-transaction-plan.js +108 -0
- package/dist/lib/context-move/context-move-types.d.ts +74 -0
- package/dist/lib/context-move/context-move-types.js +1 -0
- package/dist/lib/context-move/context-move.d.ts +8 -0
- package/dist/lib/context-move/context-move.js +180 -0
- package/dist/lib/context-mutation/manifest-lossless-patch.d.ts +28 -0
- package/dist/lib/context-mutation/manifest-lossless-patch.js +208 -0
- package/dist/lib/context-mutation/markdown-link-patch.d.ts +34 -0
- package/dist/lib/context-mutation/markdown-link-patch.js +143 -0
- package/dist/lib/context-mutation/markdown-link-spans.d.ts +10 -0
- package/dist/lib/context-mutation/markdown-link-spans.js +179 -0
- package/dist/lib/context-mutation/mutation-cas.d.ts +13 -0
- package/dist/lib/context-mutation/mutation-cas.js +365 -0
- package/dist/lib/context-mutation/mutation-command-support.d.ts +12 -0
- package/dist/lib/context-mutation/mutation-command-support.js +57 -0
- package/dist/lib/context-mutation/mutation-commit.d.ts +12 -0
- package/dist/lib/context-mutation/mutation-commit.js +89 -0
- package/dist/lib/context-mutation/mutation-directories.d.ts +5 -0
- package/dist/lib/context-mutation/mutation-directories.js +56 -0
- package/dist/lib/context-mutation/mutation-file-state.d.ts +14 -0
- package/dist/lib/context-mutation/mutation-file-state.js +137 -0
- package/dist/lib/context-mutation/mutation-journal-file-validation.d.ts +1 -0
- package/dist/lib/context-mutation/mutation-journal-file-validation.js +106 -0
- package/dist/lib/context-mutation/mutation-journal-io.d.ts +5 -0
- package/dist/lib/context-mutation/mutation-journal-io.js +55 -0
- package/dist/lib/context-mutation/mutation-journal-storage.d.ts +18 -0
- package/dist/lib/context-mutation/mutation-journal-storage.js +283 -0
- package/dist/lib/context-mutation/mutation-journal-validation-support.d.ts +16 -0
- package/dist/lib/context-mutation/mutation-journal-validation-support.js +140 -0
- package/dist/lib/context-mutation/mutation-journal-validation.d.ts +3 -0
- package/dist/lib/context-mutation/mutation-journal-validation.js +177 -0
- package/dist/lib/context-mutation/mutation-journal.d.ts +8 -0
- package/dist/lib/context-mutation/mutation-journal.js +111 -0
- package/dist/lib/context-mutation/mutation-live-validation.d.ts +3 -0
- package/dist/lib/context-mutation/mutation-live-validation.js +51 -0
- package/dist/lib/context-mutation/mutation-long-task-guard.d.ts +6 -0
- package/dist/lib/context-mutation/mutation-long-task-guard.js +57 -0
- package/dist/lib/context-mutation/mutation-recovery.d.ts +4 -0
- package/dist/lib/context-mutation/mutation-recovery.js +189 -0
- package/dist/lib/context-mutation/mutation-staged-fs.d.ts +5 -0
- package/dist/lib/context-mutation/mutation-staged-fs.js +56 -0
- package/dist/lib/context-mutation/mutation-types.d.ts +103 -0
- package/dist/lib/context-mutation/mutation-types.js +1 -0
- package/dist/lib/context-register/context-register-input.d.ts +11 -0
- package/dist/lib/context-register/context-register-input.js +43 -0
- package/dist/lib/context-register/context-register-render.d.ts +2 -0
- package/dist/lib/context-register/context-register-render.js +21 -0
- package/dist/lib/context-register/context-register-support.d.ts +6 -0
- package/dist/lib/context-register/context-register-support.js +46 -0
- package/dist/lib/context-register/context-register-types.d.ts +46 -0
- package/dist/lib/context-register/context-register-types.js +1 -0
- package/dist/lib/context-register/context-register.d.ts +8 -0
- package/dist/lib/context-register/context-register.js +155 -0
- package/dist/lib/context-router/context-route-budget.d.ts +15 -0
- package/dist/lib/context-router/context-route-budget.js +14 -0
- package/dist/lib/context-router/context-route-candidates.d.ts +15 -0
- package/dist/lib/context-router/context-route-candidates.js +112 -0
- package/dist/lib/context-router/context-route-order.d.ts +6 -0
- package/dist/lib/context-router/context-route-order.js +53 -0
- package/dist/lib/context-router/context-route-paths.d.ts +16 -0
- package/dist/lib/context-router/context-route-paths.js +109 -0
- package/dist/lib/context-router/context-route-render.d.ts +2 -0
- package/dist/lib/context-router/context-route-render.js +32 -0
- package/dist/lib/context-router/context-route-scan.d.ts +18 -0
- package/dist/lib/context-router/context-route-scan.js +156 -0
- package/dist/lib/context-router/context-route-selection.d.ts +16 -0
- package/dist/lib/context-router/context-route-selection.js +72 -0
- package/dist/lib/context-router/context-route-terms.d.ts +13 -0
- package/dist/lib/context-router/context-route-terms.js +202 -0
- package/dist/lib/context-router/context-route-types.d.ts +101 -0
- package/dist/lib/context-router/context-route-types.js +1 -0
- package/dist/lib/context-router/context-route.d.ts +2 -0
- package/dist/lib/context-router/context-route.js +127 -0
- package/dist/lib/context-units-migration.d.ts +13 -0
- package/dist/lib/context-units-migration.js +217 -0
- package/dist/lib/design-authority-binding.d.ts +7 -0
- package/dist/lib/design-authority-binding.js +96 -0
- package/dist/lib/design-authority-closure.d.ts +3 -0
- package/dist/lib/design-authority-closure.js +201 -0
- package/dist/lib/design-authority-delta-codec-primitives.d.ts +10 -0
- package/dist/lib/design-authority-delta-codec-primitives.js +58 -0
- package/dist/lib/design-authority-delta-codec.d.ts +2 -0
- package/dist/lib/design-authority-delta-codec.js +193 -0
- package/dist/lib/design-authority-delta-types.d.ts +65 -0
- package/dist/lib/design-authority-delta-types.js +6 -0
- package/dist/lib/design-authority-delta-validation.d.ts +2 -0
- package/dist/lib/design-authority-delta-validation.js +16 -0
- package/dist/lib/design-authority-digest.d.ts +8 -0
- package/dist/lib/design-authority-digest.js +36 -0
- package/dist/lib/design-authority-files.d.ts +9 -0
- package/dist/lib/design-authority-files.js +62 -0
- package/dist/lib/design-authority-format.d.ts +2 -0
- package/dist/lib/design-authority-format.js +93 -0
- package/dist/lib/design-authority-links.d.ts +10 -0
- package/dist/lib/design-authority-links.js +137 -0
- package/dist/lib/design-authority-manifest.d.ts +4 -0
- package/dist/lib/design-authority-manifest.js +144 -0
- package/dist/lib/design-authority-tokens.d.ts +9 -0
- package/dist/lib/design-authority-tokens.js +45 -0
- package/dist/lib/design-authority-types.d.ts +80 -0
- package/dist/lib/design-authority-types.js +23 -0
- package/dist/lib/design-md-tool-adapter.d.ts +9 -0
- package/dist/lib/design-md-tool-adapter.js +152 -0
- package/dist/lib/design-md-tool-normalization.d.ts +7 -0
- package/dist/lib/design-md-tool-normalization.js +78 -0
- package/dist/lib/design-md-tool-types.d.ts +99 -0
- package/dist/lib/design-md-tool-types.js +8 -0
- package/dist/lib/design-resource-handoff-input-types.d.ts +1 -1
- package/dist/lib/design-resource-handoff-manifest-projection.js +3 -0
- package/dist/lib/design-resource-handoff-shape.js +14 -2
- package/dist/lib/design-resource-handoff-types.d.ts +3 -0
- package/dist/lib/design-resource-handoff-validation.js +16 -4
- package/dist/lib/design-resource-implementation-feasibility-validation-support.js +1 -1
- package/dist/lib/design-resource-recovery-current.js +22 -0
- package/dist/lib/design-resource-recovery-shape.js +64 -7
- package/dist/lib/design-resource-recovery-types.d.ts +4 -1
- package/dist/lib/design-resource-symbolic-fact-shape.js +7 -1
- package/dist/lib/design-resource-symbolic-fact-types.d.ts +3 -0
- package/dist/lib/design-resource-symbolic-fact-validation.js +15 -3
- package/dist/lib/doctor.d.ts +2 -1
- package/dist/lib/doctor.js +29 -1
- package/dist/lib/fs.js +1 -1
- package/dist/lib/long-task-acceptance-reachability-claims.d.ts +2 -0
- package/dist/lib/long-task-acceptance-reachability-claims.js +279 -0
- package/dist/lib/long-task-acceptance-reachability-design.d.ts +2 -0
- package/dist/lib/long-task-acceptance-reachability-design.js +96 -0
- package/dist/lib/long-task-acceptance-reachability-external.d.ts +9 -0
- package/dist/lib/long-task-acceptance-reachability-external.js +123 -0
- package/dist/lib/long-task-acceptance-reachability-helpers.d.ts +64 -0
- package/dist/lib/long-task-acceptance-reachability-helpers.js +473 -0
- package/dist/lib/long-task-acceptance-reachability-semantic.d.ts +2 -0
- package/dist/lib/long-task-acceptance-reachability-semantic.js +122 -0
- package/dist/lib/long-task-acceptance-reachability-types.d.ts +91 -0
- package/dist/lib/long-task-acceptance-reachability-types.js +1 -0
- package/dist/lib/long-task-acceptance-reachability.d.ts +4 -0
- package/dist/lib/long-task-acceptance-reachability.js +115 -0
- package/dist/lib/long-task-activation-validation.d.ts +6 -0
- package/dist/lib/long-task-activation-validation.js +72 -69
- package/dist/lib/long-task-active-authority-lock-context.d.ts +4 -0
- package/dist/lib/long-task-active-authority-lock-context.js +29 -0
- package/dist/lib/long-task-applicability-identity.d.ts +25 -0
- package/dist/lib/long-task-applicability-identity.js +60 -0
- package/dist/lib/long-task-authoring-preflight-diagnostics.js +8 -0
- package/dist/lib/long-task-authoring-preflight-types.d.ts +2 -0
- package/dist/lib/long-task-authoring-preflight-types.js +9 -0
- package/dist/lib/long-task-authoring-preflight.js +18 -2
- package/dist/lib/long-task-authority-material-diff.js +4 -0
- package/dist/lib/long-task-authority-materials.js +19 -0
- package/dist/lib/long-task-authority-policy.d.ts +3 -0
- package/dist/lib/long-task-authority-policy.js +3 -0
- package/dist/lib/long-task-authority-revision-details.js +2 -1
- package/dist/lib/long-task-authority-types.d.ts +2 -0
- package/dist/lib/long-task-authority.js +2 -0
- package/dist/lib/long-task-check-shape.js +6 -1
- package/dist/lib/long-task-claim-definitions.js +1 -3
- package/dist/lib/long-task-claim-semantic-proof-floor.d.ts +3 -0
- package/dist/lib/long-task-claim-semantic-proof-floor.js +78 -0
- package/dist/lib/long-task-claims.d.ts +0 -18
- package/dist/lib/long-task-claims.js +15 -14
- package/dist/lib/long-task-command-process.js +3 -0
- package/dist/lib/long-task-compact-authoring.js +3 -0
- package/dist/lib/long-task-compact-projections.js +10 -0
- package/dist/lib/long-task-complete-delivery-evidence-types.d.ts +38 -0
- package/dist/lib/long-task-complete-delivery-evidence-types.js +1 -0
- package/dist/lib/long-task-completion-types.d.ts +109 -0
- package/dist/lib/long-task-completion-types.js +1 -0
- package/dist/lib/long-task-conformance-policy.d.ts +2 -1
- package/dist/lib/long-task-conformance-policy.js +11 -4
- package/dist/lib/long-task-context-authority-topology.js +6 -4
- package/dist/lib/long-task-contract-types.d.ts +52 -1
- package/dist/lib/long-task-counterfactual-sandbox.d.ts +7 -1
- package/dist/lib/long-task-counterfactual-sandbox.js +86 -6
- package/dist/lib/long-task-delivery-compiler-preflight.d.ts +24 -0
- package/dist/lib/long-task-delivery-compiler-preflight.js +32 -0
- package/dist/lib/long-task-delivery-compiler.d.ts +1 -0
- package/dist/lib/long-task-delivery-compiler.js +59 -44
- package/dist/lib/long-task-delivery-parser.d.ts +3 -0
- package/dist/lib/long-task-delivery-parser.js +26 -8
- package/dist/lib/long-task-delivery-types.d.ts +2 -0
- package/dist/lib/long-task-delivery-types.js +2 -0
- package/dist/lib/long-task-delivery-validation.d.ts +6 -1
- package/dist/lib/long-task-delivery-validation.js +19 -4
- package/dist/lib/long-task-design-feasibility-binding.d.ts +1 -0
- package/dist/lib/long-task-design-feasibility-binding.js +3 -3
- package/dist/lib/long-task-design-feasibility-source-closure.js +11 -2
- package/dist/lib/long-task-design-obligation.d.ts +50 -0
- package/dist/lib/long-task-design-obligation.js +99 -0
- package/dist/lib/long-task-design-resource-handoff.d.ts +3 -1
- package/dist/lib/long-task-design-resource-handoff.js +36 -12
- package/dist/lib/long-task-design-resource-method-binding.js +12 -0
- package/dist/lib/long-task-effective-external-takeover.d.ts +15 -0
- package/dist/lib/long-task-effective-external-takeover.js +109 -0
- package/dist/lib/long-task-effective-external-ui-takeover.d.ts +5 -0
- package/dist/lib/long-task-effective-external-ui-takeover.js +117 -0
- package/dist/lib/long-task-evidence-capability-codec.js +91 -0
- package/dist/lib/long-task-evidence-capability-runtime.js +62 -14
- package/dist/lib/long-task-evidence-capability-types.d.ts +3 -2
- package/dist/lib/long-task-evidence-v2.d.ts +6 -1
- package/dist/lib/long-task-evidence-v2.js +253 -170
- package/dist/lib/long-task-execution-observation.d.ts +7 -0
- package/dist/lib/long-task-execution-observation.js +21 -4
- package/dist/lib/long-task-expected-authority.d.ts +4 -0
- package/dist/lib/long-task-expected-authority.js +126 -0
- package/dist/lib/long-task-external-confirmation-artifacts.d.ts +9 -0
- package/dist/lib/long-task-external-confirmation-artifacts.js +138 -0
- package/dist/lib/long-task-external-confirmation-attestation.d.ts +20 -0
- package/dist/lib/long-task-external-confirmation-attestation.js +115 -0
- package/dist/lib/long-task-external-confirmation-challenge.d.ts +23 -0
- package/dist/lib/long-task-external-confirmation-challenge.js +164 -0
- package/dist/lib/long-task-external-confirmation-context.d.ts +14 -0
- package/dist/lib/long-task-external-confirmation-context.js +53 -0
- package/dist/lib/long-task-external-confirmation-evaluation.d.ts +11 -0
- package/dist/lib/long-task-external-confirmation-evaluation.js +454 -0
- package/dist/lib/long-task-external-confirmation-expected.d.ts +8 -0
- package/dist/lib/long-task-external-confirmation-expected.js +200 -0
- package/dist/lib/long-task-external-confirmation-identity.d.ts +10 -0
- package/dist/lib/long-task-external-confirmation-identity.js +77 -0
- package/dist/lib/long-task-external-confirmation-plan.d.ts +25 -0
- package/dist/lib/long-task-external-confirmation-plan.js +148 -0
- package/dist/lib/long-task-external-confirmation-preparation.d.ts +4 -0
- package/dist/lib/long-task-external-confirmation-preparation.js +100 -0
- package/dist/lib/long-task-external-confirmation-shape.d.ts +8 -0
- package/dist/lib/long-task-external-confirmation-shape.js +387 -0
- package/dist/lib/long-task-external-confirmation-state.d.ts +10 -0
- package/dist/lib/long-task-external-confirmation-state.js +109 -0
- package/dist/lib/long-task-external-confirmation-types.d.ts +195 -0
- package/dist/lib/long-task-external-confirmation-types.js +1 -0
- package/dist/lib/long-task-final-integrity.d.ts +2 -0
- package/dist/lib/long-task-final-integrity.js +21 -10
- package/dist/lib/long-task-final-v2.d.ts +7 -2
- package/dist/lib/long-task-final-v2.js +179 -55
- package/dist/lib/long-task-finalization-identity.d.ts +27 -0
- package/dist/lib/long-task-finalization-identity.js +58 -0
- package/dist/lib/long-task-finding-context.d.ts +1 -1
- package/dist/lib/long-task-finding-context.js +139 -13
- package/dist/lib/long-task-freshness.d.ts +27 -0
- package/dist/lib/long-task-freshness.js +128 -5
- package/dist/lib/long-task-git.js +3 -3
- package/dist/lib/long-task-material-input-closure.d.ts +3 -0
- package/dist/lib/long-task-material-input-closure.js +92 -0
- package/dist/lib/long-task-obligation-authority-resolution.d.ts +12 -0
- package/dist/lib/long-task-obligation-authority-resolution.js +57 -0
- package/dist/lib/long-task-obligation-semantic-identity.d.ts +16 -0
- package/dist/lib/long-task-obligation-semantic-identity.js +116 -0
- package/dist/lib/long-task-observation-authority.d.ts +11 -0
- package/dist/lib/long-task-observation-authority.js +137 -6
- package/dist/lib/long-task-process-table.d.ts +2 -5
- package/dist/lib/long-task-process-table.js +21 -53
- package/dist/lib/long-task-process-tree.d.ts +0 -1
- package/dist/lib/long-task-process-tree.js +24 -54
- package/dist/lib/long-task-proof-adequacy.d.ts +12 -0
- package/dist/lib/long-task-proof-adequacy.js +57 -0
- package/dist/lib/long-task-proof-capability-floor.d.ts +6 -0
- package/dist/lib/long-task-proof-capability-floor.js +137 -0
- package/dist/lib/long-task-repair-frontier-checks.d.ts +8 -0
- package/dist/lib/long-task-repair-frontier-checks.js +93 -0
- package/dist/lib/long-task-repair-frontier-groups.d.ts +2 -0
- package/dist/lib/long-task-repair-frontier-groups.js +64 -0
- package/dist/lib/long-task-repair-frontier-utils.d.ts +6 -0
- package/dist/lib/long-task-repair-frontier-utils.js +27 -0
- package/dist/lib/long-task-repair-frontier.d.ts +14 -0
- package/dist/lib/long-task-repair-frontier.js +132 -0
- package/dist/lib/long-task-risk.d.ts +3 -2
- package/dist/lib/long-task-risk.js +73 -24
- package/dist/lib/long-task-root-shape.js +148 -8
- package/dist/lib/long-task-runner-freeze.d.ts +2 -1
- package/dist/lib/long-task-runner-freeze.js +23 -8
- package/dist/lib/long-task-runtime-types.d.ts +34 -40
- package/dist/lib/long-task-semantic-assurance-policy.js +2 -11
- package/dist/lib/long-task-semantic-contract-types.d.ts +2 -1
- package/dist/lib/long-task-semantic-drift-migration.js +48 -2
- package/dist/lib/long-task-semantic-fact-binding-types.d.ts +20 -0
- package/dist/lib/long-task-semantic-fact-closure.d.ts +5 -1
- package/dist/lib/long-task-semantic-fact-closure.js +33 -5
- package/dist/lib/long-task-semantic-fact-contract-closure.js +176 -1
- package/dist/lib/long-task-semantic-fact-contract-proofs.js +18 -1
- package/dist/lib/long-task-semantic-fact-input-closure.d.ts +16 -2
- package/dist/lib/long-task-semantic-fact-input-closure.js +138 -15
- package/dist/lib/long-task-semantic-fact-provenance-closure.js +1 -1
- package/dist/lib/long-task-semantic-fact-shape.d.ts +2 -1
- package/dist/lib/long-task-semantic-fact-shape.js +35 -1
- package/dist/lib/long-task-semantic-proof-adequacy.d.ts +2 -0
- package/dist/lib/long-task-semantic-proof-adequacy.js +19 -0
- package/dist/lib/long-task-semantic-proof-profile.d.ts +5 -0
- package/dist/lib/long-task-semantic-proof-profile.js +187 -0
- package/dist/lib/long-task-shape-primitives.d.ts +1 -1
- package/dist/lib/long-task-shape-primitives.js +5 -0
- package/dist/lib/long-task-source-anchors.d.ts +10 -0
- package/dist/lib/long-task-source-anchors.js +102 -0
- package/dist/lib/long-task-source-authority-types.d.ts +46 -0
- package/dist/lib/long-task-source-claim-validation.js +36 -0
- package/dist/lib/long-task-source-conservation-facts.d.ts +8 -0
- package/dist/lib/long-task-source-conservation-facts.js +57 -0
- package/dist/lib/long-task-source-conservation-types.d.ts +34 -0
- package/dist/lib/long-task-source-conservation-types.js +1 -0
- package/dist/lib/long-task-source-conservation.d.ts +7 -0
- package/dist/lib/long-task-source-conservation.js +110 -0
- package/dist/lib/long-task-source-fragments.d.ts +6 -0
- package/dist/lib/long-task-source-fragments.js +219 -0
- package/dist/lib/long-task-source-projection-resolution.d.ts +5 -0
- package/dist/lib/long-task-source-projection-resolution.js +57 -0
- package/dist/lib/long-task-source-projection-validation.d.ts +17 -0
- package/dist/lib/long-task-source-projection-validation.js +154 -0
- package/dist/lib/long-task-source-shape.js +14 -6
- package/dist/lib/long-task-source-supersession.d.ts +5 -0
- package/dist/lib/long-task-source-supersession.js +138 -0
- package/dist/lib/long-task-stage-policy.d.ts +7 -2
- package/dist/lib/long-task-stage-policy.js +67 -23
- package/dist/lib/long-task-state.d.ts +18 -4
- package/dist/lib/long-task-state.js +319 -33
- package/dist/lib/long-task-static-observation-freeze.js +4 -3
- package/dist/lib/long-task-status-projection.d.ts +3 -1
- package/dist/lib/long-task-status-projection.js +44 -13
- package/dist/lib/long-task-status-v2.d.ts +10 -6
- package/dist/lib/long-task-status-v2.js +70 -58
- package/dist/lib/long-task-target-policy.d.ts +8 -3
- package/dist/lib/long-task-target-policy.js +40 -9
- package/dist/lib/long-task-terminal-finalization.d.ts +12 -0
- package/dist/lib/long-task-terminal-finalization.js +190 -0
- package/dist/lib/long-task-ui-design-policy.js +15 -4
- package/dist/lib/long-task-verifier-counterfactuals.d.ts +11 -0
- package/dist/lib/long-task-verifier-counterfactuals.js +96 -0
- package/dist/lib/long-task-verifier-execution.d.ts +9 -0
- package/dist/lib/long-task-verifier-execution.js +67 -0
- package/dist/lib/long-task-verifier-identity.js +16 -5
- package/dist/lib/long-task-verifier-v2.js +52 -65
- package/dist/lib/long-task-windows-job-supervisor-helper.d.ts +1 -0
- package/dist/lib/long-task-windows-job-supervisor-helper.js +104 -0
- package/dist/lib/long-task-windows-job-supervisor-protocol.d.ts +28 -0
- package/dist/lib/long-task-windows-job-supervisor-protocol.js +124 -0
- package/dist/lib/long-task-windows-job-supervisor-result.d.ts +11 -0
- package/dist/lib/long-task-windows-job-supervisor-result.js +152 -0
- package/dist/lib/long-task-windows-job-supervisor.d.ts +2 -0
- package/dist/lib/long-task-windows-job-supervisor.js +126 -0
- package/dist/lib/long-task-workspace-scope.d.ts +1 -0
- package/dist/lib/long-task-workspace-scope.js +4 -1
- package/dist/lib/long-task-workspace.d.ts +1 -0
- package/dist/lib/long-task-workspace.js +10 -0
- package/dist/lib/migrations.js +43 -2
- package/dist/lib/repository-path-safety.d.ts +1 -0
- package/dist/lib/repository-path-safety.js +3 -3
- package/dist/lib/semantic-fact-input-shape.d.ts +7 -2
- package/dist/lib/semantic-fact-input-shape.js +25 -1
- package/dist/lib/semantic-fact-inventory-types.d.ts +8 -2
- package/dist/lib/semantic-fact-policy-census.d.ts +1 -1
- package/dist/lib/semantic-fact-policy-census.js +5 -2
- package/dist/lib/semantic-fact-policy.d.ts +1 -1
- package/dist/lib/semantic-fact-policy.js +2 -2
- package/dist/lib/semantic-fact-proof-shape.d.ts +1 -1
- package/dist/lib/semantic-fact-property-shape.d.ts +1 -1
- package/dist/lib/validators.d.ts +3 -0
- package/dist/lib/validators.js +45 -157
- package/dist/public-api-core.d.ts +12 -0
- package/dist/public-api-core.js +12 -0
- package/dist/public-api-long-task.d.ts +10 -0
- package/dist/public-api-long-task.js +10 -0
- package/dist/public-types.d.ts +5 -1
- package/dist/schemas/design-authority-delta-assessment-v1.schema.json +191 -0
- package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +166 -2
- package/dist/schemas/long-task-external-confirmation-record-v1.schema.json +155 -0
- package/dist/schemas/long-task-external-confirmation-record-v2.schema.json +209 -0
- package/migrations/README.md +99 -0
- package/package.json +7 -5
- package/source-mappings.yaml +18 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const CONTEXT_DOCTOR_DEFAULTS: Readonly<{
|
|
2
|
+
context_file_soft_budget_bytes: number;
|
|
3
|
+
long_line_code_points: 1000;
|
|
4
|
+
trigger_fanout_contexts: 4;
|
|
5
|
+
}>;
|
|
6
|
+
export interface ContextDoctorOptions {
|
|
7
|
+
context_file_soft_budget_bytes?: number;
|
|
8
|
+
long_line_code_points?: number;
|
|
9
|
+
trigger_fanout_contexts?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ContextDoctorAnalysis {
|
|
12
|
+
info: string[];
|
|
13
|
+
warnings: string[];
|
|
14
|
+
errors: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveContextDoctorOptions(options?: ContextDoctorOptions): Required<ContextDoctorOptions>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const CONTEXT_DOCTOR_DEFAULTS = Object.freeze({
|
|
2
|
+
context_file_soft_budget_bytes: 64 * 1024,
|
|
3
|
+
long_line_code_points: 1_000,
|
|
4
|
+
trigger_fanout_contexts: 4,
|
|
5
|
+
});
|
|
6
|
+
export function resolveContextDoctorOptions(options = {}) {
|
|
7
|
+
return {
|
|
8
|
+
context_file_soft_budget_bytes: options.context_file_soft_budget_bytes ??
|
|
9
|
+
CONTEXT_DOCTOR_DEFAULTS.context_file_soft_budget_bytes,
|
|
10
|
+
long_line_code_points: options.long_line_code_points ??
|
|
11
|
+
CONTEXT_DOCTOR_DEFAULTS.long_line_code_points,
|
|
12
|
+
trigger_fanout_contexts: options.trigger_fanout_contexts ??
|
|
13
|
+
CONTEXT_DOCTOR_DEFAULTS.trigger_fanout_contexts,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { compareUtf8Paths } from "../context-catalog/catalog-paths.js";
|
|
2
|
+
import { loadContextCatalog } from "../context-catalog/catalog-load.js";
|
|
3
|
+
import { CONTEXT_LEGACY_READ_POLICY_SET } from "../context-catalog/catalog-portable-contract.js";
|
|
4
|
+
import { analyzeContextMarkdownCatalog } from "../context-markdown/context-markdown-analysis.js";
|
|
5
|
+
import { resolveContextDoctorOptions } from "./context-doctor-types.js";
|
|
6
|
+
export async function inspectContextCatalogHealth(projectRoot, options = {}) {
|
|
7
|
+
const resolved = resolveContextDoctorOptions(options);
|
|
8
|
+
const result = {
|
|
9
|
+
info: [],
|
|
10
|
+
warnings: [],
|
|
11
|
+
errors: [],
|
|
12
|
+
};
|
|
13
|
+
const catalog = await loadContextCatalog(projectRoot);
|
|
14
|
+
for (const diagnostic of catalog.diagnostics) {
|
|
15
|
+
const location = diagnostic.path
|
|
16
|
+
? `${diagnostic.path}${diagnostic.line ? `:${diagnostic.line}` : ""}: `
|
|
17
|
+
: "";
|
|
18
|
+
result[diagnostic.severity === "error" ? "errors" : "warnings"].push(`${location}${diagnostic.message}`);
|
|
19
|
+
}
|
|
20
|
+
const registeredByPath = new Map(catalog.registered_contexts.map((entry) => [entry.path, entry]));
|
|
21
|
+
const unregisteredPaths = new Set(catalog.unregistered_context_files.map((entry) => entry.path));
|
|
22
|
+
const defaultPaths = new Set(catalog.default_footprint.keys());
|
|
23
|
+
const markdown = await analyzeContextMarkdownCatalog({
|
|
24
|
+
project_root: catalog.project_root,
|
|
25
|
+
files: catalog.context_files,
|
|
26
|
+
long_line_threshold: resolved.long_line_code_points,
|
|
27
|
+
});
|
|
28
|
+
const distribution = distributionFor(catalog.context_files, registeredByPath, defaultPaths, unregisteredPaths);
|
|
29
|
+
result.info.push(`all Context Markdown: ${catalog.context_files.length} file(s), ${sumBytes(catalog.context_files)} bytes`);
|
|
30
|
+
result.info.push(`Context distribution: default=${distribution.default.files} file(s)/${distribution.default.bytes} bytes, on-demand=${distribution.on_demand.files} file(s)/${distribution.on_demand.bytes} bytes, legacy=${distribution.legacy.files} file(s)/${distribution.legacy.bytes} bytes, unregistered=${distribution.unregistered.files} file(s)/${distribution.unregistered.bytes} bytes`);
|
|
31
|
+
const largestOnDemand = [...catalog.context_files]
|
|
32
|
+
.filter((file) => isOnDemandRegistered(file.path, registeredByPath, defaultPaths))
|
|
33
|
+
.sort((left, right) => right.bytes - left.bytes || compareUtf8Paths(left.path, right.path))[0];
|
|
34
|
+
if (largestOnDemand)
|
|
35
|
+
result.info.push(`largest on-demand Context: ${largestOnDemand.path}, ${largestOnDemand.bytes} bytes`);
|
|
36
|
+
for (const file of markdown.files) {
|
|
37
|
+
const registered = registeredByPath.get(file.path);
|
|
38
|
+
const classification = classifyFile(file.path, registered, defaultPaths, unregisteredPaths);
|
|
39
|
+
result.info.push(`Context file: ${file.path}, ${file.bytes} bytes, ${classification}, max line ${file.max_line_code_points} code point(s)`);
|
|
40
|
+
if (file.bytes > resolved.context_file_soft_budget_bytes)
|
|
41
|
+
result.warnings.push(`${file.path} is ${file.bytes} bytes, above the ${resolved.context_file_soft_budget_bytes}-byte all-Context per-file soft budget; this is advisory and necessary recoverable facts take precedence`);
|
|
42
|
+
for (const line of file.long_lines)
|
|
43
|
+
result.warnings.push(`${file.path}:${line.line} has ${line.code_points} Unicode code points, above the ${resolved.long_line_code_points}-code-point advisory threshold`);
|
|
44
|
+
}
|
|
45
|
+
for (const fanout of collectTriggerFanout(catalog.registered_contexts, catalog.context_files)) {
|
|
46
|
+
result.info.push(`Context trigger: ${JSON.stringify(fanout.trigger)}, ${fanout.paths.length} Context(s), ${fanout.cumulative_bytes} cumulative bytes, paths=${fanout.paths.join(", ")}`);
|
|
47
|
+
if (fanout.paths.length >= resolved.trigger_fanout_contexts)
|
|
48
|
+
result.warnings.push(`trigger ${JSON.stringify(fanout.trigger)} fans out to ${fanout.paths.length} Contexts (${fanout.cumulative_bytes} bytes): ${fanout.paths.join(", ")}; review whether this literal trigger remains selective`);
|
|
49
|
+
}
|
|
50
|
+
for (const reference of markdown.references) {
|
|
51
|
+
if (reference.status === "valid")
|
|
52
|
+
continue;
|
|
53
|
+
const target = reference.target_path ?? reference.destination;
|
|
54
|
+
result.warnings.push(`${reference.source_path}:${reference.line} has ${reference.status.replaceAll("_", " ")} explicit Markdown Context reference ${JSON.stringify(target)}${reference.detail ? `: ${reference.detail}` : ""}`);
|
|
55
|
+
}
|
|
56
|
+
for (const declaration of markdown.invalid_declarations)
|
|
57
|
+
result.warnings.push(`${declaration.path}:${declaration.line} has invalid ty-context declaration ${JSON.stringify(declaration.raw)}: ${declaration.reason}`);
|
|
58
|
+
for (const conflict of markdown.declaration_conflicts)
|
|
59
|
+
result.warnings.push(`${conflict.type} ${conflict.id} is declared by multiple candidate owners: ${conflict.owners.map((owner) => `${owner.path}:${owner.line}`).join(", ")}`);
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function distributionFor(files, registered, defaults, unregistered) {
|
|
63
|
+
const result = {
|
|
64
|
+
default: { files: 0, bytes: 0 },
|
|
65
|
+
on_demand: { files: 0, bytes: 0 },
|
|
66
|
+
legacy: { files: 0, bytes: 0 },
|
|
67
|
+
unregistered: { files: 0, bytes: 0 },
|
|
68
|
+
};
|
|
69
|
+
for (const file of files) {
|
|
70
|
+
const entry = registered.get(file.path);
|
|
71
|
+
let key;
|
|
72
|
+
if (unregistered.has(file.path))
|
|
73
|
+
key = "unregistered";
|
|
74
|
+
else if (defaults.has(file.path))
|
|
75
|
+
key = "default";
|
|
76
|
+
else if (entry?.read_policy &&
|
|
77
|
+
CONTEXT_LEGACY_READ_POLICY_SET.has(entry.read_policy))
|
|
78
|
+
key = "legacy";
|
|
79
|
+
else
|
|
80
|
+
key = "on_demand";
|
|
81
|
+
result[key].files += 1;
|
|
82
|
+
result[key].bytes += file.bytes;
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
function classifyFile(contextPath, registered, defaults, unregistered) {
|
|
87
|
+
if (unregistered.has(contextPath))
|
|
88
|
+
return "unregistered";
|
|
89
|
+
const policy = registered?.read_policy;
|
|
90
|
+
const suffix = policy ? `, read_policy=${policy}` : "";
|
|
91
|
+
if (defaults.has(contextPath))
|
|
92
|
+
return `default registered${suffix}`;
|
|
93
|
+
if (policy && CONTEXT_LEGACY_READ_POLICY_SET.has(policy))
|
|
94
|
+
return `legacy registered${suffix}`;
|
|
95
|
+
return `on-demand registered${suffix}`;
|
|
96
|
+
}
|
|
97
|
+
function isOnDemandRegistered(contextPath, registered, defaults) {
|
|
98
|
+
const entry = registered.get(contextPath);
|
|
99
|
+
return Boolean(entry &&
|
|
100
|
+
!defaults.has(contextPath) &&
|
|
101
|
+
!(entry.read_policy && CONTEXT_LEGACY_READ_POLICY_SET.has(entry.read_policy)));
|
|
102
|
+
}
|
|
103
|
+
function collectTriggerFanout(contexts, files) {
|
|
104
|
+
const filesByPath = new Map(files.map((file) => [file.path, file]));
|
|
105
|
+
const groups = new Map();
|
|
106
|
+
for (const context of contexts) {
|
|
107
|
+
for (const trigger of context.context?.triggers ?? []) {
|
|
108
|
+
const normalized = trigger.normalize("NFC").toLocaleLowerCase("en-US");
|
|
109
|
+
const group = groups.get(normalized) ?? {
|
|
110
|
+
display: trigger.normalize("NFC"),
|
|
111
|
+
paths: new Set(),
|
|
112
|
+
};
|
|
113
|
+
group.paths.add(context.path);
|
|
114
|
+
groups.set(normalized, group);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return [...groups.values()]
|
|
118
|
+
.map((group) => {
|
|
119
|
+
const paths = [...group.paths].sort(compareUtf8Paths);
|
|
120
|
+
return {
|
|
121
|
+
trigger: group.display,
|
|
122
|
+
paths,
|
|
123
|
+
cumulative_bytes: paths.reduce((total, contextPath) => total + (filesByPath.get(contextPath)?.bytes ?? 0), 0),
|
|
124
|
+
};
|
|
125
|
+
})
|
|
126
|
+
.sort((left, right) => compareUtf8Paths(left.trigger, right.trigger));
|
|
127
|
+
}
|
|
128
|
+
function sumBytes(files) {
|
|
129
|
+
return files.reduce((total, file) => total + file.bytes, 0);
|
|
130
|
+
}
|
|
@@ -6,12 +6,17 @@ export interface ContextGraphSnapshot {
|
|
|
6
6
|
controlling_files: string[];
|
|
7
7
|
supporting_files: string[];
|
|
8
8
|
}
|
|
9
|
+
export interface CapturedContextGraphSnapshot {
|
|
10
|
+
snapshot: ContextGraphSnapshot;
|
|
11
|
+
physical_files: ReadonlyMap<string, string>;
|
|
12
|
+
}
|
|
9
13
|
export interface CampaignContextBaseline {
|
|
10
14
|
graph_sha256: string;
|
|
11
15
|
files: Record<string, string>;
|
|
12
16
|
baseline_sha256: string;
|
|
13
17
|
}
|
|
14
18
|
export declare function captureContextGraphSnapshot(repositoryRoot: string, contextRefs: Iterable<string>, mode?: "referenced" | "full"): Promise<ContextGraphSnapshot>;
|
|
19
|
+
export declare function captureContextGraphSnapshotWithPhysicalFiles(repositoryRoot: string, contextRefs: Iterable<string>, mode?: "referenced" | "full"): Promise<CapturedContextGraphSnapshot>;
|
|
15
20
|
export declare function captureCampaignContextBaseline(repositoryRoot: string, contextRefs: Iterable<string>): Promise<CampaignContextBaseline>;
|
|
16
21
|
export declare function assertCampaignContextBaselineFresh(repositoryRoot: string, expected: CampaignContextBaseline, contextRefs: Iterable<string>): Promise<void>;
|
|
17
22
|
export declare function currentContextTopologySha256(repositoryRoot: string): Promise<string>;
|
|
@@ -2,15 +2,20 @@ import { readFile, readdir } from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { contextAuthorityTopologyHash } from "./long-task-context-authority-topology.js";
|
|
4
4
|
import { canonicalJson, sha256Hex } from "./strict-codec.js";
|
|
5
|
+
import { compareUtf8Paths, normalizeContextPath, portableContextPathCaseKey, repositoryRelativePathSpelling, } from "./context-catalog/catalog-paths.js";
|
|
5
6
|
import { parseContextManifest, } from "./context-manifest-schema.js";
|
|
6
7
|
import { assertProtectedRepositoryFile } from "./long-task-protected-files.js";
|
|
7
8
|
const CONTEXT_MANIFEST_PATH = "project_context/context.toml";
|
|
8
9
|
const SUPPORTING_CONTEXT_ROLES = new Set(["implementation-index", "archive"]);
|
|
9
10
|
export async function captureContextGraphSnapshot(repositoryRoot, contextRefs, mode = "referenced") {
|
|
11
|
+
return (await captureContextGraphSnapshotWithPhysicalFiles(repositoryRoot, contextRefs, mode)).snapshot;
|
|
12
|
+
}
|
|
13
|
+
export async function captureContextGraphSnapshotWithPhysicalFiles(repositoryRoot, contextRefs, mode = "referenced") {
|
|
10
14
|
const root = path.resolve(repositoryRoot);
|
|
11
15
|
const manifest = await readContextManifest(root);
|
|
12
|
-
const
|
|
13
|
-
const
|
|
16
|
+
const fileRecords = await listContextFileRecords(root);
|
|
17
|
+
const allFiles = fileRecords.map((file) => file.path);
|
|
18
|
+
const available = new Map(fileRecords.map((file) => [file.path, file]));
|
|
14
19
|
const selected = new Set();
|
|
15
20
|
const explicitlySelected = new Set();
|
|
16
21
|
if (mode === "full") {
|
|
@@ -43,24 +48,27 @@ export async function captureContextGraphSnapshot(repositoryRoot, contextRefs, m
|
|
|
43
48
|
selected.add(normalized);
|
|
44
49
|
explicitlySelected.add(normalized);
|
|
45
50
|
}
|
|
46
|
-
addTransitiveChildren(manifest, selected, available);
|
|
51
|
+
addTransitiveChildren(manifest, selected, new Set(available.keys()));
|
|
47
52
|
}
|
|
48
|
-
const files = [...selected].sort();
|
|
53
|
+
const files = [...selected].sort(compareUtf8Paths);
|
|
49
54
|
const authorityTopologySha256 = contextAuthorityTopologyHash(manifest, files);
|
|
50
55
|
const hashes = Object.fromEntries(await Promise.all(files.map(async (file) => [
|
|
51
56
|
file,
|
|
52
57
|
file === CONTEXT_MANIFEST_PATH
|
|
53
58
|
? authorityTopologySha256
|
|
54
|
-
: await hashFile(root,
|
|
59
|
+
: await hashFile(root, available.get(file).absolute_path),
|
|
55
60
|
])));
|
|
56
61
|
const classification = classifyContextFiles(manifest, files, explicitlySelected, mode);
|
|
57
62
|
return {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
snapshot: {
|
|
64
|
+
mode,
|
|
65
|
+
topology_sha256: authorityTopologySha256,
|
|
66
|
+
files,
|
|
67
|
+
sha256: sortRecord(hashes),
|
|
68
|
+
controlling_files: classification.controlling,
|
|
69
|
+
supporting_files: classification.supporting,
|
|
70
|
+
},
|
|
71
|
+
physical_files: new Map(files.map((file) => [file, available.get(file).absolute_path])),
|
|
64
72
|
};
|
|
65
73
|
}
|
|
66
74
|
export async function captureCampaignContextBaseline(repositoryRoot, contextRefs) {
|
|
@@ -85,7 +93,7 @@ export async function assertCampaignContextBaselineFresh(repositoryRoot, expecte
|
|
|
85
93
|
]),
|
|
86
94
|
]
|
|
87
95
|
.filter((file) => expected.files[file] !== current.files[file])
|
|
88
|
-
.sort();
|
|
96
|
+
.sort(compareUtf8Paths);
|
|
89
97
|
throw new Error(`campaign_context_changed:files:${changed.join(",") || "set"}`);
|
|
90
98
|
}
|
|
91
99
|
}
|
|
@@ -94,11 +102,17 @@ export async function currentContextTopologySha256(repositoryRoot) {
|
|
|
94
102
|
return contextAuthorityTopologyHash(await readContextManifest(root), await listContextFiles(root));
|
|
95
103
|
}
|
|
96
104
|
export async function listContextFiles(repositoryRoot) {
|
|
105
|
+
return (await listContextFileRecords(path.resolve(repositoryRoot))).map((file) => file.path);
|
|
106
|
+
}
|
|
107
|
+
async function listContextFileRecords(repositoryRoot) {
|
|
97
108
|
const root = path.resolve(repositoryRoot);
|
|
98
109
|
const contextRoot = path.join(root, "project_context");
|
|
99
|
-
const result =
|
|
110
|
+
const result = new Map();
|
|
111
|
+
const portabilityKeys = new Map();
|
|
100
112
|
async function visit(directory) {
|
|
101
|
-
|
|
113
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
114
|
+
entries.sort((left, right) => compareUtf8Paths(left.name, right.name));
|
|
115
|
+
for (const entry of entries) {
|
|
102
116
|
const absolute = path.join(directory, entry.name);
|
|
103
117
|
if (entry.isSymbolicLink()) {
|
|
104
118
|
throw new Error(`protected_input_symlink_not_allowed:context_authority:${absolute.replace(/\\/gu, "/")}`);
|
|
@@ -108,12 +122,26 @@ export async function listContextFiles(repositoryRoot) {
|
|
|
108
122
|
}
|
|
109
123
|
else if (entry.isFile()) {
|
|
110
124
|
await assertProtectedRepositoryFile(root, absolute, "context_authority");
|
|
111
|
-
|
|
125
|
+
const physicalPath = repositoryRelativePathSpelling(root, absolute);
|
|
126
|
+
const publicPath = normalizeContextPath(physicalPath);
|
|
127
|
+
const existing = result.get(publicPath);
|
|
128
|
+
if (existing)
|
|
129
|
+
throw new Error(`context_authority_unicode_collision:${existing.physical_path}:${physicalPath}:${publicPath}`);
|
|
130
|
+
const portabilityKey = portableContextPathCaseKey(publicPath);
|
|
131
|
+
const caseCollision = portabilityKeys.get(portabilityKey);
|
|
132
|
+
if (caseCollision && caseCollision !== publicPath)
|
|
133
|
+
throw new Error(`context_authority_case_collision:${caseCollision}:${publicPath}`);
|
|
134
|
+
portabilityKeys.set(portabilityKey, publicPath);
|
|
135
|
+
result.set(publicPath, {
|
|
136
|
+
path: publicPath,
|
|
137
|
+
physical_path: physicalPath,
|
|
138
|
+
absolute_path: absolute,
|
|
139
|
+
});
|
|
112
140
|
}
|
|
113
141
|
}
|
|
114
142
|
}
|
|
115
143
|
await visit(contextRoot);
|
|
116
|
-
return result.sort();
|
|
144
|
+
return [...result.values()].sort((left, right) => compareUtf8Paths(left.path, right.path));
|
|
117
145
|
}
|
|
118
146
|
async function readContextManifest(root) {
|
|
119
147
|
const manifestFile = await assertProtectedRepositoryFile(root, path.join(root, "project_context", "context.toml"), "context_manifest");
|
|
@@ -163,16 +191,9 @@ async function hashFile(root, file) {
|
|
|
163
191
|
const protectedFile = await assertProtectedRepositoryFile(root, file, "context_authority");
|
|
164
192
|
return sha256Hex(await readFile(protectedFile));
|
|
165
193
|
}
|
|
166
|
-
function repoRelative(root, file) {
|
|
167
|
-
const value = path.relative(root, file).replace(/\\/g, "/");
|
|
168
|
-
if (value.startsWith("../") || path.isAbsolute(value)) {
|
|
169
|
-
throw new Error(`Path is outside repository: ${file}`);
|
|
170
|
-
}
|
|
171
|
-
return value;
|
|
172
|
-
}
|
|
173
194
|
function normalizeRepoPath(value) {
|
|
174
|
-
return value
|
|
195
|
+
return normalizeContextPath(value);
|
|
175
196
|
}
|
|
176
197
|
function sortRecord(value) {
|
|
177
|
-
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left
|
|
198
|
+
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => compareUtf8Paths(left, right)));
|
|
178
199
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ContextCatalog } from "../context-catalog/catalog-types.js";
|
|
2
|
+
import type { ContextMarkdownCatalogAnalysis } from "../context-markdown/context-markdown-types.js";
|
|
3
|
+
import type { ContextInspectResult, ContextInspectRoute } from "./context-inspect-types.js";
|
|
4
|
+
export declare function projectContextInspection(input: {
|
|
5
|
+
catalog: ContextCatalog;
|
|
6
|
+
markdown: ContextMarkdownCatalogAnalysis;
|
|
7
|
+
context_path: string;
|
|
8
|
+
route: ContextInspectRoute | null;
|
|
9
|
+
}): ContextInspectResult;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { compareUtf8Paths } from "../context-catalog/catalog-paths.js";
|
|
2
|
+
const CORE_ROLES = new Map([
|
|
3
|
+
["project_context/global.md", "global"],
|
|
4
|
+
["project_context/architecture.md", "architecture"],
|
|
5
|
+
]);
|
|
6
|
+
export function projectContextInspection(input) {
|
|
7
|
+
const fileAnalysis = input.markdown.files.find((candidate) => candidate.path === input.context_path);
|
|
8
|
+
if (!fileAnalysis)
|
|
9
|
+
throw new Error(`Context Markdown analysis omitted ${input.context_path}`);
|
|
10
|
+
const registered = input.catalog.registered_contexts.find((candidate) => candidate.path === input.context_path);
|
|
11
|
+
const coreRole = CORE_ROLES.get(input.context_path);
|
|
12
|
+
const reasons = [
|
|
13
|
+
...(input.catalog.default_footprint.get(input.context_path) ?? []),
|
|
14
|
+
].sort(compareUtf8Paths);
|
|
15
|
+
const declarationKeys = new Set(fileAnalysis.declarations.map((entry) => `${entry.type}\0${entry.id}`));
|
|
16
|
+
return {
|
|
17
|
+
schema_version: 1,
|
|
18
|
+
path: input.context_path,
|
|
19
|
+
registration: registered || coreRole !== undefined ? "registered" : "unregistered",
|
|
20
|
+
source: coreRole !== undefined ? "core" : (registered?.source ?? null),
|
|
21
|
+
role: coreRole ?? registered?.role ?? null,
|
|
22
|
+
read_policy: registered?.read_policy ?? null,
|
|
23
|
+
read_when: registered?.context?.read_when ?? null,
|
|
24
|
+
triggers: [...(registered?.context?.triggers ?? [])],
|
|
25
|
+
default_children: [...(registered?.context?.default_children ?? [])],
|
|
26
|
+
bytes: fileAnalysis.bytes,
|
|
27
|
+
default_footprint: {
|
|
28
|
+
selected: reasons.length > 0,
|
|
29
|
+
reasons,
|
|
30
|
+
},
|
|
31
|
+
referenced_by: input.markdown.references
|
|
32
|
+
.filter((reference) => reference.status === "valid" &&
|
|
33
|
+
reference.target_path === input.context_path)
|
|
34
|
+
.sort(referenceOrder),
|
|
35
|
+
references: [...fileAnalysis.references].sort(referenceOrder),
|
|
36
|
+
stable_key_declarations: fileAnalysis.declarations,
|
|
37
|
+
stable_key_conflicts: input.markdown.declaration_conflicts.filter((conflict) => declarationKeys.has(`${conflict.type}\0${conflict.id}`)),
|
|
38
|
+
route: input.route,
|
|
39
|
+
diagnostics: input.catalog.diagnostics.filter((diagnostic) => diagnostic.severity === "error" ||
|
|
40
|
+
diagnostic.path === undefined ||
|
|
41
|
+
diagnostic.path === input.context_path),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function referenceOrder(left, right) {
|
|
45
|
+
return (compareUtf8Paths(left.source_path, right.source_path) ||
|
|
46
|
+
left.line - right.line ||
|
|
47
|
+
left.column - right.column ||
|
|
48
|
+
compareUtf8Paths(left.destination, right.destination));
|
|
49
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function renderContextInspectText(result) {
|
|
2
|
+
const lines = [
|
|
3
|
+
`Context: ${result.path}`,
|
|
4
|
+
`registration=${result.registration} source=${result.source ?? "none"} role=${result.role ?? "unknown"}`,
|
|
5
|
+
`read_policy=${result.read_policy ?? "none"} bytes=${result.bytes}`,
|
|
6
|
+
`default=${result.default_footprint.selected}${result.default_footprint.reasons.length > 0 ? ` reasons=${result.default_footprint.reasons.join(",")}` : ""}`,
|
|
7
|
+
`read_when=${result.read_when ?? "none"}`,
|
|
8
|
+
`triggers=${result.triggers.length > 0 ? result.triggers.join(", ") : "none"}`,
|
|
9
|
+
`default_children=${result.default_children.length > 0 ? result.default_children.join(", ") : "none"}`,
|
|
10
|
+
`referenced_by=${result.referenced_by.length}`,
|
|
11
|
+
];
|
|
12
|
+
for (const reference of result.referenced_by)
|
|
13
|
+
lines.push(` ${reference.source_path}:${reference.line}:${reference.column} (${reference.kind})`);
|
|
14
|
+
lines.push(`references=${result.references.length}`);
|
|
15
|
+
for (const reference of result.references)
|
|
16
|
+
lines.push(` ${reference.line}:${reference.column} ${reference.status} ${reference.target_path ?? reference.destination}`);
|
|
17
|
+
lines.push(`stable_key_declarations=${result.stable_key_declarations.length} conflicts=${result.stable_key_conflicts.length}`);
|
|
18
|
+
if (result.route) {
|
|
19
|
+
lines.push(`route complete=${result.route.complete} catalog_valid=${result.route.catalog_valid} selected=${result.route.selected}`);
|
|
20
|
+
if (result.route.candidate)
|
|
21
|
+
for (const reason of result.route.candidate.reasons)
|
|
22
|
+
lines.push(` ${reason.kind}: ${reason.input} — ${reason.detail}`);
|
|
23
|
+
else
|
|
24
|
+
lines.push(" no path, trigger, bounded literal or manual selection reason matched this Context");
|
|
25
|
+
}
|
|
26
|
+
for (const diagnostic of result.diagnostics)
|
|
27
|
+
lines.push(`${diagnostic.severity}: ${diagnostic.code}: ${diagnostic.message}`);
|
|
28
|
+
return `${lines.join("\n")}\n`;
|
|
29
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CatalogDiagnostic } from "../context-catalog/catalog-types.js";
|
|
2
|
+
import type { ContextRole } from "../context-catalog/catalog-portable-contract.js";
|
|
3
|
+
import type { DefaultContextSelectionReason } from "../context-catalog/catalog-default-footprint.js";
|
|
4
|
+
import type { ContextMarkdownReference, ContextStableKeyConflict, ContextStableKeyDeclaration } from "../context-markdown/context-markdown-types.js";
|
|
5
|
+
import type { ContextRouteAmbiguity, ContextRouteCandidate, ContextRouteUnresolved } from "../context-router/context-route-types.js";
|
|
6
|
+
export interface ContextInspectRoute {
|
|
7
|
+
complete: boolean;
|
|
8
|
+
catalog_valid: boolean;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
candidate: ContextRouteCandidate | null;
|
|
11
|
+
ambiguous: ContextRouteAmbiguity[];
|
|
12
|
+
unresolved: ContextRouteUnresolved[];
|
|
13
|
+
}
|
|
14
|
+
export interface ContextInspectResult {
|
|
15
|
+
schema_version: 1;
|
|
16
|
+
path: string;
|
|
17
|
+
registration: "registered" | "unregistered";
|
|
18
|
+
source: "core" | "area" | "context" | null;
|
|
19
|
+
role: ContextRole | null;
|
|
20
|
+
read_policy: string | null;
|
|
21
|
+
read_when: string | null;
|
|
22
|
+
triggers: string[];
|
|
23
|
+
default_children: string[];
|
|
24
|
+
bytes: number;
|
|
25
|
+
default_footprint: {
|
|
26
|
+
selected: boolean;
|
|
27
|
+
reasons: DefaultContextSelectionReason[];
|
|
28
|
+
};
|
|
29
|
+
referenced_by: ContextMarkdownReference[];
|
|
30
|
+
references: ContextMarkdownReference[];
|
|
31
|
+
stable_key_declarations: ContextStableKeyDeclaration[];
|
|
32
|
+
stable_key_conflicts: ContextStableKeyConflict[];
|
|
33
|
+
route: ContextInspectRoute | null;
|
|
34
|
+
diagnostics: CatalogDiagnostic[];
|
|
35
|
+
}
|
|
36
|
+
export interface ContextInspectInput {
|
|
37
|
+
project_root: string;
|
|
38
|
+
context_path: string;
|
|
39
|
+
route_task?: string;
|
|
40
|
+
route_paths?: string[];
|
|
41
|
+
route_terms?: string[];
|
|
42
|
+
route_case_sensitive?: boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { lstat, realpath } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { CLI_EXIT_CODES, CliCommandError } from "../cli-exit.js";
|
|
4
|
+
import { loadContextCatalog } from "../context-catalog/catalog-load.js";
|
|
5
|
+
import { isPathWithin, normalizeContextPath, } from "../context-catalog/catalog-paths.js";
|
|
6
|
+
import { analyzeContextMarkdownCatalog } from "../context-markdown/context-markdown-analysis.js";
|
|
7
|
+
import { routeContext } from "../context-router/context-route.js";
|
|
8
|
+
import { projectContextInspection } from "./context-inspect-projection.js";
|
|
9
|
+
export async function inspectContext(input) {
|
|
10
|
+
const projectRoot = path.resolve(input.project_root);
|
|
11
|
+
const contextPath = normalizeInspectedPath(input.context_path);
|
|
12
|
+
let catalog;
|
|
13
|
+
try {
|
|
14
|
+
catalog = await loadContextCatalog(projectRoot);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, `unable to load Context Catalog: ${message(error)}`, { cause: error });
|
|
18
|
+
}
|
|
19
|
+
const file = catalog.context_files.find((candidate) => candidate.path === contextPath);
|
|
20
|
+
if (!file)
|
|
21
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, `Context inspect target is not an eligible Markdown file: ${contextPath}`);
|
|
22
|
+
try {
|
|
23
|
+
await verifyOrdinaryInRepositoryFile(projectRoot, file.absolute_path);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error instanceof CliCommandError)
|
|
27
|
+
throw error;
|
|
28
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, `unable to inspect Context file identity: ${message(error)}`, { cause: error });
|
|
29
|
+
}
|
|
30
|
+
let markdown;
|
|
31
|
+
try {
|
|
32
|
+
markdown = await analyzeContextMarkdownCatalog({
|
|
33
|
+
project_root: projectRoot,
|
|
34
|
+
files: catalog.context_files,
|
|
35
|
+
long_line_threshold: Number.MAX_SAFE_INTEGER,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, `unable to analyze Context Markdown: ${message(error)}`, { cause: error });
|
|
40
|
+
}
|
|
41
|
+
const routeRequested = input.route_task !== undefined ||
|
|
42
|
+
(input.route_paths?.length ?? 0) > 0 ||
|
|
43
|
+
(input.route_terms?.length ?? 0) > 0;
|
|
44
|
+
let route = null;
|
|
45
|
+
if (routeRequested) {
|
|
46
|
+
const routed = await routeContext({
|
|
47
|
+
project_root: projectRoot,
|
|
48
|
+
task: input.route_task ?? "",
|
|
49
|
+
paths: input.route_paths ?? [],
|
|
50
|
+
explicit_terms: input.route_terms ?? [],
|
|
51
|
+
case_sensitive: input.route_case_sensitive,
|
|
52
|
+
});
|
|
53
|
+
const candidate = [
|
|
54
|
+
...routed.candidates,
|
|
55
|
+
...routed.unregistered_matches,
|
|
56
|
+
].find((entry) => entry.path === contextPath);
|
|
57
|
+
route = {
|
|
58
|
+
complete: routed.complete,
|
|
59
|
+
catalog_valid: routed.catalog_valid,
|
|
60
|
+
selected: Boolean(candidate),
|
|
61
|
+
candidate: candidate ?? null,
|
|
62
|
+
ambiguous: routed.ambiguous,
|
|
63
|
+
unresolved: routed.unresolved,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
return projectContextInspection({
|
|
68
|
+
catalog,
|
|
69
|
+
markdown,
|
|
70
|
+
context_path: contextPath,
|
|
71
|
+
route,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
throw new CliCommandError(CLI_EXIT_CODES.internal, message(error), {
|
|
76
|
+
cause: error,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function normalizeInspectedPath(value) {
|
|
81
|
+
if (path.isAbsolute(value))
|
|
82
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, "Context inspect requires a repository-relative path");
|
|
83
|
+
const normalized = normalizeContextPath(value);
|
|
84
|
+
if (!normalized.startsWith("project_context/") ||
|
|
85
|
+
!normalized.toLowerCase().endsWith(".md") ||
|
|
86
|
+
normalized.split("/").includes(".."))
|
|
87
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, `Context inspect target must be a Markdown file under project_context/: ${value}`);
|
|
88
|
+
return normalized;
|
|
89
|
+
}
|
|
90
|
+
async function verifyOrdinaryInRepositoryFile(projectRoot, absolutePath) {
|
|
91
|
+
const metadata = await lstat(absolutePath);
|
|
92
|
+
if (!metadata.isFile() || metadata.isSymbolicLink())
|
|
93
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, "Context inspect target must be an ordinary file");
|
|
94
|
+
const repositoryIdentity = await realpath(projectRoot);
|
|
95
|
+
// Catalog discovery owns the canonical NFC key -> physical file mapping.
|
|
96
|
+
// Re-resolving the key would lose an NFD spelling on filesystems that keep
|
|
97
|
+
// canonical-equivalent names distinct.
|
|
98
|
+
const targetIdentity = await realpath(absolutePath);
|
|
99
|
+
if (!isPathWithin(repositoryIdentity, targetIdentity))
|
|
100
|
+
throw new CliCommandError(CLI_EXIT_CODES.io, "Context inspect target resolves outside the repository");
|
|
101
|
+
}
|
|
102
|
+
function message(error) {
|
|
103
|
+
return error instanceof Error ? error.message : String(error);
|
|
104
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ContextRole
|
|
1
|
+
export type { ContextRole } from "./context-catalog/catalog-portable-contract.js";
|
|
2
2
|
export interface ContextAreaEntry {
|
|
3
3
|
line: number;
|
|
4
4
|
id: string;
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import { parse } from "smol-toml";
|
|
2
|
-
|
|
3
|
-
const AREA_FIELDS = new Set([
|
|
4
|
-
"id",
|
|
5
|
-
"root",
|
|
6
|
-
"context",
|
|
7
|
-
"kind",
|
|
8
|
-
"default",
|
|
9
|
-
"forbidden_runtime_dependencies",
|
|
10
|
-
]);
|
|
11
|
-
const CONTEXT_FIELDS = new Set([
|
|
12
|
-
"path",
|
|
13
|
-
"role",
|
|
14
|
-
"read_when",
|
|
15
|
-
"read_policy",
|
|
16
|
-
"triggers",
|
|
17
|
-
"default_children",
|
|
18
|
-
]);
|
|
2
|
+
import { CONTEXT_AREA_FIELDS, CONTEXT_NODE_FIELDS, CONTEXT_TOP_LEVEL_FIELDS, } from "./context-catalog/catalog-portable-contract.js";
|
|
19
3
|
export function parseContextManifest(content, file = "project_context/context.toml") {
|
|
20
4
|
const errors = [];
|
|
21
5
|
let parsed;
|
|
@@ -29,7 +13,7 @@ export function parseContextManifest(content, file = "project_context/context.to
|
|
|
29
13
|
],
|
|
30
14
|
};
|
|
31
15
|
}
|
|
32
|
-
rejectUnknownFields(parsed,
|
|
16
|
+
rejectUnknownFields(parsed, CONTEXT_TOP_LEVEL_FIELDS, file, errors);
|
|
33
17
|
const rawAreas = tableArray(parsed.areas, "[[areas]]", file, errors);
|
|
34
18
|
const rawContexts = tableArray(parsed.context, "[[context]]", file, errors);
|
|
35
19
|
const areaLines = tableLines(content, "areas");
|
|
@@ -37,7 +21,7 @@ export function parseContextManifest(content, file = "project_context/context.to
|
|
|
37
21
|
const areas = [];
|
|
38
22
|
for (const [index, value] of rawAreas.entries()) {
|
|
39
23
|
const location = `${file} line ${areaLines[index] ?? 1}`;
|
|
40
|
-
rejectUnknownFields(value,
|
|
24
|
+
rejectUnknownFields(value, CONTEXT_AREA_FIELDS, location, errors);
|
|
41
25
|
const id = requiredString(value, "id", location, errors);
|
|
42
26
|
const root = requiredString(value, "root", location, errors);
|
|
43
27
|
const context = requiredString(value, "context", location, errors);
|
|
@@ -59,7 +43,7 @@ export function parseContextManifest(content, file = "project_context/context.to
|
|
|
59
43
|
const contexts = [];
|
|
60
44
|
for (const [index, value] of rawContexts.entries()) {
|
|
61
45
|
const location = `${file} line ${contextLines[index] ?? 1}`;
|
|
62
|
-
rejectUnknownFields(value,
|
|
46
|
+
rejectUnknownFields(value, CONTEXT_NODE_FIELDS, location, errors);
|
|
63
47
|
const path = requiredString(value, "path", location, errors);
|
|
64
48
|
const role = requiredString(value, "role", location, errors);
|
|
65
49
|
const readWhen = optionalString(value, "read_when", location, errors);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CatalogFile } from "../context-catalog/catalog-types.js";
|
|
2
|
+
import type { ContextMarkdownCatalogAnalysis, ContextMarkdownFileAnalysis } from "./context-markdown-types.js";
|
|
3
|
+
export declare function analyzeContextMarkdownCatalog(input: {
|
|
4
|
+
project_root: string;
|
|
5
|
+
files: CatalogFile[];
|
|
6
|
+
long_line_threshold: number;
|
|
7
|
+
file_overrides?: ReadonlyMap<string, Uint8Array | null>;
|
|
8
|
+
}): Promise<ContextMarkdownCatalogAnalysis>;
|
|
9
|
+
export declare function analyzeContextMarkdownFile(input: {
|
|
10
|
+
project_root: string;
|
|
11
|
+
file: CatalogFile;
|
|
12
|
+
catalog_files?: ReadonlyMap<string, CatalogFile>;
|
|
13
|
+
long_line_threshold: number;
|
|
14
|
+
file_overrides?: ReadonlyMap<string, Uint8Array | null>;
|
|
15
|
+
}): Promise<ContextMarkdownFileAnalysis>;
|