refactor: trim over-engineering (ponytail-audit)
- ws → devDependencies (src uses type-only; runtime comes via @fastify/websocket) - delete bot/index.ts barrel; import casual-brain/driver directly - untrack tsconfig.tsbuildinfo (already gitignored) - vanillaCandidates: push-loop → .map() 94 tests pass, build clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
"fastify": "^5.2.0",
|
"fastify": "^5.2.0",
|
||||||
"js-chess-engine": "^2.4.6",
|
"js-chess-engine": "^2.4.6",
|
||||||
"pino": "^9.5.0",
|
"pino": "^9.5.0",
|
||||||
"ws": "^8.18.0",
|
|
||||||
"zod": "^3.24.0"
|
"zod": "^3.24.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -28,6 +27,7 @@
|
|||||||
"pino-pretty": "^11.3.0",
|
"pino-pretty": "^11.3.0",
|
||||||
"tsx": "^4.19.2",
|
"tsx": "^4.19.2",
|
||||||
"typescript": "^5.6.0",
|
"typescript": "^5.6.0",
|
||||||
"vitest": "^3.0.0"
|
"vitest": "^3.0.0",
|
||||||
|
"ws": "^8.18.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,7 @@ function vanillaCandidates(game: Game, color: Color): CandidateMove[] {
|
|||||||
const moves = game.chess.moves({ verbose: true }) as Array<{
|
const moves = game.chess.moves({ verbose: true }) as Array<{
|
||||||
from: Square; to: Square; promotion?: PromotionType;
|
from: Square; to: Square; promotion?: PromotionType;
|
||||||
}>;
|
}>;
|
||||||
const out: CandidateMove[] = [];
|
return moves.map((m) => ({ from: m.from, to: m.to, promotion: m.promotion }));
|
||||||
for (const m of moves) {
|
|
||||||
out.push({ from: m.from, to: m.to, promotion: m.promotion });
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function blindCandidates(game: Game, color: Color): CandidateMove[] {
|
function blindCandidates(game: Game, color: Color): CandidateMove[] {
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
export type {
|
|
||||||
Brain, BrainInput, BrainAction, BrainInitArgs,
|
|
||||||
CandidateMove, AttemptHistoryEntry,
|
|
||||||
} from './brain.js';
|
|
||||||
export { CasualBrain } from './casual-brain.js';
|
|
||||||
export { BotDriver } from './driver.js';
|
|
||||||
export { legalCandidates } from './candidates.js';
|
|
||||||
@@ -12,7 +12,8 @@ import {
|
|||||||
} from './games.js';
|
} from './games.js';
|
||||||
import { attachSocket } from './ws.js';
|
import { attachSocket } from './ws.js';
|
||||||
import { createGameSchema } from './validation.js';
|
import { createGameSchema } from './validation.js';
|
||||||
import { CasualBrain, BotDriver } from './bot/index.js';
|
import { CasualBrain } from './bot/casual-brain.js';
|
||||||
|
import { BotDriver } from './bot/driver.js';
|
||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import {
|
|||||||
} from '../../src/games.js';
|
} from '../../src/games.js';
|
||||||
import { attachSocket } from '../../src/ws.js';
|
import { attachSocket } from '../../src/ws.js';
|
||||||
import { createGameSchema } from '../../src/validation.js';
|
import { createGameSchema } from '../../src/validation.js';
|
||||||
import { CasualBrain, BotDriver } from '../../src/bot/index.js';
|
import { CasualBrain } from '../../src/bot/casual-brain.js';
|
||||||
|
import { BotDriver } from '../../src/bot/driver.js';
|
||||||
import type { ServerMessage } from '@blind-chess/shared';
|
import type { ServerMessage } from '@blind-chess/shared';
|
||||||
|
|
||||||
let app: ReturnType<typeof Fastify>;
|
let app: ReturnType<typeof Fastify>;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
{"root":["./src/commit.ts","./src/games.ts","./src/ratelimit.ts","./src/server.ts","./src/state.ts","./src/translator.ts","./src/validation.ts","./src/view.ts","./src/ws.ts"],"version":"5.9.3"}
|
|
||||||
Generated
+3
-3
@@ -63,9 +63,6 @@ importers:
|
|||||||
pino:
|
pino:
|
||||||
specifier: ^9.5.0
|
specifier: ^9.5.0
|
||||||
version: 9.14.0
|
version: 9.14.0
|
||||||
ws:
|
|
||||||
specifier: ^8.18.0
|
|
||||||
version: 8.20.0
|
|
||||||
zod:
|
zod:
|
||||||
specifier: ^3.24.0
|
specifier: ^3.24.0
|
||||||
version: 3.25.76
|
version: 3.25.76
|
||||||
@@ -88,6 +85,9 @@ importers:
|
|||||||
vitest:
|
vitest:
|
||||||
specifier: ^3.0.0
|
specifier: ^3.0.0
|
||||||
version: 3.2.4(@types/node@22.19.17)(tsx@4.21.0)
|
version: 3.2.4(@types/node@22.19.17)(tsx@4.21.0)
|
||||||
|
ws:
|
||||||
|
specifier: ^8.18.0
|
||||||
|
version: 8.20.0
|
||||||
|
|
||||||
packages/shared:
|
packages/shared:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user