@alpaca-software/40kdc-data 0.3.2 → 0.4.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.
Files changed (87) hide show
  1. package/README.md +3 -3
  2. package/dist/bundle-schemas.d.ts.map +1 -1
  3. package/dist/bundle-schemas.js +17 -0
  4. package/dist/bundle-schemas.js.map +1 -1
  5. package/dist/cli.js +5 -0
  6. package/dist/cli.js.map +1 -1
  7. package/dist/codegen-data.js +1 -0
  8. package/dist/codegen-data.js.map +1 -1
  9. package/dist/commands/populate-base-sizes.d.ts +2 -0
  10. package/dist/commands/populate-base-sizes.d.ts.map +1 -0
  11. package/dist/commands/populate-base-sizes.js +158 -0
  12. package/dist/commands/populate-base-sizes.js.map +1 -0
  13. package/dist/convert-faction.d.ts +3 -1
  14. package/dist/convert-faction.d.ts.map +1 -1
  15. package/dist/convert-faction.js +49 -16
  16. package/dist/convert-faction.js.map +1 -1
  17. package/dist/converters/base-size-bridge.d.ts +122 -0
  18. package/dist/converters/base-size-bridge.d.ts.map +1 -0
  19. package/dist/converters/base-size-bridge.js +198 -0
  20. package/dist/converters/base-size-bridge.js.map +1 -0
  21. package/dist/converters/base-size-guide-extract.d.ts +11 -0
  22. package/dist/converters/base-size-guide-extract.d.ts.map +1 -0
  23. package/dist/converters/base-size-guide-extract.js +59 -0
  24. package/dist/converters/base-size-guide-extract.js.map +1 -0
  25. package/dist/converters/option-bridge.d.ts +36 -0
  26. package/dist/converters/option-bridge.d.ts.map +1 -0
  27. package/dist/converters/option-bridge.js +72 -0
  28. package/dist/converters/option-bridge.js.map +1 -0
  29. package/dist/converters/option-parser.d.ts +56 -0
  30. package/dist/converters/option-parser.d.ts.map +1 -0
  31. package/dist/converters/option-parser.js +209 -0
  32. package/dist/converters/option-parser.js.map +1 -0
  33. package/dist/converters/wargear-options.d.ts +55 -0
  34. package/dist/converters/wargear-options.d.ts.map +1 -0
  35. package/dist/converters/wargear-options.js +187 -0
  36. package/dist/converters/wargear-options.js.map +1 -0
  37. package/dist/data/bundle.generated.js +1 -1
  38. package/dist/data/bundle.generated.js.map +1 -1
  39. package/dist/data/dataset.d.ts +9 -1
  40. package/dist/data/dataset.d.ts.map +1 -1
  41. package/dist/data/dataset.js +14 -0
  42. package/dist/data/dataset.js.map +1 -1
  43. package/dist/data/entities.d.ts +3 -1
  44. package/dist/data/entities.d.ts.map +1 -1
  45. package/dist/data/entities.js +4 -0
  46. package/dist/data/entities.js.map +1 -1
  47. package/dist/data/index.d.ts +4 -0
  48. package/dist/data/index.d.ts.map +1 -1
  49. package/dist/data/index.js +4 -0
  50. package/dist/data/index.js.map +1 -1
  51. package/dist/data/loadout.d.ts +60 -0
  52. package/dist/data/loadout.d.ts.map +1 -0
  53. package/dist/data/loadout.js +135 -0
  54. package/dist/data/loadout.js.map +1 -0
  55. package/dist/data/types.d.ts +3 -1
  56. package/dist/data/types.d.ts.map +1 -1
  57. package/dist/data/types.js +1 -0
  58. package/dist/data/types.js.map +1 -1
  59. package/dist/export/rosterizer.js +1 -1
  60. package/dist/export/rosterizer.js.map +1 -1
  61. package/dist/gen-conformance.js +20 -0
  62. package/dist/gen-conformance.js.map +1 -1
  63. package/dist/generated.d.ts +112 -55
  64. package/dist/generated.d.ts.map +1 -1
  65. package/dist/generated.js.map +1 -1
  66. package/dist/import/rosterizer.d.ts +1 -1
  67. package/dist/import/rosterizer.js.map +1 -1
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/runner.d.ts +16 -0
  72. package/dist/runner.d.ts.map +1 -1
  73. package/dist/runner.js +54 -0
  74. package/dist/runner.js.map +1 -1
  75. package/dist/translate/condition.d.ts.map +1 -1
  76. package/dist/translate/condition.js +4 -0
  77. package/dist/translate/condition.js.map +1 -1
  78. package/dist/validate.d.ts.map +1 -1
  79. package/dist/validate.js +13 -5
  80. package/dist/validate.js.map +1 -1
  81. package/package.json +4 -4
  82. package/schemas/$defs/common.schema.json +14 -0
  83. package/schemas/core/unit-composition.schema.json +5 -1
  84. package/schemas/core/unit.schema.json +2 -10
  85. package/schemas/core/wargear-option.schema.json +32 -6
  86. package/schemas/core/wargear.schema.json +24 -0
  87. package/schemas/enrichment/ability-dsl/condition.schema.json +3 -2
@@ -1 +1 @@
1
- {"version":3,"file":"generated.js","sourceRoot":"","sources":["../src/generated.ts"],"names":[],"mappings":"AAAA,gHAAgH","sourcesContent":["/* Generated from crates/wh40kdc/schemas/bundled.schema.json by 'npm run codegen:types'. DO NOT EDIT BY HAND. */\n\n/**\n * Kebab-case identifier\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"entity-id\".\n */\nexport type EntityId = string;\n/**\n * Game edition, e.g. '10th' or '11'\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"edition\".\n */\nexport type Edition = string;\n/**\n * Dataslate version: a quarterly tag (e.g. '2025-q3') or a named kebab-case slug for non-quarterly slates (e.g. 'pre-launch-provisional')\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"dataslate-version\".\n */\nexport type DataslateVersion = string;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"keyword\".\n */\nexport type Keyword = string;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"keyword-list\".\n */\nexport type KeywordList = Keyword[];\n/**\n * A stat that can be a fixed number or a dice expression\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"stat-value\".\n */\nexport type StatValue = number | string;\n/**\n * GitHub handle or '40kdc-community'\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"contributor-ref\".\n */\nexport type ContributorRef = string;\n/**\n * The five official game phases. Unchanged between 10th and 11th edition — 11e reorders Pile In timing within the Fight phase but adds no top-level phase.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"phase\".\n */\nexport type Phase = \"command\" | \"movement\" | \"shooting\" | \"charge\" | \"fight\";\n/**\n * @minItems 1\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"phase-list\".\n */\nexport type PhaseList = [Phase, ...Phase[]];\n/**\n * Type of game element that is the source of an enrichment entry\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"source-type\".\n */\nexport type SourceType = \"ability\" | \"stratagem\" | \"enhancement\" | \"detachment-rule\" | \"faction-rule\";\n/**\n * Which player's turn this applies during\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"player-turn\".\n */\nexport type PlayerTurn = \"your-turn\" | \"opponent-turn\" | \"either\";\n/**\n * 11e battle size, which sets the army's points limit and detachment-point budget: 'incursion' = 1000 pts / 2 detachment points; 'strike-force' = 2000 pts / 3 detachment points.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"battle-size\".\n */\nexport type BattleSize = \"incursion\" | \"strike-force\";\n/**\n * One of the five confirmed 11e launch Force Dispositions. Shared by force-disposition entities and the mission-matchup matrix.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"force-disposition-id\".\n */\nexport type ForceDispositionId =\n | \"take-and-hold\"\n | \"disruption\"\n | \"purge-the-foe\"\n | \"priority-assets\"\n | \"reconnaissance\";\n/**\n * A terrain piece's 2D footprint in local inches (y-down): an axis-aligned rectangle with its min corner at the local origin, a right triangle with the right angle at the local origin and legs along +x/+y, or an explicit polygon (>= 3 points). The placement resolver re-centers the footprint on its polygon area centroid, so the local-origin convention does not affect where the piece lands — only its shape matters.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"footprint\".\n */\nexport type Footprint =\n | {\n type: \"rectangle\";\n width: number;\n height: number;\n }\n | {\n type: \"right-triangle\";\n width: number;\n height: number;\n }\n | {\n type: \"polygon\";\n /**\n * @minItems 3\n */\n points: [Vec2, Vec2, Vec2, ...Vec2[]];\n };\n/**\n * An 11e terrain-area keyword. Confirmed launch set; extend as further keywords publish on dataslate.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"terrain-area-keyword\".\n */\nexport type TerrainAreaKeyword = \"obscuring\" | \"hidden\" | \"plunging-fire\";\n/**\n * A zone footprint, expressed as an axis-aligned rectangle or an explicit polygon. Vertices/extent are relative to the owning element's position.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"zone-shape\".\n */\nexport type ZoneShape =\n | {\n type: \"rectangle\";\n width: number;\n height: number;\n }\n | {\n type: \"polygon\";\n /**\n * @minItems 3\n */\n points: [Vec2, Vec2, Vec2, ...Vec2[]];\n };\n/**\n * Which player a zone or territory belongs to.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"side\".\n */\nexport type Side = \"attacker\" | \"defender\";\n/**\n * Eligibility predicate for which units may perform the action.\n */\nexport type AbilityCondition = SimpleCondition | CompoundCondition;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"condition-node\".\n */\nexport type ConditionNode = SimpleCondition | CompoundCondition;\n/**\n * Predicate for when the action is considered complete.\n */\nexport type AbilityCondition1 = SimpleCondition | CompoundCondition;\n/**\n * Effect applied when the action completes (e.g. terrain-area-tag, objective-tag, or unit-tag to mark transient state).\n */\nexport type AbilityEffect =\n | SingleEffect\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"single-effect\".\n */\nexport type SingleEffect = unknown & {\n type:\n | \"stat-modifier\"\n | \"roll-modifier\"\n | \"re-roll\"\n | \"mortal-wounds\"\n | \"feel-no-pain\"\n | \"invulnerable-save\"\n | \"ward\"\n | \"keyword-grant\"\n | \"movement-modifier\"\n | \"deep-strike\"\n | \"fallback-and-act\"\n | \"fight-first\"\n | \"fight-last\"\n | \"shoot-on-death\"\n | \"fight-on-death\"\n | \"objective-control-modifier\"\n | \"leadership-modifier\"\n | \"damage-reduction\"\n | \"attack-restriction\"\n | \"ability-grant\"\n | \"cp-gain\"\n | \"cp-refund\"\n | \"model-destruction\"\n | \"resurrection\"\n | \"resource-gain\"\n | \"resource-spend\"\n | \"charge-roll-modifier\"\n | \"terrain-area-tag\"\n | \"objective-tag\"\n | \"unit-tag\"\n | \"bs-modifier\"\n | \"engagement-passthrough\";\n target:\n | \"self\"\n | \"bearer\"\n | \"unit\"\n | \"attached-unit\"\n | \"attacker\"\n | \"defender\"\n | \"friendly-within-aura\"\n | \"enemy-within-aura\"\n | \"all-friendly\"\n | \"all-enemy\";\n modifier?: {\n [k: string]: unknown;\n };\n [k: string]: unknown;\n} & {\n type:\n | \"stat-modifier\"\n | \"roll-modifier\"\n | \"re-roll\"\n | \"mortal-wounds\"\n | \"feel-no-pain\"\n | \"invulnerable-save\"\n | \"ward\"\n | \"keyword-grant\"\n | \"movement-modifier\"\n | \"deep-strike\"\n | \"fallback-and-act\"\n | \"fight-first\"\n | \"fight-last\"\n | \"shoot-on-death\"\n | \"fight-on-death\"\n | \"objective-control-modifier\"\n | \"leadership-modifier\"\n | \"damage-reduction\"\n | \"attack-restriction\"\n | \"ability-grant\"\n | \"cp-gain\"\n | \"cp-refund\"\n | \"model-destruction\"\n | \"resurrection\"\n | \"resource-gain\"\n | \"resource-spend\"\n | \"charge-roll-modifier\"\n | \"terrain-area-tag\"\n | \"objective-tag\"\n | \"unit-tag\"\n | \"bs-modifier\"\n | \"engagement-passthrough\";\n target:\n | \"self\"\n | \"bearer\"\n | \"unit\"\n | \"attached-unit\"\n | \"attacker\"\n | \"defender\"\n | \"friendly-within-aura\"\n | \"enemy-within-aura\"\n | \"all-friendly\"\n | \"all-enemy\";\n modifier?: {\n [k: string]: unknown;\n };\n [k: string]: unknown;\n} & {\n type:\n | \"stat-modifier\"\n | \"roll-modifier\"\n | \"re-roll\"\n | \"mortal-wounds\"\n | \"feel-no-pain\"\n | \"invulnerable-save\"\n | \"ward\"\n | \"keyword-grant\"\n | \"movement-modifier\"\n | \"deep-strike\"\n | \"fallback-and-act\"\n | \"fight-first\"\n | \"fight-last\"\n | \"shoot-on-death\"\n | \"fight-on-death\"\n | \"objective-control-modifier\"\n | \"leadership-modifier\"\n | \"damage-reduction\"\n | \"attack-restriction\"\n | \"ability-grant\"\n | \"cp-gain\"\n | \"cp-refund\"\n | \"model-destruction\"\n | \"resurrection\"\n | \"resource-gain\"\n | \"resource-spend\"\n | \"charge-roll-modifier\"\n | \"terrain-area-tag\"\n | \"objective-tag\"\n | \"unit-tag\"\n | \"bs-modifier\"\n | \"engagement-passthrough\";\n target:\n | \"self\"\n | \"bearer\"\n | \"unit\"\n | \"attached-unit\"\n | \"attacker\"\n | \"defender\"\n | \"friendly-within-aura\"\n | \"enemy-within-aura\"\n | \"all-friendly\"\n | \"all-enemy\";\n modifier?: {\n [k: string]: unknown;\n };\n [k: string]: unknown;\n} & {\n type:\n | \"stat-modifier\"\n | \"roll-modifier\"\n | \"re-roll\"\n | \"mortal-wounds\"\n | \"feel-no-pain\"\n | \"invulnerable-save\"\n | \"ward\"\n | \"keyword-grant\"\n | \"movement-modifier\"\n | \"deep-strike\"\n | \"fallback-and-act\"\n | \"fight-first\"\n | \"fight-last\"\n | \"shoot-on-death\"\n | \"fight-on-death\"\n | \"objective-control-modifier\"\n | \"leadership-modifier\"\n | \"damage-reduction\"\n | \"attack-restriction\"\n | \"ability-grant\"\n | \"cp-gain\"\n | \"cp-refund\"\n | \"model-destruction\"\n | \"resurrection\"\n | \"resource-gain\"\n | \"resource-spend\"\n | \"charge-roll-modifier\"\n | \"terrain-area-tag\"\n | \"objective-tag\"\n | \"unit-tag\"\n | \"bs-modifier\"\n | \"engagement-passthrough\";\n target:\n | \"self\"\n | \"bearer\"\n | \"unit\"\n | \"attached-unit\"\n | \"attacker\"\n | \"defender\"\n | \"friendly-within-aura\"\n | \"enemy-within-aura\"\n | \"all-friendly\"\n | \"all-enemy\";\n modifier?: {\n [k: string]: unknown;\n };\n [k: string]: unknown;\n} & {\n type:\n | \"stat-modifier\"\n | \"roll-modifier\"\n | \"re-roll\"\n | \"mortal-wounds\"\n | \"feel-no-pain\"\n | \"invulnerable-save\"\n | \"ward\"\n | \"keyword-grant\"\n | \"movement-modifier\"\n | \"deep-strike\"\n | \"fallback-and-act\"\n | \"fight-first\"\n | \"fight-last\"\n | \"shoot-on-death\"\n | \"fight-on-death\"\n | \"objective-control-modifier\"\n | \"leadership-modifier\"\n | \"damage-reduction\"\n | \"attack-restriction\"\n | \"ability-grant\"\n | \"cp-gain\"\n | \"cp-refund\"\n | \"model-destruction\"\n | \"resurrection\"\n | \"resource-gain\"\n | \"resource-spend\"\n | \"charge-roll-modifier\"\n | \"terrain-area-tag\"\n | \"objective-tag\"\n | \"unit-tag\"\n | \"bs-modifier\"\n | \"engagement-passthrough\";\n target:\n | \"self\"\n | \"bearer\"\n | \"unit\"\n | \"attached-unit\"\n | \"attacker\"\n | \"defender\"\n | \"friendly-within-aura\"\n | \"enemy-within-aura\"\n | \"all-friendly\"\n | \"all-enemy\";\n modifier?: {\n [k: string]: unknown;\n };\n [k: string]: unknown;\n};\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"effect-node\".\n */\nexport type EffectNode =\n | SingleEffect\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\nexport type AbilityCondition2 = SimpleCondition | CompoundCondition;\nexport type AbilityEffect1 =\n | unknown\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"condition\".\n */\nexport type AbilityCondition3 = SimpleCondition | CompoundCondition;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"effect\".\n */\nexport type AbilityEffect2 =\n | SingleEffect\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\n\n/**\n * Auto-generated by tools/src/bundle-schemas.ts. Single self-contained schema for Rust codegen — do not edit by hand.\n */\nexport interface KdcBundledSchemas {\n [k: string]: unknown;\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"vec2\".\n */\nexport interface Vec2 {\n x: number;\n y: number;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"game-version-ref\".\n */\nexport interface GameVersionReference {\n edition: Edition;\n dataslate: DataslateVersion;\n [k: string]: unknown;\n}\n/**\n * A deployment map: per-side deployment zones, objective positions, and (11e) per-side territory polygons. Pattern geometry carries forward unchanged from 10th edition; downstream tooling (e.g. bevy-deploy-helper) consumes this as the canonical encoding.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"deployment-pattern\".\n */\nexport interface DeploymentPattern {\n id: EntityId;\n name: string;\n /**\n * Mission pack or source the pattern originates from (e.g. 'leviathan').\n */\n source?: string;\n description?: string;\n /**\n * Per-side deployment zones.\n *\n * @minItems 1\n */\n zones: [\n {\n player: Side;\n name?: string;\n shape: ZoneShape;\n position: Vec2;\n /**\n * Hex render color for the zone overlay.\n */\n color?: string;\n },\n ...{\n player: Side;\n name?: string;\n shape: ZoneShape;\n position: Vec2;\n /**\n * Hex render color for the zone overlay.\n */\n color?: string;\n }[]\n ];\n /**\n * 11e per-side territory polygons, mirroring the deployment-zone shape (e.g. the band between a deployment zone and the midline). Empty until authored.\n */\n territories?: {\n player: Side;\n shape: ZoneShape;\n position: Vec2;\n }[];\n /**\n * Objective-marker positions on the board.\n */\n objectives?: Vec2[];\n /**\n * Ids of recommended terrain-layout entities (resolved once terrain-layout data is authored).\n */\n recommended_terrain_layout_ids?: EntityId[];\n game_version: GameVersionReference;\n}\n/**\n * A detachment option within a faction, providing a detachment rule, enhancements, and stratagems.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"detachment\".\n */\nexport interface Detachment {\n id: EntityId;\n name: string;\n faction_id: EntityId;\n detachment_rule_id?: EntityId | null;\n /**\n * 11e: the detachment-point cost (1–3) charged against the army's detachment-point budget. null when not yet assigned.\n */\n detachment_points?: number | null;\n /**\n * 11e: ids of the Force Disposition entities this detachment grants. Empty until assigned.\n */\n force_dispositions?: EntityId[];\n enhancement_ids?: EntityId[];\n stratagem_ids?: EntityId[];\n restrictions?: {\n required_keywords?: KeywordList;\n excluded_keywords?: KeywordList;\n notes?: string;\n } | null;\n game_version: GameVersionReference;\n}\n/**\n * A purchasable upgrade for a character unit, provided by a detachment.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"enhancement\".\n */\nexport interface Enhancement {\n id: EntityId;\n name: string;\n detachment_id: EntityId;\n cost: number;\n /**\n * True when the cost is carried over provisionally (e.g. seeded from a prior edition during migration) and not yet confirmed against the current dataslate.\n */\n points_provisional?: boolean;\n /**\n * 11e: when true, this enhancement applies to up to `max_targets` non-character units while counting as a single Enhancement choice.\n */\n upgrade_tag?: boolean;\n /**\n * Number of units this enhancement may be applied to. Only meaningful when `upgrade_tag` is true; defaults to 1.\n */\n max_targets?: number;\n keyword_restrictions?: KeywordList;\n exclusion_keywords?: KeywordList | null;\n ability_id?: EntityId | null;\n is_unique?: boolean;\n game_version: GameVersionReference;\n}\n/**\n * A playable faction or sub-faction.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"faction\".\n */\nexport interface Faction {\n id: EntityId;\n name: string;\n parent_faction_id?: EntityId | null;\n game_version: GameVersionReference;\n keywords?: KeywordList;\n aliases?: string[];\n /**\n * Reference to the faction-wide ability (e.g., Oath of Moment)\n */\n faction_rule_id?: EntityId | null;\n}\n/**\n * A 11e strategic-intent tag granted by detachments. Players compare dispositions at game start to determine the shared mission; asymmetric primary objectives result.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"force-disposition\".\n */\nexport interface ForceDisposition {\n /**\n * One of the five confirmed launch Force Dispositions.\n */\n id: \"take-and-hold\" | \"disruption\" | \"purge-the-foe\" | \"priority-assets\" | \"reconnaissance\";\n name: string;\n /**\n * Community-authored description of the disposition's effect (original prose only — no reproduced rules text).\n */\n text?: string;\n game_version: GameVersionReference;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"game-version\".\n */\nexport interface GameVersion {\n edition: Edition;\n dataslate: DataslateVersion;\n effective_date: string;\n label?: string;\n supersedes?: DataslateVersion | null;\n}\n/**\n * Defines which character units can attach to which bodyguard units.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"leader-attachment\".\n */\nexport interface LeaderAttachment {\n leader_id: EntityId;\n /**\n * @minItems 1\n */\n eligible_bodyguard_ids: [EntityId, ...EntityId[]];\n game_version: GameVersionReference;\n}\n/**\n * One cell of the 11e Force Disposition matrix: given the player's own Force Disposition and their opponent's, the mission that player plays. Mirrors a single row on a physical Force Disposition card. The (disposition, opponent_disposition) pair is the conceptual key; compound uniqueness across entries is a data convention, not enforced by this schema.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"mission-matchup\".\n */\nexport interface MissionMatchup {\n id: EntityId;\n /**\n * The player's own Force Disposition.\n */\n disposition: \"take-and-hold\" | \"disruption\" | \"purge-the-foe\" | \"priority-assets\" | \"reconnaissance\";\n /**\n * The opponent's Force Disposition.\n */\n opponent_disposition: \"take-and-hold\" | \"disruption\" | \"purge-the-foe\" | \"priority-assets\" | \"reconnaissance\";\n /**\n * Kebab-case identifier\n */\n mission_id: string;\n game_version: GameVersionReference;\n}\n/**\n * An 11e primary mission (the objective a player scores). Which mission a player plays is selected by the Force Disposition matchup matrix (see mission-matchup), keyed on the player's own disposition and their opponent's. Victory points are capped per game and per battle round.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"mission\".\n */\nexport interface Mission {\n id: EntityId;\n name: string;\n /**\n * Mission pack or source the mission originates from.\n */\n source?: string;\n /**\n * Community-authored mission/objective summary (original prose only — no reproduced rules text).\n */\n description?: string;\n /**\n * Maximum primary VP scorable across the whole game. 11e default is 45.\n */\n vp_per_game_cap?: number;\n /**\n * Maximum primary VP scorable in a single battle round. 11e default is 15.\n */\n vp_per_round_cap?: number;\n /**\n * Ids of the deployment-pattern entities (maps) this mission can be played on. Empty until the per-mission maps are confirmed.\n */\n deployment_pattern_ids?: EntityId[];\n game_version: GameVersionReference;\n}\n/**\n * A draw-time predicate over an army list (not runtime board state, so deliberately NOT the Ability DSL condition). Used to gate when_drawn operations such as redraws. Example: a card that is void unless the opponent fields a large unit (10e 'Cull the Horde' redrew when the opponent had no unit of 14+ models) is { subject: 'opponent', quantifier: 'none', unit_filter: { model_count_min: 14 } } with operation 'redraw'.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"army-composition-predicate\".\n */\nexport interface ArmyCompositionPredicate {\n /**\n * Whose army list the predicate inspects.\n */\n subject: \"self\" | \"opponent\";\n /**\n * Whether the army must contain ('any') or lack ('none') a unit matching unit_filter for the predicate to hold.\n */\n quantifier: \"any\" | \"none\";\n /**\n * Criteria a unit in the army must satisfy to match. All present criteria must hold (logical AND).\n */\n unit_filter: {\n model_count_min?: number;\n model_count_max?: number;\n wounds_min?: number;\n keywords?: KeywordList;\n };\n}\n/**\n * An 11e mission card. The deck-level rule (draw 2 per turn, keep unscored cards) is separate and not modelled here. This is the per-card shape: an optional on-draw deck operation, an optional player action, and zero or more VP-award blocks. Primary mission cards reuse this shape via card_type. Mechanic blocks reference the Ability DSL; prose is community-authored (no reproduced rules text).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"secondary-card\".\n */\nexport interface SecondaryCard {\n id: EntityId;\n name: string;\n /**\n * Whether this is a secondary card or a primary mission card (which reuses this shape).\n */\n card_type?: \"secondary\" | \"primary\";\n /**\n * Finer classification within the deck (e.g. a category or tactical/fixed split). Free-form — not enum-locked until 11e categories are confirmed.\n */\n subtype?: string;\n /**\n * Optional deck operation performed when this card is drawn (e.g. redraw, swap). Distinct from combat effects — deck operations have no combat target, so they are not modelled via the Ability DSL effect language. If `condition` is present, the operation fires only when the predicate holds.\n */\n when_drawn?: {\n /**\n * The deck manipulation this card triggers on draw.\n */\n operation: \"reshuffle\" | \"replace\" | \"redraw\" | \"draw-extra\" | \"swap\";\n /**\n * Other cards this operation references, by id.\n */\n card_ids?: EntityId[];\n condition?: ArmyCompositionPredicate1;\n };\n /**\n * Optional player actions the card enables. Most cards have a single action; a few (e.g. Observe Enemy, with separate Baited-removal and Spotted actions) have two distinct actions on the same card.\n *\n * @minItems 1\n */\n actions?: [\n {\n /**\n * Optional kebab-case identifier used to reference this action from `action-completed` conditions in `awards[].when`.\n */\n action_id?: string;\n /**\n * The five official game phases. Unchanged between 10th and 11th edition — 11e reorders Pile In timing within the Fight phase but adds no top-level phase.\n */\n starts?: \"command\" | \"movement\" | \"shooting\" | \"charge\" | \"fight\";\n player_turn?: PlayerTurn;\n units?: AbilityCondition;\n /**\n * Maximum number of times the action may be performed (per turn unless `use_limit_scope` says otherwise).\n */\n use_limit?: number;\n /**\n * Whether `use_limit` is enforced per turn or once per game (e.g. Recover the Relics / Find and Deny 'Overwhelming Force' is once per game).\n */\n use_limit_scope?: \"per-turn\" | \"per-game\";\n completes?: AbilityCondition1;\n effect?: AbilityEffect;\n },\n ...{\n /**\n * Optional kebab-case identifier used to reference this action from `action-completed` conditions in `awards[].when`.\n */\n action_id?: string;\n /**\n * The five official game phases. Unchanged between 10th and 11th edition — 11e reorders Pile In timing within the Fight phase but adds no top-level phase.\n */\n starts?: \"command\" | \"movement\" | \"shooting\" | \"charge\" | \"fight\";\n player_turn?: PlayerTurn;\n units?: AbilityCondition;\n /**\n * Maximum number of times the action may be performed (per turn unless `use_limit_scope` says otherwise).\n */\n use_limit?: number;\n /**\n * Whether `use_limit` is enforced per turn or once per game (e.g. Recover the Relics / Find and Deny 'Overwhelming Force' is once per game).\n */\n use_limit_scope?: \"per-turn\" | \"per-game\";\n completes?: AbilityCondition1;\n effect?: AbilityEffect;\n }[]\n ];\n /**\n * VP-award blocks: each scores when `trigger` fires and the optional `when` condition holds. An award scores either a flat `vp` or a count-scaled `vp_per` (VP per instance of the thing named by `per`). Awards accrue independently and sum; a card's '+ ... CUMULATIVE' rows are modelled as separate awards flagged `cumulative` for faithful round-trip. Awards sharing the same `exclusive_group` value within a card resolve as the highest-scoring single award fires (the card's literal 'OR' rows between tier breakpoints, e.g. Record-Breaking Mission's 3-Fronts vs 4-Fronts).\n *\n * @minItems 1\n */\n awards?: [\n (\n | {\n [k: string]: unknown;\n }\n | {\n [k: string]: unknown;\n }\n ),\n ...(\n | {\n [k: string]: unknown;\n }\n | {\n [k: string]: unknown;\n }\n )[]\n ];\n /**\n * Community-authored card description (original prose only — no reproduced rules text).\n */\n text?: string;\n game_version: GameVersionReference;\n}\n/**\n * Draw-time army-composition predicate gating the operation (e.g. redraw when the opponent lacks a qualifying unit).\n */\nexport interface ArmyCompositionPredicate1 {\n /**\n * Whose army list the predicate inspects.\n */\n subject: \"self\" | \"opponent\";\n /**\n * Whether the army must contain ('any') or lack ('none') a unit matching unit_filter for the predicate to hold.\n */\n quantifier: \"any\" | \"none\";\n /**\n * Criteria a unit in the army must satisfy to match. All present criteria must hold (logical AND).\n */\n unit_filter: {\n model_count_min?: number;\n model_count_max?: number;\n wounds_min?: number;\n keywords?: KeywordList;\n };\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"simple-condition\".\n */\nexport interface SimpleCondition {\n type:\n | \"phase-is\"\n | \"timing-is\"\n | \"player-turn-is\"\n | \"unit-below-starting-strength\"\n | \"unit-below-half-strength\"\n | \"unit-has-keyword\"\n | \"unit-within-range-of\"\n | \"model-is-leader\"\n | \"target-has-keyword\"\n | \"charged-this-turn\"\n | \"advanced-this-turn\"\n | \"remained-stationary\"\n | \"is-battle-shocked\"\n | \"has-lost-wounds\"\n | \"opponent-unit-within-range\"\n | \"within-range-of-objective\"\n | \"attack-is-type\"\n | \"has-fought-this-phase\"\n | \"destroyed-by-attack-type\"\n | \"controls-objective\"\n | \"is-attached\"\n | \"terrain-area-control\"\n | \"engagement-state\"\n | \"territory-control\"\n | \"fights-first\"\n | \"disposition-matches\"\n | \"units-destroyed\"\n | \"units-destroyed-comparison\"\n | \"objective-majority\"\n | \"action-completed\"\n | \"objective-has-tag\"\n | \"unit-has-tag\"\n | \"terrain-has-tag\"\n | \"new-objective-controlled\"\n | \"engagement-fronts\"\n | \"destroyed-while-on-objective\";\n parameters?: {\n [k: string]: unknown;\n };\n negated?: boolean;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"compound-condition\".\n */\nexport interface CompoundCondition {\n operator: \"and\" | \"or\" | \"not\";\n /**\n * @minItems 1\n */\n operands: [ConditionNode, ...ConditionNode[]];\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"choice-effect\".\n */\nexport interface ChoiceEffect {\n type: \"choice\";\n /**\n * @minItems 2\n */\n options: [EffectNode, EffectNode, ...EffectNode[]];\n choice_label?: string;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"sequence-effect\".\n */\nexport interface SequenceEffect {\n type: \"sequence\";\n /**\n * @minItems 1\n */\n steps: [EffectNode, ...EffectNode[]];\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"dice-gated-effect\".\n */\nexport interface DiceGatedEffect {\n type: \"dice-gated\";\n /**\n * Dice expression, e.g. 'D6', '2D6'\n */\n dice: string;\n /**\n * Fixed threshold or model characteristic to compare against\n */\n threshold: number | (\"leadership\" | \"toughness\" | \"save\");\n comparison?: \"gte\" | \"lte\" | \"gt\" | \"lt\" | \"eq\";\n on_success?: EffectNode | null;\n on_fail?: EffectNode | null;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"conditional-effect\".\n */\nexport interface ConditionalEffect {\n type: \"conditional\";\n condition: AbilityCondition2;\n effect: EffectNode;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"dice-pool-allocation-effect\".\n */\nexport interface DicePoolAllocationEffect {\n type: \"dice-pool-allocation\";\n pool: {\n count: number;\n die: string;\n [k: string]: unknown;\n };\n max_activations: number;\n /**\n * @minItems 1\n */\n options: [\n {\n name: string;\n requirement: {\n type: \"pair\" | \"triple\" | \"single\" | \"run\";\n min_value: number;\n [k: string]: unknown;\n };\n effect: EffectNode;\n [k: string]: unknown;\n },\n ...{\n name: string;\n requirement: {\n type: \"pair\" | \"triple\" | \"single\" | \"run\";\n min_value: number;\n [k: string]: unknown;\n };\n effect: EffectNode;\n [k: string]: unknown;\n }[]\n ];\n [k: string]: unknown;\n}\n/**\n * A CP-costed ability usable during specific game phases.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"stratagem\".\n */\nexport interface Stratagem {\n id: EntityId;\n name: string;\n /**\n * Whether this is a universal core stratagem or tied to a specific detachment\n */\n category: \"core\" | \"detachment\";\n /**\n * GW-printed stratagem category from the card\n */\n type: \"battle-tactic\" | \"strategic-ploy\" | \"epic-deed\" | \"wargear\";\n /**\n * Null for core stratagems\n */\n detachment_id?: EntityId | null;\n cp_cost: number;\n phases: PhaseList;\n player_turn: PlayerTurn;\n timing: \"once-per-phase\" | \"once-per-turn\" | \"once-per-battle\" | \"unlimited\";\n target_restrictions?: {\n required_keywords?: KeywordList;\n excluded_keywords?: KeywordList;\n notes?: string;\n } | null;\n ability_id?: EntityId | null;\n game_version: GameVersionReference;\n}\n/**\n * One terrain piece placed on the board. Geometry comes from a catalog `template` or an inline `footprint` (if both are present, `footprint` is authoritative and `template` is provenance).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"piece\".\n */\nexport interface Piece {\n /**\n * Kebab-case identifier\n */\n id?: string;\n name?: string;\n /**\n * An `area` is a gameplay terrain zone (the 11e 'terrain area'); a `feature` is physical scenery (walls, containers, pipes) placed on an area.\n */\n piece_type?: \"area\" | \"feature\";\n /**\n * Kebab-case identifier\n */\n template?: string;\n /**\n * Inline geometry, standing in for or overriding a template footprint. Authoritative when present.\n */\n footprint?:\n | {\n type: \"rectangle\";\n width: number;\n height: number;\n }\n | {\n type: \"right-triangle\";\n width: number;\n height: number;\n }\n | {\n type: \"polygon\";\n /**\n * @minItems 3\n */\n points: [Vec2, Vec2, Vec2, ...Vec2[]];\n };\n position: Vec21;\n /**\n * Clockwise rotation about the centroid in the y-down board frame. Absent or 0 means the template's natural orientation.\n */\n rotation_degrees?: number;\n /**\n * Reflection applied in the centroid-local frame before rotation: `horizontal` negates local x (left-right flip), `vertical` negates local y.\n */\n mirror?: \"none\" | \"horizontal\" | \"vertical\";\n /**\n * Kebab-case identifier\n */\n parent_area_id?: string;\n /**\n * Ruin floor this piece occupies (0 = ground level).\n */\n floor?: number;\n /**\n * Height of the piece in inches; overrides the template default. Gates Plunging Fire (a piece 3\" or taller confers +1 BS on ground-level targets).\n */\n height_inches?: number;\n /**\n * Terrain-area keywords this piece's area carries; overrides the template default.\n */\n terrain_area_keywords?: TerrainAreaKeyword[];\n /**\n * Pieces sharing a `link_group` value are linked terrain — treated as a single terrain feature (and, where an objective sits among them, a single objective).\n */\n link_group?: string;\n /**\n * Whether this piece carries an objective marker.\n */\n is_objective?: boolean;\n /**\n * Objective-marker metadata. Only meaningful when `is_objective` is true.\n */\n objective?: {\n position?: Vec22;\n /**\n * Range from the marker within which models contribute to control.\n */\n control_range_inches?: number;\n };\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n */\nexport interface Vec21 {\n x: number;\n y: number;\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n */\nexport interface Vec22 {\n x: number;\n y: number;\n}\n/**\n * A recommended arrangement of terrain pieces on the board, independent of the deployment map (a deployment-pattern references the layouts it recommends via recommended_terrain_layout_ids). Each piece draws its geometry from a catalog `template` (a terrain-template entity) or an inline `footprint`; geometry is the source of truth. Placement is template-centroid-anchored: `position` is the piece's centroid, which is invariant under rotation and mirror, so orientation and location are decoupled. Resolved board-space vertices are derived by the shared terrain resolver (pinned by the conformance corpus), never stored here. No layout data is authored yet beyond migrated examples.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"terrain-layout\".\n */\nexport interface TerrainLayout {\n id: EntityId;\n name: string;\n /**\n * Mission pack or source the layout originates from.\n */\n source?: string;\n description?: string;\n /**\n * Terrain pieces composing the layout. May be empty while a layout is registered by name ahead of its confirmed geometry.\n */\n pieces?: Piece[];\n game_version: GameVersionReference;\n}\n/**\n * A feature placed on an area template, positioned in the area's centroid-local frame (y-down inches). When the area is placed, rotated, or mirrored, its composed features are carried along.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"composed-feature\".\n */\nexport interface ComposedFeature {\n /**\n * Kebab-case identifier\n */\n id?: string;\n /**\n * Kebab-case identifier\n */\n template: string;\n position: Vec23;\n /**\n * Clockwise rotation of the feature about its own centroid, within the area-local frame.\n */\n rotation_degrees?: number;\n mirror?: \"none\" | \"horizontal\" | \"vertical\";\n /**\n * Ruin floor this feature occupies (0 = ground level).\n */\n floor?: number;\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n */\nexport interface Vec23 {\n x: number;\n y: number;\n}\n/**\n * A reusable terrain piece in the standard catalog: a gameplay area (the 11e terrain-area templates) or a scenery feature (walls, containers, pipes, floor segments). Footprints are authored in natural local inches; the terrain resolver derives each footprint's polygon area centroid and re-centers on it, so a layout piece that instances a template places its centroid via the layout's `position`. An `area` template may carry an embedded `features` list — scenery placed in the area's centroid-local frame — making the template a reusable composition (e.g. a ruin with its walls). Placing such a template places all of its features, transformed by the area's own placement.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"terrain-template\".\n */\nexport interface TerrainTemplate {\n id: EntityId;\n name: string;\n /**\n * `area` = a gameplay terrain zone; `feature` = physical scenery placed on an area.\n */\n kind: \"area\" | \"feature\";\n /**\n * Catalog or mission pack the template originates from.\n */\n source?: string;\n footprint: Footprint;\n /**\n * Default height in inches for pieces instancing this template. Gates Plunging Fire (>= 3\").\n */\n default_height_inches?: number;\n /**\n * Whether the template blocks line of sight / movement by default.\n */\n default_blocking?: boolean;\n /**\n * Whether models may be placed on the ground footprint. `false` marks an elevated-only piece (a platform reachable only on its `upper_floor`, e.g. a gantry/catwalk) or a solid obstacle with no valid placement (e.g. a generator). Meaningful for `kind: \"feature\"`.\n */\n ground_accessible?: boolean;\n /**\n * An elevated platform carried by this feature (e.g. a ruin's second storey). Its footprint is authored in the SAME local frame as `footprint` and re-centered on the GROUND footprint's polygon area centroid, so the two floors stay registered when the piece is placed, rotated, or mirrored. Non-resolved metadata: the terrain resolver does not emit it; authoring/visualization tools render it as an overlay. Meaningful for `kind: \"feature\"`.\n */\n upper_floor?: {\n footprint: Footprint;\n /**\n * Ruin floor this platform occupies (1 = first floor above ground).\n */\n floor?: number;\n };\n /**\n * Terrain-area keywords areas of this template carry by default. Meaningful for `kind: \"area\"`.\n */\n default_terrain_area_keywords?: TerrainAreaKeyword[];\n /**\n * Composed scenery features, in the area's centroid-local frame. Only meaningful for `kind: \"area\"`.\n */\n features?: ComposedFeature[];\n game_version: GameVersionReference;\n}\n/**\n * Describes the internal model-type breakdown of a unit.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"unit-composition\".\n */\nexport interface UnitComposition {\n unit_id: EntityId;\n /**\n * @minItems 1\n */\n models: [\n {\n name: string;\n profile_name?: string | null;\n min: number;\n max: number;\n default_weapon_ids?: EntityId[];\n is_leader_model?: boolean;\n },\n ...{\n name: string;\n profile_name?: string | null;\n min: number;\n max: number;\n default_weapon_ids?: EntityId[];\n is_leader_model?: boolean;\n }[]\n ];\n game_version: GameVersionReference;\n}\n/**\n * A unit datasheet entry with stat profiles and point costs.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"unit\".\n */\nexport interface Unit {\n id: EntityId;\n name: string;\n faction_id: EntityId;\n /**\n * Battlefield role from the datasheet header. Unit types (Infantry, Vehicle, etc.) belong in keywords.\n */\n role?: \"character\" | \"battleline\" | \"dedicated-transport\" | \"fortification\" | \"allied\" | \"epic-hero\";\n /**\n * Character attachment role (11e). 'support' implies the unit is only legal when attached to a host unit (cannot be taken solo); 'leader' is valid as a standalone list entry. null/absent for non-attaching units.\n */\n attachment_role?: (\"leader\" | \"support\") | null;\n /**\n * @minItems 1\n */\n profiles: [\n {\n /**\n * Profile name (e.g., 'Wounded' for degrading)\n */\n name?: string;\n M: StatValue;\n T: number;\n W: number;\n Sv: number;\n invuln_sv?: number | null;\n Ld: number;\n OC: number;\n [k: string]: unknown;\n },\n ...{\n /**\n * Profile name (e.g., 'Wounded' for degrading)\n */\n name?: string;\n M: StatValue;\n T: number;\n W: number;\n Sv: number;\n invuln_sv?: number | null;\n Ld: number;\n OC: number;\n [k: string]: unknown;\n }[]\n ];\n points?: {\n models: number;\n cost: number;\n [k: string]: unknown;\n }[];\n /**\n * True when point costs are carried over provisionally (e.g. seeded from a prior edition during migration) and not yet confirmed against the current dataslate.\n */\n points_provisional?: boolean;\n keywords?: KeywordList;\n faction_keywords?: KeywordList;\n base_size_mm?: {\n shape: \"round\" | \"oval\";\n diameter?: number;\n width?: number;\n length?: number;\n [k: string]: unknown;\n } | null;\n model_count?: {\n min: number;\n max: number;\n [k: string]: unknown;\n };\n weapon_ids?: EntityId[];\n ability_ids?: EntityId[];\n transport_capacity?: {\n capacity: number;\n keyword_restrictions?: KeywordList | null;\n exclusion_keywords?: KeywordList | null;\n } | null;\n game_version: GameVersionReference;\n is_legend?: boolean;\n}\n/**\n * A weapon substitution option available to models within a unit.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"wargear-option\".\n */\nexport interface WargearOption {\n id: EntityId;\n unit_id: EntityId;\n model_constraint?: {\n model_name?: string;\n per_n_models?: number;\n max_count?: number;\n } | null;\n /**\n * Weapon IDs being removed\n *\n * @minItems 1\n */\n replaces: [EntityId, ...EntityId[]];\n /**\n * Weapon IDs being added\n *\n * @minItems 1\n */\n replacement: [EntityId, ...EntityId[]];\n is_free?: boolean;\n additional_cost?: number | null;\n game_version: GameVersionReference;\n}\n/**\n * Catalog entry for a weapon keyword (Lethal Hits, Sustained Hits N, Anti-X N+, etc.). Each weapon profile references entries here via {keyword_id, parameters?} instead of carrying free-text strings. The optional `effect` describes the keyword's game mechanic in the Ability DSL; null when the behaviour is faction-specific flavour not yet modelled.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"weapon-keyword\".\n */\nexport interface WeaponKeyword {\n id: EntityId;\n name: string;\n /**\n * Parameter keys that must be supplied at each reference site, in the order they would appear in a printed datasheet (e.g. Anti-INFANTRY 4+ → ['target_keyword', 'threshold']).\n *\n * @maxItems 3\n */\n required_parameters:\n | []\n | [\"value\" | \"target_keyword\" | \"threshold\"]\n | [\"value\" | \"target_keyword\" | \"threshold\", \"value\" | \"target_keyword\" | \"threshold\"]\n | [\n \"value\" | \"target_keyword\" | \"threshold\",\n \"value\" | \"target_keyword\" | \"threshold\",\n \"value\" | \"target_keyword\" | \"threshold\"\n ];\n effect: unknown;\n game_version: GameVersionReference;\n}\n/**\n * A weapon entry with one or more stat profiles (e.g., standard and overcharge modes).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"weapon\".\n */\nexport interface Weapon {\n id: EntityId;\n name: string;\n type: \"ranged\" | \"melee\";\n /**\n * @minItems 1\n */\n profiles: [\n {\n name: string;\n range?: number | \"Melee\";\n stats: {\n A: StatValue;\n BS?: number | null;\n WS?: number | null;\n S: StatValue;\n AP: number;\n D: StatValue;\n [k: string]: unknown;\n };\n /**\n * References into the weapon-keyword catalog. Each entry names the catalog id and supplies parameter values (e.g. `Sustained Hits 1` → `{keyword_id: 'sustained-hits', parameters: {value: 1}}`).\n */\n keywords?: {\n keyword_id: EntityId;\n /**\n * Reference-site parameters conforming to the catalog entry's required_parameters. Only the three documented keys are accepted; any other key is invalid.\n */\n parameters?: {\n value?: StatValue;\n target_keyword?: string;\n threshold?: number;\n };\n }[];\n },\n ...{\n name: string;\n range?: number | \"Melee\";\n stats: {\n A: StatValue;\n BS?: number | null;\n WS?: number | null;\n S: StatValue;\n AP: number;\n D: StatValue;\n [k: string]: unknown;\n };\n /**\n * References into the weapon-keyword catalog. Each entry names the catalog id and supplies parameter values (e.g. `Sustained Hits 1` → `{keyword_id: 'sustained-hits', parameters: {value: 1}}`).\n */\n keywords?: {\n keyword_id: EntityId;\n /**\n * Reference-site parameters conforming to the catalog entry's required_parameters. Only the three documented keys are accepted; any other key is invalid.\n */\n parameters?: {\n value?: StatValue;\n target_keyword?: string;\n threshold?: number;\n };\n }[];\n }[]\n ];\n game_version: GameVersionReference;\n}\n/**\n * Community-authored structured representation of what a game ability does. NOT GW text.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"ability\".\n */\nexport interface AbilityDSLEntry {\n ability_id: EntityId;\n name: string;\n authored_by: ContributorRef;\n game_version: GameVersionReference;\n version?: DataslateVersion;\n supersedes?: DataslateVersion | null;\n unit_ids?: EntityId[];\n /**\n * For faction-type abilities, the faction this rule belongs to\n */\n faction_id?: EntityId | null;\n /**\n * For detachment/enhancement/stratagem-type abilities, the associated detachment\n */\n detachment_id?: EntityId | null;\n ability_type?: \"core\" | \"faction\" | \"detachment\" | \"unit\" | \"enhancement\" | \"stratagem\";\n /**\n * How this ability interacts with the game flow — not a runtime predicate\n */\n behavior?: \"passive\" | \"activated\" | \"reactive\" | \"aura\";\n effect: AbilityEffect1;\n scope: AbilityScope;\n interactions?: {\n ability_ref: EntityId;\n type: \"conflicts-with\" | \"combos-with\" | \"superseded-by\" | \"requires\" | \"replaces\";\n notes?: string;\n [k: string]: unknown;\n }[];\n disputed?: boolean;\n dispute_notes?: string;\n community_notes?: string;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"scope\".\n */\nexport interface AbilityScope {\n range:\n | \"self\"\n | \"unit\"\n | \"attached\"\n | \"aura-6\"\n | \"aura-9\"\n | \"aura-12\"\n | \"aura-custom\"\n | \"engagement-range\"\n | \"any-visible\"\n | \"any-on-battlefield\"\n | \"terrain-within-range\";\n duration: \"phase\" | \"turn\" | \"battle-round\" | \"battle\" | \"until-next-command-phase\" | \"one-use\" | \"permanent\";\n range_inches?: number;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"interaction-flag\".\n */\nexport interface InteractionFlag {\n ability_a: EntityId;\n ability_b: EntityId;\n interaction_type: \"conflicts\" | \"combos\" | \"sequencing-dependent\" | \"stacks\" | \"does-not-stack\" | \"replaces\";\n resolution?: string;\n faq_reference?: string;\n disputed?: boolean;\n game_version: GameVersionReference;\n authored_by?: ContributorRef;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"phase-mapping\".\n */\nexport interface PhaseMapping {\n source_id: EntityId;\n source_type: SourceType;\n phases: PhaseList;\n game_version: GameVersionReference;\n authored_by?: ContributorRef;\n [k: string]: unknown;\n}\n/**\n * A faction's resource system (Miracle Dice, Pain tokens, Blessings dice pool, etc.).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"resource-pool\".\n */\nexport interface ResourcePool {\n id: EntityId;\n name: string;\n faction_id: EntityId;\n pool_type: \"token\" | \"dice-pool\" | \"counter\";\n generation?: {\n condition: AbilityCondition2;\n amount: StatValue;\n [k: string]: unknown;\n }[];\n max_size?: number | null;\n game_version: GameVersionReference;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"timing-flag\".\n */\nexport interface TimingFlag {\n source_id: EntityId;\n source_type: SourceType;\n timing:\n | \"start-of-phase\"\n | \"end-of-phase\"\n | \"before-hit-roll\"\n | \"after-hit-roll\"\n | \"before-wound-roll\"\n | \"after-wound-roll\"\n | \"before-save-roll\"\n | \"after-save-roll\"\n | \"before-damage-roll\"\n | \"after-damage-roll\"\n | \"before-charge-roll\"\n | \"after-charge-roll\"\n | \"before-advance-roll\"\n | \"after-advance-roll\"\n | \"before-battle-shock\"\n | \"after-battle-shock\"\n | \"on-unit-selected\"\n | \"on-unit-destroyed\"\n | \"on-model-destroyed\"\n | \"on-damage-allocated\";\n game_version: GameVersionReference;\n authored_by?: ContributorRef;\n [k: string]: unknown;\n}\n"]}
1
+ {"version":3,"file":"generated.js","sourceRoot":"","sources":["../src/generated.ts"],"names":[],"mappings":"AAAA,gHAAgH","sourcesContent":["/* Generated from crates/wh40kdc/schemas/bundled.schema.json by 'npm run codegen:types'. DO NOT EDIT BY HAND. */\n\n/**\n * Kebab-case identifier\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"entity-id\".\n */\nexport type EntityId = string;\n/**\n * Game edition, e.g. '10th' or '11'\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"edition\".\n */\nexport type Edition = string;\n/**\n * Dataslate version: a quarterly tag (e.g. '2025-q3') or a named kebab-case slug for non-quarterly slates (e.g. 'pre-launch-provisional')\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"dataslate-version\".\n */\nexport type DataslateVersion = string;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"keyword\".\n */\nexport type Keyword = string;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"keyword-list\".\n */\nexport type KeywordList = Keyword[];\n/**\n * A stat that can be a fixed number or a dice expression\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"stat-value\".\n */\nexport type StatValue = number | string;\n/**\n * GitHub handle or '40kdc-community'\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"contributor-ref\".\n */\nexport type ContributorRef = string;\n/**\n * The five official game phases. Unchanged between 10th and 11th edition — 11e reorders Pile In timing within the Fight phase but adds no top-level phase.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"phase\".\n */\nexport type Phase = \"command\" | \"movement\" | \"shooting\" | \"charge\" | \"fight\";\n/**\n * @minItems 1\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"phase-list\".\n */\nexport type PhaseList = [Phase, ...Phase[]];\n/**\n * Type of game element that is the source of an enrichment entry\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"source-type\".\n */\nexport type SourceType = \"ability\" | \"stratagem\" | \"enhancement\" | \"detachment-rule\" | \"faction-rule\";\n/**\n * Which player's turn this applies during\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"player-turn\".\n */\nexport type PlayerTurn = \"your-turn\" | \"opponent-turn\" | \"either\";\n/**\n * 11e battle size, which sets the army's points limit and detachment-point budget: 'incursion' = 1000 pts / 2 detachment points; 'strike-force' = 2000 pts / 3 detachment points.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"battle-size\".\n */\nexport type BattleSize = \"incursion\" | \"strike-force\";\n/**\n * One of the five confirmed 11e launch Force Dispositions. Shared by force-disposition entities and the mission-matchup matrix.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"force-disposition-id\".\n */\nexport type ForceDispositionId =\n | \"take-and-hold\"\n | \"disruption\"\n | \"purge-the-foe\"\n | \"priority-assets\"\n | \"reconnaissance\";\n/**\n * A terrain piece's 2D footprint in local inches (y-down): an axis-aligned rectangle with its min corner at the local origin, a right triangle with the right angle at the local origin and legs along +x/+y, or an explicit polygon (>= 3 points). The placement resolver re-centers the footprint on its polygon area centroid, so the local-origin convention does not affect where the piece lands — only its shape matters.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"footprint\".\n */\nexport type Footprint =\n | {\n type: \"rectangle\";\n width: number;\n height: number;\n }\n | {\n type: \"right-triangle\";\n width: number;\n height: number;\n }\n | {\n type: \"polygon\";\n /**\n * @minItems 3\n */\n points: [Vec2, Vec2, Vec2, ...Vec2[]];\n };\n/**\n * An 11e terrain-area keyword. Confirmed launch set; extend as further keywords publish on dataslate.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"terrain-area-keyword\".\n */\nexport type TerrainAreaKeyword = \"obscuring\" | \"hidden\" | \"plunging-fire\";\n/**\n * A zone footprint, expressed as an axis-aligned rectangle or an explicit polygon. Vertices/extent are relative to the owning element's position.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"zone-shape\".\n */\nexport type ZoneShape =\n | {\n type: \"rectangle\";\n width: number;\n height: number;\n }\n | {\n type: \"polygon\";\n /**\n * @minItems 3\n */\n points: [Vec2, Vec2, Vec2, ...Vec2[]];\n };\n/**\n * Which player a zone or territory belongs to.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"side\".\n */\nexport type Side = \"attacker\" | \"defender\";\n/**\n * Eligibility predicate for which units may perform the action.\n */\nexport type AbilityCondition = SimpleCondition | CompoundCondition;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"condition-node\".\n */\nexport type ConditionNode = SimpleCondition | CompoundCondition;\n/**\n * Predicate for when the action is considered complete.\n */\nexport type AbilityCondition1 = SimpleCondition | CompoundCondition;\n/**\n * Effect applied when the action completes (e.g. terrain-area-tag, objective-tag, or unit-tag to mark transient state).\n */\nexport type AbilityEffect =\n | SingleEffect\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"effect-node\".\n */\nexport type EffectNode =\n | SingleEffect\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\nexport type AbilityCondition2 = SimpleCondition | CompoundCondition;\nexport type AbilityEffect1 =\n | SingleEffect\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"condition\".\n */\nexport type AbilityCondition3 = SimpleCondition | CompoundCondition;\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"effect\".\n */\nexport type AbilityEffect2 =\n | SingleEffect\n | ChoiceEffect\n | SequenceEffect\n | DiceGatedEffect\n | ConditionalEffect\n | DicePoolAllocationEffect;\n\n/**\n * Auto-generated by tools/src/bundle-schemas.ts. Single self-contained schema for Rust codegen — do not edit by hand.\n */\nexport interface KdcBundledSchemas {\n [k: string]: unknown;\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"vec2\".\n */\nexport interface Vec2 {\n x: number;\n y: number;\n}\n/**\n * A model's base. 'round' carries 'diameter'; 'oval' carries 'width'+'length'. 'flying-base' (with 'size': small/large), 'hull', and 'unique' are categories the GW base-size guide gives without standard millimetre dimensions; entries carrying such a category, or any millimetre value not taken from an authoritative source, set 'draft': true to mark them for later hand-authoring.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"base-size\".\n */\nexport interface BaseSize {\n shape: \"round\" | \"oval\" | \"flying-base\" | \"hull\" | \"unique\";\n diameter?: number;\n width?: number;\n length?: number;\n /**\n * Flying-base size class, when 'shape' is 'flying-base'.\n */\n size?: \"small\" | \"large\";\n /**\n * True when the entry is provisional/guessed (e.g. a category without authoritative dimensions) and should be revisited.\n */\n draft?: boolean;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"game-version-ref\".\n */\nexport interface GameVersionReference {\n edition: Edition;\n dataslate: DataslateVersion;\n [k: string]: unknown;\n}\n/**\n * A deployment map: per-side deployment zones, objective positions, and (11e) per-side territory polygons. Pattern geometry carries forward unchanged from 10th edition; downstream tooling (e.g. bevy-deploy-helper) consumes this as the canonical encoding.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"deployment-pattern\".\n */\nexport interface DeploymentPattern {\n id: EntityId;\n name: string;\n /**\n * Mission pack or source the pattern originates from (e.g. 'leviathan').\n */\n source?: string;\n description?: string;\n /**\n * Per-side deployment zones.\n *\n * @minItems 1\n */\n zones: [\n {\n player: Side;\n name?: string;\n shape: ZoneShape;\n position: Vec2;\n /**\n * Hex render color for the zone overlay.\n */\n color?: string;\n },\n ...{\n player: Side;\n name?: string;\n shape: ZoneShape;\n position: Vec2;\n /**\n * Hex render color for the zone overlay.\n */\n color?: string;\n }[]\n ];\n /**\n * 11e per-side territory polygons, mirroring the deployment-zone shape (e.g. the band between a deployment zone and the midline). Empty until authored.\n */\n territories?: {\n player: Side;\n shape: ZoneShape;\n position: Vec2;\n }[];\n /**\n * Objective-marker positions on the board.\n */\n objectives?: Vec2[];\n /**\n * Ids of recommended terrain-layout entities (resolved once terrain-layout data is authored).\n */\n recommended_terrain_layout_ids?: EntityId[];\n game_version: GameVersionReference;\n}\n/**\n * A detachment option within a faction, providing a detachment rule, enhancements, and stratagems.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"detachment\".\n */\nexport interface Detachment {\n id: EntityId;\n name: string;\n faction_id: EntityId;\n detachment_rule_id?: EntityId | null;\n /**\n * 11e: the detachment-point cost (1–3) charged against the army's detachment-point budget. null when not yet assigned.\n */\n detachment_points?: number | null;\n /**\n * 11e: ids of the Force Disposition entities this detachment grants. Empty until assigned.\n */\n force_dispositions?: EntityId[];\n enhancement_ids?: EntityId[];\n stratagem_ids?: EntityId[];\n restrictions?: {\n required_keywords?: KeywordList;\n excluded_keywords?: KeywordList;\n notes?: string;\n } | null;\n game_version: GameVersionReference;\n}\n/**\n * A purchasable upgrade for a character unit, provided by a detachment.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"enhancement\".\n */\nexport interface Enhancement {\n id: EntityId;\n name: string;\n detachment_id: EntityId;\n cost: number;\n /**\n * True when the cost is carried over provisionally (e.g. seeded from a prior edition during migration) and not yet confirmed against the current dataslate.\n */\n points_provisional?: boolean;\n /**\n * 11e: when true, this enhancement applies to up to `max_targets` non-character units while counting as a single Enhancement choice.\n */\n upgrade_tag?: boolean;\n /**\n * Number of units this enhancement may be applied to. Only meaningful when `upgrade_tag` is true; defaults to 1.\n */\n max_targets?: number;\n keyword_restrictions?: KeywordList;\n exclusion_keywords?: KeywordList | null;\n ability_id?: EntityId | null;\n is_unique?: boolean;\n game_version: GameVersionReference;\n}\n/**\n * A playable faction or sub-faction.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"faction\".\n */\nexport interface Faction {\n id: EntityId;\n name: string;\n parent_faction_id?: EntityId | null;\n game_version: GameVersionReference;\n keywords?: KeywordList;\n aliases?: string[];\n /**\n * Reference to the faction-wide ability (e.g., Oath of Moment)\n */\n faction_rule_id?: EntityId | null;\n}\n/**\n * A 11e strategic-intent tag granted by detachments. Players compare dispositions at game start to determine the shared mission; asymmetric primary objectives result.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"force-disposition\".\n */\nexport interface ForceDisposition {\n /**\n * One of the five confirmed launch Force Dispositions.\n */\n id: \"take-and-hold\" | \"disruption\" | \"purge-the-foe\" | \"priority-assets\" | \"reconnaissance\";\n name: string;\n /**\n * Community-authored description of the disposition's effect (original prose only — no reproduced rules text).\n */\n text?: string;\n game_version: GameVersionReference;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"game-version\".\n */\nexport interface GameVersion {\n edition: Edition;\n dataslate: DataslateVersion;\n effective_date: string;\n label?: string;\n supersedes?: DataslateVersion | null;\n}\n/**\n * Defines which character units can attach to which bodyguard units.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"leader-attachment\".\n */\nexport interface LeaderAttachment {\n leader_id: EntityId;\n /**\n * @minItems 1\n */\n eligible_bodyguard_ids: [EntityId, ...EntityId[]];\n game_version: GameVersionReference;\n}\n/**\n * One cell of the 11e Force Disposition matrix: given the player's own Force Disposition and their opponent's, the mission that player plays. Mirrors a single row on a physical Force Disposition card. The (disposition, opponent_disposition) pair is the conceptual key; compound uniqueness across entries is a data convention, not enforced by this schema.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"mission-matchup\".\n */\nexport interface MissionMatchup {\n id: EntityId;\n /**\n * The player's own Force Disposition.\n */\n disposition: \"take-and-hold\" | \"disruption\" | \"purge-the-foe\" | \"priority-assets\" | \"reconnaissance\";\n /**\n * The opponent's Force Disposition.\n */\n opponent_disposition: \"take-and-hold\" | \"disruption\" | \"purge-the-foe\" | \"priority-assets\" | \"reconnaissance\";\n /**\n * Kebab-case identifier\n */\n mission_id: string;\n game_version: GameVersionReference;\n}\n/**\n * An 11e primary mission (the objective a player scores). Which mission a player plays is selected by the Force Disposition matchup matrix (see mission-matchup), keyed on the player's own disposition and their opponent's. Victory points are capped per game and per battle round.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"mission\".\n */\nexport interface Mission {\n id: EntityId;\n name: string;\n /**\n * Mission pack or source the mission originates from.\n */\n source?: string;\n /**\n * Community-authored mission/objective summary (original prose only — no reproduced rules text).\n */\n description?: string;\n /**\n * Maximum primary VP scorable across the whole game. 11e default is 45.\n */\n vp_per_game_cap?: number;\n /**\n * Maximum primary VP scorable in a single battle round. 11e default is 15.\n */\n vp_per_round_cap?: number;\n /**\n * Ids of the deployment-pattern entities (maps) this mission can be played on. Empty until the per-mission maps are confirmed.\n */\n deployment_pattern_ids?: EntityId[];\n game_version: GameVersionReference;\n}\n/**\n * When a VP award is evaluated. A bare `phase` is the legacy shorthand for 'during this phase'; richer triggers add `timing` (the moment within a phase/turn/game), `player_turn`, and a `battle_round` window. A card's section headers map onto these: 'ANY BATTLE ROUND' omits `battle_round`; 'SECOND BATTLE ROUND ONWARDS' is { min: 2 }; 'END OF THE BATTLE' is timing: end-of-battle.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"scoring-trigger\".\n */\nexport interface ScoringTrigger {\n /**\n * The five official game phases. Unchanged between 10th and 11th edition — 11e reorders Pile In timing within the Fight phase but adds no top-level phase.\n */\n phase?: \"command\" | \"movement\" | \"shooting\" | \"charge\" | \"fight\";\n /**\n * The moment the award is checked. 'End of your turn' = end-of-turn; 'End of your Command phase' = end-of-phase with phase: command; 'End of the battle' = end-of-battle.\n */\n timing?: \"start-of-turn\" | \"end-of-turn\" | \"start-of-phase\" | \"end-of-phase\" | \"end-of-battle\";\n player_turn?: PlayerTurn;\n /**\n * Battle-round window in which the trigger is active. Absent means any battle round (1-5). 'Second battle round onwards' is { min: 2 }.\n */\n battle_round?: {\n min?: number;\n max?: number;\n };\n}\n/**\n * A draw-time predicate over an army list (not runtime board state, so deliberately NOT the Ability DSL condition). Used to gate when_drawn operations such as redraws. Example: a card that is void unless the opponent fields a large unit (10e 'Cull the Horde' redrew when the opponent had no unit of 14+ models) is { subject: 'opponent', quantifier: 'none', unit_filter: { model_count_min: 14 } } with operation 'redraw'.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"army-composition-predicate\".\n */\nexport interface ArmyCompositionPredicate {\n /**\n * Whose army list the predicate inspects.\n */\n subject: \"self\" | \"opponent\";\n /**\n * Whether the army must contain ('any') or lack ('none') a unit matching unit_filter for the predicate to hold.\n */\n quantifier: \"any\" | \"none\";\n /**\n * Criteria a unit in the army must satisfy to match. All present criteria must hold (logical AND).\n */\n unit_filter: {\n model_count_min?: number;\n model_count_max?: number;\n wounds_min?: number;\n keywords?: KeywordList;\n };\n}\n/**\n * An 11e mission card. The deck-level rule (draw 2 per turn, keep unscored cards) is separate and not modelled here. This is the per-card shape: an optional on-draw deck operation, an optional player action, and zero or more VP-award blocks. Primary mission cards reuse this shape via card_type. Mechanic blocks reference the Ability DSL; prose is community-authored (no reproduced rules text).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"secondary-card\".\n */\nexport interface SecondaryCard {\n id: EntityId;\n name: string;\n /**\n * Whether this is a secondary card or a primary mission card (which reuses this shape).\n */\n card_type?: \"secondary\" | \"primary\";\n /**\n * Finer classification within the deck (e.g. a category or tactical/fixed split). Free-form — not enum-locked until 11e categories are confirmed.\n */\n subtype?: string;\n /**\n * Optional deck operation performed when this card is drawn (e.g. redraw, swap). Distinct from combat effects — deck operations have no combat target, so they are not modelled via the Ability DSL effect language. If `condition` is present, the operation fires only when the predicate holds.\n */\n when_drawn?: {\n /**\n * The deck manipulation this card triggers on draw.\n */\n operation: \"reshuffle\" | \"replace\" | \"redraw\" | \"draw-extra\" | \"swap\";\n /**\n * Other cards this operation references, by id.\n */\n card_ids?: EntityId[];\n condition?: ArmyCompositionPredicate1;\n };\n /**\n * Optional player actions the card enables. Most cards have a single action; a few (e.g. Observe Enemy, with separate Baited-removal and Spotted actions) have two distinct actions on the same card.\n *\n * @minItems 1\n */\n actions?: [\n {\n /**\n * Optional kebab-case identifier used to reference this action from `action-completed` conditions in `awards[].when`.\n */\n action_id?: string;\n /**\n * The five official game phases. Unchanged between 10th and 11th edition — 11e reorders Pile In timing within the Fight phase but adds no top-level phase.\n */\n starts?: \"command\" | \"movement\" | \"shooting\" | \"charge\" | \"fight\";\n player_turn?: PlayerTurn;\n units?: AbilityCondition;\n /**\n * Maximum number of times the action may be performed (per turn unless `use_limit_scope` says otherwise).\n */\n use_limit?: number;\n /**\n * Whether `use_limit` is enforced per turn or once per game (e.g. Recover the Relics / Find and Deny 'Overwhelming Force' is once per game).\n */\n use_limit_scope?: \"per-turn\" | \"per-game\";\n completes?: AbilityCondition1;\n effect?: AbilityEffect;\n },\n ...{\n /**\n * Optional kebab-case identifier used to reference this action from `action-completed` conditions in `awards[].when`.\n */\n action_id?: string;\n /**\n * The five official game phases. Unchanged between 10th and 11th edition — 11e reorders Pile In timing within the Fight phase but adds no top-level phase.\n */\n starts?: \"command\" | \"movement\" | \"shooting\" | \"charge\" | \"fight\";\n player_turn?: PlayerTurn;\n units?: AbilityCondition;\n /**\n * Maximum number of times the action may be performed (per turn unless `use_limit_scope` says otherwise).\n */\n use_limit?: number;\n /**\n * Whether `use_limit` is enforced per turn or once per game (e.g. Recover the Relics / Find and Deny 'Overwhelming Force' is once per game).\n */\n use_limit_scope?: \"per-turn\" | \"per-game\";\n completes?: AbilityCondition1;\n effect?: AbilityEffect;\n }[]\n ];\n /**\n * VP-award blocks: each scores when `trigger` fires and the optional `when` condition holds. An award scores either a flat `vp` or a count-scaled `vp_per` (VP per instance of the thing named by `per`). Awards accrue independently and sum; a card's '+ ... CUMULATIVE' rows are modelled as separate awards flagged `cumulative` for faithful round-trip. Awards sharing the same `exclusive_group` value within a card resolve as the highest-scoring single award fires (the card's literal 'OR' rows between tier breakpoints, e.g. Record-Breaking Mission's 3-Fronts vs 4-Fronts).\n *\n * @minItems 1\n */\n awards?: [\n (\n | {\n [k: string]: unknown;\n }\n | {\n [k: string]: unknown;\n }\n ),\n ...(\n | {\n [k: string]: unknown;\n }\n | {\n [k: string]: unknown;\n }\n )[]\n ];\n /**\n * Community-authored card description (original prose only — no reproduced rules text).\n */\n text?: string;\n game_version: GameVersionReference;\n}\n/**\n * Draw-time army-composition predicate gating the operation (e.g. redraw when the opponent lacks a qualifying unit).\n */\nexport interface ArmyCompositionPredicate1 {\n /**\n * Whose army list the predicate inspects.\n */\n subject: \"self\" | \"opponent\";\n /**\n * Whether the army must contain ('any') or lack ('none') a unit matching unit_filter for the predicate to hold.\n */\n quantifier: \"any\" | \"none\";\n /**\n * Criteria a unit in the army must satisfy to match. All present criteria must hold (logical AND).\n */\n unit_filter: {\n model_count_min?: number;\n model_count_max?: number;\n wounds_min?: number;\n keywords?: KeywordList;\n };\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"simple-condition\".\n */\nexport interface SimpleCondition {\n type:\n | \"phase-is\"\n | \"timing-is\"\n | \"player-turn-is\"\n | \"unit-below-starting-strength\"\n | \"unit-below-half-strength\"\n | \"unit-has-keyword\"\n | \"unit-within-range-of\"\n | \"model-is-leader\"\n | \"target-has-keyword\"\n | \"charged-this-turn\"\n | \"advanced-this-turn\"\n | \"remained-stationary\"\n | \"is-battle-shocked\"\n | \"has-lost-wounds\"\n | \"opponent-unit-within-range\"\n | \"within-range-of-objective\"\n | \"attack-is-type\"\n | \"has-fought-this-phase\"\n | \"destroyed-by-attack-type\"\n | \"controls-objective\"\n | \"is-attached\"\n | \"terrain-area-control\"\n | \"engagement-state\"\n | \"territory-control\"\n | \"fights-first\"\n | \"disposition-matches\"\n | \"units-destroyed\"\n | \"units-destroyed-comparison\"\n | \"objective-majority\"\n | \"action-completed\"\n | \"objective-has-tag\"\n | \"unit-has-tag\"\n | \"terrain-has-tag\"\n | \"new-objective-controlled\"\n | \"engagement-fronts\"\n | \"destroyed-while-on-objective\"\n | \"destroyed-in-tagged-terrain\";\n parameters?: {\n [k: string]: unknown;\n };\n negated?: boolean;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"compound-condition\".\n */\nexport interface CompoundCondition {\n operator: \"and\" | \"or\" | \"not\";\n /**\n * @minItems 1\n */\n operands: [ConditionNode, ...ConditionNode[]];\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"single-effect\".\n */\nexport interface SingleEffect {\n type:\n | \"stat-modifier\"\n | \"roll-modifier\"\n | \"re-roll\"\n | \"mortal-wounds\"\n | \"feel-no-pain\"\n | \"invulnerable-save\"\n | \"ward\"\n | \"keyword-grant\"\n | \"movement-modifier\"\n | \"deep-strike\"\n | \"fallback-and-act\"\n | \"fight-first\"\n | \"fight-last\"\n | \"shoot-on-death\"\n | \"fight-on-death\"\n | \"objective-control-modifier\"\n | \"leadership-modifier\"\n | \"damage-reduction\"\n | \"attack-restriction\"\n | \"ability-grant\"\n | \"cp-gain\"\n | \"cp-refund\"\n | \"model-destruction\"\n | \"resurrection\"\n | \"resource-gain\"\n | \"resource-spend\"\n | \"charge-roll-modifier\"\n | \"terrain-area-tag\"\n | \"objective-tag\"\n | \"unit-tag\"\n | \"bs-modifier\"\n | \"engagement-passthrough\";\n target:\n | \"self\"\n | \"bearer\"\n | \"unit\"\n | \"attached-unit\"\n | \"attacker\"\n | \"defender\"\n | \"friendly-within-aura\"\n | \"enemy-within-aura\"\n | \"all-friendly\"\n | \"all-enemy\";\n modifier?: {\n [k: string]: unknown;\n };\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"choice-effect\".\n */\nexport interface ChoiceEffect {\n type: \"choice\";\n /**\n * @minItems 2\n */\n options: [EffectNode, EffectNode, ...EffectNode[]];\n choice_label?: string;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"sequence-effect\".\n */\nexport interface SequenceEffect {\n type: \"sequence\";\n /**\n * @minItems 1\n */\n steps: [EffectNode, ...EffectNode[]];\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"dice-gated-effect\".\n */\nexport interface DiceGatedEffect {\n type: \"dice-gated\";\n /**\n * Dice expression, e.g. 'D6', '2D6'\n */\n dice: string;\n /**\n * Fixed threshold or model characteristic to compare against\n */\n threshold: number | (\"leadership\" | \"toughness\" | \"save\");\n comparison?: \"gte\" | \"lte\" | \"gt\" | \"lt\" | \"eq\";\n on_success?: EffectNode | null;\n on_fail?: EffectNode | null;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"conditional-effect\".\n */\nexport interface ConditionalEffect {\n type: \"conditional\";\n condition: AbilityCondition2;\n effect: EffectNode;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"dice-pool-allocation-effect\".\n */\nexport interface DicePoolAllocationEffect {\n type: \"dice-pool-allocation\";\n pool: {\n count: number;\n die: string;\n [k: string]: unknown;\n };\n max_activations: number;\n /**\n * @minItems 1\n */\n options: [\n {\n name: string;\n requirement: {\n type: \"pair\" | \"triple\" | \"single\" | \"run\";\n min_value: number;\n [k: string]: unknown;\n };\n effect: EffectNode;\n [k: string]: unknown;\n },\n ...{\n name: string;\n requirement: {\n type: \"pair\" | \"triple\" | \"single\" | \"run\";\n min_value: number;\n [k: string]: unknown;\n };\n effect: EffectNode;\n [k: string]: unknown;\n }[]\n ];\n [k: string]: unknown;\n}\n/**\n * A CP-costed ability usable during specific game phases.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"stratagem\".\n */\nexport interface Stratagem {\n id: EntityId;\n name: string;\n /**\n * Whether this is a universal core stratagem or tied to a specific detachment\n */\n category: \"core\" | \"detachment\";\n /**\n * GW-printed stratagem category from the card\n */\n type: \"battle-tactic\" | \"strategic-ploy\" | \"epic-deed\" | \"wargear\";\n /**\n * Null for core stratagems\n */\n detachment_id?: EntityId | null;\n cp_cost: number;\n phases: PhaseList;\n player_turn: PlayerTurn;\n timing: \"once-per-phase\" | \"once-per-turn\" | \"once-per-battle\" | \"unlimited\";\n target_restrictions?: {\n required_keywords?: KeywordList;\n excluded_keywords?: KeywordList;\n notes?: string;\n } | null;\n ability_id?: EntityId | null;\n game_version: GameVersionReference;\n}\n/**\n * One terrain piece placed on the board. Geometry comes from a catalog `template` or an inline `footprint` (if both are present, `footprint` is authoritative and `template` is provenance).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"piece\".\n */\nexport interface Piece {\n /**\n * Kebab-case identifier\n */\n id?: string;\n name?: string;\n /**\n * An `area` is a gameplay terrain zone (the 11e 'terrain area'); a `feature` is physical scenery (walls, containers, pipes) placed on an area.\n */\n piece_type?: \"area\" | \"feature\";\n /**\n * Kebab-case identifier\n */\n template?: string;\n /**\n * Inline geometry, standing in for or overriding a template footprint. Authoritative when present.\n */\n footprint?:\n | {\n type: \"rectangle\";\n width: number;\n height: number;\n }\n | {\n type: \"right-triangle\";\n width: number;\n height: number;\n }\n | {\n type: \"polygon\";\n /**\n * @minItems 3\n */\n points: [Vec2, Vec2, Vec2, ...Vec2[]];\n };\n position: Vec21;\n /**\n * Clockwise rotation about the centroid in the y-down board frame. Absent or 0 means the template's natural orientation.\n */\n rotation_degrees?: number;\n /**\n * Reflection applied in the centroid-local frame before rotation: `horizontal` negates local x (left-right flip), `vertical` negates local y.\n */\n mirror?: \"none\" | \"horizontal\" | \"vertical\";\n /**\n * Kebab-case identifier\n */\n parent_area_id?: string;\n /**\n * Ruin floor this piece occupies (0 = ground level).\n */\n floor?: number;\n /**\n * Height of the piece in inches; overrides the template default. Gates Plunging Fire (a piece 3\" or taller confers +1 BS on ground-level targets).\n */\n height_inches?: number;\n /**\n * Terrain-area keywords this piece's area carries; overrides the template default.\n */\n terrain_area_keywords?: TerrainAreaKeyword[];\n /**\n * Pieces sharing a `link_group` value are linked terrain — treated as a single terrain feature (and, where an objective sits among them, a single objective).\n */\n link_group?: string;\n /**\n * Whether this piece carries an objective marker.\n */\n is_objective?: boolean;\n /**\n * Objective-marker metadata. Only meaningful when `is_objective` is true.\n */\n objective?: {\n position?: Vec22;\n /**\n * Range from the marker within which models contribute to control.\n */\n control_range_inches?: number;\n };\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n */\nexport interface Vec21 {\n x: number;\n y: number;\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n */\nexport interface Vec22 {\n x: number;\n y: number;\n}\n/**\n * A recommended arrangement of terrain pieces on the board, independent of the deployment map (a deployment-pattern references the layouts it recommends via recommended_terrain_layout_ids). Each piece draws its geometry from a catalog `template` (a terrain-template entity) or an inline `footprint`; geometry is the source of truth. Placement is template-centroid-anchored: `position` is the piece's centroid, which is invariant under rotation and mirror, so orientation and location are decoupled. Resolved board-space vertices are derived by the shared terrain resolver (pinned by the conformance corpus), never stored here. No layout data is authored yet beyond migrated examples.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"terrain-layout\".\n */\nexport interface TerrainLayout {\n id: EntityId;\n name: string;\n /**\n * Mission pack or source the layout originates from.\n */\n source?: string;\n description?: string;\n /**\n * Terrain pieces composing the layout. May be empty while a layout is registered by name ahead of its confirmed geometry.\n */\n pieces?: Piece[];\n game_version: GameVersionReference;\n}\n/**\n * A feature placed on an area template, positioned in the area's centroid-local frame (y-down inches). When the area is placed, rotated, or mirrored, its composed features are carried along.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"composed-feature\".\n */\nexport interface ComposedFeature {\n /**\n * Kebab-case identifier\n */\n id?: string;\n /**\n * Kebab-case identifier\n */\n template: string;\n position: Vec23;\n /**\n * Clockwise rotation of the feature about its own centroid, within the area-local frame.\n */\n rotation_degrees?: number;\n mirror?: \"none\" | \"horizontal\" | \"vertical\";\n /**\n * Ruin floor this feature occupies (0 = ground level).\n */\n floor?: number;\n}\n/**\n * A 2D point in board inches. Origin at a board corner; JSON uses y-down (downstream renderers may flip to y-up).\n */\nexport interface Vec23 {\n x: number;\n y: number;\n}\n/**\n * A reusable terrain piece in the standard catalog: a gameplay area (the 11e terrain-area templates) or a scenery feature (walls, containers, pipes, floor segments). Footprints are authored in natural local inches; the terrain resolver derives each footprint's polygon area centroid and re-centers on it, so a layout piece that instances a template places its centroid via the layout's `position`. An `area` template may carry an embedded `features` list — scenery placed in the area's centroid-local frame — making the template a reusable composition (e.g. a ruin with its walls). Placing such a template places all of its features, transformed by the area's own placement.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"terrain-template\".\n */\nexport interface TerrainTemplate {\n id: EntityId;\n name: string;\n /**\n * `area` = a gameplay terrain zone; `feature` = physical scenery placed on an area.\n */\n kind: \"area\" | \"feature\";\n /**\n * Catalog or mission pack the template originates from.\n */\n source?: string;\n footprint: Footprint;\n /**\n * Default height in inches for pieces instancing this template. Gates Plunging Fire (>= 3\").\n */\n default_height_inches?: number;\n /**\n * Whether the template blocks line of sight / movement by default.\n */\n default_blocking?: boolean;\n /**\n * Whether models may be placed on the ground footprint. `false` marks an elevated-only piece (a platform reachable only on its `upper_floor`, e.g. a gantry/catwalk) or a solid obstacle with no valid placement (e.g. a generator). Meaningful for `kind: \"feature\"`.\n */\n ground_accessible?: boolean;\n /**\n * An elevated platform carried by this feature (e.g. a ruin's second storey). Its footprint is authored in the SAME local frame as `footprint` and re-centered on the GROUND footprint's polygon area centroid, so the two floors stay registered when the piece is placed, rotated, or mirrored. Non-resolved metadata: the terrain resolver does not emit it; authoring/visualization tools render it as an overlay. Meaningful for `kind: \"feature\"`.\n */\n upper_floor?: {\n footprint: Footprint;\n /**\n * Ruin floor this platform occupies (1 = first floor above ground).\n */\n floor?: number;\n };\n /**\n * Terrain-area keywords areas of this template carry by default. Meaningful for `kind: \"area\"`.\n */\n default_terrain_area_keywords?: TerrainAreaKeyword[];\n /**\n * Composed scenery features, in the area's centroid-local frame. Only meaningful for `kind: \"area\"`.\n */\n features?: ComposedFeature[];\n game_version: GameVersionReference;\n}\n/**\n * Describes the internal model-type breakdown of a unit.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"unit-composition\".\n */\nexport interface UnitComposition {\n unit_id: EntityId;\n /**\n * @minItems 1\n */\n models: [\n {\n name: string;\n profile_name?: string | null;\n min: number;\n max: number;\n default_weapon_ids?: EntityId[];\n is_leader_model?: boolean;\n base_size_mm?: BaseSize1;\n },\n ...{\n name: string;\n profile_name?: string | null;\n min: number;\n max: number;\n default_weapon_ids?: EntityId[];\n is_leader_model?: boolean;\n base_size_mm?: BaseSize1;\n }[]\n ];\n game_version: GameVersionReference;\n}\n/**\n * This model's base. Absent when no base could be resolved for the model.\n */\nexport interface BaseSize1 {\n shape: \"round\" | \"oval\" | \"flying-base\" | \"hull\" | \"unique\";\n diameter?: number;\n width?: number;\n length?: number;\n /**\n * Flying-base size class, when 'shape' is 'flying-base'.\n */\n size?: \"small\" | \"large\";\n /**\n * True when the entry is provisional/guessed (e.g. a category without authoritative dimensions) and should be revisited.\n */\n draft?: boolean;\n}\n/**\n * A unit datasheet entry with stat profiles and point costs.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"unit\".\n */\nexport interface Unit {\n id: EntityId;\n name: string;\n faction_id: EntityId;\n /**\n * Battlefield role from the datasheet header. Unit types (Infantry, Vehicle, etc.) belong in keywords.\n */\n role?: \"character\" | \"battleline\" | \"dedicated-transport\" | \"fortification\" | \"allied\" | \"epic-hero\";\n /**\n * Character attachment role (11e). 'support' implies the unit is only legal when attached to a host unit (cannot be taken solo); 'leader' is valid as a standalone list entry. null/absent for non-attaching units.\n */\n attachment_role?: (\"leader\" | \"support\") | null;\n /**\n * @minItems 1\n */\n profiles: [\n {\n /**\n * Profile name (e.g., 'Wounded' for degrading)\n */\n name?: string;\n M: StatValue;\n T: number;\n W: number;\n Sv: number;\n invuln_sv?: number | null;\n Ld: number;\n OC: number;\n [k: string]: unknown;\n },\n ...{\n /**\n * Profile name (e.g., 'Wounded' for degrading)\n */\n name?: string;\n M: StatValue;\n T: number;\n W: number;\n Sv: number;\n invuln_sv?: number | null;\n Ld: number;\n OC: number;\n [k: string]: unknown;\n }[]\n ];\n points?: {\n models: number;\n cost: number;\n [k: string]: unknown;\n }[];\n /**\n * True when point costs are carried over provisionally (e.g. seeded from a prior edition during migration) and not yet confirmed against the current dataslate.\n */\n points_provisional?: boolean;\n keywords?: KeywordList;\n faction_keywords?: KeywordList;\n /**\n * The unit's representative base (the most-numerous model's base). Mixed-model units carry the full per-model breakdown in unit-composition; this top-level value is a convenience for consumers that need a single base.\n */\n base_size_mm?: BaseSize | null;\n model_count?: {\n min: number;\n max: number;\n [k: string]: unknown;\n };\n weapon_ids?: EntityId[];\n ability_ids?: EntityId[];\n transport_capacity?: {\n capacity: number;\n keyword_restrictions?: KeywordList | null;\n exclusion_keywords?: KeywordList | null;\n } | null;\n game_version: GameVersionReference;\n is_legend?: boolean;\n}\n/**\n * A wargear option available to models within a unit: a weapon/wargear swap, a pure add-on, or a choice between alternatives. Models start with the unit's base loadout; an option modifies that loadout for the number of models its `model_constraint` permits.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"wargear-option\".\n */\nexport interface WargearOption {\n id: EntityId;\n unit_id: EntityId;\n model_constraint?: {\n model_name?: string;\n per_n_models?: number;\n max_count?: number;\n /**\n * When true, every model in the unit may take the option ('Any number of models can each ...'). Mutually exclusive in spirit with `per_n_models`.\n */\n any_number?: boolean;\n } | null;\n /**\n * Weapon or wargear IDs removed from the model. Omit for a pure add-on (the option only equips new wargear).\n *\n * @minItems 1\n */\n replaces?: [EntityId, ...EntityId[]];\n /**\n * Weapon or wargear IDs added to the model — all of them. Exactly one of `replacement` / `replacement_choice` is present.\n *\n * @minItems 1\n */\n replacement?: [EntityId, ...EntityId[]];\n /**\n * A choice of replacements ('one of the following'): pick exactly one inner group; each group's IDs are all added together. Exactly one of `replacement` / `replacement_choice` is present.\n *\n * @minItems 2\n */\n replacement_choice?: [[EntityId, ...EntityId[]], [EntityId, ...EntityId[]], ...[EntityId, ...EntityId[]][]];\n is_free?: boolean;\n additional_cost?: number | null;\n game_version: GameVersionReference;\n}\n/**\n * A non-weapon item a model may carry — an icon, attachment, or other piece of equipment with no weapon profile. Weapons live in weapon.schema.json; this entity exists so wargear-option swaps and add-ons can reference equipment that is not a weapon.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"wargear\".\n */\nexport interface Wargear {\n id: EntityId;\n name: string;\n category?: string | null;\n game_version: GameVersionReference;\n}\n/**\n * Catalog entry for a weapon keyword (Lethal Hits, Sustained Hits N, Anti-X N+, etc.). Each weapon profile references entries here via {keyword_id, parameters?} instead of carrying free-text strings. The optional `effect` describes the keyword's game mechanic in the Ability DSL; null when the behaviour is faction-specific flavour not yet modelled.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"weapon-keyword\".\n */\nexport interface WeaponKeyword {\n id: EntityId;\n name: string;\n /**\n * Parameter keys that must be supplied at each reference site, in the order they would appear in a printed datasheet (e.g. Anti-INFANTRY 4+ → ['target_keyword', 'threshold']).\n *\n * @maxItems 3\n */\n required_parameters:\n | []\n | [\"value\" | \"target_keyword\" | \"threshold\"]\n | [\"value\" | \"target_keyword\" | \"threshold\", \"value\" | \"target_keyword\" | \"threshold\"]\n | [\n \"value\" | \"target_keyword\" | \"threshold\",\n \"value\" | \"target_keyword\" | \"threshold\",\n \"value\" | \"target_keyword\" | \"threshold\"\n ];\n /**\n * Mechanical effect of this keyword. Null when the behaviour is faction-specific flavour not yet expressible in the DSL — engines treat such references as no-op buffs and may surface them as 'cannot auto-apply'.\n */\n effect: AbilityEffect1 | null;\n game_version: GameVersionReference;\n}\n/**\n * A weapon entry with one or more stat profiles (e.g., standard and overcharge modes).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"weapon\".\n */\nexport interface Weapon {\n id: EntityId;\n name: string;\n type: \"ranged\" | \"melee\";\n /**\n * @minItems 1\n */\n profiles: [\n {\n name: string;\n range?: number | \"Melee\";\n stats: {\n A: StatValue;\n BS?: number | null;\n WS?: number | null;\n S: StatValue;\n AP: number;\n D: StatValue;\n [k: string]: unknown;\n };\n /**\n * References into the weapon-keyword catalog. Each entry names the catalog id and supplies parameter values (e.g. `Sustained Hits 1` → `{keyword_id: 'sustained-hits', parameters: {value: 1}}`).\n */\n keywords?: {\n keyword_id: EntityId;\n /**\n * Reference-site parameters conforming to the catalog entry's required_parameters. Only the three documented keys are accepted; any other key is invalid.\n */\n parameters?: {\n value?: StatValue;\n target_keyword?: string;\n threshold?: number;\n };\n }[];\n },\n ...{\n name: string;\n range?: number | \"Melee\";\n stats: {\n A: StatValue;\n BS?: number | null;\n WS?: number | null;\n S: StatValue;\n AP: number;\n D: StatValue;\n [k: string]: unknown;\n };\n /**\n * References into the weapon-keyword catalog. Each entry names the catalog id and supplies parameter values (e.g. `Sustained Hits 1` → `{keyword_id: 'sustained-hits', parameters: {value: 1}}`).\n */\n keywords?: {\n keyword_id: EntityId;\n /**\n * Reference-site parameters conforming to the catalog entry's required_parameters. Only the three documented keys are accepted; any other key is invalid.\n */\n parameters?: {\n value?: StatValue;\n target_keyword?: string;\n threshold?: number;\n };\n }[];\n }[]\n ];\n game_version: GameVersionReference;\n}\n/**\n * Community-authored structured representation of what a game ability does. NOT GW text.\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"ability\".\n */\nexport interface AbilityDSLEntry {\n ability_id: EntityId;\n name: string;\n authored_by: ContributorRef;\n game_version: GameVersionReference;\n version?: DataslateVersion;\n supersedes?: DataslateVersion | null;\n unit_ids?: EntityId[];\n /**\n * For faction-type abilities, the faction this rule belongs to\n */\n faction_id?: EntityId | null;\n /**\n * For detachment/enhancement/stratagem-type abilities, the associated detachment\n */\n detachment_id?: EntityId | null;\n ability_type?: \"core\" | \"faction\" | \"detachment\" | \"unit\" | \"enhancement\" | \"stratagem\";\n /**\n * How this ability interacts with the game flow — not a runtime predicate\n */\n behavior?: \"passive\" | \"activated\" | \"reactive\" | \"aura\";\n effect: AbilityEffect1;\n scope: AbilityScope;\n interactions?: {\n ability_ref: EntityId;\n type: \"conflicts-with\" | \"combos-with\" | \"superseded-by\" | \"requires\" | \"replaces\";\n notes?: string;\n [k: string]: unknown;\n }[];\n disputed?: boolean;\n dispute_notes?: string;\n community_notes?: string;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"scope\".\n */\nexport interface AbilityScope {\n range:\n | \"self\"\n | \"unit\"\n | \"attached\"\n | \"aura-6\"\n | \"aura-9\"\n | \"aura-12\"\n | \"aura-custom\"\n | \"engagement-range\"\n | \"any-visible\"\n | \"any-on-battlefield\"\n | \"terrain-within-range\";\n duration: \"phase\" | \"turn\" | \"battle-round\" | \"battle\" | \"until-next-command-phase\" | \"one-use\" | \"permanent\";\n range_inches?: number;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"interaction-flag\".\n */\nexport interface InteractionFlag {\n ability_a: EntityId;\n ability_b: EntityId;\n interaction_type: \"conflicts\" | \"combos\" | \"sequencing-dependent\" | \"stacks\" | \"does-not-stack\" | \"replaces\";\n resolution?: string;\n faq_reference?: string;\n disputed?: boolean;\n game_version: GameVersionReference;\n authored_by?: ContributorRef;\n [k: string]: unknown;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"phase-mapping\".\n */\nexport interface PhaseMapping {\n source_id: EntityId;\n source_type: SourceType;\n phases: PhaseList;\n game_version: GameVersionReference;\n authored_by?: ContributorRef;\n [k: string]: unknown;\n}\n/**\n * A faction's resource system (Miracle Dice, Pain tokens, Blessings dice pool, etc.).\n *\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"resource-pool\".\n */\nexport interface ResourcePool {\n id: EntityId;\n name: string;\n faction_id: EntityId;\n pool_type: \"token\" | \"dice-pool\" | \"counter\";\n generation?: {\n condition: AbilityCondition2;\n amount: StatValue;\n [k: string]: unknown;\n }[];\n max_size?: number | null;\n game_version: GameVersionReference;\n}\n/**\n * This interface was referenced by `0KdcBundledSchemas`'s JSON-Schema\n * via the `definition` \"timing-flag\".\n */\nexport interface TimingFlag {\n source_id: EntityId;\n source_type: SourceType;\n timing:\n | \"start-of-phase\"\n | \"end-of-phase\"\n | \"before-hit-roll\"\n | \"after-hit-roll\"\n | \"before-wound-roll\"\n | \"after-wound-roll\"\n | \"before-save-roll\"\n | \"after-save-roll\"\n | \"before-damage-roll\"\n | \"after-damage-roll\"\n | \"before-charge-roll\"\n | \"after-charge-roll\"\n | \"before-advance-roll\"\n | \"after-advance-roll\"\n | \"before-battle-shock\"\n | \"after-battle-shock\"\n | \"on-unit-selected\"\n | \"on-unit-destroyed\"\n | \"on-model-destroyed\"\n | \"on-damage-allocated\";\n game_version: GameVersionReference;\n authored_by?: ContributorRef;\n [k: string]: unknown;\n}\n"]}
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * The schema is rulebook-agnostic, so the actual `Classification` strings come
13
13
  * from whichever Rosterizer rulebook authored the roster. The constants below
14
- * encode the 40K convention used by the consortium's reference rulebook; tune
14
+ * encode the 40K convention used by the 40kdc reference rulebook; tune
15
15
  * them here without touching parser logic if a real export disagrees.
16
16
  *
17
17
  * **IP safety**: the walk reads an ALLOWLIST — `item`, `designation`, `name`,
@@ -1 +1 @@
1
- {"version":3,"file":"rosterizer.js","sourceRoot":"","sources":["../../src/import/rosterizer.ts"],"names":[],"mappings":"AA6BA,+EAA+E;AAC/E,2EAA2E;AAC3E,gDAAgD;AAEhD,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,4CAA4C;AACvE,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAEjE,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,qBAAqB,CAAC;AA+C3C,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAA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CAAC;CACF,CAAC;AAEF,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU;IACV,WAAW;IACX,cAAc;IACd,QAAQ;IACR,UAAU;IACV,eAAe;IACf,eAAe;IACf,SAAS;IACT,WAAW;IACX,gBAAgB;IAChB,SAAS;IACT,WAAW;IACX,OAAO;IACP,gBAAgB;CACjB,CAAC","sourcesContent":["/**\n * Rosterizer adapter: lower a Rosterizer roster JSON payload to a\n * {@link ParsedRoster}.\n *\n * Rosterizer (https://rosterizer.com) stores a roster as a `Roster` envelope\n * with a recursive `Asset` tree under `snapshot` (or `history.present.roster`\n * as a fallback). Every entity — faction, detachment, unit, weapon, ability,\n * enhancement — is an `Asset` keyed by `Classification§Designation` (e.g.\n * `\"Unit§Tactical Squad\"`). Children sit under `assets.included` (game pieces)\n * and `assets.traits` (modifiers, abilities, markers).\n *\n * The schema is rulebook-agnostic, so the actual `Classification` strings come\n * from whichever Rosterizer rulebook authored the roster. The constants below\n * encode the 40K convention used by the consortium's reference rulebook; tune\n * them here without touching parser logic if a real export disagrees.\n *\n * **IP safety**: the walk reads an ALLOWLIST — `item`, `designation`, `name`,\n * `classification`, `quantity`, `meta.points`, `stats.Points.value`,\n * `aspects.Visibility`, and the recursive `assets.included`/`assets.traits`\n * children. Prose-bearing fields — `text`, `description`, `rules`, ability\n * `stats`, `_layers`, `lineage`, `processed`, `classIdentity`, `bareResourceKey`\n * — are never touched, so the importer's output is free of copyrighted prose\n * by construction.\n *\n * @packageDocumentation\n */\nimport type { FormatAdapter } from \"./adapter.js\";\nimport type { ParsedRoster, ParsedUnit, ParsedWargear } from \"./types.js\";\n\n// --- 40K rulebook Classification§Designation conventions. -------------------\n// These pin the strings the adapter looks for. Tune them in one place if a\n// real Rosterizer export uses different labels.\n\nconst CLS_ROSTER = \"Roster\";\nconst CLS_FACTION = \"Faction\";\nconst CLS_DETACHMENT = \"Detachment\";\nconst CLS_UNIT = \"Unit\";\nconst CLS_SQUAD = \"Squad\"; // alternative unit class some rulebooks use\nconst CLS_WEAPON = \"Weapon\";\nconst CLS_ENHANCEMENT = \"Enhancement\";\nconst CLS_BATTLE_SIZE = \"Battle Size\";\nconst CLS_TRAIT = \"Trait\";\nconst DSG_WARLORD = \"Warlord\";\nconst CHAR_CLASSIFICATIONS = new Set([\"Character\", \"Epic Hero\"]);\n\nconst POINTS_STAT_KEYS = [\"Points\", \"Pts\"];\nconst POINTS_LIMIT = /(\\d[\\d,]*)\\s*Point/i;\n\n// --- Structural views ------------------------------------------------------\n\ninterface RawStat {\n value?: unknown;\n}\ninterface RawAspects {\n Visibility?: unknown;\n}\ninterface RawAssetChildren {\n included?: unknown;\n traits?: unknown;\n}\ninterface RawAsset {\n item?: unknown;\n name?: unknown;\n designation?: unknown;\n classification?: unknown;\n quantity?: unknown;\n aspects?: unknown;\n assets?: unknown;\n meta?: unknown;\n stats?: unknown;\n keywords?: unknown;\n}\ninterface RawRulebook {\n name?: unknown;\n game?: unknown;\n publisher?: unknown;\n url?: unknown;\n}\ninterface RawHistoryItem {\n roster?: unknown;\n note?: unknown;\n}\ninterface RawHistory {\n present?: unknown;\n}\ninterface RawEnvelope {\n rulebook?: unknown;\n snapshot?: unknown;\n history?: unknown;\n slug?: unknown;\n authors?: unknown;\n}\n\nfunction asArray(value: unknown): unknown[] {\n return Array.isArray(value) ? value : [];\n}\n\nfunction asObject(value: unknown): Record<string, unknown> | null {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction asString(value: unknown): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction asNumber(value: unknown): number | null {\n if (typeof value === \"number\" && Number.isFinite(value)) return value;\n if (typeof value === \"string\") {\n const n = Number.parseFloat(value);\n return Number.isFinite(n) ? n : null;\n }\n return null;\n}\n\n/** Split `Classification§Designation` into its two halves. Falls back to the\n * raw `classification`/`designation` fields when `item` is absent. */\nfunction splitItem(asset: RawAsset): { classification: string; designation: string } {\n const item = asString(asset.item);\n if (item !== null) {\n const idx = item.indexOf(\"§\"); // §\n if (idx >= 0) {\n return {\n classification: item.slice(0, idx),\n designation: item.slice(idx + 1),\n };\n }\n }\n return {\n classification: asString(asset.classification) ?? \"\",\n designation: asString(asset.designation) ?? \"\",\n };\n}\n\n/** A user-facing display name for an asset: `name` override beats the\n * designation parsed out of the `item` key. */\nfunction displayName(asset: RawAsset): string {\n return asString(asset.name) ?? splitItem(asset).designation;\n}\n\nfunction quantity(asset: RawAsset): number {\n const n = asNumber(asset.quantity);\n return n !== null && n > 0 ? Math.trunc(n) : 1;\n}\n\nfunction included(asset: RawAsset): RawAsset[] {\n const a = asset.assets as RawAssetChildren | undefined;\n return asArray(a?.included) as RawAsset[];\n}\n\nfunction traits(asset: RawAsset): RawAsset[] {\n const a = asset.assets as RawAssetChildren | undefined;\n return asArray(a?.traits) as RawAsset[];\n}\n\n/** Points cost from `stats.Points.value` (or aliases) / `meta.points`, or null. */\nfunction pointsOf(asset: RawAsset): number | null {\n const stats = asObject(asset.stats);\n if (stats) {\n for (const key of POINTS_STAT_KEYS) {\n const stat = asObject(stats[key]) as RawStat | null;\n if (stat) {\n const v = asNumber(stat.value);\n if (v !== null) return Math.trunc(v);\n }\n }\n }\n const meta = asObject(asset.meta);\n if (meta) {\n const v = asNumber(meta.points);\n if (v !== null) return Math.trunc(v);\n }\n return null;\n}\n\n/** Depth-first visit of an asset and every included/trait descendant. */\nfunction walk(asset: RawAsset, visit: (a: RawAsset) => void): void {\n visit(asset);\n for (const child of included(asset)) walk(child, visit);\n for (const child of traits(asset)) walk(child, visit);\n}\n\nfunction classOf(asset: RawAsset): string {\n return splitItem(asset).classification;\n}\n\nfunction isUnitAsset(asset: RawAsset): boolean {\n const cls = classOf(asset);\n return cls === CLS_UNIT || cls === CLS_SQUAD;\n}\n\nfunction isWeaponAsset(asset: RawAsset): boolean {\n const cls = classOf(asset);\n // Match exact \"Weapon\", or any \"<X> Weapon\" classification (e.g. \"Ranged Weapon\").\n return cls === CLS_WEAPON || cls.endsWith(` ${CLS_WEAPON}`);\n}\n\nfunction isEnhancementAsset(asset: RawAsset): boolean {\n return classOf(asset) === CLS_ENHANCEMENT;\n}\n\nfunction isCharacterAsset(asset: RawAsset): boolean {\n const keywords = asObject(asset.keywords);\n if (keywords) {\n for (const list of Object.values(keywords)) {\n for (const kw of asArray(list)) {\n if (typeof kw === \"string\" && CHAR_CLASSIFICATIONS.has(kw)) return true;\n }\n }\n }\n // Any nested trait classified as Character also flags the unit.\n for (const t of traits(asset)) {\n if (CHAR_CLASSIFICATIONS.has(classOf(t))) return true;\n const dsg = displayName(t);\n if (CHAR_CLASSIFICATIONS.has(dsg)) return true;\n }\n return false;\n}\n\nfunction isWarlordTrait(asset: RawAsset): boolean {\n const { classification, designation } = splitItem(asset);\n if (designation === DSG_WARLORD) return true;\n return classification === CLS_TRAIT && designation === DSG_WARLORD;\n}\n\n/** Sum every Weapon/Enhancement-bearing leaf quantity to derive the unit's\n * model count. Falls back to `quantity(unit)` when the tree has no per-model\n * markers (single-model entries). */\nfunction modelCount(unit: RawAsset): number {\n // Rosterizer doesn't carve \"model\" out separately from \"unit\" the way\n // BattleScribe does; the unit's own quantity is the model count for\n // squads. For multi-model squads with explicit per-model children, each\n // child unit-class asset's quantity contributes.\n let nested = 0;\n for (const child of included(unit)) {\n if (isUnitAsset(child)) nested += quantity(child);\n }\n return nested > 0 ? nested : quantity(unit);\n}\n\nfunction parseUnit(unit: RawAsset): ParsedUnit {\n const wargear: ParsedWargear[] = [];\n let enhancement_raw_name: string | null = null;\n let enhancement_points: number | null = null;\n let is_warlord = false;\n\n for (const child of included(unit)) {\n walk(child, (a) => {\n if (isEnhancementAsset(a)) {\n if (enhancement_raw_name === null) {\n enhancement_raw_name = displayName(a);\n enhancement_points = pointsOf(a);\n }\n return;\n }\n if (isWeaponAsset(a)) {\n wargear.push({ raw_name: displayName(a), count: quantity(a) });\n }\n });\n }\n for (const t of traits(unit)) {\n walk(t, (a) => {\n if (isWarlordTrait(a)) is_warlord = true;\n });\n }\n\n return {\n raw_name: displayName(unit),\n is_character: isCharacterAsset(unit),\n model_count: modelCount(unit),\n points: pointsOf(unit),\n is_warlord,\n enhancement_raw_name,\n enhancement_points,\n wargear,\n };\n}\n\n/** Resolve the snapshot Asset tree from an envelope, preferring the explicit\n * `snapshot` field but falling through to the history-present roster. */\nfunction snapshotOf(env: RawEnvelope): RawAsset | null {\n const snap = asObject(env.snapshot);\n if (snap) return snap as RawAsset;\n const history = asObject(env.history) as RawHistory | null;\n const present = history && asObject(history.present);\n if (present) {\n const present_roster = asObject((present as RawHistoryItem).roster);\n if (present_roster) return present_roster as RawAsset;\n }\n return null;\n}\n\nfunction isRosterizerEnvelope(decoded: unknown): decoded is RawEnvelope {\n const env = asObject(decoded) as RawEnvelope | null;\n if (!env) return false;\n if (!asObject(env.rulebook)) return false;\n return snapshotOf(env) !== null;\n}\n\n/** Find the first child Asset with the given classification, if any. */\nfunction findChildByClass(asset: RawAsset, cls: string): RawAsset | null {\n for (const c of included(asset)) {\n if (classOf(c) === cls) return c;\n }\n return null;\n}\n\nfunction parseLimit(label: string | null): number | null {\n if (!label) return null;\n const match = POINTS_LIMIT.exec(label);\n if (!match) return null;\n return Number.parseInt(match[1].replace(/,/g, \"\"), 10);\n}\n\nexport const rosterizerAdapter: FormatAdapter = {\n id: \"rosterizer\",\n\n matches(decoded: unknown): boolean {\n return isRosterizerEnvelope(decoded);\n },\n\n parse(decoded: unknown): ParsedRoster {\n if (!isRosterizerEnvelope(decoded)) {\n throw new Error(\"rosterizer: payload is not a Rosterizer roster envelope\");\n }\n const snapshot = snapshotOf(decoded);\n if (snapshot === null) {\n throw new Error(\"rosterizer: envelope has no snapshot or history.present.roster\");\n }\n\n // Treat the snapshot as the roster root regardless of its `item` value —\n // some exports root at `Roster§Roster`, others at the faction itself.\n const root = snapshot;\n\n // Roster-level metadata children. Faction and detachment come from the\n // first child Asset of their respective classification; battle size the\n // same way. Walk the whole tree (rather than just root.assets.included)\n // so nested-force shapes still pick up the markers.\n let faction_raw_name: string | null = null;\n let detachment_raw_name: string | null = null;\n let battle_size_raw: string | null = null;\n const factions: string[] = [];\n walk(root, (a) => {\n const cls = classOf(a);\n if (cls === CLS_FACTION) {\n const name = displayName(a);\n if (!factions.includes(name)) factions.push(name);\n faction_raw_name ??= name;\n } else if (cls === CLS_DETACHMENT) {\n detachment_raw_name ??= displayName(a);\n } else if (cls === CLS_BATTLE_SIZE) {\n battle_size_raw ??= displayName(a);\n }\n });\n\n // Allow the rulebook envelope to carry a battle-size override (e.g.\n // `rulebook.notes: \"2000 Point limit\"`) — strictly optional.\n if (battle_size_raw === null) {\n const rulebook = asObject((decoded as RawEnvelope).rulebook) as RawRulebook | null;\n // Intentionally not reading rulebook.notes — it may carry prose.\n void rulebook;\n }\n\n // Collect units: any Unit/Squad asset anywhere in the tree, excluding\n // ones nested under another unit (those are attached leaders we'll fold\n // into leader_attachment via the resolver — but ParsedUnit doesn't model\n // them yet, so for v1 every Unit asset becomes a top-level ParsedUnit).\n const units: ParsedUnit[] = [];\n const collectUnits = (a: RawAsset, underUnit: boolean): void => {\n if (isUnitAsset(a) && !underUnit) {\n units.push(parseUnit(a));\n for (const c of included(a)) collectUnits(c, true);\n for (const c of traits(a)) collectUnits(c, true);\n return;\n }\n if (isUnitAsset(a) && underUnit) {\n // Nested unit (leader on a body, body on a leader, etc.) — emit it as\n // its own top-level ParsedUnit so the resolver can match its id and\n // the leader-attachment inference pass can link the two.\n units.push(parseUnit(a));\n return;\n }\n for (const c of included(a)) collectUnits(c, underUnit);\n for (const c of traits(a)) collectUnits(c, underUnit);\n };\n collectUnits(root, false);\n\n // Roster-level total: prefer an explicit Points stat on the root, else\n // sum every unit's (base + enhancement) contribution.\n const total_reported = pointsOf(root);\n let total_computed = 0;\n for (const u of units) {\n total_computed += u.points ?? 0;\n total_computed += u.enhancement_points ?? 0;\n }\n\n const env = decoded as RawEnvelope;\n const rulebook = asObject(env.rulebook) as RawRulebook | null;\n const generated_by = rulebook ? asString(rulebook.name) ?? asString(rulebook.url) : null;\n const name = displayName(root) || asString(rulebook?.name) || \"Imported roster\";\n\n return {\n name,\n generated_by,\n faction_raw_name,\n detachment_raw_name,\n battle_size_raw,\n declared_limit: parseLimit(battle_size_raw),\n total_reported,\n total_computed,\n units,\n multi_force: factions.length > 1,\n };\n },\n};\n\n// Internals re-exported for the symmetric exporter and unit tests.\nexport const _internals = {\n CLS_ROSTER,\n CLS_FACTION,\n CLS_DETACHMENT,\n CLS_UNIT,\n CLS_WEAPON,\n CLS_ENHANCEMENT,\n CLS_BATTLE_SIZE,\n CLS_TRAIT,\n DSG_WARLORD,\n POINTS_STAT_KEYS,\n splitItem,\n displayName,\n classOf,\n findChildByClass,\n};\n"]}
1
+ {"version":3,"file":"rosterizer.js","sourceRoot":"","sources":["../../src/import/rosterizer.ts"],"names":[],"mappings":"AA6BA,+EAA+E;AAC/E,2EAA2E;AAC3E,gDAAgD;AAEhD,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,4CAA4C;AACvE,MAAM,UAAU,GAAG,QAAQ,CAAC;AAC5B,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AAEjE,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,qBAAqB,CAAC;AA+C3C,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,C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AAgB;YAChB,mBAAmB;YACnB,eAAe;YACf,cAAc,EAAE,UAAU,CAAC,eAAe,CAAC;YAC3C,cAAc;YACd,cAAc;YACd,KAAK;YACL,WAAW,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;SACjC,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU;IACV,WAAW;IACX,cAAc;IACd,QAAQ;IACR,UAAU;IACV,eAAe;IACf,eAAe;IACf,SAAS;IACT,WAAW;IACX,gBAAgB;IAChB,SAAS;IACT,WAAW;IACX,OAAO;IACP,gBAAgB;CACjB,CAAC","sourcesContent":["/**\n * Rosterizer adapter: lower a Rosterizer roster JSON payload to a\n * {@link ParsedRoster}.\n *\n * Rosterizer (https://rosterizer.com) stores a roster as a `Roster` envelope\n * with a recursive `Asset` tree under `snapshot` (or `history.present.roster`\n * as a fallback). Every entity — faction, detachment, unit, weapon, ability,\n * enhancement — is an `Asset` keyed by `Classification§Designation` (e.g.\n * `\"Unit§Tactical Squad\"`). Children sit under `assets.included` (game pieces)\n * and `assets.traits` (modifiers, abilities, markers).\n *\n * The schema is rulebook-agnostic, so the actual `Classification` strings come\n * from whichever Rosterizer rulebook authored the roster. The constants below\n * encode the 40K convention used by the 40kdc reference rulebook; tune\n * them here without touching parser logic if a real export disagrees.\n *\n * **IP safety**: the walk reads an ALLOWLIST — `item`, `designation`, `name`,\n * `classification`, `quantity`, `meta.points`, `stats.Points.value`,\n * `aspects.Visibility`, and the recursive `assets.included`/`assets.traits`\n * children. Prose-bearing fields — `text`, `description`, `rules`, ability\n * `stats`, `_layers`, `lineage`, `processed`, `classIdentity`, `bareResourceKey`\n * — are never touched, so the importer's output is free of copyrighted prose\n * by construction.\n *\n * @packageDocumentation\n */\nimport type { FormatAdapter } from \"./adapter.js\";\nimport type { ParsedRoster, ParsedUnit, ParsedWargear } from \"./types.js\";\n\n// --- 40K rulebook Classification§Designation conventions. -------------------\n// These pin the strings the adapter looks for. Tune them in one place if a\n// real Rosterizer export uses different labels.\n\nconst CLS_ROSTER = \"Roster\";\nconst CLS_FACTION = \"Faction\";\nconst CLS_DETACHMENT = \"Detachment\";\nconst CLS_UNIT = \"Unit\";\nconst CLS_SQUAD = \"Squad\"; // alternative unit class some rulebooks use\nconst CLS_WEAPON = \"Weapon\";\nconst CLS_ENHANCEMENT = \"Enhancement\";\nconst CLS_BATTLE_SIZE = \"Battle Size\";\nconst CLS_TRAIT = \"Trait\";\nconst DSG_WARLORD = \"Warlord\";\nconst CHAR_CLASSIFICATIONS = new Set([\"Character\", \"Epic Hero\"]);\n\nconst POINTS_STAT_KEYS = [\"Points\", \"Pts\"];\nconst POINTS_LIMIT = /(\\d[\\d,]*)\\s*Point/i;\n\n// --- Structural views ------------------------------------------------------\n\ninterface RawStat {\n value?: unknown;\n}\ninterface RawAspects {\n Visibility?: unknown;\n}\ninterface RawAssetChildren {\n included?: unknown;\n traits?: unknown;\n}\ninterface RawAsset {\n item?: unknown;\n name?: unknown;\n designation?: unknown;\n classification?: unknown;\n quantity?: unknown;\n aspects?: unknown;\n assets?: unknown;\n meta?: unknown;\n stats?: unknown;\n keywords?: unknown;\n}\ninterface RawRulebook {\n name?: unknown;\n game?: unknown;\n publisher?: unknown;\n url?: unknown;\n}\ninterface RawHistoryItem {\n roster?: unknown;\n note?: unknown;\n}\ninterface RawHistory {\n present?: unknown;\n}\ninterface RawEnvelope {\n rulebook?: unknown;\n snapshot?: unknown;\n history?: unknown;\n slug?: unknown;\n authors?: unknown;\n}\n\nfunction asArray(value: unknown): unknown[] {\n return Array.isArray(value) ? value : [];\n}\n\nfunction asObject(value: unknown): Record<string, unknown> | null {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction asString(value: unknown): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\nfunction asNumber(value: unknown): number | null {\n if (typeof value === \"number\" && Number.isFinite(value)) return value;\n if (typeof value === \"string\") {\n const n = Number.parseFloat(value);\n return Number.isFinite(n) ? n : null;\n }\n return null;\n}\n\n/** Split `Classification§Designation` into its two halves. Falls back to the\n * raw `classification`/`designation` fields when `item` is absent. */\nfunction splitItem(asset: RawAsset): { classification: string; designation: string } {\n const item = asString(asset.item);\n if (item !== null) {\n const idx = item.indexOf(\"§\"); // §\n if (idx >= 0) {\n return {\n classification: item.slice(0, idx),\n designation: item.slice(idx + 1),\n };\n }\n }\n return {\n classification: asString(asset.classification) ?? \"\",\n designation: asString(asset.designation) ?? \"\",\n };\n}\n\n/** A user-facing display name for an asset: `name` override beats the\n * designation parsed out of the `item` key. */\nfunction displayName(asset: RawAsset): string {\n return asString(asset.name) ?? splitItem(asset).designation;\n}\n\nfunction quantity(asset: RawAsset): number {\n const n = asNumber(asset.quantity);\n return n !== null && n > 0 ? Math.trunc(n) : 1;\n}\n\nfunction included(asset: RawAsset): RawAsset[] {\n const a = asset.assets as RawAssetChildren | undefined;\n return asArray(a?.included) as RawAsset[];\n}\n\nfunction traits(asset: RawAsset): RawAsset[] {\n const a = asset.assets as RawAssetChildren | undefined;\n return asArray(a?.traits) as RawAsset[];\n}\n\n/** Points cost from `stats.Points.value` (or aliases) / `meta.points`, or null. */\nfunction pointsOf(asset: RawAsset): number | null {\n const stats = asObject(asset.stats);\n if (stats) {\n for (const key of POINTS_STAT_KEYS) {\n const stat = asObject(stats[key]) as RawStat | null;\n if (stat) {\n const v = asNumber(stat.value);\n if (v !== null) return Math.trunc(v);\n }\n }\n }\n const meta = asObject(asset.meta);\n if (meta) {\n const v = asNumber(meta.points);\n if (v !== null) return Math.trunc(v);\n }\n return null;\n}\n\n/** Depth-first visit of an asset and every included/trait descendant. */\nfunction walk(asset: RawAsset, visit: (a: RawAsset) => void): void {\n visit(asset);\n for (const child of included(asset)) walk(child, visit);\n for (const child of traits(asset)) walk(child, visit);\n}\n\nfunction classOf(asset: RawAsset): string {\n return splitItem(asset).classification;\n}\n\nfunction isUnitAsset(asset: RawAsset): boolean {\n const cls = classOf(asset);\n return cls === CLS_UNIT || cls === CLS_SQUAD;\n}\n\nfunction isWeaponAsset(asset: RawAsset): boolean {\n const cls = classOf(asset);\n // Match exact \"Weapon\", or any \"<X> Weapon\" classification (e.g. \"Ranged Weapon\").\n return cls === CLS_WEAPON || cls.endsWith(` ${CLS_WEAPON}`);\n}\n\nfunction isEnhancementAsset(asset: RawAsset): boolean {\n return classOf(asset) === CLS_ENHANCEMENT;\n}\n\nfunction isCharacterAsset(asset: RawAsset): boolean {\n const keywords = asObject(asset.keywords);\n if (keywords) {\n for (const list of Object.values(keywords)) {\n for (const kw of asArray(list)) {\n if (typeof kw === \"string\" && CHAR_CLASSIFICATIONS.has(kw)) return true;\n }\n }\n }\n // Any nested trait classified as Character also flags the unit.\n for (const t of traits(asset)) {\n if (CHAR_CLASSIFICATIONS.has(classOf(t))) return true;\n const dsg = displayName(t);\n if (CHAR_CLASSIFICATIONS.has(dsg)) return true;\n }\n return false;\n}\n\nfunction isWarlordTrait(asset: RawAsset): boolean {\n const { classification, designation } = splitItem(asset);\n if (designation === DSG_WARLORD) return true;\n return classification === CLS_TRAIT && designation === DSG_WARLORD;\n}\n\n/** Sum every Weapon/Enhancement-bearing leaf quantity to derive the unit's\n * model count. Falls back to `quantity(unit)` when the tree has no per-model\n * markers (single-model entries). */\nfunction modelCount(unit: RawAsset): number {\n // Rosterizer doesn't carve \"model\" out separately from \"unit\" the way\n // BattleScribe does; the unit's own quantity is the model count for\n // squads. For multi-model squads with explicit per-model children, each\n // child unit-class asset's quantity contributes.\n let nested = 0;\n for (const child of included(unit)) {\n if (isUnitAsset(child)) nested += quantity(child);\n }\n return nested > 0 ? nested : quantity(unit);\n}\n\nfunction parseUnit(unit: RawAsset): ParsedUnit {\n const wargear: ParsedWargear[] = [];\n let enhancement_raw_name: string | null = null;\n let enhancement_points: number | null = null;\n let is_warlord = false;\n\n for (const child of included(unit)) {\n walk(child, (a) => {\n if (isEnhancementAsset(a)) {\n if (enhancement_raw_name === null) {\n enhancement_raw_name = displayName(a);\n enhancement_points = pointsOf(a);\n }\n return;\n }\n if (isWeaponAsset(a)) {\n wargear.push({ raw_name: displayName(a), count: quantity(a) });\n }\n });\n }\n for (const t of traits(unit)) {\n walk(t, (a) => {\n if (isWarlordTrait(a)) is_warlord = true;\n });\n }\n\n return {\n raw_name: displayName(unit),\n is_character: isCharacterAsset(unit),\n model_count: modelCount(unit),\n points: pointsOf(unit),\n is_warlord,\n enhancement_raw_name,\n enhancement_points,\n wargear,\n };\n}\n\n/** Resolve the snapshot Asset tree from an envelope, preferring the explicit\n * `snapshot` field but falling through to the history-present roster. */\nfunction snapshotOf(env: RawEnvelope): RawAsset | null {\n const snap = asObject(env.snapshot);\n if (snap) return snap as RawAsset;\n const history = asObject(env.history) as RawHistory | null;\n const present = history && asObject(history.present);\n if (present) {\n const present_roster = asObject((present as RawHistoryItem).roster);\n if (present_roster) return present_roster as RawAsset;\n }\n return null;\n}\n\nfunction isRosterizerEnvelope(decoded: unknown): decoded is RawEnvelope {\n const env = asObject(decoded) as RawEnvelope | null;\n if (!env) return false;\n if (!asObject(env.rulebook)) return false;\n return snapshotOf(env) !== null;\n}\n\n/** Find the first child Asset with the given classification, if any. */\nfunction findChildByClass(asset: RawAsset, cls: string): RawAsset | null {\n for (const c of included(asset)) {\n if (classOf(c) === cls) return c;\n }\n return null;\n}\n\nfunction parseLimit(label: string | null): number | null {\n if (!label) return null;\n const match = POINTS_LIMIT.exec(label);\n if (!match) return null;\n return Number.parseInt(match[1].replace(/,/g, \"\"), 10);\n}\n\nexport const rosterizerAdapter: FormatAdapter = {\n id: \"rosterizer\",\n\n matches(decoded: unknown): boolean {\n return isRosterizerEnvelope(decoded);\n },\n\n parse(decoded: unknown): ParsedRoster {\n if (!isRosterizerEnvelope(decoded)) {\n throw new Error(\"rosterizer: payload is not a Rosterizer roster envelope\");\n }\n const snapshot = snapshotOf(decoded);\n if (snapshot === null) {\n throw new Error(\"rosterizer: envelope has no snapshot or history.present.roster\");\n }\n\n // Treat the snapshot as the roster root regardless of its `item` value —\n // some exports root at `Roster§Roster`, others at the faction itself.\n const root = snapshot;\n\n // Roster-level metadata children. Faction and detachment come from the\n // first child Asset of their respective classification; battle size the\n // same way. Walk the whole tree (rather than just root.assets.included)\n // so nested-force shapes still pick up the markers.\n let faction_raw_name: string | null = null;\n let detachment_raw_name: string | null = null;\n let battle_size_raw: string | null = null;\n const factions: string[] = [];\n walk(root, (a) => {\n const cls = classOf(a);\n if (cls === CLS_FACTION) {\n const name = displayName(a);\n if (!factions.includes(name)) factions.push(name);\n faction_raw_name ??= name;\n } else if (cls === CLS_DETACHMENT) {\n detachment_raw_name ??= displayName(a);\n } else if (cls === CLS_BATTLE_SIZE) {\n battle_size_raw ??= displayName(a);\n }\n });\n\n // Allow the rulebook envelope to carry a battle-size override (e.g.\n // `rulebook.notes: \"2000 Point limit\"`) — strictly optional.\n if (battle_size_raw === null) {\n const rulebook = asObject((decoded as RawEnvelope).rulebook) as RawRulebook | null;\n // Intentionally not reading rulebook.notes — it may carry prose.\n void rulebook;\n }\n\n // Collect units: any Unit/Squad asset anywhere in the tree, excluding\n // ones nested under another unit (those are attached leaders we'll fold\n // into leader_attachment via the resolver — but ParsedUnit doesn't model\n // them yet, so for v1 every Unit asset becomes a top-level ParsedUnit).\n const units: ParsedUnit[] = [];\n const collectUnits = (a: RawAsset, underUnit: boolean): void => {\n if (isUnitAsset(a) && !underUnit) {\n units.push(parseUnit(a));\n for (const c of included(a)) collectUnits(c, true);\n for (const c of traits(a)) collectUnits(c, true);\n return;\n }\n if (isUnitAsset(a) && underUnit) {\n // Nested unit (leader on a body, body on a leader, etc.) — emit it as\n // its own top-level ParsedUnit so the resolver can match its id and\n // the leader-attachment inference pass can link the two.\n units.push(parseUnit(a));\n return;\n }\n for (const c of included(a)) collectUnits(c, underUnit);\n for (const c of traits(a)) collectUnits(c, underUnit);\n };\n collectUnits(root, false);\n\n // Roster-level total: prefer an explicit Points stat on the root, else\n // sum every unit's (base + enhancement) contribution.\n const total_reported = pointsOf(root);\n let total_computed = 0;\n for (const u of units) {\n total_computed += u.points ?? 0;\n total_computed += u.enhancement_points ?? 0;\n }\n\n const env = decoded as RawEnvelope;\n const rulebook = asObject(env.rulebook) as RawRulebook | null;\n const generated_by = rulebook ? asString(rulebook.name) ?? asString(rulebook.url) : null;\n const name = displayName(root) || asString(rulebook?.name) || \"Imported roster\";\n\n return {\n name,\n generated_by,\n faction_raw_name,\n detachment_raw_name,\n battle_size_raw,\n declared_limit: parseLimit(battle_size_raw),\n total_reported,\n total_computed,\n units,\n multi_force: factions.length > 1,\n };\n },\n};\n\n// Internals re-exported for the symmetric exporter and unit tests.\nexport const _internals = {\n CLS_ROSTER,\n CLS_FACTION,\n CLS_DETACHMENT,\n CLS_UNIT,\n CLS_WEAPON,\n CLS_ENHANCEMENT,\n CLS_BATTLE_SIZE,\n CLS_TRAIT,\n DSG_WARLORD,\n POINTS_STAT_KEYS,\n splitItem,\n displayName,\n classOf,\n findChildByClass,\n};\n"]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./data/index.js";
2
2
  export * from "./generated.js";
3
3
  export * from "./translate/index.js";
4
+ export type { ScoringTrigger } from "./generated.js";
4
5
  export { resolveLayout, polygonCentroid, footprintVertices, orientedOffsets, TerrainResolveError, solveCentroid, TerrainSolveError, } from "./terrain/index.js";
5
6
  export type { ResolvedPiece, ResolvedVec2, BoardEdge, FeatureRef, DimensionLine, SolveInput, } from "./terrain/index.js";
6
7
  export * from "./scoring/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAGhC,cAAc,gBAAgB,CAAC;AAI/B,cAAc,sBAAsB,CAAC;AAKrC,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,iBA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T,UAAU,EACV,aAAa,EACb,UAAU,GACX,MAAM,oBAAoB,CAAC;AAK5B,cAAc,oBAAoB,CAAC;AAInC,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,YAAY,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,MAAM,EACN,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,SAAS,EACT,WAAW,EACX,OAAO,EACP,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,mBAAmB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,cAAc,iBAAiB,CAAC;AAEhC,mDAAmD;AACnD,cAAc,gBAAgB,CAAC;AAE/B,0EAA0E;AAC1E,6EAA6E;AAC7E,cAAc,sBAAsB,CAAC;AAErC,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAU5B,6EAA6E;AAC7E,4EAA4E;AAC5E,qCAAqC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,8EAA8E;AAC9E,uCAAuC;AACvC,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,4EAA4E;AAC5E,+EAA+E;AAC/E,uCAAuC;AACvC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC","sourcesContent":["// The linked, typed dataset — the primary entry point.\nexport * from \"./data/index.js\";\n\n// Generated types for every entity in the dataset.\nexport * from \"./generated.js\";\n\n// Plain-English translation of structured data (scoring-card awards + the\n// shared Ability-DSL condition humanizer). Cross-impl pinned by conformance.\nexport * from \"./translate/index.js\";\n\n// Terrain geometry resolver (template-anchored layout → board-space vertices).\n// Curated (not wildcard) so its internal type aliases don't clash with the\n// generated Footprint/TerrainTemplate/TerrainLayout types. Cross-impl pinned.\nexport {\n resolveLayout,\n polygonCentroid,\n footprintVertices,\n orientedOffsets,\n TerrainResolveError,\n solveCentroid,\n TerrainSolveError,\n} from \"./terrain/index.js\";\nexport type {\n ResolvedPiece,\n ResolvedVec2,\n BoardEdge,\n FeatureRef,\n DimensionLine,\n SolveInput,\n} from \"./terrain/index.js\";\n\n// Card-driven secondary-mission scoring: compute VP from asserted awards and\n// track per-round, per-player scoring. TypeScript-only for now (Rust port +\n// conformance area are a follow-up).\nexport * from \"./scoring/index.js\";\n\n// Schema access + AJV validation (secondary: this package also validates data\n// against the canonical JSON Schemas).\nexport {\n createValidator,\n findSchemaFiles,\n listSchemaIds,\n SCHEMAS_ROOT,\n} from \"./schema-loader.js\";\n\n// Army-list importer (ListForge → resolved 40kdc roster). Types are curated\n// rather than re-exported wholesale to avoid name clashes with generated types\n// (e.g. BattleSize, LeaderAttachment).\nexport {\n importListForge,\n importNewRecruit,\n importRoster,\n tryImportRoster,\n decodeListForge,\n} from \"./import/index.js\";\n\n// Army-list exporter (Roster → text or JSON for any of the supported formats).\nexport {\n exportRoster,\n newRecruitJsonSerializer,\n newRecruitSimpleSerializer,\n newRecruitWtcCompactSerializer,\n newRecruitWtcFullSerializer,\n rosterJsonSerializer,\n rosterizerSerializer,\n} from \"./export/index.js\";\nexport type { ExportFormat, RosterSerializer } from \"./export/index.js\";\nexport type { FormatAdapter } from \"./import/index.js\";\nexport type {\n ImportOptions,\n ImportResult,\n ImportFailureReason,\n AdapterTrial,\n Roster,\n RosterUnit,\n RosterWargear,\n RosterSource,\n RosterFormat,\n RosterPoints,\n RosterLeaderAttachment,\n ResolvedRef,\n Candidate,\n Diagnostics,\n Warning,\n WarningCode,\n ParsedRoster,\n ParsedUnit,\n ParsedWargear,\n} from \"./import/index.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,cAAc,iBAAiB,CAAC;AAEhC,mDAAmD;AACnD,cAAc,gBAAgB,CAAC;AAE/B,0EAA0E;AAC1E,6EAA6E;AAC7E,cAAc,sBAAsB,CAAC;AAOrC,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAU5B,6EAA6E;AAC7E,4EAA4E;AAC5E,qCAAqC;AACrC,cAAc,oBAAoB,CAAC;AAEnC,8EAA8E;AAC9E,uCAAuC;AACvC,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,4EAA4E;AAC5E,+EAA+E;AAC/E,uCAAuC;AACvC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC","sourcesContent":["// The linked, typed dataset — the primary entry point.\nexport * from \"./data/index.js\";\n\n// Generated types for every entity in the dataset.\nexport * from \"./generated.js\";\n\n// Plain-English translation of structured data (scoring-card awards + the\n// shared Ability-DSL condition humanizer). Cross-impl pinned by conformance.\nexport * from \"./translate/index.js\";\n\n// `ScoringTrigger` is emitted by both ./generated.js (schema-derived) and\n// ./translate (hand-authored). They are structurally identical; disambiguate the\n// two wildcard re-exports in favour of the generated, schema-canonical type.\nexport type { ScoringTrigger } from \"./generated.js\";\n\n// Terrain geometry resolver (template-anchored layout → board-space vertices).\n// Curated (not wildcard) so its internal type aliases don't clash with the\n// generated Footprint/TerrainTemplate/TerrainLayout types. Cross-impl pinned.\nexport {\n resolveLayout,\n polygonCentroid,\n footprintVertices,\n orientedOffsets,\n TerrainResolveError,\n solveCentroid,\n TerrainSolveError,\n} from \"./terrain/index.js\";\nexport type {\n ResolvedPiece,\n ResolvedVec2,\n BoardEdge,\n FeatureRef,\n DimensionLine,\n SolveInput,\n} from \"./terrain/index.js\";\n\n// Card-driven secondary-mission scoring: compute VP from asserted awards and\n// track per-round, per-player scoring. TypeScript-only for now (Rust port +\n// conformance area are a follow-up).\nexport * from \"./scoring/index.js\";\n\n// Schema access + AJV validation (secondary: this package also validates data\n// against the canonical JSON Schemas).\nexport {\n createValidator,\n findSchemaFiles,\n listSchemaIds,\n SCHEMAS_ROOT,\n} from \"./schema-loader.js\";\n\n// Army-list importer (ListForge → resolved 40kdc roster). Types are curated\n// rather than re-exported wholesale to avoid name clashes with generated types\n// (e.g. BattleSize, LeaderAttachment).\nexport {\n importListForge,\n importNewRecruit,\n importRoster,\n tryImportRoster,\n decodeListForge,\n} from \"./import/index.js\";\n\n// Army-list exporter (Roster → text or JSON for any of the supported formats).\nexport {\n exportRoster,\n newRecruitJsonSerializer,\n newRecruitSimpleSerializer,\n newRecruitWtcCompactSerializer,\n newRecruitWtcFullSerializer,\n rosterJsonSerializer,\n rosterizerSerializer,\n} from \"./export/index.js\";\nexport type { ExportFormat, RosterSerializer } from \"./export/index.js\";\nexport type { FormatAdapter } from \"./import/index.js\";\nexport type {\n ImportOptions,\n ImportResult,\n ImportFailureReason,\n AdapterTrial,\n Roster,\n RosterUnit,\n RosterWargear,\n RosterSource,\n RosterFormat,\n RosterPoints,\n RosterLeaderAttachment,\n ResolvedRef,\n Candidate,\n Diagnostics,\n Warning,\n WarningCode,\n ParsedRoster,\n ParsedUnit,\n ParsedWargear,\n} from \"./import/index.js\";\n"]}
package/dist/runner.d.ts CHANGED
@@ -20,6 +20,22 @@ export interface RunnerState {
20
20
  validator?: Ajv;
21
21
  }
22
22
  export declare function createRunnerState(): RunnerState;
23
+ /**
24
+ * Canonical string encoding of a base size for cross-impl comparison (mirrors the
25
+ * string-encoding used by `maximal_loadout`). Returns null for an absent base.
26
+ * round 32 → "round:32"
27
+ * oval 75×42 → "oval:75x42"
28
+ * small flyer → "flying-base:small:draft"
29
+ * hull (draft) → "hull:draft"
30
+ */
31
+ export declare function encodeBase(b: {
32
+ shape: string;
33
+ diameter?: number;
34
+ width?: number;
35
+ length?: number;
36
+ size?: string;
37
+ draft?: boolean;
38
+ } | null | undefined): string | null;
23
39
  /**
24
40
  * Apply one decoded request to the runner state and return the response. Used
25
41
  * directly by tests; the CLI loop wraps it with line parsing.
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":";AAsBA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAU5C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AA8C3B,MAAM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;AAElE,QAAA,MAAM,WAAW,oJASP,CAAC;AACX,KAAK,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAgB9C,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,GAAG,CAAC;CACjB;AAED,wBAAgB,iBAAiB,IAAI,WAAW,CAE/C;AAmID;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,CAAC,EACG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACrG,IAAI,GACJ,SAAS,GACZ,MAAM,GAAG,IAAI,CAQf;AAoSD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,cAAc,CAkChG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAc9E"}
package/dist/runner.js CHANGED
@@ -21,6 +21,7 @@ import { fileURLToPath } from "node:url";
21
21
  import process from "node:process";
22
22
  import { Dataset } from "./data/dataset.js";
23
23
  import { normalizeName } from "./data/normalize.js";
24
+ import { maximalLoadout } from "./data/loadout.js";
24
25
  import { exportRoster } from "./export/index.js";
25
26
  import { importRoster, tryImportRoster } from "./import/import-roster.js";
26
27
  import { createValidator } from "./schema-loader.js";
@@ -211,6 +212,28 @@ function handleExport(args) {
211
212
  return err("EXPORT_FAILED", { detail: e.message });
212
213
  }
213
214
  }
215
+ /**
216
+ * Canonical string encoding of a base size for cross-impl comparison (mirrors the
217
+ * string-encoding used by `maximal_loadout`). Returns null for an absent base.
218
+ * round 32 → "round:32"
219
+ * oval 75×42 → "oval:75x42"
220
+ * small flyer → "flying-base:small:draft"
221
+ * hull (draft) → "hull:draft"
222
+ */
223
+ export function encodeBase(b) {
224
+ if (!b)
225
+ return null;
226
+ const parts = [b.shape];
227
+ if (b.shape === "round" && b.diameter != null)
228
+ parts.push(String(b.diameter));
229
+ else if (b.shape === "oval" && b.width != null && b.length != null)
230
+ parts.push(`${b.width}x${b.length}`);
231
+ else if (b.shape === "flying-base" && b.size)
232
+ parts.push(b.size);
233
+ if (b.draft)
234
+ parts.push("draft");
235
+ return parts.join(":");
236
+ }
214
237
  function handleLinkedQuery(state, args) {
215
238
  if (typeof args !== "object" || args === null) {
216
239
  return err("INVALID_INPUT", { detail: "linked_query args must be an object" });
@@ -243,6 +266,21 @@ function handleLinkedQuery(state, args) {
243
266
  return err("UNKNOWN_ENTITY", { kind: "unit", id: input.unitId });
244
267
  return ok(u.weapons.map((x) => x.id));
245
268
  }
269
+ case "wargear_options_of": {
270
+ const u = ds.units.get(input.unitId);
271
+ if (!u)
272
+ return err("UNKNOWN_ENTITY", { kind: "unit", id: input.unitId });
273
+ return ok(u.wargearOptions.map((x) => x.id));
274
+ }
275
+ case "maximal_loadout": {
276
+ const u = ds.units.get(input.unitId);
277
+ if (!u)
278
+ return err("UNKNOWN_ENTITY", { kind: "unit", id: input.unitId });
279
+ const modelCount = Number(input.modelCount);
280
+ const lo = maximalLoadout(u.raw, modelCount, ds.wargearOptionsOf(u.raw));
281
+ // Encode the id→count map as sorted "id:count" strings for set compare.
282
+ return ok([...lo.counts].map(([id, n]) => `${id}:${n}`).sort());
283
+ }
246
284
  case "phases_of": {
247
285
  const ab = ds.abilities.get(input.abilityId);
248
286
  if (!ab)
@@ -255,6 +293,20 @@ function handleLinkedQuery(state, args) {
255
293
  return err("UNKNOWN_ENTITY", { kind: "unit", id: input.unitId });
256
294
  return ok(u.faction?.id ?? null);
257
295
  }
296
+ case "base_size_of": {
297
+ const u = ds.units.get(input.unitId);
298
+ if (!u)
299
+ return err("UNKNOWN_ENTITY", { kind: "unit", id: input.unitId });
300
+ return ok(encodeBase(u.raw.base_size_mm));
301
+ }
302
+ case "model_bases_of": {
303
+ const u = ds.units.get(input.unitId);
304
+ if (!u)
305
+ return err("UNKNOWN_ENTITY", { kind: "unit", id: input.unitId });
306
+ const comp = ds.unitCompositions.find((c) => c.unit_id === input.unitId);
307
+ // Ordered "modelName=encodedBase" pairs in declared model order.
308
+ return ok((comp?.models ?? []).map((m) => `${m.name}=${encodeBase(m.base_size_mm) ?? "none"}`));
309
+ }
258
310
  case "abilities_of_faction":
259
311
  return ok(ds.abilities.byFaction(input.factionId).map((x) => x.id));
260
312
  case "weapons_of_faction": {
@@ -276,6 +328,8 @@ const VALIDATOR_TARGETS = {
276
328
  weapon: "https://40kdc.dev/schemas/core/weapon.schema.json",
277
329
  faction: "https://40kdc.dev/schemas/core/faction.schema.json",
278
330
  ability: "https://40kdc.dev/schemas/enrichment/ability-dsl/ability.schema.json",
331
+ wargear: "https://40kdc.dev/schemas/core/wargear.schema.json",
332
+ "wargear-option": "https://40kdc.dev/schemas/core/wargear-option.schema.json",
279
333
  };
280
334
  function ajvKeywordToCode(keyword) {
281
335
  switch (keyword) {