Skip to content

KyleBlankRollins/meowzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

159 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Meowzer

A complete system for creating autonomous, animated cats on the web.

๐Ÿ—๏ธ System Architecture

graph TB
    subgraph "User Interface"
        USER[Developer/User]
    end

    subgraph "High-Level API"
        SDK[Meowzer SDK<br/>Integration Layer]
    end

    subgraph "Core Libraries"
        MEOWKIT[Meowkit<br/>Cat Creation]
        MEOWTION[Meowtion<br/>Animation & Movement]
        MEOWBRAIN[Meowbrain<br/>AI Behavior]
        MEOWBASE[Meowbase<br/>IndexedDB Storage]
    end

    subgraph "Data"
        PROTOCAT[ProtoCat<br/>Cat Definition]
        CAT[Cat Instance<br/>Animated Sprite]
        BRAIN[Brain Instance<br/>Decision Engine]
    end

    USER -->|meowzer.cats.create| SDK

    SDK -->|buildCat| MEOWKIT
    SDK -->|animateCat| MEOWTION
    SDK -->|createBrain| MEOWBRAIN
    SDK -->|save/load| MEOWBASE

    MEOWKIT -->|generates| PROTOCAT
    MEOWTION -->|creates| CAT
    MEOWBRAIN -->|creates| BRAIN

    PROTOCAT -->|used by| MEOWTION
    CAT -->|controlled by| BRAIN

    MEOWBASE -->|stores| PROTOCAT

    style SDK fill:#ff9500
    style MEOWKIT fill:#4a9eff
    style MEOWTION fill:#50c878
    style MEOWBRAIN fill:#da70d6
    style MEOWBASE fill:#ffd700
Loading

๐Ÿ“ฆ Packages

SDK (Meowzer)

High-level API that orchestrates all libraries. Provides a class-based interface for cat creation and management.

Key Features:

  • Unified Meowzer class with manager pattern
  • Cat lifecycle management via meowzer.cats manager
  • Storage operations via meowzer.storage manager
  • Interaction system via meowzer.interactions manager
  • Plugin system for extensibility

Meowkit (Cat Creation)

Transforms user settings into structured cat data with SVG sprites.

Key Features:

  • Procedural pixel-art SVG generation
  • Seed-based cat serialization (shareable cat codes)
  • Builder pattern for controlled creation
  • Zero dependencies for sprite generation

Meowtion (Animation & Movement)

Brings cat sprites to life with animations and physics.

Key Features:

  • GSAP-based state animations (idle, walking, running, sitting, sleeping, playing)
  • Smooth movement with curved path following
  • Physics simulation (velocity, friction, boundaries)
  • Modular architecture (DOM, movement, physics modules)

Meowbrain (AI Behavior)

Autonomous decision-making for lifelike cat behavior.

Key Features:

  • Personality-driven behavior (6 presets: lazy, playful, curious, aloof, energetic, balanced)
  • Motivation system (rest, stimulation, exploration)
  • 5 behavior types (wandering, resting, playing, observing, exploring)
  • Decision engine with weighted behavior selection

Meowbase (IndexedDB Storage)

Document database for persisting cat collections.

Key Features:

  • Document-based collections stored in IndexedDB
  • LRU cache with automatic eviction
  • Full CRUD operations for collections and cats
  • Sample dataset for learning and demos
  • Result pattern for consistent error handling

๐Ÿš€ Quick Start

// Initialize Meowzer
import { Meowzer } from "meowzer";

const meowzer = new Meowzer();
await meowzer.init();

// Simple: Create a random cat
const cat = await meowzer.cats.create();
// Cat automatically appears on the page!

// Advanced: Full control
const customCat = await meowzer.cats.create({
  name: "Whiskers",
  description: "A playful orange tabby",
  settings: {
    color: "#FF9500",
    eyeColor: "#00FF00",
    pattern: "tabby",
    size: "medium",
    furLength: "short",
  },
});

// Set personality
customCat.setPersonality("playful");

// Management
const allCats = meowzer.cats.getAll();
await meowzer.cats.destroyAll(); // Clean up when done

๐Ÿ“Š Data Flow

sequenceDiagram
    participant User
    participant Meowzer
    participant Meowkit
    participant Meowtion
    participant Meowbrain

    User->>Meowzer: meowzer.cats.create(options)
    Meowzer->>Meowkit: buildCat(settings)
    Meowkit-->>Meowzer: ProtoCat (id, seed, SVG, appearance)

    Meowzer->>Meowtion: new Cat(protoCat)
    Meowtion-->>Meowzer: Cat instance (animated sprite)

    Meowzer->>Meowbrain: new Brain(cat)
    Meowbrain-->>Meowzer: Brain instance

    Meowzer-->>User: MeowzerCat (unified interface)

    User->>Meowzer: cat.lifecycle.resume()
    Meowzer->>Meowbrain: brain.start()

    loop Decision Loop
        Meowbrain->>Meowbrain: Calculate motivations
        Meowbrain->>Meowbrain: Choose behavior
        Meowbrain->>Meowtion: Execute movement
    end
Loading

๐Ÿ—‚๏ธ Repository Structure

meowzer/
โ”œโ”€โ”€ meowzer/                  # Monorepo root for packages
โ”‚   โ”œโ”€โ”€ meowkit/             # Cat creation library
โ”‚   โ”‚   โ”œโ”€โ”€ builder.ts
โ”‚   โ”‚   โ”œโ”€โ”€ validation.ts
โ”‚   โ”‚   โ”œโ”€โ”€ serialization.ts
โ”‚   โ”‚   โ”œโ”€โ”€ svg-generator.ts
โ”‚   โ”‚   โ””โ”€โ”€ color-utils.ts
โ”‚   โ”œโ”€โ”€ meowtion/            # Animation library
โ”‚   โ”‚   โ”œโ”€โ”€ cat.ts
โ”‚   โ”‚   โ”œโ”€โ”€ state-machine.ts
โ”‚   โ”‚   โ”œโ”€โ”€ animations/
โ”‚   โ”‚   โ””โ”€โ”€ cat/
โ”‚   โ”‚       โ”œโ”€โ”€ dom.ts
โ”‚   โ”‚       โ”œโ”€โ”€ movement.ts
โ”‚   โ”‚       โ””โ”€โ”€ physics.ts
โ”‚   โ”œโ”€โ”€ meowbrain/           # AI behavior library
โ”‚   โ”‚   โ”œโ”€โ”€ brain.ts
โ”‚   โ”‚   โ”œโ”€โ”€ decision-engine.ts
โ”‚   โ”‚   โ”œโ”€โ”€ behaviors.ts
โ”‚   โ”‚   โ”œโ”€โ”€ personality.ts
โ”‚   โ”‚   โ””โ”€โ”€ behavior-orchestrator.ts
โ”‚   โ”œโ”€โ”€ meowbase/            # IndexedDB storage
โ”‚   โ”‚   โ”œโ”€โ”€ meowbase.ts
โ”‚   โ”‚   โ”œโ”€โ”€ collections/
โ”‚   โ”‚   โ”œโ”€โ”€ cats/
โ”‚   โ”‚   โ””โ”€โ”€ storage/
โ”‚   โ”œโ”€โ”€ sdk/                 # Integration layer (package: "meowzer")
โ”‚   โ”‚   โ”œโ”€โ”€ meowzer-sdk.ts
โ”‚   โ”‚   โ”œโ”€โ”€ meowzer-cat.ts
โ”‚   โ”‚   โ”œโ”€โ”€ managers/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ cat-manager.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ storage-manager.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ interaction-manager.ts
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ hook-manager.ts
โ”‚   โ”‚   โ”œโ”€โ”€ interactions/
โ”‚   โ”‚   โ””โ”€โ”€ cat-modules/
โ”‚   โ”œโ”€โ”€ ui/                  # Web components library
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ providers/
โ”‚   โ”‚   โ””โ”€โ”€ controllers/
โ”‚   โ”œโ”€โ”€ types/               # Shared TypeScript types
โ”‚   โ””โ”€โ”€ utilities/
โ”‚       โ””โ”€โ”€ event-emitter.ts # Shared event system
โ”œโ”€โ”€ docs/                    # Documentation website (Astro + Starlight)
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ””โ”€โ”€ content/
โ”œโ”€โ”€ demo/                    # Demo website (Astro)
โ””โ”€โ”€ meta/                    # Project documentation
    โ””โ”€โ”€ *.md

## ๐Ÿ› ๏ธ Development

### Initial Setup

From the root directory:

```bash
npm install  # Installs all dependencies using npm workspaces

Running Tests

Each package has its own test suite:

cd meowzer/meowkit && npm test
cd meowzer/meowtion && npm test
cd meowzer/meowbrain && npm test
cd meowzer/meowbase && npm test
cd meowzer/meowzer && npm test

Running the Docs Site

cd docs
npm run dev      # Start dev server at http://localhost:5173
npm run build    # Build for production
npm run preview  # Preview production build

๏ฟฝ Documentation

Each package has comprehensive documentation:

๐ŸŽฏ Use Cases

  • Interactive Websites: Add autonomous cats to engage visitors
  • Games: Create cat characters with unique personalities
  • Learning Tool: Study AI decision-making and animation systems
  • Art Projects: Generate and share unique cat designs via seeds
  • Demos: Showcase web technologies (IndexedDB, SVG, animations)

๐Ÿ›๏ธ Architecture Principles

  1. Modular Design: Each library has a single, focused responsibility
  2. Layered Abstraction: Low-level libraries (Meowkit) โ†’ High-level API (Meowzer)
  3. Type Safety: Full TypeScript with comprehensive type definitions
  4. Zero Config: Sensible defaults, optional customization
  5. Event-Driven: Shared EventEmitter for reactive programming
  6. Testable: Pure functions, dependency injection, comprehensive tests

๏ฟฝ Workspace Commands

The root package.json provides convenient scripts:

  • npm run dev:docs - Start docs development server
  • npm run build:docs - Build docs for production
  • npm run dev:demo - Start demo development server
  • npm run build:demo - Build demo for production
  • npm run build:sdk - Build SDK package
  • npm run build:ui - Build UI components package
  • npm run build - Build both SDK and UI packages

๐Ÿ“– Documentation

๐Ÿงช Testing

Each package has its own test suite using Vitest:

cd meowzer/meowkit && npm test
cd meowzer/meowtion && npm test
cd meowzer/meowbrain && npm test
cd meowzer/meowbase && npm test
cd meowzer/sdk && npm test
cd meowzer/ui && npm test

๐Ÿ“ License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

โšก