Skip to content

Commit be5f198

Browse files
committed
add claude.md and .claudignore
1 parent 05c2908 commit be5f198

2 files changed

Lines changed: 228 additions & 0 deletions

File tree

.claudeignore

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Build artifacts and cache
2+
target/
3+
.snfoundry_cache/
4+
build/
5+
out/
6+
7+
# Lock files (usually auto-generated)
8+
Scarb.lock
9+
*.lock
10+
11+
# Test artifacts
12+
snfoundry_trace/
13+
coverage/
14+
*.coverage
15+
*.profraw
16+
*.profdata
17+
18+
# IDE and editor files
19+
.vscode/
20+
.idea/
21+
*.swp
22+
*.swo
23+
*~
24+
.DS_Store
25+
26+
# Logs and temporary files
27+
*.log
28+
*.tmp
29+
*.temp
30+
logs/
31+
tmp/
32+
temp/
33+
34+
# Large binary files
35+
*.bin
36+
*.dat
37+
*.db
38+
*.sqlite
39+
40+
41+
# Documentation build outputs
42+
docs/_build/
43+
docs/build/
44+
site/
45+
46+
# Environment files (may contain secrets)
47+
.env
48+
.env.*
49+
!.env.example
50+
51+
# Manifest files in contracts and client directory
52+
contracts/manifest_*.json
53+
client/manifest_*.json
54+
55+
# Compiled or minified files
56+
*.min.js
57+
*.min.css
58+
dist/
59+
60+
# Node.js dependencies
61+
node_modules/
62+
**/node_modules/
63+
pnpm-lock.yaml
64+
yarn.lock
65+
package-lock.json
66+
67+
# Cairo/Starknet compilation artifacts
68+
*.sierra
69+
*.sierra.json
70+
*.casm
71+
*.casm.json
72+
73+
# Vite dev server
74+
.vite/
75+
vite.config.js.timestamp-*
76+
*.hot-update.json
77+
*.hot-update.js
78+
79+
# Large asset files
80+
client/src/assets/*
81+
client/public/banner.png
82+
83+
# Git internal files
84+
.git/objects/
85+
.git/lfs/
86+
87+
# Deployment files
88+
app.yaml
89+
90+
# Cache directories
91+
.cache/
92+
.parcel-cache/
93+
.turbo/
94+
.vercel/
95+
96+
# Test outputs
97+
test-results/
98+
playwright-report/
99+
htmlcov/
100+
.coverage/
101+
*.lcov
102+
103+
# Torii configuration
104+
torii*.toml

CLAUDE.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Dark Shuffle is a deck-building game built on Starknet. It uses:
8+
- **Frontend**: React 18 + Vite + Material-UI
9+
- **Smart Contracts**: Cairo 2.10.1 with Dojo Engine v1.5.0
10+
- **Blockchain**: Starknet Layer 2
11+
12+
## Essential Commands
13+
14+
### Local Development
15+
16+
**Start the full development environment:**
17+
```bash
18+
# Terminal 1: Start local blockchain (Katana)
19+
./scripts/contracts.sh
20+
21+
# Terminal 2: Start indexer (Torii) - wait for Katana to be ready
22+
./scripts/indexer.sh
23+
24+
# Terminal 3: Start frontend
25+
./scripts/client.sh
26+
```
27+
28+
### Frontend Commands (run from `client/` directory)
29+
```bash
30+
pnpm install # Install dependencies
31+
pnpm dev # Start dev server (with --force flag)
32+
pnpm build # Production build
33+
pnpm lint # Run ESLint
34+
pnpm preview # Preview production build
35+
```
36+
37+
### Smart Contract Commands (run from `contracts/` directory)
38+
```bash
39+
sozo build # Build contracts
40+
sozo test # Run all tests
41+
sozo migrate # Deploy to local Katana
42+
scarb fmt # Format Cairo code
43+
scarb fmt --check # Check formatting (used in CI)
44+
```
45+
46+
### Testing
47+
```bash
48+
# Run a single contract test
49+
sozo test -f test_function_name
50+
51+
# Frontend has no test command defined - check for test files before suggesting tests
52+
```
53+
54+
## Architecture
55+
56+
### Directory Structure
57+
- `client/` - React frontend
58+
- `src/api/` - Blockchain integration (indexer, starknet)
59+
- `src/battle/` - Battle logic and utilities
60+
- `src/components/` - React components
61+
- `src/contexts/` - State management
62+
- `contracts/` - Cairo smart contracts
63+
- `src/models/` - Game data models (ECS entities)
64+
- `src/systems/` - Game logic (ECS systems)
65+
- `src/utils/` - Contract utilities
66+
- `scripts/` - Development and deployment scripts
67+
68+
### Key Concepts
69+
70+
**Dojo Engine**: The game uses Dojo's Entity Component System (ECS) pattern:
71+
- **Models** define game state (entities and components)
72+
- **Systems** implement game logic that modifies state
73+
- **World** is the deployed game instance containing all systems and models
74+
75+
**Game Flow**:
76+
1. Players connect wallet via Cartridge Controller
77+
2. Draft phase: Select cards to build a deck
78+
3. Map navigation: Progress through game stages
79+
4. Battle phase: Turn-based card battles with on-chain logic
80+
5. Achievements: Track player accomplishments
81+
82+
### Important Files
83+
84+
**Entry Points**:
85+
- `client/src/main.jsx` - Frontend entry
86+
- `contracts/dojo_world_sepolia.toml` - Deployment config
87+
- `contracts/src/lib.cairo` - Contract entry
88+
89+
**Game Logic**:
90+
- `contracts/src/systems/draft.cairo` - Card selection
91+
- `contracts/src/systems/battle.cairo` - Combat logic
92+
- `contracts/src/models/game.cairo` - Core game state
93+
94+
**Monster Abilities**: Each creature has unique abilities in:
95+
- `contracts/src/systems/monster_abilities/`
96+
- `client/src/battle/creature/abilities/`
97+
98+
### Development Workflow
99+
100+
1. **Contract Changes**:
101+
- Modify Cairo files
102+
- Run `sozo build` to verify compilation
103+
- Run `sozo test` for affected systems
104+
- Run `scarb fmt` before committing
105+
106+
2. **Frontend Changes**:
107+
- GraphQL queries are generated from `client/src/queries/`
108+
- Card assets are in `client/src/assets/cards/`
109+
- Battle animations use Lottie files in `client/src/assets/animations/`
110+
111+
3. **Adding New Features**:
112+
- Define models in `contracts/src/models/`
113+
- Implement systems in `contracts/src/systems/`
114+
- Update frontend queries and components
115+
- Copy new manifest to client after migration
116+
117+
### Deployment Environments
118+
119+
- **Local**: Katana + Torii (development)
120+
- **Sepolia**: Testnet deployment
121+
- **Mainnet**: Production deployment
122+
- **Slot**: Cartridge infrastructure deployment
123+
124+
Each environment has its own manifest file (`manifest_*.json`) generated after deployment.

0 commit comments

Comments
 (0)