Initialize project structure with core files, environment settings, and basic configurations

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-23 17:19:55 -04:00
commit 14a07bca7a
12 changed files with 622 additions and 0 deletions

8
charactergarden/.env Normal file
View File

@@ -0,0 +1,8 @@
NODE_ENV=development
APP_PORT=3000
FRONTEND_PORT=5173
DB_PATH=/data/sqlite/app.db
# Optional — only needed when running with the llm profile
OLLAMA_URL=http://ollama:11434
OLLAMA_MODEL=llama3

View File

@@ -0,0 +1,11 @@
# Copy this file to .env and adjust values as needed.
# Never commit .env — it is gitignored.
NODE_ENV=development
APP_PORT=3000
FRONTEND_PORT=5173
DB_PATH=/data/sqlite/app.db
# Optional — only required when running with: docker compose --profile llm up
OLLAMA_URL=http://ollama:11434
OLLAMA_MODEL=llama3

33
charactergarden/.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
# ── Dependencies ────────────────────────────────────────────
node_modules/
# ── TypeScript build output ──────────────────────────────────
app/dist/
frontend/dist/
# ── Vite cache ───────────────────────────────────────────────
frontend/.vite/
# ── SQLite database (keep the directory, not the data) ───────
data/sqlite/*.db
data/sqlite/*.db-shm
data/sqlite/*.db-wal
# ── Environment — commit .env.example, never .env ────────────
.env
.env.local
.env.*.local
# ── Docker volumes / build context artifacts ─────────────────
.docker/
# ── OS noise ─────────────────────────────────────────────────
.DS_Store
Thumbs.db
desktop.ini
# ── Editor noise ─────────────────────────────────────────────
.vscode/settings.json
.idea/
*.suo
*.user

View File

@@ -0,0 +1,22 @@
{
"name": "charactergarden-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "ts-node-dev --respawn src/index.ts",
"build": "tsc",
"start": "node dist/index.js"
},
"dependencies": {
"fastify": "^4.28.1",
"better-sqlite3": "^9.6.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.11",
"@types/node": "^20.14.0",
"@types/uuid": "^9.0.8",
"ts-node-dev": "^2.0.0",
"typescript": "^5.4.5"
}
}

View File

@@ -0,0 +1,76 @@
// Core contracts — DO NOT modify without updating project.md
// ── Section 2.1 ─────────────────────────────────────────────
export interface Entity {
id: string;
type: string;
name: string;
attributes: Record<string, unknown>;
}
// ── Section 2.2 ─────────────────────────────────────────────
export const ALLOWED_VERBS = [
"move",
"open",
"close",
"take",
"drop",
"use",
"inspect",
"speak",
] as const;
export type Verb = (typeof ALLOWED_VERBS)[number];
export interface Action {
actor: string; // entity id
verb: Verb;
target?: string; // entity id
params?: Record<string, unknown>;
}
// ── Section 2.3 ─────────────────────────────────────────────
export interface ValidationResult {
accepted: Action[];
rejected: { action: Action; reason: string }[];
state_changes: StateChange[];
}
// ── Section 2.4 ─────────────────────────────────────────────
export interface StateChange {
entity_id: string;
field: string;
old_value: unknown;
new_value: unknown;
}
// ── Section 2.5 ─────────────────────────────────────────────
export interface GameEvent {
id: string;
turn: number;
action: Action;
result: "success" | "fail";
timestamp: number;
}
// ── Section 4 — Memory types ─────────────────────────────────
export interface Turn {
id: string;
turn: number;
input: string;
output: string;
timestamp: number;
}
export interface Belief {
entity_id: string;
claim: string;
confidence: number;
}
export interface Summary {
id: string;
turn_range: [number, number];
text: string;
timestamp: number;
}

View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "commonjs",
"lib": ["ES2022"],
"outDir": "dist",
"rootDir": "src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}

View File

@@ -0,0 +1 @@
# sqlite data directory — tracked by git, contents ignored

View File

@@ -0,0 +1,34 @@
version: "3.9"
services:
app:
build: ./app
ports:
- "${APP_PORT:-3000}:3000"
environment:
- NODE_ENV=${NODE_ENV:-development}
- DB_PATH=/data/sqlite/app.db
- OLLAMA_URL=${OLLAMA_URL:-http://ollama:11434}
volumes:
- ./data:/data
depends_on:
- ollama
frontend:
build: ./frontend
ports:
- "${FRONTEND_PORT:-5173}:5173"
depends_on:
- app
ollama:
image: ollama/ollama:latest
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
profiles:
- llm
volumes:
ollama_data:

View File

@@ -0,0 +1,21 @@
{
"name": "charactergarden-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.4.5",
"vite": "^5.3.1"
}
}