@reicek/neataptic-ts 0.1.11 → 0.1.12
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/.github/copilot-instructions.md +76 -0
- package/README.md +247 -272
- package/STYLEGUIDE.md +513 -0
- package/dist-docs/scripts/generate-bench-tables.js +47 -18
- package/dist-docs/scripts/generate-bench-tables.js.map +1 -1
- package/dist-docs/scripts/generate-docs.js +1 -1
- package/dist-docs/scripts/generate-docs.js.map +1 -1
- package/dist-docs/scripts/render-docs-html.js +31 -10
- package/dist-docs/scripts/render-docs-html.js.map +1 -1
- package/docs/README.md +247 -272
- package/docs/architecture/index.html +2 -2
- package/docs/architecture/network/index.html +2 -2
- package/docs/assets/ascii-maze.bundle.js +10381 -4015
- package/docs/assets/ascii-maze.bundle.js.map +4 -4
- package/docs/assets/theme.css +45 -0
- package/docs/examples/README.md +82 -0
- package/docs/examples/asciiMaze/index.html +17 -118
- package/docs/examples/index.html +71 -0
- package/docs/index.html +330 -495
- package/docs/methods/index.html +2 -2
- package/docs/multithreading/index.html +2 -2
- package/docs/multithreading/workers/browser/index.html +2 -2
- package/docs/multithreading/workers/index.html +2 -2
- package/docs/multithreading/workers/node/index.html +2 -2
- package/docs/neat/index.html +2 -2
- package/docs/src/index.html +2 -2
- package/docs/utils/README.md +0 -6
- package/docs/utils/index.html +3 -4
- package/jest.config.mjs +39 -1
- package/package.json +25 -23
- package/plans/ASCII_MAZE_enhancements.md +0 -0
- package/plans/ES2023 migration +5 -10
- package/scripts/copy-examples.mjs +3 -1
- package/scripts/export-onnx.mjs +26 -6
- package/scripts/generate-bench-tables.mjs +115 -57
- package/scripts/generate-bench-tables.ts +101 -39
- package/scripts/generate-docs.ts +1 -1
- package/scripts/render-docs-html.ts +97 -46
- package/src/multithreading/workers/node/testworker.ts +102 -14
- package/src/neat/neat.evaluate.ts +18 -2
- package/src/utils/README.md +0 -6
- package/test/benchmarks/asciiMaze.micro.bench.ts +0 -0
- package/test/benchmarks/benchmark.asciiMaze.micro.bench.test.ts +0 -0
- package/test/benchmarks/benchmark.memory.test.ts +2 -2
- package/test/benchmarks/benchmark.neat.evaluate.hotspot.test.ts +0 -0
- package/test/examples/asciiMaze/asciiMaze.api.test.ts +174 -0
- package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +50 -298
- package/test/examples/asciiMaze/browser-entry.ts +394 -133
- package/test/examples/asciiMaze/browserLogger.ts +412 -132
- package/test/examples/asciiMaze/browserTerminalUtility.ts +49 -17
- package/test/examples/asciiMaze/dashboardManager.ts +2026 -829
- package/test/examples/asciiMaze/evolutionEngine.ts +7370 -987
- package/test/examples/asciiMaze/fitness.ts +76 -34
- package/test/examples/asciiMaze/index.html +17 -118
- package/test/examples/asciiMaze/interfaces.ts +22 -2
- package/test/examples/asciiMaze/mazeMovement.ts +1345 -813
- package/test/examples/asciiMaze/mazeUtils.ts +440 -147
- package/test/examples/asciiMaze/mazeVision.ts +337 -337
- package/test/examples/asciiMaze/mazeVisualization.ts +74 -39
- package/test/examples/asciiMaze/mazes.ts +382 -0
- package/test/examples/asciiMaze/networkRefinement.ts +38 -6
- package/test/examples/asciiMaze/networkVisualization.ts +782 -600
- package/test/examples/asciiMaze/refineWinner.ts +65 -0
- package/test/examples/asciiMaze/terminalUtility.ts +17 -2
- package/test/types/es2023.d.ts +10 -0
- package/test/utils/pollUntil.test.ts +44 -0
- package/test/utils/pollUntil.ts +67 -0
- package/tsconfig.test.json +2 -1
- package/webpack.config.js +2 -8
- package/plans/network.slab.design.md +0 -67
- package/src/utils/deprecation.ts +0 -8
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Repo Copilot Instructions — NeatapticTS
|
|
2
|
+
|
|
3
|
+
Purpose
|
|
4
|
+
-------
|
|
5
|
+
When generating, modifying, or suggesting code that touches files under `src/` or `test/`, follow the project `STYLEGUIDE.md` rules and perform the quick validations listed below before returning suggestions.
|
|
6
|
+
|
|
7
|
+
How to use these instructions
|
|
8
|
+
-----------------------------
|
|
9
|
+
- Always prefer to produce code that already satisfies the style guide.
|
|
10
|
+
- If you cannot fully transform a file (large refactor), return a patch with clear TODO comments, an explicit list of remaining violations, and small, safe automated fixes where possible.
|
|
11
|
+
- If you propose changes that alter public behavior, include tests and TypeScript typechecks.
|
|
12
|
+
|
|
13
|
+
Strict rules to enforce (apply to any suggestion touching `src/` or `test/`)
|
|
14
|
+
---------------------------------------------------------------------
|
|
15
|
+
1. Naming: avoid short local identifiers. Do not use these short names for non-trivial locals: `dx`, `dy`, `d`, `i`, `a`, `b`, `c`, `p`, `o`, `cand`, `tries`, `idx`.
|
|
16
|
+
- If the original code uses a short name in a tiny loop (1–3 lines) and it is clearly idiomatic, allow `i`, `j` only.
|
|
17
|
+
- Prefer descriptive names: `candidateDirection`, `bestDistance`, `currentPosition`.
|
|
18
|
+
|
|
19
|
+
2. JSDoc: exported classes/functions/constants and public methods must have JSDoc with `@param` and `@returns` where appropriate. Add short `@example` when behavior is non-obvious.
|
|
20
|
+
|
|
21
|
+
3. Tests: follow the single-expect rule. Each `it()` (or `test()`) must have exactly one top-level `expect(...)` statement. If multiple assertions are needed, split into multiple `it()` cases or use helper assertions.
|
|
22
|
+
|
|
23
|
+
4. Constants: replace magic numbers with named `export const` or class-private `static #` constants with a short JSDoc.
|
|
24
|
+
|
|
25
|
+
5. Comments: methods should have step-level inline comments explaining intent (not every line). Use numbered steps where helpful.
|
|
26
|
+
|
|
27
|
+
6. Lookup tables and enums: prefer a single table/enum for small fixed mappings (for example direction deltas) and helper methods like `#opposite(direction)` rather than scattered arithmetic.
|
|
28
|
+
|
|
29
|
+
Automated validations to run before finalizing a suggestion
|
|
30
|
+
-------------------------------------------------------
|
|
31
|
+
When you modify or create files under `src/` or `test/`, run (or advise running) these quick validations. If you cannot run them, still make sure your suggestion would pass them.
|
|
32
|
+
|
|
33
|
+
1) TypeScript diagnostics
|
|
34
|
+
|
|
35
|
+
# Copilot instructions — STYLEGUIDE light checks
|
|
36
|
+
|
|
37
|
+
Purpose
|
|
38
|
+
-------
|
|
39
|
+
Give brief, actionable guidance so suggestions touching `src/` or `test/` prioritize compliance with `STYLEGUIDE.md`.
|
|
40
|
+
|
|
41
|
+
Keep it light: prefer small, automated checks and a short validation summary with every patch.
|
|
42
|
+
|
|
43
|
+
Quick checks to run (recommended)
|
|
44
|
+
--------------------------------
|
|
45
|
+
- TypeScript: run `npm run build` and report pass/fail.
|
|
46
|
+
- Short-id scan: flag uses of the short identifiers regex `\b(dx|dy|d|i|a|b|c|p|o|idx|cand|tries)\b` in changed files.
|
|
47
|
+
- Tests heuristic: flag test files that contain more than one `expect(` occurrence (these should be split into multiple `it()` blocks).
|
|
48
|
+
- JSDoc: for new exported symbols, ensure a JSDoc block with `@param`/`@returns` exists (or flag if missing).
|
|
49
|
+
|
|
50
|
+
PowerShell examples (local validation)
|
|
51
|
+
-------------------------------------
|
|
52
|
+
Typecheck:
|
|
53
|
+
```powershell
|
|
54
|
+
npx tsc --noEmit -p tsconfig.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Short-id scan:
|
|
58
|
+
```powershell
|
|
59
|
+
Get-ChildItem -Path src,test -Recurse -Include *.ts,*.tsx | Select-String -Pattern '\b(dx|dy|d|i|a|b|c|p|o|idx|cand|tries)\b' -NotMatch '\b(i|j)\b' -List
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Test heuristic:
|
|
63
|
+
```powershell
|
|
64
|
+
Get-ChildItem -Path test -Recurse -Include *.ts,*.tsx | ForEach-Object {
|
|
65
|
+
$count = (Get-Content $_.FullName | Select-String 'expect\(' -AllMatches).Matches.Count
|
|
66
|
+
if ($count -gt 1) { Write-Output "$($_.FullName): $count expects" }
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
What to include with a suggestion
|
|
71
|
+
--------------------------------
|
|
72
|
+
- A short validation summary (TypeScript: pass/fail, short-id matches: list or 0, test-expect heuristic: list or 0, JSDoc missing: list or 0).
|
|
73
|
+
- If any issue can't be safely fixed automatically, include a TODO comment at the top of the changed file and a one-line explanation in the patch.
|
|
74
|
+
|
|
75
|
+
- A runnable patch or new file content that follows the rules above.
|
|
76
|
+
|