project-tiny-context-harness 0.2.84 → 0.6.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 +163 -428
- package/assets/README.md +283 -455
- package/assets/README.zh-CN.md +199 -123
- package/assets/agents/AGENTS_CORE.md +54 -67
- package/assets/context_templates/context.toml +3 -0
- package/assets/context_templates/global.md +6 -6
- package/assets/github/harness.yml +2 -2
- package/assets/skills/context_development_engineer/SKILL.md +91 -107
- package/assets/skills/context_product_plan/SKILL.md +18 -28
- package/assets/skills/context_surface_contract/SKILL.md +35 -38
- package/assets/skills/context_uiux_design/SKILL.md +31 -30
- package/assets/skills/long-task-workflow/SKILL.md +76 -0
- package/assets/skills/long-task-workflow/agents/openai.yaml +4 -0
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +41 -0
- package/assets/skills/long-task-workflow/references/contract-authoring.md +62 -0
- package/assets/skills/long-task-workflow/references/evidence-design.md +45 -0
- package/assets/skills/normal-long-task/SKILL.md +12 -489
- package/assets/skills/source-plan-authoring/SKILL.md +379 -0
- package/assets/tools/validate_context.py +293 -127
- package/dist/cli.js +3 -1
- package/dist/commands/check-modularity.js +33 -10
- package/dist/commands/composite-campaign.d.ts +1 -0
- package/dist/commands/composite-campaign.js +8 -0
- package/dist/commands/composite-long-task.d.ts +1 -6
- package/dist/commands/composite-long-task.js +7 -157
- package/dist/commands/delivery-set.d.ts +1 -0
- package/dist/commands/delivery-set.js +8 -0
- package/dist/commands/disable.d.ts +1 -0
- package/dist/commands/disable.js +15 -0
- package/dist/commands/enable.d.ts +1 -0
- package/dist/commands/enable.js +14 -0
- package/dist/commands/export-context-args.js +13 -4
- package/dist/commands/export-context.js +18 -7
- package/dist/commands/index.js +42 -30
- package/dist/commands/init.js +12 -6
- package/dist/commands/long-task-authoring.d.ts +3 -0
- package/dist/commands/long-task-authoring.js +92 -0
- package/dist/commands/long-task-explain.d.ts +1 -0
- package/dist/commands/long-task-explain.js +52 -0
- package/dist/commands/long-task.d.ts +1 -0
- package/dist/commands/long-task.js +226 -0
- package/dist/commands/package-source.js +2 -2
- package/dist/commands/upgrade.js +10 -10
- package/dist/index.d.ts +11 -1
- package/dist/index.js +8 -0
- package/dist/lib/config.js +34 -8
- package/dist/lib/context-default-footprint.d.ts +16 -0
- package/dist/lib/context-default-footprint.js +107 -0
- package/dist/lib/context-export.js +105 -41
- package/dist/lib/context-graph-snapshot.d.ts +18 -0
- package/dist/lib/context-graph-snapshot.js +171 -0
- package/dist/lib/context-manifest-schema.d.ts +28 -0
- package/dist/lib/context-manifest-schema.js +150 -0
- package/dist/lib/context-manifest.js +28 -20
- package/dist/lib/context-templates.js +5 -5
- package/dist/lib/design-md.js +1 -1
- package/dist/lib/doctor.js +54 -1
- package/dist/lib/harness-root.js +25 -8
- package/dist/lib/init.js +6 -3
- package/dist/lib/legacy-managed-scan.js +23 -7
- package/dist/lib/legacy-sdlc-migration.js +21 -11
- package/dist/lib/long-task-acceptance-reference.d.ts +22 -0
- package/dist/lib/long-task-acceptance-reference.js +46 -0
- package/dist/lib/long-task-acceptance-shape.d.ts +5 -0
- package/dist/lib/long-task-acceptance-shape.js +131 -0
- package/dist/lib/long-task-activation-validation.d.ts +21 -0
- package/dist/lib/long-task-activation-validation.js +136 -0
- package/dist/lib/long-task-artifacts.d.ts +5 -0
- package/dist/lib/long-task-artifacts.js +34 -0
- package/dist/lib/long-task-assertions-v2.d.ts +22 -0
- package/dist/lib/long-task-assertions-v2.js +212 -0
- package/dist/lib/long-task-authoring-authority-preview.d.ts +5 -0
- package/dist/lib/long-task-authoring-authority-preview.js +85 -0
- package/dist/lib/long-task-authoring-preflight-diagnostics.d.ts +8 -0
- package/dist/lib/long-task-authoring-preflight-diagnostics.js +179 -0
- package/dist/lib/long-task-authoring-preflight-repair-order.d.ts +8 -0
- package/dist/lib/long-task-authoring-preflight-repair-order.js +95 -0
- package/dist/lib/long-task-authoring-preflight-types.d.ts +46 -0
- package/dist/lib/long-task-authoring-preflight-types.js +38 -0
- package/dist/lib/long-task-authoring-preflight.d.ts +3 -0
- package/dist/lib/long-task-authoring-preflight.js +44 -0
- package/dist/lib/long-task-authority-material-diff.d.ts +17 -0
- package/dist/lib/long-task-authority-material-diff.js +152 -0
- package/dist/lib/long-task-authority-materials.d.ts +7 -0
- package/dist/lib/long-task-authority-materials.js +83 -0
- package/dist/lib/long-task-authority-policy.d.ts +168 -0
- package/dist/lib/long-task-authority-policy.js +181 -0
- package/dist/lib/long-task-authority-revision-details.d.ts +19 -0
- package/dist/lib/long-task-authority-revision-details.js +192 -0
- package/dist/lib/long-task-authority-revision-enforcement.d.ts +3 -0
- package/dist/lib/long-task-authority-revision-enforcement.js +41 -0
- package/dist/lib/long-task-authority-revision-types.d.ts +50 -0
- package/dist/lib/long-task-authority-revision-types.js +1 -0
- package/dist/lib/long-task-authority-revision.d.ts +4 -0
- package/dist/lib/long-task-authority-revision.js +188 -0
- package/dist/lib/long-task-authority-transition-policy.d.ts +62 -0
- package/dist/lib/long-task-authority-transition-policy.js +62 -0
- package/dist/lib/long-task-authority-types.d.ts +96 -0
- package/dist/lib/long-task-authority-types.js +1 -0
- package/dist/lib/long-task-authority.d.ts +7 -0
- package/dist/lib/long-task-authority.js +142 -0
- package/dist/lib/long-task-boundary-check.d.ts +15 -0
- package/dist/lib/long-task-boundary-check.js +9 -0
- package/dist/lib/long-task-check-evidence-decoder.d.ts +3 -0
- package/dist/lib/long-task-check-evidence-decoder.js +74 -0
- package/dist/lib/long-task-check-execution-policy.d.ts +18 -0
- package/dist/lib/long-task-check-execution-policy.js +36 -0
- package/dist/lib/long-task-check-runner.d.ts +2 -0
- package/dist/lib/long-task-check-runner.js +181 -0
- package/dist/lib/long-task-check-shape.d.ts +2 -0
- package/dist/lib/long-task-check-shape.js +136 -0
- package/dist/lib/long-task-claim-definitions.d.ts +7 -0
- package/dist/lib/long-task-claim-definitions.js +78 -0
- package/dist/lib/long-task-claim-proof-policy.d.ts +4 -0
- package/dist/lib/long-task-claim-proof-policy.js +57 -0
- package/dist/lib/long-task-claims.d.ts +10 -0
- package/dist/lib/long-task-claims.js +187 -0
- package/dist/lib/long-task-context-authority-topology.d.ts +7 -0
- package/dist/lib/long-task-context-authority-topology.js +37 -0
- package/dist/lib/long-task-context-authority.d.ts +14 -0
- package/dist/lib/long-task-context-authority.js +66 -0
- package/dist/lib/long-task-contract-types.d.ts +203 -0
- package/dist/lib/long-task-contract-types.js +1 -0
- package/dist/lib/long-task-counterfactual-claim-policy.d.ts +10 -0
- package/dist/lib/long-task-counterfactual-claim-policy.js +57 -0
- package/dist/lib/long-task-counterfactual-sandbox.d.ts +6 -0
- package/dist/lib/long-task-counterfactual-sandbox.js +87 -0
- package/dist/lib/long-task-counterfactual-types.d.ts +24 -0
- package/dist/lib/long-task-counterfactual-types.js +1 -0
- package/dist/lib/long-task-delivery-compiler.d.ts +10 -0
- package/dist/lib/long-task-delivery-compiler.js +129 -0
- package/dist/lib/long-task-delivery-parser.d.ts +13 -0
- package/dist/lib/long-task-delivery-parser.js +90 -0
- package/dist/lib/long-task-delivery-preflight.d.ts +5 -0
- package/dist/lib/long-task-delivery-preflight.js +151 -0
- package/dist/lib/long-task-delivery-shape.d.ts +5 -0
- package/dist/lib/long-task-delivery-shape.js +5 -0
- package/dist/lib/long-task-delivery-types.d.ts +8 -0
- package/dist/lib/long-task-delivery-types.js +8 -0
- package/dist/lib/long-task-delivery-validation.d.ts +3 -0
- package/dist/lib/long-task-delivery-validation.js +175 -0
- package/dist/lib/long-task-evidence-adapter-policy.d.ts +4 -0
- package/dist/lib/long-task-evidence-adapter-policy.js +15 -0
- package/dist/lib/long-task-evidence-adapter-types.d.ts +1 -0
- package/dist/lib/long-task-evidence-adapter-types.js +1 -0
- package/dist/lib/long-task-evidence-findings.d.ts +5 -0
- package/dist/lib/long-task-evidence-findings.js +113 -0
- package/dist/lib/long-task-evidence-sensitivity-policy.d.ts +4 -0
- package/dist/lib/long-task-evidence-sensitivity-policy.js +98 -0
- package/dist/lib/long-task-evidence-v2.d.ts +5 -0
- package/dist/lib/long-task-evidence-v2.js +226 -0
- package/dist/lib/long-task-explain-acceptance-link.d.ts +46 -0
- package/dist/lib/long-task-explain-acceptance-link.js +96 -0
- package/dist/lib/long-task-explain-claim-links.d.ts +45 -0
- package/dist/lib/long-task-explain-claim-links.js +88 -0
- package/dist/lib/long-task-explain-source-links.d.ts +93 -0
- package/dist/lib/long-task-explain-source-links.js +51 -0
- package/dist/lib/long-task-final-v2.d.ts +2 -0
- package/dist/lib/long-task-final-v2.js +124 -0
- package/dist/lib/long-task-finding-context.d.ts +3 -0
- package/dist/lib/long-task-finding-context.js +63 -0
- package/dist/lib/long-task-freshness.d.ts +3 -0
- package/dist/lib/long-task-freshness.js +80 -0
- package/dist/lib/long-task-hook-install.d.ts +9 -0
- package/dist/lib/long-task-hook-install.js +184 -0
- package/dist/lib/long-task-hook-preflight.d.ts +7 -0
- package/dist/lib/long-task-hook-preflight.js +58 -0
- package/dist/lib/long-task-observation-ownership.d.ts +2 -0
- package/dist/lib/long-task-observation-ownership.js +22 -0
- package/dist/lib/long-task-outcome-parser.d.ts +4 -0
- package/dist/lib/long-task-outcome-parser.js +100 -0
- package/dist/lib/long-task-paths.d.ts +49 -0
- package/dist/lib/long-task-paths.js +418 -0
- package/dist/lib/long-task-playwright-counterfactual-policy.d.ts +7 -0
- package/dist/lib/long-task-playwright-counterfactual-policy.js +125 -0
- package/dist/lib/long-task-playwright-evidence.d.ts +6 -0
- package/dist/lib/long-task-playwright-evidence.js +244 -0
- package/dist/lib/long-task-product-shape.d.ts +6 -0
- package/dist/lib/long-task-product-shape.js +73 -0
- package/dist/lib/long-task-progress.d.ts +4 -0
- package/dist/lib/long-task-progress.js +114 -0
- package/dist/lib/long-task-protected-files.d.ts +1 -0
- package/dist/lib/long-task-protected-files.js +30 -0
- package/dist/lib/long-task-required-proof-surfaces.d.ts +2 -0
- package/dist/lib/long-task-required-proof-surfaces.js +13 -0
- package/dist/lib/long-task-requirement-shape.d.ts +2 -0
- package/dist/lib/long-task-requirement-shape.js +18 -0
- package/dist/lib/long-task-risk-surfaces.d.ts +2 -0
- package/dist/lib/long-task-risk-surfaces.js +60 -0
- package/dist/lib/long-task-risk-types.d.ts +5 -0
- package/dist/lib/long-task-risk-types.js +12 -0
- package/dist/lib/long-task-risk.d.ts +9 -0
- package/dist/lib/long-task-risk.js +132 -0
- package/dist/lib/long-task-root-shape.d.ts +4 -0
- package/dist/lib/long-task-root-shape.js +86 -0
- package/dist/lib/long-task-runner-environment.d.ts +7 -0
- package/dist/lib/long-task-runner-environment.js +57 -0
- package/dist/lib/long-task-runner-files.d.ts +3 -0
- package/dist/lib/long-task-runner-files.js +39 -0
- package/dist/lib/long-task-runner-freeze.d.ts +2 -0
- package/dist/lib/long-task-runner-freeze.js +168 -0
- package/dist/lib/long-task-runtime-types.d.ts +214 -0
- package/dist/lib/long-task-runtime-types.js +1 -0
- package/dist/lib/long-task-shape-primitives.d.ts +17 -0
- package/dist/lib/long-task-shape-primitives.js +81 -0
- package/dist/lib/long-task-source-authority-types.d.ts +13 -0
- package/dist/lib/long-task-source-authority-types.js +1 -0
- package/dist/lib/long-task-source-claim-validation.d.ts +5 -0
- package/dist/lib/long-task-source-claim-validation.js +96 -0
- package/dist/lib/long-task-source-continuity.d.ts +4 -0
- package/dist/lib/long-task-source-continuity.js +57 -0
- package/dist/lib/long-task-source-inventory.d.ts +2 -0
- package/dist/lib/long-task-source-inventory.js +21 -0
- package/dist/lib/long-task-source-item-parser.d.ts +3 -0
- package/dist/lib/long-task-source-item-parser.js +112 -0
- package/dist/lib/long-task-source-shape.d.ts +2 -0
- package/dist/lib/long-task-source-shape.js +56 -0
- package/dist/lib/long-task-source-target-continuity.d.ts +4 -0
- package/dist/lib/long-task-source-target-continuity.js +80 -0
- package/dist/lib/long-task-source-target-index.d.ts +12 -0
- package/dist/lib/long-task-source-target-index.js +76 -0
- package/dist/lib/long-task-source-validation.d.ts +3 -0
- package/dist/lib/long-task-source-validation.js +46 -0
- package/dist/lib/long-task-state.d.ts +91 -0
- package/dist/lib/long-task-state.js +611 -0
- package/dist/lib/long-task-status-projection.d.ts +21 -0
- package/dist/lib/long-task-status-projection.js +116 -0
- package/dist/lib/long-task-status-v2.d.ts +37 -0
- package/dist/lib/long-task-status-v2.js +306 -0
- package/dist/lib/long-task-technical-shape.d.ts +3 -0
- package/dist/lib/long-task-technical-shape.js +44 -0
- package/dist/lib/long-task-verifier-authority.d.ts +12 -0
- package/dist/lib/long-task-verifier-authority.js +47 -0
- package/dist/lib/long-task-verifier-identity.d.ts +2 -0
- package/dist/lib/long-task-verifier-identity.js +55 -0
- package/dist/lib/long-task-verifier-v2.d.ts +13 -0
- package/dist/lib/long-task-verifier-v2.js +266 -0
- package/dist/lib/long-task-workspace-runtime-types.d.ts +23 -0
- package/dist/lib/long-task-workspace-runtime-types.js +1 -0
- package/dist/lib/long-task-workspace.d.ts +25 -0
- package/dist/lib/long-task-workspace.js +366 -0
- package/dist/lib/managed-file.js +20 -5
- package/dist/lib/migrations.js +156 -32
- package/dist/lib/modularity.d.ts +27 -1
- package/dist/lib/modularity.js +499 -23
- package/dist/lib/package-json-config.js +14 -5
- package/dist/lib/package-source.js +15 -3
- package/dist/lib/profiles.d.ts +13 -0
- package/dist/lib/profiles.js +66 -0
- package/dist/lib/schema-guard.js +4 -2
- package/dist/lib/source-files.js +14 -7
- package/dist/lib/source-pack-classify.js +91 -19
- package/dist/lib/source-pack-config.js +25 -8
- package/dist/lib/source-pack-export.js +84 -25
- package/dist/lib/source-pack-manifest.js +18 -6
- package/dist/lib/source-pack-records.js +35 -11
- package/dist/lib/source-pack-render.js +47 -18
- package/dist/lib/stable-json.d.ts +2 -0
- package/dist/lib/stable-json.js +21 -0
- package/dist/lib/strict-codec.d.ts +4 -0
- package/dist/lib/strict-codec.js +65 -0
- package/dist/lib/sync-engine.js +76 -24
- package/dist/lib/types.d.ts +8 -1
- package/dist/lib/upgrade.js +4 -3
- package/dist/lib/validators.js +218 -191
- package/dist/long-task-hook.d.ts +2 -0
- package/dist/long-task-hook.js +55 -0
- package/dist/schemas/long-task-delivery-v2/long-task-delivery-v2.schema.json +340 -0
- package/dist/schemas/long-task-delivery-v2/long-task-outcomes-v2.schema.json +18 -0
- package/migrations/README.md +8 -3
- package/package.json +17 -6
- package/source-mappings.yaml +0 -3
- package/assets/protected-harness-baseline.json +0 -20
- package/assets/skills/composite-long-task-workflow/SKILL.md +0 -244
- package/assets/skills/composite-long-task-workflow/assets/execution-binding.template.md +0 -57
- package/assets/skills/composite-long-task-workflow/assets/goal-objective.template.md +0 -17
- package/assets/skills/composite-long-task-workflow/references/composite-long-task-workflow-protocol.md +0 -675
- package/dist/commands/superpowers.d.ts +0 -1
- package/dist/commands/superpowers.js +0 -8
- package/dist/lib/composite-long-task-renderer.d.ts +0 -12
- package/dist/lib/composite-long-task-renderer.js +0 -109
- package/dist/lib/plan-acceptance-artifacts.d.ts +0 -1
- package/dist/lib/plan-acceptance-artifacts.js +0 -220
- package/dist/lib/plan-acceptance-evidence.d.ts +0 -2
- package/dist/lib/plan-acceptance-evidence.js +0 -108
- package/dist/lib/plan-acceptance-json.d.ts +0 -15
- package/dist/lib/plan-acceptance-json.js +0 -133
- package/dist/lib/plan-acceptance-validator.d.ts +0 -2
- package/dist/lib/plan-acceptance-validator.js +0 -209
- package/dist/lib/plan-contract-validator.d.ts +0 -2
- package/dist/lib/plan-contract-validator.js +0 -127
- package/dist/lib/plan-validator-common.d.ts +0 -24
- package/dist/lib/plan-validator-common.js +0 -196
- package/dist/lib/superpowers-task-ac010.d.ts +0 -6
- package/dist/lib/superpowers-task-ac010.js +0 -26
- package/dist/lib/superpowers-task-assertion-normalizers.d.ts +0 -3
- package/dist/lib/superpowers-task-assertion-normalizers.js +0 -74
- package/dist/lib/superpowers-task-assertions.d.ts +0 -20
- package/dist/lib/superpowers-task-assertions.js +0 -257
- package/dist/lib/superpowers-task-attempt.d.ts +0 -4
- package/dist/lib/superpowers-task-attempt.js +0 -102
- package/dist/lib/superpowers-task-command-run-correlation.d.ts +0 -8
- package/dist/lib/superpowers-task-command-run-correlation.js +0 -103
- package/dist/lib/superpowers-task-command-specs.d.ts +0 -3
- package/dist/lib/superpowers-task-command-specs.js +0 -52
- package/dist/lib/superpowers-task-compile-diagnostics.d.ts +0 -5
- package/dist/lib/superpowers-task-compile-diagnostics.js +0 -20
- package/dist/lib/superpowers-task-compile-guards.d.ts +0 -2
- package/dist/lib/superpowers-task-compile-guards.js +0 -66
- package/dist/lib/superpowers-task-compile.d.ts +0 -6
- package/dist/lib/superpowers-task-compile.js +0 -133
- package/dist/lib/superpowers-task-completion-output.d.ts +0 -52
- package/dist/lib/superpowers-task-completion-output.js +0 -228
- package/dist/lib/superpowers-task-conformance.d.ts +0 -2
- package/dist/lib/superpowers-task-conformance.js +0 -24
- package/dist/lib/superpowers-task-contradictions.d.ts +0 -6
- package/dist/lib/superpowers-task-contradictions.js +0 -126
- package/dist/lib/superpowers-task-current-evidence.d.ts +0 -3
- package/dist/lib/superpowers-task-current-evidence.js +0 -176
- package/dist/lib/superpowers-task-delivery.d.ts +0 -4
- package/dist/lib/superpowers-task-delivery.js +0 -96
- package/dist/lib/superpowers-task-derive.d.ts +0 -14
- package/dist/lib/superpowers-task-derive.js +0 -382
- package/dist/lib/superpowers-task-events.d.ts +0 -1
- package/dist/lib/superpowers-task-events.js +0 -13
- package/dist/lib/superpowers-task-evidence-kernel.d.ts +0 -19
- package/dist/lib/superpowers-task-evidence-kernel.js +0 -347
- package/dist/lib/superpowers-task-evidence-records.d.ts +0 -2
- package/dist/lib/superpowers-task-evidence-records.js +0 -55
- package/dist/lib/superpowers-task-evidence.d.ts +0 -10
- package/dist/lib/superpowers-task-evidence.js +0 -147
- package/dist/lib/superpowers-task-fields.d.ts +0 -22
- package/dist/lib/superpowers-task-fields.js +0 -276
- package/dist/lib/superpowers-task-final-card.d.ts +0 -3
- package/dist/lib/superpowers-task-final-card.js +0 -24
- package/dist/lib/superpowers-task-gates.d.ts +0 -12
- package/dist/lib/superpowers-task-gates.js +0 -155
- package/dist/lib/superpowers-task-harness-drift.d.ts +0 -11
- package/dist/lib/superpowers-task-harness-drift.js +0 -90
- package/dist/lib/superpowers-task-next-slices.d.ts +0 -1
- package/dist/lib/superpowers-task-next-slices.js +0 -12
- package/dist/lib/superpowers-task-protected-baseline.d.ts +0 -10
- package/dist/lib/superpowers-task-protected-baseline.js +0 -66
- package/dist/lib/superpowers-task-source-compile.d.ts +0 -5
- package/dist/lib/superpowers-task-source-compile.js +0 -226
- package/dist/lib/superpowers-task-source-parser.d.ts +0 -23
- package/dist/lib/superpowers-task-source-parser.js +0 -218
- package/dist/lib/superpowers-task-state-schema.d.ts +0 -440
- package/dist/lib/superpowers-task-state-schema.js +0 -66
- package/dist/lib/superpowers-task-state-shape.d.ts +0 -3
- package/dist/lib/superpowers-task-state-shape.js +0 -50
- package/dist/lib/superpowers-task-state.d.ts +0 -16
- package/dist/lib/superpowers-task-state.js +0 -246
- package/dist/lib/superpowers-task-status.d.ts +0 -2
- package/dist/lib/superpowers-task-status.js +0 -24
- package/dist/lib/superpowers-task-under-specified.d.ts +0 -7
- package/dist/lib/superpowers-task-under-specified.js +0 -61
- package/dist/lib/superpowers-task-unregistered-evidence.d.ts +0 -11
- package/dist/lib/superpowers-task-unregistered-evidence.js +0 -72
- package/dist/lib/superpowers-task-validator.d.ts +0 -5
- package/dist/lib/superpowers-task-validator.js +0 -290
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { isHarnessPath } from "./superpowers-task-harness-drift.js";
|
|
2
|
-
import { isRecord } from "./superpowers-task-state-schema.js";
|
|
3
|
-
export const PROTECTED_BASELINE_PATHS = [
|
|
4
|
-
"packages/ty-context/assets/protected-harness-baseline.json",
|
|
5
|
-
".codex/ty-context-managed/protected-harness-baseline.json",
|
|
6
|
-
"packages/ty-context/source-mappings.yaml",
|
|
7
|
-
"packages/ty-context/src/lib/superpowers-task-gates.ts",
|
|
8
|
-
"packages/ty-context/src/lib/superpowers-task-completion-output.ts",
|
|
9
|
-
"packages/ty-context/src/lib/superpowers-task-final-card.ts",
|
|
10
|
-
"packages/ty-context/src/lib/superpowers-task-validator.ts",
|
|
11
|
-
"packages/ty-context/src/lib/superpowers-task-derive.ts",
|
|
12
|
-
"packages/ty-context/src/lib/superpowers-task-evidence.ts",
|
|
13
|
-
"packages/ty-context/src/lib/superpowers-task-evidence-kernel.ts",
|
|
14
|
-
"packages/ty-context/src/lib/superpowers-task-current-evidence.ts",
|
|
15
|
-
"packages/ty-context/src/lib/superpowers-task-command-run-correlation.ts",
|
|
16
|
-
"packages/ty-context/src/lib/superpowers-task-unregistered-evidence.ts",
|
|
17
|
-
"packages/ty-context/src/lib/superpowers-task-ac010.ts",
|
|
18
|
-
"packages/ty-context/src/lib/superpowers-task-harness-drift.ts",
|
|
19
|
-
"packages/ty-context/src/lib/superpowers-task-protected-baseline.ts",
|
|
20
|
-
"packages/ty-context/src/lib/superpowers-task-state-schema.ts",
|
|
21
|
-
".codex/ty-context-managed/skills/composite-long-task-workflow/SKILL.md",
|
|
22
|
-
".codex/ty-context-managed/skills/composite-long-task-workflow/references/composite-long-task-workflow-protocol.md",
|
|
23
|
-
".codex/ty-context-managed/skills/composite-long-task-workflow/assets/goal-objective.template.md",
|
|
24
|
-
".codex/ty-context-managed/skills/composite-long-task-workflow/assets/execution-binding.template.md",
|
|
25
|
-
"packages/ty-context/assets/skills/composite-long-task-workflow/SKILL.md",
|
|
26
|
-
"packages/ty-context/assets/skills/composite-long-task-workflow/references/composite-long-task-workflow-protocol.md",
|
|
27
|
-
"packages/ty-context/assets/skills/composite-long-task-workflow/assets/goal-objective.template.md",
|
|
28
|
-
"packages/ty-context/assets/skills/composite-long-task-workflow/assets/execution-binding.template.md",
|
|
29
|
-
"tests/ty-context/composite-long-task-completion-output-gate.test.mjs",
|
|
30
|
-
"tests/ty-context/fixtures/composite-long-task/completion-output-gate/expected-outcomes.json",
|
|
31
|
-
"tests/ty-context/composite-long-task-false-completion-regression.test.mjs",
|
|
32
|
-
"tests/ty-context/fixtures/composite-long-task/false-completion-regression/manifest.json"
|
|
33
|
-
];
|
|
34
|
-
export function evaluateProtectedBaseline(state) {
|
|
35
|
-
const attempt = currentAttempt(state);
|
|
36
|
-
const changedFiles = [...new Set((attempt?.changed_files ?? []).map((file) => file.replace(/\\/g, "/")).filter(Boolean))];
|
|
37
|
-
const protectedChanges = changedFiles.filter(isProtectedBaselinePath);
|
|
38
|
-
const mode = attempt?.mode ?? "product_task";
|
|
39
|
-
const errors = [];
|
|
40
|
-
if (mode === "product_task" && protectedChanges.length > 0) {
|
|
41
|
-
errors.push(`protected_baseline_changed: product_task cannot change protected harness baseline paths: ${protectedChanges.join(", ")}`);
|
|
42
|
-
}
|
|
43
|
-
if (mode === "harness_task" && protectedChanges.length > 0 && !protectedBaselineReason(state)) {
|
|
44
|
-
errors.push("protected_baseline_reason_required: harness_task baseline changes must record gates.protected_baseline.reason");
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
protected_baseline_changed: protectedChanges.length > 0,
|
|
48
|
-
product_goal_complete: errors.length === 0,
|
|
49
|
-
changed_files: protectedChanges,
|
|
50
|
-
errors
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export function isProtectedBaselinePath(file) {
|
|
54
|
-
const normalized = file.replace(/\\/g, "/");
|
|
55
|
-
return PROTECTED_BASELINE_PATHS.includes(normalized) || isHarnessPath(normalized);
|
|
56
|
-
}
|
|
57
|
-
function protectedBaselineReason(state) {
|
|
58
|
-
const baseline = state.gates?.protected_baseline;
|
|
59
|
-
return isRecord(baseline) && typeof baseline.reason === "string" && baseline.reason.trim().length > 0;
|
|
60
|
-
}
|
|
61
|
-
function currentAttempt(state) {
|
|
62
|
-
if (!state.current_attempt_id) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
return (state.attempts ?? []).find((item) => item.task_attempt_id === state.current_attempt_id);
|
|
66
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type SuperpowersAcceptanceCriterion, type SuperpowersPlanItem, type SuperpowersProductArchitectureScope } from "./superpowers-task-state-schema.js";
|
|
2
|
-
export declare const DEFAULT_LAYERS: string[];
|
|
3
|
-
export declare function parseProductArchitectureScope(content: string, sourceFile: string): SuperpowersProductArchitectureScope;
|
|
4
|
-
export declare function parsePlanItems(content: string, sourceFile: string): Record<string, SuperpowersPlanItem>;
|
|
5
|
-
export declare function parseAcceptanceCriteria(content: string, sourceFile: string): Record<string, SuperpowersAcceptanceCriterion>;
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { MACHINE_VERIFIABLE_PROOF_LAYERS, proofLayerName } from "./superpowers-task-assertions.js";
|
|
2
|
-
import { compileReportSuffix, missingCategory, throwCompileErrors } from "./superpowers-task-compile-diagnostics.js";
|
|
3
|
-
import { ACCEPTANCE_FIELDS, ACCEPTANCE_SCOPES, fieldSet, isSelectedScopeFitSlice, normalizeProofLayerName, PLAN_DELIVERY_SCOPES, PLAN_FIELDS, PRODUCT_DELIVERY_SCOPES, PRODUCT_FIELDS, SCOPE_FIT_DECISIONS } from "./superpowers-task-fields.js";
|
|
4
|
-
import { fieldArray, fieldBoolean, fieldLine, fieldText, parseDocumentFields, parseHeadingDefinitions } from "./superpowers-task-source-parser.js";
|
|
5
|
-
export const DEFAULT_LAYERS = ["code", "test"];
|
|
6
|
-
const PRODUCT_FIELD_SET = fieldSet(PRODUCT_FIELDS);
|
|
7
|
-
const PLAN_FIELD_SET = fieldSet(PLAN_FIELDS);
|
|
8
|
-
const ACCEPTANCE_FIELD_SET = fieldSet(ACCEPTANCE_FIELDS);
|
|
9
|
-
export function parseProductArchitectureScope(content, sourceFile) {
|
|
10
|
-
const fields = parseDocumentFields(content, sourceFile, PRODUCT_FIELD_SET);
|
|
11
|
-
const errors = [];
|
|
12
|
-
const selectedScopeFitSlice = requireText(errors, "Product / Architecture Source", "selected_scope_fit_slice", fields, sourceFile, 1);
|
|
13
|
-
if (selectedScopeFitSlice && !isSelectedScopeFitSlice(selectedScopeFitSlice)) {
|
|
14
|
-
errors.push(`Product / Architecture Source invalid selected_scope_fit_slice: ${selectedScopeFitSlice} at ${sourceFile}:${fieldLine(fields, "selected_scope_fit_slice") ?? 1}; allowed: none or SFC-###${compileReportSuffix("blocking_unparseable_object", sourceFile, fieldLine(fields, "selected_scope_fit_slice") ?? 1, "selected_scope_fit_slice", "value must be none or an SFC-### id", "fix selected_scope_fit_slice and rerun compile")}`);
|
|
15
|
-
}
|
|
16
|
-
const scope = {
|
|
17
|
-
delivery_scope: requireEnum(errors, "Product / Architecture Source", "delivery_scope", fields, PRODUCT_DELIVERY_SCOPES, sourceFile, 1),
|
|
18
|
-
full_population_required: requireBoolean(errors, "Product / Architecture Source", "full_population_required", fields, sourceFile, 1),
|
|
19
|
-
representative_samples_validate: requireArray(errors, "Product / Architecture Source", "representative_samples_validate", fields, sourceFile, 1),
|
|
20
|
-
representative_samples_do_not_validate: requireArray(errors, "Product / Architecture Source", "representative_samples_do_not_validate", fields, sourceFile, 1),
|
|
21
|
-
out_of_scope_backlog: requireArray(errors, "Product / Architecture Source", "out_of_scope_backlog", fields, sourceFile, 1),
|
|
22
|
-
scope_fit_decision: requireEnum(errors, "Product / Architecture Source", "scope_fit_decision", fields, SCOPE_FIT_DECISIONS, sourceFile, 1),
|
|
23
|
-
selected_scope_fit_slice: selectedScopeFitSlice,
|
|
24
|
-
owner_boundary: requireText(errors, "Product / Architecture Source", "owner_boundary", fields, sourceFile, 1),
|
|
25
|
-
primary_capability_path: requireText(errors, "Product / Architecture Source", "primary_capability_path", fields, sourceFile, 1),
|
|
26
|
-
non_completing_outcomes: requireArray(errors, "Product / Architecture Source", "non_completing_outcomes", fields, sourceFile, 1),
|
|
27
|
-
assertion_policy: requireText(errors, "Product / Architecture Source", "assertion_policy", fields, sourceFile, 1),
|
|
28
|
-
source_authority: requireText(errors, "Product / Architecture Source", "source_authority", fields, sourceFile, 1),
|
|
29
|
-
product_goal: requireText(errors, "Product / Architecture Source", "product_goal", fields, sourceFile, 1),
|
|
30
|
-
surface_ia_lock: optionalText(fields, "surface_ia_lock"),
|
|
31
|
-
decision_lock: optionalText(fields, "decision_lock"),
|
|
32
|
-
context_delta: optionalText(fields, "context_delta"),
|
|
33
|
-
source_to_context_coverage: optionalText(fields, "source_to_context_coverage"),
|
|
34
|
-
acceptance_semantics: optionalText(fields, "acceptance_semantics"),
|
|
35
|
-
impact: optionalText(fields, "impact")
|
|
36
|
-
};
|
|
37
|
-
throwCompileErrors(errors);
|
|
38
|
-
return scope;
|
|
39
|
-
}
|
|
40
|
-
export function parsePlanItems(content, sourceFile) {
|
|
41
|
-
const items = {};
|
|
42
|
-
const errors = [];
|
|
43
|
-
for (const definition of parseHeadingDefinitions(content, { kind: "PI", sourceFile, allowedFields: PLAN_FIELD_SET })) {
|
|
44
|
-
const fields = definition.fields;
|
|
45
|
-
items[definition.id] = {
|
|
46
|
-
requirement: definition.title,
|
|
47
|
-
source_file: definition.source_file,
|
|
48
|
-
source_start_line: definition.source_start_line,
|
|
49
|
-
source_end_line: definition.source_end_line,
|
|
50
|
-
delivery_scope: requireEnum(errors, definition.id, "delivery_scope", fields, PLAN_DELIVERY_SCOPES, sourceFile, definition.source_start_line),
|
|
51
|
-
capability_target: requireText(errors, definition.id, "capability_target", fields, sourceFile, definition.source_start_line),
|
|
52
|
-
representative_samples: requireArray(errors, definition.id, "representative_samples", fields, sourceFile, definition.source_start_line),
|
|
53
|
-
full_population_boundary: requireText(errors, definition.id, "full_population_boundary", fields, sourceFile, definition.source_start_line),
|
|
54
|
-
non_required_population: requireArray(errors, definition.id, "non_required_population", fields, sourceFile, definition.source_start_line),
|
|
55
|
-
owner_boundary: requireText(errors, definition.id, "owner_boundary", fields, sourceFile, definition.source_start_line),
|
|
56
|
-
primary_capability_path: requireText(errors, definition.id, "primary_capability_path", fields, sourceFile, definition.source_start_line),
|
|
57
|
-
trigger_contract: requireText(errors, definition.id, "trigger_contract", fields, sourceFile, definition.source_start_line),
|
|
58
|
-
state_transition_contract: requireText(errors, definition.id, "state_transition_contract", fields, sourceFile, definition.source_start_line),
|
|
59
|
-
observable_result_contract: requireText(errors, definition.id, "observable_result_contract", fields, sourceFile, definition.source_start_line),
|
|
60
|
-
assertion_support: requireText(errors, definition.id, "assertion_support", fields, sourceFile, definition.source_start_line),
|
|
61
|
-
required_assertion_commands: requireArray(errors, definition.id, "required_assertion_commands", fields, sourceFile, definition.source_start_line),
|
|
62
|
-
invalid_implementation_shortcuts: requireArray(errors, definition.id, "invalid_implementation_shortcuts", fields, sourceFile, definition.source_start_line),
|
|
63
|
-
owner_surfaces: optionalArray(fields, "owner_surfaces"),
|
|
64
|
-
forbidden_surfaces: optionalArray(fields, "forbidden_surfaces"),
|
|
65
|
-
implementation_paths: requireArray(errors, definition.id, "implementation_paths", fields, sourceFile, definition.source_start_line),
|
|
66
|
-
required_tests: optionalArray(fields, "required_tests"),
|
|
67
|
-
proof_layer_ids: optionalArray(fields, "proof_layer_ids").map(normalizeLayerId),
|
|
68
|
-
requirement_ref: optionalText(fields, "requirement_ref"),
|
|
69
|
-
decision_id: optionalText(fields, "decision_id"),
|
|
70
|
-
api_schema_changes: optionalText(fields, "api_schema_changes"),
|
|
71
|
-
state_machine: optionalText(fields, "state_machine"),
|
|
72
|
-
data_flow: optionalText(fields, "data_flow"),
|
|
73
|
-
worker_runtime_behavior: optionalText(fields, "worker_runtime_behavior"),
|
|
74
|
-
ui_ia_changes: optionalText(fields, "ui_ia_changes"),
|
|
75
|
-
migration_plan: optionalText(fields, "migration_plan"),
|
|
76
|
-
evidence_artifacts: optionalArray(fields, "evidence_artifacts"),
|
|
77
|
-
non_completing_shortcuts: optionalArray(fields, "non_completing_shortcuts"),
|
|
78
|
-
substitution_policy: optionalArray(fields, "substitution_policy"),
|
|
79
|
-
drift_severity: optionalText(fields, "drift_severity"),
|
|
80
|
-
partial_conditions: optionalArray(fields, "partial_conditions"),
|
|
81
|
-
blockers: optionalArray(fields, "blockers"),
|
|
82
|
-
explicit_no_test_scope: fieldBoolean(fields, "explicit_no_test_scope") === true,
|
|
83
|
-
context_fact_refs: optionalArray(fields, "context_fact_refs"),
|
|
84
|
-
status: "not_started",
|
|
85
|
-
related_acs: optionalArray(fields, "related_acs").map((item) => item.toUpperCase()),
|
|
86
|
-
required_proof_layers: []
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
throwCompileErrors(errors);
|
|
90
|
-
return items;
|
|
91
|
-
}
|
|
92
|
-
export function parseAcceptanceCriteria(content, sourceFile) {
|
|
93
|
-
const items = {};
|
|
94
|
-
const errors = [];
|
|
95
|
-
for (const definition of parseHeadingDefinitions(content, { kind: "AC", sourceFile, allowedFields: ACCEPTANCE_FIELD_SET })) {
|
|
96
|
-
const fields = definition.fields;
|
|
97
|
-
const layers = requireArray(errors, definition.id, "required_proof_layers", fields, sourceFile, definition.source_start_line).map(normalizeLayer).filter(Boolean);
|
|
98
|
-
const requiredProofLayers = layers.length > 0 ? layers : DEFAULT_LAYERS;
|
|
99
|
-
items[definition.id] = {
|
|
100
|
-
scope: definition.title,
|
|
101
|
-
source_file: definition.source_file,
|
|
102
|
-
source_start_line: definition.source_start_line,
|
|
103
|
-
source_end_line: definition.source_end_line,
|
|
104
|
-
acceptance_scope: requireEnum(errors, definition.id, "acceptance_scope", fields, ACCEPTANCE_SCOPES, sourceFile, definition.source_start_line),
|
|
105
|
-
ac_validates: requireArray(errors, definition.id, "ac_validates", fields, sourceFile, definition.source_start_line),
|
|
106
|
-
ac_does_not_validate: requireArray(errors, definition.id, "ac_does_not_validate", fields, sourceFile, definition.source_start_line),
|
|
107
|
-
sample_boundary: requireText(errors, definition.id, "sample_boundary", fields, sourceFile, definition.source_start_line),
|
|
108
|
-
full_population_required: requireBoolean(errors, definition.id, "full_population_required", fields, sourceFile, definition.source_start_line),
|
|
109
|
-
related_plan_items: requireArray(errors, definition.id, "related_plan_items", fields, sourceFile, definition.source_start_line).map((item) => item.toUpperCase()),
|
|
110
|
-
required_proof_layers: requiredProofLayers,
|
|
111
|
-
assertion_requirements: assertionRequirements(fields, requiredProofLayers),
|
|
112
|
-
assertion_command: requireText(errors, definition.id, "assertion_command", fields, sourceFile, definition.source_start_line),
|
|
113
|
-
assertion_artifacts: requireArray(errors, definition.id, "assertion_artifacts", fields, sourceFile, definition.source_start_line),
|
|
114
|
-
positive_assertions: requireArray(errors, definition.id, "positive_assertions", fields, sourceFile, definition.source_start_line),
|
|
115
|
-
negative_assertions: requireArray(errors, definition.id, "negative_assertions", fields, sourceFile, definition.source_start_line),
|
|
116
|
-
machine_blocking: requireBoolean(errors, definition.id, "machine_blocking", fields, sourceFile, definition.source_start_line),
|
|
117
|
-
invalid_completion_signals: requireArray(errors, definition.id, "invalid_completion_signals", fields, sourceFile, definition.source_start_line),
|
|
118
|
-
assertion_result_required: requireBoolean(errors, definition.id, "assertion_result_required", fields, sourceFile, definition.source_start_line),
|
|
119
|
-
ac_type: optionalText(fields, "ac_type"),
|
|
120
|
-
proof_chain: optionalArray(fields, "proof_chain").map(normalizeLayerId),
|
|
121
|
-
required_test_ids: optionalArray(fields, "required_test_ids"),
|
|
122
|
-
fail_conditions: optionalArray(fields, "fail_conditions"),
|
|
123
|
-
invalid_evidence: optionalArray(fields, "invalid_evidence"),
|
|
124
|
-
substitution_policy: optionalArray(fields, "substitution_policy"),
|
|
125
|
-
missing_layer_downgrade: optionalText(fields, "missing_layer_downgrade"),
|
|
126
|
-
auditor_expectation: optionalText(fields, "auditor_expectation"),
|
|
127
|
-
out_of_scope_na_approval_source: optionalText(fields, "out_of_scope_na_approval_source"),
|
|
128
|
-
hard_blockers: optionalArray(fields, "hard_blockers"),
|
|
129
|
-
validates_explanation: optionalText(fields, "validates_explanation"),
|
|
130
|
-
does_not_validate_explanation: optionalText(fields, "does_not_validate_explanation"),
|
|
131
|
-
final_evidence_expected: optionalArray(fields, "final_evidence_expected"),
|
|
132
|
-
verification_method: optionalArray(fields, "verification_method"),
|
|
133
|
-
test_cases: optionalArray(fields, "test_cases"),
|
|
134
|
-
explicit_no_test_scope: fieldBoolean(fields, "explicit_no_test_scope") === true,
|
|
135
|
-
status: "not_run"
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
throwCompileErrors(errors);
|
|
139
|
-
return items;
|
|
140
|
-
}
|
|
141
|
-
function normalizeLayer(value) {
|
|
142
|
-
return normalizeProofLayerName(value);
|
|
143
|
-
}
|
|
144
|
-
function normalizeLayerId(value) {
|
|
145
|
-
const trimmed = value.trim();
|
|
146
|
-
if (!trimmed.includes(".")) {
|
|
147
|
-
return normalizeLayer(trimmed);
|
|
148
|
-
}
|
|
149
|
-
const acId = trimmed.slice(0, trimmed.lastIndexOf(".")).toUpperCase();
|
|
150
|
-
const layer = trimmed.slice(trimmed.lastIndexOf(".") + 1);
|
|
151
|
-
return `${acId}.${normalizeLayer(layer)}`;
|
|
152
|
-
}
|
|
153
|
-
function assertionRequirements(fields, layers) {
|
|
154
|
-
const requiredTestIds = optionalArray(fields, "required_test_ids");
|
|
155
|
-
const positiveAssertions = unique(optionalArray(fields, "positive_assertions"));
|
|
156
|
-
const negativeAssertions = unique(optionalArray(fields, "negative_assertions"));
|
|
157
|
-
const assertionCommand = fieldText(fields, "assertion_command");
|
|
158
|
-
const assertionArtifacts = optionalArray(fields, "assertion_artifacts");
|
|
159
|
-
const machineBlocking = fieldBoolean(fields, "machine_blocking");
|
|
160
|
-
const assertionResultRequired = fieldBoolean(fields, "assertion_result_required");
|
|
161
|
-
const invalidCompletionSignals = optionalArray(fields, "invalid_completion_signals");
|
|
162
|
-
return layers.map((layer) => {
|
|
163
|
-
const normalized = proofLayerName(normalizeLayer(layer));
|
|
164
|
-
return {
|
|
165
|
-
proof_layer: normalized,
|
|
166
|
-
required: true,
|
|
167
|
-
machine_blocking: machineBlocking ?? MACHINE_VERIFIABLE_PROOF_LAYERS.has(normalized),
|
|
168
|
-
assertion_result_required: assertionResultRequired ?? MACHINE_VERIFIABLE_PROOF_LAYERS.has(normalized),
|
|
169
|
-
assertion_command: assertionCommand,
|
|
170
|
-
assertion_artifacts: assertionArtifacts,
|
|
171
|
-
invalid_completion_signals: invalidCompletionSignals,
|
|
172
|
-
required_test_ids: requiredTestIds,
|
|
173
|
-
positive_assertions: positiveAssertions,
|
|
174
|
-
negative_assertions: negativeAssertions
|
|
175
|
-
};
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
function requireEnum(errors, label, name, fields, allowed, sourceFile, fallbackLine) {
|
|
179
|
-
const value = fieldText(fields, name);
|
|
180
|
-
const line = fieldLine(fields, name) ?? fallbackLine;
|
|
181
|
-
if (!value) {
|
|
182
|
-
errors.push(`${label} missing ${name} at ${sourceFile}:${line}${compileReportSuffix(missingCategory(label), sourceFile, line, name, "field is required", "add the required field and rerun compile")}`);
|
|
183
|
-
return "";
|
|
184
|
-
}
|
|
185
|
-
if (!allowed.has(value)) {
|
|
186
|
-
errors.push(`${label} invalid ${name}: ${value} at ${sourceFile}:${line}; allowed: ${[...allowed].join(", ")}${compileReportSuffix("blocking_unparseable_object", sourceFile, line, name, `value must be one of ${[...allowed].join(", ")}`, "fix the field value and rerun compile")}`);
|
|
187
|
-
}
|
|
188
|
-
return value;
|
|
189
|
-
}
|
|
190
|
-
function requireText(errors, label, name, fields, sourceFile, fallbackLine) {
|
|
191
|
-
const value = fieldText(fields, name);
|
|
192
|
-
const line = fieldLine(fields, name) ?? fallbackLine;
|
|
193
|
-
if (!value) {
|
|
194
|
-
errors.push(`${label} missing ${name} at ${sourceFile}:${line}${compileReportSuffix(missingCategory(label), sourceFile, line, name, "field is required", "add non-empty text and rerun compile")}`);
|
|
195
|
-
}
|
|
196
|
-
return value;
|
|
197
|
-
}
|
|
198
|
-
function requireArray(errors, label, name, fields, sourceFile, fallbackLine) {
|
|
199
|
-
const line = fieldLine(fields, name) ?? fallbackLine;
|
|
200
|
-
if (!fields[name]) {
|
|
201
|
-
errors.push(`${label} missing ${name} at ${sourceFile}:${line}${compileReportSuffix(missingCategory(label), sourceFile, line, name, "field is required", "add the list field and rerun compile")}`);
|
|
202
|
-
return [];
|
|
203
|
-
}
|
|
204
|
-
return fieldArray(fields, name);
|
|
205
|
-
}
|
|
206
|
-
function requireBoolean(errors, label, name, fields, sourceFile, fallbackLine) {
|
|
207
|
-
const line = fieldLine(fields, name) ?? fallbackLine;
|
|
208
|
-
if (!fields[name]) {
|
|
209
|
-
errors.push(`${label} missing ${name} at ${sourceFile}:${line}${compileReportSuffix(missingCategory(label), sourceFile, line, name, "field is required", "add true or false and rerun compile")}`);
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
const value = fieldBoolean(fields, name);
|
|
213
|
-
if (value === null) {
|
|
214
|
-
errors.push(`${label} invalid ${name}: ${fieldText(fields, name)} at ${sourceFile}:${line}; must be true or false${compileReportSuffix("blocking_unparseable_object", sourceFile, line, name, "value must be true or false", "fix the boolean and rerun compile")}`);
|
|
215
|
-
}
|
|
216
|
-
return value;
|
|
217
|
-
}
|
|
218
|
-
function optionalArray(fields, name) {
|
|
219
|
-
return fields[name] ? fieldArray(fields, name) : [];
|
|
220
|
-
}
|
|
221
|
-
function optionalText(fields, name) {
|
|
222
|
-
return fields[name] ? fieldText(fields, name) : "";
|
|
223
|
-
}
|
|
224
|
-
function unique(values) {
|
|
225
|
-
return [...new Set(values.filter(Boolean))];
|
|
226
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface ParsedField {
|
|
2
|
-
value: string | string[];
|
|
3
|
-
line: number;
|
|
4
|
-
}
|
|
5
|
-
export interface ParsedDefinition {
|
|
6
|
-
id: string;
|
|
7
|
-
title: string;
|
|
8
|
-
fields: Record<string, ParsedField>;
|
|
9
|
-
source_file: string;
|
|
10
|
-
source_start_line: number;
|
|
11
|
-
source_end_line: number;
|
|
12
|
-
}
|
|
13
|
-
export interface DefinitionParseOptions {
|
|
14
|
-
kind: "PI" | "AC";
|
|
15
|
-
sourceFile: string;
|
|
16
|
-
allowedFields: Set<string>;
|
|
17
|
-
}
|
|
18
|
-
export declare function parseHeadingDefinitions(content: string, options: DefinitionParseOptions): ParsedDefinition[];
|
|
19
|
-
export declare function parseDocumentFields(content: string, sourceFile: string, allowedFields: Set<string>): Record<string, ParsedField>;
|
|
20
|
-
export declare function fieldText(fields: Record<string, ParsedField>, name: string): string;
|
|
21
|
-
export declare function fieldArray(fields: Record<string, ParsedField>, name: string): string[];
|
|
22
|
-
export declare function fieldBoolean(fields: Record<string, ParsedField>, name: string): boolean | null;
|
|
23
|
-
export declare function fieldLine(fields: Record<string, ParsedField>, name: string): number | undefined;
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { compileError, throwCompileErrors } from "./superpowers-task-compile-diagnostics.js";
|
|
2
|
-
export function parseHeadingDefinitions(content, options) {
|
|
3
|
-
const lines = splitLines(content);
|
|
4
|
-
const errors = [];
|
|
5
|
-
rejectListStyleDefinitions(lines, options, errors);
|
|
6
|
-
const headings = findDefinitionHeadings(lines, options.kind);
|
|
7
|
-
const seen = new Map();
|
|
8
|
-
const definitions = [];
|
|
9
|
-
for (const heading of headings) {
|
|
10
|
-
const firstLine = seen.get(heading.id);
|
|
11
|
-
if (firstLine !== undefined) {
|
|
12
|
-
errors.push(compileError(`${heading.id} duplicate definition at ${options.sourceFile}:${firstLine} and ${options.sourceFile}:${heading.line}`, "blocking_unparseable_object", options.sourceFile, heading.line, heading.id, "duplicate object ids make PI/AC graph references ambiguous", "keep exactly one heading definition for this id"));
|
|
13
|
-
continue;
|
|
14
|
-
}
|
|
15
|
-
seen.set(heading.id, heading.line);
|
|
16
|
-
const sourceEndLine = sectionEndLine(lines, heading.index, heading.level);
|
|
17
|
-
const section = lines.slice(heading.index, sourceEndLine);
|
|
18
|
-
definitions.push({
|
|
19
|
-
id: heading.id,
|
|
20
|
-
title: heading.title,
|
|
21
|
-
fields: parseFields(section, options.sourceFile, heading.line, options.allowedFields, errors),
|
|
22
|
-
source_file: options.sourceFile,
|
|
23
|
-
source_start_line: heading.line,
|
|
24
|
-
source_end_line: sourceEndLine
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
if (definitions.length === 0) {
|
|
28
|
-
errors.push(compileError(`${options.sourceFile} must define ${options.kind} items with Markdown headings like "## ${options.kind}-001: ..."`, options.kind === "PI" ? "blocking_missing_plan" : "blocking_missing_checklist", options.sourceFile, 1, `${options.kind}_heading`, "the source cannot compile without at least one object heading", `add headings like ## ${options.kind}-001: ...`));
|
|
29
|
-
}
|
|
30
|
-
throwCompileErrors(errors);
|
|
31
|
-
return definitions;
|
|
32
|
-
}
|
|
33
|
-
export function parseDocumentFields(content, sourceFile, allowedFields) {
|
|
34
|
-
const errors = [];
|
|
35
|
-
const fields = parseFields(splitLines(content), sourceFile, 1, allowedFields, errors);
|
|
36
|
-
throwCompileErrors(errors);
|
|
37
|
-
return fields;
|
|
38
|
-
}
|
|
39
|
-
export function fieldText(fields, name) {
|
|
40
|
-
const field = fields[name];
|
|
41
|
-
if (!field) {
|
|
42
|
-
return "";
|
|
43
|
-
}
|
|
44
|
-
return Array.isArray(field.value) ? field.value.join("\n").trim() : field.value.trim();
|
|
45
|
-
}
|
|
46
|
-
export function fieldArray(fields, name) {
|
|
47
|
-
const field = fields[name];
|
|
48
|
-
if (!field) {
|
|
49
|
-
return [];
|
|
50
|
-
}
|
|
51
|
-
if (Array.isArray(field.value)) {
|
|
52
|
-
return field.value.flatMap(splitScalarArray).filter(Boolean);
|
|
53
|
-
}
|
|
54
|
-
return splitScalarArray(field.value);
|
|
55
|
-
}
|
|
56
|
-
export function fieldBoolean(fields, name) {
|
|
57
|
-
const value = fieldText(fields, name).toLowerCase();
|
|
58
|
-
if (value === "true") {
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
if (value === "false") {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
export function fieldLine(fields, name) {
|
|
67
|
-
return fields[name]?.line;
|
|
68
|
-
}
|
|
69
|
-
function parseFields(lines, sourceFile, startLine, allowedFields, errors) {
|
|
70
|
-
const fields = {};
|
|
71
|
-
for (let index = 0; index < lines.length; index++) {
|
|
72
|
-
const line = lines[index];
|
|
73
|
-
const lineNumber = startLine + index;
|
|
74
|
-
const heading = /^(#{1,6})\s+(.+?)\s*$/.exec(line);
|
|
75
|
-
if (heading && allowedFields.has(heading[2].trim())) {
|
|
76
|
-
errors.push(compileError(`${sourceFile}:${lineNumber} field headings are not supported; use "${heading[2].trim()}: ..."`, "blocking_unparseable_object", sourceFile, lineNumber, heading[2].trim(), "field heading syntax is ambiguous in compiled source", "use key: value fields"));
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
if (/^\s*\|/.test(line) && containsKnownField(line, allowedFields)) {
|
|
80
|
-
errors.push(compileError(`${sourceFile}:${lineNumber} table fields are not supported; use key: value fields`, "blocking_unparseable_object", sourceFile, lineNumber, "table_field", "table fields cannot be parsed into canonical state safely", "use key: value fields"));
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
const match = /^([a-z][a-z0-9_]*)\s*:\s*(.*)$/.exec(line);
|
|
84
|
-
if (!match) {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const name = match[1];
|
|
88
|
-
if (!allowedFields.has(name)) {
|
|
89
|
-
errors.push(compileError(`${sourceFile}:${lineNumber} unknown field ${name}`, "blocking_unparseable_object", sourceFile, lineNumber, name, "unknown fields may hide required source semantics", "rename the field to a supported canonical key"));
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (fields[name]) {
|
|
93
|
-
errors.push(compileError(`${sourceFile}:${lineNumber} duplicate field ${name}`, "blocking_unparseable_object", sourceFile, lineNumber, name, "duplicate fields make canonical source values ambiguous", "keep one field value"));
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
const parsed = parseFieldValue(lines, index, match[2], sourceFile, lineNumber, errors);
|
|
97
|
-
fields[name] = { value: parsed.value, line: lineNumber };
|
|
98
|
-
index = parsed.endIndex;
|
|
99
|
-
}
|
|
100
|
-
return fields;
|
|
101
|
-
}
|
|
102
|
-
function parseFieldValue(lines, index, rest, sourceFile, lineNumber, errors) {
|
|
103
|
-
const trimmed = rest.trim();
|
|
104
|
-
if (trimmed === "|") {
|
|
105
|
-
const block = [];
|
|
106
|
-
let cursor = index + 1;
|
|
107
|
-
for (; cursor < lines.length; cursor++) {
|
|
108
|
-
const next = lines[cursor];
|
|
109
|
-
if (next.trim() && isTopLevelFieldOrHeading(next)) {
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
block.push(next.replace(/^\s{0,2}/, ""));
|
|
113
|
-
}
|
|
114
|
-
if (block.length === 0) {
|
|
115
|
-
errors.push(compileError(`${sourceFile}:${lineNumber} block field must include indented text`, "blocking_unparseable_object", sourceFile, lineNumber, "block_field", "empty block field cannot prove source intent", "add indented text or remove the field"));
|
|
116
|
-
}
|
|
117
|
-
return { value: block.join("\n").trim(), endIndex: cursor - 1 };
|
|
118
|
-
}
|
|
119
|
-
if (trimmed) {
|
|
120
|
-
return { value: cleanValue(trimmed), endIndex: index };
|
|
121
|
-
}
|
|
122
|
-
const values = [];
|
|
123
|
-
let cursor = index + 1;
|
|
124
|
-
for (; cursor < lines.length; cursor++) {
|
|
125
|
-
const next = lines[cursor];
|
|
126
|
-
if (!next.trim()) {
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (isTopLevelFieldOrHeading(next)) {
|
|
130
|
-
break;
|
|
131
|
-
}
|
|
132
|
-
const listItem = /^\s*[-*+]\s+(.+?)\s*$/.exec(next);
|
|
133
|
-
if (!listItem) {
|
|
134
|
-
errors.push(compileError(`${sourceFile}:${cursor + 1} field lists must use indented "- item" entries or key: | blocks`, "blocking_unparseable_object", sourceFile, cursor + 1, "list_field", "list syntax cannot be parsed into canonical arrays", "use indented '- item' entries or key: | blocks"));
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
values.push(cleanValue(listItem[1]));
|
|
138
|
-
}
|
|
139
|
-
return { value: values, endIndex: cursor - 1 };
|
|
140
|
-
}
|
|
141
|
-
function isTopLevelFieldOrHeading(line) {
|
|
142
|
-
if (/^(#{1,6})\s+/.test(line)) {
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
return /^([a-z][a-z0-9_]*)\s*:/.test(line);
|
|
146
|
-
}
|
|
147
|
-
function rejectListStyleDefinitions(lines, options, errors) {
|
|
148
|
-
const idPattern = options.kind === "PI" ? "PI" : "AC";
|
|
149
|
-
const listPattern = new RegExp(`^\\s*[-*+]\\s+(${idPattern}-\\d{3,})\\b\\s*[:.-]?`, "i");
|
|
150
|
-
for (let index = 0; index < lines.length; index++) {
|
|
151
|
-
const match = listPattern.exec(lines[index]);
|
|
152
|
-
if (!match) {
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
const block = listItemBlock(lines, index);
|
|
156
|
-
if (!block.some((line) => containsKnownField(line, options.allowedFields))) {
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
const id = match[1].toUpperCase();
|
|
160
|
-
errors.push(compileError(`${id} list-style definition is not allowed at ${options.sourceFile}:${index + 1}; use "## ${id}: ..."`, "blocking_unparseable_object", options.sourceFile, index + 1, id, "list-style object definitions are not canonical PI/AC headings", `use "## ${id}: ..."`));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function listItemBlock(lines, start) {
|
|
164
|
-
const block = [lines[start]];
|
|
165
|
-
for (let index = start + 1; index < lines.length; index++) {
|
|
166
|
-
const line = lines[index];
|
|
167
|
-
if (line.trim() && !/^\s/.test(line)) {
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
block.push(line);
|
|
171
|
-
}
|
|
172
|
-
return block;
|
|
173
|
-
}
|
|
174
|
-
function findDefinitionHeadings(lines, kind) {
|
|
175
|
-
const pattern = new RegExp(`^(#{1,6})\\s+(${kind}-\\d{3,})\\b(?:\\s*[:.-]\\s*|\\s+)?(.*?)\\s*$`, "i");
|
|
176
|
-
return lines.flatMap((line, index) => {
|
|
177
|
-
const match = pattern.exec(line);
|
|
178
|
-
if (!match) {
|
|
179
|
-
return [];
|
|
180
|
-
}
|
|
181
|
-
return [{
|
|
182
|
-
id: match[2].toUpperCase(),
|
|
183
|
-
level: match[1].length,
|
|
184
|
-
title: cleanValue(match[3]) || match[2].toUpperCase(),
|
|
185
|
-
index,
|
|
186
|
-
line: index + 1
|
|
187
|
-
}];
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
function sectionEndLine(lines, headingIndex, headingLevel) {
|
|
191
|
-
for (let index = headingIndex + 1; index < lines.length; index++) {
|
|
192
|
-
const match = /^(#{1,6})\s+/.exec(lines[index]);
|
|
193
|
-
if (match && match[1].length <= headingLevel) {
|
|
194
|
-
return index;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return lines.length;
|
|
198
|
-
}
|
|
199
|
-
function containsKnownField(line, allowedFields) {
|
|
200
|
-
for (const field of allowedFields) {
|
|
201
|
-
if (new RegExp(`\\b${field}\\b\\s*:`, "i").test(line) || new RegExp(`\\b${field}\\b`, "i").test(line)) {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
function splitScalarArray(value) {
|
|
208
|
-
return value
|
|
209
|
-
.split(/[,;\n]/)
|
|
210
|
-
.map((item) => cleanValue(item))
|
|
211
|
-
.filter(Boolean);
|
|
212
|
-
}
|
|
213
|
-
function splitLines(content) {
|
|
214
|
-
return content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
|
215
|
-
}
|
|
216
|
-
function cleanValue(value) {
|
|
217
|
-
return value.replace(/^[-#*\s]+/, "").trim();
|
|
218
|
-
}
|