spawnpack 0.1.23 → 0.2.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/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "spawnpack",
3
- "version": "0.1.23",
3
+ "version": "0.2.0",
4
4
  "description": "Minecraft Bedrock addon project generator — scaffold your BP+RP in seconds",
5
- "author": "veedy-dev",
5
+ "author": "ve3dy",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "bin": {
@@ -11,8 +11,6 @@
11
11
  "files": [
12
12
  "bin/spawnpack.js",
13
13
  "dist/spawnpack.js",
14
- "templates/AGENTS.md",
15
- "templates/filters/typegen/main.js",
16
14
  "README.md",
17
15
  "LICENSE",
18
16
  "package.json"
@@ -1,51 +0,0 @@
1
- ## Documentation lookup
2
-
3
- - Before relying on version-sensitive or unfamiliar Minecraft Bedrock behavior, verify the relevant current documentation for the project's target Minecraft and Script API versions and stable/preview status. This includes Script API, BP/RP JSON formats, components, events, schemas, MoLang, manifests, commands, animations, and pack behavior.
4
- - Prefer Exa MCP for documentation and web research. If Exa is unavailable, use built-in web search or browsing. Use Context7 only as a last resort because its indexed documentation may lag behind current releases.
5
- - Prefer current Microsoft Creator documentation and versioned references on `bedrock.dev`. For Script API, also use `https://jaylydev.github.io/scriptapi-docs/latest/`. Use `wiki.bedrock.dev` for established concepts and proven implementation patterns. Confirm stable versus preview status and the target Minecraft version.
6
- - For other external libraries, frameworks, SDKs, APIs, and CLI tools, verify current official documentation before relying on unfamiliar or version-sensitive behavior.
7
-
8
- ## Technical judgment
9
-
10
- - Do not assume the user or the agent is correct. Before implementing, verify assumptions against current documentation, repository evidence, established patterns, or a working project sample.
11
- - If those sources do not resolve a choice that materially affects the result, ask the user for a reference, pattern, or sample project.
12
- - If evidence shows the requested approach is incorrect, unsafe, incompatible, unnecessarily complex, or slower than a supported alternative, explain why and recommend the better implementation. Follow the user's final choice unless it violates safety or repository constraints.
13
-
14
- ## Verification
15
-
16
- - After TypeScript changes, run `tsc --noEmit`.
17
- - For JavaScript, run the project's configured `npm run typecheck` or `npm run check` script when present.
18
- - Do not create or run tests unless the user asks or an existing repository policy explicitly requires them.
19
- - If the relevant command is unavailable or fails for a pre-existing reason, state that plainly.
20
-
21
- ## Code rules
22
-
23
- - Do not write comments that restate the code. Use clear naming and straightforward structure so the code is self-explanatory; comment only non-obvious workarounds or engine quirks.
24
- - Validate predictable invalid states before calling an API. Use `try-catch` only for a documented or observed unguardable failure when the catch performs meaningful recovery, cleanup, translation, or contextual rethrow. Keep the `try` block narrow; never silently swallow errors.
25
-
26
- ## Minecraft Bedrock conventions
27
-
28
- - Guard before Script API calls that can throw: check `entity.isValid` (players are valid only while loaded) before `getComponent`/`getComponents`; confirm the chunk is loaded before `dimension.getBlock`/`spawnEntity`; and use containers only after re-fetching them from a current block or entity rather than holding a stale reference. Defer world-mutating work from read-only or early-execution callbacks with `system.run`. Reserve `try-catch` for calls whose validity cannot be checked in advance, such as `runCommand` throwing `CommandError`.
29
- - Prefer `@minecraft/vanilla-data` typed identifiers over raw component, entity, block, item, and effect strings.
30
- - Check `@minecraft/math` before writing vector, matrix, clamp, lerp, or similar math helpers.
31
- - Validate changed BP/RP JSON against the project's configured Bedrock schemas when available.
32
- - In Regolith projects, inspect compilation output through `.regolith/tmp` without resolving its symlinks.
33
-
34
- ## Performance preferences
35
-
36
- - Before adding `system.runInterval` polling, check the project's Script API version and current documentation for a matching event. Prefer the event when it provides the required data and timing, such as `PlayerInventoryItemChangeAfterEventSignal` instead of repeatedly scanning every player's inventory or hotbar for item changes. Poll only when no suitable event exists or the event cannot represent the required behavior; then minimize the polling frequency, players, slots, and work performed.
37
- - In hot loops, iterate maps directly with `for (const value of map.values())`. Do not spread maps into temporary arrays or iterate entry pairs when values or keys are enough.
38
- - Cache stable configuration in memory and persist only when values actually change.
39
-
40
- ## Repository hygiene
41
-
42
- - Never discard, overwrite, or revert unrelated user changes.
43
- - Do not create repository files for agent memory, lessons, session notes, plans, or debugging logs.
44
- - Do not create or update documentation, changelogs, or generated artifacts unless requested or required by the changed contract.
45
- - Do not commit, push, publish, or delete unrelated files unless explicitly requested.
46
- - Commit messages, when requested, use short natural subjects without Conventional Commit prefixes, AI/tool attribution, or structured report trailers. Split unrelated logical changes into separate commits.
47
-
48
- ## Communication
49
-
50
- - Be direct and concise. State assumptions only when they materially affect the implementation.
51
- - After changes, report what changed, the verification evidence, and any real blocker or residual risk. Do not add ritual sections for untouched files.
@@ -1,86 +0,0 @@
1
- import { pascalCase } from "es-toolkit";
2
- import * as JSONC from "jsonc-parser";
3
- import { glob, mkdir, readFile, writeFile } from "node:fs/promises";
4
- import { matchesGlob } from "node:path";
5
-
6
- const entries = [
7
- {
8
- type: "BlockId",
9
- pattern: "BP/blocks/**/*.json",
10
- jsonPath: ["minecraft:block", "description", "identifier"],
11
- identifiers: [],
12
- },
13
- {
14
- type: "EntityId",
15
- pattern: "BP/entities/**/*.json",
16
- jsonPath: ["minecraft:entity", "description", "identifier"],
17
- identifiers: [],
18
- },
19
- {
20
- type: "ItemId",
21
- pattern: "BP/items/**/*.json",
22
- jsonPath: ["minecraft:item", "description", "identifier"],
23
- identifiers: [],
24
- },
25
- ];
26
-
27
- for (const dir of ["BP", "RP"]) {
28
- for await (const path of glob(`${dir}/**/*.json`)) {
29
- const entry = entries.find((f) => matchesGlob(path, f.pattern));
30
- if (!entry) continue;
31
-
32
- let found = false;
33
- const text = await readFile(path, "utf8");
34
- JSONC.visit(text, {
35
- onArrayBegin() {
36
- return !found;
37
- },
38
- onObjectBegin() {
39
- return !found;
40
- },
41
- onLiteralValue(value, _offset, _length, _startLine, _startCharacter, pathSupplier) {
42
- if (typeof value !== "string") return;
43
- if (!pathSupplier().every((segment, i) => segment === entry.jsonPath[i])) return;
44
-
45
- found = true;
46
- entry.identifiers.push(value);
47
- },
48
- });
49
- }
50
- }
51
-
52
- const lines = ["// Auto-generated file. DO NOT EDIT MANUALLY!\n"];
53
-
54
- for (const entry of entries) {
55
- if (entry.identifiers.length === 0) continue;
56
-
57
- lines.push(`export const enum ${entry.type} {`);
58
- for (const id of entry.identifiers) {
59
- const colIndex = id.indexOf(":");
60
- if (colIndex === -1) {
61
- console.warn(`Invalid identifier: ${id}`);
62
- continue;
63
- }
64
- const name = id.slice(colIndex + 1).trim();
65
- if (name === "") {
66
- console.warn(`Invalid identifier: ${id}`);
67
- continue;
68
- }
69
- lines.push(`\t${pascalCase(name)} = "${id}",`);
70
- }
71
- lines.push(`}\n`);
72
- }
73
-
74
- const res = lines.join("\n");
75
-
76
- const ROOT_DIR = process.env.ROOT_DIR;
77
-
78
- const current = await readFile(`${ROOT_DIR}/data/scripts/generated_types.ts`, "utf8")
79
- .catch(() => null);
80
-
81
- if (current !== res) {
82
- await Promise.all([
83
- writeFile(`${ROOT_DIR}/data/scripts/generated_types.ts`, res),
84
- writeFile("./data/scripts/generated_types.ts", res),
85
- ]);
86
- }