@its-not-rocket-science/ananke 0.1.69 → 0.5.4

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 (165) hide show
  1. package/CHANGELOG.md +288 -0
  2. package/README.md +150 -432
  3. package/STABLE_API.md +113 -490
  4. package/conformance/README.md +46 -44
  5. package/conformance/lockstep-sequence.json +395 -395
  6. package/conformance/phase-order.json +21 -0
  7. package/conformance/replay-parity.json +65 -65
  8. package/conformance/state-hash-regression.json +39 -0
  9. package/conformance/state-hash.json +23 -22
  10. package/dist/src/conformance.d.ts +8 -2
  11. package/dist/src/content/index.d.ts +3 -0
  12. package/dist/src/content/index.js +2 -0
  13. package/dist/src/content/injector.d.ts +19 -0
  14. package/dist/src/content/injector.js +61 -0
  15. package/dist/src/content/loader.d.ts +3 -0
  16. package/dist/src/content/loader.js +170 -0
  17. package/dist/src/content/types.d.ts +56 -0
  18. package/dist/src/content/types.js +1 -0
  19. package/dist/src/content/validator.d.ts +6 -0
  20. package/dist/src/content/validator.js +14 -0
  21. package/dist/src/content-pack.d.ts +3 -2
  22. package/dist/src/content-pack.js +205 -10
  23. package/dist/src/data-governance.d.ts +73 -0
  24. package/dist/src/data-governance.js +188 -0
  25. package/dist/src/debug.d.ts +6 -0
  26. package/dist/src/debug.js +9 -0
  27. package/dist/src/determinism.d.ts +12 -0
  28. package/dist/src/determinism.js +93 -0
  29. package/dist/src/dialogue.d.ts +41 -0
  30. package/dist/src/dialogue.js +113 -2
  31. package/dist/src/economy.d.ts +97 -3
  32. package/dist/src/economy.js +191 -37
  33. package/dist/src/history/autosave.d.ts +19 -0
  34. package/dist/src/history/autosave.js +98 -0
  35. package/dist/src/history/timetravel.d.ts +28 -0
  36. package/dist/src/history/timetravel.js +61 -0
  37. package/dist/src/index.d.ts +19 -31
  38. package/dist/src/index.js +20 -38
  39. package/dist/src/model3d.js +63 -2
  40. package/dist/src/narrative/combat-logger.d.ts +25 -0
  41. package/dist/src/narrative/combat-logger.js +97 -0
  42. package/dist/src/narrative/plausibility.d.ts +30 -0
  43. package/dist/src/narrative/plausibility.js +70 -0
  44. package/dist/src/narrative-layer.d.ts +2 -0
  45. package/dist/src/narrative-layer.js +2 -0
  46. package/dist/src/navigation/causal-chain.d.ts +26 -0
  47. package/dist/src/navigation/causal-chain.js +74 -0
  48. package/dist/src/netcode.d.ts +1 -1
  49. package/dist/src/netcode.js +1 -1
  50. package/dist/src/performance/adaptive-tick.d.ts +23 -0
  51. package/dist/src/performance/adaptive-tick.js +50 -0
  52. package/dist/src/plugins/loader.d.ts +23 -0
  53. package/dist/src/plugins/loader.js +86 -0
  54. package/dist/src/plugins/registry.d.ts +11 -0
  55. package/dist/src/plugins/registry.js +28 -0
  56. package/dist/src/plugins/types.d.ts +31 -0
  57. package/dist/src/plugins/types.js +7 -0
  58. package/dist/src/replay.js +5 -2
  59. package/dist/src/scenario.js +2 -1
  60. package/dist/src/serialization/binary.d.ts +5 -0
  61. package/dist/src/serialization/binary.js +193 -0
  62. package/dist/src/session.d.ts +115 -0
  63. package/dist/src/session.js +228 -0
  64. package/dist/src/sim/ai/decide.js +1 -1
  65. package/dist/src/sim/ai/personality.js +2 -2
  66. package/dist/src/sim/bodyplan.d.ts +30 -0
  67. package/dist/src/sim/context.d.ts +2 -0
  68. package/dist/src/sim/kernel.js +80 -1294
  69. package/dist/src/sim/normalization.d.ts +12 -0
  70. package/dist/src/sim/normalization.js +92 -0
  71. package/dist/src/sim/resolvers/attack-resolver.d.ts +30 -0
  72. package/dist/src/sim/resolvers/attack-resolver.js +310 -0
  73. package/dist/src/sim/resolvers/capability-resolver.d.ts +15 -0
  74. package/dist/src/sim/resolvers/capability-resolver.js +270 -0
  75. package/dist/src/sim/resolvers/grapple-resolver.d.ts +28 -0
  76. package/dist/src/sim/resolvers/grapple-resolver.js +70 -0
  77. package/dist/src/sim/resolvers/shoot-resolver.d.ts +27 -0
  78. package/dist/src/sim/resolvers/shoot-resolver.js +212 -0
  79. package/dist/src/sim/resolvers/treat-resolver.d.ts +16 -0
  80. package/dist/src/sim/resolvers/treat-resolver.js +77 -0
  81. package/dist/src/sim/step/apply/intents.d.ts +6 -0
  82. package/dist/src/sim/step/apply/intents.js +83 -0
  83. package/dist/src/sim/step/kernel-pipeline.d.ts +9 -0
  84. package/dist/src/sim/step/kernel-pipeline.js +15 -0
  85. package/dist/src/sim/step/phases/capability-phase.d.ts +8 -0
  86. package/dist/src/sim/step/phases/capability-phase.js +65 -0
  87. package/dist/src/sim/step/phases/cooldowns-phase.d.ts +3 -0
  88. package/dist/src/sim/step/phases/cooldowns-phase.js +37 -0
  89. package/dist/src/sim/step/phases/prepare-phase.d.ts +10 -0
  90. package/dist/src/sim/step/phases/prepare-phase.js +33 -0
  91. package/dist/src/sim/step/pipeline.d.ts +2 -0
  92. package/dist/src/sim/step/pipeline.js +15 -0
  93. package/dist/src/sim/step/resolvers/impact-resolver.d.ts +9 -0
  94. package/dist/src/sim/step/resolvers/impact-resolver.js +55 -0
  95. package/dist/src/sim/step/world-phases.d.ts +7 -0
  96. package/dist/src/sim/step/world-phases.js +15 -0
  97. package/dist/src/sim/step/world-step-context.d.ts +23 -0
  98. package/dist/src/sim/step/world-step-context.js +1 -0
  99. package/dist/src/sim/systemic-toxicology.js +1 -1
  100. package/dist/src/sim/team.js +2 -2
  101. package/dist/src/sim/testing.js +4 -3
  102. package/dist/src/sim/toxicology.d.ts +1 -1
  103. package/dist/src/sim/toxicology.js +1 -1
  104. package/dist/src/sim/world.d.ts +17 -24
  105. package/dist/src/snapshot.js +3 -6
  106. package/dist/src/tier2.d.ts +19 -0
  107. package/dist/src/tier2.js +21 -0
  108. package/dist/src/tier3.d.ts +10 -0
  109. package/dist/src/tier3.js +12 -0
  110. package/dist/src/version.d.ts +6 -0
  111. package/dist/src/version.js +8 -0
  112. package/dist/src/wasm/bridge.d.ts +14 -0
  113. package/dist/src/wasm/bridge.js +84 -0
  114. package/dist/src/wasm-kernel.d.ts +2 -0
  115. package/dist/src/wasm-kernel.js +1 -0
  116. package/dist/src/world-evolution-backend/engine.d.ts +4 -0
  117. package/dist/src/world-evolution-backend/engine.js +347 -0
  118. package/dist/src/world-evolution-backend/host-schema.d.ts +145 -0
  119. package/dist/src/world-evolution-backend/host-schema.js +375 -0
  120. package/dist/src/world-evolution-backend/index.d.ts +1 -0
  121. package/dist/src/world-evolution-backend/index.js +1 -0
  122. package/dist/src/world-evolution-backend/open-world-host-adapter.d.ts +96 -0
  123. package/dist/src/world-evolution-backend/open-world-host-adapter.js +208 -0
  124. package/dist/src/world-evolution-backend/profiles.d.ts +4 -0
  125. package/dist/src/world-evolution-backend/profiles.js +136 -0
  126. package/dist/src/world-evolution-backend/public.d.ts +11 -0
  127. package/dist/src/world-evolution-backend/public.js +7 -0
  128. package/dist/src/world-evolution-backend/reproducibility.d.ts +8 -0
  129. package/dist/src/world-evolution-backend/reproducibility.js +35 -0
  130. package/dist/src/world-evolution-backend/timeline.d.ts +6 -0
  131. package/dist/src/world-evolution-backend/timeline.js +337 -0
  132. package/dist/src/world-evolution-backend/types.d.ts +138 -0
  133. package/dist/src/world-evolution-backend/types.js +1 -0
  134. package/dist/src/world-evolution-host-backend.d.ts +51 -0
  135. package/dist/src/world-evolution-host-backend.js +97 -0
  136. package/dist/src/world-evolution.d.ts +201 -0
  137. package/dist/src/world-evolution.js +543 -0
  138. package/dist/src/world-factory.js +2 -1
  139. package/dist/tools/pack-cli.js +55 -2
  140. package/docs/bridge-contract.md +140 -332
  141. package/docs/completion-evidence-dashboard.md +63 -0
  142. package/docs/host-contract.md +86 -310
  143. package/docs/host-world-evolution-schema.md +155 -0
  144. package/docs/integration-primer.md +29 -22
  145. package/docs/migration-monolith-to-modular.md +102 -120
  146. package/docs/package-architecture.md +116 -323
  147. package/docs/plugins/README.md +42 -0
  148. package/docs/plugins/hooks.md +22 -0
  149. package/docs/plugins/publishing.md +29 -0
  150. package/docs/plugins/security-model.md +273 -0
  151. package/docs/project-overview.md +30 -30
  152. package/docs/release-dashboard.md +47 -0
  153. package/docs/session-api.md +127 -0
  154. package/docs/stable-api-manifest.json +52 -0
  155. package/docs/trust-dashboard.md +37 -0
  156. package/docs/versioning.md +256 -245
  157. package/docs/wire-protocol.md +140 -209
  158. package/docs/world-evolution-backend.md +200 -0
  159. package/docs/world-evolution-engine.md +150 -0
  160. package/docs/world-evolution-host-backend.md +70 -0
  161. package/docs/world-evolution-orchestration.md +248 -0
  162. package/package.json +125 -6
  163. package/schema/content-pack.schema.json +85 -0
  164. package/schema/plugin.schema.json +57 -0
  165. package/schema/world-evolution-input.schema.json +196 -0
@@ -7,7 +7,7 @@
7
7
  ## Purpose
8
8
 
9
9
  > **New to Ananke?** Start with [`docs/host-contract.md`](host-contract.md) — it covers the
10
- > complete stable integration surface with working code examples. Return here for
10
+ > current Tier 1 stable integration surface with working code examples. Return here for
11
11
  > architecture diagrams, type glossary, and integration gotchas.
12
12
 
13
13
  This document captures the technical insights, data‑flow diagrams, type glossaries, and gotchas discovered during the 2–4 week evaluation spike described in the ROADMAP’s **Deep Integration & Technical Onboarding** milestone. It is intended as an internal reference for engineers who will be integrating Ananke into a production game or simulation.
@@ -16,28 +16,29 @@ The spike consisted of three concrete experiments:
16
16
 
17
17
  1. **Tracing the data flow of a simple melee attack** — from `Command` input through the kernel to injury output (`tools/trace‑attack.ts`).
18
18
  2. **Building a minimal observer** that reads `WorldState` after each `stepWorld` call and prints entity positions, condition, and injury summaries (`tools/observer.ts`).
19
- 3. **Experimenting with saving and loading a complete `WorldState`** to understand the serialisation format and any Map/BigInt round‑trip concerns (`tools/serialize.ts`).
19
+ 3. **Experimenting with saving and loading a full `WorldState` snapshot** to understand the serialisation format and any Map/BigInt round‑trip concerns (`tools/serialize.ts`).
20
20
 
21
21
  Each experiment is documented below, followed by a glossary of critical types and a list of integration gotchas.
22
22
 
23
23
  ## Choose your entry point
24
24
 
25
25
  Use the table below to find the right subpath export for your use case.
26
- The full module index with all 41 exports is in [`docs/module-index.md`](module-index.md).
26
+ The full module index is in [`docs/module-index.md`](module-index.md).
27
27
 
28
28
  | I want to… | Start with | Then add |
29
29
  |---|---|---|
30
30
  | **Simulate a duel or battle** | `"@its-not-rocket-science/ananke"` (main) | `"…/combat"` for grapple, ranged, formation |
31
31
  | **Run a campaign / world simulation** | `"…"` + `"…/polity"` | `"…/campaign"` + whichever campaign extensions you need |
32
32
  | **Design a species or xenobiology** | `"…"` + `"…/species"` + `"…/anatomy"` | `"…/character"` for aging, sleep, disease |
33
- | **Drive a 3D renderer** | `""` (bridge exports are in main bundle) | See [`docs/bridge-contract.md`](bridge-contract.md) |
33
+ | **Drive a 3D renderer** | `"…/host-loop"` for stable wire frames | Add `"…/tier2"` only if you need experimental bridge internals (`BridgeEngine`, mapping helpers) see [`docs/bridge-contract.md`](bridge-contract.md) |
34
34
  | **Build a multiplayer host** | `"…"` (deterministic by design) | See [`docs/host-contract.md`](host-contract.md) for lockstep pattern |
35
+ | **Run host session workflows** | `"…/session"` | See [`docs/session-api.md`](session-api.md) for the Tier 2 / experimental session facade |
35
36
  | **Add narrative / storytelling** | `"…/narrative"` + `"…/narrative-prose"` | `"…/renown"` for legend-building |
36
37
  | **Craft / economic simulation** | `"…/crafting"` + `"…/catalog"` | `"…/social"` for trade and faction effects |
37
38
  | **Grand strategy / 4X** | `"…/polity"` + `"…/campaign"` | Any combination of the 26 campaign extension modules |
38
39
 
39
- **Stability:** `"."` and `"./polity"` are **Tier 1 (Stable)** — no breaking changes without a major version bump.
40
- All other subpaths are **Tier 2 (Experimental)** — changelog documents any breaking changes.
40
+ **Stability:** `"."` and `"./polity"` are **Tier 1 stable** — no breaking changes without a major version bump.
41
+ All other subpaths are **Experimental** — changelog documents any breaking changes.
41
42
  See [`STABLE_API.md`](../STABLE_API.md) for the full tier table.
42
43
 
43
44
  ---
@@ -48,13 +49,19 @@ Ananke is a deterministic, lockstep‑friendly simulation kernel that models ent
48
49
 
49
50
  ### Core data structures
50
51
 
51
- ```typescript
52
+ ```typescript no-check-example
52
53
  interface WorldState {
53
54
  tick: number;
54
55
  seed: number;
55
56
  entities: Entity[];
56
57
  activeFieldEffects?: FieldEffect[];
57
- __sensoryEnv?: any; // internal side‑channel
58
+ runtimeState?: {
59
+ sensoryEnv?: SensoryEnvironment;
60
+ factionRegistry?: FactionRegistry;
61
+ partyRegistry?: PartyRegistry;
62
+ relationshipGraph?: RelationshipGraph;
63
+ nutritionAccum?: number;
64
+ }; // explicit host/runtime subsystem state
58
65
  }
59
66
 
60
67
  interface Entity {
@@ -78,7 +85,7 @@ type CommandMap = Map<number, Command[]>;
78
85
 
79
86
  ### Kernel entry point
80
87
 
81
- ```typescript
88
+ ```typescript no-check-example
82
89
  function stepWorld(
83
90
  world: WorldState,
84
91
  commands: CommandMap,
@@ -125,7 +132,7 @@ The observer (`tools/observer.ts`) demonstrates how to hook into the `stepWorld`
125
132
 
126
133
  ### Observer pattern
127
134
 
128
- ```typescript
135
+ ```typescript no-check-example
129
136
  for (let tick = 0; tick < maxTicks; tick++) {
130
137
  // 1. Build indexes (required for AI decisions, but we hard‑code commands)
131
138
  const index = buildWorldIndex(world);
@@ -161,7 +168,7 @@ The serialisation demo (`tools/serialize.ts`) shows how to round‑trip a `World
161
168
 
162
169
  Optional Map fields on `Entity` (`foodInventory`, `armourState`, `reputations`) must be explicitly converted to an array of entries for JSON serialisation:
163
170
 
164
- ```typescript
171
+ ```typescript no-check-example
165
172
  function serializeEntity(e: Entity): unknown {
166
173
  const obj: any = { ...e };
167
174
  if (e.foodInventory instanceof Map) {
@@ -174,7 +181,7 @@ function serializeEntity(e: Entity): unknown {
174
181
 
175
182
  On deserialisation, reconstruct the Map from the array:
176
183
 
177
- ```typescript
184
+ ```typescript no-check-example
178
185
  function deserializeEntity(e: any): Entity {
179
186
  const entity = { ...e } as Entity;
180
187
  if (Array.isArray(e.foodInventory)) {
@@ -189,24 +196,24 @@ function deserializeEntity(e: any): Entity {
189
196
 
190
197
  After deserialisation, the simulation can be continued from the saved state and will produce **identical results** to the original run, provided the same seed and commands are used. This is a direct consequence of the kernel’s pure‑deterministic design.
191
198
 
192
- > **Gotcha:** The `__sensoryEnv` and `activeFieldEffects` side‑channel fields are not required for basic combat simulation; they can be omitted during serialisation if not needed.
199
+ > **Gotcha:** `runtimeState` and `activeFieldEffects` are optional host/runtime subsystem state; they can be omitted during serialisation for basic combat if unused.
193
200
 
194
201
  ---
195
202
 
196
203
  ## 5. Connecting to a Renderer (Bridge API)
197
204
 
198
- Milestone 3 delivers a complete bridge module (`src/bridge/`) that handles tick‑rate conversion, segment‑to‑bone mapping, and deterministic interpolation between simulation ticks. The bridge is a double‑buffered engine that ingests simulation snapshots at 20 Hz and provides smooth interpolated state at render frequency (60 Hz or higher).
205
+ Milestone 3 delivers a Tier 1 stable bridge module (`src/bridge/`) that handles tick‑rate conversion, segment‑to‑bone mapping, and deterministic interpolation between simulation ticks. The bridge is a double‑buffered engine that ingests simulation snapshots at 20 Hz and provides smooth interpolated state at render frequency (60 Hz or higher).
199
206
 
200
207
  ### Key features
201
208
 
202
209
  - **Mapping system** – connect simulation segment IDs (`"leftArm"`, `"torso"`) to your skeleton’s bone names (`"arm_L"`, `"spine_02"`).
203
210
  - **Fixed‑point interpolation** – deterministic linear interpolation of positions, velocities, animation weights, pose modifiers, and condition.
204
211
  - **Extrapolation control** – optional velocity‑based prediction when render time runs ahead of simulation.
205
- - **Full API documentation** – see [`bridge‑api.md`](./bridge‑api.md) for detailed reference and examples.
212
+ - **Full API documentation** – see [`bridge‑api.md`](./bridge-contract.md) for detailed reference and examples.
206
213
 
207
214
  ### Minimal setup example
208
215
 
209
- ```typescript
216
+ ```typescript no-check-example
210
217
  import { BridgeEngine } from "ananke";
211
218
  import { extractRigSnapshots, extractMotionVectors, extractConditionSamples } from "ananke";
212
219
 
@@ -237,11 +244,11 @@ if (state) {
237
244
 
238
245
  ### Working demo
239
246
 
240
- Run `npm run run:bridgedemo` to see a complete bridge workflow with humanoid and quadruped body plans, simulation loop, render‑loop simulation, and determinism verification.
247
+ Run `npm run run:bridge-demo` to see an end-to-end bridge workflow with humanoid and quadruped body plans, simulation loop, render‑loop simulation, and determinism verification.
241
248
 
242
249
  ### Integration steps
243
250
 
244
- 1. Read the [bridge API documentation](./bridge‑api.md) to understand mapping and interpolation details.
251
+ 1. Read the [bridge API documentation](./bridge-contract.md) to understand mapping and interpolation details.
245
252
  2. Author mappings for each body plan your game uses (humanoid, quadruped, avian, etc.).
246
253
  3. Integrate the bridge into your simulation and render threads as shown above.
247
254
  4. Use the `poseModifiers` array to drive vertex‑shader weights or morph targets for injury visualisation.
@@ -273,7 +280,7 @@ Run `npm run run:bridge‑demo` to see a complete bridge workflow with humanoid
273
280
 
274
281
  TypeScript’s `exactOptionalPropertyTypes` is enabled in the project. This means an optional property set to `undefined` is **not** the same as omitting the property. For example:
275
282
 
276
- ```typescript
283
+ ```typescript no-check-example
277
284
  // ❌ Wrong – will cause type errors
278
285
  entity.cognition = undefined;
279
286
 
@@ -317,11 +324,11 @@ When mapping injury regions to a 3D skeleton, note that region IDs are **camelCa
317
324
 
318
325
  ## 8. Recommended Integration Steps
319
326
 
320
- 1. **Start with the vertical slice** (`npm run run:vertical-slice`) to see a complete 1v1 duel.
327
+ 1. **Start with the vertical slice** (`npm run run:vertical-slice`) to see an end-to-end 1v1 duel.
321
328
  2. **Trace a single attack** (`npm run run:trace-attack`) to internalise the data flow.
322
329
  3. **Build an observer** that logs the state of your own entities each tick (copy `observer.ts`).
323
330
  4. **Implement save/load** using the serialisation pattern (`serialize.ts`).
324
- 5. **Connect the 3D rig** using the bridge API (`npm run run:bridgedemo`). See [Bridge API documentation](./bridge‑api.md).
331
+ 5. **Connect the 3D rig** using the bridge API (`npm run run:bridge-demo`). See [Bridge API documentation](./bridge-contract.md).
325
332
  6. **Profile performance** with many entities (100+) to ensure your bridge does not become a bottleneck.
326
333
 
327
334
  ---
@@ -332,4 +339,4 @@ The evaluation spike confirms that Ananke’s deterministic, physics‑first sim
332
339
 
333
340
  With this primer, a team can proceed to **Milestone 3 (Asset Pipeline & Renderer Bridge)** with a solid understanding of the kernel’s internals and the gotchas to avoid.
334
341
 
335
- *Generated by Claude Code during Integration Milestone 2, March 2026.*
342
+ *Generated by Claude Code during Integration Milestone 2, March 2026.*
@@ -1,120 +1,102 @@
1
- # Migration Guide: Monolith to Modular Packages
2
-
3
- This guide covers how to migrate from `@its-not-rocket-science/ananke` to the
4
- focused `@ananke/*` packages. Migration is optional — the monolith package is
5
- maintained indefinitely for backwards compatibility.
6
-
7
- ---
8
-
9
- ## Should you migrate?
10
-
11
- | Situation | Recommendation |
12
- |-----------|----------------|
13
- | Existing project, everything working | Stay on the monolith. No action required. |
14
- | New project, only needs combat | Start with `@ananke/combat` + `@ananke/core` |
15
- | New project, full simulation stack | Use the monolith; migrate to modular when convenient |
16
- | Bundle size is a concern (Phase 2+) | Migrate after Phase 2 (source migration) for real tree-shaking |
17
-
18
- ---
19
-
20
- ## Phase 1 Migration (stubs — available now)
21
-
22
- Phase 1 packages are thin wrappers that re-export from the monolith. Bundle
23
- size is unchanged, but import paths are cleaner and signal which API tier you
24
- depend on.
25
-
26
- ### Step 1 — Install the sub-package(s) you need
27
-
28
- ```bash
29
- # Combat-only host
30
- npm install @ananke/core @ananke/combat
31
-
32
- # Full world simulation
33
- npm install @ananke/core @ananke/combat @ananke/campaign @ananke/content
34
- ```
35
-
36
- The monolith is installed automatically as a peer dependency.
37
-
38
- ### Step 2 — Update imports
39
-
40
- Replace monolith paths with the appropriate package name:
41
-
42
- | Old import | New import |
43
- |-----------|-----------|
44
- | `@its-not-rocket-science/ananke` | `@ananke/core` |
45
- | `@its-not-rocket-science/ananke/combat` | `@ananke/combat` |
46
- | `@its-not-rocket-science/ananke/anatomy` | `@ananke/combat` |
47
- | `@its-not-rocket-science/ananke/competence` | `@ananke/combat` |
48
- | `@its-not-rocket-science/ananke/wasm-kernel` | `@ananke/combat` |
49
- | `@its-not-rocket-science/ananke/species` | `@ananke/content` |
50
- | `@its-not-rocket-science/ananke/catalog` | `@ananke/content` |
51
- | `@its-not-rocket-science/ananke/character` | `@ananke/content` |
52
- | `@its-not-rocket-science/ananke/crafting` | `@ananke/content` |
53
- | `@its-not-rocket-science/ananke/campaign` | `@ananke/campaign` |
54
- | `@its-not-rocket-science/ananke/polity` | `@ananke/campaign` |
55
- | `@its-not-rocket-science/ananke/social` | `@ananke/campaign` |
56
- | `@its-not-rocket-science/ananke/narrative` | `@ananke/campaign` |
57
- | `@its-not-rocket-science/ananke/narrative-prose` | `@ananke/campaign` |
58
- | `@its-not-rocket-science/ananke/renown` | `@ananke/campaign` |
59
- | `@its-not-rocket-science/ananke/kinship` | `@ananke/campaign` |
60
- | `@its-not-rocket-science/ananke/succession` | `@ananke/campaign` |
61
- | `@its-not-rocket-science/ananke/calendar` | `@ananke/campaign` |
62
- | `@its-not-rocket-science/ananke/feudal` | `@ananke/campaign` |
63
- | `@its-not-rocket-science/ananke/diplomacy` | `@ananke/campaign` |
64
- | `@its-not-rocket-science/ananke/migration` | `@ananke/campaign` |
65
- | `@its-not-rocket-science/ananke/espionage` | `@ananke/campaign` |
66
- | `@its-not-rocket-science/ananke/trade-routes` | `@ananke/campaign` |
67
- | `@its-not-rocket-science/ananke/siege` | `@ananke/campaign` |
68
- | `@its-not-rocket-science/ananke/faith` | `@ananke/campaign` |
69
- | `@its-not-rocket-science/ananke/demography` | `@ananke/campaign` |
70
- | `@its-not-rocket-science/ananke/granary` | `@ananke/campaign` |
71
- | `@its-not-rocket-science/ananke/epidemic` | `@ananke/campaign` |
72
- | `@its-not-rocket-science/ananke/infrastructure` | `@ananke/campaign` |
73
- | `@its-not-rocket-science/ananke/unrest` | `@ananke/campaign` |
74
- | `@its-not-rocket-science/ananke/research` | `@ananke/campaign` |
75
- | `@its-not-rocket-science/ananke/taxation` | `@ananke/campaign` |
76
- | `@its-not-rocket-science/ananke/military-campaign` | `@ananke/campaign` |
77
- | `@its-not-rocket-science/ananke/governance` | `@ananke/campaign` |
78
- | `@its-not-rocket-science/ananke/resources` | `@ananke/campaign` |
79
- | `@its-not-rocket-science/ananke/climate` | `@ananke/campaign` |
80
- | `@its-not-rocket-science/ananke/famine` | `@ananke/campaign` |
81
- | `@its-not-rocket-science/ananke/containment` | `@ananke/campaign` |
82
- | `@its-not-rocket-science/ananke/mercenaries` | `@ananke/campaign` |
83
- | `@its-not-rocket-science/ananke/wonders` | `@ananke/campaign` |
84
- | `@its-not-rocket-science/ananke/monetary` | `@ananke/campaign` |
85
-
86
- ### Step 3 — Verify
87
-
88
- ```bash
89
- npm run build # or tsc --noEmit
90
- npm test
91
- ```
92
-
93
- No other changes are needed.
94
-
95
- ---
96
-
97
- ## Phase 2 Migration (source migration — planned)
98
-
99
- When Phase 2 lands, `@ananke/combat` will no longer depend on the monolith.
100
- The import paths remain identical — only the transitive dependency graph changes.
101
-
102
- **No code changes required in your project for Phase 2.**
103
-
104
- Run `npm update` when the new versions are published; your bundler will
105
- automatically produce a smaller output.
106
-
107
- ---
108
-
109
- ## Staying on the monolith
110
-
111
- If you prefer to keep using `@its-not-rocket-science/ananke` directly, nothing
112
- changes. The 41 subpath exports are stable and will not be removed.
113
-
114
- ---
115
-
116
- ## See also
117
-
118
- - [`docs/package-architecture.md`](package-architecture.md) — full design document and source file mapping
119
- - [`docs/module-index.md`](module-index.md) — all exports with stability tiers and use cases
120
- - [`STABLE_API.md`](../STABLE_API.md) — stable API surface (Tier 1)
1
+ # Migration guide: monolith to modular imports (state-aware)
2
+
3
+ This guide separates what is available **today** from what is **planned** so adopters can migrate with accurate expectations.
4
+
5
+ ---
6
+
7
+ ## Current state (available now)
8
+
9
+ - `@its-not-rocket-science/ananke` is the primary shipped package.
10
+ - `@ananke/core`, `@ananke/combat`, `@ananke/campaign`, and `@ananke/content` are currently Phase 1 wrappers that re-export from the monolith.
11
+ - Result: changing imports can improve API clarity, but does not yet create full package isolation or guaranteed bundle-size reductions.
12
+
13
+ ## In progress (partial implementation)
14
+
15
+ - Package-boundary definitions and checks exist and are actively used.
16
+ - Boundary cleanup and source ownership migration are still ongoing.
17
+ - Until that migration is complete, modular packages should be treated as compatibility entrypoints, not fully separated codebases.
18
+
19
+ ## Target state (planned)
20
+
21
+ - Each `@ananke/*` package will own implementation and build artifacts.
22
+ - Dependency relationships between packages will match the declared modular DAG.
23
+ - The monolith remains as a compatibility/meta package for teams that prefer one dependency.
24
+
25
+ ---
26
+
27
+ ## Should you migrate now?
28
+
29
+ | Situation | Recommendation today |
30
+ |---|---|
31
+ | Existing project that already works on monolith imports | Staying on monolith is valid; no urgent change required. |
32
+ | New project that wants explicit domain-oriented imports | Use `@ananke/*` imports, understanding they are wrappers in Phase 1. |
33
+ | Team expecting immediate tree-shaking/size wins from modular packages | Wait for source-ownership migration milestones before expecting those gains. |
34
+
35
+ ---
36
+
37
+ ## Migration steps you can do today
38
+
39
+ ### 1) Install wrapper packages
40
+
41
+ ```bash
42
+ # Example: combat-oriented app
43
+ npm install @ananke/core @ananke/combat
44
+
45
+ # Example: broader simulation app
46
+ npm install @ananke/core @ananke/combat @ananke/campaign @ananke/content
47
+ ```
48
+
49
+ These packages currently peer on `@its-not-rocket-science/ananke`.
50
+
51
+ ### 2) Update imports
52
+
53
+ Use modular package names instead of monolith subpaths where practical.
54
+
55
+ | Old import | Current modular import |
56
+ |---|---|
57
+ | `@its-not-rocket-science/ananke` | `@ananke/core` |
58
+ | `@its-not-rocket-science/ananke/combat` | `@ananke/combat` |
59
+ | `@its-not-rocket-science/ananke/anatomy` | `@ananke/combat` |
60
+ | `@its-not-rocket-science/ananke/competence` | `@ananke/combat` |
61
+ | `@its-not-rocket-science/ananke/wasm-kernel` | `@ananke/combat` |
62
+ | `@its-not-rocket-science/ananke/species` | `@ananke/content` |
63
+ | `@its-not-rocket-science/ananke/catalog` | `@ananke/content` |
64
+ | `@its-not-rocket-science/ananke/character` | `@ananke/content` |
65
+ | `@its-not-rocket-science/ananke/crafting` | `@ananke/content` |
66
+ | `@its-not-rocket-science/ananke/campaign` | `@ananke/campaign` |
67
+ | `@its-not-rocket-science/ananke/polity` | `@ananke/campaign` |
68
+ | `@its-not-rocket-science/ananke/social` | `@ananke/campaign` |
69
+ | `@its-not-rocket-science/ananke/narrative` | `@ananke/campaign` |
70
+ | `@its-not-rocket-science/ananke/renown` | `@ananke/campaign` |
71
+ | `@its-not-rocket-science/ananke/kinship` | `@ananke/campaign` |
72
+ | `@its-not-rocket-science/ananke/succession` | `@ananke/campaign` |
73
+ | `@its-not-rocket-science/ananke/diplomacy` | `@ananke/campaign` |
74
+ | `@its-not-rocket-science/ananke/migration` | `@ananke/campaign` |
75
+ | `@its-not-rocket-science/ananke/trade-routes` | `@ananke/campaign` |
76
+ | `@its-not-rocket-science/ananke/military-campaign` | `@ananke/campaign` |
77
+ | `@its-not-rocket-science/ananke/governance` | `@ananke/campaign` |
78
+
79
+ > Note: for APIs not listed above, keep using monolith subpaths until corresponding modular wrapper/package coverage is explicitly documented.
80
+
81
+ ### 3) Verify build and tests
82
+
83
+ ```bash
84
+ npm run build
85
+ npm test
86
+ ```
87
+
88
+ ---
89
+
90
+ ## What this means for adopters today
91
+
92
+ - Treat current migration as an import-surface alignment step.
93
+ - Do not treat it as proof that implementation has already moved out of the monolith.
94
+ - Adopting modular imports now can reduce future churn once target modular ownership lands.
95
+
96
+ ---
97
+
98
+ ## Related docs
99
+
100
+ - [`docs/package-architecture.md`](package-architecture.md)
101
+ - [`docs/module-index.md`](module-index.md)
102
+ - [`STABLE_API.md`](../STABLE_API.md)