@mclawnet/agent 0.6.19 → 0.6.21

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 (66) hide show
  1. package/dist/{chunk-RO47ET27.js → chunk-M2CDVPQF.js} +2 -2
  2. package/dist/{chunk-CBZIH6FY.js → chunk-PJ5M6Q36.js} +2 -2
  3. package/dist/chunk-PJ5M6Q36.js.map +1 -0
  4. package/dist/{chunk-MSDIRBXF.js → chunk-RIK7IXSW.js} +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/{linux-6AR7SXHW.js → linux-IHA4O633.js} +3 -3
  7. package/dist/{macos-BTP5JW3U.js → macos-G4VK2253.js} +8 -3
  8. package/dist/macos-G4VK2253.js.map +1 -0
  9. package/dist/service/index.js +5 -5
  10. package/dist/service/macos.d.ts.map +1 -1
  11. package/dist/start.js +2 -2
  12. package/dist/{windows-IQNSUMN6.js → windows-P6U3JLUZ.js} +3 -3
  13. package/package.json +4 -4
  14. package/skills/cocos-creator-3x-cn/SKILL.md +475 -0
  15. package/skills/cocos-creator-3x-cn/references/framework/asset-management.md +322 -0
  16. package/skills/cocos-creator-3x-cn/references/framework/component-system.md +348 -0
  17. package/skills/cocos-creator-3x-cn/references/framework/event-patterns.md +410 -0
  18. package/skills/cocos-creator-3x-cn/references/framework/playable-optimization.md +257 -0
  19. package/skills/cocos-creator-3x-cn/references/language/performance.md +363 -0
  20. package/skills/cocos-creator-3x-cn/references/language/quality-hygiene.md +307 -0
  21. package/skills/cocos-creator-3x-cn/references/review/architecture-review.md +183 -0
  22. package/skills/cocos-creator-3x-cn/references/review/quality-review.md +251 -0
  23. package/skills/cocos-performance-optimizer/SKILL.md +214 -0
  24. package/skills/game-development/2d-games/SKILL.md +129 -0
  25. package/skills/game-development/3d-games/SKILL.md +145 -0
  26. package/skills/game-development/SKILL.md +175 -0
  27. package/skills/game-development/game-art/SKILL.md +195 -0
  28. package/skills/game-development/game-audio/SKILL.md +200 -0
  29. package/skills/game-development/game-design/SKILL.md +139 -0
  30. package/skills/game-development/mobile-games/SKILL.md +118 -0
  31. package/skills/game-development/multiplayer/SKILL.md +142 -0
  32. package/skills/game-development/pc-games/SKILL.md +154 -0
  33. package/skills/game-development/vr-ar/SKILL.md +133 -0
  34. package/skills/game-development/web-games/SKILL.md +160 -0
  35. package/skills/game-engine/SKILL.md +140 -0
  36. package/skills/game-engine/assets/2d-maze-game.md +528 -0
  37. package/skills/game-engine/assets/2d-platform-game.md +1855 -0
  38. package/skills/game-engine/assets/gameBase-template-repo.md +310 -0
  39. package/skills/game-engine/assets/paddle-game-template.md +1528 -0
  40. package/skills/game-engine/assets/simple-2d-engine.md +507 -0
  41. package/skills/game-engine/references/3d-web-games.md +754 -0
  42. package/skills/game-engine/references/algorithms.md +843 -0
  43. package/skills/game-engine/references/basics.md +343 -0
  44. package/skills/game-engine/references/game-control-mechanisms.md +617 -0
  45. package/skills/game-engine/references/game-engine-core-principles.md +695 -0
  46. package/skills/game-engine/references/game-publishing.md +352 -0
  47. package/skills/game-engine/references/techniques.md +894 -0
  48. package/skills/game-engine/references/terminology.md +354 -0
  49. package/skills/game-engine/references/web-apis.md +1394 -0
  50. package/skills/theone-cocos-standards/SKILL.md +557 -0
  51. package/skills/theone-cocos-standards/references/framework/component-system.md +645 -0
  52. package/skills/theone-cocos-standards/references/framework/event-patterns.md +433 -0
  53. package/skills/theone-cocos-standards/references/framework/playable-optimization.md +429 -0
  54. package/skills/theone-cocos-standards/references/framework/size-optimization.md +308 -0
  55. package/skills/theone-cocos-standards/references/language/modern-typescript.md +658 -0
  56. package/skills/theone-cocos-standards/references/language/performance.md +580 -0
  57. package/skills/theone-cocos-standards/references/language/quality-hygiene.md +582 -0
  58. package/skills/theone-cocos-standards/references/review/architecture-review.md +250 -0
  59. package/skills/theone-cocos-standards/references/review/performance-review.md +288 -0
  60. package/skills/theone-cocos-standards/references/review/quality-review.md +239 -0
  61. package/dist/chunk-CBZIH6FY.js.map +0 -1
  62. package/dist/macos-BTP5JW3U.js.map +0 -1
  63. /package/dist/{chunk-RO47ET27.js.map → chunk-M2CDVPQF.js.map} +0 -0
  64. /package/dist/{chunk-MSDIRBXF.js.map → chunk-RIK7IXSW.js.map} +0 -0
  65. /package/dist/{linux-6AR7SXHW.js.map → linux-IHA4O633.js.map} +0 -0
  66. /package/dist/{windows-IQNSUMN6.js.map → windows-P6U3JLUZ.js.map} +0 -0
@@ -0,0 +1,308 @@
1
+ # Bundle Size Optimization (<5MB Target)
2
+
3
+ ## Texture Compression (Biggest Impact)
4
+
5
+ **Target: <5MB total bundle size for playable ads**
6
+
7
+ Texture compression is the single biggest factor in bundle size. Enable compression for all platforms.
8
+
9
+ ### Build Settings Configuration
10
+
11
+ ```json
12
+ // Project Settings → Build → Web Mobile
13
+ {
14
+ "textureCompression": {
15
+ "web-mobile": "auto", // Auto-select best compression
16
+ "web-desktop": "auto",
17
+ "android": "etc1", // ETC1 for Android
18
+ "ios": "pvrtc" // PVRTC for iOS
19
+ },
20
+ "packAutoAtlas": true, // Auto-generate atlases
21
+ "md5Cache": false, // Disable for smaller output
22
+ "inlineSpriteFrames": true // Reduce file count
23
+ }
24
+ ```
25
+
26
+ ### Texture Size Guidelines
27
+
28
+ ```typescript
29
+ // ✅ EXCELLENT: Optimal texture sizes for playables
30
+
31
+ // Character sprites: 512x512 max (often 256x256 is enough)
32
+ // UI elements: 256x256 max
33
+ // Backgrounds: 1024x1024 max (or use tiled smaller textures)
34
+ // Effects: 128x128 or 256x256
35
+ // Icons: 64x64 or 128x128
36
+
37
+ // ❌ WRONG: Oversized textures
38
+ // - 2048x2048 for small character sprites
39
+ // - High-res images that won't be seen at that scale
40
+ // Use appropriate sizes for display resolution
41
+ ```
42
+
43
+ ## Asset Optimization Priority
44
+
45
+ ### 1. Textures (50-60% of bundle)
46
+
47
+ ```typescript
48
+ // ✅ EXCELLENT: Sprite atlas configuration
49
+ // Combine multiple small textures into single atlas
50
+ // - Character animations: single atlas
51
+ // - UI elements: single atlas
52
+ // - Effects: single atlas
53
+
54
+ // Auto-atlas settings (Project Settings):
55
+ // - Max Width: 2048
56
+ // - Max Height: 2048
57
+ // - Padding: 2
58
+ // - Allow Rotation: true
59
+ // - Force Square: false
60
+
61
+ // ❌ WRONG: Individual texture files
62
+ // Each separate texture = separate HTTP request + worse compression
63
+ ```
64
+
65
+ ### 2. Audio (20-30% of bundle)
66
+
67
+ ```typescript
68
+ // ✅ EXCELLENT: Audio optimization
69
+ // - Format: MP3 or OGG (not WAV)
70
+ // - Background music: 128kbps max, short loops (<30 seconds)
71
+ // - Sound effects: 64kbps, very short (<2 seconds)
72
+
73
+ // ❌ WRONG: Uncompressed audio
74
+ // - WAV files: 10-20x larger than compressed
75
+ // - Long music tracks: use short loops
76
+ // - High bitrate: 320kbps unnecessary for playables
77
+ ```
78
+
79
+ ### 3. Code (5-10% of bundle)
80
+
81
+ ```typescript
82
+ // ✅ EXCELLENT: Code minification
83
+ // rollup.config.js or webpack.config.js
84
+ export default {
85
+ mode: 'production',
86
+ optimization: {
87
+ minimize: true,
88
+ minimizer: [
89
+ new TerserPlugin({
90
+ terserOptions: {
91
+ compress: {
92
+ drop_console: true, // Remove console.log
93
+ drop_debugger: true, // Remove debugger
94
+ dead_code: true, // Remove unreachable code
95
+ unused: true // Remove unused variables
96
+ },
97
+ mangle: { toplevel: true } // Shorten variable names
98
+ }
99
+ })
100
+ ]
101
+ }
102
+ };
103
+
104
+ // ✅ EXCELLENT: Import only what you need
105
+ import { Vec3, Node } from 'cc'; // Specific imports
106
+
107
+ // ❌ WRONG: Import entire module
108
+ import * as cc from 'cc'; // Imports everything (larger bundle)
109
+ ```
110
+
111
+ ### 4. Fonts (5-10% of bundle)
112
+
113
+ ```typescript
114
+ // ✅ EXCELLENT: Bitmap fonts for playables
115
+ // - Pre-render characters to texture
116
+ // - Include only needed characters: "0123456789,."
117
+ // - Much smaller than TTF fonts
118
+
119
+ // Create bitmap font:
120
+ // 1. Use BMFont tool or online generator
121
+ // 2. Include only needed characters
122
+ // 3. Export as .fnt + .png
123
+ // 4. Import to Cocos Creator as BitmapFont
124
+
125
+ // ❌ WRONG: TTF fonts
126
+ // - Large file size (hundreds of KB)
127
+ // - System fonts vary by platform
128
+ // - Use bitmap fonts for playables
129
+ ```
130
+
131
+ ## Build Configuration for Minimum Size
132
+
133
+ ```json
134
+ // Project Settings → Build → Web Mobile
135
+
136
+ {
137
+ // Bundle settings
138
+ "inlineSpriteFrames": true, // Reduce file count
139
+ "md5Cache": false, // Disable MD5 in filenames
140
+ "mainBundleCompressionType": "default",
141
+ "mainBundleIsRemote": false,
142
+
143
+ // Code optimization
144
+ "debug": false, // Disable debug mode
145
+ "sourceMaps": false, // Disable source maps
146
+ "separateEngine": false, // Include engine in bundle
147
+
148
+ // Texture optimization
149
+ "packAutoAtlas": true, // Auto-generate atlases
150
+ "textureCompression": "auto", // Enable compression
151
+
152
+ // Feature exclusions
153
+ "excludeScenes": [], // Remove unused scenes
154
+ "useBuiltinServer": false // Playables don't need server
155
+ }
156
+ ```
157
+
158
+ ## Removing Unused Assets
159
+
160
+ ```typescript
161
+ // ✅ EXCELLENT: Regular asset cleanup
162
+
163
+ // 1. Use Cocos Creator's "Find References" feature
164
+ // - Right-click asset → Find References
165
+ // - Delete if no references found
166
+
167
+ // 2. Check build output
168
+ // - Review build folder size after each build
169
+ // - Identify largest files
170
+ // - Remove unused assets
171
+
172
+ // 3. Remove debug assets before build
173
+ // - Test levels
174
+ // - Debug sprites and textures
175
+ // - Development-only tools
176
+ // - Temporary assets
177
+
178
+ // ❌ WRONG: Keep all assets "just in case"
179
+ // - Unused textures add unnecessary size
180
+ // - Clean up regularly during development
181
+ ```
182
+
183
+ ## Real-World Example: Size Breakdown
184
+
185
+ ```typescript
186
+ // Target: <5MB playable bundle
187
+ // Typical optimized breakdown:
188
+
189
+ // Textures: 2.5MB (50%)
190
+ // - Character sprites: 800KB (sprite atlas, ETC1 compressed)
191
+ // - UI elements: 600KB (sprite atlas, ETC1 compressed)
192
+ // - Background: 700KB (1024x1024, compressed, or tiled)
193
+ // - Effects: 400KB (sprite atlas, compressed)
194
+
195
+ // Code: 400KB (8%)
196
+ // - Cocos engine: 200KB (minified, tree-shaken)
197
+ // - Game logic: 200KB (minified, dead code removed)
198
+
199
+ // Audio: 1.5MB (30%)
200
+ // - Background music: 1MB (MP3, 128kbps, 60s loop)
201
+ // - Sound effects: 500KB (MP3, 64kbps, 10 short clips)
202
+
203
+ // Other: 600KB (12%)
204
+ // - Bitmap fonts: 200KB (only needed characters)
205
+ // - Config files: 100KB (JSON, minified)
206
+ // - Misc assets: 300KB
207
+
208
+ // Total: 5.0MB (within ad network limit)
209
+
210
+ // ❌ BAD EXAMPLE: Unoptimized (12MB+)
211
+ // - Textures: 8MB (no compression, individual files)
212
+ // - Audio: 3MB (WAV files, long tracks)
213
+ // - Code: 800KB (no minification, dev mode)
214
+ // - Fonts: 400KB (TTF fonts)
215
+ // Total: 12.2MB (rejected by ad networks!)
216
+ ```
217
+
218
+ ## Monitoring Bundle Size
219
+
220
+ ```bash
221
+ # ✅ EXCELLENT: Monitor size regularly
222
+
223
+ # 1. Check build output size
224
+ du -sh build/web-mobile/
225
+
226
+ # 2. Break down by asset type
227
+ du -sh build/web-mobile/assets/
228
+ du -sh build/web-mobile/src/
229
+
230
+ # 3. Find largest files
231
+ find build/web-mobile -type f -exec du -h {} \; | sort -rh | head -20
232
+
233
+ # 4. Set size budget in CI/CD
234
+ # Fail build if bundle >5MB
235
+ # Alert if bundle >4.5MB (warning threshold)
236
+ ```
237
+
238
+ ## Lazy Loading Pattern (Optional)
239
+
240
+ ```typescript
241
+ import { _decorator, Component, resources, Prefab } from 'cc';
242
+ const { ccclass } = _decorator;
243
+
244
+ @ccclass('LazyLoader')
245
+ export class LazyLoader extends Component {
246
+ // ✅ EXCELLENT: Load levels on demand
247
+ // For playables with multiple levels, load only current level
248
+
249
+ private levelPrefabs: Map<number, Prefab> = new Map();
250
+
251
+ public async loadLevel(levelId: number): Promise<void> {
252
+ if (this.levelPrefabs.has(levelId)) {
253
+ return; // Already loaded
254
+ }
255
+
256
+ const path = `levels/level_${levelId}`;
257
+ return new Promise((resolve, reject) => {
258
+ resources.load(path, Prefab, (err, prefab) => {
259
+ if (err) {
260
+ reject(err);
261
+ return;
262
+ }
263
+ this.levelPrefabs.set(levelId, prefab);
264
+ resolve();
265
+ });
266
+ });
267
+ }
268
+
269
+ // ✅ GOOD: Unload previous level
270
+ public async switchLevel(fromLevel: number, toLevel: number): Promise<void> {
271
+ const prevPrefab = this.levelPrefabs.get(fromLevel);
272
+ if (prevPrefab) {
273
+ prevPrefab.decRef();
274
+ this.levelPrefabs.delete(fromLevel);
275
+ }
276
+ await this.loadLevel(toLevel);
277
+ }
278
+ }
279
+
280
+ // ❌ WRONG: Loading all levels at start
281
+ // - Increases initial bundle size
282
+ // - Longer load time
283
+ // - Only load what's needed for first level
284
+ ```
285
+
286
+ ## Size Optimization Checklist
287
+
288
+ **🔴 Critical (Biggest Impact):**
289
+ - [ ] Enable texture compression (auto or platform-specific)
290
+ - [ ] Use sprite atlases (combine textures)
291
+ - [ ] Reduce texture dimensions (512x512 max for characters)
292
+ - [ ] Compress audio (MP3/OGG, 64-128kbps)
293
+ - [ ] Remove unused assets
294
+
295
+ **🟡 Important:**
296
+ - [ ] Enable code minification (drop_console, dead_code removal)
297
+ - [ ] Use bitmap fonts (not TTF)
298
+ - [ ] Disable source maps in production
299
+ - [ ] Import specific modules (tree shaking)
300
+ - [ ] Remove debug/test assets
301
+
302
+ **🟢 Nice to Have:**
303
+ - [ ] Lazy load levels (if multiple levels)
304
+ - [ ] Monitor bundle size in CI/CD
305
+ - [ ] Set size budget alerts (<5MB hard limit)
306
+ - [ ] Track size trends over time
307
+
308
+ **Target: <5MB total bundle size for playable ad approval.**