spawnpack 0.1.8 → 0.1.10
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/README.md +14 -1
- package/package.json +1 -1
- package/templates/AGENTS.md +63 -22
- package/templates/CLAUDE.md +63 -22
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ It generates BP/RP structure, optional Script API setup, optional rgl integratio
|
|
|
20
20
|
- Optional AI setup:
|
|
21
21
|
- `CLAUDE.md` for Claude
|
|
22
22
|
- `AGENTS.md` for Other
|
|
23
|
-
- `.mcp.json`
|
|
23
|
+
- `.mcp.json` with keyless MCP servers
|
|
24
24
|
|
|
25
25
|
## Runtime Requirement
|
|
26
26
|
|
|
@@ -97,6 +97,18 @@ Depending on your choices, Spawnpack can generate:
|
|
|
97
97
|
- `CLAUDE.md`
|
|
98
98
|
- `AGENTS.md`
|
|
99
99
|
- `.mcp.json`
|
|
100
|
+
|
|
101
|
+
## AI MCP setup
|
|
102
|
+
|
|
103
|
+
When AI setup is enabled, Spawnpack generates an `.mcp.json` that works out of the box without API keys.
|
|
104
|
+
|
|
105
|
+
Generated MCP servers currently include:
|
|
106
|
+
|
|
107
|
+
- Exa hosted MCP (`https://mcp.exa.ai/mcp`) for free, rate-limited web/documentation search
|
|
108
|
+
- `grep_app` for code search
|
|
109
|
+
- `context7` for library documentation context
|
|
110
|
+
|
|
111
|
+
You can add your own Exa API key later if you need higher Exa limits, but it is not required for the generated scaffold.
|
|
100
112
|
|
|
101
113
|
## Marketplace structure mode
|
|
102
114
|
|
|
@@ -139,6 +151,7 @@ bun run build
|
|
|
139
151
|
The npm package is configured to publish only:
|
|
140
152
|
|
|
141
153
|
- `dist/spawnpack.js`
|
|
154
|
+
- `bin/spawnpack.js`
|
|
142
155
|
- `templates/CLAUDE.md`
|
|
143
156
|
- `templates/AGENTS.md`
|
|
144
157
|
- `README.md`
|
package/package.json
CHANGED
package/templates/AGENTS.md
CHANGED
|
@@ -160,6 +160,37 @@ For non-trivial changes: pause and ask "is there a more elegant way?" If a fix f
|
|
|
160
160
|
Write code that reads like a human wrote it. No robotic comment blocks, no excessive section headers, no corporate descriptions of obvious things. If three experienced devs would all write it the same way, that's the way.
|
|
161
161
|
</behavior>
|
|
162
162
|
|
|
163
|
+
<code_style name="boring_durable_addon_code" priority="high">
|
|
164
|
+
Prefer code that is easy for an add-on developer to read top-to-bottom. Use boring, linear code as the default; add durability machinery only at persistence, async timing, entity lifecycle, duplication, or data-loss boundaries.
|
|
165
|
+
|
|
166
|
+
Style rules:
|
|
167
|
+
- Write linear, imperative code by default: do A, then B, then C.
|
|
168
|
+
- Prefer guard clauses and early returns over nested branching.
|
|
169
|
+
- Keep behavior close to where it happens.
|
|
170
|
+
- Avoid framework-like abstractions unless they clearly reduce repeated complexity.
|
|
171
|
+
- Prefer explicit state names over clever generic names.
|
|
172
|
+
- Make the happy path obvious.
|
|
173
|
+
- Split code by real gameplay/lifecycle responsibility, not by abstract pattern.
|
|
174
|
+
- Do not hide important game-state transitions behind vague helpers.
|
|
175
|
+
- If durability/data-loss protection requires complexity, isolate it behind a small, boring API.
|
|
176
|
+
- Keep normal gameplay code simple even when the persistence/lifecycle layer underneath is more defensive.
|
|
177
|
+
- Do not copy another contributor's style blindly; use their readability as a reference while preserving correctness.
|
|
178
|
+
- Prefer one obvious source of truth for each piece of state.
|
|
179
|
+
- Before adding a new helper/class/system, ask: "Will this make the next maintainer understand the code faster?"
|
|
180
|
+
</code_style>
|
|
181
|
+
|
|
182
|
+
<implementation_preference name="minimal_safe_patch" priority="high">
|
|
183
|
+
When fixing bugs:
|
|
184
|
+
1. First find the smallest clear fix near the bug.
|
|
185
|
+
2. Add stronger safety only where data loss, duplication, or invalid world state can happen.
|
|
186
|
+
3. Avoid broad lifecycle rewrites unless the current lifecycle is the root cause.
|
|
187
|
+
4. If a durable solution needs more machinery, keep the public flow simple and document the responsibility through naming, not comments.
|
|
188
|
+
</implementation_preference>
|
|
189
|
+
|
|
190
|
+
<behavior name="use_simplify_skill_for_maintainability" priority="high">
|
|
191
|
+
Use the `simplify` skill for maintainability, not only cleanup. When the user asks to simplify, clean up, refactor for readability, reduce complexity, or make code easier to maintain, load `simplify` before planning or editing. For non-trivial implementation work, use `simplify` as a post-implementation review pass before final verification: check whether the new code can be made more obvious, boring, local, and behavior-preserving. In orchestrated workflows, explicitly include this maintainability review after implementation and before reporting completion. For broad codebase cleanup, audit first, propose small phases, and wait for approval before editing.
|
|
192
|
+
</behavior>
|
|
193
|
+
|
|
163
194
|
<behavior name="dead_code_hygiene" priority="medium">
|
|
164
195
|
After refactoring or implementing changes:
|
|
165
196
|
- Identify code that is now unreachable
|
|
@@ -215,27 +246,37 @@ PLAN:
|
|
|
215
246
|
ALWAYS use Exa to search the latest Minecraft Script API documentation before implementing. APIs change every major update — never trust memory.
|
|
216
247
|
</guideline>
|
|
217
248
|
|
|
218
|
-
<guideline name="
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
249
|
+
<guideline name="guard_first_error_handling" priority="critical">
|
|
250
|
+
Prefer **guard clauses** for predictable invalid state: missing values, unloaded or invalid entities, optional components, permissions, and known preconditions. `throw`, `try`, and `catch` are allowed when they are truly necessary: APIs can fail despite correct guards, you are crossing IO/persistence/parsing/async boundaries, or you need cleanup, recovery, or clearer error context.
|
|
251
|
+
|
|
252
|
+
Keep `catch` blocks narrow and purposeful. Do not use `try-catch` as normal control flow, to hide mistakes, or where a simple guard makes the failure impossible.
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
// ✅ CORRECT: Use guard clauses
|
|
256
|
+
function processBlock(block: Block | undefined): void {
|
|
224
257
|
if (!block) return;
|
|
225
258
|
if (!block.isValid) return;
|
|
226
259
|
const permutation = block.permutation;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
//
|
|
230
|
-
function
|
|
231
|
-
try {
|
|
232
|
-
|
|
233
|
-
} catch (
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// ✅ CORRECT: Use try-catch only at a real failure boundary
|
|
263
|
+
function loadSavedConfig(rawConfig: string): AddonConfig {
|
|
264
|
+
try {
|
|
265
|
+
return JSON.parse(rawConfig) as AddonConfig;
|
|
266
|
+
} catch (error) {
|
|
267
|
+
throw new Error("Saved addon config is not valid JSON", { cause: error });
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ❌ WRONG: Catching instead of checking known state
|
|
272
|
+
function processBlockBad(block: Block | undefined): void {
|
|
273
|
+
try {
|
|
274
|
+
const permutation = block!.permutation;
|
|
275
|
+
} catch {
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
</guideline>
|
|
239
280
|
|
|
240
281
|
<guideline name="typescript_verification" priority="critical">
|
|
241
282
|
ALWAYS run `tsc --noEmit` after implementing. Ensure **zero warnings, zero errors, and no unused variables/imports**.
|
|
@@ -364,7 +405,7 @@ ALWAYS use Minecraft Bedrock Edition JSON Schemas for validation of BP/RP JSON f
|
|
|
364
405
|
- Use explicit return types on functions
|
|
365
406
|
- Use `readonly` for immutable properties
|
|
366
407
|
- Prefer interfaces over type aliases for object shapes
|
|
367
|
-
- Use `undefined` checks
|
|
408
|
+
- Use `undefined` checks and guard clauses before reaching for try-catch
|
|
368
409
|
</best_practices>
|
|
369
410
|
|
|
370
411
|
<best_practices name="script_api">
|
|
@@ -567,7 +608,7 @@ POTENTIAL CONCERNS:
|
|
|
567
608
|
13. Editing files from stale context without re-reading first
|
|
568
609
|
14. Duplicating state instead of fixing the real problem
|
|
569
610
|
15. Writing library/framework code from memory without searching Exa for current docs first
|
|
570
|
-
16. Using try-catch in Minecraft Script API code
|
|
611
|
+
16. Using broad try-catch in Minecraft Script API code where guard clauses would be clearer
|
|
571
612
|
17. Creating custom math functions when @minecraft/math has them available
|
|
572
613
|
18. Using raw strings instead of @minecraft/vanilla-data typed identifiers
|
|
573
614
|
19. Writing BP/RP JSON files without schema validation
|
|
@@ -583,7 +624,7 @@ You have unlimited stamina. The human does not. Use your persistence wisely —
|
|
|
583
624
|
1. **EXA FOR DOCS** — Always search library/framework docs via Exa before implementing
|
|
584
625
|
2. **VERIFY BEFORE DONE** — Type-check, lint, test before claiming success
|
|
585
626
|
3. **PLAN BEFORE BUILD** — Spec and approval before implementation
|
|
586
|
-
4. **GUARD CLAUSES** —
|
|
627
|
+
4. **GUARD CLAUSES FIRST** — Prefer guards; use throw/try-catch only at real failure boundaries
|
|
587
628
|
5. **VANILLA-DATA** — Use typed identifiers from @minecraft/vanilla-data
|
|
588
629
|
6. **MINECRAFT-MATH** — Use @minecraft/math library for math operations
|
|
589
630
|
7. **JSON SCHEMAS** — Validate BP/RP JSONs with Rockide/schemas
|
|
@@ -594,7 +635,7 @@ You have unlimited stamina. The human does not. Use your persistence wisely —
|
|
|
594
635
|
- ❌ Said "Done!" without running type-check/lint/tests? → Violated forced verification rule
|
|
595
636
|
- ❌ Edited a file from memory after 10+ messages without re-reading? → Violated context decay rule
|
|
596
637
|
- ❌ Started building without plan approval on a non-trivial task? → Violated plan-build separation
|
|
597
|
-
- ❌ Used try-catch
|
|
638
|
+
- ❌ Used broad try-catch where guards would work? → Violated guard-first error handling
|
|
598
639
|
- ❌ Made changes without running `tsc --noEmit`? → Violated TypeScript verification
|
|
599
640
|
- ❌ Created custom math function without checking @minecraft/math? → Violated library-first rule
|
|
600
641
|
- ❌ Used raw string like `"inventory"` or `"minecraft:wolf"`? → Violated vanilla-data rule
|
package/templates/CLAUDE.md
CHANGED
|
@@ -160,6 +160,37 @@ For non-trivial changes: pause and ask "is there a more elegant way?" If a fix f
|
|
|
160
160
|
Write code that reads like a human wrote it. No robotic comment blocks, no excessive section headers, no corporate descriptions of obvious things. If three experienced devs would all write it the same way, that's the way.
|
|
161
161
|
</behavior>
|
|
162
162
|
|
|
163
|
+
<code_style name="boring_durable_addon_code" priority="high">
|
|
164
|
+
Prefer code that is easy for an add-on developer to read top-to-bottom. Use boring, linear code as the default; add durability machinery only at persistence, async timing, entity lifecycle, duplication, or data-loss boundaries.
|
|
165
|
+
|
|
166
|
+
Style rules:
|
|
167
|
+
- Write linear, imperative code by default: do A, then B, then C.
|
|
168
|
+
- Prefer guard clauses and early returns over nested branching.
|
|
169
|
+
- Keep behavior close to where it happens.
|
|
170
|
+
- Avoid framework-like abstractions unless they clearly reduce repeated complexity.
|
|
171
|
+
- Prefer explicit state names over clever generic names.
|
|
172
|
+
- Make the happy path obvious.
|
|
173
|
+
- Split code by real gameplay/lifecycle responsibility, not by abstract pattern.
|
|
174
|
+
- Do not hide important game-state transitions behind vague helpers.
|
|
175
|
+
- If durability/data-loss protection requires complexity, isolate it behind a small, boring API.
|
|
176
|
+
- Keep normal gameplay code simple even when the persistence/lifecycle layer underneath is more defensive.
|
|
177
|
+
- Do not copy another contributor's style blindly; use their readability as a reference while preserving correctness.
|
|
178
|
+
- Prefer one obvious source of truth for each piece of state.
|
|
179
|
+
- Before adding a new helper/class/system, ask: "Will this make the next maintainer understand the code faster?"
|
|
180
|
+
</code_style>
|
|
181
|
+
|
|
182
|
+
<implementation_preference name="minimal_safe_patch" priority="high">
|
|
183
|
+
When fixing bugs:
|
|
184
|
+
1. First find the smallest clear fix near the bug.
|
|
185
|
+
2. Add stronger safety only where data loss, duplication, or invalid world state can happen.
|
|
186
|
+
3. Avoid broad lifecycle rewrites unless the current lifecycle is the root cause.
|
|
187
|
+
4. If a durable solution needs more machinery, keep the public flow simple and document the responsibility through naming, not comments.
|
|
188
|
+
</implementation_preference>
|
|
189
|
+
|
|
190
|
+
<behavior name="use_simplify_skill_for_maintainability" priority="high">
|
|
191
|
+
Use the `simplify` skill for maintainability, not only cleanup. When the user asks to simplify, clean up, refactor for readability, reduce complexity, or make code easier to maintain, load `simplify` before planning or editing. For non-trivial implementation work, use `simplify` as a post-implementation review pass before final verification: check whether the new code can be made more obvious, boring, local, and behavior-preserving. In orchestrated workflows, explicitly include this maintainability review after implementation and before reporting completion. For broad codebase cleanup, audit first, propose small phases, and wait for approval before editing.
|
|
192
|
+
</behavior>
|
|
193
|
+
|
|
163
194
|
<behavior name="dead_code_hygiene" priority="medium">
|
|
164
195
|
After refactoring or implementing changes:
|
|
165
196
|
- Identify code that is now unreachable
|
|
@@ -215,27 +246,37 @@ PLAN:
|
|
|
215
246
|
ALWAYS use Exa to search the latest Minecraft Script API documentation before implementing. APIs change every major update — never trust memory.
|
|
216
247
|
</guideline>
|
|
217
248
|
|
|
218
|
-
<guideline name="
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
249
|
+
<guideline name="guard_first_error_handling" priority="critical">
|
|
250
|
+
Prefer **guard clauses** for predictable invalid state: missing values, unloaded or invalid entities, optional components, permissions, and known preconditions. `throw`, `try`, and `catch` are allowed when they are truly necessary: APIs can fail despite correct guards, you are crossing IO/persistence/parsing/async boundaries, or you need cleanup, recovery, or clearer error context.
|
|
251
|
+
|
|
252
|
+
Keep `catch` blocks narrow and purposeful. Do not use `try-catch` as normal control flow, to hide mistakes, or where a simple guard makes the failure impossible.
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
// ✅ CORRECT: Use guard clauses
|
|
256
|
+
function processBlock(block: Block | undefined): void {
|
|
224
257
|
if (!block) return;
|
|
225
258
|
if (!block.isValid) return;
|
|
226
259
|
const permutation = block.permutation;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
//
|
|
230
|
-
function
|
|
231
|
-
try {
|
|
232
|
-
|
|
233
|
-
} catch (
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// ✅ CORRECT: Use try-catch only at a real failure boundary
|
|
263
|
+
function loadSavedConfig(rawConfig: string): AddonConfig {
|
|
264
|
+
try {
|
|
265
|
+
return JSON.parse(rawConfig) as AddonConfig;
|
|
266
|
+
} catch (error) {
|
|
267
|
+
throw new Error("Saved addon config is not valid JSON", { cause: error });
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// ❌ WRONG: Catching instead of checking known state
|
|
272
|
+
function processBlockBad(block: Block | undefined): void {
|
|
273
|
+
try {
|
|
274
|
+
const permutation = block!.permutation;
|
|
275
|
+
} catch {
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
</guideline>
|
|
239
280
|
|
|
240
281
|
<guideline name="typescript_verification" priority="critical">
|
|
241
282
|
ALWAYS run `tsc --noEmit` after implementing. Ensure **zero warnings, zero errors, and no unused variables/imports**.
|
|
@@ -364,7 +405,7 @@ ALWAYS use Minecraft Bedrock Edition JSON Schemas for validation of BP/RP JSON f
|
|
|
364
405
|
- Use explicit return types on functions
|
|
365
406
|
- Use `readonly` for immutable properties
|
|
366
407
|
- Prefer interfaces over type aliases for object shapes
|
|
367
|
-
- Use `undefined` checks
|
|
408
|
+
- Use `undefined` checks and guard clauses before reaching for try-catch
|
|
368
409
|
</best_practices>
|
|
369
410
|
|
|
370
411
|
<best_practices name="script_api">
|
|
@@ -567,7 +608,7 @@ POTENTIAL CONCERNS:
|
|
|
567
608
|
13. Editing files from stale context without re-reading first
|
|
568
609
|
14. Duplicating state instead of fixing the real problem
|
|
569
610
|
15. Writing library/framework code from memory without searching Exa for current docs first
|
|
570
|
-
16. Using try-catch in Minecraft Script API code
|
|
611
|
+
16. Using broad try-catch in Minecraft Script API code where guard clauses would be clearer
|
|
571
612
|
17. Creating custom math functions when @minecraft/math has them available
|
|
572
613
|
18. Using raw strings instead of @minecraft/vanilla-data typed identifiers
|
|
573
614
|
19. Writing BP/RP JSON files without schema validation
|
|
@@ -583,7 +624,7 @@ You have unlimited stamina. The human does not. Use your persistence wisely —
|
|
|
583
624
|
1. **EXA FOR DOCS** — Always search library/framework docs via Exa before implementing
|
|
584
625
|
2. **VERIFY BEFORE DONE** — Type-check, lint, test before claiming success
|
|
585
626
|
3. **PLAN BEFORE BUILD** — Spec and approval before implementation
|
|
586
|
-
4. **GUARD CLAUSES** —
|
|
627
|
+
4. **GUARD CLAUSES FIRST** — Prefer guards; use throw/try-catch only at real failure boundaries
|
|
587
628
|
5. **VANILLA-DATA** — Use typed identifiers from @minecraft/vanilla-data
|
|
588
629
|
6. **MINECRAFT-MATH** — Use @minecraft/math library for math operations
|
|
589
630
|
7. **JSON SCHEMAS** — Validate BP/RP JSONs with Rockide/schemas
|
|
@@ -594,7 +635,7 @@ You have unlimited stamina. The human does not. Use your persistence wisely —
|
|
|
594
635
|
- ❌ Said "Done!" without running type-check/lint/tests? → Violated forced verification rule
|
|
595
636
|
- ❌ Edited a file from memory after 10+ messages without re-reading? → Violated context decay rule
|
|
596
637
|
- ❌ Started building without plan approval on a non-trivial task? → Violated plan-build separation
|
|
597
|
-
- ❌ Used try-catch
|
|
638
|
+
- ❌ Used broad try-catch where guards would work? → Violated guard-first error handling
|
|
598
639
|
- ❌ Made changes without running `tsc --noEmit`? → Violated TypeScript verification
|
|
599
640
|
- ❌ Created custom math function without checking @minecraft/math? → Violated library-first rule
|
|
600
641
|
- ❌ Used raw string like `"inventory"` or `"minecraft:wolf"`? → Violated vanilla-data rule
|