rapidkit 0.20.0 → 0.21.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/README.md +423 -1509
- package/dist/chunk-7LU4Z66R.js +4 -0
- package/dist/chunk-D2ZRDZOE.js +17 -0
- package/dist/chunk-RV6HBTFC.js +2 -0
- package/dist/index.js +194 -800
- package/dist/package.json +8 -2
- package/dist/pythonRapidkitExec-GFCAVUOY.js +1 -0
- package/dist/workspace-LZZGJRGV.js +587 -0
- package/dist/workspace-marker-IOPQ42A7.js +1 -0
- package/package.json +8 -2
package/dist/index.js
CHANGED
|
@@ -1,632 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
[${o}/${t}]`),m.white(n));}},y=new ot;});function $t(e){let t=e.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!t)return null;let n=t[4]?t[4].split(".").map(r=>r.match(/^\d+$/)?Number(r):r):[];return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3]),prerelease:n}}function Jo(e,o){let t=$t(e),n=$t(o);if(!t||!n)return 0;if(t.major!==n.major)return t.major>n.major?1:-1;if(t.minor!==n.minor)return t.minor>n.minor?1:-1;if(t.patch!==n.patch)return t.patch>n.patch?1:-1;if(t.prerelease.length===0&&n.prerelease.length===0)return 0;if(t.prerelease.length===0)return 1;if(n.prerelease.length===0)return -1;let r=Math.max(t.prerelease.length,n.prerelease.length);for(let i=0;i<r;i+=1){let s=t.prerelease[i],a=n.prerelease[i];if(s===void 0)return -1;if(a===void 0)return 1;if(s===a)continue;let c=typeof s=="number",l=typeof a=="number";return c&&l?s>a?1:-1:c?-1:l||String(s)>String(a)?1:-1}return 0}async function _t(){try{y.debug("Checking for updates...");let{stdout:e}=await execa("npm",["view",Uo,"version"],{timeout:3e3}),o=e.trim();o&&Jo(o,nt)>0?(console.log(m.yellow(`
|
|
4
|
-
\u26A0\uFE0F Update available: ${nt} \u2192 ${o}`)),console.log(m.cyan(`Run: npm install -g rapidkit@latest
|
|
5
|
-
`))):y.debug("You are using the latest version");}catch{y.debug("Could not check for updates");}}function q(){return nt}var Uo,Bo,Ho,nt,Pe=se(()=>{j();ce();Uo="rapidkit",Bo=createRequire(import.meta.url),Ho=Bo("../package.json"),nt=Ho?.version??"0.0.0";});var nn,_e,it=se(()=>{j();nn=["version","project","create","init","dev","start","build","test","lint","format","add","list","info","upgrade","diff","doctor","license","commands","reconcile","rollback","uninstall","checkpoint","optimize","snapshot","frameworks","modules","merge"],_e=new Set(nn);});var lt={};tt(lt,{__test__:()=>yn,checkRapidkitCoreAvailable:()=>Ut,getCachedCoreTopLevelCommands:()=>ct,getCoreTopLevelCommands:()=>gn,getModulesCatalog:()=>hn,resolveRapidkitPython:()=>he,runCoreRapidkit:()=>Q,runCoreRapidkitCapture:()=>fe});function Kt(e){if(e instanceof z)switch(e.code){case "PYTHON_NOT_FOUND":return "RapidKit (npm) could not find Python (python3/python) on your PATH.\nInstall Python 3.10+ and ensure `python3` is available, then retry.\nTip: if you are inside a RapidKit project, use the local ./rapidkit launcher.";case "BRIDGE_VENV_CREATE_FAILED":return `RapidKit (npm) failed to create its bridge virtual environment.
|
|
6
|
-
Ensure Python venv support is installed (e.g., python3-venv).
|
|
7
|
-
Details: ${e.message}`;case "BRIDGE_PIP_BOOTSTRAP_FAILED":return `RapidKit (npm) could not bootstrap pip inside the bridge virtual environment.
|
|
8
|
-
Install python3-venv/python3-pip and retry.
|
|
9
|
-
Details: ${e.message}`;case "BRIDGE_PIP_UPGRADE_FAILED":return `RapidKit (npm) could not upgrade pip in the bridge virtual environment.
|
|
10
|
-
Check your network/proxy or disable RAPIDKIT_BRIDGE_UPGRADE_PIP.
|
|
11
|
-
Details: ${e.message}`;case "BRIDGE_PIP_INSTALL_FAILED":return `RapidKit (npm) could not install rapidkit-core in the bridge virtual environment.
|
|
12
|
-
Check your network/proxy, or install manually with: pipx install rapidkit-core.
|
|
13
|
-
Details: ${e.message}`;default:return `RapidKit (npm) bridge error: ${e.message}`}return `RapidKit (npm) failed to run the Python core engine: ${e instanceof Error?e.message:String(e)}`}function rt(){let e=process.env.RAPIDKIT_CORE_PYTHON_PACKAGE;return e&&e.trim()?e.trim():"rapidkit-core"}function sn(){let e=rt(),o=process.env.RAPIDKIT_CORE_PYTHON_PACKAGE_ID,t=o&&o.trim()?`${e}|${o.trim()}`:e;return rn.createHash("sha256").update(t).digest("hex").slice(0,12)}function Fe(){let e=process.env.XDG_CACHE_HOME;return e&&e.trim()?e:v.join(te__default.homedir(),".cache")}function an(){return v.join(Fe(),"rapidkit","npm-bridge","venv")}function Lt(){let e=sn();return v.join(Fe(),"rapidkit","npm-bridge",`venv-${e}`)}function Dt(e){return process.platform==="win32"?v.join(e,"Scripts","python.exe"):v.join(e,"bin","python")}function Nt(e){return process.platform==="win32"?v.join(e,"Scripts","rapidkit.exe"):v.join(e,"bin","rapidkit")}function cn(e){return /[<>=!~]=|@|\.whl$|\.tar\.gz$|\.zip$|git\+|https?:\/\//.test(e)}function ln(e){return v.dirname(v.dirname(e))}function Gt(){return v.join(Fe(),"rapidkit","npm-bridge","core-commands.json")}async function Wt(e){let o=!!process.env.RAPIDKIT_DEBUG,t=n=>{o&&process.stderr.write(`[DEBUG] tryRapidkit(${e}): ${n}
|
|
14
|
-
`);};try{t("probing interpreter-specific rapidkit script");let r=((await execa(e,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"],{reject:!1,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(t(`script path: ${r}`),r)try{if(await b.pathExists(r)){t(`found script at ${r}; invoking --version --json`);let i=await execa(r,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(t(`script exitCode=${i.exitCode}`),i.exitCode===0){let s=(i.stdout??"").toString().trim();try{let a=JSON.parse(s),c=!!a&&typeof a=="object"&&a!==null&&"version"in a;if(t(`script JSON parse ok=${c}`),c)return !0}catch{t("script output not valid JSON");}}}}catch(i){t(`interpreter-specific script probe failed: ${String(i)}`);}}catch(n){t(`interpreter-specific script probe error: ${String(n)}`);}try{t('probing importlib.find_spec("rapidkit")');let n=await execa(e,["-c","import importlib.util; print(1 if importlib.util.find_spec('rapidkit') else 0)"],{reject:!1,stdio:"pipe",timeout:2e3});if(t(`import probe exitCode=${n.exitCode} stdout=${(n.stdout??"").toString().trim()}`),n.exitCode===0&&(n.stdout??"").toString().trim()==="1")return !0}catch(n){t(`import probe error: ${String(n)}`);}try{t("probing python -m rapidkit");let n=await execa(e,["-m","rapidkit","--version","--json"],{reject:!1,stdio:"pipe",timeout:8e3});if(t(`-m probe exitCode=${n.exitCode}`),n.exitCode===0)return !0}catch(n){t(`-m probe error: ${String(n)}`);}try{t("probing PATH for rapidkit executables");let n=(process.env.PATH??"").split(v.delimiter).filter(Boolean);for(let r of n){let i=v.join(r,process.platform==="win32"?"rapidkit.exe":"rapidkit");try{if(await b.pathExists(i)){t(`found candidate on PATH: ${i}; invoking --version --json`);let s=await execa(i,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(t(`candidate exitCode=${s.exitCode}`),s.exitCode===0){let a=(s.stdout??"").toString().trim();try{let c=JSON.parse(a);if(c&&typeof c=="object"&&c!==null&&"version"in c)return !0}catch{t("candidate output not valid JSON, skipping");}}}}catch(s){t(`error probing candidate ${i}: ${String(s)}`);}}return t("no valid rapidkit found on PATH"),!1}catch(n){return t(`PATH probe error: ${String(n)}`),false}}async function st(e){let o=(e??"").toString().trim();if(!o)return false;try{let t=JSON.parse(o);return !!t&&typeof t=="object"&&t!==null&&"version"in t}catch{return false}}async function dn(e){let o=process.platform==="win32",t=o?v.join(".venv","Scripts","rapidkit.exe"):v.join(".venv","bin","rapidkit"),n=o?v.join(".venv","Scripts","python.exe"):v.join(".venv","bin","python"),r=e;for(let i=0;i<25;i+=1){let s=v.join(r,t);if(await b.pathExists(s)){let l=await execa(s,["--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:r});if(l.exitCode===0&&await st(l.stdout))return {cmd:s,baseArgs:[]}}let a=v.join(r,n);if(await b.pathExists(a)){let l=await execa(a,["-m","rapidkit","--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:r});if(l.exitCode===0&&await st(l.stdout))return {cmd:a,baseArgs:["-m","rapidkit"]}}let c=v.dirname(r);if(c===r)break;r=c;}return null}async function pn(e){try{let o=v.join(e,".python-version");if(await b.pathExists(o)){let n=(await b.readFile(o,"utf-8")).trim();if(n)return n}}catch{}try{let o=v.join(e,".rapidkit-workspace");if(await b.pathExists(o)){let t=await b.readFile(o,"utf-8"),n=JSON.parse(t);if(n.pythonVersion)return n.pythonVersion}}catch{}return null}async function Vt(e){if(e&&e.trim())try{let i=await dn(e);if(i){let s=v.dirname(i.cmd).includes(".venv")?v.dirname(v.dirname(v.dirname(i.cmd))):v.dirname(i.cmd),a=await pn(s);return a&&(process.env.PYENV_VERSION=a),i}}catch{}let o=await he();if(o.kind==="venv"){let i=ln(o.pythonPath),s=Nt(i);return await b.pathExists(s)?{cmd:s,baseArgs:[]}:{cmd:o.pythonPath,baseArgs:["-m","rapidkit"]}}try{if((await execa(o.cmd,["-m","rapidkit","--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3})).exitCode===0)return {cmd:o.cmd,baseArgs:["-m","rapidkit"]}}catch{}try{let s=((await execa(o.cmd,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"],{reject:!1,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(s&&await b.pathExists(s))try{let a=await execa(s,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(a.exitCode===0&&await st(a.stdout))return {cmd:s,baseArgs:[]}}catch{}}catch{}let t=Lt(),n=await Te(o.cmd),r=Nt(t);return await b.pathExists(r)?{cmd:r,baseArgs:[]}:{cmd:n,baseArgs:["-m","rapidkit"]}}async function at(){for(let e of ["python3","python"])try{return await execa(e,["--version"],{reject:!1,stdio:"pipe",timeout:2e3}),e}catch{}return null}async function Ut(){let e=!!process.env.RAPIDKIT_DEBUG,o=t=>{e&&process.stderr.write(`[DEBUG] checkRapidkitCore: ${t}
|
|
15
|
-
`);};for(let t of ["python3","python","python3.10","python3.11","python3.12"])try{o(`Method 1: trying ${t} import`);let n=await execa(t,["-c","import rapidkit_core; print(1)"],{reject:!1,stdio:"pipe",timeout:3e3});if(n.exitCode===0&&n.stdout?.trim()==="1")return o(`\u2713 Found via ${t} import`),!0}catch{continue}for(let t of ["python3","python"])try{o(`Method 2: trying ${t} -m pip show`);let n=await execa(t,["-m","pip","show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(n.exitCode===0&&n.stdout?.includes("Name: rapidkit-core"))return o(`\u2713 Found via ${t} -m pip show`),!0}catch{continue}for(let t of ["pip","pip3"])try{o(`Method 3: trying ${t} show`);let n=await execa(t,["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(n.exitCode===0&&n.stdout?.includes("Name: rapidkit-core"))return o(`\u2713 Found via ${t} show`),!0}catch{continue}try{o("Method 4: checking pyenv versions");let t=await execa("pyenv",["versions","--bare"],{reject:!1,stdio:"pipe",timeout:3e3});if(t.exitCode===0&&t.stdout){let n=t.stdout.split(`
|
|
16
|
-
`).filter(r=>r.trim());o(`Found pyenv versions: ${n.join(", ")}`);for(let r of n){let i=process.env.PYENV_ROOT||v.join(te__default.homedir(),".pyenv"),s=v.join(i,"versions",r.trim(),"bin","pip");try{let a=await execa(s,["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(a.exitCode===0&&a.stdout?.includes("Name: rapidkit-core"))return o(`\u2713 Found in pyenv ${r}`),!0}catch{try{let a=await execa("bash",["-c",`PYENV_VERSION=${r.trim()} pyenv exec pip show rapidkit-core`],{reject:!1,stdio:"pipe",timeout:3e3});if(a.exitCode===0&&a.stdout?.includes("Name: rapidkit-core"))return o(`\u2713 Found in pyenv ${r} via PYENV_VERSION`),!0}catch{continue}}}}}catch{o("pyenv not available");}for(let t of ["python3","python"])try{o(`Method 5: checking ${t} user site`);let n=await execa(t,["-m","site","--user-site"],{reject:!1,stdio:"pipe",timeout:3e3});if(n.exitCode===0&&n.stdout){let r=n.stdout.trim(),i=v.join(r,"rapidkit_core");if(await b.pathExists(i))return o("\u2713 Found in user site-packages"),!0}}catch{continue}try{o("Method 6: checking pipx");let t=await execa("pipx",["list"],{reject:!1,stdio:"pipe",timeout:3e3});if(t.exitCode===0&&t.stdout?.includes("rapidkit-core"))return o("\u2713 Found via pipx"),!0}catch{o("pipx not available");}try{if(o("Method 7: checking poetry"),(await execa("poetry",["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3})).exitCode===0)return o("\u2713 Found via poetry"),!0}catch{o("poetry check failed");}try{o("Method 8: checking conda");let t=await execa("conda",["list","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(t.exitCode===0&&t.stdout?.includes("rapidkit-core"))return o("\u2713 Found via conda"),!0}catch{o("conda not available");}return o("\u2717 Not found in any environment"),false}async function Te(e){let o=Lt(),t=an(),n=rt(),r=[o];!cn(n)&&!await b.pathExists(o)&&await b.pathExists(t)&&r.push(t);for(let g of r){let w=Dt(g);if(await b.pathExists(w))try{let h=await execa(w,["-c","import importlib.util; print(1 if importlib.util.find_spec('rapidkit') else 0)"],{reject:!1,stdio:"pipe",timeout:2e3});if(h.exitCode===0&&(h.stdout??"").toString().trim()==="1")return w;await b.remove(g);}catch{await b.remove(g);}}let i=o,s={...process.env,PIP_DISABLE_PIP_VERSION_CHECK:"1",PIP_NO_PYTHON_VERSION_WARNING:"1"},a=Math.max(0,Number(process.env.RAPIDKIT_BRIDGE_PIP_RETRY??"2")),c=Math.max(200,Number(process.env.RAPIDKIT_BRIDGE_PIP_RETRY_DELAY_MS??"800")),l=Math.max(1e4,Number(process.env.RAPIDKIT_BRIDGE_PIP_TIMEOUT_MS??"120000")),d=g=>new Promise(w=>setTimeout(w,g)),p=async(g,w,h)=>{let x=await execa(g,w,{reject:false,stdio:["ignore","pipe","inherit"],env:s,timeout:h});if(x.exitCode===0)return;let T=(x.stdout??"").toString(),F=(x.stderr??"").toString(),V=[T,F].filter(Boolean).join(`
|
|
17
|
-
`),xe=V?`${g} ${w.join(" ")}
|
|
18
|
-
${V}`:`${g} ${w.join(" ")}`;throw new Error(xe)},u=async(g,w,h)=>{let x=0;for(;;)try{await p(g,w,h);return}catch(T){if(x>=a)throw T;let F=Math.floor(Math.random()*200),V=c*Math.pow(2,x)+F;x+=1,await d(V);}};try{await b.ensureDir(v.dirname(i));try{await p(e,["-m","venv",i],6e4);}catch(h){let x=h instanceof Error?h.message:String(h);throw new z("BRIDGE_VENV_CREATE_FAILED",x)}let g=Dt(i);if((await execa(g,["-m","pip","--version"],{reject:!1,stdio:"pipe",timeout:2e3})).exitCode!==0&&(await execa(g,["-m","ensurepip","--default-pip"],{reject:!1,stdio:["ignore","pipe","inherit"],env:s,timeout:6e4})).exitCode!==0)throw new z("BRIDGE_PIP_BOOTSTRAP_FAILED","ensurepip failed; install python3-venv/python3-pip and retry.");if(process.env.RAPIDKIT_BRIDGE_UPGRADE_PIP==="1")try{await u(g,["-m","pip","install","-U","pip"],l);}catch(h){let x=h instanceof Error?h.message:String(h);throw new z("BRIDGE_PIP_UPGRADE_FAILED",x)}try{await u(g,["-m","pip","install","-U",rt()],l);}catch(h){let x=h instanceof Error?h.message:String(h);throw new z("BRIDGE_PIP_INSTALL_FAILED",x)}return g}catch(g){if(g instanceof z)throw g;let w=g instanceof Error?g.message:String(g);throw new z("BRIDGE_VENV_BOOTSTRAP_FAILED",w)}}async function he(){if(process.env.RAPIDKIT_BRIDGE_FORCE_VENV==="1"){let t=await at();if(!t)throw new z("PYTHON_NOT_FOUND","No Python interpreter found (python3/python).");return {kind:"venv",pythonPath:await Te(t)}}for(let t of ["python3","python"])if(await Wt(t))return {kind:"system",cmd:t};let e=await at();if(!e)throw new z("PYTHON_NOT_FOUND","No Python interpreter found (python3/python).");return {kind:"venv",pythonPath:await Te(e)}}async function Q(e,o){try{let t=await Vt(o?.cwd),n=t.cmd,r=[...t.baseArgs,...e],i=await execa(n,r,{cwd:o?.cwd,env:{...process.env,...o?.env},reject:!1,stdio:"inherit"});return typeof i.exitCode=="number"?i.exitCode:1}catch(t){return process.stderr.write(`${Kt(t)}
|
|
19
|
-
`),1}}async function fe(e,o){try{let t=await Vt(o?.cwd),n=t.cmd,r=[...t.baseArgs,...e],i=await execa(n,r,{cwd:o?.cwd,env:{...process.env,...o?.env},reject:!1,stdio:"pipe"});return {exitCode:typeof i.exitCode=="number"?i.exitCode:1,stdout:(i.stdout??"").toString(),stderr:(i.stderr??"").toString()}}catch(t){return {exitCode:1,stdout:"",stderr:`${Kt(t)}
|
|
20
|
-
`}}}function Bt(e){let o=new Set,t=e.split(`
|
|
21
|
-
`),n=false;for(let r of t){let i=r.replace(/\r$/,"");if(!n){/^\s*Commands:\s*$/i.test(i)&&(n=true);let c=i.match(/^\s*rapidkit\s+([a-z0-9_-]+)\b/i);if(c){let l=c[1].trim();l&&!l.startsWith("-")&&o.add(l);}continue}if(!i.trim())break;if(/^\s*(Options|Arguments|Usage|Commands)\s*:/i.test(i))continue;let s=i.match(/^\s*([a-z0-9][a-z0-9_-]*)\b/i);if(!s)continue;let a=s[1].trim();a&&!a.startsWith("-")&&o.add(a);}return o}async function Ht(){let e=Gt();if(!await b.pathExists(e))return null;try{let o=await b.readJson(e);if(o&&o.schema_version===1&&Array.isArray(o.commands))return o}catch{}return null}async function Mt(e){let o=Gt();await b.ensureDir(v.dirname(o)),await b.writeJson(o,e,{spaces:2});}async function un(){let e=await fe(["version","--json"],{cwd:process.cwd()});if(e.exitCode===0)try{let t=JSON.parse(e.stdout)?.version;return typeof t=="string"?t:void 0}catch{return}}async function mn(){let e=await fe(["commands","--json"],{cwd:process.cwd()});if(e.exitCode!==0)return null;try{let o=JSON.parse(e.stdout);if(o?.schema_version!==1||!Array.isArray(o.commands))return null;let t=o.commands.filter(n=>typeof n=="string");return t.length?t:null}catch{return null}}async function gn(){let o=Date.now(),t=await Ht(),n=await un(),r=!!t?.commands?.length;if(r&&o-t.fetched_at<864e5&&(!n||!t.rapidkit_version||t.rapidkit_version===n))return new Set(t.commands);let i=await mn();if(i?.length){let l=Array.from(new Set(i)).sort();return await Mt({schema_version:1,fetched_at:o,rapidkit_version:n,commands:l}),new Set(l)}let s=await fe(["--help"],{cwd:process.cwd()});if(s.exitCode!==0)return r&&t?.commands?new Set(t.commands):new Set(_e);let a=Bt(s.stdout);if(a.size===0)return new Set(_e);let c=Array.from(a).sort();return await Mt({schema_version:1,fetched_at:o,rapidkit_version:n,commands:c}),a}async function ct(){let o=Date.now(),t=await Ht();return !t||o-t.fetched_at>=864e5||!t.commands?.length?null:new Set(t.commands)}function Jt(){return v.join(Fe(),"rapidkit","npm-bridge","modules-catalog.json")}async function fn(){let e=Jt();if(!await b.pathExists(e))return null;try{let o=await b.readJson(e);if(o&&o.schema_version===1&&Array.isArray(o.modules))return o}catch{}return null}async function Ot(e){let o=Jt();await b.ensureDir(v.dirname(o)),await b.writeJson(o,e,{spaces:2});}function Tt(e){try{return JSON.parse(e)}catch{return null}}async function hn(e={}){let o=typeof e.ttlMs=="number"?e.ttlMs:18e5,t=Date.now(),n=await fn();if(n?.fetched_at&&t-n.fetched_at<o)return n;let r=["modules","list","--json-schema","1"];e.category&&r.push("--category",e.category),e.tag&&r.push("--tag",e.tag),e.detailed&&r.push("--detailed");let i=await fe(r,{cwd:e.cwd,env:e.env});if(i.exitCode===0){let a=Tt(i.stdout);if(a&&a.schema_version===1&&Array.isArray(a.modules)){let c={...a,fetched_at:t};return await Ot(c),c}}let s=await fe(["modules","list","--json"],{cwd:e.cwd,env:e.env});if(s.exitCode===0){let a=Tt(s.stdout);if(Array.isArray(a)){let c={schema_version:1,generated_at:new Date().toISOString(),filters:{category:e.category??null,tag:e.tag??null,detailed:!!e.detailed},stats:{total:a.length,returned:a.length,invalid:0},modules:a,source:"legacy-json",fetched_at:t};return await Ot(c),c}}return n||null}var z,yn,Ke=se(()=>{j();it();z=class extends Error{code;constructor(o,t){super(t),this.code=o;}};yn={pickSystemPython:at,ensureBridgeVenv:Te,parseCoreCommandsFromHelp:Bt,tryRapidkit:Wt,checkRapidkitCoreAvailable:Ut};});var qt={};tt(qt,{createNpmWorkspaceMarker:()=>pt,isValidWorkspaceMarker:()=>kn,readWorkspaceMarker:()=>dt,updateWorkspaceMetadata:()=>wn,writeWorkspaceMarker:()=>Ge});async function dt(e){let o=v.join(e,".rapidkit-workspace");try{if(await b.pathExists(o))return await b.readJson(o)}catch{return null}return null}async function Ge(e,o){let t=v.join(e,".rapidkit-workspace"),n=await dt(e);n?.metadata&&(o.metadata={...n.metadata,...o.metadata}),await b.outputFile(t,JSON.stringify(o,null,2)+`
|
|
22
|
-
`,"utf-8");}async function wn(e,o){let t=await dt(e);return t?(t.metadata={...t.metadata,...o,vscode:o.vscode?{...t.metadata?.vscode,...o.vscode}:t.metadata?.vscode,npm:o.npm?{...t.metadata?.npm,...o.npm}:t.metadata?.npm,python:o.python?{...t.metadata?.python,...o.python}:t.metadata?.python},await Ge(e,t),true):false}function pt(e,o,t){return {signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:o,createdAt:new Date().toISOString(),name:e,metadata:{npm:{packageVersion:o,installMethod:t,lastUsedAt:new Date().toISOString()}}}}function kn(e){if(!e||typeof e!="object")return false;let o=e;return o.signature==="RAPIDKIT_WORKSPACE"&&typeof o.createdBy=="string"&&typeof o.version=="string"&&typeof o.createdAt=="string"&&typeof o.name=="string"}var ut=se(()=>{j();});var oe={};tt(oe,{createProject:()=>$n,createWorkspace:()=>xn,listWorkspaces:()=>Rn,registerProjectInWorkspace:()=>bn,registerWorkspace:()=>zt,syncWorkspaceProjects:()=>vn});async function zt(e,o){try{let t=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(te__default.homedir(),".config"),n=process.platform==="win32"?v.join(t,"rapidkit"):v.join(te__default.homedir(),".rapidkit"),r=v.join(n,"workspaces.json");await promises.mkdir(n,{recursive:!0});let i={workspaces:[]};try{let a=await promises.readFile(r,"utf8"),c=JSON.parse(a);c&&Array.isArray(c.workspaces)&&(i=c);}catch{}i.workspaces.some(a=>a.path===e)||(i.workspaces.push({name:o,path:e,mode:"full",projects:[]}),await promises.writeFile(r,JSON.stringify(i,null,2)));}catch{console.warn(m.gray("Note: Could not register workspace in shared registry"));}}async function vn(e,o=false){try{let t=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(te__default.homedir(),".config"),n=process.platform==="win32"?v.join(t,"rapidkit"):v.join(te__default.homedir(),".rapidkit"),r=v.join(n,"workspaces.json"),i={workspaces:[]};try{let d=await promises.readFile(r,"utf8"),p=JSON.parse(d);p&&Array.isArray(p.workspaces)&&(i=p);}catch{o||console.log("\u26A0\uFE0F Workspace registry not found");return}let s=i.workspaces.find(d=>d.path===e);if(!s){o||console.log("\u26A0\uFE0F Workspace not registered in registry");return}Array.isArray(s.projects)||(s.projects=[]);let a=await promises.readdir(e,{withFileTypes:!0}),c=0,l=0;for(let d of a)if(d.isDirectory()&&!d.name.startsWith(".")){let p=v.join(e,d.name),u=v.join(p,".rapidkit","context.json"),g=v.join(p,".rapidkit","project.json");try{let w=!1;try{await promises.access(u),w=!0;}catch{await promises.access(g),w=!0;}w&&(s.projects.some(x=>x.path===p||x.name===d.name)?l++:(s.projects.push({name:d.name,path:p}),c++,o||console.log(`\u2714 Added: ${d.name}`)));}catch{}}c>0?(await promises.writeFile(r,JSON.stringify(i,null,2)),o||console.log(`
|
|
23
|
-
\u2705 Synced ${c} project(s) to registry`)):o||console.log(`
|
|
24
|
-
\u2705 All projects already registered (${l} found)`);}catch(t){o||console.error("\u274C Failed to sync projects:",t.message);}}async function bn(e,o,t){try{let n=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(te__default.homedir(),".config"),r=process.platform==="win32"?v.join(n,"rapidkit"):v.join(te__default.homedir(),".rapidkit"),i=v.join(r,"workspaces.json");console.log(`[REGISTRY DEBUG] Registry file: ${i}`);let s={workspaces:[]};try{let l=await promises.readFile(i,"utf8"),d=JSON.parse(l);d&&Array.isArray(d.workspaces)&&(s=d),console.log(`[REGISTRY DEBUG] Registry loaded, ${s.workspaces.length} workspaces`);}catch{console.log("[REGISTRY DEBUG] Registry doesn't exist, returning");return}let a=s.workspaces.find(l=>l.path===e);if(!a){console.log("[REGISTRY DEBUG] Workspace not found in registry, returning");return}console.log(`[REGISTRY DEBUG] Workspace found: ${a.name}`),Array.isArray(a.projects)||(a.projects=[]),a.projects.some(l=>l.path===t||l.name===o)?console.log("[REGISTRY DEBUG] Project already exists in registry"):(console.log("[REGISTRY DEBUG] Adding project to registry"),a.projects.push({name:o,path:t}),await promises.writeFile(i,JSON.stringify(s,null,2)),console.log("[REGISTRY DEBUG] Registry updated successfully"));}catch(n){console.log(`[REGISTRY DEBUG] Error: ${n}`);}}async function xn(e,o){let t=Re("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:!0}),await promises.mkdir(v.join(e,".rapidkit"),{recursive:!0});let n={workspace_name:o.name,author:o.author,rapidkit_version:q(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(v.join(e,".rapidkit","config.json"),JSON.stringify(n,null,2));let r=Pn();await promises.writeFile(v.join(e,"rapidkit"),r),await promises.chmod(v.join(e,"rapidkit"),493);let i=jn(o.name);if(await promises.writeFile(v.join(e,"README.md"),i),await promises.writeFile(v.join(e,".gitignore"),`# RapidKit workspace
|
|
25
|
-
.env
|
|
26
|
-
.env.*
|
|
27
|
-
!.env.example
|
|
28
|
-
|
|
29
|
-
# OS
|
|
30
|
-
.DS_Store
|
|
31
|
-
Thumbs.db
|
|
32
|
-
|
|
33
|
-
# IDEs
|
|
34
|
-
.vscode/
|
|
35
|
-
.idea/
|
|
36
|
-
|
|
37
|
-
# Logs
|
|
38
|
-
*.log
|
|
39
|
-
`),await promises.writeFile(v.join(e,".rapidkit-workspace"),JSON.stringify({signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:q(),createdAt:new Date().toISOString(),name:o.name},null,2)),await Cn(e),t.succeed("Workspace created!"),!o.skipGit){let a=Re("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:e}),a.succeed("Git repository initialized");}catch{a.warn("Could not initialize git repository");}}await zt(e,o.name),console.log(`
|
|
40
|
-
${m.green("\u2728 RapidKit workspace created successfully!")}
|
|
41
|
-
|
|
42
|
-
${m.bold("\u{1F4C2} Workspace structure:")}
|
|
43
|
-
${e}/
|
|
44
|
-
\u251C\u2500\u2500 rapidkit # Local CLI wrapper
|
|
45
|
-
\u251C\u2500\u2500 .rapidkit/ # Workspace configuration
|
|
46
|
-
\u2502 \u251C\u2500\u2500 config.json # Workspace settings
|
|
47
|
-
\u2502 \u2514\u2500\u2500 templates/ # Project templates
|
|
48
|
-
\u2514\u2500\u2500 README.md
|
|
49
|
-
|
|
50
|
-
${m.bold("\u{1F680} Get started:")}
|
|
51
|
-
${m.cyan(`cd ${o.name}`)}
|
|
52
|
-
${m.cyan("npx rapidkit my-api --template fastapi")}
|
|
53
|
-
${m.cyan("cd my-api")}
|
|
54
|
-
${m.cyan("npx rapidkit init")}
|
|
55
|
-
${m.cyan("npx rapidkit dev")}
|
|
56
|
-
|
|
57
|
-
${m.bold("\u{1F4E6} Available templates:")}
|
|
58
|
-
fastapi - FastAPI + Python (default)
|
|
59
|
-
nestjs - NestJS + TypeScript
|
|
60
|
-
|
|
61
|
-
${m.bold("\u{1F4DA} Commands:")}
|
|
62
|
-
npx rapidkit <name> --template <type> Create a new project
|
|
63
|
-
npx rapidkit init Install dependencies
|
|
64
|
-
npx rapidkit dev Start dev server
|
|
65
|
-
npx rapidkit help Show all commands
|
|
66
|
-
|
|
67
|
-
${m.gray("Alternative: ./rapidkit dev, make dev")}
|
|
68
|
-
${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
|
|
69
|
-
`);}catch(n){throw t.fail("Failed to create workspace"),n}}function Pn(){return `#!/usr/bin/env bash
|
|
70
|
-
#
|
|
71
|
-
# RapidKit CLI - Local workspace commands
|
|
72
|
-
# This script provides rapidkit commands within the workspace
|
|
73
|
-
#
|
|
74
|
-
|
|
75
|
-
set -e
|
|
76
|
-
|
|
77
|
-
# Find workspace root (where this script lives)
|
|
78
|
-
SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
|
|
79
|
-
|
|
80
|
-
# Check if we're in a project directory (has .rapidkit/project.json)
|
|
81
|
-
find_project_root() {
|
|
82
|
-
local dir="$PWD"
|
|
83
|
-
while [[ "$dir" != "/" ]]; do
|
|
84
|
-
if [[ -f "$dir/.rapidkit/project.json" ]]; then
|
|
85
|
-
echo "$dir"
|
|
86
|
-
return 0
|
|
87
|
-
fi
|
|
88
|
-
dir="$(dirname "$dir")"
|
|
89
|
-
done
|
|
90
|
-
return 1
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
# Check if we're in a workspace (has .rapidkit/config.json with type=workspace)
|
|
94
|
-
find_workspace_root() {
|
|
95
|
-
local dir="$PWD"
|
|
96
|
-
while [[ "$dir" != "/" ]]; do
|
|
97
|
-
if [[ -f "$dir/.rapidkit/config.json" ]]; then
|
|
98
|
-
if grep -q '"type": "workspace"' "$dir/.rapidkit/config.json" 2>/dev/null; then
|
|
99
|
-
echo "$dir"
|
|
100
|
-
return 0
|
|
101
|
-
fi
|
|
102
|
-
fi
|
|
103
|
-
dir="$(dirname "$dir")"
|
|
104
|
-
done
|
|
105
|
-
return 1
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
# Colors
|
|
109
|
-
RED='\\033[0;31m'
|
|
110
|
-
GREEN='\\033[0;32m'
|
|
111
|
-
YELLOW='\\033[0;33m'
|
|
112
|
-
BLUE='\\033[0;34m'
|
|
113
|
-
CYAN='\\033[0;36m'
|
|
114
|
-
NC='\\033[0m' # No Color
|
|
115
|
-
BOLD='\\033[1m'
|
|
116
|
-
|
|
117
|
-
print_banner() {
|
|
118
|
-
echo -e "\${BLUE}\${BOLD}\u{1F680} RapidKit CLI\${NC}"
|
|
119
|
-
echo ""
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
print_help() {
|
|
123
|
-
print_banner
|
|
124
|
-
echo -e "\${BOLD}Usage:\${NC} rapidkit <command> [options]"
|
|
125
|
-
echo ""
|
|
126
|
-
echo -e "\${BOLD}\u{1F3D7}\uFE0F Workspace Commands:\${NC}"
|
|
127
|
-
echo " create <name> Create a new project from template"
|
|
128
|
-
echo " create --help Show create command options"
|
|
129
|
-
echo ""
|
|
130
|
-
echo -e "\${BOLD}\u{1F680} Project Commands\${NC} (run inside a project):"
|
|
131
|
-
echo " init Install project dependencies"
|
|
132
|
-
echo " dev Start development server"
|
|
133
|
-
echo " start Start production server"
|
|
134
|
-
echo " build Build for production"
|
|
135
|
-
echo " test Run tests"
|
|
136
|
-
echo " lint Run linting"
|
|
137
|
-
echo " format Format code"
|
|
138
|
-
echo ""
|
|
139
|
-
echo -e "\${BOLD}\u{1F4DA} Other Commands:\${NC}"
|
|
140
|
-
echo " help Show this help message"
|
|
141
|
-
echo " version Show version"
|
|
142
|
-
echo ""
|
|
143
|
-
echo -e "\${BOLD}Examples:\${NC}"
|
|
144
|
-
echo -e " \${CYAN}rapidkit create my-api --template fastapi\${NC}"
|
|
145
|
-
echo -e " \${CYAN}rapidkit create my-app --template nestjs --yes\${NC}"
|
|
146
|
-
echo -e " \${CYAN}cd my-api && rapidkit dev\${NC}"
|
|
147
|
-
echo ""
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
print_create_help() {
|
|
151
|
-
print_banner
|
|
152
|
-
echo -e "\${BOLD}Usage:\${NC} rapidkit create <project-name> [options]"
|
|
153
|
-
echo ""
|
|
154
|
-
echo -e "\${BOLD}Options:\${NC}"
|
|
155
|
-
echo " -t, --template <name> Template to use (fastapi, nestjs)"
|
|
156
|
-
echo " -y, --yes Skip prompts, use defaults"
|
|
157
|
-
echo " --skip-git Skip git initialization"
|
|
158
|
-
echo " --skip-install Skip dependency installation"
|
|
159
|
-
echo ""
|
|
160
|
-
echo -e "\${BOLD}Templates:\${NC}"
|
|
161
|
-
echo " fastapi FastAPI + Python (default)"
|
|
162
|
-
echo " nestjs NestJS + TypeScript"
|
|
163
|
-
echo ""
|
|
164
|
-
echo -e "\${BOLD}Examples:\${NC}"
|
|
165
|
-
echo -e " \${CYAN}rapidkit create my-api\${NC}"
|
|
166
|
-
echo -e " \${CYAN}rapidkit create my-api --template fastapi\${NC}"
|
|
167
|
-
echo -e " \${CYAN}rapidkit create my-app --template nestjs --yes\${NC}"
|
|
168
|
-
echo ""
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
# Create project command
|
|
172
|
-
cmd_create() {
|
|
173
|
-
local project_name=""
|
|
174
|
-
local template="fastapi"
|
|
175
|
-
local yes_flag=""
|
|
176
|
-
local skip_git=""
|
|
177
|
-
local skip_install=""
|
|
178
|
-
|
|
179
|
-
# Parse arguments
|
|
180
|
-
while [[ $# -gt 0 ]]; do
|
|
181
|
-
case "$1" in
|
|
182
|
-
-h|--help)
|
|
183
|
-
print_create_help
|
|
184
|
-
exit 0
|
|
185
|
-
;;
|
|
186
|
-
-t|--template)
|
|
187
|
-
template="$2"
|
|
188
|
-
shift 2
|
|
189
|
-
;;
|
|
190
|
-
-y|--yes)
|
|
191
|
-
yes_flag="--yes"
|
|
192
|
-
shift
|
|
193
|
-
;;
|
|
194
|
-
--skip-git)
|
|
195
|
-
skip_git="--skip-git"
|
|
196
|
-
shift
|
|
197
|
-
;;
|
|
198
|
-
--skip-install)
|
|
199
|
-
skip_install="--skip-install"
|
|
200
|
-
shift
|
|
201
|
-
;;
|
|
202
|
-
-*)
|
|
203
|
-
echo -e "\${RED}\u274C Unknown option: $1\${NC}"
|
|
204
|
-
print_create_help
|
|
205
|
-
exit 1
|
|
206
|
-
;;
|
|
207
|
-
*)
|
|
208
|
-
if [[ -z "$project_name" ]]; then
|
|
209
|
-
project_name="$1"
|
|
210
|
-
fi
|
|
211
|
-
shift
|
|
212
|
-
;;
|
|
213
|
-
esac
|
|
214
|
-
done
|
|
215
|
-
|
|
216
|
-
# Validate template
|
|
217
|
-
if [[ "$template" != "fastapi" && "$template" != "nestjs" ]]; then
|
|
218
|
-
echo -e "\${RED}\u274C Invalid template: $template\${NC}"
|
|
219
|
-
echo -e "Available templates: fastapi, nestjs"
|
|
220
|
-
exit 1
|
|
221
|
-
fi
|
|
222
|
-
|
|
223
|
-
# If no project name, prompt for it or show help
|
|
224
|
-
if [[ -z "$project_name" ]]; then
|
|
225
|
-
if [[ -n "$yes_flag" ]]; then
|
|
226
|
-
project_name="my-\${template}-project"
|
|
227
|
-
else
|
|
228
|
-
echo -e "\${YELLOW}Project name required\${NC}"
|
|
229
|
-
echo ""
|
|
230
|
-
print_create_help
|
|
231
|
-
exit 1
|
|
232
|
-
fi
|
|
233
|
-
fi
|
|
234
|
-
|
|
235
|
-
# Find workspace root
|
|
236
|
-
local workspace_root
|
|
237
|
-
workspace_root=$(find_workspace_root) || {
|
|
238
|
-
echo -e "\${RED}\u274C Not in a RapidKit workspace\${NC}"
|
|
239
|
-
echo -e "Run this command from within a RapidKit workspace."
|
|
240
|
-
exit 1
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
local project_path="$PWD/$project_name"
|
|
244
|
-
|
|
245
|
-
# Check if project already exists
|
|
246
|
-
if [[ -d "$project_path" ]]; then
|
|
247
|
-
echo -e "\${RED}\u274C Directory '$project_name' already exists\${NC}"
|
|
248
|
-
exit 1
|
|
249
|
-
fi
|
|
250
|
-
|
|
251
|
-
echo -e "\${BLUE}\${BOLD}\u{1F680} Creating $template project: $project_name\${NC}"
|
|
252
|
-
echo ""
|
|
253
|
-
|
|
254
|
-
# Use Node.js generator script
|
|
255
|
-
local generator_script="$workspace_root/.rapidkit/generator.js"
|
|
256
|
-
|
|
257
|
-
if [[ -f "$generator_script" ]]; then
|
|
258
|
-
node "$generator_script" "$project_path" "$template" "$yes_flag" "$skip_git" "$skip_install"
|
|
259
|
-
else
|
|
260
|
-
echo -e "\${RED}\u274C Generator script not found\${NC}"
|
|
261
|
-
exit 1
|
|
262
|
-
fi
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
# Project commands (dev, build, test, etc.)
|
|
266
|
-
cmd_project() {
|
|
267
|
-
local cmd="$1"
|
|
268
|
-
shift
|
|
269
|
-
|
|
270
|
-
# Find project root
|
|
271
|
-
local project_root
|
|
272
|
-
project_root=$(find_project_root) || {
|
|
273
|
-
echo -e "\${RED}\u274C Not in a RapidKit project\${NC}"
|
|
274
|
-
echo -e "Run this command from within a project directory."
|
|
275
|
-
echo -e "Use \${CYAN}rapidkit create <name>\${NC} to create a new project."
|
|
276
|
-
exit 1
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
# Read project type from project.json
|
|
280
|
-
local project_json="$project_root/.rapidkit/project.json"
|
|
281
|
-
local kit_name
|
|
282
|
-
kit_name=$(grep -o '"kit_name": *"[^"]*"' "$project_json" | cut -d'"' -f4)
|
|
283
|
-
|
|
284
|
-
cd "$project_root"
|
|
285
|
-
|
|
286
|
-
case "$kit_name" in
|
|
287
|
-
fastapi.standard|fastapi.ddd|python)
|
|
288
|
-
# Python/FastAPI project
|
|
289
|
-
case "$cmd" in
|
|
290
|
-
init)
|
|
291
|
-
echo -e "\${BLUE}\u{1F4E6} Installing dependencies...\${NC}"
|
|
292
|
-
|
|
293
|
-
# Source activate script first to ensure Poetry is available
|
|
294
|
-
if [[ -f ".rapidkit/activate" ]]; then
|
|
295
|
-
source .rapidkit/activate
|
|
296
|
-
fi
|
|
297
|
-
|
|
298
|
-
poetry install
|
|
299
|
-
echo -e "\${GREEN}\u2705 Dependencies installed!\${NC}"
|
|
300
|
-
;;
|
|
301
|
-
dev)
|
|
302
|
-
echo -e "\${BLUE}\u{1F680} Starting development server...\${NC}"
|
|
303
|
-
poetry run dev "$@"
|
|
304
|
-
;;
|
|
305
|
-
start)
|
|
306
|
-
echo -e "\${BLUE}\u26A1 Starting production server...\${NC}"
|
|
307
|
-
poetry run start "$@"
|
|
308
|
-
;;
|
|
309
|
-
build)
|
|
310
|
-
echo -e "\${BLUE}\u{1F4E6} Building project...\${NC}"
|
|
311
|
-
poetry run build
|
|
312
|
-
;;
|
|
313
|
-
test)
|
|
314
|
-
echo -e "\${BLUE}\u{1F9EA} Running tests...\${NC}"
|
|
315
|
-
poetry run test
|
|
316
|
-
;;
|
|
317
|
-
lint)
|
|
318
|
-
echo -e "\${BLUE}\u{1F527} Running linter...\${NC}"
|
|
319
|
-
poetry run lint
|
|
320
|
-
;;
|
|
321
|
-
format)
|
|
322
|
-
echo -e "\${BLUE}\u2728 Formatting code...\${NC}"
|
|
323
|
-
poetry run format
|
|
324
|
-
;;
|
|
325
|
-
*)
|
|
326
|
-
echo -e "\${RED}\u274C Unknown command: $cmd\${NC}"
|
|
327
|
-
exit 1
|
|
328
|
-
;;
|
|
329
|
-
esac
|
|
330
|
-
;;
|
|
331
|
-
nestjs.standard|node)
|
|
332
|
-
# Node/NestJS project
|
|
333
|
-
local pm="npm"
|
|
334
|
-
if command -v pnpm &>/dev/null && [[ -f "pnpm-lock.yaml" ]]; then
|
|
335
|
-
pm="pnpm"
|
|
336
|
-
elif command -v yarn &>/dev/null && [[ -f "yarn.lock" ]]; then
|
|
337
|
-
pm="yarn"
|
|
338
|
-
fi
|
|
339
|
-
|
|
340
|
-
case "$cmd" in
|
|
341
|
-
init)
|
|
342
|
-
echo -e "\${BLUE}\u{1F4E6} Installing dependencies...\${NC}"
|
|
343
|
-
|
|
344
|
-
# Source activate script first to ensure environment is ready
|
|
345
|
-
if [[ -f ".rapidkit/activate" ]]; then
|
|
346
|
-
source .rapidkit/activate
|
|
347
|
-
fi
|
|
348
|
-
|
|
349
|
-
$pm install
|
|
350
|
-
echo -e "\${GREEN}\u2705 Dependencies installed!\${NC}"
|
|
351
|
-
;;
|
|
352
|
-
dev)
|
|
353
|
-
echo -e "\${BLUE}\u{1F680} Starting development server...\${NC}"
|
|
354
|
-
$pm run start:dev
|
|
355
|
-
;;
|
|
356
|
-
start)
|
|
357
|
-
echo -e "\${BLUE}\u26A1 Starting production server...\${NC}"
|
|
358
|
-
$pm run start:prod
|
|
359
|
-
;;
|
|
360
|
-
build)
|
|
361
|
-
echo -e "\${BLUE}\u{1F4E6} Building project...\${NC}"
|
|
362
|
-
$pm run build
|
|
363
|
-
;;
|
|
364
|
-
test)
|
|
365
|
-
echo -e "\${BLUE}\u{1F9EA} Running tests...\${NC}"
|
|
366
|
-
$pm test
|
|
367
|
-
;;
|
|
368
|
-
lint)
|
|
369
|
-
echo -e "\${BLUE}\u{1F527} Running linter...\${NC}"
|
|
370
|
-
$pm run lint
|
|
371
|
-
;;
|
|
372
|
-
format)
|
|
373
|
-
echo -e "\${BLUE}\u2728 Formatting code...\${NC}"
|
|
374
|
-
$pm run format
|
|
375
|
-
;;
|
|
376
|
-
*)
|
|
377
|
-
echo -e "\${RED}\u274C Unknown command: $cmd\${NC}"
|
|
378
|
-
exit 1
|
|
379
|
-
;;
|
|
380
|
-
esac
|
|
381
|
-
;;
|
|
382
|
-
*)
|
|
383
|
-
echo -e "\${RED}\u274C Unknown project type: $kit_name\${NC}"
|
|
384
|
-
exit 1
|
|
385
|
-
;;
|
|
386
|
-
esac
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
# Main command handler
|
|
390
|
-
main() {
|
|
391
|
-
local cmd="\${1:-help}"
|
|
392
|
-
shift || true
|
|
393
|
-
|
|
394
|
-
case "$cmd" in
|
|
395
|
-
create)
|
|
396
|
-
cmd_create "$@"
|
|
397
|
-
;;
|
|
398
|
-
init|dev|start|build|test|lint|format)
|
|
399
|
-
cmd_project "$cmd" "$@"
|
|
400
|
-
;;
|
|
401
|
-
help|-h|--help)
|
|
402
|
-
print_help
|
|
403
|
-
;;
|
|
404
|
-
version|-v|--version)
|
|
405
|
-
echo "RapidKit CLI (npm workspace) v${q()}"
|
|
406
|
-
;;
|
|
407
|
-
*)
|
|
408
|
-
echo -e "\${RED}\u274C Unknown command: $cmd\${NC}"
|
|
409
|
-
echo ""
|
|
410
|
-
print_help
|
|
411
|
-
exit 1
|
|
412
|
-
;;
|
|
413
|
-
esac
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
main "$@"
|
|
417
|
-
`}function jn(e){return `# ${e}
|
|
418
|
-
|
|
419
|
-
RapidKit workspace for building API projects.
|
|
420
|
-
|
|
421
|
-
## Quick Start
|
|
422
|
-
|
|
423
|
-
\`\`\`bash
|
|
424
|
-
# Add rapidkit to PATH (or use ./rapidkit)
|
|
425
|
-
export PATH="$PWD:$PATH"
|
|
426
|
-
|
|
427
|
-
# Create a FastAPI project
|
|
428
|
-
npx rapidkit my-api --template fastapi
|
|
429
|
-
|
|
430
|
-
# Or create a NestJS project
|
|
431
|
-
npx rapidkit my-app --template nestjs
|
|
432
|
-
|
|
433
|
-
# Enter project and start development
|
|
434
|
-
cd my-api
|
|
435
|
-
npx rapidkit init # Install dependencies
|
|
436
|
-
npx rapidkit dev # Start dev server
|
|
437
|
-
\`\`\`
|
|
438
|
-
|
|
439
|
-
## Available Templates
|
|
440
|
-
|
|
441
|
-
| Template | Stack | Description |
|
|
442
|
-
|----------|-------|-------------|
|
|
443
|
-
| \`fastapi\` | Python + FastAPI | High-performance Python API |
|
|
444
|
-
| \`nestjs\` | TypeScript + NestJS | Enterprise Node.js framework |
|
|
445
|
-
|
|
446
|
-
## Commands
|
|
447
|
-
|
|
448
|
-
### Commands
|
|
449
|
-
|
|
450
|
-
| Command | Description |
|
|
451
|
-
|---------|-------------|
|
|
452
|
-
| \`npx rapidkit <name> --template <type>\` | Create a new project |
|
|
453
|
-
| \`npx rapidkit init\` | Install dependencies |
|
|
454
|
-
| \`npx rapidkit dev\` | Start development server |
|
|
455
|
-
| \`npx rapidkit start\` | Start production server |
|
|
456
|
-
| \`npx rapidkit build\` | Build for production |
|
|
457
|
-
| \`npx rapidkit test\` | Run tests |
|
|
458
|
-
| \`npx rapidkit lint\` | Run linting |
|
|
459
|
-
| \`npx rapidkit format\` | Format code |
|
|
460
|
-
|
|
461
|
-
## Learn More
|
|
462
|
-
|
|
463
|
-
- [RapidKit Documentation](https://rapidkit.dev)
|
|
464
|
-
- [GitHub Repository](https://github.com/Baziar/rapidkit)
|
|
465
|
-
`}async function Cn(e){let{fileURLToPath:o}=await import('url'),t=o(import.meta.url),n=v.dirname(t),r=v.resolve(n,".."),i=v.join(r,"templates","kits"),s=v.join(e,".rapidkit","templates"),{default:a}=await import('fs-extra');await a.copy(i,s);let c=v.join(r,"templates","generator.js"),l=v.join(e,".rapidkit","generator.js");await a.copy(c,l);}async function $n(e,o){let t=o.template==="fastapi",n=t?"FastAPI":"NestJS",r=Re(`Creating ${n} project...`).start();try{let{fileURLToPath:i}=await import('url'),s=i(import.meta.url),a=v.dirname(s),c=v.resolve(a,".."),l=t?"fastapi-standard":"nestjs-standard",d=v.join(c,"templates","kits",l);await promises.mkdir(e,{recursive:!0});let p={project_name:t?o.name.replace(/-/g,"_").toLowerCase():o.name.replace(/_/g,"-").toLowerCase(),author:o.author,description:o.description||`${n} application generated with RapidKit`,app_version:"0.1.0",license:"MIT",package_manager:o.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:q()};await Qt(d,e,p);let u=t?`# Python
|
|
466
|
-
__pycache__/
|
|
467
|
-
*.py[cod]
|
|
468
|
-
*$py.class
|
|
469
|
-
*.so
|
|
470
|
-
.Python
|
|
471
|
-
build/
|
|
472
|
-
develop-eggs/
|
|
473
|
-
dist/
|
|
474
|
-
downloads/
|
|
475
|
-
eggs/
|
|
476
|
-
.eggs/
|
|
477
|
-
lib/
|
|
478
|
-
lib64/
|
|
479
|
-
parts/
|
|
480
|
-
sdist/
|
|
481
|
-
var/
|
|
482
|
-
wheels/
|
|
483
|
-
*.egg-info/
|
|
484
|
-
.installed.cfg
|
|
485
|
-
*.egg
|
|
486
|
-
|
|
487
|
-
# Virtual environments
|
|
488
|
-
.venv/
|
|
489
|
-
venv/
|
|
490
|
-
ENV/
|
|
491
|
-
env/
|
|
492
|
-
|
|
493
|
-
# IDEs
|
|
494
|
-
.vscode/
|
|
495
|
-
.idea/
|
|
496
|
-
*.swp
|
|
497
|
-
*.swo
|
|
498
|
-
*~
|
|
499
|
-
|
|
500
|
-
# OS
|
|
501
|
-
.DS_Store
|
|
502
|
-
Thumbs.db
|
|
503
|
-
|
|
504
|
-
# Project specific
|
|
505
|
-
.env
|
|
506
|
-
.env.local
|
|
507
|
-
`:`# Node artifacts
|
|
508
|
-
node_modules/
|
|
509
|
-
dist/
|
|
510
|
-
.tmp/
|
|
511
|
-
.env
|
|
512
|
-
.env.*
|
|
513
|
-
!.env.example
|
|
514
|
-
|
|
515
|
-
# Logs
|
|
516
|
-
logs/
|
|
517
|
-
*.log
|
|
518
|
-
npm-debug.log*
|
|
519
|
-
yarn-debug.log*
|
|
520
|
-
yarn-error.log*
|
|
521
|
-
pnpm-debug.log*
|
|
522
|
-
|
|
523
|
-
# OS
|
|
524
|
-
.DS_Store
|
|
525
|
-
Thumbs.db
|
|
526
|
-
|
|
527
|
-
# IDEs
|
|
528
|
-
.idea/
|
|
529
|
-
.vscode/
|
|
530
|
-
|
|
531
|
-
# Coverage
|
|
532
|
-
coverage/
|
|
533
|
-
`;if(await promises.writeFile(v.join(e,".gitignore"),u),r.succeed(`${n} project created!`),!o.skipGit){let w=Re("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m",`Initial commit: ${n} project via RapidKit`],{cwd:e}),w.succeed("Git repository initialized");}catch{w.warn("Could not initialize git repository");}}if(!o.skipInstall&&!t){let w=o.package_manager||"npm",h=Re(`Installing dependencies with ${w}...`).start();try{await execa(w,["install"],{cwd:e}),h.succeed("Dependencies installed");}catch{h.warn(`Could not install dependencies. Run '${w} install' manually.`);}}let g=v.basename(e);console.log(t?`
|
|
534
|
-
${m.green("\u2728 FastAPI project created successfully!")}
|
|
535
|
-
|
|
536
|
-
${m.bold("\u{1F4C2} Project structure:")}
|
|
537
|
-
${e}/
|
|
538
|
-
\u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
|
|
539
|
-
\u251C\u2500\u2500 src/
|
|
540
|
-
\u2502 \u251C\u2500\u2500 main.py # FastAPI application
|
|
541
|
-
\u2502 \u251C\u2500\u2500 cli.py # CLI commands
|
|
542
|
-
\u2502 \u251C\u2500\u2500 routing/ # API routes
|
|
543
|
-
\u2502 \u2514\u2500\u2500 modules/ # Module system
|
|
544
|
-
\u251C\u2500\u2500 tests/ # Test suite
|
|
545
|
-
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
546
|
-
\u2514\u2500\u2500 README.md
|
|
547
|
-
|
|
548
|
-
${m.bold("\u{1F680} Get started:")}
|
|
549
|
-
${m.cyan(`cd ${g}`)}
|
|
550
|
-
${m.cyan("npx rapidkit init")} ${m.gray("# Install dependencies")}
|
|
551
|
-
${m.cyan("npx rapidkit dev")} ${m.gray("# Start dev server")}
|
|
552
|
-
|
|
553
|
-
${m.bold("\u{1F4DA} Available commands:")}
|
|
554
|
-
npx rapidkit init # Install dependencies (poetry install)
|
|
555
|
-
npx rapidkit dev # Start dev server with hot reload
|
|
556
|
-
npx rapidkit start # Start production server
|
|
557
|
-
npx rapidkit test # Run tests
|
|
558
|
-
npx rapidkit lint # Lint code
|
|
559
|
-
npx rapidkit format # Format code
|
|
560
|
-
|
|
561
|
-
${m.gray("Alternative: make dev, ./rapidkit dev, poetry run dev")}
|
|
562
|
-
${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
|
|
563
|
-
`:`
|
|
564
|
-
${m.green("\u2728 NestJS project created successfully!")}
|
|
565
|
-
|
|
566
|
-
${m.bold("\u{1F4C2} Project structure:")}
|
|
567
|
-
${e}/
|
|
568
|
-
\u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
|
|
569
|
-
\u251C\u2500\u2500 src/
|
|
570
|
-
\u2502 \u251C\u2500\u2500 main.ts # Application entry point
|
|
571
|
-
\u2502 \u251C\u2500\u2500 app.module.ts # Root module
|
|
572
|
-
\u2502 \u251C\u2500\u2500 config/ # Configuration
|
|
573
|
-
\u2502 \u2514\u2500\u2500 examples/ # Example module
|
|
574
|
-
\u251C\u2500\u2500 test/ # Test files
|
|
575
|
-
\u251C\u2500\u2500 package.json # Dependencies
|
|
576
|
-
\u2514\u2500\u2500 README.md
|
|
577
|
-
|
|
578
|
-
${m.bold("\u{1F680} Get started:")}
|
|
579
|
-
${m.cyan(`cd ${g}`)}
|
|
580
|
-
${o.skipInstall?m.cyan("npx rapidkit init")+m.gray(" # npm install")+`
|
|
581
|
-
`:""}${m.cyan("cp .env.example .env")}
|
|
582
|
-
${m.cyan("npx rapidkit dev")} ${m.gray("# Start dev server")}
|
|
583
|
-
|
|
584
|
-
${m.bold("\u{1F4DA} Available commands:")}
|
|
585
|
-
npx rapidkit init # Install dependencies
|
|
586
|
-
npx rapidkit dev # Start dev server with hot reload
|
|
587
|
-
npx rapidkit start # Start production server
|
|
588
|
-
npx rapidkit build # Build for production
|
|
589
|
-
npx rapidkit test # Run tests
|
|
590
|
-
npx rapidkit lint # Lint code
|
|
591
|
-
npx rapidkit format # Format code
|
|
592
|
-
|
|
593
|
-
${m.bold("\u{1F310} API endpoints:")}
|
|
594
|
-
http://localhost:8000/health # Health check
|
|
595
|
-
http://localhost:8000/docs # Swagger docs
|
|
596
|
-
http://localhost:8000/examples/notes # Example API
|
|
597
|
-
|
|
598
|
-
${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
|
|
599
|
-
`);}catch(i){throw r.fail(`Failed to create ${n} project`),i}}async function Qt(e,o,t){let n=await promises.readdir(e,{withFileTypes:true});for(let r of n){let i=v.join(e,r.name),s=r.name.replace(/\.j2$/,""),a=v.join(o,s);if(r.isDirectory())await promises.mkdir(a,{recursive:true}),await Qt(i,a,t);else {let c=await promises.readFile(i,"utf-8");r.name.endsWith(".j2")&&(c=_n(c,t)),await promises.writeFile(a,c),(s==="rapidkit"||s==="activate"||s.endsWith(".py")&&a.includes(".rapidkit"))&&await promises.chmod(a,493);}}}function _n(e,o){let t=e;for(let[n,r]of Object.entries(o)){let i=new RegExp(`\\{\\{\\s*${n}\\s*\\}\\}`,"g");t=t.replace(i,String(r));let s=new RegExp(`\\{\\{\\s*${n}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");t=t.replace(s,(l,d,p)=>String(r).replace(new RegExp(d,"g"),p));let a=new RegExp(`\\{\\{\\s*${n}\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(a,String(r).toLowerCase());let c=new RegExp(`\\{\\{\\s*${n}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(c,(l,d,p)=>String(r).replace(new RegExp(d,"g"),p).toLowerCase());}return t}async function Rn(){let e=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(te__default.homedir(),".config"),o=process.platform==="win32"?v.join(e,"rapidkit"):v.join(te__default.homedir(),".rapidkit"),t=v.join(o,"workspaces.json");if(!await promises.stat(t).catch(()=>null)){console.log(m.yellow(`
|
|
600
|
-
\u26A0\uFE0F No workspaces registered yet.
|
|
601
|
-
`)),console.log(m.gray(`Create a workspace with: npx rapidkit <workspace-name>
|
|
602
|
-
`));return}try{let n=await promises.readFile(t,"utf8"),r=JSON.parse(n);if(!r.workspaces||r.workspaces.length===0){console.log(m.yellow(`
|
|
603
|
-
\u26A0\uFE0F No workspaces registered yet.
|
|
604
|
-
`));return}console.log(m.bold(`
|
|
605
|
-
\u{1F4E6} Registered RapidKit Workspaces:
|
|
606
|
-
`));for(let i of r.workspaces)console.log(m.cyan(` ${i.name}`)),console.log(m.gray(` Path: ${i.path}`)),console.log(m.gray(` Projects: ${i.projects?.length||0}`)),await promises.stat(i.path).catch(()=>null)||console.log(m.red(" \u26A0\uFE0F Path not found")),console.log();console.log(m.gray(`Total: ${r.workspaces.length} workspace(s)
|
|
607
|
-
`));}catch(n){console.error(m.red(`
|
|
608
|
-
\u274C Failed to read workspace registry`)),console.error(m.gray(String(n)));}}var ne=se(()=>{j();Pe();});j();ce();Pe();j();ce();var zo=".rapidkitrc.json",Qo=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function je(){let e=v.join(te__default.homedir(),zo);try{let o=await promises.readFile(e,"utf-8"),t=JSON.parse(o);return y.debug(`Loaded config from ${e}`),t}catch{return y.debug("No user config found, using defaults"),{}}}async function Et(e=process.cwd()){let o=e,t=v.parse(o).root;for(;o!==t;){for(let n of Qo){let r=v.join(o,n);try{await promises.access(r),y.debug(`Found config file: ${r}`);let s=await import(pathToFileURL(r).href),a=s.default||s;return y.debug(`Loaded RapidKit config from ${n}`),a}catch{continue}}o=v.dirname(o);}return y.debug("No RapidKit config file found, using defaults"),{}}function It(e,o,t){return {author:t.author||o.workspace?.defaultAuthor||e.author,pythonVersion:o.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||o.workspace?.installMethod||e.defaultInstallMethod,defaultKit:t.defaultKit||o.projects?.defaultKit||e.defaultKit,skipGit:t.skipGit??o.projects?.skipGit??e.skipGit,license:t.license||e.license,testRapidKitPath:t.testRapidKitPath||e.testRapidKitPath}}function Me(e){return process.env.RAPIDKIT_DEV_PATH||e.testRapidKitPath||void 0}j();j();var J=class extends Error{constructor(t,n,r){super(t);this.code=n;this.details=r;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}},me=class extends J{constructor(o,t){let n=t?`Python ${o}+ required, found ${t}`:`Python ${o}+ not found`;super(n,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},Ce=class extends J{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},$e=class extends J{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},Oe=class extends J{constructor(o){super(`Directory "${o}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},ee=class extends J{constructor(o,t){super(`Invalid project name: "${o}"`,"INVALID_PROJECT_NAME",t);}},U=class extends J{constructor(o,t){let n=`Installation failed at: ${o}`,r=`${t.message}
|
|
2
|
+
import {d,c as c$1,g,a as a$1}from'./chunk-D2ZRDZOE.js';import {d as d$1,b as b$1}from'./chunk-RV6HBTFC.js';import {c,a,b}from'./chunk-7LU4Z66R.js';import {Command,Option}from'commander';import u from'chalk';import Se from'inquirer';import w from'path';import {exec,spawn}from'child_process';import S,{promises}from'fs';import*as Wt from'os';import Wt__default from'os';import {fileURLToPath,pathToFileURL}from'url';import qt from'validate-npm-package-name';import*as k from'fs-extra';import k__default from'fs-extra';import {execa}from'execa';import Me from'ora';import no from'nunjucks';import ro from'crypto';import {promisify}from'util';var Ut=".rapidkitrc.json",Ht=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function ie(){let e=w.join(Wt__default.homedir(),Ut);try{let o=await promises.readFile(e,"utf-8"),t=JSON.parse(o);return a.debug(`Loaded config from ${e}`),t}catch{return a.debug("No user config found, using defaults"),{}}}async function Be(e=process.cwd()){let o=e,t=w.parse(o).root;for(;o!==t;){for(let n of Ht){let r=w.join(o,n);try{await promises.access(r),a.debug(`Found config file: ${r}`);let s=await import(pathToFileURL(r).href),l=s.default||s;return a.debug(`Loaded RapidKit config from ${n}`),l}catch{continue}}o=w.dirname(o);}return a.debug("No RapidKit config file found, using defaults"),{}}function Ye(e,o,t){return {author:t.author||o.workspace?.defaultAuthor||e.author,pythonVersion:o.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||o.workspace?.installMethod||e.defaultInstallMethod,defaultKit:t.defaultKit||o.projects?.defaultKit||e.defaultKit,skipGit:t.skipGit??o.projects?.skipGit??e.skipGit,license:t.license||e.license,testRapidKitPath:t.testRapidKitPath||e.testRapidKitPath}}function ge(e){return process.env.RAPIDKIT_DEV_PATH||e.testRapidKitPath||void 0}var N=class extends Error{constructor(t,n,r){super(t);this.code=n;this.details=r;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}},X=class extends N{constructor(o,t){let n=t?`Python ${o}+ required, found ${t}`:`Python ${o}+ not found`;super(n,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},re=class extends N{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},se=class extends N{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},fe=class extends N{constructor(o){super(`Directory "${o}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},H=class extends N{constructor(o,t){super(`Invalid project name: "${o}"`,"INVALID_PROJECT_NAME",t);}},D=class extends N{constructor(o,t){let n=`Installation failed at: ${o}`,r=`${t.message}
|
|
609
3
|
|
|
610
4
|
Troubleshooting:
|
|
611
5
|
- Check your internet connection
|
|
612
6
|
- Verify Python/Poetry installation
|
|
613
|
-
- Try running with --debug flag for more details`;super(n,"INSTALLATION_ERROR",r);}},
|
|
7
|
+
- Try running with --debug flag for more details`;super(n,"INSTALLATION_ERROR",r);}},Z=class extends N{constructor(){super("RapidKit Python package is not yet available on PyPI","RAPIDKIT_NOT_AVAILABLE",`Available options:
|
|
614
8
|
1. Install Python 3.10+ and retry the same command
|
|
615
9
|
2. Use the core workflow: npx rapidkit create workspace <name>
|
|
616
10
|
3. Offline fallback (limited): npx rapidkit create project fastapi.standard <name> --output .
|
|
617
11
|
|
|
618
|
-
Legacy: set RAPIDKIT_SHOW_LEGACY=1 to reveal template-mode flags in help.`);}};function
|
|
12
|
+
Legacy: set RAPIDKIT_SHOW_LEGACY=1 to reveal template-mode flags in help.`);}};function Qe(e){let o=qt(e);if(!o.validForNewPackages){let n=o.errors||[],r=o.warnings||[],i=[...n,...r];throw new H(e,`NPM validation failed: ${i.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(e))throw new H(e,"Must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores");if(["test","tests","src","dist","build","lib","python","pip","poetry","node","npm","rapidkit","rapidkit"].includes(e.toLowerCase()))throw new H(e,`"${e}" is a reserved name. Please choose a different name.`);if(e.length<2)throw new H(e,"Name must be at least 2 characters long");if(e.length>214)throw new H(e,"Name must be less than 214 characters");return true}function zt(e){return typeof e=="object"&&e!==null}async function Bt(e,o,t,n=8e3){try{let r=await execa(e,o,{cwd:t,timeout:n,reject:false,stdio:"pipe"});return {ok:r.exitCode===0,exitCode:r.exitCode,stdout:r.stdout,stderr:r.stderr}}catch(r){return {ok:false,exitCode:void 0,stdout:"",stderr:r instanceof Error?r.message:String(r)}}}async function Yt(e,o){let t=["-m","rapidkit",...e],n=["python3","python"];for(let r of n){let i=await Bt(r,t,o?.cwd,o?.timeoutMs);if(!i.ok)continue;let s=(i.stdout??"").trim();try{let l=JSON.parse(s);return zt(l)?{ok:true,command:r,exitCode:i.exitCode,stdout:i.stdout,stderr:i.stderr,data:l}:{ok:false,command:r,exitCode:i.exitCode,stdout:i.stdout,stderr:i.stderr}}catch{return {ok:false,command:r,exitCode:i.exitCode,stdout:i.stdout,stderr:i.stderr}}}return {ok:false}}async function Xe(e,o){let t=await Yt(["project","detect","--path",e,"--json"],o);return !t.ok||!t.data||t.data.schema_version!==1?{ok:false,command:t.command,exitCode:t.exitCode,stdout:t.stdout,stderr:t.stderr}:t}function he(){return process.platform==="win32"?"python":"python3"}async function tt(e,o,t,n){let r=d$1(o,c(),t);n&&(r.metadata||(r.metadata={}),r.metadata.python={version:n}),await b$1(e,r);}async function ot(e){await k.outputFile(w.join(e,".gitignore"),`.venv/
|
|
619
13
|
__pycache__/
|
|
620
14
|
*.pyc
|
|
621
15
|
.env
|
|
622
16
|
.rapidkit-workspace/
|
|
623
17
|
|
|
624
|
-
`,"utf-8");}async function
|
|
625
|
-
`,"utf-8"),
|
|
18
|
+
`,"utf-8");}async function Ze(e){try{let{stdout:o}=await execa(e,["--version"],{timeout:3e3}),t=o.match(/Python (\d+\.\d+\.\d+)/);if(t)return t[1]}catch{}return null}async function Qt(e,o){try{await promises.writeFile(w.join(e,".python-version"),`${o}
|
|
19
|
+
`,"utf-8"),a.debug(`Created .python-version with ${o}`);}catch(t){a.warn(`Failed to create .python-version: ${t}`);}}function ae(){let e=w.join(Wt.homedir(),".local","bin"),t=(process.env.PATH||"").split(w.delimiter).filter(Boolean);t.includes(e)||(process.env.PATH=[e,...t].join(w.delimiter));}async function ye(e,o){ae(),e.start("Checking pipx installation");try{return await execa("pipx",["--version"]),e.succeed("pipx found"),{kind:"binary"}}catch{}let t=he();try{return await execa(t,["-m","pipx","--version"]),e.succeed("pipx found"),{kind:"python-module",pythonCmd:t}}catch{}if(o)throw new se;let{installPipx:n}=await Se.prompt([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!n)throw new se;e.start("Installing pipx (user install)");try{try{await execa(t,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(t,["-m","pip","install","--user","--upgrade","pipx"]);}catch(r){let i=r,s=String(i?.stderr||i?.shortMessage||i?.message||"");throw new D("Install pipx with python -m pip",r instanceof Error?r:new Error(s))}e.succeed("pipx installed"),ae();try{return await execa(t,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:t}}catch(r){let i=r,s=String(i?.stderr||i?.shortMessage||i?.message||"pipx not runnable after install");throw new D("Verify pipx after install",new Error(`${s}
|
|
626
20
|
|
|
627
|
-
Try reopening your terminal or run: python3 -m pipx ensurepath`))}}async function
|
|
21
|
+
Try reopening your terminal or run: python3 -m pipx ensurepath`))}}async function ee(e,o){return e.kind==="binary"?execa("pipx",o):execa(e.pythonCmd,["-m","pipx",...o])}async function Xt(e,o){ae(),e.start("Checking Poetry installation");try{await execa("poetry",["--version"]),e.succeed("Poetry found");return}catch{}if(o)throw new re;let{installPoetry:t}=await Se.prompt([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!t)throw new re;let n=await ye(e,o);e.start("Installing Poetry with pipx");try{await ee(n,["install","poetry"]);}catch(r){let i=r,s=String(i?.stderr||i?.shortMessage||i?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(s))try{await ee(n,["upgrade","poetry"]);}catch{}else throw new D("Install Poetry with pipx",r instanceof Error?r:new Error(s))}e.succeed("Poetry installed"),ae();try{await execa("poetry",["--version"]);}catch(r){let i=r,s=String(i?.stderr||i?.shortMessage||i?.message||"Poetry not found on PATH");throw new D("Verify Poetry after pipx install",new Error(`${s}
|
|
628
22
|
|
|
629
|
-
Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function
|
|
23
|
+
Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function Zt(e){let o=e==="poetry";return `#!/usr/bin/env sh
|
|
630
24
|
set -eu
|
|
631
25
|
|
|
632
26
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
@@ -645,7 +39,7 @@ echo "- If you used venv: ensure .venv exists (or re-run the installer)." 1>&2
|
|
|
645
39
|
${o?`echo "- If you used Poetry: run 'poetry install' and retry, or activate the env." 1>&2
|
|
646
40
|
`:""}echo "Tip: you can also run: ./.venv/bin/rapidkit --help" 1>&2
|
|
647
41
|
exit 1
|
|
648
|
-
`}function
|
|
42
|
+
`}function eo(e){return `@echo off
|
|
649
43
|
setlocal
|
|
650
44
|
|
|
651
45
|
set "SCRIPT_DIR=%~dp0"
|
|
@@ -664,42 +58,42 @@ if %ERRORLEVEL%==0 if exist "%SCRIPT_DIR%\\pyproject.toml" (
|
|
|
664
58
|
`:""}echo RapidKit launcher could not find a local Python CLI. 1>&2
|
|
665
59
|
echo Tip: run .venv\\Scripts\\rapidkit.exe --help 1>&2
|
|
666
60
|
exit /b 1
|
|
667
|
-
`}async function
|
|
61
|
+
`}async function nt(e,o){await k.outputFile(w.join(e,"rapidkit"),Zt(o),{encoding:"utf-8",mode:493}),await k.outputFile(w.join(e,"rapidkit.cmd"),eo(o),"utf-8");}async function it(e,o){let{skipGit:t=false,testMode:n=false,demoMode:r=false,dryRun:i=false,yes:s=false,userConfig:l={},installMethod:a$1}=o,c=e||"rapidkit",d=w.resolve(process.cwd(),c);if(await k.pathExists(d))throw new fe(c);if(i){await oo(d,c,r,l);return}if(r){await to(d,c,t);return}let g=s?{pythonVersion:l.pythonVersion||"3.10",installMethod:a$1||l.defaultInstallMethod||"poetry"}:await Se.prompt([{type:"list",name:"pythonVersion",message:"Select Python version for RapidKit:",choices:["3.10","3.11","3.12"],default:l.pythonVersion||"3.10"},{type:"list",name:"installMethod",message:"How would you like to install RapidKit?",choices:[{name:"\u{1F3AF} Poetry (Recommended - includes virtual env)",value:"poetry"},{name:"\u{1F4E6} pip with venv (Standard)",value:"venv"},{name:"\u{1F527} pipx (Global isolated install)",value:"pipx"}],default:l.defaultInstallMethod||"poetry"}]);a.step(1,3,"Setting up RapidKit environment");let p=Me("Creating directory").start();try{await k.ensureDir(d),p.succeed("Directory created"),p.start("Detecting Python version");let y=null,P=await rt(g.pythonVersion);if(P)y=await Ze(P),y?(a.info(` Detected Python ${y}`),p.succeed(`Python ${y} detected`)):p.warn("Could not detect exact Python version");else {let v=he();y=await Ze(v),y?p.succeed(`Python ${y} detected`):p.warn("Could not detect Python version, proceeding with defaults");}if(await tt(d,c,g.installMethod,y||void 0),y&&await Qt(d,y),await ot(d),g.installMethod==="poetry")try{await st(d,g.pythonVersion,p,n,l,s);}catch(v){let C=v?.details||v?.message||String(v);if(C.includes("pyenv")||C.includes("exit status 127")||C.includes("returned non-zero exit status 127")){p.warn("Poetry encountered Python discovery issues, trying venv method"),a.debug(`Poetry error (attempting venv fallback): ${C}`);try{await Ee(d,g.pythonVersion,p,n,l),g.installMethod="venv";}catch(M){throw M}}else throw v}else g.installMethod==="venv"?await Ee(d,g.pythonVersion,p,n,l):await at(d,p,n,l,s);if(await nt(d,g.installMethod),await ct(d,g.installMethod),p.succeed("RapidKit environment ready!"),!o.skipGit){p.start("Initializing git repository");try{await execa("git",["init"],{cwd:d}),await execa("git",["add","."],{cwd:d}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:d}),p.succeed("Git repository initialized");}catch{p.warn("Could not initialize git repository");}}try{let{registerWorkspace:v}=await import('./workspace-LZZGJRGV.js');await v(d,c);}catch{console.warn(u.gray("Note: Could not register workspace in shared registry"));}if(console.log(u.green(`
|
|
668
62
|
\u2728 RapidKit environment created successfully!
|
|
669
|
-
`)),console.log(
|
|
670
|
-
`)),console.log(
|
|
671
|
-
\u{1F4A1} For more information, check the README.md file.`)),console.log(
|
|
672
|
-
\u{1F4DA} RapidKit commands:`)),console.log(
|
|
673
|
-
`));}catch(
|
|
674
|
-
\u274C Error:`),
|
|
675
|
-
package-mode = false`):
|
|
63
|
+
`)),console.log(u.cyan("\u{1F4C2} Location:"),u.white(d)),console.log(u.cyan(`\u{1F680} Get started:
|
|
64
|
+
`)),console.log(u.white(` cd ${c}`)),g.installMethod==="poetry"){let v="source $(poetry env info --path)/bin/activate";try{ae();let{stdout:C}=await execa("poetry",["--version"]),_=C.match(/Poetry.*?(\d+)\.(\d+)/);_&&(parseInt(_[1])>=2?v="source $(poetry env info --path)/bin/activate":v="poetry shell");}catch{}console.log(u.white(` ${v} # Or: poetry run rapidkit`)),console.log(u.white(" rapidkit create # Interactive mode")),console.log(u.white(" cd <project-name> && rapidkit init && rapidkit dev"));}else g.installMethod==="venv"?(console.log(u.white(" source .venv/bin/activate # On Windows: .venv\\Scripts\\activate")),console.log(u.white(" rapidkit create # Interactive mode")),console.log(u.white(" cd <project-name> && rapidkit init && rapidkit dev"))):(console.log(u.white(" rapidkit create # Interactive mode")),console.log(u.white(" cd <project-name> && rapidkit init && rapidkit dev")));console.log(u.white(`
|
|
65
|
+
\u{1F4A1} For more information, check the README.md file.`)),console.log(u.cyan(`
|
|
66
|
+
\u{1F4DA} RapidKit commands:`)),console.log(u.white(" rapidkit create - Create a new project (interactive)")),console.log(u.white(" rapidkit dev - Run development server")),console.log(u.white(" rapidkit add module <name> - Add a module (e.g., settings)")),console.log(u.white(" rapidkit list - List available kits")),console.log(u.white(" rapidkit modules - List available modules")),console.log(u.white(` rapidkit --help - Show all commands
|
|
67
|
+
`));}catch(y){p.fail("Failed to create RapidKit environment"),console.error(u.red(`
|
|
68
|
+
\u274C Error:`),y);try{await k.remove(d);}catch{}throw y}}async function rt(e){let o=[];try{let{stdout:t}=await execa("pyenv",["root"]),n=t.trim();o.push(w.join(n,"versions",`${e}.*`,"bin","python"));let[r,i]=e.split(".");o.push(w.join(n,"versions",`${r}.${i}.*`,"bin","python"));}catch{}o.push(`python${e}`,`python3.${e.split(".")[1]}`,"python3","python"),o.push(`/usr/bin/python${e}`,"/usr/bin/python3",`/usr/local/bin/python${e}`,"/usr/local/bin/python3");for(let t of o)try{let n=t;if(t.includes("*")){if(n=(await execa("sh",["-c",`ls -d ${t} 2>/dev/null | head -1`])).stdout.trim(),!n)continue;n=w.join(n.split("/").slice(0,-1).join("/"),"../bin/python");}let{stdout:r}=await execa(n,["--version"],{timeout:2e3}),i=r.match(/Python (\d+\.\d+)/)?.[1];if(i&&parseFloat(i)>=parseFloat(e))return await execa(n,["-c","import sys; sys.exit(0)"],{timeout:2e3}),n}catch{continue}return null}async function st(e,o,t,n,r,i=false){await Xt(t,i),t.start("Finding Python interpreter");let s=await rt(o);s?(a.debug(`Found working Python: ${s}`),t.succeed("Python found")):t.warn("Could not verify Python path, proceeding with default"),t.start("Initializing Poetry project"),await execa("poetry",["init","--no-interaction","--python",`^${o}`],{cwd:e}),t.succeed("Poetry project initialized");let l=w.join(e,"pyproject.toml"),c=await promises.readFile(l,"utf-8");c.includes("[tool.poetry]")?c=c.replace("[tool.poetry]",`[tool.poetry]
|
|
69
|
+
package-mode = false`):c.includes("[project]")&&(c.includes("[build-system]")?c=c.replace("[build-system]",`
|
|
676
70
|
[tool.poetry]
|
|
677
71
|
package-mode = false
|
|
678
72
|
|
|
679
|
-
[build-system]`):
|
|
73
|
+
[build-system]`):c+=`
|
|
680
74
|
|
|
681
75
|
[tool.poetry]
|
|
682
76
|
package-mode = false
|
|
683
|
-
`),await promises.writeFile(
|
|
684
|
-
Error: ${
|
|
77
|
+
`),await promises.writeFile(l,c,"utf-8"),t.start("Configuring Poetry");try{if(await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:e}),s)try{await execa("poetry",["env","use",s],{cwd:e}),a.debug(`Poetry configured to use: ${s}`);}catch(d){a.debug(`Could not set Poetry env to ${s}: ${d}`);}t.succeed("Poetry configured");}catch{t.warn("Could not configure Poetry virtualenvs.in-project");}t.start("Creating virtualenv");try{await execa("poetry",["install","--no-root"],{cwd:e,timeout:3e4}),t.succeed("Virtualenv created");}catch(d){a.debug(`Failed to create virtualenv: ${d}`),t.warn("Could not create virtualenv, proceeding with add command");}if(t.start("Installing RapidKit"),n){let d=ge(r||{});if(!d)throw new D("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a.debug(`Installing from local path: ${d}`),t.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",d],{cwd:e});}else {t.text="Installing RapidKit from PyPI";let d=false,g=null;for(let p=1;p<=3;p++)try{await execa("poetry",["add","rapidkit-core"],{cwd:e,timeout:6e4*p}),d=true;break}catch(y){g=y,a.debug(`Poetry add attempt ${p} failed: ${y}`),p<3&&(t.text=`Retrying installation (attempt ${p+1}/3)`,await new Promise(P=>setTimeout(P,2e3)));}if(!d){let p=g?.stderr||g?.message||"Unknown error";throw a.debug(`All Poetry install attempts failed. Last error: ${p}`),p.includes("Could not find")||p.includes("No matching distribution")?new Z:new D("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
78
|
+
Error: ${p}
|
|
685
79
|
|
|
686
80
|
Possible solutions:
|
|
687
81
|
1. Check your internet connection
|
|
688
|
-
2. Try installing manually: cd ${
|
|
689
|
-
3. Use venv method instead: npx rapidkit ${
|
|
82
|
+
2. Try installing manually: cd ${w.basename(e)} && poetry add rapidkit-core
|
|
83
|
+
3. Use venv method instead: npx rapidkit ${w.basename(e)} --install-method=venv`))}}t.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:d}=await import('./pythonRapidkitExec-GFCAVUOY.js');if(!await d()&&!n){t.start("Installing RapidKit globally with pipx for CLI access");let p=await ye(t,i);try{await ee(p,["install","rapidkit-core"]),t.succeed("RapidKit installed globally");}catch(y){t.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),a.debug(`pipx install failed: ${y}`);}}}catch(d){a.debug(`Global install check skipped: ${d}`);}}async function Ee(e,o,t,n,r,i=false){t.start(`Checking Python ${o}`);let s=he();try{let{stdout:a}=await execa(s,["--version"]),c=a.match(/Python (\d+\.\d+)/)?.[1];if(c&&parseFloat(c)<parseFloat(o))throw new X(o,c);t.succeed(`Python ${c} found`);}catch(a){throw a instanceof X?a:new X(o)}t.start("Creating virtual environment");try{await execa(s,["-m","venv",".venv"],{cwd:e}),t.succeed("Virtual environment created");}catch(a){if(t.fail("Failed to create virtual environment"),(d=>typeof d=="object"&&d!==null&&"stdout"in d&&typeof d.stdout=="string")(a)&&a.stdout.includes("ensurepip is not")){let d=a.stdout.match(/apt install (python[\d.]+-venv)/),g=d?d[1]:"python3-venv";throw new D("Python venv module not available",new Error(`Virtual environment creation failed.
|
|
690
84
|
|
|
691
85
|
On Debian/Ubuntu systems, install the venv package:
|
|
692
|
-
sudo apt install ${
|
|
86
|
+
sudo apt install ${g}
|
|
693
87
|
|
|
694
88
|
Or use Poetry instead (recommended):
|
|
695
|
-
npx rapidkit ${
|
|
89
|
+
npx rapidkit ${w.basename(e)} --yes`))}throw new D("Virtual environment creation",a instanceof Error?a:new Error(String(a)))}t.start("Installing RapidKit");let l=w.join(e,".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python");if(await execa(l,["-m","pip","install","--upgrade","pip"],{cwd:e}),n){let a$1=ge(r||{});if(!a$1)throw new D("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a.debug(`Installing from local path: ${a$1}`),t.text="Installing RapidKit from local path (test mode)",await execa(l,["-m","pip","install","-e",a$1],{cwd:e});}else {t.text="Installing RapidKit from PyPI";let a$1=false,c=null;for(let d=1;d<=3;d++)try{await execa(l,["-m","pip","install","rapidkit-core"],{cwd:e,timeout:6e4*d}),a$1=true;break}catch(g){c=g,a.debug(`pip install attempt ${d} failed: ${g}`),d<3&&(t.text=`Retrying installation (attempt ${d+1}/3)`,await new Promise(p=>setTimeout(p,2e3)));}if(!a$1){let d=c?.stderr||c?.message||"Unknown error";throw a.debug(`All pip install attempts failed. Last error: ${d}`),d.includes("Could not find")||d.includes("No matching distribution")?new Z:new D("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
696
90
|
Error: ${d}
|
|
697
91
|
|
|
698
92
|
Possible solutions:
|
|
699
93
|
1. Check your internet connection
|
|
700
|
-
2. Try installing manually: cd ${
|
|
701
|
-
3. Use Poetry instead: npx rapidkit ${
|
|
702
|
-
`,"utf-8");}async function
|
|
94
|
+
2. Try installing manually: cd ${w.basename(e)} && .venv/bin/python -m pip install rapidkit-core
|
|
95
|
+
3. Use Poetry instead: npx rapidkit ${w.basename(e)} --install-method=poetry`))}}t.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:a$1}=await import('./pythonRapidkitExec-GFCAVUOY.js');if(!await a$1()&&!n){t.start("Installing RapidKit globally with pipx for CLI access");let d=await ye(t,i);try{await ee(d,["install","rapidkit-core"]),t.succeed("RapidKit installed globally");}catch(g){t.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),a.debug(`pipx install failed: ${g}`);}}}catch(a$1){a.debug(`Global install check skipped: ${a$1}`);}}async function at(e,o,t,n,r=false){let i=await ye(o,r);if(o.start("Installing RapidKit globally with pipx"),t){let s=ge(n||{});if(!s)throw new D("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a.debug(`Installing from local path: ${s}`),o.text="Installing RapidKit from local path (test mode)",await ee(i,["install","-e",s]);}else {o.text="Installing RapidKit from PyPI";try{await ee(i,["install","rapidkit-core"]);}catch{throw new Z}}o.succeed("RapidKit installed globally"),await k.outputFile(w.join(e,".rapidkit-global"),`RapidKit installed globally with pipx
|
|
96
|
+
`,"utf-8");}async function B(e,o){let{skipGit:t=false,testMode:n=false,userConfig:r={},yes:i=false,installMethod:s,pythonVersion:l="3.10"}=o||{},a=s||r.defaultInstallMethod||"poetry";await tt(e,w.basename(e),a),await ot(e);let c=Me("Registering workspace").start();try{a==="poetry"?await st(e,l,c,n,r,i):a==="venv"?await Ee(e,l,c,n,r):await at(e,c,n,r,i),await nt(e,a),await ct(e,a),c.succeed("Workspace registered");try{let{registerWorkspace:d}=await import('./workspace-LZZGJRGV.js');await d(e,w.basename(e));}catch{}if(!t){c.start("Initializing git repository");try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:e}),c.succeed("Git repository initialized");}catch{c.warn("Could not initialize git repository");}}}catch(d){throw c.fail("Failed to register workspace"),d}}async function ct(e,o){let r=`# RapidKit Workspace
|
|
703
97
|
|
|
704
98
|
This directory contains a RapidKit development environment.
|
|
705
99
|
|
|
@@ -810,7 +204,7 @@ If you encounter issues:
|
|
|
810
204
|
2. Check RapidKit installation: \`rapidkit --version\`
|
|
811
205
|
3. Run diagnostics: \`rapidkit doctor\`
|
|
812
206
|
4. Visit RapidKit documentation or GitHub issues
|
|
813
|
-
`;await promises.writeFile(
|
|
207
|
+
`;await promises.writeFile(w.join(e,"README.md"),r,"utf-8");}async function to(e,o,t){let n=Me("Creating demo workspace").start();try{await k.ensureDir(e),n.succeed("Directory created"),n.start("Setting up demo kit generator");let r=JSON.stringify({name:`${o}-workspace`,version:"1.0.0",private:true,description:"RapidKit demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(w.join(e,"package.json"),r,"utf-8"),await promises.writeFile(w.join(e,"generate-demo.js"),`#!/usr/bin/env node
|
|
814
208
|
/**
|
|
815
209
|
* Demo Kit Generator - Create FastAPI demo projects
|
|
816
210
|
*
|
|
@@ -1206,7 +600,7 @@ venv/
|
|
|
1206
600
|
}
|
|
1207
601
|
|
|
1208
602
|
main().catch(console.error);
|
|
1209
|
-
`,"utf-8");try{await execa("chmod",["+x",
|
|
603
|
+
`,"utf-8");try{await execa("chmod",["+x",w.join(e,"generate-demo.js")]);}catch{}let s=`# RapidKit Demo Workspace
|
|
1210
604
|
|
|
1211
605
|
Welcome to your RapidKit demo workspace! This environment lets you generate FastAPI demo projects using bundled RapidKit templates, without needing to install Python RapidKit.
|
|
1212
606
|
|
|
@@ -1293,7 +687,7 @@ ${o}/
|
|
|
1293
687
|
---
|
|
1294
688
|
|
|
1295
689
|
**Generated with RapidKit** | [GitHub](https://github.com/getrapidkit/rapidkit-npm)
|
|
1296
|
-
`;if(await promises.writeFile(
|
|
690
|
+
`;if(await promises.writeFile(w.join(e,"README.md"),s,"utf-8"),n.succeed("Demo workspace setup complete"),!t){n.start("Initializing git repository");try{await execa("git",["init"],{cwd:e}),await k.outputFile(w.join(e,".gitignore"),`# Dependencies
|
|
1297
691
|
node_modules/
|
|
1298
692
|
|
|
1299
693
|
# Generated projects
|
|
@@ -1306,19 +700,19 @@ __pycache__/
|
|
|
1306
700
|
*.pyc
|
|
1307
701
|
.venv/
|
|
1308
702
|
.env
|
|
1309
|
-
`,"utf-8"),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:e}),n.succeed("Git repository initialized");}catch{n.warn("Could not initialize git repository");}}console.log(
|
|
703
|
+
`,"utf-8"),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:e}),n.succeed("Git repository initialized");}catch{n.warn("Could not initialize git repository");}}console.log(u.green(`
|
|
1310
704
|
\u2728 Demo workspace created successfully!
|
|
1311
|
-
`)),console.log(
|
|
1312
|
-
`)),console.log(
|
|
705
|
+
`)),console.log(u.cyan("\u{1F4C2} Location:"),u.white(e)),console.log(u.cyan(`\u{1F680} Get started:
|
|
706
|
+
`)),console.log(u.white(` cd ${o}`)),console.log(u.white(" node generate-demo.js my-api")),console.log(u.white(" cd my-api")),console.log(u.white(" rapidkit init")),console.log(u.white(" rapidkit dev")),console.log(),console.log(u.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For full RapidKit features:"),console.log(u.cyan(" pipx install rapidkit")),console.log();}catch(r){throw n.fail("Failed to create demo workspace"),r}}async function oo(e,o,t,n){console.log(u.cyan(`
|
|
1313
707
|
\u{1F50D} Dry-run mode - showing what would be created:
|
|
1314
|
-
`)),console.log(
|
|
1315
|
-
\u{1F4DD} Files to create:`)),console.log(
|
|
1316
|
-
\u{1F3AF} Capabilities:`)),console.log(
|
|
1317
|
-
\u2699\uFE0F Configuration:`)),console.log(
|
|
1318
|
-
\u{1F4DD} Files to create:`)),console.log(
|
|
1319
|
-
\u{1F3AF} Next steps after creation:`)),console.log(
|
|
708
|
+
`)),console.log(u.white("\u{1F4C2} Project path:"),e),console.log(u.white("\u{1F4E6} Project type:"),t?"Demo workspace":"Full RapidKit environment"),t?(console.log(u.white(`
|
|
709
|
+
\u{1F4DD} Files to create:`)),console.log(u.gray(" - package.json")),console.log(u.gray(" - generate-demo.js (project generator)")),console.log(u.gray(" - README.md")),console.log(u.gray(" - .gitignore")),console.log(u.white(`
|
|
710
|
+
\u{1F3AF} Capabilities:`)),console.log(u.gray(" - Generate multiple FastAPI demo projects")),console.log(u.gray(" - No Python RapidKit installation required")),console.log(u.gray(" - Bundled templates included"))):(console.log(u.white(`
|
|
711
|
+
\u2699\uFE0F Configuration:`)),console.log(u.gray(` - Python version: ${n.pythonVersion||"3.10"}`)),console.log(u.gray(` - Install method: ${n.defaultInstallMethod||"poetry"}`)),console.log(u.gray(` - Git initialization: ${n.skipGit?"No":"Yes"}`)),console.log(u.white(`
|
|
712
|
+
\u{1F4DD} Files to create:`)),console.log(u.gray(" - pyproject.toml (Poetry) or .venv/ (venv)")),console.log(u.gray(" - README.md")),console.log(u.gray(" - .gitignore")),console.log(u.white(`
|
|
713
|
+
\u{1F3AF} Next steps after creation:`)),console.log(u.gray(" 1. Install RapidKit Python package")),console.log(u.gray(" 2. Create projects with rapidkit CLI")),console.log(u.gray(" 3. Add modules and customize"))),console.log(u.white(`
|
|
1320
714
|
\u{1F4A1} To proceed with actual creation, run without --dry-run flag
|
|
1321
|
-
`));}
|
|
715
|
+
`));}var so=fileURLToPath(import.meta.url),ao=w.dirname(so);function co(e=32){let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=ro.randomBytes(e),n="";for(let r=0;r<e;r++)n+=o[t[r]%o.length];return n}async function lt(e,o){let t=o.template||"fastapi",n=t==="fastapi",r=n?"FastAPI":"NestJS",i=Me(`Generating ${r} project...`).start();try{let s=w.resolve(ao,".."),l=o.kit_name||`${t}.standard`,a;l==="fastapi.ddd"?a="fastapi-ddd":l.startsWith("fastapi")?a="fastapi-standard":a="nestjs-standard";let c$1=w.join(s,"templates","kits",a),d=no.configure(c$1,{autoescape:false,trimBlocks:true,lstripBlocks:true});d.addFilter("generate_secret",function(v,C=32){return co(C)});let g={project_name:o.project_name,author:o.author||"RapidKit User",description:o.description||(n?"FastAPI service generated with RapidKit":"NestJS application generated with RapidKit"),app_version:o.app_version||"0.1.0",license:o.license||"MIT",package_manager:o.package_manager||"npm",node_version:o.node_version||"20.0.0",database_type:o.database_type||"postgresql",include_caching:o.include_caching||false,created_at:new Date().toISOString(),rapidkit_version:c()},p;n?p=["src/main.py.j2","src/__init__.py.j2","src/cli.py.j2","src/routing/__init__.py.j2","src/routing/health.py.j2","src/modules/__init__.py.j2","tests/__init__.py.j2","README.md.j2","pyproject.toml.j2","Makefile.j2",".rapidkit/__init__.py.j2",".rapidkit/project.json.j2",".rapidkit/cli.py.j2",".rapidkit/rapidkit.j2",".rapidkit/activate.j2","rapidkit.j2","rapidkit.cmd.j2"]:p=["src/main.ts.j2","src/app.module.ts.j2","src/app.controller.ts.j2","src/app.service.ts.j2","src/config/configuration.ts.j2","src/config/validation.ts.j2","src/config/index.ts.j2","src/modules/index.ts.j2","src/examples/examples.module.ts.j2","src/examples/examples.controller.ts.j2","src/examples/examples.service.ts.j2","src/examples/dto/create-note.dto.ts.j2","test/app.controller.spec.ts.j2","test/examples.controller.spec.ts.j2","test/app.e2e-spec.ts.j2","test/jest-e2e.json.j2","package.json.j2","tsconfig.json.j2","tsconfig.build.json.j2","nest-cli.json.j2","jest.config.ts.j2","eslint.config.cjs.j2",".env.example.j2","docker-compose.yml.j2","Dockerfile.j2","README.md.j2",".rapidkit/project.json.j2",".rapidkit/rapidkit.j2",".rapidkit/rapidkit.cmd.j2",".rapidkit/activate.j2","rapidkit.j2","rapidkit.cmd.j2"];for(let v of p){let C=w.join(c$1,v);try{await promises.access(C);}catch{continue}let _=await promises.readFile(C,"utf-8"),M;try{M=d.renderString(_,g);}catch(Gt){throw console.error(`Failed to render template: ${v}`),Gt}let U=v.replace(/\.j2$/,""),_e=w.join(e,U);await promises.mkdir(w.dirname(_e),{recursive:true}),await promises.writeFile(_e,M),(U.endsWith(".rapidkit/rapidkit")||U.endsWith(".rapidkit/cli.py")||U.endsWith(".rapidkit/activate")||U==="rapidkit")&&await promises.chmod(_e,493);}if(n){let v=w.join(c$1,".rapidkit","context.json"),C=w.join(e,".rapidkit","context.json");try{await promises.mkdir(w.join(e,".rapidkit"),{recursive:true}),await promises.copyFile(v,C);}catch{await promises.mkdir(w.join(e,".rapidkit"),{recursive:true});let M=o.engine||"pip";await promises.writeFile(C,JSON.stringify({engine:M,created_by:"rapidkit-npm-fallback"},null,2));}}let y=n?`# Python
|
|
1322
716
|
__pycache__/
|
|
1323
717
|
*.py[cod]
|
|
1324
718
|
*$py.class
|
|
@@ -1386,15 +780,15 @@ Thumbs.db
|
|
|
1386
780
|
|
|
1387
781
|
# Coverage
|
|
1388
782
|
coverage/
|
|
1389
|
-
`;if(await promises.writeFile(
|
|
1390
|
-
${
|
|
1391
|
-
${
|
|
1392
|
-
${
|
|
1393
|
-
${
|
|
783
|
+
`;if(await promises.writeFile(w.join(e,".gitignore"),y),i.succeed(`${r} project generated!`),!o.skipGit){let v=Me("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m",`Initial commit: ${r} project via RapidKit`],{cwd:e}),v.succeed("Git repository initialized");}catch{v.warn("Could not initialize git repository");}}if(!n&&!o.skipInstall){let v=o.package_manager||"npm",C=Me(`Installing dependencies with ${v}...`).start();try{await execa(v,v==="yarn"?["install"]:v==="pnpm"?["install"]:["install"],{cwd:e}),C.succeed("Dependencies installed");}catch{C.warn(`Could not install dependencies. Run '${v} install' manually.`);}}let P=w.basename(e);console.log(`
|
|
784
|
+
${u.yellow("\u26A0\uFE0F Limited offline mode:")} This project was created using basic templates.
|
|
785
|
+
${u.gray("For full kit features, install Python 3.10+ and rapidkit-core:")}
|
|
786
|
+
${u.cyan(" sudo apt install python3 python3-pip python3-venv")}
|
|
787
|
+
${u.cyan(" pip install rapidkit-core")}
|
|
1394
788
|
`),console.log(n?`
|
|
1395
|
-
${
|
|
789
|
+
${u.green("\u2728 FastAPI project created successfully!")}
|
|
1396
790
|
|
|
1397
|
-
${
|
|
791
|
+
${u.bold("\u{1F4C2} Project structure:")}
|
|
1398
792
|
${e}/
|
|
1399
793
|
\u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
|
|
1400
794
|
\u251C\u2500\u2500 src/
|
|
@@ -1406,12 +800,12 @@ ${e}/
|
|
|
1406
800
|
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
1407
801
|
\u2514\u2500\u2500 README.md
|
|
1408
802
|
|
|
1409
|
-
${
|
|
1410
|
-
${
|
|
1411
|
-
${
|
|
1412
|
-
${
|
|
803
|
+
${u.bold("\u{1F680} Get started:")}
|
|
804
|
+
${u.cyan(`cd ${P}`)}
|
|
805
|
+
${u.cyan("npx rapidkit init")} ${u.gray("# Install dependencies")}
|
|
806
|
+
${u.cyan("npx rapidkit dev")} ${u.gray("# Start dev server")}
|
|
1413
807
|
|
|
1414
|
-
${
|
|
808
|
+
${u.bold("\u{1F4DA} Available commands:")}
|
|
1415
809
|
npx rapidkit init # Install dependencies (poetry install)
|
|
1416
810
|
npx rapidkit dev # Start dev server with hot reload
|
|
1417
811
|
npx rapidkit start # Start production server
|
|
@@ -1419,12 +813,12 @@ ${m.bold("\u{1F4DA} Available commands:")}
|
|
|
1419
813
|
npx rapidkit lint # Lint code
|
|
1420
814
|
npx rapidkit format # Format code
|
|
1421
815
|
|
|
1422
|
-
${
|
|
1423
|
-
${
|
|
816
|
+
${u.gray("Alternative: make dev, ./rapidkit dev, poetry run dev")}
|
|
817
|
+
${u.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
|
|
1424
818
|
`:`
|
|
1425
|
-
${
|
|
819
|
+
${u.green("\u2728 NestJS project created successfully!")}
|
|
1426
820
|
|
|
1427
|
-
${
|
|
821
|
+
${u.bold("\u{1F4C2} Project structure:")}
|
|
1428
822
|
${e}/
|
|
1429
823
|
\u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
|
|
1430
824
|
\u251C\u2500\u2500 src/
|
|
@@ -1436,13 +830,13 @@ ${e}/
|
|
|
1436
830
|
\u251C\u2500\u2500 package.json # Dependencies
|
|
1437
831
|
\u2514\u2500\u2500 README.md
|
|
1438
832
|
|
|
1439
|
-
${
|
|
1440
|
-
${
|
|
1441
|
-
${
|
|
1442
|
-
${
|
|
1443
|
-
${
|
|
833
|
+
${u.bold("\u{1F680} Get started:")}
|
|
834
|
+
${u.cyan(`cd ${P}`)}
|
|
835
|
+
${u.cyan("npx rapidkit init")} ${u.gray("# Install dependencies")}
|
|
836
|
+
${u.cyan("cp .env.example .env")}
|
|
837
|
+
${u.cyan("npx rapidkit dev")} ${u.gray("# Start dev server")}
|
|
1444
838
|
|
|
1445
|
-
${
|
|
839
|
+
${u.bold("\u{1F4DA} Available commands:")}
|
|
1446
840
|
npx rapidkit init # Install dependencies
|
|
1447
841
|
npx rapidkit dev # Start dev server with hot reload
|
|
1448
842
|
npx rapidkit start # Start production server
|
|
@@ -1451,155 +845,155 @@ ${m.bold("\u{1F4DA} Available commands:")}
|
|
|
1451
845
|
npx rapidkit lint # Lint code
|
|
1452
846
|
npx rapidkit format # Format code
|
|
1453
847
|
|
|
1454
|
-
${
|
|
848
|
+
${u.bold("\u{1F310} API endpoints:")}
|
|
1455
849
|
http://localhost:8000/health # Health check
|
|
1456
850
|
http://localhost:8000/docs # Swagger docs
|
|
1457
851
|
http://localhost:8000/examples/notes # Example API
|
|
1458
852
|
|
|
1459
|
-
${
|
|
1460
|
-
${
|
|
1461
|
-
`);}catch(s){throw i.fail(`Failed to generate ${r} project`),s}}j();ce();async function po(){let e=process.platform==="win32"?["python","python3"]:["python3","python"];for(let o of e)try{let{stdout:t}=await execa(o,["--version"],{timeout:3e3}),n=t.match(/Python (\d+\.\d+\.\d+)/);if(n){let r=n[1],[i,s]=r.split(".").map(Number);return i<3||i===3&&s<10?{status:"warn",message:`Python ${r} (requires 3.10+)`,details:`${o} found but version is below minimum requirement`}:{status:"ok",message:`Python ${r}`,details:`Using ${o}`}}}catch{continue}return {status:"error",message:"Python not found",details:"Install Python 3.10+ and ensure it's in PATH"}}async function uo(){try{let{stdout:e}=await execa("poetry",["--version"],{timeout:3e3}),o=e.match(/Poetry .*version ([\d.]+)/);return o?{status:"ok",message:`Poetry ${o[1]}`,details:"Available for dependency management"}:{status:"warn",message:"Poetry version unknown"}}catch{return {status:"warn",message:"Poetry not installed",details:"Optional: Install for better dependency management"}}}async function mo(){try{let{stdout:e}=await execa("pipx",["--version"],{timeout:3e3});return {status:"ok",message:`pipx ${e.trim()}`,details:"Available for global tool installation"}}catch{return {status:"warn",message:"pipx not installed",details:"Optional: Install for isolated Python tools"}}}async function go(){let e=process.env.HOME||process.env.USERPROFILE||"",o=[],t=[{location:"Global (pipx)",path:v.join(e,".local","bin","rapidkit")},{location:"Global (pipx)",path:v.join(e,"AppData","Roaming","Python","Scripts","rapidkit.exe")},{location:"Global (pyenv)",path:v.join(e,".pyenv","shims","rapidkit")},{location:"Global (system)",path:"/usr/local/bin/rapidkit"},{location:"Global (system)",path:"/usr/bin/rapidkit"}],n=[{location:"Workspace (.venv)",path:v.join(process.cwd(),".venv","bin","rapidkit")},{location:"Workspace (.venv)",path:v.join(process.cwd(),".venv","Scripts","rapidkit.exe")}];for(let{location:i,path:s}of [...t,...n])try{if(await b__default.pathExists(s)){let{stdout:a,exitCode:c}=await execa(s,["--version"],{timeout:3e3,reject:!1});if(c===0&&(a.includes("RapidKit Version")||a.includes("RapidKit"))){let l=a.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);l&&o.push({location:i,path:s,version:l[1]});}}}catch{continue}if(o.length>0)return {status:"ok",message:`RapidKit Core ${o[0].version}`,paths:o.map(s=>({location:s.location,path:s.path,version:s.version}))};try{let{stdout:i,exitCode:s}=await execa("rapidkit",["--version"],{timeout:3e3,reject:!1});if(s===0&&(i.includes("RapidKit Version")||i.includes("RapidKit"))){let a=i.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(a)return {status:"ok",message:`RapidKit Core ${a[1]}`,details:"Available via PATH"}}}catch{}try{let{stdout:i,exitCode:s}=await execa("poetry",["run","rapidkit","--version"],{timeout:3e3,reject:!1});if(s===0&&(i.includes("RapidKit Version")||i.includes("RapidKit"))){let a=i.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(a)return {status:"ok",message:`RapidKit Core ${a[1]}`,details:"Available via Poetry"}}}catch{}let r=process.platform==="win32"?["python","python3"]:["python3","python"];for(let i of r)try{let{stdout:s,exitCode:a}=await execa(i,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:3e3,reject:!1});if(a===0&&s&&!s.includes("Traceback")&&!s.includes("ModuleNotFoundError")){let c=s.trim();if(c)return {status:"ok",message:`RapidKit Core ${c}`,details:`Available in ${i} environment`}}}catch{continue}return {status:"error",message:"RapidKit Core not installed",details:"Install with: pipx install rapidkit-core"}}async function yt(e,o){let t=v.join(e,"Dockerfile");o.hasDocker=await b__default.pathExists(t);let n=v.join(e,"tests"),r=v.join(e,"test");if(o.hasTests=await b__default.pathExists(n)||await b__default.pathExists(r),o.framework==="NestJS"){let i=v.join(e,".eslintrc.js"),s=v.join(e,".eslintrc.json");o.hasCodeQuality=await b__default.pathExists(i)||await b__default.pathExists(s);}else if(o.framework==="FastAPI"){let i=v.join(e,"ruff.toml"),s=v.join(e,"pyproject.toml");if(await b__default.pathExists(s))try{let a=await b__default.readFile(s,"utf8");o.hasCodeQuality=a.includes("[tool.ruff]")||await b__default.pathExists(i);}catch{o.hasCodeQuality=await b__default.pathExists(i);}}try{if(o.framework==="NestJS"){let{stdout:i}=await execa("npm",["audit","--json"],{cwd:e,reject:!1});if(i)try{let a=JSON.parse(i).metadata?.vulnerabilities;a&&(o.vulnerabilities=(a.high||0)+(a.critical||0)+(a.moderate||0));}catch{}}else if(o.framework==="FastAPI"){let i=v.join(e,".venv"),s=process.platform==="win32"?v.join(i,"Scripts","python.exe"):v.join(i,"bin","python");if(await b__default.pathExists(s))try{let{stdout:a}=await execa(s,["-m","pip","list","--format=json"],{timeout:5e3,reject:!1});if(a){let c=JSON.parse(a);o.vulnerabilities=0;}}catch{}}}catch{}}async function Wn(e){let t={name:v.basename(e),path:e,venvActive:false,depsInstalled:false,coreInstalled:false,issues:[],fixCommands:[]},n=v.join(e,".rapidkit");if(!await b__default.pathExists(n))return t.issues.push("Not a valid RapidKit project (missing .rapidkit directory)"),t;try{let c=v.join(e,"registry.json");if(await b__default.pathExists(c)){let l=await b__default.readJson(c);l.installed_modules&&(t.stats={modules:l.installed_modules.length});}}catch{}try{let c=v.join(n,"project.json");if(await b__default.pathExists(c)){let l=await b__default.readJson(c);l.kit&&(t.kit=l.kit);}}catch{}try{let c=v.join(e,".git");if(await b__default.pathExists(c)){let{stdout:l}=await execa("git",["log","-1","--format=%cr"],{cwd:e,reject:!1});l&&(t.lastModified=l.trim());}else {let l=await b__default.stat(e),p=Date.now()-l.mtime.getTime(),u=Math.floor(p/(1e3*60*60*24));t.lastModified=u===0?"today":`${u} day${u>1?"s":""} ago`;}}catch{}let r=v.join(e,"package.json"),i=v.join(e,"pyproject.toml"),s=await b__default.pathExists(r),a=await b__default.pathExists(i);if(s){t.framework="NestJS",t.venvActive=true;let c=v.join(e,"node_modules");if(await b__default.pathExists(c))try{let u=(await b__default.readdir(c)).filter(g=>!g.startsWith(".")&&!g.startsWith("_"));t.depsInstalled=u.length>0;}catch{t.depsInstalled=false;}t.depsInstalled||(t.issues.push("Dependencies not installed (node_modules empty or missing)"),t.fixCommands?.push(`cd ${e} && rapidkit init`)),t.coreInstalled=false;let l=v.join(e,".env");if(t.hasEnvFile=await b__default.pathExists(l),!t.hasEnvFile){let p=v.join(e,".env.example");await b__default.pathExists(p)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(`cd ${e} && cp .env.example .env`));}let d=v.join(e,"src");if(t.modulesHealthy=true,t.missingModules=[],await b__default.pathExists(d))try{let p=await b__default.readdir(d);t.modulesHealthy=p.length>0;}catch{t.modulesHealthy=false;}return await yt(e,t),t}if(a){t.framework="FastAPI";let c=v.join(e,".venv");if(await b__default.pathExists(c)){t.venvActive=true;let u=process.platform==="win32"?v.join(c,"Scripts","python.exe"):v.join(c,"bin","python");if(await b__default.pathExists(u)){try{let{stdout:g}=await execa(u,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:2e3});t.coreInstalled=!0,t.coreVersion=g.trim();}catch{t.coreInstalled=false;}try{await execa(u,["-c","import fastapi"],{timeout:2e3}),t.depsInstalled=!0;}catch{try{let g=v.join(c,"lib");if(await b__default.pathExists(g)){let h=(await b__default.readdir(g)).find(x=>x.startsWith("python"));if(h){let x=v.join(g,h,"site-packages");if(await b__default.pathExists(x)){let F=(await b__default.readdir(x)).filter(V=>!V.startsWith("_")&&!V.includes("dist-info")&&!["pip","setuptools","wheel","pkg_resources"].includes(V));t.depsInstalled=F.length>0;}}}t.depsInstalled||(t.issues.push("Dependencies not installed"),t.fixCommands?.push(`cd ${e} && rapidkit init`));}catch{t.issues.push("Could not verify dependency installation");}}}else t.issues.push("Virtual environment exists but Python executable not found");}else t.issues.push("Virtual environment not created"),t.fixCommands?.push(`cd ${e} && rapidkit init`);let l=v.join(e,".env");if(t.hasEnvFile=await b__default.pathExists(l),!t.hasEnvFile){let u=v.join(e,".env.example");await b__default.pathExists(u)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(`cd ${e} && cp .env.example .env`));}let d=v.join(e,"src"),p=v.join(e,"modules");if(t.modulesHealthy=true,t.missingModules=[],await b__default.pathExists(d)){let u=v.join(d,"__init__.py");await b__default.pathExists(u)||(t.modulesHealthy=false,t.missingModules.push("src/__init__.py"));}if(await b__default.pathExists(p))try{let u=await fo(p);for(let g of u){let w=v.join(p,g,"__init__.py");await b__default.pathExists(w)||(t.modulesHealthy=!1,t.missingModules.push(`modules/${g}/__init__.py`));}}catch{}return !t.modulesHealthy&&t.missingModules.length>0&&t.issues.push(`Missing module init files: ${t.missingModules.join(", ")}`),await yt(e,t),t}return t.issues.push("Unknown project type (no package.json or pyproject.toml)"),await yt(e,t),t}async function fo(e){try{return (await b__default.readdir(e,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name)}catch{try{let o=await b__default.readdir(e),t=[];for(let n of o)try{(await b__default.stat(v.join(e,n))).isDirectory()&&t.push(n);}catch{continue}return t}catch{return []}}}async function Vn(e,o,t){let n=new Set,r=[{dir:e,depth:0}];for(;r.length>0;){let i=r.shift();if(!i)break;try{let s=await b__default.readdir(i.dir);for(let a of s){if(t.has(a))continue;let c=v.join(i.dir,a),l;try{l=await b__default.stat(c);}catch{continue}if(!l.isDirectory())continue;let d=v.join(c,".rapidkit");if(await b__default.pathExists(d)){n.add(c);continue}i.depth<o&&r.push({dir:c,depth:i.depth+1});}}catch{continue}}return Array.from(n)}async function Un(e){let o=e,t=v.parse(o).root;for(;o!==t;){let n=[v.join(o,".rapidkit-workspace"),v.join(o,".rapidkit","workspace-marker.json"),v.join(o,".rapidkit","config.json")];for(let r of n)if(await b__default.pathExists(r))return o;o=v.dirname(o);}return null}function Bn(e,o){let t=0,n=0,r=0;return e.forEach(s=>{s.status==="ok"?t++:s.status==="warn"?n++:s.status==="error"&&r++;}),o.forEach(s=>{s.issues.length===0&&s.venvActive&&s.depsInstalled?t++:s.issues.length>0&&n++;}),{total:t+n+r,passed:t,warnings:n,errors:r}}async function Hn(e){let o=v.basename(e);try{let r=v.join(e,".rapidkit-workspace");await b__default.pathExists(r)&&(o=(await b__default.readJSON(r)).name||o);}catch{try{let r=v.join(e,".rapidkit","config.json");o=(await b__default.readJSON(r)).workspace_name||o;}catch{}}let t={workspacePath:e,workspaceName:o,python:await po(),poetry:await uo(),pipx:await mo(),rapidkitCore:await go(),projects:[]};try{let r=new Set([".git",".venv","node_modules",".rapidkit","dist","build","coverage","__pycache__"]),i=new Set,s=v.join(e,".rapidkit");await b__default.pathExists(s)&&i.add(e);let a=async(c,l)=>{if(l<0)return;let d=await fo(c);for(let p of d){if(r.has(p))continue;let u=v.join(c,p),g=v.join(u,".rapidkit");if(await b__default.pathExists(g)){i.add(u);continue}l>0&&await a(u,l-1);}};if(await a(e,1),y.debug(`Workspace scan (shallow) found ${i.size} project(s)`),i.size===0){let c=await Vn(e,3,r);c.forEach(l=>i.add(l)),y.debug(`Workspace scan (deep fallback) found ${c.length} project(s)`);}i.size>0&&y.debug(`Workspace projects detected: ${Array.from(i).join(", ")}`);for(let c of i){let l=await Wn(c);t.projects.push(l);}}catch(r){y.debug(`Failed to scan workspace projects: ${r}`);}let n=[t.python,t.poetry,t.pipx,t.rapidkitCore];if(t.healthScore=Bn(n,t.projects),t.rapidkitCore.status==="ok"){let r=t.rapidkitCore.message.match(/([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);r&&(t.coreVersion=r[1]);}return t}function ie(e,o){let t=e.status==="ok"?"\u2705":e.status==="warn"?"\u26A0\uFE0F":"\u274C",n=e.status==="ok"?m.green:e.status==="warn"?m.yellow:m.red;console.log(`${t} ${m.bold(o)}: ${n(e.message)}`),e.paths&&e.paths.length>0?e.paths.forEach(r=>{let i=r.version?m.cyan(` -> ${r.version}`):"";console.log(` ${m.cyan("\u2022")} ${m.gray(r.location)}: ${m.dim(r.path)}${i}`);}):e.details&&console.log(` ${m.gray(e.details)}`);}function Jn(e){let o=e.issues.length>0,t=o?"\u26A0\uFE0F":"\u2705",n=o?m.yellow:m.green;if(console.log(`
|
|
1462
|
-
${t} ${
|
|
1463
|
-
${
|
|
1464
|
-
\u2705 No fixes needed - all projects are healthy!`));return}console.log(
|
|
853
|
+
${u.gray("Alternative: npm run start:dev, ./rapidkit dev")}
|
|
854
|
+
${u.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
|
|
855
|
+
`);}catch(s){throw i.fail(`Failed to generate ${r} project`),s}}async function pt(){let e=process.platform==="win32"?["python","python3"]:["python3","python"];for(let o of e)try{let{stdout:t}=await execa(o,["--version"],{timeout:3e3}),n=t.match(/Python (\d+\.\d+\.\d+)/);if(n){let r=n[1],[i,s]=r.split(".").map(Number);return i<3||i===3&&s<10?{status:"warn",message:`Python ${r} (requires 3.10+)`,details:`${o} found but version is below minimum requirement`}:{status:"ok",message:`Python ${r}`,details:`Using ${o}`}}}catch{continue}return {status:"error",message:"Python not found",details:"Install Python 3.10+ and ensure it's in PATH"}}async function ut(){try{let{stdout:e}=await execa("poetry",["--version"],{timeout:3e3}),o=e.match(/Poetry .*version ([\d.]+)/);return o?{status:"ok",message:`Poetry ${o[1]}`,details:"Available for dependency management"}:{status:"warn",message:"Poetry version unknown"}}catch{return {status:"warn",message:"Poetry not installed",details:"Optional: Install for better dependency management"}}}async function mt(){try{let{stdout:e}=await execa("pipx",["--version"],{timeout:3e3});return {status:"ok",message:`pipx ${e.trim()}`,details:"Available for global tool installation"}}catch{return {status:"warn",message:"pipx not installed",details:"Optional: Install for isolated Python tools"}}}async function gt(){let e=process.env.HOME||process.env.USERPROFILE||"",o=[],t=[{location:"Global (pipx)",path:w.join(e,".local","bin","rapidkit")},{location:"Global (pipx)",path:w.join(e,"AppData","Roaming","Python","Scripts","rapidkit.exe")},{location:"Global (pyenv)",path:w.join(e,".pyenv","shims","rapidkit")},{location:"Global (system)",path:"/usr/local/bin/rapidkit"},{location:"Global (system)",path:"/usr/bin/rapidkit"}],n=[{location:"Workspace (.venv)",path:w.join(process.cwd(),".venv","bin","rapidkit")},{location:"Workspace (.venv)",path:w.join(process.cwd(),".venv","Scripts","rapidkit.exe")}];for(let{location:i,path:s}of [...t,...n])try{if(await k__default.pathExists(s)){let{stdout:l,exitCode:a}=await execa(s,["--version"],{timeout:3e3,reject:false});if(a===0&&(l.includes("RapidKit Version")||l.includes("RapidKit"))){let c=l.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);c&&o.push({location:i,path:s,version:c[1]});}}}catch{continue}if(o.length>0)return {status:"ok",message:`RapidKit Core ${o[0].version}`,paths:o.map(s=>({location:s.location,path:s.path,version:s.version}))};try{let{stdout:i,exitCode:s}=await execa("rapidkit",["--version"],{timeout:3e3,reject:false});if(s===0&&(i.includes("RapidKit Version")||i.includes("RapidKit"))){let l=i.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(l)return {status:"ok",message:`RapidKit Core ${l[1]}`,details:"Available via PATH"}}}catch{}try{let{stdout:i,exitCode:s}=await execa("poetry",["run","rapidkit","--version"],{timeout:3e3,reject:false});if(s===0&&(i.includes("RapidKit Version")||i.includes("RapidKit"))){let l=i.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(l)return {status:"ok",message:`RapidKit Core ${l[1]}`,details:"Available via Poetry"}}}catch{}let r=process.platform==="win32"?["python","python3"]:["python3","python"];for(let i of r)try{let{stdout:s,exitCode:l}=await execa(i,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:3e3,reject:false});if(l===0&&s&&!s.includes("Traceback")&&!s.includes("ModuleNotFoundError")){let a=s.trim();if(a)return {status:"ok",message:`RapidKit Core ${a}`,details:`Available in ${i} environment`}}}catch{continue}return {status:"error",message:"RapidKit Core not installed",details:"Install with: pipx install rapidkit-core"}}async function Ke(e,o){let t=w.join(e,"Dockerfile");o.hasDocker=await k__default.pathExists(t);let n=w.join(e,"tests"),r=w.join(e,"test");if(o.hasTests=await k__default.pathExists(n)||await k__default.pathExists(r),o.framework==="NestJS"){let i=w.join(e,".eslintrc.js"),s=w.join(e,".eslintrc.json");o.hasCodeQuality=await k__default.pathExists(i)||await k__default.pathExists(s);}else if(o.framework==="FastAPI"){let i=w.join(e,"ruff.toml"),s=w.join(e,"pyproject.toml");if(await k__default.pathExists(s))try{let l=await k__default.readFile(s,"utf8");o.hasCodeQuality=l.includes("[tool.ruff]")||await k__default.pathExists(i);}catch{o.hasCodeQuality=await k__default.pathExists(i);}}try{if(o.framework==="NestJS"){let{stdout:i}=await execa("npm",["audit","--json"],{cwd:e,reject:false});if(i)try{let l=JSON.parse(i).metadata?.vulnerabilities;l&&(o.vulnerabilities=(l.high||0)+(l.critical||0)+(l.moderate||0));}catch{}}else if(o.framework==="FastAPI"){let i=w.join(e,".venv"),s=process.platform==="win32"?w.join(i,"Scripts","python.exe"):w.join(i,"bin","python");if(await k__default.pathExists(s))try{let{stdout:l}=await execa(s,["-m","pip","list","--format=json"],{timeout:5e3,reject:false});if(l){JSON.parse(l);o.vulnerabilities=0;}}catch{}}}catch{}}async function po(e){let t={name:w.basename(e),path:e,venvActive:false,depsInstalled:false,coreInstalled:false,issues:[],fixCommands:[]},n=w.join(e,".rapidkit");if(!await k__default.pathExists(n))return t.issues.push("Not a valid RapidKit project (missing .rapidkit directory)"),t;try{let a=w.join(e,"registry.json");if(await k__default.pathExists(a)){let c=await k__default.readJson(a);c.installed_modules&&(t.stats={modules:c.installed_modules.length});}}catch{}try{let a=w.join(n,"project.json");if(await k__default.pathExists(a)){let c=await k__default.readJson(a);c.kit&&(t.kit=c.kit);}}catch{}try{let a=w.join(e,".git");if(await k__default.pathExists(a)){let{stdout:c}=await execa("git",["log","-1","--format=%cr"],{cwd:e,reject:false});c&&(t.lastModified=c.trim());}else {let c=await k__default.stat(e),g=Date.now()-c.mtime.getTime(),p=Math.floor(g/(1e3*60*60*24));t.lastModified=p===0?"today":`${p} day${p>1?"s":""} ago`;}}catch{}let r=w.join(e,"package.json"),i=w.join(e,"pyproject.toml"),s=await k__default.pathExists(r),l=await k__default.pathExists(i);if(s){t.framework="NestJS",t.venvActive=true;let a=w.join(e,"node_modules");if(await k__default.pathExists(a))try{let p=(await k__default.readdir(a)).filter(y=>!y.startsWith(".")&&!y.startsWith("_"));t.depsInstalled=p.length>0;}catch{t.depsInstalled=false;}t.depsInstalled||(t.issues.push("Dependencies not installed (node_modules empty or missing)"),t.fixCommands?.push(`cd ${e} && rapidkit init`)),t.coreInstalled=false;let c=w.join(e,".env");if(t.hasEnvFile=await k__default.pathExists(c),!t.hasEnvFile){let g=w.join(e,".env.example");await k__default.pathExists(g)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(`cd ${e} && cp .env.example .env`));}let d=w.join(e,"src");if(t.modulesHealthy=true,t.missingModules=[],await k__default.pathExists(d))try{let g=await k__default.readdir(d);t.modulesHealthy=g.length>0;}catch{t.modulesHealthy=false;}return await Ke(e,t),t}if(l){t.framework="FastAPI";let a=w.join(e,".venv");if(await k__default.pathExists(a)){t.venvActive=true;let p=process.platform==="win32"?w.join(a,"Scripts","python.exe"):w.join(a,"bin","python");if(await k__default.pathExists(p)){try{let{stdout:y}=await execa(p,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:2e3});t.coreInstalled=true,t.coreVersion=y.trim();}catch{t.coreInstalled=false;}try{await execa(p,["-c","import fastapi"],{timeout:2e3}),t.depsInstalled=true;}catch{try{let y=w.join(a,"lib");if(await k__default.pathExists(y)){let v=(await k__default.readdir(y)).find(C=>C.startsWith("python"));if(v){let C=w.join(y,v,"site-packages");if(await k__default.pathExists(C)){let M=(await k__default.readdir(C)).filter(U=>!U.startsWith("_")&&!U.includes("dist-info")&&!["pip","setuptools","wheel","pkg_resources"].includes(U));t.depsInstalled=M.length>0;}}}t.depsInstalled||(t.issues.push("Dependencies not installed"),t.fixCommands?.push(`cd ${e} && rapidkit init`));}catch{t.issues.push("Could not verify dependency installation");}}}else t.issues.push("Virtual environment exists but Python executable not found");}else t.issues.push("Virtual environment not created"),t.fixCommands?.push(`cd ${e} && rapidkit init`);let c=w.join(e,".env");if(t.hasEnvFile=await k__default.pathExists(c),!t.hasEnvFile){let p=w.join(e,".env.example");await k__default.pathExists(p)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(`cd ${e} && cp .env.example .env`));}let d=w.join(e,"src"),g=w.join(e,"modules");if(t.modulesHealthy=true,t.missingModules=[],await k__default.pathExists(d)){let p=w.join(d,"__init__.py");await k__default.pathExists(p)||(t.modulesHealthy=false,t.missingModules.push("src/__init__.py"));}if(await k__default.pathExists(g))try{let p=await ft(g);for(let y of p){let P=w.join(g,y,"__init__.py");await k__default.pathExists(P)||(t.modulesHealthy=false,t.missingModules.push(`modules/${y}/__init__.py`));}}catch{}return !t.modulesHealthy&&t.missingModules.length>0&&t.issues.push(`Missing module init files: ${t.missingModules.join(", ")}`),await Ke(e,t),t}return t.issues.push("Unknown project type (no package.json or pyproject.toml)"),await Ke(e,t),t}async function ft(e){try{return (await k__default.readdir(e,{withFileTypes:true})).filter(t=>t.isDirectory()).map(t=>t.name)}catch{try{let o=await k__default.readdir(e),t=[];for(let n of o)try{(await k__default.stat(w.join(e,n))).isDirectory()&&t.push(n);}catch{continue}return t}catch{return []}}}async function uo(e,o,t){let n=new Set,r=[{dir:e,depth:0}];for(;r.length>0;){let i=r.shift();if(!i)break;try{let s=await k__default.readdir(i.dir);for(let l of s){if(t.has(l))continue;let a=w.join(i.dir,l),c;try{c=await k__default.stat(a);}catch{continue}if(!c.isDirectory())continue;let d=w.join(a,".rapidkit");if(await k__default.pathExists(d)){n.add(a);continue}i.depth<o&&r.push({dir:a,depth:i.depth+1});}}catch{continue}}return Array.from(n)}async function mo(e){let o=e,t=w.parse(o).root;for(;o!==t;){let n=[w.join(o,".rapidkit-workspace"),w.join(o,".rapidkit","workspace-marker.json"),w.join(o,".rapidkit","config.json")];for(let r of n)if(await k__default.pathExists(r))return o;o=w.dirname(o);}return null}function go(e,o){let t=0,n=0,r=0;return e.forEach(s=>{s.status==="ok"?t++:s.status==="warn"?n++:s.status==="error"&&r++;}),o.forEach(s=>{s.issues.length===0&&s.venvActive&&s.depsInstalled?t++:s.issues.length>0&&n++;}),{total:t+n+r,passed:t,warnings:n,errors:r}}async function fo(e){let o=w.basename(e);try{let r=w.join(e,".rapidkit-workspace");await k__default.pathExists(r)&&(o=(await k__default.readJSON(r)).name||o);}catch{try{let r=w.join(e,".rapidkit","config.json");o=(await k__default.readJSON(r)).workspace_name||o;}catch{}}let t={workspacePath:e,workspaceName:o,python:await pt(),poetry:await ut(),pipx:await mt(),rapidkitCore:await gt(),projects:[]};try{let r=new Set([".git",".venv","node_modules",".rapidkit","dist","build","coverage","__pycache__"]),i=new Set,s=w.join(e,".rapidkit");await k__default.pathExists(s)&&i.add(e);let l=async(a,c)=>{if(c<0)return;let d=await ft(a);for(let g of d){if(r.has(g))continue;let p=w.join(a,g),y=w.join(p,".rapidkit");if(await k__default.pathExists(y)){i.add(p);continue}c>0&&await l(p,c-1);}};if(await l(e,1),a.debug(`Workspace scan (shallow) found ${i.size} project(s)`),i.size===0){let a$1=await uo(e,3,r);a$1.forEach(c=>i.add(c)),a.debug(`Workspace scan (deep fallback) found ${a$1.length} project(s)`);}i.size>0&&a.debug(`Workspace projects detected: ${Array.from(i).join(", ")}`);for(let a of i){let c=await po(a);t.projects.push(c);}}catch(r){a.debug(`Failed to scan workspace projects: ${r}`);}let n=[t.python,t.poetry,t.pipx,t.rapidkitCore];if(t.healthScore=go(n,t.projects),t.rapidkitCore.status==="ok"){let r=t.rapidkitCore.message.match(/([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);r&&(t.coreVersion=r[1]);}return t}function q(e,o){let t=e.status==="ok"?"\u2705":e.status==="warn"?"\u26A0\uFE0F":"\u274C",n=e.status==="ok"?u.green:e.status==="warn"?u.yellow:u.red;console.log(`${t} ${u.bold(o)}: ${n(e.message)}`),e.paths&&e.paths.length>0?e.paths.forEach(r=>{let i=r.version?u.cyan(` -> ${r.version}`):"";console.log(` ${u.cyan("\u2022")} ${u.gray(r.location)}: ${u.dim(r.path)}${i}`);}):e.details&&console.log(` ${u.gray(e.details)}`);}function ho(e){let o=e.issues.length>0,t=o?"\u26A0\uFE0F":"\u2705",n=o?u.yellow:u.green;if(console.log(`
|
|
856
|
+
${t} ${u.bold("Project")}: ${n(e.name)}`),e.framework){let l=e.framework==="FastAPI"?"\u{1F40D}":e.framework==="NestJS"?"\u{1F985}":"\u{1F4E6}";console.log(` ${l} Framework: ${u.cyan(e.framework)}${e.kit?u.gray(` (${e.kit})`):""}`);}if(console.log(` ${u.gray(`Path: ${e.path}`)}`),!(e.venvActive&&!e.coreInstalled)&&(e.venvActive?console.log(` \u2705 Virtual environment: ${u.green("Active")}`):console.log(` \u274C Virtual environment: ${u.red("Not found")}`),e.coreInstalled?console.log(` ${u.dim("\u2139")} RapidKit Core: ${u.gray(e.coreVersion||"In venv")} ${u.dim("(optional)")}`):console.log(` ${u.dim("\u2139")} RapidKit Core: ${u.gray("Using global installation")} ${u.dim("(recommended)")}`)),e.depsInstalled?console.log(` \u2705 Dependencies: ${u.green("Installed")}`):console.log(` \u26A0\uFE0F Dependencies: ${u.yellow("Not installed")}`),e.hasEnvFile!==void 0&&(e.hasEnvFile?console.log(` \u2705 Environment: ${u.green(".env configured")}`):console.log(` \u26A0\uFE0F Environment: ${u.yellow(".env missing")}`)),e.modulesHealthy!==void 0&&(e.modulesHealthy?console.log(` \u2705 Modules: ${u.green("Healthy")}`):e.missingModules&&e.missingModules.length>0&&console.log(` \u26A0\uFE0F Modules: ${u.yellow(`Missing ${e.missingModules.length} init file(s)`)}`)),e.stats){let l=[];e.stats.modules!==void 0&&l.push(`${e.stats.modules} module${e.stats.modules!==1?"s":""}`),l.length>0&&console.log(` \u{1F4CA} Stats: ${u.cyan(l.join(" \u2022 "))}`);}e.lastModified&&console.log(` \u{1F552} Last Modified: ${u.gray(e.lastModified)}`);let s=[];if(e.hasTests!==void 0&&s.push(e.hasTests?"\u2705 Tests":u.dim("\u2298 No tests")),e.hasDocker!==void 0&&s.push(e.hasDocker?"\u2705 Docker":u.dim("\u2298 No Docker")),e.hasCodeQuality!==void 0){let l=e.framework==="NestJS"?"ESLint":"Ruff";s.push(e.hasCodeQuality?`\u2705 ${l}`:u.dim(`\u2298 No ${l}`));}s.length>0&&console.log(` ${s.join(" \u2022 ")}`),e.vulnerabilities!==void 0&&e.vulnerabilities>0&&console.log(` \u26A0\uFE0F Security: ${u.yellow(`${e.vulnerabilities} vulnerability(ies) found`)}`),e.issues.length>0&&(console.log(` ${u.bold("Issues:")}`),e.issues.forEach(l=>{console.log(` \u2022 ${u.yellow(l)}`);}),e.fixCommands&&e.fixCommands.length>0&&(console.log(`
|
|
857
|
+
${u.bold.cyan("\u{1F527} Quick Fix:")}`),e.fixCommands.forEach(l=>{console.log(` ${u.cyan("$")} ${u.white(l)}`);})));}async function dt(e,o=false){let t=e.filter(r=>r.fixCommands&&r.fixCommands.length>0);if(t.length===0){console.log(u.green(`
|
|
858
|
+
\u2705 No fixes needed - all projects are healthy!`));return}console.log(u.bold.cyan(`
|
|
1465
859
|
\u{1F527} Available Fixes:
|
|
1466
|
-
`));for(let r of t)console.log(
|
|
1467
|
-
\u26A0\uFE0F Fixes cancelled by user`));return}console.log(
|
|
860
|
+
`));for(let r of t)console.log(u.bold(`Project: ${u.yellow(r.name)}`)),r.fixCommands.forEach((i,s)=>{console.log(` ${s+1}. ${u.cyan(i)}`);}),console.log();if(!o){console.log(u.gray("\u{1F4A1} Run with --fix flag to apply fixes automatically"));return}let{confirm:n}=await Se.prompt([{type:"confirm",name:"confirm",message:`Apply ${t.reduce((r,i)=>r+i.fixCommands.length,0)} fix(es)?`,default:false}]);if(!n){console.log(u.yellow(`
|
|
861
|
+
\u26A0\uFE0F Fixes cancelled by user`));return}console.log(u.bold.cyan(`
|
|
1468
862
|
\u{1F680} Applying fixes...
|
|
1469
|
-
`));for(let r of t){console.log(
|
|
1470
|
-
`));}catch(s){console.log(
|
|
1471
|
-
`));}}console.log(
|
|
1472
|
-
\u2705 Fix process completed!`));}async function
|
|
863
|
+
`));for(let r of t){console.log(u.bold(`Fixing ${u.cyan(r.name)}...`));for(let i of r.fixCommands)try{console.log(u.gray(` $ ${i}`)),await execa(i,{shell:true,stdio:"inherit"}),console.log(u.green(` \u2705 Success
|
|
864
|
+
`));}catch(s){console.log(u.red(` \u274C Failed: ${s instanceof Error?s.message:String(s)}
|
|
865
|
+
`));}}console.log(u.bold.green(`
|
|
866
|
+
\u2705 Fix process completed!`));}async function ht(e={}){if(e.json||console.log(u.bold.cyan(`
|
|
1473
867
|
\u{1FA7A} RapidKit Health Check
|
|
1474
|
-
`)),e.workspace){let o=await
|
|
1475
|
-
\u{1F4CA} Health Score:`)),console.log(` ${
|
|
868
|
+
`)),e.workspace){let o=await mo(process.cwd());o||(a.error("No RapidKit workspace found in current directory or parents"),a.info('Run this command from within a workspace, or use "rapidkit doctor" for system check'),process.exit(1)),e.json||(console.log(u.bold(`Workspace: ${u.cyan(w.basename(o))}`)),console.log(u.gray(`Path: ${o}`)));let t=await fo(o);if(e.json){let i={workspace:{name:w.basename(o),path:o},healthScore:t.healthScore,system:{python:t.python,poetry:t.poetry,pipx:t.pipx,rapidkitCore:t.rapidkitCore,versions:{core:t.coreVersion,npm:t.npmVersion}},projects:t.projects.map(s=>({name:s.name,path:s.path,venvActive:s.venvActive,depsInstalled:s.depsInstalled,coreInstalled:s.coreInstalled,coreVersion:s.coreVersion,issues:s.issues,fixCommands:s.fixCommands})),summary:{totalProjects:t.projects.length,totalIssues:t.projects.reduce((s,l)=>s+l.issues.length,0),hasSystemErrors:[t.python,t.rapidkitCore].some(s=>s.status==="error")}};console.log(JSON.stringify(i,null,2));return}if(t.healthScore){let i=t.healthScore,s=Math.round(i.passed/i.total*100),l=s>=80?u.green:s>=50?u.yellow:u.red,a="\u2588".repeat(Math.floor(s/5))+"\u2591".repeat(20-Math.floor(s/5));console.log(u.bold(`
|
|
869
|
+
\u{1F4CA} Health Score:`)),console.log(` ${l(`${s}%`)} ${u.gray(a)}`),console.log(` ${u.green(`\u2705 ${i.passed} passed`)} ${u.gray("|")} ${u.yellow(`\u26A0\uFE0F ${i.warnings} warnings`)} ${u.gray("|")} ${u.red(`\u274C ${i.errors} errors`)}`);}if(console.log(u.bold(`
|
|
1476
870
|
|
|
1477
871
|
System Tools:
|
|
1478
|
-
`)),
|
|
1479
|
-
\u26A0\uFE0F Version mismatch: Core ${t.coreVersion} / CLI ${t.npmVersion}`)),console.log(
|
|
1480
|
-
\u{1F4E6} Projects (${t.projects.length}):`)),t.projects.forEach(i=>
|
|
1481
|
-
\u{1F4E6} Projects:`)),console.log(
|
|
1482
|
-
\u26A0\uFE0F Found ${n} project issue(s)`)),r&&console.log(
|
|
1483
|
-
\u2705 All checks passed! Workspace is healthy.`));}else {console.log(
|
|
1484
|
-
`));let o=await
|
|
1485
|
-
\u274C Some required tools are missing`)),console.log(
|
|
1486
|
-
Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`))):(console.log(
|
|
1487
|
-
\u2705 All required tools are installed!`)),console.log(
|
|
1488
|
-
Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`)));}console.log("");}
|
|
872
|
+
`)),q(t.python,"Python"),q(t.poetry,"Poetry"),q(t.pipx,"pipx"),q(t.rapidkitCore,"RapidKit Core"),t.coreVersion&&t.npmVersion){let i=t.coreVersion.split(".")[1],s=t.npmVersion.split(".")[1];i!==s&&(console.log(u.yellow(`
|
|
873
|
+
\u26A0\uFE0F Version mismatch: Core ${t.coreVersion} / CLI ${t.npmVersion}`)),console.log(u.gray(" Consider updating to matching versions for best compatibility")));}t.projects.length>0?(console.log(u.bold(`
|
|
874
|
+
\u{1F4E6} Projects (${t.projects.length}):`)),t.projects.forEach(i=>ho(i))):(console.log(u.bold(`
|
|
875
|
+
\u{1F4E6} Projects:`)),console.log(u.gray(" No RapidKit projects found in workspace")));let n=t.projects.reduce((i,s)=>i+s.issues.length,0),r=[t.python,t.rapidkitCore].some(i=>i.status==="error");r||n>0?(console.log(u.bold.yellow(`
|
|
876
|
+
\u26A0\uFE0F Found ${n} project issue(s)`)),r&&console.log(u.bold.red("\u274C System requirements not met")),e.fix?await dt(t.projects,true):n>0&&await dt(t.projects,false)):console.log(u.bold.green(`
|
|
877
|
+
\u2705 All checks passed! Workspace is healthy.`));}else {console.log(u.bold(`System Tools:
|
|
878
|
+
`));let o=await pt(),t=await ut(),n=await mt(),r=await gt();q(o,"Python"),q(t,"Poetry"),q(n,"pipx"),q(r,"RapidKit Core"),[o,r].some(s=>s.status==="error")?(console.log(u.bold.red(`
|
|
879
|
+
\u274C Some required tools are missing`)),console.log(u.gray(`
|
|
880
|
+
Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`))):(console.log(u.bold.green(`
|
|
881
|
+
\u2705 All required tools are installed!`)),console.log(u.gray(`
|
|
882
|
+
Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`)));}console.log("");}var Fe=w.join(Wt__default.homedir(),".rapidkit"),ke=w.join(Fe,"config.json");function te(){try{if(!S.existsSync(ke))return {};let e=S.readFileSync(ke,"utf-8");return JSON.parse(e)}catch{return {}}}function ve(e){let t={...te(),...e};S.existsSync(Fe)||S.mkdirSync(Fe,{recursive:true}),S.writeFileSync(ke,JSON.stringify(t,null,2),"utf-8");}function le(){return process.env.OPENAI_API_KEY||te().openaiApiKey||null}function Oe(){return te().aiEnabled!==false}function Te(){return ke}async function wt(){return (await import('inquirer')).default}function kt(e){let o=e.command("config").description("Configure RapidKit settings");o.command("set-api-key").description("Set OpenAI API key for AI features").option("--key <key>","API key (or enter interactively)").action(async t=>{let n=t.key;n?n.startsWith("sk-")||(console.log(u.red(`
|
|
1489
883
|
\u274C Invalid API key format (should start with sk-)
|
|
1490
|
-
`)),process.exit(1)):n=(await
|
|
884
|
+
`)),process.exit(1)):n=(await(await wt()).prompt([{type:"password",name:"apiKey",message:"Enter your OpenAI API key:",validate:s=>s?s.startsWith("sk-")?s.length<20?"API key seems too short":true:"Invalid API key format (should start with sk-)":"API key is required"}])).apiKey,ve({openaiApiKey:n}),console.log(u.green(`
|
|
1491
885
|
\u2705 OpenAI API key saved successfully!
|
|
1492
|
-
`)),console.log(
|
|
1493
|
-
\u{1F389} You can now use AI features:`)),console.log(
|
|
1494
|
-
\u{1F4A1} To generate module embeddings (one-time):`)),console.log(
|
|
1495
|
-
`));}),o.command("show").description("Show current configuration").action(()=>{let t=
|
|
886
|
+
`)),console.log(u.gray(`Stored in: ${Te()}`)),console.log(u.cyan(`
|
|
887
|
+
\u{1F389} You can now use AI features:`)),console.log(u.white(' rapidkit ai recommend "I need user authentication"')),console.log(u.gray(`
|
|
888
|
+
\u{1F4A1} To generate module embeddings (one-time):`)),console.log(u.white(" cd rapidkit-npm")),console.log(u.white(` npx tsx src/ai/generate-embeddings.ts
|
|
889
|
+
`));}),o.command("show").description("Show current configuration").action(()=>{let t=te();if(console.log(u.bold(`
|
|
1496
890
|
\u2699\uFE0F RapidKit Configuration
|
|
1497
|
-
`)),t.openaiApiKey){let n=t.openaiApiKey.substring(0,8)+"..."+t.openaiApiKey.slice(-4);console.log(
|
|
1498
|
-
\u{1F4C1} Config file: ${
|
|
1499
|
-
`));}),o.command("remove-api-key").description("Remove stored OpenAI API key").action(async()=>{if(!
|
|
891
|
+
`)),t.openaiApiKey){let n=t.openaiApiKey.substring(0,8)+"..."+t.openaiApiKey.slice(-4);console.log(u.cyan("OpenAI API Key:"),u.white(n));}else console.log(u.cyan("OpenAI API Key:"),u.red("Not set")),console.log(u.gray(" Set with: rapidkit config set-api-key"));console.log(u.cyan("AI Features:"),t.aiEnabled!==false?u.green("Enabled"):u.red("Disabled")),console.log(u.gray(`
|
|
892
|
+
\u{1F4C1} Config file: ${Te()}
|
|
893
|
+
`));}),o.command("remove-api-key").description("Remove stored OpenAI API key").action(async()=>{if(!te().openaiApiKey){console.log(u.yellow(`
|
|
1500
894
|
\u26A0\uFE0F No API key is currently stored
|
|
1501
|
-
`));return}(await
|
|
895
|
+
`));return}(await(await wt()).prompt([{type:"confirm",name:"confirm",message:"Are you sure you want to remove your OpenAI API key?",default:false}])).confirm?(ve({openaiApiKey:void 0}),console.log(u.green(`
|
|
1502
896
|
\u2705 API key removed successfully
|
|
1503
|
-
`))):console.log(
|
|
897
|
+
`))):console.log(u.gray(`
|
|
1504
898
|
Cancelled
|
|
1505
|
-
`));}),o.command("ai <action>").description("Enable or disable AI features (enable|disable)").action(t=>{t!=="enable"&&t!=="disable"&&(console.log(
|
|
1506
|
-
\u274C Invalid action: ${t}`)),console.log(
|
|
1507
|
-
`)),process.exit(1));let n=t==="enable";
|
|
899
|
+
`));}),o.command("ai <action>").description("Enable or disable AI features (enable|disable)").action(t=>{t!=="enable"&&t!=="disable"&&(console.log(u.red(`
|
|
900
|
+
\u274C Invalid action: ${t}`)),console.log(u.gray(`Use: rapidkit config ai enable|disable
|
|
901
|
+
`)),process.exit(1));let n=t==="enable";ve({aiEnabled:n}),console.log(u.green(`
|
|
1508
902
|
\u2705 AI features ${n?"enabled":"disabled"}
|
|
1509
|
-
`));});}j();j();var He=null,Je=false;function vo(){Je=true;}function bo(e){let t=new Array(1536),n=0;for(let i=0;i<e.length;i++)n=(n<<5)-n+e.charCodeAt(i),n=n&n;for(let i=0;i<1536;i++)n=n*1664525+1013904223&4294967295,t[i]=n/4294967295*2-1;let r=Math.sqrt(t.reduce((i,s)=>i+s*s,0));return t.map(i=>i/r)}function Ye(e){He=new qn({apiKey:e});}function xo(){if(!He)throw new Error("OpenAI client not initialized. Call initOpenAI() first with your API key.");return He}async function Po(e){return Je?bo(e):(await xo().embeddings.create({model:"text-embedding-3-small",input:e,encoding_format:"float"})).data[0].embedding}async function jo(e){return Je?e.map(bo):(await xo().embeddings.create({model:"text-embedding-3-small",input:e,encoding_format:"float"})).data.map(n=>n.embedding)}function Co(){return He!==null}function $o(){return Je}j();j();var Xn=promisify(exec),Ro=[{id:"authentication-core",name:"Authentication Core",category:"auth",description:"Complete authentication system with password hashing, JWT tokens, OAuth 2.0, and secure session management",longDescription:"Production-ready authentication with bcrypt password hashing, JWT access/refresh tokens, OAuth 2.0 providers (Google, GitHub, etc), rate limiting, and security best practices.",keywords:["auth","login","password","jwt","oauth","token","authentication","security","signin","signup"],framework:"both",dependencies:[],useCases:["User login and logout","Password reset flow","OAuth social login (Google, GitHub)","JWT authentication","Secure session management","Token refresh","Rate limiting"]},{id:"users-core",name:"Users Core",category:"auth",description:"User management system with profiles, roles, permissions, and user CRUD operations",longDescription:"Complete user management with user profiles, role-based access control (RBAC), permissions, user search, soft delete, and audit trails.",keywords:["user","profile","role","permission","rbac","management","admin","accounts"],framework:"both",dependencies:["authentication-core"],useCases:["User registration","User profile management","Role management (admin, user, etc)","Permission system","User administration dashboard","Soft delete users"]},{id:"session-management",name:"Session Management",category:"auth",description:"Secure session handling with Redis storage, session rotation, and device tracking",longDescription:"Advanced session management with Redis-backed storage, automatic session rotation, device fingerprinting, IP tracking, and session revocation.",keywords:["session","redis","cookie","storage","device","tracking"],framework:"both",dependencies:["authentication-core","redis-cache"],useCases:["User session management","Remember me functionality","Device tracking","Session security","Logout from all devices","Session expiration"]},{id:"db-postgres",name:"PostgreSQL",category:"database",description:"PostgreSQL integration with async SQLAlchemy, migrations, connection pooling, and query optimization",longDescription:"Production-ready PostgreSQL with async SQLAlchemy 2.0, Alembic migrations, connection pooling, query optimization, JSON support, and full-text search.",keywords:["postgres","postgresql","database","sql","sqlalchemy","migration","orm","relational"],framework:"both",dependencies:[],useCases:["Relational database","Complex SQL queries","Database transactions","Data integrity","Production-grade database","ACID compliance"]},{id:"db-mongodb",name:"MongoDB",category:"database",description:"MongoDB integration with Motor async driver, schema validation, and aggregation pipelines",longDescription:"Async MongoDB with Motor driver, Pydantic schema validation, aggregation pipelines, indexes, and Atlas integration.",keywords:["mongodb","mongo","nosql","document","database","motor"],framework:"both",dependencies:[],useCases:["Document storage","Flexible schema","Real-time data","JSON documents","Unstructured data","Analytics"]},{id:"stripe-payment",name:"Stripe Payment",category:"payment",description:"Stripe integration with payment intents, subscriptions, webhooks, and customer portal",longDescription:"Complete Stripe integration with Payment Intents API, subscription management, automatic webhooks, customer portal, refunds, and SCA compliance.",keywords:["stripe","payment","subscription","billing","checkout","webhook","credit card"],framework:"both",dependencies:[],useCases:["Accept credit card payments","Subscription billing","One-time payments","Checkout flow","Payment webhooks","Refunds and disputes"]},{id:"email",name:"Email",category:"communication",description:"Email sending with templates, SMTP/SendGrid/AWS SES support, and queue management",longDescription:"Production email system with Jinja2 templates, multiple providers (SMTP, SendGrid, AWS SES), queue management, retry logic, and bounce handling.",keywords:["email","mail","smtp","sendgrid","ses","template","notification"],framework:"both",dependencies:[],useCases:["Welcome emails","Password reset emails","Notifications","Marketing emails","Transactional emails","Email templates"]},{id:"sms",name:"SMS",category:"communication",description:"SMS sending with Twilio, verification codes, and delivery tracking",longDescription:"SMS integration with Twilio, verification codes, two-factor authentication, delivery tracking, and international support.",keywords:["sms","twilio","text","message","2fa","verification","otp"],framework:"both",dependencies:[],useCases:["2FA verification codes","SMS notifications","Phone verification","OTP generation","SMS alerts"]},{id:"redis-cache",name:"Redis Cache",category:"infrastructure",description:"Redis caching with decorators, TTL management, and cache invalidation patterns",longDescription:"Redis integration with async client, caching decorators, TTL management, cache invalidation, pub/sub, and rate limiting.",keywords:["redis","cache","memory","performance","speed","pubsub"],framework:"both",dependencies:[],useCases:["API response caching","Session storage","Rate limiting","Real-time features","Performance optimization","Pub/sub messaging"]},{id:"celery",name:"Celery",category:"infrastructure",description:"Background task processing with Celery, periodic tasks, and monitoring",longDescription:"Celery task queue with Redis/RabbitMQ backend, periodic tasks (cron), task monitoring, retry logic, and failure handling.",keywords:["celery","task","background","queue","async","worker","job","cron"],framework:"fastapi",dependencies:["redis-cache"],useCases:["Background email sending","Data processing","Report generation","Scheduled tasks","Long-running jobs"]},{id:"storage",name:"Storage",category:"infrastructure",description:"File storage with S3, local filesystem, and image processing",longDescription:"Unified storage interface for AWS S3, local files, image resizing, format conversion, CDN integration, and presigned URLs.",keywords:["storage","s3","file","upload","image","cdn","aws"],framework:"both",dependencies:[],useCases:["File uploads","Image storage","Document management","Profile pictures","Media files","CDN integration"]}],ve=null,_o=0,Zn=300*1e3;function ei(e){return {id:e.name||e.id||e.module_id||"",name:e.display_name||e.name||"",category:ti(e.category||"infrastructure"),description:e.description||e.summary||"",longDescription:e.long_description||e.description||"",keywords:e.keywords||e.tags||[],framework:oi(e.framework),dependencies:e.dependencies||[],useCases:e.use_cases||e.useCases||[]}}function ti(e){return {auth:"auth",authentication:"auth",database:"database",payment:"payment",billing:"payment",communication:"communication",infrastructure:"infrastructure",security:"security",analytics:"analytics"}[e.toLowerCase()]||"infrastructure"}function oi(e){if(!e)return "both";if(typeof e=="string"){if(e.toLowerCase().includes("fastapi"))return "fastapi";if(e.toLowerCase().includes("nest"))return "nestjs"}return "both"}async function ni(){try{let{stdout:e}=await Xn("rapidkit modules list --json-schema 1",{timeout:1e4,maxBuffer:10485760}),o=e.match(/\{[\s\S]*\}/),t=o?o[0]:e,n=JSON.parse(t),r=[];return Array.isArray(n)?r=n:n.modules&&Array.isArray(n.modules)?r=n.modules:n.data&&Array.isArray(n.data)&&(r=n.data),r.map(ei).filter(i=>i.id&&i.name)}catch(e){return e.code==="ENOENT"?console.warn("\u26A0\uFE0F RapidKit Python Core not found in PATH"):e.killed?console.warn("\u26A0\uFE0F Python Core command timed out"):console.warn("\u26A0\uFE0F Failed to fetch modules from Python Core:",e.message),console.warn(" Using fallback module catalog (11 modules)"),Ro}}async function qe(){let e=Date.now();return ve&&e-_o<Zn||(ve=await ni(),_o=e,ve.length===0&&(console.warn("\u26A0\uFE0F No modules found, using fallback catalog"),ve=Ro)),ve}var ri=fileURLToPath(import.meta.url),Io=v.dirname(ri),Se=null;function si(){if(Se)return Se;let e=[v.join(Io,"../../data/modules-embeddings.json"),v.join(Io,"../data/modules-embeddings.json"),v.join(process.cwd(),"data/modules-embeddings.json")],o=null;for(let r of e)if(W.existsSync(r)){o=r;break}if(!o)throw new Error("embeddings file not found");let t=W.readFileSync(o,"utf-8"),n=JSON.parse(t);return Array.isArray(n)?Se={model:"mock-or-text-embedding-3-small",dimension:n[0]?.embedding?.length||1536,generated_at:new Date().toISOString(),modules:n}:Se=n,Se}function ai(e,o){if(e.length!==o.length)throw new Error("Vectors must have the same length");let t=0,n=0,r=0;for(let s=0;s<e.length;s++)t+=e[s]*o[s],n+=e[s]*e[s],r+=o[s]*o[s];let i=Math.sqrt(n)*Math.sqrt(r);return i===0?0:t/i}function ci(e,o){let t=o.toLowerCase(),n=e.keywords.filter(r=>t.includes(r)||r.includes(t));return n.length>0?`Matches: ${n.slice(0,3).join(", ")}`:`Relevant for: ${e.useCases[0]}`}async function Ao(e,o=5){let t=si(),n=await qe(),r=await Po(e),i=t.modules.map(s=>{let a=n.find(l=>l.id===s.id);if(!a)return null;let c=ai(r,s.embedding);return {module:a,score:c,reason:ci(a,e)}}).filter(s=>s!==null);return i.sort((s,a)=>a.score-s.score),i.slice(0,o)}j();var pi=fileURLToPath(import.meta.url),So=v.dirname(pi);function ui(){return [v.join(So,"../../data/modules-embeddings.json"),v.join(So,"../data/modules-embeddings.json"),v.join(process.cwd(),"data/modules-embeddings.json")]}function No(){let e=ui();for(let o of e)if(W.existsSync(o))try{let t=JSON.parse(W.readFileSync(o,"utf-8")),n=Array.isArray(t)?t:t.modules||[];return {exists:!0,path:o,moduleCount:n.length,generatedAt:t.generated_at||null}}catch{continue}return {exists:false,path:null,moduleCount:0,generatedAt:null}}async function Qe(e=true,o){try{if(!Co()&&!$o())return console.log(m.red(`
|
|
1510
|
-
\u274C OpenAI not initialized`)),console.log(
|
|
1511
|
-
`))
|
|
903
|
+
`));});}var be=null,xe=false,Ne=null;async function wo(){return Ne||(Ne=(await import('openai')).default),Ne}function vt(){xe=true;}function bt(e){let t=new Array(1536),n=0;for(let i=0;i<e.length;i++)n=(n<<5)-n+e.charCodeAt(i),n=n&n;for(let i=0;i<1536;i++)n=n*1664525+1013904223&4294967295,t[i]=n/4294967295*2-1;let r=Math.sqrt(t.reduce((i,s)=>i+s*s,0));return t.map(i=>i/r)}async function Pe(e){let o=await wo();be=new o({apiKey:e});}function xt(){if(!be)throw new Error("OpenAI client not initialized. Call initOpenAI() first with your API key.");return be}async function Pt(e){return xe?bt(e):(await xt().embeddings.create({model:"text-embedding-3-small",input:e,encoding_format:"float"})).data[0].embedding}async function It(e){return xe?e.map(bt):(await xt().embeddings.create({model:"text-embedding-3-small",input:e,encoding_format:"float"})).data.map(n=>n.embedding)}function jt(){return be!==null}function Ct(){return xe}var bo=promisify(exec),$t=[{id:"authentication-core",name:"Authentication Core",category:"auth",description:"Complete authentication system with password hashing, JWT tokens, OAuth 2.0, and secure session management",longDescription:"Production-ready authentication with bcrypt password hashing, JWT access/refresh tokens, OAuth 2.0 providers (Google, GitHub, etc), rate limiting, and security best practices.",keywords:["auth","login","password","jwt","oauth","token","authentication","security","signin","signup"],framework:"both",dependencies:[],useCases:["User login and logout","Password reset flow","OAuth social login (Google, GitHub)","JWT authentication","Secure session management","Token refresh","Rate limiting"]},{id:"users-core",name:"Users Core",category:"auth",description:"User management system with profiles, roles, permissions, and user CRUD operations",longDescription:"Complete user management with user profiles, role-based access control (RBAC), permissions, user search, soft delete, and audit trails.",keywords:["user","profile","role","permission","rbac","management","admin","accounts"],framework:"both",dependencies:["authentication-core"],useCases:["User registration","User profile management","Role management (admin, user, etc)","Permission system","User administration dashboard","Soft delete users"]},{id:"session-management",name:"Session Management",category:"auth",description:"Secure session handling with Redis storage, session rotation, and device tracking",longDescription:"Advanced session management with Redis-backed storage, automatic session rotation, device fingerprinting, IP tracking, and session revocation.",keywords:["session","redis","cookie","storage","device","tracking"],framework:"both",dependencies:["authentication-core","redis-cache"],useCases:["User session management","Remember me functionality","Device tracking","Session security","Logout from all devices","Session expiration"]},{id:"db-postgres",name:"PostgreSQL",category:"database",description:"PostgreSQL integration with async SQLAlchemy, migrations, connection pooling, and query optimization",longDescription:"Production-ready PostgreSQL with async SQLAlchemy 2.0, Alembic migrations, connection pooling, query optimization, JSON support, and full-text search.",keywords:["postgres","postgresql","database","sql","sqlalchemy","migration","orm","relational"],framework:"both",dependencies:[],useCases:["Relational database","Complex SQL queries","Database transactions","Data integrity","Production-grade database","ACID compliance"]},{id:"db-mongodb",name:"MongoDB",category:"database",description:"MongoDB integration with Motor async driver, schema validation, and aggregation pipelines",longDescription:"Async MongoDB with Motor driver, Pydantic schema validation, aggregation pipelines, indexes, and Atlas integration.",keywords:["mongodb","mongo","nosql","document","database","motor"],framework:"both",dependencies:[],useCases:["Document storage","Flexible schema","Real-time data","JSON documents","Unstructured data","Analytics"]},{id:"stripe-payment",name:"Stripe Payment",category:"payment",description:"Stripe integration with payment intents, subscriptions, webhooks, and customer portal",longDescription:"Complete Stripe integration with Payment Intents API, subscription management, automatic webhooks, customer portal, refunds, and SCA compliance.",keywords:["stripe","payment","subscription","billing","checkout","webhook","credit card"],framework:"both",dependencies:[],useCases:["Accept credit card payments","Subscription billing","One-time payments","Checkout flow","Payment webhooks","Refunds and disputes"]},{id:"email",name:"Email",category:"communication",description:"Email sending with templates, SMTP/SendGrid/AWS SES support, and queue management",longDescription:"Production email system with Jinja2 templates, multiple providers (SMTP, SendGrid, AWS SES), queue management, retry logic, and bounce handling.",keywords:["email","mail","smtp","sendgrid","ses","template","notification"],framework:"both",dependencies:[],useCases:["Welcome emails","Password reset emails","Notifications","Marketing emails","Transactional emails","Email templates"]},{id:"sms",name:"SMS",category:"communication",description:"SMS sending with Twilio, verification codes, and delivery tracking",longDescription:"SMS integration with Twilio, verification codes, two-factor authentication, delivery tracking, and international support.",keywords:["sms","twilio","text","message","2fa","verification","otp"],framework:"both",dependencies:[],useCases:["2FA verification codes","SMS notifications","Phone verification","OTP generation","SMS alerts"]},{id:"redis-cache",name:"Redis Cache",category:"infrastructure",description:"Redis caching with decorators, TTL management, and cache invalidation patterns",longDescription:"Redis integration with async client, caching decorators, TTL management, cache invalidation, pub/sub, and rate limiting.",keywords:["redis","cache","memory","performance","speed","pubsub"],framework:"both",dependencies:[],useCases:["API response caching","Session storage","Rate limiting","Real-time features","Performance optimization","Pub/sub messaging"]},{id:"celery",name:"Celery",category:"infrastructure",description:"Background task processing with Celery, periodic tasks, and monitoring",longDescription:"Celery task queue with Redis/RabbitMQ backend, periodic tasks (cron), task monitoring, retry logic, and failure handling.",keywords:["celery","task","background","queue","async","worker","job","cron"],framework:"fastapi",dependencies:["redis-cache"],useCases:["Background email sending","Data processing","Report generation","Scheduled tasks","Long-running jobs"]},{id:"storage",name:"Storage",category:"infrastructure",description:"File storage with S3, local filesystem, and image processing",longDescription:"Unified storage interface for AWS S3, local files, image resizing, format conversion, CDN integration, and presigned URLs.",keywords:["storage","s3","file","upload","image","cdn","aws"],framework:"both",dependencies:[],useCases:["File uploads","Image storage","Document management","Profile pictures","Media files","CDN integration"]}],oe=null,Rt=0,xo=300*1e3;function Po(e){return {id:e.name||e.id||e.module_id||"",name:e.display_name||e.name||"",category:Io(e.category||"infrastructure"),description:e.description||e.summary||"",longDescription:e.long_description||e.description||"",keywords:e.keywords||e.tags||[],framework:jo(e.framework),dependencies:e.dependencies||[],useCases:e.use_cases||e.useCases||[]}}function Io(e){return {auth:"auth",authentication:"auth",database:"database",payment:"payment",billing:"payment",communication:"communication",infrastructure:"infrastructure",security:"security",analytics:"analytics"}[e.toLowerCase()]||"infrastructure"}function jo(e){if(!e)return "both";if(typeof e=="string"){if(e.toLowerCase().includes("fastapi"))return "fastapi";if(e.toLowerCase().includes("nest"))return "nestjs"}return "both"}async function Co(){try{let{stdout:e}=await bo("rapidkit modules list --json-schema 1",{timeout:1e4,maxBuffer:10485760}),o=e.match(/\{[\s\S]*\}/),t=o?o[0]:e,n=JSON.parse(t),r=[];return Array.isArray(n)?r=n:n.modules&&Array.isArray(n.modules)?r=n.modules:n.data&&Array.isArray(n.data)&&(r=n.data),r.map(Po).filter(i=>i.id&&i.name)}catch(e){return e.code==="ENOENT"?console.warn("\u26A0\uFE0F RapidKit Python Core not found in PATH"):e.killed?console.warn("\u26A0\uFE0F Python Core command timed out"):console.warn("\u26A0\uFE0F Failed to fetch modules from Python Core:",e.message),console.warn(" Using fallback module catalog (11 modules)"),$t}}async function Ie(){let e=Date.now();return oe&&e-Rt<xo||(oe=await Co(),Rt=e,oe.length===0&&(console.warn("\u26A0\uFE0F No modules found, using fallback catalog"),oe=$t)),oe}var $o=fileURLToPath(import.meta.url),_t=w.dirname($o),de=null;function Ao(){if(de)return de;let e=[w.join(_t,"../../data/modules-embeddings.json"),w.join(_t,"../data/modules-embeddings.json"),w.join(process.cwd(),"data/modules-embeddings.json")],o=null;for(let r of e)if(S.existsSync(r)){o=r;break}if(!o)throw new Error("embeddings file not found");let t=S.readFileSync(o,"utf-8"),n=JSON.parse(t);return Array.isArray(n)?de={model:"mock-or-text-embedding-3-small",dimension:n[0]?.embedding?.length||1536,generated_at:new Date().toISOString(),modules:n}:de=n,de}function _o(e,o){if(e.length!==o.length)throw new Error("Vectors must have the same length");let t=0,n=0,r=0;for(let s=0;s<e.length;s++)t+=e[s]*o[s],n+=e[s]*e[s],r+=o[s]*o[s];let i=Math.sqrt(n)*Math.sqrt(r);return i===0?0:t/i}function Eo(e,o){let t=o.toLowerCase(),n=e.keywords.filter(r=>t.includes(r)||r.includes(t));return n.length>0?`Matches: ${n.slice(0,3).join(", ")}`:`Relevant for: ${e.useCases[0]}`}async function Et(e,o=5){let t=Ao(),n=await Ie(),r=await Pt(e),i=t.modules.map(s=>{let l=n.find(c=>c.id===s.id);if(!l)return null;let a=_o(r,s.embedding);return {module:l,score:a,reason:Eo(l,e)}}).filter(s=>s!==null);return i.sort((s,l)=>l.score-s.score),i.slice(0,o)}var Do=fileURLToPath(import.meta.url),St=w.dirname(Do);async function Mt(){return (await import('inquirer')).default}function Ko(){return [w.join(St,"../../data/modules-embeddings.json"),w.join(St,"../data/modules-embeddings.json"),w.join(process.cwd(),"data/modules-embeddings.json")]}function Dt(){let e=Ko();for(let o of e)if(S.existsSync(o))try{let t=JSON.parse(S.readFileSync(o,"utf-8")),n=Array.isArray(t)?t:t.modules||[];return {exists:true,path:o,moduleCount:n.length,generatedAt:t.generated_at||null}}catch{continue}return {exists:false,path:null,moduleCount:0,generatedAt:null}}async function Ce(e=true,o){try{if(!jt()&&!Ct())return console.log(u.red(`
|
|
904
|
+
\u274C OpenAI not initialized`)),console.log(u.yellow("Please set your API key:")),console.log(u.white(" rapidkit config set-api-key")),console.log(u.gray(` OR set: export OPENAI_API_KEY="sk-..."
|
|
905
|
+
`)),false;console.log(u.blue(`
|
|
1512
906
|
\u{1F916} Generating AI embeddings for RapidKit modules...
|
|
1513
|
-
`)),console.log(
|
|
1514
|
-
`));let n=t.length*50/1e6*.02;if(console.log(
|
|
1515
|
-
`)),e){let{confirm:
|
|
907
|
+
`)),console.log(u.gray("\u{1F4E1} Fetching modules from RapidKit..."));let t=await Ie();console.log(u.green(`\u2713 Found ${t.length} modules
|
|
908
|
+
`));let n=t.length*50/1e6*.02;if(console.log(u.cyan(`\u{1F4B0} Estimated cost: ~$${n.toFixed(3)}`)),console.log(u.gray(` (Based on ${t.length} modules at $0.02/1M tokens)
|
|
909
|
+
`)),e){let s=await Mt(),{confirm:l}=await s.prompt([{type:"confirm",name:"confirm",message:"Generate embeddings now?",default:true}]);if(!l)return console.log(u.yellow(`
|
|
1516
910
|
\u26A0\uFE0F Embeddings generation cancelled
|
|
1517
|
-
`))
|
|
1518
|
-
\u2705 Embeddings generated successfully!`)),console.log(
|
|
1519
|
-
`))
|
|
1520
|
-
\u274C OpenAI API quota exceeded`)),console.log(
|
|
1521
|
-
`))):s.message?.includes("401")?(console.log(
|
|
1522
|
-
\u274C Invalid API key`)),console.log(
|
|
1523
|
-
`))):console.log(
|
|
911
|
+
`)),false}let r=t.map(s=>`${s.name}. ${s.description}. ${s.longDescription}. Keywords: ${s.keywords.join(", ")}. Use cases: ${s.useCases.join(", ")}.`),i=Me(`Generating embeddings for ${t.length} modules...`).start();try{let s=await It(r);i.succeed(`Generated embeddings for ${t.length} modules`);let l={model:"text-embedding-3-small",dimension:s[0].length,generated_at:new Date().toISOString(),modules:t.map((d,g)=>({id:d.id,name:d.name,embedding:s[g]}))},a=o||w.join(process.cwd(),"data","modules-embeddings.json"),c=w.dirname(a);return S.existsSync(c)||S.mkdirSync(c,{recursive:true}),S.writeFileSync(a,JSON.stringify(l,null,2)),console.log(u.green(`
|
|
912
|
+
\u2705 Embeddings generated successfully!`)),console.log(u.gray(`\u{1F4C1} Saved to: ${a}`)),console.log(u.gray(`\u{1F4CA} Size: ${t.length} modules, ${s[0].length} dimensions
|
|
913
|
+
`)),true}catch(s){return i.fail("Failed to generate embeddings"),s.message?.includes("429")?(console.log(u.red(`
|
|
914
|
+
\u274C OpenAI API quota exceeded`)),console.log(u.yellow(`Please check your billing: https://platform.openai.com/account/billing
|
|
915
|
+
`))):s.message?.includes("401")?(console.log(u.red(`
|
|
916
|
+
\u274C Invalid API key`)),console.log(u.yellow("Please set a valid API key:")),console.log(u.white(` rapidkit config set-api-key
|
|
917
|
+
`))):console.log(u.red(`
|
|
1524
918
|
\u274C Error: ${s.message}
|
|
1525
|
-
`))
|
|
919
|
+
`)),false}}catch(t){return console.log(u.red(`
|
|
1526
920
|
\u274C Failed to generate embeddings: ${t.message}
|
|
1527
|
-
`)),false}}async function
|
|
1528
|
-
\u26A0\uFE0F Module embeddings not found`)),console.log(
|
|
1529
|
-
`)),!e)return console.log(
|
|
1530
|
-
`)),false;let{action:
|
|
921
|
+
`)),false}}async function Kt(e=true){if(Dt().exists)return true;if(console.log(u.yellow(`
|
|
922
|
+
\u26A0\uFE0F Module embeddings not found`)),console.log(u.gray(`AI recommendations require embeddings to be generated.
|
|
923
|
+
`)),!e)return console.log(u.red("\u274C Cannot generate embeddings in non-interactive mode")),console.log(u.white(`Run: rapidkit ai generate-embeddings
|
|
924
|
+
`)),false;let t=await Mt(),{action:n}=await t.prompt([{type:"list",name:"action",message:"What would you like to do?",choices:[{name:"\u{1F680} Generate embeddings now (requires OpenAI API key)",value:"generate"},{name:"\u{1F4DD} Show me how to generate them manually",value:"manual"},{name:"\u274C Cancel",value:"cancel"}]}]);return n==="generate"?await Ce(true):(n==="manual"&&(console.log(u.cyan(`
|
|
1531
925
|
\u{1F4DD} To generate embeddings manually:
|
|
1532
|
-
`)),console.log(
|
|
1533
|
-
`)),console.log(
|
|
1534
|
-
`)),console.log(
|
|
1535
|
-
`))),false)}async function
|
|
1536
|
-
\u{1F504} Updating embeddings...`)),console.log(
|
|
1537
|
-
`)),await
|
|
1538
|
-
\u26A0\uFE0F No existing embeddings found`)),console.log(
|
|
1539
|
-
`)),false)}
|
|
1540
|
-
\u26A0\uFE0F AI features are disabled`)),console.log(
|
|
1541
|
-
`)),process.exit(1));let r=
|
|
926
|
+
`)),console.log(u.white("1. Get OpenAI API key from: https://platform.openai.com/api-keys")),console.log(u.white("2. Set the API key:")),console.log(u.gray(" rapidkit config set-api-key")),console.log(u.gray(` OR: export OPENAI_API_KEY="sk-..."
|
|
927
|
+
`)),console.log(u.white("3. Generate embeddings:")),console.log(u.gray(` rapidkit ai generate-embeddings
|
|
928
|
+
`)),console.log(u.cyan(`\u{1F4B0} Cost: ~$0.50 one-time
|
|
929
|
+
`))),false)}async function Ft(){let e=Dt();return e.exists?(console.log(u.blue(`
|
|
930
|
+
\u{1F504} Updating embeddings...`)),console.log(u.gray(`Current: ${e.moduleCount} modules`)),console.log(u.gray(`Generated: ${e.generatedAt||"unknown"}
|
|
931
|
+
`)),await Ce(true,e.path)):(console.log(u.yellow(`
|
|
932
|
+
\u26A0\uFE0F No existing embeddings found`)),console.log(u.gray(`Use: rapidkit ai generate-embeddings
|
|
933
|
+
`)),false)}async function Ot(){return (await import('inquirer')).default}function Tt(e){let o=e.command("ai").description("AI-powered features");o.command("recommend").description("Get AI-powered module recommendations").argument("[query]",'What do you want to build? (e.g., "user authentication with email")').option("-n, --number <count>","Number of recommendations","5").option("--json","Output as JSON").action(async(t,n)=>{try{Oe()||(console.log(u.yellow(`
|
|
934
|
+
\u26A0\uFE0F AI features are disabled`)),console.log(u.gray(`Enable with: rapidkit config ai enable
|
|
935
|
+
`)),process.exit(1));let r=le();r?await Pe(r):(console.log(u.yellow(`
|
|
1542
936
|
\u26A0\uFE0F OpenAI API key not configured - using MOCK MODE for testing
|
|
1543
|
-
`)),console.log(
|
|
1544
|
-
`)),console.log(
|
|
1545
|
-
`)),
|
|
937
|
+
`)),console.log(u.gray("\u{1F4DD} Note: Mock embeddings provide approximate results for testing.")),console.log(u.gray(` For production, configure your OpenAI API key:
|
|
938
|
+
`)),console.log(u.white(" 1. Get your key from: https://platform.openai.com/api-keys")),console.log(u.white(" 2. Configure it: rapidkit config set-api-key")),console.log(u.gray(` OR set: export OPENAI_API_KEY="sk-proj-..."
|
|
939
|
+
`)),vt());let i=t;i||(i=(await(await Ot()).prompt([{type:"input",name:"query",message:"\u{1F916} What do you want to build?",validate:P=>P.length===0?"Please enter a description":P.length<3?"Please be more specific (at least 3 characters)":true}])).query),n.json||console.log(u.blue(`
|
|
1546
940
|
\u{1F916} Analyzing your request...
|
|
1547
|
-
`)),await
|
|
941
|
+
`)),await Kt(!n.json)||(console.log(u.yellow(`
|
|
1548
942
|
\u26A0\uFE0F Cannot proceed without embeddings
|
|
1549
|
-
`)),process.exit(1));let
|
|
943
|
+
`)),process.exit(1));let l=parseInt(n.number,10),a=await Et(i,l);if(a.length===0||a[0].score<.3)if(console.log(u.yellow(`
|
|
1550
944
|
\u26A0\uFE0F No matching modules found in RapidKit registry.
|
|
1551
|
-
`)),console.log(
|
|
1552
|
-
`)),console.log(
|
|
1553
|
-
`)),console.log(
|
|
1554
|
-
`)),console.log(
|
|
1555
|
-
`)),
|
|
1556
|
-
`));else return;if(n.json){console.log(JSON.stringify({query:i,recommendations:
|
|
1557
|
-
`)),
|
|
1558
|
-
`));let{shouldInstall:
|
|
945
|
+
`)),console.log(u.cyan(`\u{1F4A1} Options:
|
|
946
|
+
`)),console.log(u.white("1. Create custom module:")),console.log(u.gray(" rapidkit modules scaffold <name> --category <category>")),console.log(u.gray(` Example: rapidkit modules scaffold blockchain-integration --category integrations
|
|
947
|
+
`)),console.log(u.white("2. Search with different keywords")),console.log(u.gray(` Try more general terms (e.g., "storage" instead of "blockchain")
|
|
948
|
+
`)),console.log(u.white("3. Request feature:")),console.log(u.gray(` https://github.com/getrapidkit/rapidkit/issues
|
|
949
|
+
`)),a.length>0)console.log(u.yellow(`\u26A0\uFE0F Low confidence matches found:
|
|
950
|
+
`));else return;if(n.json){console.log(JSON.stringify({query:i,recommendations:a},null,2));return}console.log(u.green.bold(`\u{1F4E6} Recommended Modules:
|
|
951
|
+
`)),a.forEach((p,y)=>{let P=(p.score*100).toFixed(1),v=p.score>.8?" \u2B50":"";console.log(u.bold(`${y+1}. ${p.module.name}${v}`)),console.log(u.gray(` ${p.module.description}`)),console.log(u.cyan(` Match: ${P}%`)+u.gray(` - ${p.reason}`)),console.log(u.yellow(` Category: ${p.module.category}`)),p.module.dependencies.length>0&&console.log(u.magenta(` Requires: ${p.module.dependencies.join(", ")}`)),console.log();});let c=a.slice(0,3).map(p=>p.module.id);console.log(u.cyan("\u{1F4A1} Quick install (top 3):")),console.log(u.white(` rapidkit add module ${c.join(" ")}
|
|
952
|
+
`));let d=await Ot(),{shouldInstall:g}=await d.prompt([{type:"confirm",name:"shouldInstall",message:"Would you like to install these modules now?",default:false}]);if(g){let{selectedModules:p}=await d.prompt([{type:"checkbox",name:"selectedModules",message:"Select modules to install:",choices:a.map(y=>({name:`${y.module.name} - ${y.module.description}`,value:y.module.id,checked:y.score>.7}))}]);p.length>0?(console.log(u.blue(`
|
|
1559
953
|
\u{1F4E6} Installing ${p.length} modules...
|
|
1560
|
-
`)),console.log(
|
|
1561
|
-
\u26A0\uFE0F Note: Module installation not yet implemented`)),console.log(
|
|
1562
|
-
`))):console.log(
|
|
954
|
+
`)),console.log(u.gray(`Command: rapidkit add module ${p.join(" ")}`)),console.log(u.yellow(`
|
|
955
|
+
\u26A0\uFE0F Note: Module installation not yet implemented`)),console.log(u.gray(`Coming soon in next version!
|
|
956
|
+
`))):console.log(u.gray(`
|
|
1563
957
|
No modules selected
|
|
1564
|
-
`));}}catch(r){
|
|
1565
|
-
\u274C Error:`,r.message),r.code==="invalid_api_key"?(console.log(
|
|
1566
|
-
\u{1F4A1} Your API key may be invalid or expired`)),console.log(
|
|
1567
|
-
`))):r.message.includes("embeddings file not found")&&(console.log(
|
|
1568
|
-
\u{1F4A1} Module embeddings not generated yet`)),console.log(
|
|
1569
|
-
`))),process.exit(1);}}),o.command("info").description("Show AI features information").action(()=>{let t=
|
|
958
|
+
`));}}catch(r){a.error(`
|
|
959
|
+
\u274C Error:`,r.message),r.code==="invalid_api_key"?(console.log(u.yellow(`
|
|
960
|
+
\u{1F4A1} Your API key may be invalid or expired`)),console.log(u.cyan(` Update it: rapidkit config set-api-key
|
|
961
|
+
`))):r.message.includes("embeddings file not found")&&(console.log(u.yellow(`
|
|
962
|
+
\u{1F4A1} Module embeddings not generated yet`)),console.log(u.cyan(" Generate them (one-time):")),console.log(u.white(" cd rapidkit-npm")),console.log(u.white(' export OPENAI_API_KEY="sk-proj-..."')),console.log(u.white(` npx tsx src/ai/generate-embeddings.ts
|
|
963
|
+
`))),process.exit(1);}}),o.command("info").description("Show AI features information").action(()=>{let t=le(),n=Oe();console.log(u.bold(`
|
|
1570
964
|
\u{1F916} RapidKit AI Features
|
|
1571
|
-
`)),console.log(
|
|
965
|
+
`)),console.log(u.cyan("Status:"),n?u.green("Enabled"):u.red("Disabled")),console.log(u.cyan("API Key:"),t?u.green("Configured \u2713"):u.red("Not configured \u2717")),console.log(u.bold(`
|
|
1572
966
|
\u{1F4E6} Available Features:
|
|
1573
|
-
`)),console.log(
|
|
967
|
+
`)),console.log(u.white("\u2022 Module Recommender")+u.gray(" - AI-powered module suggestions")),console.log(u.gray(' Usage: rapidkit ai recommend "I need authentication"')),console.log(u.bold(`
|
|
1574
968
|
\u{1F4B0} Pricing:
|
|
1575
|
-
`)),console.log(
|
|
969
|
+
`)),console.log(u.white("\u2022 Per query: ~$0.0002")+u.gray(" (practically free)")),console.log(u.white("\u2022 100 queries: ~$0.02")+u.gray(" (2 cents)")),console.log(u.white("\u2022 1000 queries: ~$0.20")+u.gray(" (20 cents)")),console.log(u.bold(`
|
|
1576
970
|
\u{1F680} Getting Started:
|
|
1577
|
-
`)),t?(console.log(
|
|
971
|
+
`)),t?(console.log(u.green("\u2713 You're all set!")),console.log(u.white(' Try: rapidkit ai recommend "user authentication"'))):(console.log(u.white("1. Get OpenAI API key: https://platform.openai.com/api-keys")),console.log(u.white("2. Configure: rapidkit config set-api-key")),console.log(u.white('3. Try: rapidkit ai recommend "user authentication"'))),console.log();}),o.command("generate-embeddings").description("Generate AI embeddings for all modules (one-time setup)").option("--force","Force regeneration even if embeddings exist").action(async()=>{try{let t=le();t||(console.log(u.red(`
|
|
1578
972
|
\u274C OpenAI API key not configured
|
|
1579
|
-
`)),console.log(
|
|
1580
|
-
`)),console.log(
|
|
1581
|
-
OR set environment variable:`)),console.log(
|
|
1582
|
-
`)),process.exit(1)),
|
|
1583
|
-
`))),process.exit(n?0:1);}catch(t){
|
|
973
|
+
`)),console.log(u.cyan(`To generate embeddings, you need an OpenAI API key:
|
|
974
|
+
`)),console.log(u.white("1. Get your key from: https://platform.openai.com/api-keys")),console.log(u.white("2. Configure it: rapidkit config set-api-key")),console.log(u.gray(`
|
|
975
|
+
OR set environment variable:`)),console.log(u.white(` export OPENAI_API_KEY="sk-proj-..."
|
|
976
|
+
`)),process.exit(1)),Pe(t);let n=await Ce(true);n&&(console.log(u.green("\u2705 Ready to use AI recommendations!")),console.log(u.cyan(`Try: rapidkit ai recommend "authentication"
|
|
977
|
+
`))),process.exit(n?0:1);}catch(t){a.error("Failed to generate embeddings:",t.message),process.exit(1);}}),o.command("update-embeddings").description("Update existing embeddings with latest modules").action(async()=>{try{let t=le();t||(console.log(u.red(`
|
|
1584
978
|
\u274C OpenAI API key not configured
|
|
1585
|
-
`)),console.log(
|
|
1586
|
-
`)),process.exit(1)),
|
|
979
|
+
`)),console.log(u.white(`Set your API key: rapidkit config set-api-key
|
|
980
|
+
`)),process.exit(1)),Pe(t);let n=await Ft();process.exit(n?0:1);}catch(t){a.error("Failed to update embeddings:",t.message),process.exit(1);}});}function Le(e){if(!e||typeof e!="object")return null;let o=e.code;return o==="PYTHON_NOT_FOUND"||o==="BRIDGE_VENV_BOOTSTRAP_FAILED"?o:null}function Oo(e){let o=e.trim().toLowerCase();return o?o.startsWith("fastapi")?"fastapi":o.startsWith("nestjs")?"nestjs":null:null}function To(e,o){let t=e.indexOf(o);if(t>=0&&t+1<e.length)return e[t+1];let n=e.find(r=>r.startsWith(`${o}=`));if(n)return n.slice(o.length+1)}async function Ge(e,o){if(e.includes("--json"))return process.stderr.write("RapidKit (npm) offline fallback does not support --json for `create` commands.\nInstall Python 3.10+ and retry the same command.\n"),1;if(e[0]!=="create")return 1;if(e[1]!=="project")return process.stderr.write(`RapidKit (npm) could not run the Python core engine for \`create\`.
|
|
1587
981
|
Reason: ${o}.
|
|
1588
982
|
Install Python 3.10+ to use the interactive wizard and full kit catalog.
|
|
1589
983
|
`),1;let r=e[2],i=e[3];if(!r||!i)return process.stderr.write(`Usage: rapidkit create project <kit> <name> [--output <dir>]
|
|
1590
984
|
Tip: offline fallback supports only fastapi* and nestjs* kits.
|
|
1591
|
-
`),1;let s=
|
|
985
|
+
`),1;let s=Oo(r);if(!s)return process.stderr.write(`RapidKit (npm) could not run the Python core engine to create this kit.
|
|
1592
986
|
Reason: ${o}.
|
|
1593
987
|
Requested kit: ${r}
|
|
1594
988
|
Offline fallback only supports: fastapi.standard, nestjs.standard (and their shorthands).
|
|
1595
989
|
Install Python 3.10+ to access all kits.
|
|
1596
|
-
`),1;let
|
|
1597
|
-
`),1;let
|
|
1598
|
-
`),1}}async function
|
|
1599
|
-
`),
|
|
1600
|
-
`),1)}}if(e[0]==="create"&&e[1]!=="project")try{await
|
|
1601
|
-
`),1)}return await
|
|
1602
|
-
`),1)}}var
|
|
990
|
+
`),1;let l=To(e,"--output")||process.cwd(),a=w.resolve(l,i),c=e.includes("--skip-git")||e.includes("--no-git"),d=e.includes("--skip-install");try{if(await k.ensureDir(w.dirname(a)),await k.pathExists(a))return process.stderr.write(`\u274C Directory "${a}" already exists
|
|
991
|
+
`),1;let g="pip",p=$e(process.cwd());if(p)try{let{readWorkspaceMarker:y}=await import('./workspace-marker-IOPQ42A7.js'),P=await y(p);P?.metadata?.npm?.installMethod&&(g=P.metadata.npm.installMethod,console.log(`[DEBUG] Detected workspace engine: ${g}`));}catch(y){console.log("[DEBUG] Failed to read workspace marker:",y);}else console.log("[DEBUG] No workspace found, using default engine: pip");if(await k.ensureDir(a),await lt(a,{project_name:i,template:s,kit_name:r,skipGit:c,skipInstall:d,engine:g}),p){let{syncWorkspaceProjects:y}=await import('./workspace-LZZGJRGV.js');await y(p,true);}return 0}catch(g){return process.stderr.write(`RapidKit (npm) offline fallback failed: ${g?.message??g}
|
|
992
|
+
`),1}}async function No(e){let o=new Set(["--yes","-y","--skip-git","--skip-install","--debug","--dry-run","--no-update-check","--create-workspace","--no-workspace"]);try{if(e[0]==="create"&&e[1]==="project"){let t=e.includes("--create-workspace"),n=e.includes("--no-workspace"),r=e.includes("--yes")||e.includes("-y"),i=e.includes("--skip-git")||e.includes("--no-git");if(!!!Re(process.cwd())){if(t)await B(process.cwd(),{skipGit:i,yes:r,userConfig:await ie()});else if(!n)if(r)await B(process.cwd(),{skipGit:i,yes:true,userConfig:await ie()});else {let{createWs:a}=await Se.prompt([{type:"confirm",name:"createWs",message:"This project will be created outside a RapidKit workspace. Create and register a workspace here?",default:true}]);a&&await B(process.cwd(),{skipGit:i,yes:false,userConfig:await ie()});}}let l=e.filter(a=>{let c=a.split("=")[0];return !o.has(a)&&!o.has(c)});try{await c$1();let a$1=await d(l,{cwd:process.cwd()});if(a$1===0){let c=$e(process.cwd());if(c){try{let g=e[3];if(g){let p=e.indexOf("--output"),y=p>=0?e[p+1]:".",P=w.resolve(process.cwd(),y,g),v=w.join(c,".python-version"),C=w.join(P,".python-version");if(S.existsSync(v)&&S.existsSync(P)){let _=S.readFileSync(v,"utf-8");S.writeFileSync(C,_.trim()+`
|
|
993
|
+
`),a.debug(`Synced Python version ${_.trim()} from workspace to ${g}`);}}}catch(g){a.debug("Could not sync Python version from workspace:",g);}let{syncWorkspaceProjects:d}=await import('./workspace-LZZGJRGV.js');await d(c,true);}}return a$1}catch(a){let c=Le(a);return c?await Ge(l,c):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${a?.message??a}
|
|
994
|
+
`),1)}}if(e[0]==="create"&&e[1]!=="project")try{await c$1();let t=await d(e,{cwd:process.cwd()});if(t===0){let n=$e(process.cwd());if(n){let{syncWorkspaceProjects:r}=await import('./workspace-LZZGJRGV.js');await r(n,true);}}return t}catch(t){let n=Le(t);return n?await Ge(e,n):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${t?.message??t}
|
|
995
|
+
`),1)}return await c$1(),await d(e,{cwd:process.cwd()})}catch(t){let n=Le(t);return n?await Ge(e,n):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${t?.message??t}
|
|
996
|
+
`),1)}}var Lt=["init","dev","start","build","test","lint","format","create","help","--help","-h"];function Lo(e){let o=e;for(;;){let t=w.join(o,".rapidkit","context.json");if(S.existsSync(t))return t;let n=w.dirname(o);if(n===o)break;o=n;}return null}function Re(e){let o=e;for(;;){let t=w.join(o,".rapidkit-workspace");if(S.existsSync(t))return t;let n=w.dirname(o);if(n===o)break;o=n;}return null}function $e(e){let o=e;for(;;){let t=w.join(o,".rapidkit-workspace");if(S.existsSync(t))return o;let n=w.dirname(o);if(n===o)break;o=n;}return null}async function Go(){let e=process.cwd(),o=process.argv.slice(2);if(o[0]==="create")return false;try{let a=o[0],c=!a||a==="--help"||a==="-h"||a==="help";if(Re(e)&&c){let g=await d(a?["--help"]:[],{cwd:e});process.exit(g);}}catch{}try{let a=o[0],c=a==="shell"&&o[1]==="activate",d$1=a==="create",g=await Xe(e,{cwd:e,timeoutMs:1200});if(g.ok&&g.data?.isRapidkitProject&&g.data.engine==="python"&&!c&&!d$1){let p=await d(process.argv.slice(2),{cwd:e});process.exit(p);}}catch{}let t=Lo(e),n=process.platform==="win32",r=n?[w.join(e,"rapidkit.cmd"),w.join(e,"rapidkit"),w.join(e,".rapidkit","rapidkit.cmd"),w.join(e,".rapidkit","rapidkit")]:[w.join(e,"rapidkit"),w.join(e,".rapidkit","rapidkit")],i=null;for(let a of r)if(await k.pathExists(a)){i=a;break}let s=o[0],l=s==="create";if(i&&s&&Lt.includes(s)&&!l){a.debug(`Delegating to local CLI: ${i} ${o.join(" ")}`);let a$1=spawn(i,o,{stdio:"inherit",cwd:e,shell:n});return a$1.on("close",c=>{process.exit(c??0);}),a$1.on("error",c=>{a.error(`Failed to run local rapidkit: ${c.message}`),process.exit(1);}),true}if(t&&await k.pathExists(t))try{if((await k.readJson(t)).engine==="pip"){let c=o[0],g=process.platform==="win32"?[w.join(e,"rapidkit.cmd"),w.join(e,"rapidkit"),w.join(e,".rapidkit","rapidkit.cmd"),w.join(e,".rapidkit","rapidkit")]:[w.join(e,"rapidkit"),w.join(e,".rapidkit","rapidkit")],p=null;for(let P of g)if(await k.pathExists(P)){p=P;break}if(p&&c&&Lt.includes(c)){a.debug(`Delegating to local CLI (early detection): ${p} ${o.join(" ")}`);let P=spawn(p,o,{stdio:"inherit",cwd:e});return P.on("close",v=>process.exit(v??0)),P.on("error",v=>{a.error(`Failed to run local rapidkit: ${v.message}`),process.exit(1);}),true}if(c==="shell"&&o[1]==="activate"){let P=`# RapidKit: activation snippet - eval "$(rapidkit shell activate)"
|
|
1603
997
|
VENV='.venv'
|
|
1604
998
|
if [ -f "$VENV/bin/activate" ]; then
|
|
1605
999
|
. "$VENV/bin/activate"
|
|
@@ -1608,45 +1002,45 @@ elif [ -f "$VENV/bin/activate.fish" ]; then
|
|
|
1608
1002
|
fi
|
|
1609
1003
|
export RAPIDKIT_PROJECT_ROOT="$(pwd)"
|
|
1610
1004
|
export PATH="$(pwd)/.rapidkit:$(pwd):$PATH"
|
|
1611
|
-
`;console.log(
|
|
1005
|
+
`;console.log(u.green.bold(`
|
|
1612
1006
|
\u2705 Activation snippet \u2014 run the following to activate this project in your current shell:
|
|
1613
|
-
`)),console.log(
|
|
1007
|
+
`)),console.log(P),console.log(u.gray(`
|
|
1614
1008
|
\u{1F4A1} After activation you can run: rapidkit dev
|
|
1615
|
-
`)),process.exit(0);}let
|
|
1009
|
+
`)),process.exit(0);}let y=await d(o,{cwd:e});process.exit(y);}}catch{}return false}var J=null,Ae=false,V=new Command;async function Vo(e){if(e.length===0)return false;let o=e[0],t=e[1];if(o==="shell"&&t==="activate"||o==="workspace"||o==="doctor"||o==="ai"||o==="config")return false;if(e.includes("--tui"))return true;if(o==="--help"||o==="-h"||o==="help"||o==="--version"||o==="-V"||e.includes("--template")||e.includes("-t"))return false;let n=new Set(["--yes","-y","--skip-git","--skip-install","--debug","--dry-run","--no-update-check","--create-workspace","--no-workspace"]);if(e.some(i=>n.has(i)))return false;let r=await g();return r?r.has(o):!!(a$1.has(o)||e.length>1)}V.name("rapidkit").description("Create RapidKit workspaces and projects").version(c());V.addHelpText("beforeAll",`RapidKit
|
|
1616
1010
|
|
|
1617
1011
|
Global CLI
|
|
1618
1012
|
Create RapidKit workspaces and projects
|
|
1619
1013
|
|
|
1620
1014
|
Global Engine Commands
|
|
1621
1015
|
Access engine-level commands when inside a RapidKit workspace or via the core bridge
|
|
1622
|
-
`);
|
|
1016
|
+
`);V.addHelpText("afterAll",`
|
|
1623
1017
|
Project Commands
|
|
1624
1018
|
rapidkit create
|
|
1625
1019
|
rapidkit init
|
|
1626
1020
|
rapidkit dev
|
|
1627
1021
|
|
|
1628
1022
|
Use "rapidkit help <command>" for more information.
|
|
1629
|
-
`);
|
|
1023
|
+
`);V.argument("[name]","Name of the workspace or project directory").addOption(new Option("-t, --template <template>","Legacy: create a project with template (fastapi, nestjs) instead of a workspace").hideHelp()).option("-y, --yes","Skip prompts and use defaults").addOption(new Option("--skip-git","Skip git initialization").hideHelp()).addOption(new Option("--skip-install","Legacy: skip installing dependencies (template mode)").hideHelp()).option("--debug","Enable debug logging").addOption(new Option("--dry-run","Show what would be created without creating it").hideHelp()).addOption(new Option("--install-method <method>","Installation method: poetry, venv, or pipx").choices(["poetry","venv","pipx"]).hideHelp()).addOption(new Option("--create-workspace","When creating a project outside a workspace: create and register a workspace in the current directory").hideHelp()).addOption(new Option("--no-workspace","When creating a project outside a workspace: do not create a workspace").hideHelp()).option("--no-update-check","Skip checking for updates").action(async(e,o)=>{try{o.debug&&(a.setDebug(true),a.debug("Debug mode enabled"));let t=await ie();a.debug("User config loaded",t);let n=await Be();a.debug("RapidKit config loaded",n);let r=Ye(t,n,{author:o.author,skipGit:o.skipGit});a.debug("Merged config",r),o.updateCheck!==false&&await b(),console.log(u.blue.bold(`
|
|
1630
1024
|
\u{1F680} Welcome to RapidKit!
|
|
1631
|
-
`)),e||(
|
|
1632
|
-
\u274C ${
|
|
1633
|
-
`),process.exit(1)),
|
|
1634
|
-
\u274C Directory "${e}" already exists`),console.log(
|
|
1025
|
+
`)),e||(Uo(),process.exit(0));try{Qe(e);}catch(l){throw l instanceof N&&(a.error(`
|
|
1026
|
+
\u274C ${l.message}`),l.details&&a.warn(`\u{1F4A1} ${l.details}
|
|
1027
|
+
`),process.exit(1)),l}let i=w.resolve(process.cwd(),e);J=i,await k.pathExists(i)&&(a.error(`
|
|
1028
|
+
\u274C Directory "${e}" already exists`),console.log(u.cyan(`
|
|
1635
1029
|
\u{1F4A1} Choose a different name or delete the existing directory.
|
|
1636
|
-
`)),process.exit(1));let s=!!o.template;if(o.dryRun){console.log(
|
|
1030
|
+
`)),process.exit(1));let s=!!o.template;if(o.dryRun){console.log(u.cyan(`
|
|
1637
1031
|
\u{1F50D} Dry-run mode - showing what would be created:
|
|
1638
|
-
`)),console.log(
|
|
1639
|
-
`)),s){let
|
|
1640
|
-
`),
|
|
1641
|
-
`),
|
|
1642
|
-
\u274C ${t.message}`),t.details&&
|
|
1643
|
-
\u274C An unexpected error occurred:`),console.error(t)),process.exit(1);}finally{
|
|
1644
|
-
`)),console.log(
|
|
1645
|
-
`)),console.log(
|
|
1646
|
-
`)),console.log(
|
|
1647
|
-
`)),console.log(
|
|
1648
|
-
`));}process.on("SIGINT",async()=>{if(!
|
|
1649
|
-
|
|
1650
|
-
\u26A0\uFE0F Interrupted by user`)),
|
|
1651
|
-
`),o[0]==="create"){let n=await
|
|
1652
|
-
`),t){let n=await
|
|
1032
|
+
`)),console.log(u.white("\u{1F4C2} Path:"),i),console.log(u.white("\u{1F4E6} Type:"),s?`Project (${o.template})`:"Workspace"),console.log();return}if(!o.yes&&!s?await Se.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"}]):o.yes&&console.log(u.gray(`Using default values (--yes flag)
|
|
1033
|
+
`)),s){let l=String(o.template||"").trim(),a$1=l.toLowerCase(),c=a$1==="fastapi"?"fastapi.standard":a$1==="nestjs"?"nestjs.standard":l;if(!!!Re(process.cwd())){if(o.createWorkspace)await B(process.cwd(),{skipGit:o.skipGit,yes:o.yes,userConfig:t});else if(!o.noWorkspace)if(o.yes)await B(process.cwd(),{skipGit:o.skipGit,yes:true,userConfig:t});else {let{createWs:P}=await Se.prompt([{type:"confirm",name:"createWs",message:"This project will be created outside a RapidKit workspace. Create and register a workspace here?",default:true}]);P&&await B(process.cwd(),{skipGit:o.skipGit,yes:false,userConfig:t});}}let g=["create","project",c,e,"--output",process.cwd(),"--install-essentials"],p=await d(g,{cwd:process.cwd()});p!==0&&process.exit(p);let y=Re(process.cwd());if(y){let P=w.dirname(y),v=w.join(P,".python-version"),C=w.join(i,".python-version");try{if(await k.pathExists(v)){let _=S.readFileSync(v,"utf-8");S.writeFileSync(C,_.trim()+`
|
|
1034
|
+
`),a.debug(`Synced Python version ${_.trim()} from workspace to project`);}}catch(_){a.debug("Could not sync Python version from workspace:",_);}}if(!o.skipInstall){let P=await d(["init",i],{cwd:process.cwd()});if(P!==0&&process.exit(P),y){let v=w.dirname(y),C=w.join(v,".python-version"),_=w.join(i,".python-version");try{if(await k.pathExists(C)){let M=S.readFileSync(C,"utf-8");S.writeFileSync(_,M.trim()+`
|
|
1035
|
+
`),a.debug(`Re-synced Python version ${M.trim()} after init`);}}catch(M){a.debug("Could not re-sync Python version after init:",M);}}}}else await it(e,{skipGit:o.skipGit,dryRun:o.dryRun,yes:o.yes,userConfig:r,installMethod:o.installMethod});}catch(t){t instanceof N?(a.error(`
|
|
1036
|
+
\u274C ${t.message}`),t.details&&a.warn(`\u{1F4A1} ${t.details}`),a.debug("Error code:",t.code)):(a.error(`
|
|
1037
|
+
\u274C An unexpected error occurred:`),console.error(t)),process.exit(1);}finally{J=null;}});Tt(V);kt(V);V.command("shell <action>").description("Shell helpers (activate virtualenv in current shell)").action(async e=>{e!=="activate"&&(console.log(u.red(`Unknown shell command: ${e}`)),process.exit(1));let o=process.cwd();function t(a){let c=a;for(;;){let d=w.join(c,".rapidkit","context.json");if(S.existsSync(d))return d;let g=w.dirname(c);if(g===c)break;c=g;}return null}let n=t(o);function r(a){let c=a;for(;;){let d=w.join(c,".venv"),g=w.join(c,".rapidkit","activate");if(S.existsSync(g)||S.existsSync(d))return {venv:d,activateFile:g};let p=w.dirname(c);if(p===c)break;c=p;}return null}let i=r(o);!n&&!i&&(console.log(u.yellow("No RapidKit project found in this directory")),process.exit(1));let s;i&&S.existsSync(i.activateFile)?s=i.activateFile:i&&S.existsSync(i.venv)?s=process.platform==="win32"?w.join(i.venv,"Scripts","activate"):w.join(i.venv,"bin","activate"):(console.log(u.yellow("No virtual environment found")),process.exit(1));let l=process.platform==="win32";console.log(l?`call "${s}"`:`. "${s}"`);});V.command("doctor").description("\u{1FA7A} Check RapidKit environment health").option("--workspace","Check entire workspace (including all projects)").option("--json","Output results in JSON format (for CI/CD pipelines)").option("--fix","Automatically fix common issues (with confirmation)").action(async e=>{await ht(e);});V.command("workspace <action>").description("Manage RapidKit workspaces (list, sync)").action(async e=>{if(e==="list"){let{listWorkspaces:o}=await import('./workspace-LZZGJRGV.js');await o();}else if(e==="sync"){let o=$e(process.cwd());o||(console.log(u.red("\u274C Not inside a RapidKit workspace")),console.log(u.gray("\u{1F4A1} Run this command from within a workspace directory")),process.exit(1));let{syncWorkspaceProjects:t}=await import('./workspace-LZZGJRGV.js');console.log(u.cyan(`\u{1F4C2} Scanning workspace: ${w.basename(o)}`)),await t(o);}else console.log(u.red(`Unknown workspace action: ${e}`)),console.log(u.gray("Available: list, sync")),process.exit(1);});function Uo(){console.log(u.white(`Usage:
|
|
1038
|
+
`)),console.log(u.cyan(" npx rapidkit <workspace-name> [options]")),console.log(u.cyan(` npx rapidkit create <...>
|
|
1039
|
+
`)),console.log(u.bold("Recommended workflow:")),console.log(u.cyan(" npx rapidkit my-workspace")),console.log(u.cyan(" cd my-workspace")),console.log(u.cyan(" npx rapidkit create project fastapi.standard my-api --output .")),console.log(u.cyan(" cd my-api")),console.log(u.cyan(` npx rapidkit init && npx rapidkit dev
|
|
1040
|
+
`)),console.log(u.bold("Options (workspace creation):")),console.log(u.gray(" -y, --yes Skip prompts and use defaults")),console.log(u.gray(" --skip-git Skip git initialization")),console.log(u.gray(" --debug Enable debug logging")),console.log(u.gray(" --dry-run Show what would be created")),console.log(u.gray(" --create-workspace When creating a project outside a workspace: create and register a workspace in the current directory")),console.log(u.gray(" --no-workspace When creating a project outside a workspace: do not create a workspace")),console.log(u.gray(` --no-update-check Skip checking for updates
|
|
1041
|
+
`)),console.log(u.gray(`Tip: set RAPIDKIT_SHOW_LEGACY=1 to show legacy template flags in help.
|
|
1042
|
+
`));}process.on("SIGINT",async()=>{if(!Ae){if(Ae=true,console.log(u.yellow(`
|
|
1043
|
+
|
|
1044
|
+
\u26A0\uFE0F Interrupted by user`)),J&&await k.pathExists(J)){console.log(u.gray("Cleaning up partial installation..."));try{await k.remove(J),console.log(u.green("\u2713 Cleanup complete"));}catch(e){a.debug("Cleanup failed:",e);}}process.exit(130);}});process.on("SIGTERM",async()=>{if(!Ae){if(Ae=true,a.debug("Received SIGTERM"),J&&await k.pathExists(J))try{await k.remove(J);}catch(e){a.debug("Cleanup failed:",e);}process.exit(143);}});Go().then(async e=>{if(!e){let o=process.argv.slice(2);if(process.env.RAPIDKIT_NPM_DEBUG_ARGS==="1"&&process.stderr.write(`[rapidkit-npm] argv=${JSON.stringify(o)}
|
|
1045
|
+
`),o[0]==="create"){let n=await No(o);process.exit(n);}let t=await Vo(o);if(process.env.RAPIDKIT_NPM_DEBUG_ARGS==="1"&&process.stderr.write(`[rapidkit-npm] shouldForwardToCore=${t}
|
|
1046
|
+
`),t){let n=await d(o,{cwd:process.cwd()});process.exit(n);}V.parse();}});export{No as handleCreateOrFallback};
|