@dcl-regenesislabs/opendcl 0.1.0-22234509684.commit-63dfd19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +234 -0
  2. package/context/components-reference.md +113 -0
  3. package/context/open-source-3d-assets.md +705 -0
  4. package/context/sdk7-complete-reference.md +3684 -0
  5. package/context/sdk7-examples.md +1709 -0
  6. package/dist/index.d.ts +8 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +76 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/scene-context.d.ts +97 -0
  11. package/dist/scene-context.d.ts.map +1 -0
  12. package/dist/scene-context.js +203 -0
  13. package/dist/scene-context.js.map +1 -0
  14. package/dist/utils.d.ts +2 -0
  15. package/dist/utils.d.ts.map +1 -0
  16. package/dist/utils.js +4 -0
  17. package/dist/utils.js.map +1 -0
  18. package/extensions/dcl-context.ts +123 -0
  19. package/extensions/dcl-deploy.ts +89 -0
  20. package/extensions/dcl-header.ts +162 -0
  21. package/extensions/dcl-init.ts +62 -0
  22. package/extensions/dcl-preview.ts +144 -0
  23. package/extensions/dcl-setup-ollama.ts +312 -0
  24. package/extensions/dcl-setup.ts +96 -0
  25. package/extensions/dcl-status.ts +88 -0
  26. package/extensions/dcl-tasks.ts +102 -0
  27. package/extensions/dcl-update-check.ts +79 -0
  28. package/extensions/dcl-validate.ts +80 -0
  29. package/extensions/plan-mode/index.ts +340 -0
  30. package/extensions/plan-mode/utils.ts +168 -0
  31. package/extensions/process-registry.ts +25 -0
  32. package/extensions/scene-utils.ts +31 -0
  33. package/package.json +65 -0
  34. package/prompts/explain.md +16 -0
  35. package/prompts/review.md +19 -0
  36. package/prompts/system.md +126 -0
  37. package/skills/add-3d-models/SKILL.md +115 -0
  38. package/skills/add-interactivity/SKILL.md +176 -0
  39. package/skills/advanced-input/SKILL.md +238 -0
  40. package/skills/advanced-rendering/SKILL.md +235 -0
  41. package/skills/animations-tweens/SKILL.md +173 -0
  42. package/skills/audio-video/SKILL.md +167 -0
  43. package/skills/authoritative-server/SKILL.md +329 -0
  44. package/skills/build-ui/SKILL.md +231 -0
  45. package/skills/camera-control/SKILL.md +199 -0
  46. package/skills/create-scene/SKILL.md +67 -0
  47. package/skills/deploy-scene/SKILL.md +106 -0
  48. package/skills/deploy-worlds/SKILL.md +107 -0
  49. package/skills/lighting-environment/SKILL.md +216 -0
  50. package/skills/multiplayer-sync/SKILL.md +132 -0
  51. package/skills/nft-blockchain/SKILL.md +246 -0
  52. package/skills/optimize-scene/SKILL.md +160 -0
  53. package/skills/player-avatar/SKILL.md +239 -0
  54. package/skills/smart-items/SKILL.md +181 -0
package/README.md ADDED
@@ -0,0 +1,234 @@
1
+ # OpenDCL ๐Ÿงช
2
+
3
+ [![CI](https://github.com/dcl-regenesislabs/opendcl/actions/workflows/ci.yaml/badge.svg)](https://github.com/dcl-regenesislabs/opendcl/actions/workflows/ci.yaml)
4
+
5
+ AI coding assistant for Decentraland SDK7 scene development.
6
+
7
+ OpenDCL is a terminal-based AI agent that understands Decentraland's SDK, components, and patterns out of the box. It helps creators โ€” from beginners to experienced developers โ€” build interactive 3D scenes faster using natural language.
8
+
9
+ ## Features
10
+
11
+ - **Branded header** โ€” on startup, displays a block-character "Decentraland" ASCII art banner with version and working directory. Falls back to a compact text header on narrow terminals
12
+ - **Multi-provider LLM support** โ€” works with Claude, OpenAI, Google, Ollama (free/local), OpenRouter, and more
13
+ - **Scene-aware** โ€” automatically detects your project's `scene.json`, SDK version, and entry points
14
+ - **18 built-in skills** โ€” scaffolding, 3D models, interactivity, UI, animations, multiplayer, authoritative server, audio/video, deployment (Genesis City & Worlds), optimization, smart items, camera control, lighting, player/avatar, NFT/blockchain, advanced rendering, advanced input
15
+ - **Integrated commands** โ€” `/init` to scaffold, `/preview` to launch the dev server, `/tasks` to manage running processes, `/review` to audit code
16
+ - **TypeScript validation** โ€” catches type errors immediately after writing code
17
+ - **Free 3D asset catalog** โ€” 900+ CC0-licensed models the agent can suggest and help you use
18
+ - **Session persistence** โ€” pick up where you left off across sessions
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ # Install
24
+ npm install -g @dcl-regenesislabs/opendcl
25
+
26
+ # Run in any directory
27
+ opendcl
28
+ ```
29
+
30
+ On first run, type `/setup` to configure a cloud API provider (Anthropic, OpenAI, Google, etc.) or `/setup-ollama` to install [Ollama](https://ollama.com/) and use a free local model.
31
+
32
+ ### In an Empty Folder
33
+
34
+ ```
35
+ $ opendcl
36
+ > Create a medieval tavern scene with a bar, tables, and a fireplace
37
+ ```
38
+
39
+ OpenDCL will scaffold `scene.json`, `package.json`, `tsconfig.json`, and `src/index.ts` with your scene.
40
+
41
+ ### In an Existing Scene
42
+
43
+ ```
44
+ $ cd my-scene/
45
+ $ opendcl
46
+ > Add a click handler to the door that opens it with an animation
47
+ ```
48
+
49
+ OpenDCL reads your scene context and modifies existing code without overwriting it.
50
+
51
+ ## Use with Any AI Agent
52
+
53
+ Install just the skills into your preferred AI coding agent โ€” no opendcl installation required:
54
+
55
+ ```bash
56
+ # Install all Decentraland skills (Claude Code, Cursor, Codex, Windsurf, and 35+ more)
57
+ npx skills add dcl-regenesislabs/opendcl
58
+
59
+ # List available skills first
60
+ npx skills add dcl-regenesislabs/opendcl --list
61
+
62
+ # Install specific skills only
63
+ npx skills add dcl-regenesislabs/opendcl --skill create-scene --skill multiplayer-sync
64
+
65
+ # Install globally (available in all projects)
66
+ npx skills add dcl-regenesislabs/opendcl -g
67
+ ```
68
+
69
+ This uses the open [skills](https://github.com/vercel-labs/skills) CLI to copy SKILL.md files into your agent's skills directory.
70
+
71
+ > **Note:** The full OpenDCL agent adds auto TypeScript validation, scene context detection, and slash commands (`/preview`, `/init`, `/deploy`) on top of these skills.
72
+
73
+ ## Commands
74
+
75
+ | Command | Description |
76
+ |---------|-------------|
77
+ | `/setup` | Configure a cloud API provider (Anthropic, OpenAI, Google, etc.) |
78
+ | `/setup-ollama` | Install Ollama and configure a free local LLM model |
79
+ | `/init` | Scaffold a new Decentraland scene in the current directory |
80
+ | `/preview` | Start the Bevy-web preview server and open the scene in browser |
81
+ | `/deploy` | Deploy the scene to Genesis City or a World (auto-detects from scene.json) |
82
+ | `/tasks` | Interactively manage running background processes (preview server, etc.) |
83
+ | `/review` | Review scene code for quality, performance, and SDK7 best practices |
84
+ | `/explain <concept>` | Explain a Decentraland SDK7 concept (e.g., `/explain tweens`) |
85
+
86
+ ## Skills
87
+
88
+ OpenDCL loads domain-specific skills on demand based on what you're asking:
89
+
90
+ | Skill | Triggered when you want to... |
91
+ |-------|-------------------------------|
92
+ | `create-scene` | Start a new project, scaffold files |
93
+ | `add-3d-models` | Load .glb models, browse free asset catalog |
94
+ | `add-interactivity` | Add click handlers, hover effects, triggers |
95
+ | `build-ui` | Create HUDs, menus, buttons with React-ECS |
96
+ | `animations-tweens` | Animate objects, play GLTF animations |
97
+ | `multiplayer-sync` | Sync state between players |
98
+ | `authoritative-server` | Server-authoritative multiplayer with anti-cheat, storage, env vars |
99
+ | `audio-video` | Add sounds, music, video screens |
100
+ | `deploy-scene` | Publish to Genesis City (LAND-based) |
101
+ | `deploy-worlds` | Publish to a World (DCL NAME or ENS domain) |
102
+ | `optimize-scene` | Fix performance, stay within limits |
103
+ | `smart-items` | Use asset pack smart items |
104
+ | `camera-control` | Switch camera modes, cinematic cameras, cutscenes |
105
+ | `lighting-environment` | Add lights, shadows, day/night cycle, glow effects |
106
+ | `player-avatar` | Player data, emotes, attachments, NPC avatars |
107
+ | `nft-blockchain` | Display NFTs, wallet checks, smart contracts |
108
+ | `advanced-rendering` | Billboards, 3D text, materials, transparency |
109
+ | `advanced-input` | Cursor state, movement restriction, WASD patterns |
110
+
111
+ ## How It Works
112
+
113
+ OpenDCL is built on [pi-coding-agent](https://github.com/badlogic/pi-mono), the agent engine behind [OpenClaw](https://github.com/openclaw/openclaw). It adds Decentraland-specific:
114
+
115
+ - **System prompt** with SDK7 architecture knowledge (ECS, QuickJS sandbox, parcel constraints)
116
+ - **Extensions** that detect your project, inject context, validate TypeScript, and provide slash commands
117
+ - **Skills** with detailed guides for every common scene development task
118
+ - **Reference docs** (87KB SDK reference, component tables, code examples, 3D asset catalog)
119
+
120
+ The agent has full access to standard coding tools (read, write, edit, bash, grep, find) and uses them to understand and modify your scene code.
121
+
122
+ ## Project Structure
123
+
124
+ ```
125
+ opendcl/
126
+ โ”œโ”€โ”€ src/
127
+ โ”‚ โ”œโ”€โ”€ index.ts # CLI entry point
128
+ โ”‚ โ””โ”€โ”€ scene-context.ts # Scene detection & context formatting
129
+ โ”œโ”€โ”€ extensions/
130
+ โ”‚ โ”œโ”€โ”€ dcl-context.ts # Auto-detect scene, inject metadata
131
+ โ”‚ โ”œโ”€โ”€ dcl-init.ts # /init command
132
+ โ”‚ โ”œโ”€โ”€ dcl-preview.ts # /preview command
133
+ โ”‚ โ”œโ”€โ”€ dcl-deploy.ts # /deploy command
134
+ โ”‚ โ”œโ”€โ”€ dcl-setup.ts # /setup command (cloud API provider config)
135
+ โ”‚ โ”œโ”€โ”€ dcl-setup-ollama.ts # /setup-ollama command (Ollama setup wizard)
136
+ โ”‚ โ”œโ”€โ”€ dcl-status.ts # Thinking/streaming status (elapsed time + tokens)
137
+ โ”‚ โ”œโ”€โ”€ dcl-update-check.ts # Checks npm for newer OpenDCL versions
138
+ โ”‚ โ”œโ”€โ”€ dcl-validate.ts # Post-write TypeScript validation
139
+ โ”‚ โ”œโ”€โ”€ dcl-tasks.ts # /tasks command (process manager)
140
+ โ”‚ โ””โ”€โ”€ process-registry.ts # Shared background process registry
141
+ โ”œโ”€โ”€ skills/ # 18 SKILL.md files (domain expertise)
142
+ โ”œโ”€โ”€ prompts/ # System prompt + command templates
143
+ โ”œโ”€โ”€ context/ # SDK7 reference docs + asset catalog
144
+ โ””โ”€โ”€ tests/ # Vitest test suites
145
+ ```
146
+
147
+ ## Development
148
+
149
+ ```bash
150
+ # Clone and install
151
+ git clone https://github.com/dcl-regenesislabs/opendcl.git
152
+ cd opendcl
153
+ npm install
154
+
155
+ # Build
156
+ npm run build
157
+
158
+ # Run locally
159
+ node dist/index.js
160
+
161
+ # Run tests
162
+ npm test
163
+
164
+ # Watch mode (rebuild on changes)
165
+ npm run dev
166
+ ```
167
+
168
+ ### Testing
169
+
170
+ Tests are organized into two tiers:
171
+
172
+ - **Unit tests** (`tests/unit/`) โ€” static analysis of file contents, frontmatter, and patterns
173
+ - **Integration tests** (`tests/integration/`) โ€” dynamic imports, mock registration, cross-extension wiring, and process lifecycle verification
174
+
175
+ Integration tests catch wiring bugs (e.g., referencing a nonexistent extension file in `index.ts`) that static analysis alone would miss.
176
+
177
+ ### Adding a Skill
178
+
179
+ Skills are markdown files โ€” no code changes needed:
180
+
181
+ 1. Create `skills/my-skill/SKILL.md`
182
+ 2. Add frontmatter with `name` and `description`
183
+ 3. Write the instructions the agent should follow
184
+
185
+ ```markdown
186
+ ---
187
+ name: my-skill
188
+ description: Brief description of when this skill should be used
189
+ ---
190
+
191
+ # My Skill
192
+
193
+ Instructions for the agent...
194
+ ```
195
+
196
+ The `description` field determines when the agent loads the skill. Make it specific about the user intent it covers.
197
+
198
+ ### Adding Context
199
+
200
+ Drop a `.md` file in `context/` and reference it from your skills. The agent reads context files on demand to avoid bloating the context window.
201
+
202
+ ## LLM Providers
203
+
204
+ OpenDCL supports any provider compatible with pi-coding-agent:
205
+
206
+ | Provider | API Key Env Var | Notes |
207
+ |----------|----------------|-------|
208
+ | Anthropic (Claude) | `ANTHROPIC_API_KEY` | Best quality |
209
+ | OpenAI | `OPENAI_API_KEY` | GPT-4o, o1, etc. |
210
+ | Google | `GOOGLE_API_KEY` | Gemini models |
211
+ | Ollama | โ€” | Free, runs locally |
212
+ | OpenRouter | `OPENROUTER_API_KEY` | Access to many models |
213
+
214
+ Set the environment variable or enter the key on first run. Switch models anytime with `Ctrl+P`.
215
+
216
+ ## Requirements
217
+
218
+ - Node.js >= 18
219
+ - npm
220
+
221
+ ## Contributing
222
+
223
+ Contributions are welcome! The easiest way to contribute is by adding or improving skills:
224
+
225
+ 1. Fork the repository
226
+ 2. Create a new skill in `skills/<name>/SKILL.md`
227
+ 3. Test that the skill loads: `npm test`
228
+ 4. Submit a pull request
229
+
230
+ For bugs and feature requests, please [open an issue](https://github.com/dcl-regenesislabs/opendcl/issues).
231
+
232
+ ## License
233
+
234
+ Apache-2.0
@@ -0,0 +1,113 @@
1
+ # Decentraland SDK7 Components Quick Reference
2
+
3
+ All components are imported from `@dcl/sdk/ecs`.
4
+
5
+ ## Transform & Positioning
6
+
7
+ | Component | Key Fields | Description |
8
+ |-----------|-----------|-------------|
9
+ | **Transform** | `position: Vector3`, `rotation: Quaternion`, `scale: Vector3`, `parent?: Entity` | Position, rotation, and scale of an entity. Parent for hierarchy. |
10
+
11
+ ## 3D Rendering
12
+
13
+ | Component | Key Fields | Description |
14
+ |-----------|-----------|-------------|
15
+ | **MeshRenderer** | Static methods: `setBox()`, `setSphere()`, `setCylinder()`, `setPlane()` | Renders primitive 3D shapes. |
16
+ | **MeshCollider** | Static methods: `setBox()`, `setSphere()`, `setCylinder()`, `setPlane()` | Adds collision geometry for physics/pointer events. |
17
+ | **Material** | Static methods: `setPbrMaterial({ albedoColor, metallic, roughness, texture })`, `setBasicMaterial()` | PBR or unlit material for meshes. |
18
+ | **GltfContainer** | `src: string`, `visibleMeshesCollisionMask?`, `invisibleMeshesCollisionMask?` | Loads a .glb/.gltf 3D model file. |
19
+ | **GltfContainerLoadingState** | `currentState` | Read-only loading state for GLTF models. |
20
+ | **GltfNodeModifiers** | `nodes: Array<{ path, visibleMeshes, invisibleMeshes }>` | Modify visibility of specific nodes in GLTF. |
21
+ | **Billboard** | `billboardMode: BillboardMode` | Makes entity always face the camera. |
22
+ | **VisibilityComponent** | `visible: boolean` | Show/hide entity without removing it. |
23
+ | **NftShape** | `src: string (urn)`, `style?` | Display an NFT artwork frame. |
24
+ | **TextShape** | `text: string`, `fontSize?: number`, `textColor?: Color4`, `font?: Font` | Render 3D text in the scene. |
25
+ | **LightSource** | `type`, `color`, `intensity`, `range`, `innerAngle`, `outerAngle`, `shadows` | Add point, spot, or directional lights. |
26
+
27
+ ## Interaction & Input
28
+
29
+ | Component | Key Fields | Description |
30
+ |-----------|-----------|-------------|
31
+ | **PointerEvents** | `pointerEvents: Array<{ eventType, eventInfo: { button, hoverText, maxDistance } }>` | Define clickable/hoverable areas. Use `pointerEventsSystem.onPointerDown()` helper. |
32
+ | **PointerEventsResult** | Read-only | Results of pointer events (which button, hit point). |
33
+ | **PointerLock** | `isPointerLocked: boolean` | Whether pointer is locked (first-person mode). |
34
+ | **PrimaryPointerInfo** | Read-only | Position and entity of the primary pointer. |
35
+ | **InputModifier** | `mode` | Modify input behavior for the entity. |
36
+ | **Raycast** | `direction`, `maxDistance`, `queryType`, `continuous` | Cast rays for collision detection. |
37
+ | **RaycastResult** | Read-only | Results of a raycast (hits, distances). |
38
+ | **TriggerArea** | `area: { box }`, `layerMask` | Define trigger volumes that detect player entry. |
39
+ | **TriggerAreaResult** | Read-only | Which entities are inside the trigger. |
40
+
41
+ ## Animation & Movement
42
+
43
+ | Component | Key Fields | Description |
44
+ |-----------|-----------|-------------|
45
+ | **Animator** | `states: Array<{ clip, playing, loop, speed, weight }>` | Play animations embedded in GLTF models. |
46
+ | **Tween** | `mode: { move, rotate, scale }`, `duration`, `easingFunction`, `currentTime` | Animate entity properties over time. |
47
+ | **TweenSequence** | `sequence: Array<{ ... }>`, `loop` | Chain multiple tweens together. |
48
+ | **TweenState** | Read-only | Current state of a tween. |
49
+
50
+ ## Audio & Video
51
+
52
+ | Component | Key Fields | Description |
53
+ |-----------|-----------|-------------|
54
+ | **AudioSource** | `audioClipUrl: string`, `playing: boolean`, `loop: boolean`, `volume: number`, `pitch: number` | Play audio clips (.mp3, .ogg, .wav). |
55
+ | **AudioStream** | `url: string`, `playing: boolean`, `volume: number` | Stream audio from a URL. |
56
+ | **AudioEvent** | Read-only | Audio playback events. |
57
+ | **VideoPlayer** | `src: string`, `playing: boolean`, `loop: boolean`, `volume: number`, `playbackRate: number` | Play video on a surface. Requires `Material` with video texture. |
58
+ | **VideoEvent** | Read-only | Video playback events. |
59
+
60
+ ## Player & Avatar
61
+
62
+ | Component | Key Fields | Description |
63
+ |-----------|-----------|-------------|
64
+ | **PlayerIdentityData** | `address: string`, `isGuest: boolean` | Player's wallet address and guest status. |
65
+ | **AvatarShape** | `id: string`, `name: string`, `bodyShape`, `wearables`, `emotes` | Render an avatar (for NPCs). |
66
+ | **AvatarBase** | `skinColor`, `eyeColor`, `hairColor`, `bodyShapeUrn` | Base avatar appearance. |
67
+ | **AvatarAttach** | `avatarId: string`, `anchorPointId` | Attach an entity to a player's avatar. |
68
+ | **AvatarModifierArea** | `area`, `modifiers: Array<AvatarModifierType>` | Modify avatars in an area (hide, freeze). |
69
+ | **AvatarEmoteCommand** | `emoteUrn`, `loop` | Trigger avatar emotes. |
70
+ | **AvatarEquippedData** | Read-only | Data about equipped wearables. |
71
+
72
+ ## Camera
73
+
74
+ | Component | Key Fields | Description |
75
+ |-----------|-----------|-------------|
76
+ | **CameraMode** | `mode: CameraType` | Set camera to first-person or third-person. |
77
+ | **CameraModeArea** | `area`, `mode` | Force camera mode in an area. |
78
+ | **MainCamera** | Read-only | Access main camera position/rotation. |
79
+ | **VirtualCamera** | `lookAtEntity?`, `defaultTransition` | Create cinematic camera angles. |
80
+
81
+ ## UI Components (React-ECS)
82
+
83
+ Imported from `@dcl/sdk/react-ecs`:
84
+
85
+ | Component | Key Fields | Description |
86
+ |-----------|-----------|-------------|
87
+ | **UiTransform** | `width`, `height`, `positionType`, `flexDirection`, `alignItems`, `justifyContent`, `margin`, `padding`, `position` | Layout and positioning (CSS flexbox-like). |
88
+ | **UiText** | `value: string`, `fontSize`, `color`, `textAlign`, `font` | Render text in UI. |
89
+ | **UiBackground** | `color?`, `textureMode?`, `texture?` | Background color or image for UI elements. |
90
+ | **UiInput** | `placeholder`, `fontSize`, `color`, `onSubmit` | Text input field. |
91
+ | **UiInputResult** | Read-only | Input field value. |
92
+ | **UiDropdown** | `options: string[]`, `selectedIndex`, `onChange` | Dropdown selector. |
93
+ | **UiDropdownResult** | Read-only | Selected dropdown value. |
94
+ | **UiCanvasInformation** | Read-only | Screen dimensions and device pixel ratio. |
95
+
96
+ ## System & Runtime
97
+
98
+ | Component | Key Fields | Description |
99
+ |-----------|-----------|-------------|
100
+ | **EngineInfo** | Read-only: `tickNumber`, `totalRuntime`, `frameNumber` | Engine timing information. |
101
+ | **RealmInfo** | Read-only: `realmName`, `networkId`, `baseUrl` | Current realm/server info. |
102
+ | **SkyboxTime** | `time` | Control the time of day (skybox). |
103
+ | **AssetLoad** | `src`, `type` | Request loading of external assets. |
104
+ | **AssetLoadLoadingState** | Read-only | Loading state of external assets. |
105
+
106
+ ## Math Types (from `@dcl/sdk/math`)
107
+
108
+ | Type | Factory | Description |
109
+ |------|---------|-------------|
110
+ | **Vector3** | `Vector3.create(x, y, z)`, `.Zero()`, `.One()`, `.Up()`, `.Forward()` | 3D position/direction. |
111
+ | **Quaternion** | `Quaternion.fromEulerDegrees(x, y, z)`, `.Identity()` | Rotation. |
112
+ | **Color4** | `Color4.create(r, g, b, a)`, `.Red()`, `.Blue()`, `.Green()`, `.White()`, `.Black()` | RGBA color (0-1 range). |
113
+ | **Color3** | `Color3.create(r, g, b)` | RGB color. |