@jhm1909/ag-kit 0.1.0
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.
- package/.agent/ARCHITECTURE.md +189 -0
- package/.agent/known-registries.json +181 -0
- package/.agent/mcp_config.json +19 -0
- package/.agent/rules/clean-code.md +107 -0
- package/.agent/rules/documents.md +177 -0
- package/.agent/rules/git-workflow.md +68 -0
- package/.agent/rules/nano-banana.md +46 -0
- package/.agent/rules/research.md +35 -0
- package/.agent/rules/skill-loading.md +100 -0
- package/.agent/rules/skill-suggestion.md +47 -0
- package/.agent/rules/testing.md +52 -0
- package/.agent/rules/workflow-advisor.md +108 -0
- package/.agent/rules/workflow-skill-convention.md +127 -0
- package/.agent/skills/ai-engineer/SKILL.md +824 -0
- package/.agent/skills/ai-engineer/references/agentic-patterns.md +329 -0
- package/.agent/skills/ai-engineer/references/evaluation.md +493 -0
- package/.agent/skills/ai-engineer/references/llm.md +490 -0
- package/.agent/skills/ai-engineer/references/rag-advanced.md +444 -0
- package/.agent/skills/ai-engineer/references/serving-optimization.md +531 -0
- package/.agent/skills/ai-engineer/vector-db/README.md +137 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +71 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +41 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/.agent/skills/backend-developer/SKILL.md +763 -0
- package/.agent/skills/backend-developer/references/general-patterns.md +65 -0
- package/.agent/skills/backend-developer/references/go-echo.md +68 -0
- package/.agent/skills/backend-developer/references/go-gin.md +76 -0
- package/.agent/skills/backend-developer/references/java-springboot.md +83 -0
- package/.agent/skills/backend-developer/references/node-express.md +64 -0
- package/.agent/skills/backend-developer/references/node-nestjs.md +69 -0
- package/.agent/skills/backend-developer/references/python-django.md +67 -0
- package/.agent/skills/backend-developer/references/python-fastapi.md +80 -0
- package/.agent/skills/blockchain-engineer/SKILL.md +975 -0
- package/.agent/skills/blockchain-engineer/references/deployment.md +28 -0
- package/.agent/skills/blockchain-engineer/references/evm.md +14 -0
- package/.agent/skills/blockchain-engineer/references/mechanisms.md +32 -0
- package/.agent/skills/blockchain-engineer/references/solidity.md +32 -0
- package/.agent/skills/business-analysis/SKILL.md +85 -0
- package/.agent/skills/business-analysis/references/best-practices/diagrams.md +141 -0
- package/.agent/skills/business-analysis/references/domains/ai-agent.md +94 -0
- package/.agent/skills/business-analysis/references/domains/blockchain-dapp.md +86 -0
- package/.agent/skills/business-analysis/references/domains/ecommerce.md +77 -0
- package/.agent/skills/business-analysis/references/domains/education.md +42 -0
- package/.agent/skills/business-analysis/references/domains/fintech.md +44 -0
- package/.agent/skills/business-analysis/references/domains/fnb.md +82 -0
- package/.agent/skills/business-analysis/references/domains/healthtech.md +44 -0
- package/.agent/skills/business-analysis/references/domains/internal-tools.md +38 -0
- package/.agent/skills/business-analysis/references/domains/marketplace.md +52 -0
- package/.agent/skills/business-analysis/references/domains/saas.md +36 -0
- package/.agent/skills/business-analysis/references/workflows/collaboration.md +41 -0
- package/.agent/skills/business-analysis/scripts/verify_mermaid.py +86 -0
- package/.agent/skills/business-analysis/templates/brd.md +46 -0
- package/.agent/skills/business-analysis/templates/change-request.md +41 -0
- package/.agent/skills/business-analysis/templates/prd-functional.md +38 -0
- package/.agent/skills/business-analysis/templates/use-case.md +40 -0
- package/.agent/skills/business-analysis/templates/user-story-detailed.md +36 -0
- package/.agent/skills/code-review/SKILL.md +113 -0
- package/.agent/skills/code-review/references/code-review-reception.md +209 -0
- package/.agent/skills/code-review/references/differential_review.md +59 -0
- package/.agent/skills/code-review/references/requesting-code-review.md +105 -0
- package/.agent/skills/code-review/references/spec_compliance.md +43 -0
- package/.agent/skills/code-review/references/verification-before-completion.md +139 -0
- package/.agent/skills/context-engineering/SKILL.md +68 -0
- package/.agent/skills/context-engineering/references/context-compression.md +84 -0
- package/.agent/skills/context-engineering/references/context-degradation.md +93 -0
- package/.agent/skills/context-engineering/references/context-fundamentals.md +75 -0
- package/.agent/skills/context-engineering/references/context-optimization.md +82 -0
- package/.agent/skills/context-engineering/references/evaluation.md +89 -0
- package/.agent/skills/context-engineering/references/memory-systems.md +88 -0
- package/.agent/skills/context-engineering/references/multi-agent-patterns.md +90 -0
- package/.agent/skills/context-engineering/references/project-development.md +97 -0
- package/.agent/skills/context-engineering/references/tool-design.md +86 -0
- package/.agent/skills/debugging/SKILL.md +60 -0
- package/.agent/skills/debugging/references/defense-in-depth.md +130 -0
- package/.agent/skills/debugging/references/root-cause-tracing.md +177 -0
- package/.agent/skills/debugging/references/systematic-debugging.md +295 -0
- package/.agent/skills/debugging/references/verification-before-completion.md +142 -0
- package/.agent/skills/designer/SKILL.md +159 -0
- package/.agent/skills/designer/concepts/apple-glass.md +48 -0
- package/.agent/skills/designer/concepts/aurora-gradients.md +26 -0
- package/.agent/skills/designer/concepts/bento-grids.md +14 -0
- package/.agent/skills/designer/concepts/claymorphism.md +27 -0
- package/.agent/skills/designer/concepts/neo-brutalism.md +32 -0
- package/.agent/skills/designer/data/app-interface.csv +31 -0
- package/.agent/skills/designer/data/charts.csv +26 -0
- package/.agent/skills/designer/data/colors.csv +162 -0
- package/.agent/skills/designer/data/design.csv +1776 -0
- package/.agent/skills/designer/data/icons.csv +106 -0
- package/.agent/skills/designer/data/landing.csv +35 -0
- package/.agent/skills/designer/data/products.csv +162 -0
- package/.agent/skills/designer/data/react-performance.csv +45 -0
- package/.agent/skills/designer/data/styles.csv +85 -0
- package/.agent/skills/designer/data/typography.csv +74 -0
- package/.agent/skills/designer/data/ui-reasoning.csv +162 -0
- package/.agent/skills/designer/data/ux-guidelines.csv +100 -0
- package/.agent/skills/designer/references/accessibility.md +172 -0
- package/.agent/skills/designer/references/branding.md +88 -0
- package/.agent/skills/designer/references/color-theory.md +139 -0
- package/.agent/skills/designer/references/creation.md +118 -0
- package/.agent/skills/designer/references/design-systems.md +219 -0
- package/.agent/skills/designer/references/frontend_design_aesthetics.md +57 -0
- package/.agent/skills/designer/references/layout.md +200 -0
- package/.agent/skills/designer/references/motion.md +92 -0
- package/.agent/skills/designer/references/review.md +100 -0
- package/.agent/skills/designer/references/trends.md +209 -0
- package/.agent/skills/designer/references/typography.md +190 -0
- package/.agent/skills/designer/scripts/remove_background.py +135 -0
- package/.agent/skills/designer/scripts/ui-search/__pycache__/core.cpython-314.pyc +0 -0
- package/.agent/skills/designer/scripts/ui-search/__pycache__/design_system.cpython-314.pyc +0 -0
- package/.agent/skills/designer/scripts/ui-search/core.py +217 -0
- package/.agent/skills/designer/scripts/ui-search/design_system.py +1067 -0
- package/.agent/skills/designer/scripts/ui-search/search.py +114 -0
- package/.agent/skills/designer/templates/design-motion-spec.md +30 -0
- package/.agent/skills/devops-engineer/SKILL.md +90 -0
- package/.agent/skills/devops-engineer/docker-compose/README.md +47 -0
- package/.agent/skills/devops-engineer/references/ci-cd-pipelines.md +76 -0
- package/.agent/skills/devops-engineer/references/cloud-providers.md +57 -0
- package/.agent/skills/devops-engineer/references/codebase-normalization.md +104 -0
- package/.agent/skills/devops-engineer/references/container-orchestration.md +69 -0
- package/.agent/skills/devops-engineer/references/iac-tools.md +63 -0
- package/.agent/skills/devops-engineer/references/observability-security.md +45 -0
- package/.agent/skills/devops-engineer/references/vercel-supabase.md +17 -0
- package/.agent/skills/devops-engineer/templates/release-notes.md +8 -0
- package/.agent/skills/frontend-developer/SKILL.md +125 -0
- package/.agent/skills/frontend-developer/react-nextjs/README.md +90 -0
- package/.agent/skills/frontend-developer/references/angular.md +52 -0
- package/.agent/skills/frontend-developer/references/composition_patterns.md +60 -0
- package/.agent/skills/frontend-developer/references/core-performance.md +68 -0
- package/.agent/skills/frontend-developer/references/modern-signals.md +43 -0
- package/.agent/skills/frontend-developer/references/react_performance_rules.md +55 -0
- package/.agent/skills/frontend-developer/references/vue-nuxt.md +55 -0
- package/.agent/skills/frontend-developer/scripts/validate_compliance.py +65 -0
- package/.agent/skills/frontend-developer/threejs/README.md +89 -0
- package/.agent/skills/frontend-developer/threejs/animation.md +552 -0
- package/.agent/skills/frontend-developer/threejs/fundamentals.md +488 -0
- package/.agent/skills/frontend-developer/threejs/geometry.md +548 -0
- package/.agent/skills/frontend-developer/threejs/interaction.md +660 -0
- package/.agent/skills/frontend-developer/threejs/lighting.md +481 -0
- package/.agent/skills/frontend-developer/threejs/loaders.md +623 -0
- package/.agent/skills/frontend-developer/threejs/materials.md +520 -0
- package/.agent/skills/frontend-developer/threejs/postprocessing.md +602 -0
- package/.agent/skills/frontend-developer/threejs/router.json +181 -0
- package/.agent/skills/frontend-developer/threejs/shaders.md +642 -0
- package/.agent/skills/frontend-developer/threejs/textures.md +628 -0
- package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
- package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
- package/.agent/skills/game-development/SKILL.md +167 -0
- package/.agent/skills/game-development/game-art/SKILL.md +185 -0
- package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
- package/.agent/skills/game-development/game-design/SKILL.md +129 -0
- package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
- package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
- package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
- package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
- package/.agent/skills/game-development/web-games/SKILL.md +150 -0
- package/.agent/skills/lead-architect/SKILL.md +85 -0
- package/.agent/skills/lead-architect/references/application-architecture.md +70 -0
- package/.agent/skills/lead-architect/references/infrastructure.md +51 -0
- package/.agent/skills/lead-architect/references/process.md +42 -0
- package/.agent/skills/lead-architect/references/system-architecture.md +62 -0
- package/.agent/skills/lead-architect/references/web-fullstack.md +82 -0
- package/.agent/skills/lead-architect/templates/adr.md +62 -0
- package/.agent/skills/lead-architect/templates/rfc.md +46 -0
- package/.agent/skills/lead-architect/templates/sdd.md +62 -0
- package/.agent/skills/lead-architect/templates/technical-spec.md +61 -0
- package/.agent/skills/marketer/SKILL.md +66 -0
- package/.agent/skills/marketer/remotion-best-practices/SKILL.md +58 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/3d.md +86 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/animations.md +29 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/assets.md +78 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/audio.md +172 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/calculate-metadata.md +104 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/can-decode.md +75 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/charts.md +58 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/compositions.md +146 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/display-captions.md +126 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/extract-frames.md +229 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/fonts.md +152 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/get-audio-duration.md +58 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/get-video-dimensions.md +68 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/get-video-duration.md +58 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/gifs.md +138 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/images.md +130 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/import-srt-captions.md +67 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/lottie.md +68 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/measuring-dom-nodes.md +35 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/measuring-text.md +143 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/sequencing.md +106 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/tailwind.md +11 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/text-animations.md +20 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/timing.md +179 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/transcribe-captions.md +19 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/transitions.md +122 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/trimming.md +53 -0
- package/.agent/skills/marketer/remotion-best-practices/rules/videos.md +171 -0
- package/.agent/skills/mcp-builder/SKILL.md +76 -0
- package/.agent/skills/mcp-builder/references/evaluation.md +602 -0
- package/.agent/skills/mcp-builder/references/mcp_best_practices.md +249 -0
- package/.agent/skills/mcp-builder/references/node_mcp_server.md +970 -0
- package/.agent/skills/mcp-builder/references/python_mcp_server.md +719 -0
- package/.agent/skills/mobile-developer/SKILL.md +83 -0
- package/.agent/skills/mobile-developer/api-routes/SKILL.md +389 -0
- package/.agent/skills/mobile-developer/building-ui/SKILL.md +335 -0
- package/.agent/skills/mobile-developer/building-ui/references/animations.md +220 -0
- package/.agent/skills/mobile-developer/building-ui/references/controls.md +270 -0
- package/.agent/skills/mobile-developer/building-ui/references/form-sheet.md +227 -0
- package/.agent/skills/mobile-developer/building-ui/references/gradients.md +106 -0
- package/.agent/skills/mobile-developer/building-ui/references/icons.md +213 -0
- package/.agent/skills/mobile-developer/building-ui/references/media.md +198 -0
- package/.agent/skills/mobile-developer/building-ui/references/route-structure.md +229 -0
- package/.agent/skills/mobile-developer/building-ui/references/search.md +248 -0
- package/.agent/skills/mobile-developer/building-ui/references/storage.md +121 -0
- package/.agent/skills/mobile-developer/building-ui/references/tabs.md +368 -0
- package/.agent/skills/mobile-developer/building-ui/references/visual-effects.md +197 -0
- package/.agent/skills/mobile-developer/building-ui/references/webgpu-three.md +605 -0
- package/.agent/skills/mobile-developer/cicd-workflows/SKILL.md +107 -0
- package/.agent/skills/mobile-developer/cicd-workflows/scripts/fetch.js +109 -0
- package/.agent/skills/mobile-developer/cicd-workflows/scripts/package.json +11 -0
- package/.agent/skills/mobile-developer/cicd-workflows/scripts/validate.js +84 -0
- package/.agent/skills/mobile-developer/data-fetching/SKILL.md +508 -0
- package/.agent/skills/mobile-developer/deployment/SKILL.md +207 -0
- package/.agent/skills/mobile-developer/deployment/references/app-store-metadata.md +479 -0
- package/.agent/skills/mobile-developer/deployment/references/ios-app-store.md +355 -0
- package/.agent/skills/mobile-developer/deployment/references/play-store.md +246 -0
- package/.agent/skills/mobile-developer/deployment/references/testflight.md +58 -0
- package/.agent/skills/mobile-developer/deployment/references/workflows.md +200 -0
- package/.agent/skills/mobile-developer/dev-client/SKILL.md +181 -0
- package/.agent/skills/mobile-developer/tailwind-setup/SKILL.md +501 -0
- package/.agent/skills/mobile-developer/upgrading-expo/SKILL.md +116 -0
- package/.agent/skills/mobile-developer/upgrading-expo/references/new-architecture.md +79 -0
- package/.agent/skills/mobile-developer/upgrading-expo/references/react-19.md +79 -0
- package/.agent/skills/mobile-developer/upgrading-expo/references/react-compiler.md +59 -0
- package/.agent/skills/mobile-developer/use-dom/SKILL.md +434 -0
- package/.agent/skills/modern-python/SKILL.md +122 -0
- package/.agent/skills/project-manager/SKILL.md +110 -0
- package/.agent/skills/project-manager/references/ba-collaboration.md +62 -0
- package/.agent/skills/project-manager/references/discovery_process.md +52 -0
- package/.agent/skills/project-manager/references/jobs_to_be_done.md +51 -0
- package/.agent/skills/project-manager/references/prd_development.md +52 -0
- package/.agent/skills/project-manager/references/rules-guide.md +55 -0
- package/.agent/skills/project-manager/references/skill-creation.md +98 -0
- package/.agent/skills/project-manager/references/strategic-frameworks.md +62 -0
- package/.agent/skills/project-manager/references/task-decomposition.md +194 -0
- package/.agent/skills/project-manager/references/workflows-guide.md +44 -0
- package/.agent/skills/project-manager/router.json +160 -0
- package/.agent/skills/project-manager/scripts/compare_skill.py +177 -0
- package/.agent/skills/project-manager/scripts/encoding_utils.py +36 -0
- package/.agent/skills/project-manager/scripts/init_skill.py +190 -0
- package/.agent/skills/project-manager/scripts/quick_validate.py +123 -0
- package/.agent/skills/project-manager/templates/pm-strategy-one-pager.md +6 -0
- package/.agent/skills/project-manager/templates/prd-strategic.md +38 -0
- package/.agent/skills/project-manager/templates/skill-questionnaire.md +118 -0
- package/.agent/skills/project-manager/templates/user-story-simple.md +14 -0
- package/.agent/skills/prompt-engineer/SKILL.md +319 -0
- package/.agent/skills/prompt-engineer/skill-creator/README.md +47 -0
- package/.agent/skills/qa-tester/SKILL.md +142 -0
- package/.agent/skills/qa-tester/assets/README.md +8 -0
- package/.agent/skills/qa-tester/references/accessibility_testing.md +35 -0
- package/.agent/skills/qa-tester/references/agent_browser.md +38 -0
- package/.agent/skills/qa-tester/references/automation/api_testing.md +23 -0
- package/.agent/skills/qa-tester/references/automation/best_practices.md +14 -0
- package/.agent/skills/qa-tester/references/automation/jest_vitest.md +26 -0
- package/.agent/skills/qa-tester/references/automation/playwright.md +30 -0
- package/.agent/skills/qa-tester/references/e2e_testing.md +46 -0
- package/.agent/skills/qa-tester/references/integration_testing.md +39 -0
- package/.agent/skills/qa-tester/references/performance_testing.md +44 -0
- package/.agent/skills/qa-tester/references/property_based_testing.md +44 -0
- package/.agent/skills/qa-tester/references/security_audit.md +53 -0
- package/.agent/skills/qa-tester/references/security_testing.md +30 -0
- package/.agent/skills/qa-tester/references/sharp_edges.md +49 -0
- package/.agent/skills/qa-tester/references/static_analysis.md +52 -0
- package/.agent/skills/qa-tester/references/supply_chain_audit.md +54 -0
- package/.agent/skills/qa-tester/references/test_case_standards.md +96 -0
- package/.agent/skills/qa-tester/references/test_report_template.md +32 -0
- package/.agent/skills/qa-tester/references/unit_testing.md +50 -0
- package/.agent/skills/qa-tester/references/visual_testing.md +32 -0
- package/.agent/skills/qa-tester/templates/uat-plan.md +34 -0
- package/.agent/skills/research-first/SKILL.md +118 -0
- package/.agent/skills-manifest.json +264 -0
- package/.agent/workflows/absorb.md +176 -0
- package/.agent/workflows/bootstrap.md +91 -0
- package/.agent/workflows/brainstorm.md +168 -0
- package/.agent/workflows/break-tasks.md +77 -0
- package/.agent/workflows/commit.md +349 -0
- package/.agent/workflows/custom-behavior.md +64 -0
- package/.agent/workflows/debug.md +65 -0
- package/.agent/workflows/development.md +49 -0
- package/.agent/workflows/documentation.md +221 -0
- package/.agent/workflows/gen-tests.md +53 -0
- package/.agent/workflows/guide.md +196 -0
- package/.agent/workflows/implement-feature.md +182 -0
- package/.agent/workflows/install-skill.md +193 -0
- package/.agent/workflows/qa.md +54 -0
- package/.agent/workflows/ui-ux-design.md +108 -0
- package/LICENSE +21 -0
- package/README.md +258 -0
- package/cli/index.js +345 -0
- package/cli/migrate-skills.js +113 -0
- package/cli/verify.js +291 -0
- package/package.json +49 -0
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
# WebGPU & Three.js for Expo
|
|
2
|
+
|
|
3
|
+
**Use this skill for ANY 3D graphics, games, GPU compute, or Three.js features in React Native.**
|
|
4
|
+
|
|
5
|
+
## Locked Versions (Tested & Working)
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"react-native-wgpu": "^0.4.1",
|
|
10
|
+
"three": "0.172.0",
|
|
11
|
+
"@react-three/fiber": "^9.4.0",
|
|
12
|
+
"wgpu-matrix": "^3.0.2",
|
|
13
|
+
"@types/three": "0.172.0"
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Critical:** These versions are tested together. Mismatched versions cause type errors and runtime issues.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install react-native-wgpu@^0.4.1 three@0.172.0 @react-three/fiber@^9.4.0 wgpu-matrix@^3.0.2 @types/three@0.172.0 --legacy-peer-deps
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Note:** `--legacy-peer-deps` may be required due to peer dependency conflicts with canary Expo versions.
|
|
26
|
+
|
|
27
|
+
## Metro Configuration
|
|
28
|
+
|
|
29
|
+
Create `metro.config.js` in project root:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
const { getDefaultConfig } = require("expo/metro-config");
|
|
33
|
+
|
|
34
|
+
const config = getDefaultConfig(__dirname);
|
|
35
|
+
|
|
36
|
+
config.resolver.resolveRequest = (context, moduleName, platform) => {
|
|
37
|
+
// Force 'three' to webgpu build
|
|
38
|
+
if (moduleName.startsWith("three")) {
|
|
39
|
+
moduleName = "three/webgpu";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Use standard react-three/fiber instead of React Native version
|
|
43
|
+
if (platform !== "web" && moduleName.startsWith("@react-three/fiber")) {
|
|
44
|
+
return context.resolveRequest(
|
|
45
|
+
{
|
|
46
|
+
...context,
|
|
47
|
+
unstable_conditionNames: ["module"],
|
|
48
|
+
mainFields: ["module"],
|
|
49
|
+
},
|
|
50
|
+
moduleName,
|
|
51
|
+
platform
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
module.exports = config;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Required Lib Files
|
|
61
|
+
|
|
62
|
+
Create these files in `src/lib/`:
|
|
63
|
+
|
|
64
|
+
### 1. make-webgpu-renderer.ts
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import type { NativeCanvas } from "react-native-wgpu";
|
|
68
|
+
import * as THREE from "three/webgpu";
|
|
69
|
+
|
|
70
|
+
export class ReactNativeCanvas {
|
|
71
|
+
constructor(private canvas: NativeCanvas) {}
|
|
72
|
+
|
|
73
|
+
get width() {
|
|
74
|
+
return this.canvas.width;
|
|
75
|
+
}
|
|
76
|
+
get height() {
|
|
77
|
+
return this.canvas.height;
|
|
78
|
+
}
|
|
79
|
+
set width(width: number) {
|
|
80
|
+
this.canvas.width = width;
|
|
81
|
+
}
|
|
82
|
+
set height(height: number) {
|
|
83
|
+
this.canvas.height = height;
|
|
84
|
+
}
|
|
85
|
+
get clientWidth() {
|
|
86
|
+
return this.canvas.width;
|
|
87
|
+
}
|
|
88
|
+
get clientHeight() {
|
|
89
|
+
return this.canvas.height;
|
|
90
|
+
}
|
|
91
|
+
set clientWidth(width: number) {
|
|
92
|
+
this.canvas.width = width;
|
|
93
|
+
}
|
|
94
|
+
set clientHeight(height: number) {
|
|
95
|
+
this.canvas.height = height;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
addEventListener(_type: string, _listener: EventListener) {}
|
|
99
|
+
removeEventListener(_type: string, _listener: EventListener) {}
|
|
100
|
+
dispatchEvent(_event: Event) {}
|
|
101
|
+
setPointerCapture() {}
|
|
102
|
+
releasePointerCapture() {}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export const makeWebGPURenderer = (
|
|
106
|
+
context: GPUCanvasContext,
|
|
107
|
+
{ antialias = true }: { antialias?: boolean } = {}
|
|
108
|
+
) =>
|
|
109
|
+
new THREE.WebGPURenderer({
|
|
110
|
+
antialias,
|
|
111
|
+
// @ts-expect-error
|
|
112
|
+
canvas: new ReactNativeCanvas(context.canvas),
|
|
113
|
+
context,
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 2. fiber-canvas.tsx
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import * as THREE from "three/webgpu";
|
|
121
|
+
import React, { useEffect, useRef } from "react";
|
|
122
|
+
import type { ReconcilerRoot, RootState } from "@react-three/fiber";
|
|
123
|
+
import {
|
|
124
|
+
extend,
|
|
125
|
+
createRoot,
|
|
126
|
+
unmountComponentAtNode,
|
|
127
|
+
events,
|
|
128
|
+
} from "@react-three/fiber";
|
|
129
|
+
import type { ViewProps } from "react-native";
|
|
130
|
+
import { PixelRatio } from "react-native";
|
|
131
|
+
import { Canvas, type CanvasRef } from "react-native-wgpu";
|
|
132
|
+
|
|
133
|
+
import {
|
|
134
|
+
makeWebGPURenderer,
|
|
135
|
+
ReactNativeCanvas,
|
|
136
|
+
} from "@/lib/make-webgpu-renderer";
|
|
137
|
+
|
|
138
|
+
// Extend THREE namespace for R3F - add all components you use
|
|
139
|
+
extend({
|
|
140
|
+
AmbientLight: THREE.AmbientLight,
|
|
141
|
+
DirectionalLight: THREE.DirectionalLight,
|
|
142
|
+
PointLight: THREE.PointLight,
|
|
143
|
+
SpotLight: THREE.SpotLight,
|
|
144
|
+
Mesh: THREE.Mesh,
|
|
145
|
+
Group: THREE.Group,
|
|
146
|
+
Points: THREE.Points,
|
|
147
|
+
BoxGeometry: THREE.BoxGeometry,
|
|
148
|
+
SphereGeometry: THREE.SphereGeometry,
|
|
149
|
+
CylinderGeometry: THREE.CylinderGeometry,
|
|
150
|
+
ConeGeometry: THREE.ConeGeometry,
|
|
151
|
+
DodecahedronGeometry: THREE.DodecahedronGeometry,
|
|
152
|
+
BufferGeometry: THREE.BufferGeometry,
|
|
153
|
+
BufferAttribute: THREE.BufferAttribute,
|
|
154
|
+
MeshStandardMaterial: THREE.MeshStandardMaterial,
|
|
155
|
+
MeshBasicMaterial: THREE.MeshBasicMaterial,
|
|
156
|
+
PointsMaterial: THREE.PointsMaterial,
|
|
157
|
+
PerspectiveCamera: THREE.PerspectiveCamera,
|
|
158
|
+
Scene: THREE.Scene,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
interface FiberCanvasProps {
|
|
162
|
+
children: React.ReactNode;
|
|
163
|
+
style?: ViewProps["style"];
|
|
164
|
+
camera?: THREE.PerspectiveCamera;
|
|
165
|
+
scene?: THREE.Scene;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export const FiberCanvas = ({
|
|
169
|
+
children,
|
|
170
|
+
style,
|
|
171
|
+
scene,
|
|
172
|
+
camera,
|
|
173
|
+
}: FiberCanvasProps) => {
|
|
174
|
+
const root = useRef<ReconcilerRoot<OffscreenCanvas>>(null!);
|
|
175
|
+
const canvasRef = useRef<CanvasRef>(null);
|
|
176
|
+
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
const context = canvasRef.current!.getContext("webgpu")!;
|
|
179
|
+
const renderer = makeWebGPURenderer(context);
|
|
180
|
+
|
|
181
|
+
// @ts-expect-error - ReactNativeCanvas wraps native canvas
|
|
182
|
+
const canvas = new ReactNativeCanvas(context.canvas) as HTMLCanvasElement;
|
|
183
|
+
canvas.width = canvas.clientWidth * PixelRatio.get();
|
|
184
|
+
canvas.height = canvas.clientHeight * PixelRatio.get();
|
|
185
|
+
const size = {
|
|
186
|
+
top: 0,
|
|
187
|
+
left: 0,
|
|
188
|
+
width: canvas.clientWidth,
|
|
189
|
+
height: canvas.clientHeight,
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
if (!root.current) {
|
|
193
|
+
root.current = createRoot(canvas);
|
|
194
|
+
}
|
|
195
|
+
root.current.configure({
|
|
196
|
+
size,
|
|
197
|
+
events,
|
|
198
|
+
scene,
|
|
199
|
+
camera,
|
|
200
|
+
gl: renderer,
|
|
201
|
+
frameloop: "always",
|
|
202
|
+
dpr: 1,
|
|
203
|
+
onCreated: async (state: RootState) => {
|
|
204
|
+
// @ts-expect-error - WebGPU renderer has init method
|
|
205
|
+
await state.gl.init();
|
|
206
|
+
const renderFrame = state.gl.render.bind(state.gl);
|
|
207
|
+
state.gl.render = (s: THREE.Scene, c: THREE.Camera) => {
|
|
208
|
+
renderFrame(s, c);
|
|
209
|
+
context?.present();
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
root.current.render(children);
|
|
214
|
+
return () => {
|
|
215
|
+
if (canvas != null) {
|
|
216
|
+
unmountComponentAtNode(canvas!);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
return <Canvas ref={canvasRef} style={style} />;
|
|
222
|
+
};
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Basic 3D Scene
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import * as THREE from "three/webgpu";
|
|
229
|
+
import { View } from "react-native";
|
|
230
|
+
import { useRef } from "react";
|
|
231
|
+
import { useFrame, useThree } from "@react-three/fiber";
|
|
232
|
+
import { FiberCanvas } from "@/lib/fiber-canvas";
|
|
233
|
+
|
|
234
|
+
function RotatingBox() {
|
|
235
|
+
const ref = useRef<THREE.Mesh>(null!);
|
|
236
|
+
|
|
237
|
+
useFrame((_, delta) => {
|
|
238
|
+
ref.current.rotation.x += delta;
|
|
239
|
+
ref.current.rotation.y += delta * 0.5;
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<mesh ref={ref}>
|
|
244
|
+
<boxGeometry args={[1, 1, 1]} />
|
|
245
|
+
<meshStandardMaterial color="hotpink" />
|
|
246
|
+
</mesh>
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function Scene() {
|
|
251
|
+
const { camera } = useThree();
|
|
252
|
+
|
|
253
|
+
useEffect(() => {
|
|
254
|
+
camera.position.set(0, 2, 5);
|
|
255
|
+
camera.lookAt(0, 0, 0);
|
|
256
|
+
}, [camera]);
|
|
257
|
+
|
|
258
|
+
return (
|
|
259
|
+
<>
|
|
260
|
+
<ambientLight intensity={0.5} />
|
|
261
|
+
<directionalLight position={[10, 10, 5]} intensity={1} />
|
|
262
|
+
<RotatingBox />
|
|
263
|
+
</>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export default function App() {
|
|
268
|
+
return (
|
|
269
|
+
<View style={{ flex: 1 }}>
|
|
270
|
+
<FiberCanvas style={{ flex: 1 }}>
|
|
271
|
+
<Scene />
|
|
272
|
+
</FiberCanvas>
|
|
273
|
+
</View>
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Lazy Loading (Recommended)
|
|
279
|
+
|
|
280
|
+
Use React.lazy to code-split Three.js for better loading:
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
import React, { Suspense } from "react";
|
|
284
|
+
import { ActivityIndicator, View } from "react-native";
|
|
285
|
+
|
|
286
|
+
const Scene = React.lazy(() => import("@/components/scene"));
|
|
287
|
+
|
|
288
|
+
export default function Page() {
|
|
289
|
+
return (
|
|
290
|
+
<View style={{ flex: 1 }}>
|
|
291
|
+
<Suspense fallback={<ActivityIndicator size="large" />}>
|
|
292
|
+
<Scene />
|
|
293
|
+
</Suspense>
|
|
294
|
+
</View>
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Common Geometries
|
|
300
|
+
|
|
301
|
+
```tsx
|
|
302
|
+
// Box
|
|
303
|
+
<mesh>
|
|
304
|
+
<boxGeometry args={[width, height, depth]} />
|
|
305
|
+
<meshStandardMaterial color="red" />
|
|
306
|
+
</mesh>
|
|
307
|
+
|
|
308
|
+
// Sphere
|
|
309
|
+
<mesh>
|
|
310
|
+
<sphereGeometry args={[radius, widthSegments, heightSegments]} />
|
|
311
|
+
<meshStandardMaterial color="blue" />
|
|
312
|
+
</mesh>
|
|
313
|
+
|
|
314
|
+
// Cylinder
|
|
315
|
+
<mesh>
|
|
316
|
+
<cylinderGeometry args={[radiusTop, radiusBottom, height, segments]} />
|
|
317
|
+
<meshStandardMaterial color="green" />
|
|
318
|
+
</mesh>
|
|
319
|
+
|
|
320
|
+
// Cone
|
|
321
|
+
<mesh>
|
|
322
|
+
<coneGeometry args={[radius, height, segments]} />
|
|
323
|
+
<meshStandardMaterial color="yellow" />
|
|
324
|
+
</mesh>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Lighting
|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
// Ambient (uniform light everywhere)
|
|
331
|
+
<ambientLight intensity={0.5} />
|
|
332
|
+
|
|
333
|
+
// Directional (sun-like)
|
|
334
|
+
<directionalLight position={[10, 10, 5]} intensity={1} />
|
|
335
|
+
|
|
336
|
+
// Point (light bulb)
|
|
337
|
+
<pointLight position={[0, 5, 0]} intensity={2} distance={10} />
|
|
338
|
+
|
|
339
|
+
// Spot (flashlight)
|
|
340
|
+
<spotLight position={[0, 10, 0]} angle={0.3} penumbra={1} intensity={2} />
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Animation with useFrame
|
|
344
|
+
|
|
345
|
+
```tsx
|
|
346
|
+
import { useFrame } from "@react-three/fiber";
|
|
347
|
+
import { useRef } from "react";
|
|
348
|
+
import * as THREE from "three/webgpu";
|
|
349
|
+
|
|
350
|
+
function AnimatedMesh() {
|
|
351
|
+
const ref = useRef<THREE.Mesh>(null!);
|
|
352
|
+
|
|
353
|
+
// Runs every frame - delta is time since last frame
|
|
354
|
+
useFrame((state, delta) => {
|
|
355
|
+
// Rotate
|
|
356
|
+
ref.current.rotation.y += delta;
|
|
357
|
+
|
|
358
|
+
// Oscillate position
|
|
359
|
+
ref.current.position.y = Math.sin(state.clock.elapsedTime) * 2;
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
return (
|
|
363
|
+
<mesh ref={ref}>
|
|
364
|
+
<boxGeometry />
|
|
365
|
+
<meshStandardMaterial color="orange" />
|
|
366
|
+
</mesh>
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
## Particle Systems
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
import * as THREE from "three/webgpu";
|
|
375
|
+
import { useRef, useEffect } from "react";
|
|
376
|
+
import { useFrame } from "@react-three/fiber";
|
|
377
|
+
|
|
378
|
+
function Particles({ count = 500 }) {
|
|
379
|
+
const ref = useRef<THREE.Points>(null!);
|
|
380
|
+
const positions = useRef<Float32Array>(new Float32Array(count * 3));
|
|
381
|
+
|
|
382
|
+
useEffect(() => {
|
|
383
|
+
for (let i = 0; i < count; i++) {
|
|
384
|
+
positions.current[i * 3] = (Math.random() - 0.5) * 50;
|
|
385
|
+
positions.current[i * 3 + 1] = (Math.random() - 0.5) * 50;
|
|
386
|
+
positions.current[i * 3 + 2] = (Math.random() - 0.5) * 50;
|
|
387
|
+
}
|
|
388
|
+
}, [count]);
|
|
389
|
+
|
|
390
|
+
useFrame((_, delta) => {
|
|
391
|
+
// Animate particles
|
|
392
|
+
for (let i = 0; i < count; i++) {
|
|
393
|
+
positions.current[i * 3 + 1] -= delta * 2;
|
|
394
|
+
if (positions.current[i * 3 + 1] < -25) {
|
|
395
|
+
positions.current[i * 3 + 1] = 25;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
ref.current.geometry.attributes.position.needsUpdate = true;
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
return (
|
|
402
|
+
<points ref={ref}>
|
|
403
|
+
<bufferGeometry>
|
|
404
|
+
<bufferAttribute
|
|
405
|
+
attach="attributes-position"
|
|
406
|
+
args={[positions.current, 3]}
|
|
407
|
+
/>
|
|
408
|
+
</bufferGeometry>
|
|
409
|
+
<pointsMaterial color="#ffffff" size={0.2} sizeAttenuation />
|
|
410
|
+
</points>
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Touch Controls (Orbit)
|
|
416
|
+
|
|
417
|
+
See the full `orbit-controls.tsx` implementation in the lib files. Usage:
|
|
418
|
+
|
|
419
|
+
```tsx
|
|
420
|
+
import { View } from "react-native";
|
|
421
|
+
import { FiberCanvas } from "@/lib/fiber-canvas";
|
|
422
|
+
import useControls from "@/lib/orbit-controls";
|
|
423
|
+
|
|
424
|
+
function Scene() {
|
|
425
|
+
const [OrbitControls, events] = useControls();
|
|
426
|
+
|
|
427
|
+
return (
|
|
428
|
+
<View style={{ flex: 1 }} {...events}>
|
|
429
|
+
<FiberCanvas style={{ flex: 1 }}>
|
|
430
|
+
<OrbitControls />
|
|
431
|
+
{/* Your 3D content */}
|
|
432
|
+
</FiberCanvas>
|
|
433
|
+
</View>
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
## Common Issues & Solutions
|
|
439
|
+
|
|
440
|
+
### 1. "X is not part of the THREE namespace"
|
|
441
|
+
|
|
442
|
+
**Problem:** Error like `AmbientLight is not part of the THREE namespace`
|
|
443
|
+
|
|
444
|
+
**Solution:** Add the missing component to the `extend()` call in fiber-canvas.tsx:
|
|
445
|
+
|
|
446
|
+
```tsx
|
|
447
|
+
extend({
|
|
448
|
+
AmbientLight: THREE.AmbientLight,
|
|
449
|
+
// Add other missing components...
|
|
450
|
+
});
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### 2. TypeScript Errors with Three.js
|
|
454
|
+
|
|
455
|
+
**Problem:** Type mismatches between three.js and R3F
|
|
456
|
+
|
|
457
|
+
**Solution:** Use `@ts-expect-error` comments where needed:
|
|
458
|
+
|
|
459
|
+
```tsx
|
|
460
|
+
// @ts-expect-error - WebGPU renderer types don't match
|
|
461
|
+
await state.gl.init();
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### 3. Blank Screen
|
|
465
|
+
|
|
466
|
+
**Problem:** Canvas renders but nothing visible
|
|
467
|
+
|
|
468
|
+
**Solution:**
|
|
469
|
+
|
|
470
|
+
1. Ensure camera is positioned correctly and looking at scene
|
|
471
|
+
2. Add lighting (objects are black without light)
|
|
472
|
+
3. Check that `extend()` includes all components used
|
|
473
|
+
|
|
474
|
+
### 4. Performance Issues
|
|
475
|
+
|
|
476
|
+
**Problem:** Low frame rate or stuttering
|
|
477
|
+
|
|
478
|
+
**Solution:**
|
|
479
|
+
|
|
480
|
+
- Reduce polygon count in geometries
|
|
481
|
+
- Use `useMemo` for static data
|
|
482
|
+
- Limit particle count
|
|
483
|
+
- Use `instancedMesh` for many identical objects
|
|
484
|
+
|
|
485
|
+
### 5. Peer Dependency Errors
|
|
486
|
+
|
|
487
|
+
**Problem:** npm install fails with ERESOLVE
|
|
488
|
+
|
|
489
|
+
**Solution:** Use `--legacy-peer-deps`:
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
npm install <packages> --legacy-peer-deps
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## Building
|
|
496
|
+
|
|
497
|
+
WebGPU requires a custom build:
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
npx expo prebuild
|
|
501
|
+
npx expo run:ios
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
**Note:** WebGPU does NOT work in Expo Go.
|
|
505
|
+
|
|
506
|
+
## File Structure
|
|
507
|
+
|
|
508
|
+
```
|
|
509
|
+
src/
|
|
510
|
+
├── app/
|
|
511
|
+
│ └── index.tsx # Entry point with lazy loading
|
|
512
|
+
├── components/
|
|
513
|
+
│ ├── scene.tsx # Main 3D scene
|
|
514
|
+
│ └── game.tsx # Game logic
|
|
515
|
+
└── lib/
|
|
516
|
+
├── fiber-canvas.tsx # R3F canvas wrapper
|
|
517
|
+
├── make-webgpu-renderer.ts # WebGPU renderer
|
|
518
|
+
└── orbit-controls.tsx # Touch controls
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## Decision Tree
|
|
522
|
+
|
|
523
|
+
```
|
|
524
|
+
Need 3D graphics?
|
|
525
|
+
├── Simple shapes → mesh + geometry + material
|
|
526
|
+
├── Animated objects → useFrame + refs
|
|
527
|
+
├── Many objects → instancedMesh
|
|
528
|
+
├── Particles → Points + BufferGeometry
|
|
529
|
+
│
|
|
530
|
+
Need interaction?
|
|
531
|
+
├── Orbit camera → useControls hook
|
|
532
|
+
├── Touch objects → onClick on mesh
|
|
533
|
+
├── Gestures → react-native-gesture-handler
|
|
534
|
+
│
|
|
535
|
+
Performance critical?
|
|
536
|
+
├── Static geometry → useMemo
|
|
537
|
+
├── Many instances → InstancedMesh
|
|
538
|
+
└── Complex scenes → LOD (Level of Detail)
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
## Example: Complete Game Scene
|
|
542
|
+
|
|
543
|
+
```tsx
|
|
544
|
+
import * as THREE from "three/webgpu";
|
|
545
|
+
import { View, Text, Pressable } from "react-native";
|
|
546
|
+
import { useRef, useState, useCallback } from "react";
|
|
547
|
+
import { useFrame, useThree } from "@react-three/fiber";
|
|
548
|
+
import { FiberCanvas } from "@/lib/fiber-canvas";
|
|
549
|
+
|
|
550
|
+
function Player({ position }: { position: THREE.Vector3 }) {
|
|
551
|
+
const ref = useRef<THREE.Mesh>(null!);
|
|
552
|
+
|
|
553
|
+
useFrame(() => {
|
|
554
|
+
ref.current.position.copy(position);
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
return (
|
|
558
|
+
<mesh ref={ref}>
|
|
559
|
+
<coneGeometry args={[0.5, 1, 8]} />
|
|
560
|
+
<meshStandardMaterial color="#00ffff" />
|
|
561
|
+
</mesh>
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function GameScene({ playerX }: { playerX: number }) {
|
|
566
|
+
const { camera } = useThree();
|
|
567
|
+
const playerPos = useRef(new THREE.Vector3(0, 0, 0));
|
|
568
|
+
|
|
569
|
+
playerPos.current.x = playerX;
|
|
570
|
+
|
|
571
|
+
useEffect(() => {
|
|
572
|
+
camera.position.set(0, 10, 15);
|
|
573
|
+
camera.lookAt(0, 0, 0);
|
|
574
|
+
}, [camera]);
|
|
575
|
+
|
|
576
|
+
return (
|
|
577
|
+
<>
|
|
578
|
+
<ambientLight intensity={0.5} />
|
|
579
|
+
<directionalLight position={[5, 10, 5]} />
|
|
580
|
+
<Player position={playerPos.current} />
|
|
581
|
+
</>
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export default function Game() {
|
|
586
|
+
const [playerX, setPlayerX] = useState(0);
|
|
587
|
+
|
|
588
|
+
return (
|
|
589
|
+
<View style={{ flex: 1, backgroundColor: "#000" }}>
|
|
590
|
+
<FiberCanvas style={{ flex: 1 }}>
|
|
591
|
+
<GameScene playerX={playerX} />
|
|
592
|
+
</FiberCanvas>
|
|
593
|
+
|
|
594
|
+
<View style={{ position: "absolute", bottom: 40, flexDirection: "row" }}>
|
|
595
|
+
<Pressable onPress={() => setPlayerX((x) => x - 1)}>
|
|
596
|
+
<Text style={{ color: "#fff", fontSize: 32 }}>◀</Text>
|
|
597
|
+
</Pressable>
|
|
598
|
+
<Pressable onPress={() => setPlayerX((x) => x + 1)}>
|
|
599
|
+
<Text style={{ color: "#fff", fontSize: 32 }}>▶</Text>
|
|
600
|
+
</Pressable>
|
|
601
|
+
</View>
|
|
602
|
+
</View>
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cicd-workflows
|
|
3
|
+
description: >
|
|
4
|
+
Helps understand and write EAS workflow YAML files for Expo projects. Use this skill when the user asks about CI/CD or workflows in an Expo or EAS context, mentions .eas/workflows/, or wants help with EAS build pipelines or deployment automation.
|
|
5
|
+
license: MIT
|
|
6
|
+
compatibility: Claude Code, Cursor, Gemini CLI, GitHub Copilot
|
|
7
|
+
metadata:
|
|
8
|
+
author: jhm1909
|
|
9
|
+
version: "2.0.0"
|
|
10
|
+
domain: mobile
|
|
11
|
+
estimated_tokens: 3000
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# EAS Workflows Skill
|
|
15
|
+
|
|
16
|
+
## Knowledge Graph
|
|
17
|
+
|
|
18
|
+
- **extends**: []
|
|
19
|
+
- **requires**: [[mobile-developer]]
|
|
20
|
+
- **suggests**: [[deployment]], [[devops-engineer]]
|
|
21
|
+
- **conflicts": []
|
|
22
|
+
- **enhances**: []
|
|
23
|
+
- **moc": [[mobile-development-moc]]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Help developers write and edit EAS CI/CD workflow YAML files.
|
|
27
|
+
|
|
28
|
+
## Reference Documentation
|
|
29
|
+
|
|
30
|
+
Fetch these resources before generating or validating workflow files. Use the fetch script (implemented using Node.js) in this skill's `scripts/` directory; it caches responses using ETags for efficiency:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Fetch resources
|
|
34
|
+
node {baseDir}/scripts/fetch.js <url>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
1. **JSON Schema** — https://api.expo.dev/v2/workflows/schema
|
|
38
|
+
- It is NECESSARY to fetch this schema
|
|
39
|
+
- Source of truth for validation
|
|
40
|
+
- All job types and their required/optional parameters
|
|
41
|
+
- Trigger types and configurations
|
|
42
|
+
- Runner types, VM images, and all enums
|
|
43
|
+
|
|
44
|
+
2. **Syntax Documentation** — https://raw.githubusercontent.com/expo/expo/refs/heads/main/docs/pages/eas/workflows/syntax.mdx
|
|
45
|
+
- Overview of workflow YAML syntax
|
|
46
|
+
- Examples and English explanations
|
|
47
|
+
- Expression syntax and contexts
|
|
48
|
+
|
|
49
|
+
3. **Pre-packaged Jobs** — https://raw.githubusercontent.com/expo/expo/refs/heads/main/docs/pages/eas/workflows/pre-packaged-jobs.mdx
|
|
50
|
+
- Documentation for supported pre-packaged job types
|
|
51
|
+
- Job-specific parameters and outputs
|
|
52
|
+
|
|
53
|
+
Do not rely on memorized values; these resources evolve as new features are added.
|
|
54
|
+
|
|
55
|
+
## Workflow File Location
|
|
56
|
+
|
|
57
|
+
Workflows live in `.eas/workflows/*.yml` (or `.yaml`).
|
|
58
|
+
|
|
59
|
+
## Top-Level Structure
|
|
60
|
+
|
|
61
|
+
A workflow file has these top-level keys:
|
|
62
|
+
|
|
63
|
+
- `name` — Display name for the workflow
|
|
64
|
+
- `on` — Triggers that start the workflow (at least one required)
|
|
65
|
+
- `jobs` — Job definitions (required)
|
|
66
|
+
- `defaults` — Shared defaults for all jobs
|
|
67
|
+
- `concurrency` — Control parallel workflow runs
|
|
68
|
+
|
|
69
|
+
Consult the schema for the full specification of each section.
|
|
70
|
+
|
|
71
|
+
## Expressions
|
|
72
|
+
|
|
73
|
+
Use `${{ }}` syntax for dynamic values. The schema defines available contexts:
|
|
74
|
+
|
|
75
|
+
- `github.*` — GitHub repository and event information
|
|
76
|
+
- `inputs.*` — Values from `workflow_dispatch` inputs
|
|
77
|
+
- `needs.*` — Outputs and status from dependent jobs
|
|
78
|
+
- `jobs.*` — Job outputs (alternative syntax)
|
|
79
|
+
- `steps.*` — Step outputs within custom jobs
|
|
80
|
+
- `workflow.*` — Workflow metadata
|
|
81
|
+
|
|
82
|
+
## Generating Workflows
|
|
83
|
+
|
|
84
|
+
When generating or editing workflows:
|
|
85
|
+
|
|
86
|
+
1. Fetch the schema to get current job types, parameters, and allowed values
|
|
87
|
+
2. Validate that required fields are present for each job type
|
|
88
|
+
3. Verify job references in `needs` and `after` exist in the workflow
|
|
89
|
+
4. Check that expressions reference valid contexts and outputs
|
|
90
|
+
5. Ensure `if` conditions respect the schema's length constraints
|
|
91
|
+
|
|
92
|
+
## Validation
|
|
93
|
+
|
|
94
|
+
After generating or editing a workflow file, validate it against the schema:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
# Install dependencies if missing
|
|
98
|
+
[ -d "{baseDir}/scripts/node_modules" ] || npm install --prefix {baseDir}/scripts
|
|
99
|
+
|
|
100
|
+
node {baseDir}/scripts/validate.js <workflow.yml> [workflow2.yml ...]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The validator fetches the latest schema and checks the YAML structure. Fix any reported errors before considering the workflow complete.
|
|
104
|
+
|
|
105
|
+
## Answering Questions
|
|
106
|
+
|
|
107
|
+
When users ask about available options (job types, triggers, runner types, etc.), fetch the schema and derive the answer from it rather than relying on potentially outdated information.
|