@its-not-rocket-science/ananke 0.1.65 → 0.1.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,31 @@ Versioning follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ---
8
8
 
9
+ ## [0.1.66] — 2026-04-01
10
+
11
+ ### Added
12
+
13
+ - **PM-7 — API Deprecation Framework (complete):**
14
+ - `tools/audit-deprecations.ts` (new): scans all `src/` TypeScript files for `@deprecated` JSDoc tags and outputs a structured table of `{ symbol, file, line, since, removeAfter, replacement, overdue }`.
15
+ - `--json` flag: machine-readable JSON output with timestamp, engine version, and full entry list.
16
+ - `--check` flag: exits 1 if any symbol's `removeAfter` version ≤ current engine version (overdue).
17
+ - `prepublishOnly` now includes `npm run audit-deprecations -- --check`: `npm publish` fails if any symbol is overdue for removal.
18
+ - npm script: `audit-deprecations`.
19
+ - Structured `@deprecated` convention defined: `@deprecated since {version} — use {replacement} instead. Removes at {removeAfter}.`
20
+ - All three existing `@deprecated` tags in `src/` updated to the new structured format:
21
+ - `anankeVersion` in `content-pack.ts`: since 0.1.65, removes at 0.3.0
22
+ - `Perception` type alias in `sim/ai/perception.ts`: since 0.1.0, removes at 0.3.0
23
+ - `mkWorld(seed, loadout)` overload in `sim/testing.ts`: since 0.1.0, removes at 0.2.0
24
+ - `docs/versioning.md`: new "Deprecation lifecycle" section documenting the three-phase pattern (mark → migration window → remove), the required tag format, and the audit checklist.
25
+ - `docs/module-index.md`: new "Deprecated exports" table surfacing all known deprecated symbols with since/removeAfter/replacement.
26
+ - 0 new tests (5,593 total). Coverage: 97.11%/88.07%/95.83%/97.11%. Build: clean.
27
+
28
+ ### Deprecated
29
+
30
+ - `AnankePackManifest.anankeVersion` — since 0.1.65, use `registry.compatRange` instead. Removes at 0.3.0.
31
+
32
+ ---
33
+
9
34
  ## [0.1.65] — 2026-04-01
10
35
 
11
36
  ### Added
@@ -1,6 +1,6 @@
1
1
  import type { WorldState } from "./sim/world.js";
2
2
  /** Current Ananke engine version — used to evaluate pack compatRange at runtime. */
3
- export declare const ANANKE_ENGINE_VERSION = "0.1.65";
3
+ export declare const ANANKE_ENGINE_VERSION = "0.1.66";
4
4
  /** A single actionable validation failure from `validatePack`. */
5
5
  export interface PackValidationError {
6
6
  /** JSONPath-style location, e.g. `"$.weapons[2].mass_kg"`. */
@@ -81,7 +81,7 @@ export interface AnankePackManifest {
81
81
  description?: string;
82
82
  /**
83
83
  * Minimum Ananke version required, as a semver range string.
84
- * @deprecated Use `registry.compatRange` instead this field is informational only.
84
+ * @deprecated since 0.1.65 — use `registry.compatRange` instead. Removes at 0.3.0.
85
85
  */
86
86
  anankeVersion?: string;
87
87
  /**
@@ -16,7 +16,7 @@ import { registerWorldArchetype, registerWorldItem } from "./world-factory.js";
16
16
  // ── Version constant ──────────────────────────────────────────────────────────
17
17
  // Must be kept in sync with package.json "version" field.
18
18
  /** Current Ananke engine version — used to evaluate pack compatRange at runtime. */
19
- export const ANANKE_ENGINE_VERSION = "0.1.65";
19
+ export const ANANKE_ENGINE_VERSION = "0.1.66";
20
20
  // ── Semver utilities ──────────────────────────────────────────────────────────
21
21
  // Lightweight range evaluator — no external dependencies.
22
22
  // Supports: >=X.Y.Z >X.Y.Z <=X.Y.Z <X.Y.Z =X.Y.Z ^X.Y.Z ~X.Y.Z
@@ -7,6 +7,6 @@ export interface LocalPerception {
7
7
  enemies: Entity[];
8
8
  allies: Entity[];
9
9
  }
10
- /** @deprecated Use LocalPerception */
10
+ /** @deprecated since 0.1.0 — use `LocalPerception` instead. Removes at 0.3.0. */
11
11
  export type Perception = LocalPerception;
12
12
  export declare function perceiveLocal(world: WorldState | undefined, self: Entity, index: WorldIndex, spatial: SpatialIndex, radius_m: number, maxCount?: number, env?: SensoryEnvironment): LocalPerception;
@@ -8,6 +8,6 @@ import { ImpactEvent } from "./events.js";
8
8
  */
9
9
  export declare function mkHumanoidEntity(id: number, teamId: number, x_m: number, y_m: number, z_m?: number): Entity;
10
10
  export declare function mkWorld(seed: number, entities: Entity[]): WorldState;
11
- /** @deprecated Pass an explicit entity array instead: mkWorld(seed, [a, b]) */
11
+ /** @deprecated since 0.1.0 use `mkWorld(seed, entities[])` instead. Removes at 0.2.0. */
12
12
  export declare function mkWorld(seed: number, loadoutA: Loadout): WorldState;
13
13
  export declare function mkImpactEvent(attackerId: number, targetId: number, region?: string, energy_J?: number, protectedByArmour?: boolean, blocked?: boolean, parried?: boolean, weaponId?: string, wpn?: Weapon, hitQuality?: number, shieldBlocked?: boolean): ImpactEvent;
@@ -179,3 +179,67 @@ body plan hooks):
179
179
  3. Keep an `UPSTREAM.md` at your fork root noting your base version and a diff summary
180
180
  4. Periodically rebase onto upstream Tier 3 commits to collect non-breaking improvements;
181
181
  treat Tier 1/2 commits as explicit migration tasks to schedule
182
+
183
+ ---
184
+
185
+ ## Deprecation lifecycle
186
+
187
+ Symbols are deprecated rather than removed immediately so downstream projects have time
188
+ to migrate. The lifecycle follows a three-phase pattern:
189
+
190
+ ### 1 — Mark deprecated (current version)
191
+
192
+ Add a structured JSDoc tag to the symbol:
193
+
194
+ ```typescript
195
+ /**
196
+ * @deprecated since 0.1.50 — use `newFunction` instead. Removes at 0.3.0.
197
+ */
198
+ export function oldFunction() { … }
199
+ ```
200
+
201
+ The **required format** is:
202
+
203
+ ```
204
+ @deprecated since {version} — use {replacement} instead. Removes at {removeAfter}.
205
+ ```
206
+
207
+ | Field | Meaning |
208
+ |-------|---------|
209
+ | `since` | Version in which the deprecation was introduced |
210
+ | `replacement` | Short description or code reference of what to use instead |
211
+ | `removeAfter` | Version at which the symbol will be deleted — must be a future version |
212
+
213
+ `removeAfter` must satisfy `> current` at publish time; `npm publish` runs
214
+ `audit-deprecations --check` and fails if any symbol is overdue.
215
+
216
+ ### 2 — Migration window
217
+
218
+ During the migration window the symbol still works but emits a TypeScript deprecation
219
+ warning in IDEs (the `@deprecated` tag triggers the strikethrough).
220
+
221
+ The migration window is at least one **minor** version for Tier 2 symbols
222
+ and at least one **major** version for Tier 1 (Stable) symbols.
223
+
224
+ ### 3 — Remove at removeAfter
225
+
226
+ When the engine reaches `removeAfter`, the symbol is deleted and a CHANGELOG entry is
227
+ added under a `### Removed` heading. The `since` version and the replacement are
228
+ included in the removal note so the changelog is self-contained.
229
+
230
+ ### Auditing
231
+
232
+ ```bash
233
+ npm run audit-deprecations # human-readable table
234
+ npm run audit-deprecations -- --json # machine-readable JSON
235
+ npm run audit-deprecations -- --check # exit 1 if any overdue
236
+ ```
237
+
238
+ The `--check` flag is run automatically by `npm run prepublishOnly`.
239
+
240
+ ### Adding a new deprecation (checklist)
241
+
242
+ - [ ] Add the structured `@deprecated` JSDoc tag with `since`, replacement, and `removeAfter`.
243
+ - [ ] Run `npm run audit-deprecations` to confirm the tag is detected and not overdue.
244
+ - [ ] Add a CHANGELOG entry under `### Deprecated`.
245
+ - [ ] Surface the replacement in the relevant `docs/` file or `STABLE_API.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@its-not-rocket-science/ananke",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "type": "module",
5
5
  "description": "Deterministic lockstep-friendly SI-units RPG/physics core (fixed-point TS)",
6
6
  "license": "MIT",
@@ -247,7 +247,7 @@
247
247
  "game-engine"
248
248
  ],
249
249
  "scripts": {
250
- "prepublishOnly": "npm run build && npm run test:coverage",
250
+ "prepublishOnly": "npm run build && npm run test:coverage && npm run audit-deprecations -- --check",
251
251
  "build": "tsc -p tsconfig.build.json",
252
252
  "test": "vitest run",
253
253
  "test:watch": "vitest",
@@ -298,6 +298,7 @@
298
298
  "benchmark-check": "node dist/tools/benchmark-check.js",
299
299
  "benchmark-check:strict": "node dist/tools/benchmark-check.js --threshold=0.10",
300
300
  "benchmark-check:update": "node dist/tools/benchmark-check.js --update-baseline",
301
+ "audit-deprecations": "node dist/tools/audit-deprecations.js",
301
302
  "benchmark:guide": "node dist/tools/benchmark-guide.js",
302
303
  "benchmark:parallel": "node dist/tools/benchmark-parallel.js",
303
304
  "run:renderer-bridge": "node dist/tools/renderer-bridge.js",