diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md deleted file mode 100644 index c360cd2..0000000 --- a/.github/copilot-instructions.md +++ /dev/null @@ -1,48 +0,0 @@ -# BlueprintPi Copilot Instructions - -## Project Overview -BlueprintPi is a React-based web application for analyzing Balatro seeds, specifically focusing on seed filtering and visualization. It is a fork of the original Blueprint project, emphasizing experimental features and the "JAML" (Joker Analysis Markup Language) system. - -## Tech Stack -- **Framework**: React 18+ (Functional Components, Hooks) -- **Language**: TypeScript (Strict mode preferred) -- **UI Library**: Mantine v8 (@mantine/core, @mantine/hooks, etc.) -- **Icons**: @tabler/icons-react -- **State Management**: Zustand, React Query (@tanstack/react-query) -- **Build Tool**: Vite -- **Testing**: Vitest -- **Data Serialization**: JAML (YAML-based) using `js-yaml` -- **Engine**: WASM via `motely-wasm` - -## Coding Standards -- **Components**: Use functional components with arrow functions. Prefer Mantine components over raw HTML. -- **Styling**: Use Mantine's style props, `className` with CSS Modules (`.module.scss` or `.module.css`), or Mantine's theme system. -- **Type Safety**: Always define interfaces or types for props and data models. Use the predefined enums and types in `src/modules/balatrots/enum/`. -- **State**: Use specialized providers in `src/modules/state/` (e.g., `optionsProvider.tsx`, `analysisResultProvider.tsx`) or Zustand stores in `src/modules/state/store.ts`. -- **Naming**: - - Components: PascalCase (e.g., `JamlEditor.tsx`) - - Hooks: `use` prefix (e.g., `useJamlSearch.ts`) - - Modules: camelCase or kebab-case - -## Domain Knowledge (Balatro / JAML) -- **Seeds**: 8-character strings (e.g., `2K9H9HN`). -- **JAML**: A YAML-based DSL for defining filters for Balatro seeds. It includes sections like `name`, `author`, `deck`, `stake`, `must`, `should`, and `seeds`. -- **Search Modes**: - - `quick`: Search a specific number of seeds (1k, 100k, etc.) or a single seed. - - `sequential`: Search between a range of seeds. - - `funny`: Specialized searches for palindromes or keywords. -- **Antes/Packs**: The game is structured in Antes (1-8 typically). Shops contain booster packs and shop slots. -- **WASM**: Seed analysis is often performed using WebAssembly (`motely-wasm`) with configurable thread counts and batch sizes. - -## File Structure -- `src/components/blueprint/`: Core UI divided by view types (`jamlView`, `simpleView`, `snapshotView`, `standardView`). -- `src/modules/balatrots/`: Core logic for Balatro game mechanics and analysis. -- `src/modules/state/`: Context providers and global state stores. -- `src/themes/`: Custom Mantine themes (e.g., `Goomy.ts`, `Sylveon.ts`). - -## Guidelines for Copilot -- When suggesting UI changes, prioritize Mantine v8 components and patterns. -- When working with JAML, respect the YAML structure and the `JAML_PRESETS` defined in the project. -- If modifying game logic, refer to `src/modules/balatrots/` for existing enums and types to ensure consistency. -- Maintain the "experimental" and "performance-focused" nature of the JAML search implementation. -- Use `lucide-react` or `@tabler/icons-react` for icons as per existing patterns. diff --git a/CLAUDE.md b/CLAUDE.md index a062a29..65a36da 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,7 +17,6 @@ ## motely-wasm - v11+ is NativeAOT-LLVM, single-threaded, no SharedArrayBuffer needed, no COI serviceworker. - Boot once on mount. Don't boot again. -- Import directly: `import motely, { MotelyWasm, MotelyWasmEvents } from "motely-wasm"` ## React - Modern React patterns only. No unnecessary refs, useCallback chains, or setState-in-effects. diff --git a/___tests___/jamlDocument.spec.ts b/___tests___/jamlDocument.spec.ts deleted file mode 100644 index ae56d96..0000000 --- a/___tests___/jamlDocument.spec.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { load } from "js-yaml"; -import { describe, expect, it } from "vitest"; -import { documentLooksLikeSeedBundle, parseJamlDocument } from "../src/modules/jamlDocumentParse"; -import { parseSeedList } from "../src/modules/state/store"; - -describe("parseJamlDocument", () => { - it("splits filter clauses from a seeds list and reads deck/stake", () => { - const doc = parseJamlDocument(`name: demo -deck: Ghost -stake: White -must: - - tag: NegativeTag - antes: [1] -seeds: - - ALEEB - - PIROCKS -`); - expect(doc.name).toBe("demo"); - expect(doc.deck).toBe("Ghost"); - expect(doc.stake).toBe("White"); - expect(doc.seeds).toEqual(["ALEEB", "PIROCKS"]); - expect(doc.filterJaml).toContain("must:"); - expect(doc.filterJaml).not.toMatch(/^seeds:/m); - }); - - it("feeds parseSeedList for whole JAML uploads", () => { - const text = `deck: Red -stake: White -must: - - joker: Any - antes: [1] -seeds: - - WEEJOKER - - ALEEB -`; - expect(parseSeedList(text)).toEqual(["WEEJOKER", "ALEEB"]); - }); -}); - -describe("simpleCola fixture", () => { - it("loads 46,210 seeds without keeping them in the filter body", () => { - const alphabet = "123456789ABCDEFGHIJKLMNPQRSTUVWXYZ"; - const seeds = Array.from({ length: 46210 }, (_, i) => { - let n = i, out = ""; - for (let k = 0; k < 8; k++) { out += alphabet[n % alphabet.length]; n = Math.floor(n / alphabet.length); } - return out; - }); - const text = `name: simpleCola\ndeck: Ghost\nstake: White\nmust:\n - joker: DietCola\n antes: [1, 2]\nseeds:\n${seeds.map((x) => ` - ${x}`).join("\n")}\n`; - const started = performance.now(); - const doc = parseJamlDocument(text); - const elapsed = performance.now() - started; - expect(doc.seeds).toHaveLength(46210); - expect(doc.deck).toBe("Ghost"); - expect(doc.stake).toBe("White"); - expect(doc.filterJaml).toContain("simpleCola"); - expect(doc.filterJaml).not.toMatch(/^seeds:/m); - expect(elapsed).toBeLessThan(5000); - }); -}); - -describe("JSON filter", () => { - it("reads seeds, deck and stake off a JSON document and keeps the rest as the filter", () => { - const text = JSON.stringify({ name: "cola", deck: "Ghost", stake: "White", must: [{ joker: "DietCola", antes: [1] }], seeds: ["WEEJOKER", "aleeb"] }); - const doc = parseJamlDocument(text); - expect(doc.seeds).toEqual(["WEEJOKER", "ALEEB"]); - expect(doc.deck).toBe("Ghost"); - expect(doc.stake).toBe("White"); - expect(doc.name).toBe("cola"); - expect(load(doc.filterJaml)).toEqual({ name: "cola", deck: "Ghost", stake: "White", must: [{ joker: "DietCola", antes: [1] }] }); - }); - - it("is detected as a seed bundle", () => { - expect(documentLooksLikeSeedBundle(JSON.stringify({ must: [], seeds: ["ALEEB"] }))).toBe(true); - expect(documentLooksLikeSeedBundle(JSON.stringify({ must: [{ joker: "Blueprint" }] }))).toBe(false); - }); -}); diff --git a/index.html b/index.html index 2f96f90..452aa2e 100644 --- a/index.html +++ b/index.html @@ -63,7 +63,7 @@
- +