create-mcbe 0.1.0-beta.1

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 ADDED
@@ -0,0 +1,93 @@
1
+ # create-mcbe
2
+
3
+ An extensible Minecraft Bedrock project scaffold generator for both interactive users and coding agents.
4
+
5
+ ## One-command setup for agents
6
+
7
+ Create an SAPI-Pro behavior-pack project, install its npm dependencies, install BePack locally, and resolve Script API dependencies:
8
+
9
+ ```bash
10
+ npm create mcbe@latest my-addon -- --template sapi-pro --yes --install
11
+ ```
12
+
13
+ Then build the project:
14
+
15
+ ```bash
16
+ cd my-addon && npm run build
17
+ ```
18
+
19
+ To use a globally installed BePack instead of installing it in the project:
20
+
21
+ ```bash
22
+ npm create mcbe@latest my-addon -- --template sapi-pro --skip-bepack-install --yes
23
+ ```
24
+
25
+ Then run:
26
+
27
+ ```bash
28
+ cd my-addon && bepack install && npm run build
29
+ ```
30
+
31
+ Use `--json` when an agent needs machine-readable output:
32
+
33
+ ```bash
34
+ npm create mcbe@latest my-addon -- --template bepack-addon --yes --install --json
35
+ ```
36
+
37
+ ## Templates
38
+
39
+ | Template | Description |
40
+ | --- | --- |
41
+ | `sapi-pro` | SAPI-Pro behavior pack with the built-in `sapi-pro` BePack plugin |
42
+ | `bepack-behavior` | TypeScript behavior pack managed by BePack |
43
+ | `bepack-addon` | TypeScript behavior pack and resource pack managed by BePack |
44
+ | `behavior-pack` | Data-only behavior pack without scripts or build tools |
45
+ | `resource-pack` | Data-only resource pack without scripts or build tools |
46
+
47
+ List available templates:
48
+
49
+ ```bash
50
+ npm create mcbe@latest -- --list-templates
51
+ ```
52
+
53
+ ## Common options
54
+
55
+ - `--template <id>`: Select a template.
56
+ - `--yes`: Use defaults and disable prompts; recommended for agents.
57
+ - `--install`: Install project dependencies after creation. For BePack templates, also run the BePack install script.
58
+ - If a template declares `skills`, `--install` also installs each source into the generated project with `npx skills add`.
59
+ - `--skip-skills-install`: Do not install skills declared by the template. This only skips skills; npm and BePack installation still run when `--install` is used.
60
+ - `--install-bepack`: Install BePack in the generated project.
61
+ - `--skip-bepack-install`: Do not install BePack locally; use the global `bepack` command.
62
+ - `--pm <npm|pnpm|yarn|bun>`: Select the package manager.
63
+ - `--git`: Initialize a Git repository.
64
+ - `--json`: Print machine-readable JSON output.
65
+ - `--cwd <path>`: Set the directory where the project is created.
66
+ - `--force`: Allow overwriting a non-empty target directory.
67
+
68
+ ## Interactive mode
69
+
70
+ Run without arguments to choose the project name, template, and BePack installation mode interactively:
71
+
72
+ ```bash
73
+ npm create mcbe
74
+ ```
75
+
76
+ ## Development
77
+
78
+ Run these commands from the BePack monorepo root:
79
+
80
+ ```bash
81
+ npm run build:create-mcbe
82
+ npm run check:create-mcbe
83
+ npm run test:create-mcbe
84
+ ```
85
+
86
+ To add a template, create a directory under `templates/` and register its definition in `src/templates/index.ts`.
87
+
88
+ Template authors can opt into skills by adding a URL (or URLs) to the template definition:
89
+
90
+ ```ts
91
+ skills: 'https://github.com/example/agent-skills'
92
+ // or: skills: ['https://github.com/example/skills-a', 'https://github.com/example/skills-b']
93
+ ```
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire as e}from"node:module";import{styleText as t}from"node:util";import n,{stdin as r,stdout as i}from"node:process";import a from"node:readline";import o from"node:path";import s from"node:fs/promises";import{spawn as c}from"node:child_process";import l from"node:crypto";import{fileURLToPath as u}from"node:url";var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},y=(e,t,n)=>(n=e==null?{}:d(h(e)),v(t||!e||!e.__esModule?f(n,`default`,{value:e,enumerable:!0}):n,e));const b=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),x=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ee=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,te=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,ne=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,re=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,ie=/\t{1,1000}/y,ae=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,oe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,se=/\p{M}+/gu,ce={limit:1/0,ellipsis:``},S=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?S(i,ce,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[oe,l],[te,0],[ne,o],[ie,s],[ae,c],[re,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,C=0,w=0,T=0;outer:for(;;){if(C>y||p>=m&&p>f){let t=e.slice(y,C)||e.slice(f,p);h=0;for(let e of t.replaceAll(se,``)){let t=e.codePointAt(0)||0;if(T=x(t)?2:ee(t)?u:l,w+T>v&&(_=Math.min(_,Math.max(y,f)+h)),w+T>r){g=!0;break outer}h+=e.length,w+=T}y=C=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===re?b(e.slice(p,n.lastIndex)):n===ae?1:n.lastIndex-p,T=h*i,w+T>v&&(_=Math.min(_,p+Math.floor((v-w)/i))),w+T>r){g=!0;break outer}w+=T,y=f,C=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:w,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},C={limit:1/0,ellipsis:``,ellipsisWidth:0},w=(e,t={})=>S(e,C,t).width,T=`]8;;`,le=RegExp(`(?:\\[(?<code>\\d+)m|\\${T}(?<uri>.*))`,`y`),ue=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},E=e=>`[${e}m`,D=e=>`${T}${e}`,O=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:w(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=w(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(T,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},de=e=>{let t=e.split(` `),n=t.length;for(;n&&!w(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},fe=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=w(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=w(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),O(s,r,t),c=w(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){O(s,r,t),c=w(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){O(s,r,t),c=w(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>de(e)));let l=s.join(`
3
+ `),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===`›`){le.lastIndex=e+1;let t=le.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
4
+ `){a&&(r+=D(``));let e=i?ue(i):void 0;i&&e&&(r+=E(e))}else t===`
5
+ `&&(i&&ue(i)&&(r+=E(i)),a&&(r+=D(a)))}return r},pe=/\r?\n/;function k(e,t,n){return String(e).normalize().split(pe).map(e=>fe(e,t,n)).join(`
6
+ `)}var A=_(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}}))();function j(e,t,n){if(!n.some(e=>!e.disabled))return e;let r=e+t,i=Math.max(n.length-1,0),a=r<0?i:r>i?0:r;return n[a]?.disabled?j(a,t<0?-1:1,n):a}const M={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]]),messages:{cancel:`Canceled`,error:`Something went wrong`},withGuide:!0,date:{monthNames:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],messages:{required:`Please enter a valid date`,invalidMonth:`There are only 12 months in a year`,invalidDay:(e,t)=>`There are only ${e} days in ${t}`,afterMin:e=>`Date must be on or after ${e.toISOString().slice(0,10)}`,beforeMax:e=>`Date must be on or before ${e.toISOString().slice(0,10)}`}}};function me(e,t){if(typeof e==`string`)return M.aliases.get(e)===t;for(let n of e)if(n!==void 0&&me(n,t))return!0;return!1}function he(e,t){if(e===t)return;let n=e.split(`
7
+ `),r=t.split(`
8
+ `),i=Math.max(n.length,r.length),a=[];for(let e=0;e<i;e++)n[e]!==r[e]&&a.push(e);return{lines:a,numLinesBefore:n.length,numLinesAfter:r.length,numLines:i}}globalThis.process.platform.startsWith(`win`);const N=Symbol(`clack:cancel`);function P(e){return e===N}function F(e,t){let n=e;n.isTTY&&n.setRawMode(t)}const ge=e=>`columns`in e&&typeof e.columns==`number`?e.columns:80,_e=e=>`rows`in e&&typeof e.rows==`number`?e.rows:20;function I(e,t,n,r=n,a=n,o){return k(t,ge(e??i)-n.length,{hard:!0,trim:!1}).split(`
9
+ `).map((e,t,i)=>{let s=o?o(e,t):e;return t===0?`${r}${s}`:t===i.length-1?`${a}${s}`:`${n}${s}`}).join(`
10
+ `)}function ve(e,t){if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return n.issues?.at(0)?.message}return e(t)}var L=class{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame=``;_subscribers=new Map;_cursor=0;state=`initial`;error=``;value;userInput=``;constructor(e,t=!0){let{input:n=r,output:a=i,render:o,signal:s,...c}=e;this.opts=c,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=o.bind(this),this._track=t,this._abortSignal=s,this.input=n,this.output=a}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise(e=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(N);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}this.rl=a.createInterface({input:this.input,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on(`keypress`,this.onKeypress),F(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(A.cursor.show),this.output.off(`resize`,this.render),F(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(A.cursor.show),this.output.off(`resize`,this.render),F(this.input,!1),e(N)})})}_isActionKey(e,t){return e===` `}_shouldSubmit(e,t){return!0}_setValue(e){this.value=e,this.emit(`value`,this.value)}_setUserInput(e,t){this.userInput=e??``,this.emit(`userInput`,this.userInput),t&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:`u`}),this._setUserInput(``)}onKeypress(e,t){if(this._track&&t.name!==`return`&&(t.name&&this._isActionKey(e,t)&&this.rl?.write(null,{ctrl:!0,name:`h`}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&M.aliases.has(t.name)&&this.emit(`cursor`,M.aliases.get(t.name)),M.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),this.emit(`key`,e,t),t?.name===`return`&&this._shouldSubmit(e,t)){if(this.opts.validate){let e=ve(this.opts.validate,this.value);e&&(this.error=e instanceof Error?e.message:e,this.state=`error`,this.rl?.write(this.userInput))}this.state!==`error`&&(this.state=`submit`)}me([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
11
+ `),F(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=k(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
12
+ `).length-1;this.output.write(A.cursor.move(-999,e*-1))}render(){let e=k(this._render(this)??``,process.stdout.columns,{hard:!0,trim:!1});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(A.cursor.hide);else{let t=he(this._prevFrame,e),n=_e(this.output);if(this.restoreCursor(),t){let r=Math.max(0,t.numLinesAfter-n),i=Math.max(0,t.numLinesBefore-n),a=t.lines.find(e=>e>=r);if(a===void 0){this._prevFrame=e;return}if(t.lines.length===1){this.output.write(A.cursor.move(0,a-i)),this.output.write(A.erase.lines(1));let t=e.split(`
13
+ `);this.output.write(t[a]),this._prevFrame=e,this.output.write(A.cursor.move(0,t.length-a-1));return}else if(t.lines.length>1){if(r<i)a=r;else{let e=a-i;e>0&&this.output.write(A.cursor.move(0,e))}this.output.write(A.erase.down());let t=e.split(`
14
+ `).slice(a);this.output.write(t.join(`
15
+ `)),this._prevFrame=e;return}}this.output.write(A.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},ye=class extends L{get cursor(){return+!this.value}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on(`userInput`,()=>{this.value=this._value}),this.on(`confirm`,e=>{this.output.write(A.cursor.move(0,-1)),this.value=e,this.state=`submit`,this.close()}),this.on(`cursor`,()=>{this.value=!this.value})}};let be=class extends L{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){let e=this._selectedValue;this.value=e===void 0?void 0:e.value}constructor(e){super(e,!1),this.options=e.options;let t=this.options.findIndex(({value:t})=>t===e.initialValue),n=t===-1?0:t;this.cursor=this.options[n]?.disabled?j(n,1,this.options):n,this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=j(this.cursor,-1,this.options);break;case`down`:case`right`:this.cursor=j(this.cursor,1,this.options);break}this.changeValue()})}};var xe=class extends L{get userInputWithCursor(){if(this.state===`submit`)return this.userInput;let e=this.userInput;if(this.cursor>=e.length)return`${this.userInput}\u2588`;let n=e.slice(0,this.cursor),r=e.slice(this.cursor,this.cursor+1),i=e.slice(this.cursor+1);return`${n}${t(`inverse`,r)}${i}`}get cursor(){return this._cursor}constructor(e){super({...e,initialUserInput:e.initialUserInput??e.initialValue}),this.on(`userInput`,e=>{this._setValue(e)}),this.on(`finalize`,()=>{this.value||=e.defaultValue,this.value===void 0&&(this.value=``)})}};function Se(){return n.platform===`win32`?!!n.env.CI||!!n.env.WT_SESSION||!!n.env.TERMINUS_SUBLIME||n.env.ConEmuTask===`{cmd::Cmder}`||n.env.TERM_PROGRAM===`Terminus-Sublime`||n.env.TERM_PROGRAM===`vscode`||n.env.TERM===`xterm-256color`||n.env.TERM===`alacritty`||n.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:n.env.TERM!==`linux`}const Ce=Se(),R=(e,t)=>Ce?e:t,we=R(`◆`,`*`),Te=R(`■`,`x`),Ee=R(`▲`,`x`),De=R(`◇`,`o`),z=R(`│`,`|`),B=R(`└`,`—`),V=R(`●`,`>`),H=R(`○`,` `),U=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,we);case`cancel`:return t(`red`,Te);case`error`:return t(`yellow`,Ee);case`submit`:return t(`green`,De)}},Oe=e=>{switch(e){case`initial`:case`active`:return t(`cyan`,z);case`cancel`:return t(`red`,z);case`error`:return t(`yellow`,z);case`submit`:return t(`green`,z)}};function ke(e,n){let r=[`${n?`${t(`cyan`,z)} `:``}${e.join(` • `)}`];return n&&r.push(t(`cyan`,B)),r}const W=(e,t,n,r,i,a=!1)=>{let o=t,s=0;if(a)for(let t=r-1;t>=n;t--){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}else for(let t=n;t<r;t++){let n=e[t];if(n&&(o-=n.length),s++,o<=i)break}return{lineCount:o,removals:s}},Ae=({cursor:e,options:n,style:r,output:i=process.stdout,maxItems:a=1/0,columnPadding:o=0,rowPadding:s=4})=>{let c=ge(i)-o,l=_e(i),u=t(`dim`,`...`),d=Math.max(l-s,0),f=Math.max(Math.min(a,d),5),p=0;e>=f-3&&(p=Math.max(Math.min(e-f+3,n.length-f),0));let m=f<n.length&&p>0,h=f<n.length&&p+f<n.length,g=Math.min(p+f,n.length),_=[],v=0;m&&v++,h&&v++;let y=p+ +!!m,b=g-+!!h;for(let t=y;t<b;t++){let i=n[t],a=k(i?r(i,t===e):``,c,{hard:!0,trim:!1}).split(`
16
+ `);_.push(a),v+=a.length}if(v>d){let t=0,n=0,r=v,i=e-y,a=d,o=()=>W(_,r,0,i,a),s=()=>W(_,r,i+1,_.length,a,!0);m?({lineCount:r,removals:t}=o(),r>a&&(h||--a,{lineCount:r,removals:n}=s())):(h||--a,{lineCount:r,removals:n}=s(),r>a&&(--a,{lineCount:r,removals:t}=o())),t>0&&(m=!0,_.splice(0,t)),n>0&&(h=!0,_.splice(_.length-n,n))}let x=[];m&&x.push(u);for(let e of _)for(let t of e)x.push(t);return h&&x.push(u),x},je=e=>{let n=e.active??`Yes`,r=e.inactive??`No`;return new ye({active:n,inactive:r,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue??!0,render(){let i=e.withGuide??M.withGuide,a=`${U(this.state)} `,o=i?`${t(`gray`,z)} `:``,s=I(e.output,e.message,o,a),c=`${i?`${t(`gray`,z)}
17
+ `:``}${s}
18
+ `,l=this.value?n:r;switch(this.state){case`submit`:return`${c}${i?`${t(`gray`,z)} `:``}${t(`dim`,l)}`;case`cancel`:return`${c}${i?`${t(`gray`,z)} `:``}${t([`strikethrough`,`dim`],l)}${i?`
19
+ ${t(`gray`,z)}`:``}`;default:{let a=i?`${t(`cyan`,z)} `:``,o=i?t(`cyan`,B):``;return`${c}${a}${this.value?`${t(`green`,V)} ${n}`:`${t(`dim`,H)} ${t(`dim`,n)}`}${e.vertical?i?`
20
+ ${t(`cyan`,z)} `:`
21
+ `:` ${t(`dim`,`/`)} `}${this.value?`${t(`dim`,H)} ${t(`dim`,r)}`:`${t(`green`,V)} ${r}`}
22
+ ${o}
23
+ `}}}}).prompt()};`${t(`dim`,`↑/↓`)}`,`${t(`dim`,`Space:`)}`,`${t(`dim`,`Enter:`)}`;const Me=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??M.withGuide?`${t(`gray`,B)} `:``;r.write(`${i}${t(`red`,e)}
24
+
25
+ `)},Ne=(e=``,n)=>{let r=n?.output??process.stdout,i=n?.withGuide??M.withGuide?`${t(`gray`,z)}
26
+ ${t(`gray`,B)} `:``;r.write(`${i}${e}
27
+
28
+ `)},Pe=[`${t(`dim`,`↑/↓`)} to navigate`,`${t(`dim`,`Enter:`)} confirm`],G=(e,t)=>e.includes(`
29
+ `)?e.split(`
30
+ `).map(e=>t(e)).join(`
31
+ `):t(e),Fe=e=>{let n=(e,n)=>{if(e===void 0)return``;let r=e.label??String(e.value);switch(n){case`disabled`:return`${t(`gray`,H)} ${G(r,e=>t(`gray`,e))}${e.hint?` ${t(`dim`,`(${e.hint??`disabled`})`)}`:``}`;case`selected`:return`${G(r,e=>t(`dim`,e))}`;case`active`:return`${t(`green`,V)} ${r}${e.hint?` ${t(`dim`,`(${e.hint})`)}`:``}`;case`cancelled`:return`${G(r,e=>t([`strikethrough`,`dim`],e))}`;default:return`${t(`dim`,H)} ${G(r,e=>t(`dim`,e))}`}},r=e.showInstructions??!0;return new be({options:e.options,signal:e.signal,input:e.input,output:e.output,initialValue:e.initialValue,render(){let i=e.withGuide??M.withGuide,a=`${U(this.state)} `,o=`${Oe(this.state)} `,s=I(e.output,e.message,o,a),c=`${i?`${t(`gray`,z)}
32
+ `:``}${s}
33
+ `;switch(this.state){case`submit`:{let r=i?`${t(`gray`,z)} `:``;return`${c}${I(e.output,n(this.options[this.cursor],`selected`),r)}`}case`cancel`:{let r=i?`${t(`gray`,z)} `:``;return`${c}${I(e.output,n(this.options[this.cursor],`cancelled`),r)}${i?`
34
+ ${t(`gray`,z)}`:``}`}default:{let a=i?`${t(`cyan`,z)} `:``,o=c.split(`
35
+ `).length,s=r?ke(Pe,i):i?[t(`cyan`,B)]:[],l=s.join(`
36
+ `),u=s.length+1;return`${c}${a}${Ae({output:e.output,cursor:this.cursor,options:this.options,maxItems:e.maxItems,columnPadding:a.length,rowPadding:o+u,style:(e,t)=>n(e,e.disabled?`disabled`:t?`active`:`inactive`)}).join(`
37
+ ${a}`)}
38
+ ${l}
39
+ `}}}}).prompt()};`${t(`gray`,z)}`;const Ie=e=>new xe({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,output:e.output,signal:e.signal,input:e.input,render(){let n=e?.withGuide??M.withGuide,r=`${`${n?`${t(`gray`,z)}
40
+ `:``}${U(this.state)} `}${e.message}
41
+ `,i=e.placeholder&&e.placeholder.length>0?t(`inverse`,e.placeholder[0])+t(`dim`,e.placeholder.slice(1)):t([`inverse`,`hidden`],`_`),a=this.userInput?this.userInputWithCursor:i,o=this.value??``;switch(this.state){case`error`:{let e=this.error?` ${t(`yellow`,this.error)}`:``,i=n?`${t(`yellow`,z)} `:``,o=n?t(`yellow`,B):``;return`${r.trim()}
42
+ ${i}${a}
43
+ ${o}${e}
44
+ `}case`submit`:{let e=o?` ${t(`dim`,o)}`:``;return`${r}${n?t(`gray`,z):``}${e}`}case`cancel`:{let e=o?` ${t([`strikethrough`,`dim`],o)}`:``,i=n?t(`gray`,z):``;return`${r}${i}${e}${o.trim()?`
45
+ ${i}`:``}`}default:return`${r}${n?`${t(`cyan`,z)} `:``}${a}
46
+ ${n?t(`cyan`,B):``}
47
+ `}}}).prompt();let K=!0;const q=typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};let Le=0;if(q.process&&q.process.env&&q.process.stdout){let{FORCE_COLOR:e,NODE_DISABLE_COLORS:t,NO_COLOR:n,TERM:r,COLORTERM:i}=q.process.env;K=t||n||e===`0`?!1:e===`1`||e===`2`||e===`3`?!0:r===`dumb`?!1:`CI`in q.process.env&&[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`,`DRONE`].some(e=>e in q.process.env)?!0:process.stdout.isTTY,K&&(Le=process.platform===`win32`||i&&(i===`truecolor`||i===`24bit`)?3:r&&(r.endsWith(`-256color`)||r.endsWith(`256`))?2:1)}let Re={enabled:K,supportLevel:Le};function J(e,t,n=1){let r=`\x1b[${e}m`,i=`\x1b[${t}m`,a=RegExp(`\\x1b\\[${t}m`,`g`);return e=>Re.enabled&&Re.supportLevel>=n?r+(``+e).replace(a,r)+i:``+e}J(0,0);const ze=J(1,22),Be=J(2,22);J(3,23),J(4,24),J(7,27),J(8,28),J(9,29),J(30,39);const Ve=J(31,39),He=J(32,39);J(33,39),J(34,39),J(35,39);const Ue=J(36,39);J(97,39),J(90,39),J(37,39),J(91,39),J(92,39),J(93,39),J(94,39),J(95,39),J(96,39),J(40,49),J(41,49),J(42,49),J(43,49),J(44,49),J(45,49),J(46,49),J(107,49),J(100,49),J(101,49),J(102,49),J(103,49),J(104,49),J(105,49),J(106,49),J(47,49);async function Y(e){try{return await s.access(e),!0}catch{return!1}}async function We(e){if(!await Y(e))return!0;let t=await s.readdir(e);return t.length===0||t.every(e=>e===`.git`)}async function Ge(e){await s.mkdir(e,{recursive:!0});let t=await s.readdir(e);await Promise.all(t.map(async t=>{t!==`.git`&&await s.rm(o.join(e,t),{recursive:!0,force:!0})}))}async function Ke(e,t){await s.mkdir(t,{recursive:!0});let n=await s.readdir(e,{withFileTypes:!0});for(let r of n){if(r.name===`.DS_Store`)continue;let n=o.join(e,r.name),i=o.join(t,qe(r.name));if(r.isDirectory())await Ke(n,i);else if(r.isFile())await s.mkdir(o.dirname(i),{recursive:!0}),await s.copyFile(n,i);else if(r.isSymbolicLink()){let e=await s.readlink(n);await s.symlink(e,i)}}}function qe(e){return e===`_gitignore`?`.gitignore`:e===`_npmrc`?`.npmrc`:e}function Je(){let e=process.env.npm_config_user_agent||``;return e.startsWith(`pnpm`)?`pnpm`:e.startsWith(`yarn`)?`yarn`:e.startsWith(`bun`)?`bun`:`npm`}function Ye(e){return{npm:`npm@11`,pnpm:`pnpm@9`,yarn:`yarn@1.22`,bun:`bun@1`}[e]}function Xe(e,t){return e===`npm`?`npm run ${t}`:e===`yarn`?`yarn ${t}`:e===`bun`?`bun run ${t}`:`pnpm ${t}`}async function Ze(e,t){await X(e,e===`yarn`?[]:[`install`],t)}async function Qe(e,t){for(let n of e)await X(`npx`,[`--yes`,`skills@latest`,`add`,n,`--copy`,`--yes`],t)}function $e(e){return e.map(e=>`npx --yes skills@latest add ${e} --copy --yes`).join(` && `)}async function et(e){await X(`git`,[`init`],e)}function X(e,t,n){return new Promise((r,i)=>{let a=c(e,t,{cwd:n,stdio:`ignore`,shell:process.platform===`win32`});a.on(`error`,i),a.on(`close`,n=>{n===0?r():i(Error(`${e} ${t.join(` `)} failed with code ${n}`))})})}function tt(e){return e.trim().replace(/([a-z])([A-Z])/g,`$1-$2`).replace(/\s+/g,`-`).replace(/_/g,`-`).toLowerCase().replace(/[^a-z0-9@/.-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)||`mcbe-addon`}function nt(e){let t=e.trim(),n=t.toLowerCase().replace(/([a-z])([A-Z])/g,`$1_$2`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`mcbe_${rt(t)}`;return`${/^[a-z]/.test(n)?n:`mcbe_${n}`}_${l.randomBytes(3).toString(`hex`)}`}function rt(e){return l.createHash(`sha1`).update(e,`utf8`).digest(`hex`).slice(0,8)}async function it(e){let t=await s.readFile(e,`utf8`);return JSON.parse(t)}async function at(e,t){await s.writeFile(e,`${JSON.stringify(t,null,2)}\n`,`utf8`)}async function ot(e,t){let n=await it(e);return await t(n),await at(e,n),n}async function Z(e){let t=[[o.join(e.root,`bp`,`manifest.json`),`BP`],[o.join(e.root,`rp`,`manifest.json`),`RP`],[o.join(e.root,`manifest.json`),e.template.id===`resource-pack`?`RP`:`BP`]];for(let[n,r]of t)await Y(n)&&await ot(n,t=>{t.header.name=`${e.projectName} ${r}`,t.header.description=`${e.projectName} ${r.toLowerCase()}`,t.header.uuid=l.randomUUID();for(let e of t.modules??[])e.uuid=l.randomUUID()})}async function st(e,t){await Z(e);let n=JSON.parse(await s.readFile(o.join(e.root,t.bpRoot,`manifest.json`),`utf8`)),r=t.rpRoot?JSON.parse(await s.readFile(o.join(e.root,t.rpRoot,`manifest.json`),`utf8`)):void 0,i=n.modules?.find(e=>e.type===`script`);t.namespace&&await ct(e,nt(e.projectName));let a={name:e.packageName,version:`1.0.0`,description:`${e.projectName} Bedrock add-on`,target:`latest`,packs:{bp:{root:t.bpRoot,uuid:n.header.uuid,...i?.uuid?{moduleUuid:i.uuid}:{},compile:{entry:`src/main.ts`},dependencies:t.dependencies??{"@minecraft/server":`stable`}},...r?{rp:{root:t.rpRoot,uuid:r.header.uuid,moduleUuid:r.modules?.[0]?.uuid}}:{}},pack:{outDir:`dist`},...t.replaceBuiltins?{replace:{builtins:{NAME:!0,DESCRIPTION:!0,VERSION:!0,UUID:!0}}}:{}};await s.writeFile(o.join(e.root,`bepack.config.ts`),lt(a,t.plugin,e.installBepack),`utf8`)}async function ct(e,t){let n=o.join(e.root,`src`,`main.ts`);if(!await Y(n))return;let r=await s.readFile(n,`utf8`);await s.writeFile(n,r.replaceAll(`**NAMESPACE**`,t),`utf8`)}function lt(e,t,n){let r=JSON.stringify(e,null,2).replace(/\n( +)"([a-zA-Z_$][a-zA-Z0-9_$]*)": /g,`
48
+ $1$2: `),i=t?r.replace(/^\{\n/,n?`{\n plugins: [${t.call}],\n`:`{\n plugins: ['${t.name}'],\n`):r,a=n&&t?`import { defineConfig, ${t.importName} } from '@bepack/cli';`:n?`import { defineConfig } from '@bepack/cli';`:``,o=n?`defineConfig(${i})`:i;return`${a?`${a}\n\n`:``}export default ${o};\n`}function Q(e){let{id:t,title:n,description:r,templateDir:i,skills:a,...o}=e;return{id:t,title:n,description:r,templateDir:i,defaultPackageManager:`npm`,skills:a,workflow:`bepack`,prepare:e=>st(e,o)}}const $=[Q({id:`sapi-pro`,title:`SAPI-Pro + BEPack`,description:`SAPI-Pro behavior pack managed and packed by BEPack.`,templateDir:`sapi-pro`,bpRoot:`.`,dependencies:{"@minecraft/server":`stable`,"@minecraft/server-ui":`stable`,"@minecraft/vanilla-data":`stable`,"sapi-pro":`stable`},plugin:{name:`sapi-pro`,importName:`sapiPro`,call:`sapiPro()`},replaceBuiltins:!0,namespace:!0}),Q({id:`bepack-behavior`,title:`BEPack Behavior Pack`,description:`TypeScript Script API behavior pack built and packed by BEPack.`,templateDir:`bepack-behavior`,bpRoot:`.`}),Q({id:`bepack-addon`,title:`BEPack Add-on (BP + RP)`,description:`TypeScript behavior pack plus resource pack, managed by BEPack.`,templateDir:`bepack-addon`,bpRoot:`bp`,rpRoot:`rp`}),{id:`behavior-pack`,title:`Behavior Pack`,description:`Simple behavior pack without scripts or build tools.`,templateDir:`behavior-pack`,prepare:Z},{id:`resource-pack`,title:`Resource Pack`,description:`Simple resource pack without scripts or build tools.`,templateDir:`resource-pack`,prepare:Z}];function ut(e){return o.join(e,`package.json`)}async function dt(e,t){return ot(ut(e),t)}async function ft(e,t){return dt(e,e=>{e.name=t.name,t.packageManager&&(e.packageManager=Ye(t.packageManager))})}const pt=o.resolve(o.dirname(u(import.meta.url)),`..`);async function mt(e){let t=await ht(e);vt(t);let n=await gt(e),r=await _t(e,n),i=o.resolve(e.cwd,t),a=e.packageManager||n.defaultPackageManager||`npm`,s={cli:e,cwd:e.cwd,root:i,projectName:t,packageName:tt(t),template:n,packageManager:a,installBepack:r,templateOptions:n.defaultOptions??{}};await yt(s),await Ke(o.resolve(pt,`templates`,n.templateDir),i),await Y(o.join(i,`package.json`))&&(await ft(i,{name:s.packageName,packageManager:a}),n.workflow===`bepack`&&!r&&await Ct(i)),await n.prepare?.(s);let c=!1;e.git&&(await et(i),c=!0);let l=!1,u=!1;if(e.install){await Y(o.join(i,`package.json`))&&(n.workflow===`bepack`&&r?(await Ze(a,i),await St(a,`bepack:install`,i)):n.workflow===`bepack`?await X(`bepack`,[`install`],i):await Ze(a,i),l=!0);let t=xt(n.skills);!e.skipSkillsInstall&&t.length>0&&(await Qe(t,i),u=!0)}return{root:i,projectName:t,template:n.id,packageManager:a,installedDependencies:l,installedSkills:u,initializedGit:c,warnings:[],nextSteps:bt(s,l,u||e.skipSkillsInstall)}}async function ht(e){if(e.projectName)return e.projectName;if(e.yes||!process.stdin.isTTY)return`mcbe-addon`;let t=await Ie({message:`Project name`,placeholder:`my-addon`,defaultValue:`my-addon`,validate(e){if(!e?.trim())return`Project name is required.`}});if(P(t))throw t;return String(t)}async function gt(e){if(e.template){let t=$.find(t=>t.id===e.template);if(!t)throw Error(`Unknown template "${e.template}". Available: ${$.map(e=>e.id).join(`, `)}`);return t}if(e.yes||!process.stdin.isTTY)return $[0];let t=await Fe({message:`Select a template`,options:$.map(e=>({value:e.id,label:e.title,hint:e.description}))});if(P(t))throw t;return $.find(e=>e.id===String(t))}async function _t(e,t){if(t.workflow!==`bepack`)return!1;if(e.installBepack!==void 0)return e.installBepack;if(e.yes||!process.stdin.isTTY)return!0;let n=await je({message:`Install BEPack in this project?`,initialValue:!0});if(P(n))throw n;return!!n}function vt(e){if(!e.trim()||e===`.`||e===`..`||o.isAbsolute(e))throw Error(`Project name must be a non-empty relative child directory, not . or an absolute path.`);let t=o.normalize(e);if(t===`..`||t.startsWith(`..${o.sep}`))throw Error(`Project name cannot escape the working directory.`)}async function yt(e){if(!await Y(e.root)){await s.mkdir(e.root,{recursive:!0});return}if(await We(e.root))return;if(e.cli.force){await Ge(e.root);return}if(e.cli.yes||!process.stdin.isTTY)throw Error(`Target directory is not empty: ${e.root}. Use --force to overwrite.`);let t=await Fe({message:`Target directory ${e.projectName} is not empty`,options:[{value:`cancel`,label:`Cancel`},{value:`overwrite`,label:`Overwrite`}]});if(P(t)||t===`cancel`)throw Error(`Cancelled.`);await Ge(e.root)}function bt(e,t,n){let r=[`cd ${o.relative(process.cwd(),e.root)||`.`}`];if(e.template.workflow===`bepack`&&(e.installBepack&&!t?(r.push(`${e.packageManager} install`),r.push(Xe(e.packageManager,`bepack:install`))):e.installBepack||r.push(`bepack install`),r.push(Xe(e.packageManager,`build`))),!n){let t=xt(e.template.skills);t.length>0&&r.push($e(t))}return r}function xt(e){return(Array.isArray(e)?e:e?[e]:[]).map(e=>e.trim()).filter(Boolean)}async function St(e,t,n){return e===`npm`?X(`npm`,[`run`,t],n):e===`pnpm`?X(`pnpm`,[t],n):e===`yarn`?X(`yarn`,[t],n):X(`bun`,[`run`,t],n)}async function Ct(e){let t=o.join(e,`package.json`),n=JSON.parse(await s.readFile(t,`utf8`));n.devDependencies&&delete n.devDependencies[`@bepack/cli`],n.scripts&&delete n.scripts[`bepack:install`],await s.writeFile(t,`${JSON.stringify(n,null,2)}\n`,`utf8`)}var wt=y(_(((e,t)=>{function n(e){return e==null?[]:Array.isArray(e)?e:[e]}function r(e,t,n,r){var i,a=e[t],o=~r.string.indexOf(t)?n==null||n===!0?``:String(n):typeof n==`boolean`?n:~r.boolean.indexOf(t)?n===`false`?!1:n===`true`||(e._.push((i=+n,i*0==0?i:n)),!!n):(i=+n,i*0==0?i:n);e[t]=a==null?o:Array.isArray(a)?a.concat(o):[a,o]}t.exports=function(e,t){e||=[],t||={};var i,a,o,s,c,l={_:[]},u=0,d=0,f=0,p=e.length;let m=t.alias!==void 0,h=t.unknown!==void 0,g=t.default!==void 0;if(t.alias=t.alias||{},t.string=n(t.string),t.boolean=n(t.boolean),m)for(i in t.alias)for(a=t.alias[i]=n(t.alias[i]),u=0;u<a.length;u++)(t.alias[a[u]]=a.concat(i)).splice(u,1);for(u=t.boolean.length;u-->0;)for(a=t.alias[t.boolean[u]]||[],d=a.length;d-->0;)t.boolean.push(a[d]);for(u=t.string.length;u-->0;)for(a=t.alias[t.string[u]]||[],d=a.length;d-->0;)t.string.push(a[d]);if(g){for(i in t.default)if(s=typeof t.default[i],a=t.alias[i]=t.alias[i]||[],t[s]!==void 0)for(t[s].push(i),u=0;u<a.length;u++)t[s].push(a[u])}let _=h?Object.keys(t.alias):[];for(u=0;u<p;u++){if(o=e[u],o===`--`){l._=l._.concat(e.slice(++u));break}for(d=0;d<o.length&&o.charCodeAt(d)===45;d++);if(d===0)l._.push(o);else if(o.substring(d,d+3)===`no-`){if(s=o.substring(d+3),h&&!~_.indexOf(s))return t.unknown(o);l[s]=!1}else{for(f=d+1;f<o.length&&o.charCodeAt(f)!==61;f++);for(s=o.substring(d,f),c=o.substring(++f)||u+1===p||(``+e[u+1]).charCodeAt(0)===45||e[++u],a=d===2?[s]:s,f=0;f<a.length;f++){if(s=a[f],h&&!~_.indexOf(s))return t.unknown(`-`.repeat(d)+s);r(l,s,f+1<a.length||c,t)}}}if(g)for(i in t.default)l[i]===void 0&&(l[i]=t.default[i]);if(m)for(i in l)for(a=t.alias[i]||[];a.length>0;)l[a.shift()]=l[i];return l}}))(),1);const Tt=new Set([`npm`,`pnpm`,`yarn`,`bun`]);function Et(e=[]){let t=(0,wt.default)(e,{alias:{h:`help`,v:`version`,t:`template`},boolean:[`help`,`version`,`yes`,`force`,`install`,`skip-skills-install`,`install-bepack`,`skip-bepack-install`,`git`,`json`,`list-templates`],string:[`template`,`pm`,`cwd`],default:{install:!1,git:!1}}),n=String(t.pm||Je());if(!Tt.has(n))throw Error(`Unknown package manager: ${n}`);if(t[`install-bepack`]&&t[`skip-bepack-install`])throw Error(`--install-bepack and --skip-bepack-install cannot be used together.`);let r=Array.isArray(t._)?t._.find(Boolean):void 0;return{cwd:o.resolve(String(t.cwd||process.cwd())),projectName:r===void 0?void 0:String(r),template:t.template?String(t.template):void 0,packageManager:n,yes:!!t.yes,force:!!t.force,install:!!t.install,skipSkillsInstall:!!t[`skip-skills-install`],installBepack:t[`skip-bepack-install`]?!1:t[`install-bepack`]?!0:void 0,git:!!t.git,json:!!t.json,listTemplates:!!t[`list-templates`],help:!!t.help,version:!!t.version}}const Dt=e(import.meta.url)(`../package.json`);async function Ot(e=process.argv.slice(2)){let t;try{if(t=Et(e),t.help)return console.log(At());if(t.version)return console.log(Dt.version);if(t.listTemplates)return console.log($.map(e=>`${Ue(e.id.padEnd(18))} ${e.description}`).join(`
49
+ `));let n=await mt(t);if(t.json)return console.log(JSON.stringify({ok:!0,result:n},null,2));kt(n)}catch(n){let r=n instanceof Error?n.message:String(n),i=P(n);t?.json||e.includes(`--json`)?console.log(JSON.stringify({ok:!1,error:i?`cancelled`:r},null,2)):i?Me(`Cancelled.`):console.error(Ve(`Error: ${r}`)),process.exitCode=1}}function kt(e){Ne(`${He(`Created`)} ${ze(e.projectName)}`),console.log(Be(`\nTemplate: ${e.template}`)),console.log(`
50
+ Next steps:`);for(let t of e.nextSteps)console.log(` ${t}`)}function At(){return`\n${[`${ze(`create-mcbe`)} ${Be(`v${Dt.version}`)}`,``,`Usage:`,` npm create mcbe@latest [project-name] -- [options]`,``,`Options:`,` --template <id> Template id`,` --pm <npm|pnpm|yarn|bun>`,` --yes Use defaults`,` --force Overwrite a non-empty target directory`,` --install Install dependencies after creation`,` --skip-skills-install Skip template skills installation`,` --install-bepack Install BEPack in the project`,` --skip-bepack-install Use global BEPack instead`,` --git Initialize git`,` --cwd <dir> Working directory`,` --json Machine-readable output`,` --list-templates List templates`,` -h, --help Show help`,` -v, --version Show version`,``,`Templates:`,...$.map(e=>` ${e.id.padEnd(18)} ${e.description}`)].join(`
51
+ `)}\n`}await Ot();export{};
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "create-mcbe",
3
+ "version": "0.1.0-beta.1",
4
+ "description": "A small, extensible scaffolder for Minecraft Bedrock Edition projects.",
5
+ "author": "XiaoYangx666",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/XiaoYangx666/BEPack.git",
10
+ "directory": "packages/create-mcbe"
11
+ },
12
+ "homepage": "https://github.com/XiaoYangx666/BEPack/tree/main/packages/create-mcbe#readme",
13
+ "type": "module",
14
+ "bin": {
15
+ "create-mcbe": "./dist/index.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "templates",
20
+ "README.md"
21
+ ],
22
+ "scripts": {
23
+ "dev": "tsx src/index.ts",
24
+ "clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
25
+ "build": "npm run clean && rolldown -c",
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "vitest run tests --exclude backup-pre-bepack-rewrite-20260720/**",
28
+ "prepublishOnly": "npm run typecheck && npm run test && npm run build"
29
+ },
30
+ "dependencies": {},
31
+ "devDependencies": {
32
+ "@clack/prompts": "^1.6.0",
33
+ "kolorist": "^1.8.0",
34
+ "mri": "^1.2.0"
35
+ },
36
+ "engines": {
37
+ "node": ">=20.0"
38
+ },
39
+ "keywords": [
40
+ "minecraft",
41
+ "bedrock",
42
+ "mcbe",
43
+ "addon",
44
+ "script-api",
45
+ "scaffold"
46
+ ],
47
+ "allowScripts": {
48
+ "esbuild": true
49
+ }
50
+ }
@@ -0,0 +1 @@
1
+ # Behavior Pack
@@ -0,0 +1 @@
1
+ say Hello from create-mcbe
@@ -0,0 +1,17 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": {
4
+ "name": "Behavior Pack",
5
+ "description": "Minimal behavior pack",
6
+ "uuid": "00000000-0000-4000-8000-000000000011",
7
+ "version": [1, 0, 0],
8
+ "min_engine_version": [1, 21, 0]
9
+ },
10
+ "modules": [
11
+ {
12
+ "type": "data",
13
+ "uuid": "00000000-0000-4000-8000-000000000012",
14
+ "version": [1, 0, 0]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ bp/scripts
4
+ *.mcpack
5
+ *.mcaddon
@@ -0,0 +1,5 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": { "name": "Behavior Pack", "description": "BEPack behavior pack", "uuid": "00000000-0000-4000-0000-000000000001", "version": [1, 0, 0], "min_engine_version": [1, 21, 0] },
4
+ "modules": [{ "type": "script", "language": "javascript", "uuid": "00000000-0000-4000-0000-000000000002", "version": [1, 0, 0], "entry": "scripts/main.js" }]
5
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "mcbe-bepack-addon",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "bepack:install": "bepack install",
8
+ "dev": "bepack dev --copy",
9
+ "build": "bepack build",
10
+ "pack": "bepack pack",
11
+ "release": "bepack build --install --pack"
12
+ },
13
+ "devDependencies": {
14
+ "@bepack/cli": "^0.1.0-beta.1",
15
+ "typescript": "7.0.2"
16
+ }
17
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": { "name": "Resource Pack", "description": "BEPack resource pack", "uuid": "00000000-0000-4000-0000-000000000003", "version": [1, 0, 0], "min_engine_version": [1, 21, 0] },
4
+ "modules": [{ "type": "resources", "uuid": "00000000-0000-4000-0000-000000000004", "version": [1, 0, 0] }]
5
+ }
@@ -0,0 +1,2 @@
1
+ pack.name=Resource Pack
2
+ pack.description=Created by create-mcbe
@@ -0,0 +1,5 @@
1
+ import { world } from '@minecraft/server';
2
+
3
+ world.afterEvents.worldLoad.subscribe(() => {
4
+ console.warn('Hello from create-mcbe + BEPack');
5
+ });
@@ -0,0 +1,4 @@
1
+ {
2
+ "compilerOptions": { "target": "ES2022", "module": "ES2022", "moduleResolution": "Bundler", "strict": true, "skipLibCheck": true },
3
+ "include": ["src"]
4
+ }
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ scripts
4
+ *.mcpack
5
+ *.mcaddon
@@ -0,0 +1,5 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": { "name": "Behavior Pack", "description": "BEPack behavior pack", "uuid": "00000000-0000-4000-0000-000000000001", "version": [1, 0, 0], "min_engine_version": [1, 21, 0] },
4
+ "modules": [{ "type": "script", "language": "javascript", "uuid": "00000000-0000-4000-8000-000000000002", "version": [1, 0, 0], "entry": "scripts/main.js" }]
5
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "mcbe-bepack-behavior",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "bepack:install": "bepack install",
8
+ "dev": "bepack dev --copy",
9
+ "build": "bepack build",
10
+ "pack": "bepack pack",
11
+ "release": "bepack build --install --pack"
12
+ },
13
+ "devDependencies": {
14
+ "@bepack/cli": "^0.1.0-beta.1",
15
+ "typescript": "7.0.2"
16
+ }
17
+ }
@@ -0,0 +1,5 @@
1
+ import { world } from '@minecraft/server';
2
+
3
+ world.afterEvents.worldLoad.subscribe(() => {
4
+ console.warn('Hello from create-mcbe + BEPack');
5
+ });
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "moduleResolution": "Bundler",
6
+ "strict": true,
7
+ "skipLibCheck": true
8
+ },
9
+ "include": ["src"]
10
+ }
@@ -0,0 +1 @@
1
+ # Resource Pack
@@ -0,0 +1,17 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": {
4
+ "name": "Resource Pack",
5
+ "description": "Minimal resource pack",
6
+ "uuid": "00000000-0000-4000-8000-000000000021",
7
+ "version": [1, 0, 0],
8
+ "min_engine_version": [1, 21, 0]
9
+ },
10
+ "modules": [
11
+ {
12
+ "type": "resources",
13
+ "uuid": "00000000-0000-4000-8000-000000000022",
14
+ "version": [1, 0, 0]
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,2 @@
1
+ pack.name=Resource Pack
2
+ pack.description=Created by create-mcbe
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ dist
3
+ scripts
4
+ *.mcpack
5
+ *.mcaddon
@@ -0,0 +1,5 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": { "name": "SAPI-Pro Behavior Pack", "description": "SAPI-Pro behavior pack", "uuid": "00000000-0000-4000-8000-000000000031", "version": [1, 0, 0], "min_engine_version": [1, 21, 0] },
4
+ "modules": [{ "type": "script", "language": "javascript", "uuid": "00000000-0000-4000-8000-000000000032", "version": [1, 0, 0], "entry": "scripts/main.js" }]
5
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "mcbe-sapi-pro",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "bepack:install": "bepack install",
8
+ "dev": "bepack dev --copy",
9
+ "build": "bepack build",
10
+ "pack": "bepack pack",
11
+ "release": "bepack build --install --pack"
12
+ },
13
+ "devDependencies": {
14
+ "@bepack/cli": "^0.1.0-beta.1",
15
+ "typescript": "7.0.2"
16
+ }
17
+ }
@@ -0,0 +1,10 @@
1
+ import { initSAPIPro } from 'sapi-pro';
2
+
3
+ initSAPIPro({
4
+ name: '**NAME**',
5
+ version: '**VERSION**',
6
+ description: '**DESCRIPTION**',
7
+ author: 'Your Name',
8
+ nameSpace: '**NAMESPACE**',
9
+ uuid: '**UUID**',
10
+ });
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "moduleResolution": "Bundler",
6
+ "strict": true,
7
+ "skipLibCheck": true
8
+ },
9
+ "include": ["src"]
10
+ }