rapidkit 0.16.5 → 0.17.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 CHANGED
@@ -313,6 +313,9 @@ npx rapidkit info module <name> # Module details
313
313
 
314
314
  # System
315
315
  npx rapidkit doctor # Diagnose environment
316
+ npx rapidkit doctor --workspace # Check entire workspace
317
+ npx rapidkit doctor --workspace --json # JSON output (CI/CD)
318
+ npx rapidkit doctor --workspace --fix # Auto-fix issues
316
319
  npx rapidkit --version # Show version
317
320
  npx rapidkit --tui # Launch interactive TUI
318
321
 
@@ -321,6 +324,42 @@ npx rapidkit workspace list # List workspaces
321
324
  npx rapidkit workspace sync # Sync projects
322
325
  ```
323
326
 
327
+ ### Doctor Command (Health Check)
328
+
329
+ The enhanced `doctor` command provides comprehensive health monitoring:
330
+
331
+ ```bash
332
+ # System check (basic)
333
+ rapidkit doctor
334
+
335
+ # Workspace check (detailed)
336
+ rapidkit doctor --workspace
337
+ # ✅ Health score with visual progress bar
338
+ # ✅ System tools validation (Python, Poetry, pipx, Core)
339
+ # ✅ Project-level checks (venv, dependencies, modules)
340
+ # ✅ Environment file validation (.env)
341
+ # ✅ Module structure integrity
342
+ # ✅ Version compatibility warnings
343
+ # ✅ Actionable fix commands
344
+
345
+ # JSON output for CI/CD pipelines
346
+ rapidkit doctor --workspace --json
347
+
348
+ # Auto-fix common issues
349
+ rapidkit doctor --workspace --fix
350
+ # Interactive confirmation before applying fixes
351
+ ```
352
+
353
+ **Features:**
354
+ - **Health Score**: Visual percentage with pass/warn/error breakdown
355
+ - **Fix Commands**: Project-specific commands to resolve issues
356
+ - **JSON Mode**: Machine-readable output for automation
357
+ - **Auto-Fix**: Apply fixes automatically with confirmation
358
+ - **Module Checks**: Validates `__init__.py` files
359
+ - **Environment Checks**: Detects missing `.env` files
360
+ - **Version Compatibility**: Warns about Core/CLI mismatches
361
+ ```
362
+
324
363
  ### Workspace Commands
325
364
 
326
365
  ```bash
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env node
2
- import v from'path';import {fileURLToPath,pathToFileURL}from'url';import g from'chalk';import {execa}from'execa';import {createRequire}from'module';import*as z from'os';import z__default from'os';import*as I from'fs-extra';import T,{promises}from'fs';import wt from'ora';import {Command,Option}from'commander';import Jt from'inquirer';import {spawn}from'child_process';import ze from'validate-npm-package-name';import Ri from'nunjucks';import Ci from'crypto';var Me=Object.defineProperty;var at=(t,e)=>()=>(t&&(e=t(t=0)),e);var Nt=(t,e)=>{for(var i in e)Me(t,i,{get:e[i],enumerable:true});};var $=at(()=>{});var Dt,u,st=at(()=>{$();Dt=class{debugEnabled=false;setDebug(e){this.debugEnabled=e;}debug(e,...i){this.debugEnabled&&console.log(g.gray(`[DEBUG] ${e}`),...i);}info(e,...i){console.log(g.blue(e),...i);}success(e,...i){console.log(g.green(e),...i);}warn(e,...i){console.log(g.yellow(e),...i);}error(e,...i){console.error(g.red(e),...i);}step(e,i,o){console.log(g.cyan(`
3
- [${e}/${i}]`),g.white(o));}},u=new Dt;});async function te(){try{u.debug("Checking for updates...");let{stdout:t}=await execa("npm",["view",Ge,"version"],{timeout:3e3}),e=t.trim();e&&e!==Tt?(console.log(g.yellow(`
4
- \u26A0\uFE0F Update available: ${Tt} \u2192 ${e}`)),console.log(g.cyan(`Run: npm install -g rapidkit@latest
5
- `))):u.debug("You are using the latest version");}catch{u.debug("Could not check for updates");}}function U(){return Tt}var Ge,Ve,Ue,Tt,gt=at(()=>{$();st();Ge="rapidkit",Ve=createRequire(import.meta.url),Ue=Ve("../package.json"),Tt=Ue?.version??"0.0.0";});var Gt={};Nt(Gt,{__test__:()=>ai,checkRapidkitCoreAvailable:()=>me,getCachedCoreTopLevelCommands:()=>Lt,getCoreTopLevelCommands:()=>ni,resolveRapidkitPython:()=>dt,runCoreRapidkit:()=>B,runCoreRapidkitCapture:()=>Wt});function Mt(t){return t instanceof lt?t.code==="PYTHON_NOT_FOUND"?"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.":`RapidKit (npm) bridge error: ${t.message}`:`RapidKit (npm) failed to run the Python core engine: ${t instanceof Error?t.message:String(t)}`}function ti(){let t=process.env.RAPIDKIT_CORE_PYTHON_PACKAGE;return t&&t.trim()?t.trim():"rapidkit-core"}function pe(){let t=process.env.XDG_CACHE_HOME;return t&&t.trim()?t:v.join(z__default.homedir(),".cache")}function Ot(){return v.join(pe(),"rapidkit","npm-bridge","venv")}function ae(t){return process.platform==="win32"?v.join(t,"Scripts","python.exe"):v.join(t,"bin","python")}function se(t){return process.platform==="win32"?v.join(t,"Scripts","rapidkit.exe"):v.join(t,"bin","rapidkit")}function le(){return v.join(pe(),"rapidkit","npm-bridge","core-commands.json")}async function de(t){let e=!!process.env.RAPIDKIT_DEBUG,i=o=>{e&&process.stderr.write(`[DEBUG] tryRapidkit(${t}): ${o}
6
- `);};try{i("probing interpreter-specific rapidkit script");let r=((await execa(t,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"],{reject:!1,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(i(`script path: ${r}`),r)try{if(await I.pathExists(r)){i(`found script at ${r}; invoking --version --json`);let n=await execa(r,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(i(`script exitCode=${n.exitCode}`),n.exitCode===0){let a=(n.stdout??"").toString().trim();try{let s=JSON.parse(a),c=!!s&&typeof s=="object"&&s!==null&&"version"in s;if(i(`script JSON parse ok=${c}`),c)return !0}catch{i("script output not valid JSON");}}}}catch(n){i(`interpreter-specific script probe failed: ${String(n)}`);}}catch(o){i(`interpreter-specific script probe error: ${String(o)}`);}try{i('probing importlib.find_spec("rapidkit")');let o=await execa(t,["-c","import importlib.util; print(1 if importlib.util.find_spec('rapidkit') else 0)"],{reject:!1,stdio:"pipe",timeout:2e3});if(i(`import probe exitCode=${o.exitCode} stdout=${(o.stdout??"").toString().trim()}`),o.exitCode===0&&(o.stdout??"").toString().trim()==="1")return !0}catch(o){i(`import probe error: ${String(o)}`);}try{i("probing python -m rapidkit");let o=await execa(t,["-m","rapidkit","--version","--json"],{reject:!1,stdio:"pipe",timeout:8e3});if(i(`-m probe exitCode=${o.exitCode}`),o.exitCode===0)return !0}catch(o){i(`-m probe error: ${String(o)}`);}try{i("probing PATH for rapidkit executables");let o=(process.env.PATH??"").split(v.delimiter).filter(Boolean);for(let r of o){let n=v.join(r,process.platform==="win32"?"rapidkit.exe":"rapidkit");try{if(await I.pathExists(n)){i(`found candidate on PATH: ${n}; invoking --version --json`);let a=await execa(n,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(i(`candidate exitCode=${a.exitCode}`),a.exitCode===0){let s=(a.stdout??"").toString().trim();try{let c=JSON.parse(s);if(c&&typeof c=="object"&&c!==null&&"version"in c)return !0}catch{i("candidate output not valid JSON, skipping");}}}}catch(a){i(`error probing candidate ${n}: ${String(a)}`);}}return i("no valid rapidkit found on PATH"),!1}catch(o){return i(`PATH probe error: ${String(o)}`),false}}async function Ft(t){let e=(t??"").toString().trim();if(!e)return false;try{let i=JSON.parse(e);return !!i&&typeof i=="object"&&i!==null&&"version"in i}catch{return false}}async function ei(t){let e=process.platform==="win32",i=e?v.join(".venv","Scripts","rapidkit.exe"):v.join(".venv","bin","rapidkit"),o=e?v.join(".venv","Scripts","python.exe"):v.join(".venv","bin","python"),r=t;for(let n=0;n<25;n+=1){let a=v.join(r,i);if(await I.pathExists(a)){let p=await execa(a,["--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:r});if(p.exitCode===0&&await Ft(p.stdout))return {cmd:a,baseArgs:[]}}let s=v.join(r,o);if(await I.pathExists(s)){let p=await execa(s,["-m","rapidkit","--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:r});if(p.exitCode===0&&await Ft(p.stdout))return {cmd:s,baseArgs:["-m","rapidkit"]}}let c=v.dirname(r);if(c===r)break;r=c;}return null}async function ii(t){try{let e=v.join(t,".python-version");if(await I.pathExists(e)){let o=(await I.readFile(e,"utf-8")).trim();if(o)return o}}catch{}try{let e=v.join(t,".rapidkit-workspace");if(await I.pathExists(e)){let i=await I.readFile(e,"utf-8"),o=JSON.parse(i);if(o.pythonVersion)return o.pythonVersion}}catch{}return null}async function ue(t){if(t&&t.trim())try{let n=await ei(t);if(n){let a=v.dirname(n.cmd).includes(".venv")?v.dirname(v.dirname(v.dirname(n.cmd))):v.dirname(n.cmd),s=await ii(a);return s&&(process.env.PYENV_VERSION=s),n}}catch{}let e=await dt();if(e.kind==="venv"){let n=Ot(),a=se(n);return await I.pathExists(a)?{cmd:a,baseArgs:[]}:{cmd:e.pythonPath,baseArgs:["-m","rapidkit"]}}try{if((await execa(e.cmd,["-m","rapidkit","--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3})).exitCode===0)return {cmd:e.cmd,baseArgs:["-m","rapidkit"]}}catch{}try{let a=((await execa(e.cmd,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"],{reject:!1,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(a&&await I.pathExists(a))try{let s=await execa(a,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(s.exitCode===0&&await Ft(s.stdout))return {cmd:a,baseArgs:[]}}catch{}}catch{}let i=Ot(),o=await bt(e.cmd),r=se(i);return await I.pathExists(r)?{cmd:r,baseArgs:[]}:{cmd:o,baseArgs:["-m","rapidkit"]}}async function Kt(){for(let t of ["python3","python"])try{return await execa(t,["--version"],{reject:!1,stdio:"pipe",timeout:2e3}),t}catch{}return null}async function me(){let t=!!process.env.RAPIDKIT_DEBUG,e=i=>{t&&process.stderr.write(`[DEBUG] checkRapidkitCore: ${i}
7
- `);};for(let i of ["python3","python","python3.10","python3.11","python3.12"])try{e(`Method 1: trying ${i} import`);let o=await execa(i,["-c","import rapidkit_core; print(1)"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout?.trim()==="1")return e(`\u2713 Found via ${i} import`),!0}catch{continue}for(let i of ["python3","python"])try{e(`Method 2: trying ${i} -m pip show`);let o=await execa(i,["-m","pip","show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout?.includes("Name: rapidkit-core"))return e(`\u2713 Found via ${i} -m pip show`),!0}catch{continue}for(let i of ["pip","pip3"])try{e(`Method 3: trying ${i} show`);let o=await execa(i,["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout?.includes("Name: rapidkit-core"))return e(`\u2713 Found via ${i} show`),!0}catch{continue}try{e("Method 4: checking pyenv versions");let i=await execa("pyenv",["versions","--bare"],{reject:!1,stdio:"pipe",timeout:3e3});if(i.exitCode===0&&i.stdout){let o=i.stdout.split(`
8
- `).filter(r=>r.trim());e(`Found pyenv versions: ${o.join(", ")}`);for(let r of o){let n=process.env.PYENV_ROOT||v.join(z__default.homedir(),".pyenv"),a=v.join(n,"versions",r.trim(),"bin","pip");try{let s=await execa(a,["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(s.exitCode===0&&s.stdout?.includes("Name: rapidkit-core"))return e(`\u2713 Found in pyenv ${r}`),!0}catch{try{let s=await execa("bash",["-c",`PYENV_VERSION=${r.trim()} pyenv exec pip show rapidkit-core`],{reject:!1,stdio:"pipe",timeout:3e3});if(s.exitCode===0&&s.stdout?.includes("Name: rapidkit-core"))return e(`\u2713 Found in pyenv ${r} via PYENV_VERSION`),!0}catch{continue}}}}}catch{e("pyenv not available");}for(let i of ["python3","python"])try{e(`Method 5: checking ${i} user site`);let o=await execa(i,["-m","site","--user-site"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout){let r=o.stdout.trim(),n=v.join(r,"rapidkit_core");if(await I.pathExists(n))return e("\u2713 Found in user site-packages"),!0}}catch{continue}try{e("Method 6: checking pipx");let i=await execa("pipx",["list"],{reject:!1,stdio:"pipe",timeout:3e3});if(i.exitCode===0&&i.stdout?.includes("rapidkit-core"))return e("\u2713 Found via pipx"),!0}catch{e("pipx not available");}try{if(e("Method 7: checking poetry"),(await execa("poetry",["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3})).exitCode===0)return e("\u2713 Found via poetry"),!0}catch{e("poetry check failed");}try{e("Method 8: checking conda");let i=await execa("conda",["list","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(i.exitCode===0&&i.stdout?.includes("rapidkit-core"))return e("\u2713 Found via conda"),!0}catch{e("conda not available");}return e("\u2717 Not found in any environment"),false}async function bt(t){let e=Ot(),i=ae(e);if(await I.pathExists(i))try{let n=await execa(i,["-c","import importlib.util; print(1 if importlib.util.find_spec('rapidkit') else 0)"],{reject:!1,stdio:"pipe",timeout:2e3});if(n.exitCode===0&&(n.stdout??"").toString().trim()==="1")return i;await I.remove(e);}catch{await I.remove(e);}let o={...process.env,PIP_DISABLE_PIP_VERSION_CHECK:"1",PIP_NO_PYTHON_VERSION_WARNING:"1"},r=async(n,a)=>{let s=await execa(n,a,{reject:false,stdio:["ignore","pipe","inherit"],env:o});if(s.exitCode===0)return;let c=(s.stdout??"").toString(),p=(s.stderr??"").toString(),l=[c,p].filter(Boolean).join(`
9
- `),d=l?`${n} ${a.join(" ")}
10
- ${l}`:`${n} ${a.join(" ")}`;throw new Error(d)};try{await I.ensureDir(v.dirname(e)),await r(t,["-m","venv",e]);let n=ae(e);if((await execa(n,["-m","pip","--version"],{reject:!1,stdio:"pipe",timeout:2e3})).exitCode!==0&&(await execa(n,["-m","ensurepip","--default-pip"],{reject:!1,stdio:["ignore","pipe","inherit"],env:o})).exitCode!==0)throw new Error(`Failed to install pip in virtual environment.
2
+ import w from'path';import {fileURLToPath,pathToFileURL}from'url';import m from'chalk';import {execa}from'execa';import {createRequire}from'module';import*as z from'os';import z__default from'os';import*as k from'fs-extra';import k__default from'fs-extra';import F,{promises}from'fs';import kt from'ora';import {Command,Option}from'commander';import Jt from'inquirer';import {spawn}from'child_process';import Xe from'validate-npm-package-name';import _i from'nunjucks';import Ii from'crypto';var Le=Object.defineProperty;var st=(t,i)=>()=>(t&&(i=t(t=0)),i);var Nt=(t,i)=>{for(var e in i)Le(t,e,{get:i[e],enumerable:true});};var R=st(()=>{});var Dt,f,ct=st(()=>{R();Dt=class{debugEnabled=false;setDebug(i){this.debugEnabled=i;}debug(i,...e){this.debugEnabled&&console.log(m.gray(`[DEBUG] ${i}`),...e);}info(i,...e){console.log(m.blue(i),...e);}success(i,...e){console.log(m.green(i),...e);}warn(i,...e){console.log(m.yellow(i),...e);}error(i,...e){console.error(m.red(i),...e);}step(i,e,o){console.log(m.cyan(`
3
+ [${i}/${e}]`),m.white(o));}},f=new Dt;});async function ee(){try{f.debug("Checking for updates...");let{stdout:t}=await execa("npm",["view",He,"version"],{timeout:3e3}),i=t.trim();i&&i!==Tt?(console.log(m.yellow(`
4
+ \u26A0\uFE0F Update available: ${Tt} \u2192 ${i}`)),console.log(m.cyan(`Run: npm install -g rapidkit@latest
5
+ `))):f.debug("You are using the latest version");}catch{f.debug("Could not check for updates");}}function H(){return Tt}var He,Be,Je,Tt,gt=st(()=>{R();ct();He="rapidkit",Be=createRequire(import.meta.url),Je=Be("../package.json"),Tt=Je?.version??"0.0.0";});var Lt={};Nt(Lt,{__test__:()=>li,checkRapidkitCoreAvailable:()=>fe,getCachedCoreTopLevelCommands:()=>Vt,getCoreTopLevelCommands:()=>ci,resolveRapidkitPython:()=>ut,runCoreRapidkit:()=>B,runCoreRapidkitCapture:()=>Wt});function Kt(t){return t instanceof dt?t.code==="PYTHON_NOT_FOUND"?"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.":`RapidKit (npm) bridge error: ${t.message}`:`RapidKit (npm) failed to run the Python core engine: ${t instanceof Error?t.message:String(t)}`}function oi(){let t=process.env.RAPIDKIT_CORE_PYTHON_PACKAGE;return t&&t.trim()?t.trim():"rapidkit-core"}function pe(){let t=process.env.XDG_CACHE_HOME;return t&&t.trim()?t:w.join(z__default.homedir(),".cache")}function Ft(){return w.join(pe(),"rapidkit","npm-bridge","venv")}function se(t){return process.platform==="win32"?w.join(t,"Scripts","python.exe"):w.join(t,"bin","python")}function ce(t){return process.platform==="win32"?w.join(t,"Scripts","rapidkit.exe"):w.join(t,"bin","rapidkit")}function de(){return w.join(pe(),"rapidkit","npm-bridge","core-commands.json")}async function ue(t){let i=!!process.env.RAPIDKIT_DEBUG,e=o=>{i&&process.stderr.write(`[DEBUG] tryRapidkit(${t}): ${o}
6
+ `);};try{e("probing interpreter-specific rapidkit script");let r=((await execa(t,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"],{reject:!1,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(e(`script path: ${r}`),r)try{if(await k.pathExists(r)){e(`found script at ${r}; invoking --version --json`);let n=await execa(r,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(e(`script exitCode=${n.exitCode}`),n.exitCode===0){let a=(n.stdout??"").toString().trim();try{let s=JSON.parse(a),c=!!s&&typeof s=="object"&&s!==null&&"version"in s;if(e(`script JSON parse ok=${c}`),c)return !0}catch{e("script output not valid JSON");}}}}catch(n){e(`interpreter-specific script probe failed: ${String(n)}`);}}catch(o){e(`interpreter-specific script probe error: ${String(o)}`);}try{e('probing importlib.find_spec("rapidkit")');let o=await execa(t,["-c","import importlib.util; print(1 if importlib.util.find_spec('rapidkit') else 0)"],{reject:!1,stdio:"pipe",timeout:2e3});if(e(`import probe exitCode=${o.exitCode} stdout=${(o.stdout??"").toString().trim()}`),o.exitCode===0&&(o.stdout??"").toString().trim()==="1")return !0}catch(o){e(`import probe error: ${String(o)}`);}try{e("probing python -m rapidkit");let o=await execa(t,["-m","rapidkit","--version","--json"],{reject:!1,stdio:"pipe",timeout:8e3});if(e(`-m probe exitCode=${o.exitCode}`),o.exitCode===0)return !0}catch(o){e(`-m probe error: ${String(o)}`);}try{e("probing PATH for rapidkit executables");let o=(process.env.PATH??"").split(w.delimiter).filter(Boolean);for(let r of o){let n=w.join(r,process.platform==="win32"?"rapidkit.exe":"rapidkit");try{if(await k.pathExists(n)){e(`found candidate on PATH: ${n}; invoking --version --json`);let a=await execa(n,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(e(`candidate exitCode=${a.exitCode}`),a.exitCode===0){let s=(a.stdout??"").toString().trim();try{let c=JSON.parse(s);if(c&&typeof c=="object"&&c!==null&&"version"in c)return !0}catch{e("candidate output not valid JSON, skipping");}}}}catch(a){e(`error probing candidate ${n}: ${String(a)}`);}}return e("no valid rapidkit found on PATH"),!1}catch(o){return e(`PATH probe error: ${String(o)}`),false}}async function Ot(t){let i=(t??"").toString().trim();if(!i)return false;try{let e=JSON.parse(i);return !!e&&typeof e=="object"&&e!==null&&"version"in e}catch{return false}}async function ni(t){let i=process.platform==="win32",e=i?w.join(".venv","Scripts","rapidkit.exe"):w.join(".venv","bin","rapidkit"),o=i?w.join(".venv","Scripts","python.exe"):w.join(".venv","bin","python"),r=t;for(let n=0;n<25;n+=1){let a=w.join(r,e);if(await k.pathExists(a)){let l=await execa(a,["--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:r});if(l.exitCode===0&&await Ot(l.stdout))return {cmd:a,baseArgs:[]}}let s=w.join(r,o);if(await k.pathExists(s)){let l=await execa(s,["-m","rapidkit","--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:r});if(l.exitCode===0&&await Ot(l.stdout))return {cmd:s,baseArgs:["-m","rapidkit"]}}let c=w.dirname(r);if(c===r)break;r=c;}return null}async function ri(t){try{let i=w.join(t,".python-version");if(await k.pathExists(i)){let o=(await k.readFile(i,"utf-8")).trim();if(o)return o}}catch{}try{let i=w.join(t,".rapidkit-workspace");if(await k.pathExists(i)){let e=await k.readFile(i,"utf-8"),o=JSON.parse(e);if(o.pythonVersion)return o.pythonVersion}}catch{}return null}async function me(t){if(t&&t.trim())try{let n=await ni(t);if(n){let a=w.dirname(n.cmd).includes(".venv")?w.dirname(w.dirname(w.dirname(n.cmd))):w.dirname(n.cmd),s=await ri(a);return s&&(process.env.PYENV_VERSION=s),n}}catch{}let i=await ut();if(i.kind==="venv"){let n=Ft(),a=ce(n);return await k.pathExists(a)?{cmd:a,baseArgs:[]}:{cmd:i.pythonPath,baseArgs:["-m","rapidkit"]}}try{if((await execa(i.cmd,["-m","rapidkit","--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3})).exitCode===0)return {cmd:i.cmd,baseArgs:["-m","rapidkit"]}}catch{}try{let a=((await execa(i.cmd,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"],{reject:!1,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(a&&await k.pathExists(a))try{let s=await execa(a,["--version","--json"],{reject:!1,stdio:"pipe",timeout:4e3});if(s.exitCode===0&&await Ot(s.stdout))return {cmd:a,baseArgs:[]}}catch{}}catch{}let e=Ft(),o=await $t(i.cmd),r=ce(e);return await k.pathExists(r)?{cmd:r,baseArgs:[]}:{cmd:o,baseArgs:["-m","rapidkit"]}}async function Mt(){for(let t of ["python3","python"])try{return await execa(t,["--version"],{reject:!1,stdio:"pipe",timeout:2e3}),t}catch{}return null}async function fe(){let t=!!process.env.RAPIDKIT_DEBUG,i=e=>{t&&process.stderr.write(`[DEBUG] checkRapidkitCore: ${e}
7
+ `);};for(let e of ["python3","python","python3.10","python3.11","python3.12"])try{i(`Method 1: trying ${e} import`);let o=await execa(e,["-c","import rapidkit_core; print(1)"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout?.trim()==="1")return i(`\u2713 Found via ${e} import`),!0}catch{continue}for(let e of ["python3","python"])try{i(`Method 2: trying ${e} -m pip show`);let o=await execa(e,["-m","pip","show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout?.includes("Name: rapidkit-core"))return i(`\u2713 Found via ${e} -m pip show`),!0}catch{continue}for(let e of ["pip","pip3"])try{i(`Method 3: trying ${e} show`);let o=await execa(e,["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout?.includes("Name: rapidkit-core"))return i(`\u2713 Found via ${e} show`),!0}catch{continue}try{i("Method 4: checking pyenv versions");let e=await execa("pyenv",["versions","--bare"],{reject:!1,stdio:"pipe",timeout:3e3});if(e.exitCode===0&&e.stdout){let o=e.stdout.split(`
8
+ `).filter(r=>r.trim());i(`Found pyenv versions: ${o.join(", ")}`);for(let r of o){let n=process.env.PYENV_ROOT||w.join(z__default.homedir(),".pyenv"),a=w.join(n,"versions",r.trim(),"bin","pip");try{let s=await execa(a,["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(s.exitCode===0&&s.stdout?.includes("Name: rapidkit-core"))return i(`\u2713 Found in pyenv ${r}`),!0}catch{try{let s=await execa("bash",["-c",`PYENV_VERSION=${r.trim()} pyenv exec pip show rapidkit-core`],{reject:!1,stdio:"pipe",timeout:3e3});if(s.exitCode===0&&s.stdout?.includes("Name: rapidkit-core"))return i(`\u2713 Found in pyenv ${r} via PYENV_VERSION`),!0}catch{continue}}}}}catch{i("pyenv not available");}for(let e of ["python3","python"])try{i(`Method 5: checking ${e} user site`);let o=await execa(e,["-m","site","--user-site"],{reject:!1,stdio:"pipe",timeout:3e3});if(o.exitCode===0&&o.stdout){let r=o.stdout.trim(),n=w.join(r,"rapidkit_core");if(await k.pathExists(n))return i("\u2713 Found in user site-packages"),!0}}catch{continue}try{i("Method 6: checking pipx");let e=await execa("pipx",["list"],{reject:!1,stdio:"pipe",timeout:3e3});if(e.exitCode===0&&e.stdout?.includes("rapidkit-core"))return i("\u2713 Found via pipx"),!0}catch{i("pipx not available");}try{if(i("Method 7: checking poetry"),(await execa("poetry",["show","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3})).exitCode===0)return i("\u2713 Found via poetry"),!0}catch{i("poetry check failed");}try{i("Method 8: checking conda");let e=await execa("conda",["list","rapidkit-core"],{reject:!1,stdio:"pipe",timeout:3e3});if(e.exitCode===0&&e.stdout?.includes("rapidkit-core"))return i("\u2713 Found via conda"),!0}catch{i("conda not available");}return i("\u2717 Not found in any environment"),false}async function $t(t){let i=Ft(),e=se(i);if(await k.pathExists(e))try{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(n.exitCode===0&&(n.stdout??"").toString().trim()==="1")return e;await k.remove(i);}catch{await k.remove(i);}let o={...process.env,PIP_DISABLE_PIP_VERSION_CHECK:"1",PIP_NO_PYTHON_VERSION_WARNING:"1"},r=async(n,a)=>{let s=await execa(n,a,{reject:false,stdio:["ignore","pipe","inherit"],env:o});if(s.exitCode===0)return;let c=(s.stdout??"").toString(),l=(s.stderr??"").toString(),p=[c,l].filter(Boolean).join(`
9
+ `),d=p?`${n} ${a.join(" ")}
10
+ ${p}`:`${n} ${a.join(" ")}`;throw new Error(d)};try{await k.ensureDir(w.dirname(i)),await r(t,["-m","venv",i]);let n=se(i);if((await execa(n,["-m","pip","--version"],{reject:!1,stdio:"pipe",timeout:2e3})).exitCode!==0&&(await execa(n,["-m","ensurepip","--default-pip"],{reject:!1,stdio:["ignore","pipe","inherit"],env:o})).exitCode!==0)throw new Error(`Failed to install pip in virtual environment.
11
11
  Your Python installation may be missing the ensurepip module.
12
- On Debian/Ubuntu, install: sudo apt install python3-venv python3-pip`);return process.env.RAPIDKIT_BRIDGE_UPGRADE_PIP==="1"&&await r(n,["-m","pip","install","-U","pip"]),await r(n,["-m","pip","install","-U",ti()]),n}catch(n){throw new lt("BRIDGE_VENV_BOOTSTRAP_FAILED",Mt(n))}}async function dt(){if(process.env.RAPIDKIT_BRIDGE_FORCE_VENV==="1"){let i=await Kt();if(!i)throw new lt("PYTHON_NOT_FOUND","No Python interpreter found (python3/python).");return {kind:"venv",pythonPath:await bt(i)}}for(let i of ["python3","python"])if(await de(i))return {kind:"system",cmd:i};let t=await Kt();if(!t)throw new lt("PYTHON_NOT_FOUND","No Python interpreter found (python3/python).");return {kind:"venv",pythonPath:await bt(t)}}async function B(t,e){try{let i=await ue(e?.cwd),o=i.cmd,r=[...i.baseArgs,...t],n=await execa(o,r,{cwd:e?.cwd,env:{...process.env,...e?.env},reject:!1,stdio:"inherit"});return typeof n.exitCode=="number"?n.exitCode:1}catch(i){return process.stderr.write(`${Mt(i)}
13
- `),1}}async function Wt(t,e){try{let i=await ue(e?.cwd),o=i.cmd,r=[...i.baseArgs,...t],n=await execa(o,r,{cwd:e?.cwd,env:{...process.env,...e?.env},reject:!1,stdio:"pipe"});return {exitCode:typeof n.exitCode=="number"?n.exitCode:1,stdout:(n.stdout??"").toString(),stderr:(n.stderr??"").toString()}}catch(i){return {exitCode:1,stdout:"",stderr:`${Mt(i)}
14
- `}}}function ge(t){let e=new Set,i=t.split(`
15
- `),o=false;for(let r of i){let n=r.replace(/\r$/,"");if(!o){/^\s*Commands:\s*$/i.test(n)&&(o=true);let c=n.match(/^\s*rapidkit\s+([a-z0-9_-]+)\b/i);if(c){let p=c[1].trim();p&&!p.startsWith("-")&&e.add(p);}continue}if(!n.trim())break;if(/^\s*(Options|Arguments|Usage|Commands)\s*:/i.test(n))continue;let a=n.match(/^\s*([a-z0-9][a-z0-9_-]*)\b/i);if(!a)continue;let s=a[1].trim();s&&!s.startsWith("-")&&e.add(s);}return e}async function fe(){let t=le();if(!await I.pathExists(t))return null;try{let e=await I.readJson(t);if(e&&e.schema_version===1&&Array.isArray(e.commands))return e}catch{}return null}async function oi(t){let e=le();await I.ensureDir(v.dirname(e)),await I.writeJson(e,t,{spaces:2});}async function ri(){let t=await Wt(["version","--json"],{cwd:process.cwd()});if(t.exitCode===0)try{let i=JSON.parse(t.stdout)?.version;return typeof i=="string"?i:void 0}catch{return}}async function ni(){let e=Date.now(),i=await fe(),o=await ri(),r=!!i?.commands?.length;if(r&&e-i.fetched_at<864e5&&(!o||!i.rapidkit_version||i.rapidkit_version===o))return new Set(i.commands);let n=await Wt(["--help"],{cwd:process.cwd()});if(n.exitCode!==0)return r&&i?.commands?new Set(i.commands):new Set;let a=ge(n.stdout);if(a.size===0)return new Set;let s=Array.from(a).sort();return await oi({schema_version:1,fetched_at:e,rapidkit_version:o,commands:s}),a}async function Lt(){let e=Date.now(),i=await fe();return !i||e-i.fetched_at>=864e5||!i.commands?.length?null:new Set(i.commands)}var lt,ai,$t=at(()=>{$();lt=class extends Error{code;constructor(e,i){super(i),this.code=e;}};ai={pickSystemPython:Kt,ensureBridgeVenv:bt,parseCoreCommandsFromHelp:ge,tryRapidkit:de,checkRapidkitCoreAvailable:me};});var we={};Nt(we,{createNpmWorkspaceMarker:()=>Ut,isValidWorkspaceMarker:()=>pi,readWorkspaceMarker:()=>Vt,updateWorkspaceMetadata:()=>ci,writeWorkspaceMarker:()=>Pt});async function Vt(t){let e=v.join(t,".rapidkit-workspace");try{if(await I.pathExists(e))return await I.readJson(e)}catch{return null}return null}async function Pt(t,e){let i=v.join(t,".rapidkit-workspace"),o=await Vt(t);o?.metadata&&(e.metadata={...o.metadata,...e.metadata}),await I.outputFile(i,JSON.stringify(e,null,2)+`
16
- `,"utf-8");}async function ci(t,e){let i=await Vt(t);return i?(i.metadata={...i.metadata,...e,vscode:e.vscode?{...i.metadata?.vscode,...e.vscode}:i.metadata?.vscode,npm:e.npm?{...i.metadata?.npm,...e.npm}:i.metadata?.npm,python:e.python?{...i.metadata?.python,...e.python}:i.metadata?.python},await Pt(t,i),true):false}function Ut(t,e,i){return {signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:e,createdAt:new Date().toISOString(),name:t,metadata:{npm:{packageVersion:e,installMethod:i,lastUsedAt:new Date().toISOString()}}}}function pi(t){if(!t||typeof t!="object")return false;let e=t;return e.signature==="RAPIDKIT_WORKSPACE"&&typeof e.createdBy=="string"&&typeof e.version=="string"&&typeof e.createdAt=="string"&&typeof e.name=="string"}var Bt=at(()=>{$();});var q={};Nt(q,{createProject:()=>hi,createWorkspace:()=>ui,listWorkspaces:()=>wi,registerProjectInWorkspace:()=>di,registerWorkspace:()=>ke,syncWorkspaceProjects:()=>li});async function ke(t,e){try{let i=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(z__default.homedir(),".config"),o=process.platform==="win32"?v.join(i,"rapidkit"):v.join(z__default.homedir(),".rapidkit"),r=v.join(o,"workspaces.json");await promises.mkdir(o,{recursive:!0});let n={workspaces:[]};try{let s=await promises.readFile(r,"utf8"),c=JSON.parse(s);c&&Array.isArray(c.workspaces)&&(n=c);}catch{}n.workspaces.some(s=>s.path===t)||(n.workspaces.push({name:e,path:t,mode:"full",projects:[]}),await promises.writeFile(r,JSON.stringify(n,null,2)));}catch{console.warn(g.gray("Note: Could not register workspace in shared registry"));}}async function li(t,e=false){try{let i=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(z__default.homedir(),".config"),o=process.platform==="win32"?v.join(i,"rapidkit"):v.join(z__default.homedir(),".rapidkit"),r=v.join(o,"workspaces.json"),n={workspaces:[]};try{let l=await promises.readFile(r,"utf8"),d=JSON.parse(l);d&&Array.isArray(d.workspaces)&&(n=d);}catch{e||console.log("\u26A0\uFE0F Workspace registry not found");return}let a=n.workspaces.find(l=>l.path===t);if(!a){e||console.log("\u26A0\uFE0F Workspace not registered in registry");return}Array.isArray(a.projects)||(a.projects=[]);let s=await promises.readdir(t,{withFileTypes:!0}),c=0,p=0;for(let l of s)if(l.isDirectory()&&!l.name.startsWith(".")){let d=v.join(t,l.name),m=v.join(d,".rapidkit","context.json"),y=v.join(d,".rapidkit","project.json");try{let f=!1;try{await promises.access(m),f=!0;}catch{await promises.access(y),f=!0;}f&&(a.projects.some(A=>A.path===d||A.name===l.name)?p++:(a.projects.push({name:l.name,path:d}),c++,e||console.log(`\u2714 Added: ${l.name}`)));}catch{}}c>0?(await promises.writeFile(r,JSON.stringify(n,null,2)),e||console.log(`
17
- \u2705 Synced ${c} project(s) to registry`)):e||console.log(`
18
- \u2705 All projects already registered (${p} found)`);}catch(i){e||console.error("\u274C Failed to sync projects:",i.message);}}async function di(t,e,i){try{let o=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(z__default.homedir(),".config"),r=process.platform==="win32"?v.join(o,"rapidkit"):v.join(z__default.homedir(),".rapidkit"),n=v.join(r,"workspaces.json");console.log(`[REGISTRY DEBUG] Registry file: ${n}`);let a={workspaces:[]};try{let p=await promises.readFile(n,"utf8"),l=JSON.parse(p);l&&Array.isArray(l.workspaces)&&(a=l),console.log(`[REGISTRY DEBUG] Registry loaded, ${a.workspaces.length} workspaces`);}catch{console.log("[REGISTRY DEBUG] Registry doesn't exist, returning");return}let s=a.workspaces.find(p=>p.path===t);if(!s){console.log("[REGISTRY DEBUG] Workspace not found in registry, returning");return}console.log(`[REGISTRY DEBUG] Workspace found: ${s.name}`),Array.isArray(s.projects)||(s.projects=[]),s.projects.some(p=>p.path===i||p.name===e)?console.log("[REGISTRY DEBUG] Project already exists in registry"):(console.log("[REGISTRY DEBUG] Adding project to registry"),s.projects.push({name:e,path:i}),await promises.writeFile(n,JSON.stringify(a,null,2)),console.log("[REGISTRY DEBUG] Registry updated successfully"));}catch(o){console.log(`[REGISTRY DEBUG] Error: ${o}`);}}async function ui(t,e){let i=wt("Creating RapidKit workspace...").start();try{await promises.mkdir(t,{recursive:!0}),await promises.mkdir(v.join(t,".rapidkit"),{recursive:!0});let o={workspace_name:e.name,author:e.author,rapidkit_version:U(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(v.join(t,".rapidkit","config.json"),JSON.stringify(o,null,2));let r=mi();await promises.writeFile(v.join(t,"rapidkit"),r),await promises.chmod(v.join(t,"rapidkit"),493);let n=gi(e.name);if(await promises.writeFile(v.join(t,"README.md"),n),await promises.writeFile(v.join(t,".gitignore"),`# RapidKit workspace
12
+ On Debian/Ubuntu, install: sudo apt install python3-venv python3-pip`);return process.env.RAPIDKIT_BRIDGE_UPGRADE_PIP==="1"&&await r(n,["-m","pip","install","-U","pip"]),await r(n,["-m","pip","install","-U",oi()]),n}catch(n){throw new dt("BRIDGE_VENV_BOOTSTRAP_FAILED",Kt(n))}}async function ut(){if(process.env.RAPIDKIT_BRIDGE_FORCE_VENV==="1"){let e=await Mt();if(!e)throw new dt("PYTHON_NOT_FOUND","No Python interpreter found (python3/python).");return {kind:"venv",pythonPath:await $t(e)}}for(let e of ["python3","python"])if(await ue(e))return {kind:"system",cmd:e};let t=await Mt();if(!t)throw new dt("PYTHON_NOT_FOUND","No Python interpreter found (python3/python).");return {kind:"venv",pythonPath:await $t(t)}}async function B(t,i){try{let e=await me(i?.cwd),o=e.cmd,r=[...e.baseArgs,...t],n=await execa(o,r,{cwd:i?.cwd,env:{...process.env,...i?.env},reject:!1,stdio:"inherit"});return typeof n.exitCode=="number"?n.exitCode:1}catch(e){return process.stderr.write(`${Kt(e)}
13
+ `),1}}async function Wt(t,i){try{let e=await me(i?.cwd),o=e.cmd,r=[...e.baseArgs,...t],n=await execa(o,r,{cwd:i?.cwd,env:{...process.env,...i?.env},reject:!1,stdio:"pipe"});return {exitCode:typeof n.exitCode=="number"?n.exitCode:1,stdout:(n.stdout??"").toString(),stderr:(n.stderr??"").toString()}}catch(e){return {exitCode:1,stdout:"",stderr:`${Kt(e)}
14
+ `}}}function ge(t){let i=new Set,e=t.split(`
15
+ `),o=false;for(let r of e){let n=r.replace(/\r$/,"");if(!o){/^\s*Commands:\s*$/i.test(n)&&(o=true);let c=n.match(/^\s*rapidkit\s+([a-z0-9_-]+)\b/i);if(c){let l=c[1].trim();l&&!l.startsWith("-")&&i.add(l);}continue}if(!n.trim())break;if(/^\s*(Options|Arguments|Usage|Commands)\s*:/i.test(n))continue;let a=n.match(/^\s*([a-z0-9][a-z0-9_-]*)\b/i);if(!a)continue;let s=a[1].trim();s&&!s.startsWith("-")&&i.add(s);}return i}async function he(){let t=de();if(!await k.pathExists(t))return null;try{let i=await k.readJson(t);if(i&&i.schema_version===1&&Array.isArray(i.commands))return i}catch{}return null}async function ai(t){let i=de();await k.ensureDir(w.dirname(i)),await k.writeJson(i,t,{spaces:2});}async function si(){let t=await Wt(["version","--json"],{cwd:process.cwd()});if(t.exitCode===0)try{let e=JSON.parse(t.stdout)?.version;return typeof e=="string"?e:void 0}catch{return}}async function ci(){let i=Date.now(),e=await he(),o=await si(),r=!!e?.commands?.length;if(r&&i-e.fetched_at<864e5&&(!o||!e.rapidkit_version||e.rapidkit_version===o))return new Set(e.commands);let n=await Wt(["--help"],{cwd:process.cwd()});if(n.exitCode!==0)return r&&e?.commands?new Set(e.commands):new Set;let a=ge(n.stdout);if(a.size===0)return new Set;let s=Array.from(a).sort();return await ai({schema_version:1,fetched_at:i,rapidkit_version:o,commands:s}),a}async function Vt(){let i=Date.now(),e=await he();return !e||i-e.fetched_at>=864e5||!e.commands?.length?null:new Set(e.commands)}var dt,li,Pt=st(()=>{R();dt=class extends Error{code;constructor(i,e){super(e),this.code=i;}};li={pickSystemPython:Mt,ensureBridgeVenv:$t,parseCoreCommandsFromHelp:ge,tryRapidkit:ue,checkRapidkitCoreAvailable:fe};});var ke={};Nt(ke,{createNpmWorkspaceMarker:()=>Ut,isValidWorkspaceMarker:()=>ui,readWorkspaceMarker:()=>Gt,updateWorkspaceMetadata:()=>di,writeWorkspaceMarker:()=>Ct});async function Gt(t){let i=w.join(t,".rapidkit-workspace");try{if(await k.pathExists(i))return await k.readJson(i)}catch{return null}return null}async function Ct(t,i){let e=w.join(t,".rapidkit-workspace"),o=await Gt(t);o?.metadata&&(i.metadata={...o.metadata,...i.metadata}),await k.outputFile(e,JSON.stringify(i,null,2)+`
16
+ `,"utf-8");}async function di(t,i){let e=await Gt(t);return e?(e.metadata={...e.metadata,...i,vscode:i.vscode?{...e.metadata?.vscode,...i.vscode}:e.metadata?.vscode,npm:i.npm?{...e.metadata?.npm,...i.npm}:e.metadata?.npm,python:i.python?{...e.metadata?.python,...i.python}:e.metadata?.python},await Ct(t,e),true):false}function Ut(t,i,e){return {signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:i,createdAt:new Date().toISOString(),name:t,metadata:{npm:{packageVersion:i,installMethod:e,lastUsedAt:new Date().toISOString()}}}}function ui(t){if(!t||typeof t!="object")return false;let i=t;return i.signature==="RAPIDKIT_WORKSPACE"&&typeof i.createdBy=="string"&&typeof i.version=="string"&&typeof i.createdAt=="string"&&typeof i.name=="string"}var Ht=st(()=>{R();});var q={};Nt(q,{createProject:()=>ki,createWorkspace:()=>gi,listWorkspaces:()=>xi,registerProjectInWorkspace:()=>fi,registerWorkspace:()=>ve,syncWorkspaceProjects:()=>mi});async function ve(t,i){try{let e=process.env.XDG_CONFIG_HOME||process.env.APPDATA||w.join(z__default.homedir(),".config"),o=process.platform==="win32"?w.join(e,"rapidkit"):w.join(z__default.homedir(),".rapidkit"),r=w.join(o,"workspaces.json");await promises.mkdir(o,{recursive:!0});let n={workspaces:[]};try{let s=await promises.readFile(r,"utf8"),c=JSON.parse(s);c&&Array.isArray(c.workspaces)&&(n=c);}catch{}n.workspaces.some(s=>s.path===t)||(n.workspaces.push({name:i,path:t,mode:"full",projects:[]}),await promises.writeFile(r,JSON.stringify(n,null,2)));}catch{console.warn(m.gray("Note: Could not register workspace in shared registry"));}}async function mi(t,i=false){try{let e=process.env.XDG_CONFIG_HOME||process.env.APPDATA||w.join(z__default.homedir(),".config"),o=process.platform==="win32"?w.join(e,"rapidkit"):w.join(z__default.homedir(),".rapidkit"),r=w.join(o,"workspaces.json"),n={workspaces:[]};try{let p=await promises.readFile(r,"utf8"),d=JSON.parse(p);d&&Array.isArray(d.workspaces)&&(n=d);}catch{i||console.log("\u26A0\uFE0F Workspace registry not found");return}let a=n.workspaces.find(p=>p.path===t);if(!a){i||console.log("\u26A0\uFE0F Workspace not registered in registry");return}Array.isArray(a.projects)||(a.projects=[]);let s=await promises.readdir(t,{withFileTypes:!0}),c=0,l=0;for(let p of s)if(p.isDirectory()&&!p.name.startsWith(".")){let d=w.join(t,p.name),u=w.join(d,".rapidkit","context.json"),h=w.join(d,".rapidkit","project.json");try{let y=!1;try{await promises.access(u),y=!0;}catch{await promises.access(h),y=!0;}y&&(a.projects.some(A=>A.path===d||A.name===p.name)?l++:(a.projects.push({name:p.name,path:d}),c++,i||console.log(`\u2714 Added: ${p.name}`)));}catch{}}c>0?(await promises.writeFile(r,JSON.stringify(n,null,2)),i||console.log(`
17
+ \u2705 Synced ${c} project(s) to registry`)):i||console.log(`
18
+ \u2705 All projects already registered (${l} found)`);}catch(e){i||console.error("\u274C Failed to sync projects:",e.message);}}async function fi(t,i,e){try{let o=process.env.XDG_CONFIG_HOME||process.env.APPDATA||w.join(z__default.homedir(),".config"),r=process.platform==="win32"?w.join(o,"rapidkit"):w.join(z__default.homedir(),".rapidkit"),n=w.join(r,"workspaces.json");console.log(`[REGISTRY DEBUG] Registry file: ${n}`);let a={workspaces:[]};try{let l=await promises.readFile(n,"utf8"),p=JSON.parse(l);p&&Array.isArray(p.workspaces)&&(a=p),console.log(`[REGISTRY DEBUG] Registry loaded, ${a.workspaces.length} workspaces`);}catch{console.log("[REGISTRY DEBUG] Registry doesn't exist, returning");return}let s=a.workspaces.find(l=>l.path===t);if(!s){console.log("[REGISTRY DEBUG] Workspace not found in registry, returning");return}console.log(`[REGISTRY DEBUG] Workspace found: ${s.name}`),Array.isArray(s.projects)||(s.projects=[]),s.projects.some(l=>l.path===e||l.name===i)?console.log("[REGISTRY DEBUG] Project already exists in registry"):(console.log("[REGISTRY DEBUG] Adding project to registry"),s.projects.push({name:i,path:e}),await promises.writeFile(n,JSON.stringify(a,null,2)),console.log("[REGISTRY DEBUG] Registry updated successfully"));}catch(o){console.log(`[REGISTRY DEBUG] Error: ${o}`);}}async function gi(t,i){let e=kt("Creating RapidKit workspace...").start();try{await promises.mkdir(t,{recursive:!0}),await promises.mkdir(w.join(t,".rapidkit"),{recursive:!0});let o={workspace_name:i.name,author:i.author,rapidkit_version:H(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(w.join(t,".rapidkit","config.json"),JSON.stringify(o,null,2));let r=hi();await promises.writeFile(w.join(t,"rapidkit"),r),await promises.chmod(w.join(t,"rapidkit"),493);let n=yi(i.name);if(await promises.writeFile(w.join(t,"README.md"),n),await promises.writeFile(w.join(t,".gitignore"),`# RapidKit workspace
19
19
  .env
20
20
  .env.*
21
21
  !.env.example
@@ -30,10 +30,10 @@ Thumbs.db
30
30
 
31
31
  # Logs
32
32
  *.log
33
- `),await promises.writeFile(v.join(t,".rapidkit-workspace"),JSON.stringify({signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:U(),createdAt:new Date().toISOString(),name:e.name},null,2)),await fi(t),i.succeed("Workspace created!"),!e.skipGit){let s=wt("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:t}),s.succeed("Git repository initialized");}catch{s.warn("Could not initialize git repository");}}await ke(t,e.name),console.log(`
34
- ${g.green("\u2728 RapidKit workspace created successfully!")}
33
+ `),await promises.writeFile(w.join(t,".rapidkit-workspace"),JSON.stringify({signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:H(),createdAt:new Date().toISOString(),name:i.name},null,2)),await wi(t),e.succeed("Workspace created!"),!i.skipGit){let s=kt("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:t}),s.succeed("Git repository initialized");}catch{s.warn("Could not initialize git repository");}}await ve(t,i.name),console.log(`
34
+ ${m.green("\u2728 RapidKit workspace created successfully!")}
35
35
 
36
- ${g.bold("\u{1F4C2} Workspace structure:")}
36
+ ${m.bold("\u{1F4C2} Workspace structure:")}
37
37
  ${t}/
38
38
  \u251C\u2500\u2500 rapidkit # Local CLI wrapper
39
39
  \u251C\u2500\u2500 .rapidkit/ # Workspace configuration
@@ -41,26 +41,26 @@ ${t}/
41
41
  \u2502 \u2514\u2500\u2500 templates/ # Project templates
42
42
  \u2514\u2500\u2500 README.md
43
43
 
44
- ${g.bold("\u{1F680} Get started:")}
45
- ${g.cyan(`cd ${e.name}`)}
46
- ${g.cyan("npx rapidkit my-api --template fastapi")}
47
- ${g.cyan("cd my-api")}
48
- ${g.cyan("npx rapidkit init")}
49
- ${g.cyan("npx rapidkit dev")}
44
+ ${m.bold("\u{1F680} Get started:")}
45
+ ${m.cyan(`cd ${i.name}`)}
46
+ ${m.cyan("npx rapidkit my-api --template fastapi")}
47
+ ${m.cyan("cd my-api")}
48
+ ${m.cyan("npx rapidkit init")}
49
+ ${m.cyan("npx rapidkit dev")}
50
50
 
51
- ${g.bold("\u{1F4E6} Available templates:")}
51
+ ${m.bold("\u{1F4E6} Available templates:")}
52
52
  fastapi - FastAPI + Python (default)
53
53
  nestjs - NestJS + TypeScript
54
54
 
55
- ${g.bold("\u{1F4DA} Commands:")}
55
+ ${m.bold("\u{1F4DA} Commands:")}
56
56
  npx rapidkit <name> --template <type> Create a new project
57
57
  npx rapidkit init Install dependencies
58
58
  npx rapidkit dev Start dev server
59
59
  npx rapidkit help Show all commands
60
60
 
61
- ${g.gray("Alternative: ./rapidkit dev, make dev")}
62
- ${g.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
63
- `);}catch(o){throw i.fail("Failed to create workspace"),o}}function mi(){return `#!/usr/bin/env bash
61
+ ${m.gray("Alternative: ./rapidkit dev, make dev")}
62
+ ${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
63
+ `);}catch(o){throw e.fail("Failed to create workspace"),o}}function hi(){return `#!/usr/bin/env bash
64
64
  #
65
65
  # RapidKit CLI - Local workspace commands
66
66
  # This script provides rapidkit commands within the workspace
@@ -396,7 +396,7 @@ main() {
396
396
  print_help
397
397
  ;;
398
398
  version|-v|--version)
399
- echo "RapidKit CLI (npm workspace) v${U()}"
399
+ echo "RapidKit CLI (npm workspace) v${H()}"
400
400
  ;;
401
401
  *)
402
402
  echo -e "\${RED}\u274C Unknown command: $cmd\${NC}"
@@ -408,7 +408,7 @@ main() {
408
408
  }
409
409
 
410
410
  main "$@"
411
- `}function gi(t){return `# ${t}
411
+ `}function yi(t){return `# ${t}
412
412
 
413
413
  RapidKit workspace for building API projects.
414
414
 
@@ -456,7 +456,7 @@ npx rapidkit dev # Start dev server
456
456
 
457
457
  - [RapidKit Documentation](https://rapidkit.dev)
458
458
  - [GitHub Repository](https://github.com/Baziar/rapidkit)
459
- `}async function fi(t){let{fileURLToPath:e}=await import('url'),i=e(import.meta.url),o=v.dirname(i),r=v.resolve(o,".."),n=v.join(r,"templates","kits"),a=v.join(t,".rapidkit","templates"),{default:s}=await import('fs-extra');await s.copy(n,a);let c=v.join(r,"templates","generator.js"),p=v.join(t,".rapidkit","generator.js");await s.copy(c,p);}async function hi(t,e){let i=e.template==="fastapi",o=i?"FastAPI":"NestJS",r=wt(`Creating ${o} project...`).start();try{let{fileURLToPath:n}=await import('url'),a=n(import.meta.url),s=v.dirname(a),c=v.resolve(s,".."),p=i?"fastapi-standard":"nestjs-standard",l=v.join(c,"templates","kits",p);await promises.mkdir(t,{recursive:!0});let d={project_name:i?e.name.replace(/-/g,"_").toLowerCase():e.name.replace(/_/g,"-").toLowerCase(),author:e.author,description:e.description||`${o} application generated with RapidKit`,app_version:"0.1.0",license:"MIT",package_manager:e.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:U()};await ve(l,t,d);let m=i?`# Python
459
+ `}async function wi(t){let{fileURLToPath:i}=await import('url'),e=i(import.meta.url),o=w.dirname(e),r=w.resolve(o,".."),n=w.join(r,"templates","kits"),a=w.join(t,".rapidkit","templates"),{default:s}=await import('fs-extra');await s.copy(n,a);let c=w.join(r,"templates","generator.js"),l=w.join(t,".rapidkit","generator.js");await s.copy(c,l);}async function ki(t,i){let e=i.template==="fastapi",o=e?"FastAPI":"NestJS",r=kt(`Creating ${o} project...`).start();try{let{fileURLToPath:n}=await import('url'),a=n(import.meta.url),s=w.dirname(a),c=w.resolve(s,".."),l=e?"fastapi-standard":"nestjs-standard",p=w.join(c,"templates","kits",l);await promises.mkdir(t,{recursive:!0});let d={project_name:e?i.name.replace(/-/g,"_").toLowerCase():i.name.replace(/_/g,"-").toLowerCase(),author:i.author,description:i.description||`${o} application generated with RapidKit`,app_version:"0.1.0",license:"MIT",package_manager:i.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:H()};await xe(p,t,d);let u=e?`# Python
460
460
  __pycache__/
461
461
  *.py[cod]
462
462
  *$py.class
@@ -524,10 +524,10 @@ Thumbs.db
524
524
 
525
525
  # Coverage
526
526
  coverage/
527
- `;if(await promises.writeFile(v.join(t,".gitignore"),m),r.succeed(`${o} project created!`),!e.skipGit){let f=wt("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m",`Initial commit: ${o} project via RapidKit`],{cwd:t}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}if(!e.skipInstall&&!i){let f=e.package_manager||"npm",w=wt(`Installing dependencies with ${f}...`).start();try{await execa(f,["install"],{cwd:t}),w.succeed("Dependencies installed");}catch{w.warn(`Could not install dependencies. Run '${f} install' manually.`);}}let y=v.basename(t);console.log(i?`
528
- ${g.green("\u2728 FastAPI project created successfully!")}
527
+ `;if(await promises.writeFile(w.join(t,".gitignore"),u),r.succeed(`${o} project created!`),!i.skipGit){let y=kt("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m",`Initial commit: ${o} project via RapidKit`],{cwd:t}),y.succeed("Git repository initialized");}catch{y.warn("Could not initialize git repository");}}if(!i.skipInstall&&!e){let y=i.package_manager||"npm",x=kt(`Installing dependencies with ${y}...`).start();try{await execa(y,["install"],{cwd:t}),x.succeed("Dependencies installed");}catch{x.warn(`Could not install dependencies. Run '${y} install' manually.`);}}let h=w.basename(t);console.log(e?`
528
+ ${m.green("\u2728 FastAPI project created successfully!")}
529
529
 
530
- ${g.bold("\u{1F4C2} Project structure:")}
530
+ ${m.bold("\u{1F4C2} Project structure:")}
531
531
  ${t}/
532
532
  \u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
533
533
  \u251C\u2500\u2500 src/
@@ -539,12 +539,12 @@ ${t}/
539
539
  \u251C\u2500\u2500 pyproject.toml # Poetry configuration
540
540
  \u2514\u2500\u2500 README.md
541
541
 
542
- ${g.bold("\u{1F680} Get started:")}
543
- ${g.cyan(`cd ${y}`)}
544
- ${g.cyan("npx rapidkit init")} ${g.gray("# Install dependencies")}
545
- ${g.cyan("npx rapidkit dev")} ${g.gray("# Start dev server")}
542
+ ${m.bold("\u{1F680} Get started:")}
543
+ ${m.cyan(`cd ${h}`)}
544
+ ${m.cyan("npx rapidkit init")} ${m.gray("# Install dependencies")}
545
+ ${m.cyan("npx rapidkit dev")} ${m.gray("# Start dev server")}
546
546
 
547
- ${g.bold("\u{1F4DA} Available commands:")}
547
+ ${m.bold("\u{1F4DA} Available commands:")}
548
548
  npx rapidkit init # Install dependencies (poetry install)
549
549
  npx rapidkit dev # Start dev server with hot reload
550
550
  npx rapidkit start # Start production server
@@ -552,12 +552,12 @@ ${g.bold("\u{1F4DA} Available commands:")}
552
552
  npx rapidkit lint # Lint code
553
553
  npx rapidkit format # Format code
554
554
 
555
- ${g.gray("Alternative: make dev, ./rapidkit dev, poetry run dev")}
556
- ${g.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
555
+ ${m.gray("Alternative: make dev, ./rapidkit dev, poetry run dev")}
556
+ ${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
557
557
  `:`
558
- ${g.green("\u2728 NestJS project created successfully!")}
558
+ ${m.green("\u2728 NestJS project created successfully!")}
559
559
 
560
- ${g.bold("\u{1F4C2} Project structure:")}
560
+ ${m.bold("\u{1F4C2} Project structure:")}
561
561
  ${t}/
562
562
  \u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
563
563
  \u251C\u2500\u2500 src/
@@ -569,13 +569,13 @@ ${t}/
569
569
  \u251C\u2500\u2500 package.json # Dependencies
570
570
  \u2514\u2500\u2500 README.md
571
571
 
572
- ${g.bold("\u{1F680} Get started:")}
573
- ${g.cyan(`cd ${y}`)}
574
- ${e.skipInstall?g.cyan("npx rapidkit init")+g.gray(" # npm install")+`
575
- `:""}${g.cyan("cp .env.example .env")}
576
- ${g.cyan("npx rapidkit dev")} ${g.gray("# Start dev server")}
572
+ ${m.bold("\u{1F680} Get started:")}
573
+ ${m.cyan(`cd ${h}`)}
574
+ ${i.skipInstall?m.cyan("npx rapidkit init")+m.gray(" # npm install")+`
575
+ `:""}${m.cyan("cp .env.example .env")}
576
+ ${m.cyan("npx rapidkit dev")} ${m.gray("# Start dev server")}
577
577
 
578
- ${g.bold("\u{1F4DA} Available commands:")}
578
+ ${m.bold("\u{1F4DA} Available commands:")}
579
579
  npx rapidkit init # Install dependencies
580
580
  npx rapidkit dev # Start dev server with hot reload
581
581
  npx rapidkit start # Start production server
@@ -584,22 +584,22 @@ ${g.bold("\u{1F4DA} Available commands:")}
584
584
  npx rapidkit lint # Lint code
585
585
  npx rapidkit format # Format code
586
586
 
587
- ${g.bold("\u{1F310} API endpoints:")}
587
+ ${m.bold("\u{1F310} API endpoints:")}
588
588
  http://localhost:8000/health # Health check
589
589
  http://localhost:8000/docs # Swagger docs
590
590
  http://localhost:8000/examples/notes # Example API
591
591
 
592
- ${g.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
593
- `);}catch(n){throw r.fail(`Failed to create ${o} project`),n}}async function ve(t,e,i){let o=await promises.readdir(t,{withFileTypes:true});for(let r of o){let n=v.join(t,r.name),a=r.name.replace(/\.j2$/,""),s=v.join(e,a);if(r.isDirectory())await promises.mkdir(s,{recursive:true}),await ve(n,s,i);else {let c=await promises.readFile(n,"utf-8");r.name.endsWith(".j2")&&(c=yi(c,i)),await promises.writeFile(s,c),(a==="rapidkit"||a==="activate"||a.endsWith(".py")&&s.includes(".rapidkit"))&&await promises.chmod(s,493);}}}function yi(t,e){let i=t;for(let[o,r]of Object.entries(e)){let n=new RegExp(`\\{\\{\\s*${o}\\s*\\}\\}`,"g");i=i.replace(n,String(r));let a=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");i=i.replace(a,(p,l,d)=>String(r).replace(new RegExp(l,"g"),d));let s=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*lower\\s*\\}\\}`,"g");i=i.replace(s,String(r).toLowerCase());let c=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");i=i.replace(c,(p,l,d)=>String(r).replace(new RegExp(l,"g"),d).toLowerCase());}return i}async function wi(){let t=process.env.XDG_CONFIG_HOME||process.env.APPDATA||v.join(z__default.homedir(),".config"),e=process.platform==="win32"?v.join(t,"rapidkit"):v.join(z__default.homedir(),".rapidkit"),i=v.join(e,"workspaces.json");if(!await promises.stat(i).catch(()=>null)){console.log(g.yellow(`
592
+ ${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
593
+ `);}catch(n){throw r.fail(`Failed to create ${o} project`),n}}async function xe(t,i,e){let o=await promises.readdir(t,{withFileTypes:true});for(let r of o){let n=w.join(t,r.name),a=r.name.replace(/\.j2$/,""),s=w.join(i,a);if(r.isDirectory())await promises.mkdir(s,{recursive:true}),await xe(n,s,e);else {let c=await promises.readFile(n,"utf-8");r.name.endsWith(".j2")&&(c=vi(c,e)),await promises.writeFile(s,c),(a==="rapidkit"||a==="activate"||a.endsWith(".py")&&s.includes(".rapidkit"))&&await promises.chmod(s,493);}}}function vi(t,i){let e=t;for(let[o,r]of Object.entries(i)){let n=new RegExp(`\\{\\{\\s*${o}\\s*\\}\\}`,"g");e=e.replace(n,String(r));let a=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");e=e.replace(a,(l,p,d)=>String(r).replace(new RegExp(p,"g"),d));let s=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*lower\\s*\\}\\}`,"g");e=e.replace(s,String(r).toLowerCase());let c=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");e=e.replace(c,(l,p,d)=>String(r).replace(new RegExp(p,"g"),d).toLowerCase());}return e}async function xi(){let t=process.env.XDG_CONFIG_HOME||process.env.APPDATA||w.join(z__default.homedir(),".config"),i=process.platform==="win32"?w.join(t,"rapidkit"):w.join(z__default.homedir(),".rapidkit"),e=w.join(i,"workspaces.json");if(!await promises.stat(e).catch(()=>null)){console.log(m.yellow(`
594
594
  \u26A0\uFE0F No workspaces registered yet.
595
- `)),console.log(g.gray(`Create a workspace with: npx rapidkit <workspace-name>
596
- `));return}try{let o=await promises.readFile(i,"utf8"),r=JSON.parse(o);if(!r.workspaces||r.workspaces.length===0){console.log(g.yellow(`
595
+ `)),console.log(m.gray(`Create a workspace with: npx rapidkit <workspace-name>
596
+ `));return}try{let o=await promises.readFile(e,"utf8"),r=JSON.parse(o);if(!r.workspaces||r.workspaces.length===0){console.log(m.yellow(`
597
597
  \u26A0\uFE0F No workspaces registered yet.
598
- `));return}console.log(g.bold(`
598
+ `));return}console.log(m.bold(`
599
599
  \u{1F4E6} Registered RapidKit Workspaces:
600
- `));for(let n of r.workspaces)console.log(g.cyan(` ${n.name}`)),console.log(g.gray(` Path: ${n.path}`)),console.log(g.gray(` Projects: ${n.projects?.length||0}`)),await promises.stat(n.path).catch(()=>null)||console.log(g.red(" \u26A0\uFE0F Path not found")),console.log();console.log(g.gray(`Total: ${r.workspaces.length} workspace(s)
601
- `));}catch(o){console.error(g.red(`
602
- \u274C Failed to read workspace registry`)),console.error(g.gray(String(o)));}}var X=at(()=>{$();gt();});$();st();gt();$();st();var Je=".rapidkitrc.json",Ye=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function ft(){let t=v.join(z__default.homedir(),Je);try{let e=await promises.readFile(t,"utf-8"),i=JSON.parse(e);return u.debug(`Loaded config from ${t}`),i}catch{return u.debug("No user config found, using defaults"),{}}}async function ie(t=process.cwd()){let e=t,i=v.parse(e).root;for(;e!==i;){for(let o of Ye){let r=v.join(e,o);try{await promises.access(r),u.debug(`Found config file: ${r}`);let a=await import(pathToFileURL(r).href),s=a.default||a;return u.debug(`Loaded RapidKit config from ${o}`),s}catch{continue}}e=v.dirname(e);}return u.debug("No RapidKit config file found, using defaults"),{}}function oe(t,e,i){return {author:i.author||e.workspace?.defaultAuthor||t.author,pythonVersion:e.workspace?.pythonVersion||t.pythonVersion,defaultInstallMethod:i.defaultInstallMethod||e.workspace?.installMethod||t.defaultInstallMethod,defaultKit:i.defaultKit||e.projects?.defaultKit||t.defaultKit,skipGit:i.skipGit??e.projects?.skipGit??t.skipGit,license:i.license||t.license,testRapidKitPath:i.testRapidKitPath||t.testRapidKitPath}}function xt(t){return process.env.RAPIDKIT_DEV_PATH||t.testRapidKitPath||void 0}$();$();var G=class extends Error{constructor(i,o,r){super(i);this.code=o;this.details=r;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}},ct=class extends G{constructor(e,i){let o=i?`Python ${e}+ required, found ${i}`:`Python ${e}+ not found`;super(o,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},ht=class extends G{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},yt=class extends G{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},jt=class extends G{constructor(e){super(`Directory "${e}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},Y=class extends G{constructor(e,i){super(`Invalid project name: "${e}"`,"INVALID_PROJECT_NAME",i);}},F=class extends G{constructor(e,i){let o=`Installation failed at: ${e}`,r=`${i.message}
600
+ `));for(let n of r.workspaces)console.log(m.cyan(` ${n.name}`)),console.log(m.gray(` Path: ${n.path}`)),console.log(m.gray(` Projects: ${n.projects?.length||0}`)),await promises.stat(n.path).catch(()=>null)||console.log(m.red(" \u26A0\uFE0F Path not found")),console.log();console.log(m.gray(`Total: ${r.workspaces.length} workspace(s)
601
+ `));}catch(o){console.error(m.red(`
602
+ \u274C Failed to read workspace registry`)),console.error(m.gray(String(o)));}}var Q=st(()=>{R();gt();});R();ct();gt();R();ct();var qe=".rapidkitrc.json",Qe=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function ht(){let t=w.join(z__default.homedir(),qe);try{let i=await promises.readFile(t,"utf-8"),e=JSON.parse(i);return f.debug(`Loaded config from ${t}`),e}catch{return f.debug("No user config found, using defaults"),{}}}async function oe(t=process.cwd()){let i=t,e=w.parse(i).root;for(;i!==e;){for(let o of Qe){let r=w.join(i,o);try{await promises.access(r),f.debug(`Found config file: ${r}`);let a=await import(pathToFileURL(r).href),s=a.default||a;return f.debug(`Loaded RapidKit config from ${o}`),s}catch{continue}}i=w.dirname(i);}return f.debug("No RapidKit config file found, using defaults"),{}}function ne(t,i,e){return {author:e.author||i.workspace?.defaultAuthor||t.author,pythonVersion:i.workspace?.pythonVersion||t.pythonVersion,defaultInstallMethod:e.defaultInstallMethod||i.workspace?.installMethod||t.defaultInstallMethod,defaultKit:e.defaultKit||i.projects?.defaultKit||t.defaultKit,skipGit:e.skipGit??i.projects?.skipGit??t.skipGit,license:e.license||t.license,testRapidKitPath:e.testRapidKitPath||t.testRapidKitPath}}function jt(t){return process.env.RAPIDKIT_DEV_PATH||t.testRapidKitPath||void 0}R();R();var G=class extends Error{constructor(e,o,r){super(e);this.code=o;this.details=r;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}},lt=class extends G{constructor(i,e){let o=e?`Python ${i}+ required, found ${e}`:`Python ${i}+ not found`;super(o,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},yt=class extends G{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},wt=class extends G{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},bt=class extends G{constructor(i){super(`Directory "${i}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},Y=class extends G{constructor(i,e){super(`Invalid project name: "${i}"`,"INVALID_PROJECT_NAME",e);}},M=class extends G{constructor(i,e){let o=`Installation failed at: ${i}`,r=`${e.message}
603
603
 
604
604
  Troubleshooting:
605
605
  - Check your internet connection
@@ -609,18 +609,18 @@ Troubleshooting:
609
609
  2. Use the core workflow: npx rapidkit create workspace <name>
610
610
  3. Offline fallback (limited): npx rapidkit create project fastapi.standard <name> --output .
611
611
 
612
- Legacy: set RAPIDKIT_SHOW_LEGACY=1 to reveal template-mode flags in help.`);}};function re(t){let e=ze(t);if(!e.validForNewPackages){let o=e.errors||[],r=e.warnings||[],n=[...o,...r];throw new Y(t,`NPM validation failed: ${n.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(t))throw new Y(t,"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(t.toLowerCase()))throw new Y(t,`"${t}" is a reserved name. Please choose a different name.`);if(t.length<2)throw new Y(t,"Name must be at least 2 characters long");if(t.length>214)throw new Y(t,"Name must be less than 214 characters");return true}$();function Xe(t){return typeof t=="object"&&t!==null}async function Qe(t,e,i,o=8e3){try{let r=await execa(t,e,{cwd:i,timeout:o,reject:!1,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 Ze(t,e){let i=["-m","rapidkit",...t],o=["python3","python"];for(let r of o){let n=await Qe(r,i,e?.cwd,e?.timeoutMs);if(!n.ok)continue;let a=(n.stdout??"").trim();try{let s=JSON.parse(a);return Xe(s)?{ok:!0,command:r,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,data:s}:{ok:!1,command:r,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr}}catch{return {ok:false,command:r,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr}}}return {ok:false}}async function ne(t,e){let i=await Ze(["project","detect","--path",t,"--json"],e);return !i.ok||!i.data||i.data.schema_version!==1?{ok:false,command:i.command,exitCode:i.exitCode,stdout:i.stdout,stderr:i.stderr}:i}$t();$();var si=["version","project","create","init","dev","start","build","test","lint","format","add","list","info","upgrade","diff","doctor","license","reconcile","rollback","uninstall","checkpoint","optimize","snapshot","frameworks","modules","merge"],he=new Set(si);$();st();gt();$();function Rt(){return process.platform==="win32"?"python":"python3"}Bt();async function be(t,e,i,o){let r=Ut(e,U(),i);o&&(r.metadata||(r.metadata={}),r.metadata.python={version:o}),await Pt(t,r);}async function $e(t){await I.outputFile(v.join(t,".gitignore"),`.venv/
612
+ Legacy: set RAPIDKIT_SHOW_LEGACY=1 to reveal template-mode flags in help.`);}};function re(t){let i=Xe(t);if(!i.validForNewPackages){let o=i.errors||[],r=i.warnings||[],n=[...o,...r];throw new Y(t,`NPM validation failed: ${n.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(t))throw new Y(t,"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(t.toLowerCase()))throw new Y(t,`"${t}" is a reserved name. Please choose a different name.`);if(t.length<2)throw new Y(t,"Name must be at least 2 characters long");if(t.length>214)throw new Y(t,"Name must be less than 214 characters");return true}R();function ti(t){return typeof t=="object"&&t!==null}async function ei(t,i,e,o=8e3){try{let r=await execa(t,i,{cwd:e,timeout:o,reject:!1,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 ii(t,i){let e=["-m","rapidkit",...t],o=["python3","python"];for(let r of o){let n=await ei(r,e,i?.cwd,i?.timeoutMs);if(!n.ok)continue;let a=(n.stdout??"").trim();try{let s=JSON.parse(a);return ti(s)?{ok:!0,command:r,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,data:s}:{ok:!1,command:r,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr}}catch{return {ok:false,command:r,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr}}}return {ok:false}}async function ae(t,i){let e=await ii(["project","detect","--path",t,"--json"],i);return !e.ok||!e.data||e.data.schema_version!==1?{ok:false,command:e.command,exitCode:e.exitCode,stdout:e.stdout,stderr:e.stderr}:e}Pt();R();var pi=["version","project","create","init","dev","start","build","test","lint","format","add","list","info","upgrade","diff","doctor","license","reconcile","rollback","uninstall","checkpoint","optimize","snapshot","frameworks","modules","merge"],ye=new Set(pi);R();ct();gt();R();function Rt(){return process.platform==="win32"?"python":"python3"}Ht();async function $e(t,i,e,o){let r=Ut(i,H(),e);o&&(r.metadata||(r.metadata={}),r.metadata.python={version:o}),await Ct(t,r);}async function Pe(t){await k.outputFile(w.join(t,".gitignore"),`.venv/
613
613
  __pycache__/
614
614
  *.pyc
615
615
  .env
616
616
  .rapidkit-workspace/
617
617
 
618
- `,"utf-8");}async function xe(t){try{let{stdout:e}=await execa(t,["--version"],{timeout:3e3}),i=e.match(/Python (\d+\.\d+\.\d+)/);if(i)return i[1]}catch{}return null}async function ki(t,e){try{await promises.writeFile(v.join(t,".python-version"),`${e}
619
- `,"utf-8"),u.debug(`Created .python-version with ${e}`);}catch(i){u.warn(`Failed to create .python-version: ${i}`);}}function kt(){let t=v.join(z.homedir(),".local","bin"),i=(process.env.PATH||"").split(v.delimiter).filter(Boolean);i.includes(t)||(process.env.PATH=[t,...i].join(v.delimiter));}async function Ct(t,e){kt(),t.start("Checking pipx installation");try{return await execa("pipx",["--version"]),t.succeed("pipx found"),{kind:"binary"}}catch{}let i=Rt();try{return await execa(i,["-m","pipx","--version"]),t.succeed("pipx found"),{kind:"python-module",pythonCmd:i}}catch{}if(e)throw new yt;let{installPipx:o}=await Jt.prompt([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!o)throw new yt;t.start("Installing pipx (user install)");try{try{await execa(i,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(i,["-m","pip","install","--user","--upgrade","pipx"]);}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"");throw new F("Install pipx with python -m pip",r instanceof Error?r:new Error(a))}t.succeed("pipx installed"),kt();try{return await execa(i,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:i}}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"pipx not runnable after install");throw new F("Verify pipx after install",new Error(`${a}
618
+ `,"utf-8");}async function je(t){try{let{stdout:i}=await execa(t,["--version"],{timeout:3e3}),e=i.match(/Python (\d+\.\d+\.\d+)/);if(e)return e[1]}catch{}return null}async function ji(t,i){try{await promises.writeFile(w.join(t,".python-version"),`${i}
619
+ `,"utf-8"),f.debug(`Created .python-version with ${i}`);}catch(e){f.warn(`Failed to create .python-version: ${e}`);}}function vt(){let t=w.join(z.homedir(),".local","bin"),e=(process.env.PATH||"").split(w.delimiter).filter(Boolean);e.includes(t)||(process.env.PATH=[t,...e].join(w.delimiter));}async function _t(t,i){vt(),t.start("Checking pipx installation");try{return await execa("pipx",["--version"]),t.succeed("pipx found"),{kind:"binary"}}catch{}let e=Rt();try{return await execa(e,["-m","pipx","--version"]),t.succeed("pipx found"),{kind:"python-module",pythonCmd:e}}catch{}if(i)throw new wt;let{installPipx:o}=await Jt.prompt([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!o)throw new wt;t.start("Installing pipx (user install)");try{try{await execa(e,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(e,["-m","pip","install","--user","--upgrade","pipx"]);}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"");throw new M("Install pipx with python -m pip",r instanceof Error?r:new Error(a))}t.succeed("pipx installed"),vt();try{return await execa(e,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:e}}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"pipx not runnable after install");throw new M("Verify pipx after install",new Error(`${a}
620
620
 
621
- Try reopening your terminal or run: python3 -m pipx ensurepath`))}}async function mt(t,e){return t.kind==="binary"?execa("pipx",e):execa(t.pythonCmd,["-m","pipx",...e])}async function vi(t,e){kt(),t.start("Checking Poetry installation");try{await execa("poetry",["--version"]),t.succeed("Poetry found");return}catch{}if(e)throw new ht;let{installPoetry:i}=await Jt.prompt([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!i)throw new ht;let o=await Ct(t,e);t.start("Installing Poetry with pipx");try{await mt(o,["install","poetry"]);}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(a))try{await mt(o,["upgrade","poetry"]);}catch{}else throw new F("Install Poetry with pipx",r instanceof Error?r:new Error(a))}t.succeed("Poetry installed"),kt();try{await execa("poetry",["--version"]);}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"Poetry not found on PATH");throw new F("Verify Poetry after pipx install",new Error(`${a}
621
+ Try reopening your terminal or run: python3 -m pipx ensurepath`))}}async function ft(t,i){return t.kind==="binary"?execa("pipx",i):execa(t.pythonCmd,["-m","pipx",...i])}async function bi(t,i){vt(),t.start("Checking Poetry installation");try{await execa("poetry",["--version"]),t.succeed("Poetry found");return}catch{}if(i)throw new yt;let{installPoetry:e}=await Jt.prompt([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!e)throw new yt;let o=await _t(t,i);t.start("Installing Poetry with pipx");try{await ft(o,["install","poetry"]);}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(a))try{await ft(o,["upgrade","poetry"]);}catch{}else throw new M("Install Poetry with pipx",r instanceof Error?r:new Error(a))}t.succeed("Poetry installed"),vt();try{await execa("poetry",["--version"]);}catch(r){let n=r,a=String(n?.stderr||n?.shortMessage||n?.message||"Poetry not found on PATH");throw new M("Verify Poetry after pipx install",new Error(`${a}
622
622
 
623
- Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function xi(t){let e=t==="poetry";return `#!/usr/bin/env sh
623
+ Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function $i(t){let i=t==="poetry";return `#!/usr/bin/env sh
624
624
  set -eu
625
625
 
626
626
  SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
@@ -630,16 +630,16 @@ if [ -x "$VENV_RAPIDKIT" ]; then
630
630
  exec "$VENV_RAPIDKIT" "$@"
631
631
  fi
632
632
 
633
- ${e?`if command -v poetry >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/pyproject.toml" ]; then
633
+ ${i?`if command -v poetry >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/pyproject.toml" ]; then
634
634
  exec poetry run rapidkit "$@"
635
635
  fi
636
636
 
637
637
  `:""}echo "RapidKit launcher could not find a local Python CLI." 1>&2
638
638
  echo "- If you used venv: ensure .venv exists (or re-run the installer)." 1>&2
639
- ${e?`echo "- If you used Poetry: run 'poetry install' and retry, or activate the env." 1>&2
639
+ ${i?`echo "- If you used Poetry: run 'poetry install' and retry, or activate the env." 1>&2
640
640
  `:""}echo "Tip: you can also run: ./.venv/bin/rapidkit --help" 1>&2
641
641
  exit 1
642
- `}function ji(t){return `@echo off
642
+ `}function Pi(t){return `@echo off
643
643
  setlocal
644
644
 
645
645
  set "SCRIPT_DIR=%~dp0"
@@ -658,48 +658,48 @@ if %ERRORLEVEL%==0 if exist "%SCRIPT_DIR%\\pyproject.toml" (
658
658
  `:""}echo RapidKit launcher could not find a local Python CLI. 1>&2
659
659
  echo Tip: run .venv\\Scripts\\rapidkit.exe --help 1>&2
660
660
  exit /b 1
661
- `}async function Re(t,e){await I.outputFile(v.join(t,"rapidkit"),xi(e),{encoding:"utf-8",mode:493}),await I.outputFile(v.join(t,"rapidkit.cmd"),ji(e),"utf-8");}async function Pe(t,e){let{skipGit:i=false,testMode:o=false,demoMode:r=false,dryRun:n=false,yes:a=false,userConfig:s={},installMethod:c}=e,p=t||"rapidkit",l=v.resolve(process.cwd(),p);if(await I.pathExists(l))throw new jt(p);if(n){await $i(l,p,r,s);return}if(r){await bi(l,p,i);return}let d=a?{pythonVersion:s.pythonVersion||"3.10",installMethod:c||s.defaultInstallMethod||"poetry"}:await Jt.prompt([{type:"list",name:"pythonVersion",message:"Select Python version for RapidKit:",choices:["3.10","3.11","3.12"],default:s.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:s.defaultInstallMethod||"poetry"}]);u.step(1,3,"Setting up RapidKit environment");let m=wt("Creating directory").start();try{await I.ensureDir(l),m.succeed("Directory created"),m.start("Detecting Python version");let y=null,f=await Ce(d.pythonVersion);if(f)y=await xe(f),y?(u.info(`Detected Python ${y}`),m.succeed(`Python ${y} detected`)):m.warn("Could not detect exact Python version");else {let w=Rt();y=await xe(w),y?m.succeed(`Python ${y} detected`):m.warn("Could not detect Python version, proceeding with defaults");}if(await be(l,p,d.installMethod,y||void 0),y&&await ki(l,y),await $e(l),d.installMethod==="poetry")try{await _e(l,d.pythonVersion,m,o,s,a);}catch(w){let A=w?.details||w?.message||String(w);if(A.includes("pyenv")||A.includes("exit status 127")||A.includes("returned non-zero exit status 127")){m.warn("Poetry encountered Python discovery issues, trying venv method"),u.debug(`Poetry error (attempting venv fallback): ${A}`);try{await Ht(l,d.pythonVersion,m,o,s),d.installMethod="venv";}catch(K){throw K}}else throw w}else d.installMethod==="venv"?await Ht(l,d.pythonVersion,m,o,s):await Ee(l,m,o,s,a);if(await Re(l,d.installMethod),await Ie(l,d.installMethod),m.succeed("RapidKit environment ready!"),!e.skipGit){m.start("Initializing git repository");try{await execa("git",["init"],{cwd:l}),await execa("git",["add","."],{cwd:l}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:l}),m.succeed("Git repository initialized");}catch{m.warn("Could not initialize git repository");}}try{let{registerWorkspace:w}=await Promise.resolve().then(()=>(X(),q));await w(l,p);}catch{console.warn(g.gray("Note: Could not register workspace in shared registry"));}if(console.log(g.green(`
661
+ `}async function Re(t,i){await k.outputFile(w.join(t,"rapidkit"),$i(i),{encoding:"utf-8",mode:493}),await k.outputFile(w.join(t,"rapidkit.cmd"),Pi(i),"utf-8");}async function Ce(t,i){let{skipGit:e=false,testMode:o=false,demoMode:r=false,dryRun:n=false,yes:a=false,userConfig:s={},installMethod:c}=i,l=t||"rapidkit",p=w.resolve(process.cwd(),l);if(await k.pathExists(p))throw new bt(l);if(n){await Ci(p,l,r,s);return}if(r){await Ri(p,l,e);return}let d=a?{pythonVersion:s.pythonVersion||"3.10",installMethod:c||s.defaultInstallMethod||"poetry"}:await Jt.prompt([{type:"list",name:"pythonVersion",message:"Select Python version for RapidKit:",choices:["3.10","3.11","3.12"],default:s.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:s.defaultInstallMethod||"poetry"}]);f.step(1,3,"Setting up RapidKit environment");let u=kt("Creating directory").start();try{await k.ensureDir(p),u.succeed("Directory created"),u.start("Detecting Python version");let h=null,y=await _e(d.pythonVersion);if(y)h=await je(y),h?(f.info(`Detected Python ${h}`),u.succeed(`Python ${h} detected`)):u.warn("Could not detect exact Python version");else {let x=Rt();h=await je(x),h?u.succeed(`Python ${h} detected`):u.warn("Could not detect Python version, proceeding with defaults");}if(await $e(p,l,d.installMethod,h||void 0),h&&await ji(p,h),await Pe(p),d.installMethod==="poetry")try{await Ee(p,d.pythonVersion,u,o,s,a);}catch(x){let A=x?.details||x?.message||String(x);if(A.includes("pyenv")||A.includes("exit status 127")||A.includes("returned non-zero exit status 127")){u.warn("Poetry encountered Python discovery issues, trying venv method"),f.debug(`Poetry error (attempting venv fallback): ${A}`);try{await Bt(p,d.pythonVersion,u,o,s),d.installMethod="venv";}catch(O){throw O}}else throw x}else d.installMethod==="venv"?await Bt(p,d.pythonVersion,u,o,s):await Ie(p,u,o,s,a);if(await Re(p,d.installMethod),await Se(p,d.installMethod),u.succeed("RapidKit environment ready!"),!i.skipGit){u.start("Initializing git repository");try{await execa("git",["init"],{cwd:p}),await execa("git",["add","."],{cwd:p}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:p}),u.succeed("Git repository initialized");}catch{u.warn("Could not initialize git repository");}}try{let{registerWorkspace:x}=await Promise.resolve().then(()=>(Q(),q));await x(p,l);}catch{console.warn(m.gray("Note: Could not register workspace in shared registry"));}if(console.log(m.green(`
662
662
  \u2728 RapidKit environment created successfully!
663
- `)),console.log(g.cyan("\u{1F4C2} Location:"),g.white(l)),console.log(g.cyan(`\u{1F680} Get started:
664
- `)),console.log(g.white(` cd ${p}`)),d.installMethod==="poetry"){let w="source $(poetry env info --path)/bin/activate";try{kt();let{stdout:A}=await execa("poetry",["--version"]),D=A.match(/Poetry.*?(\d+)\.(\d+)/);D&&(parseInt(D[1])>=2?w="source $(poetry env info --path)/bin/activate":w="poetry shell");}catch{}console.log(g.white(` ${w} # Or: poetry run rapidkit`)),console.log(g.white(" rapidkit create # Interactive mode")),console.log(g.white(" cd <project-name> && rapidkit init && rapidkit dev"));}else d.installMethod==="venv"?(console.log(g.white(" source .venv/bin/activate # On Windows: .venv\\Scripts\\activate")),console.log(g.white(" rapidkit create # Interactive mode")),console.log(g.white(" cd <project-name> && rapidkit init && rapidkit dev"))):(console.log(g.white(" rapidkit create # Interactive mode")),console.log(g.white(" cd <project-name> && rapidkit init && rapidkit dev")));console.log(g.white(`
665
- \u{1F4A1} For more information, check the README.md file.`)),console.log(g.cyan(`
666
- \u{1F4DA} RapidKit commands:`)),console.log(g.white(" rapidkit create - Create a new project (interactive)")),console.log(g.white(" rapidkit dev - Run development server")),console.log(g.white(" rapidkit add module <name> - Add a module (e.g., settings)")),console.log(g.white(" rapidkit list - List available kits")),console.log(g.white(" rapidkit modules - List available modules")),console.log(g.white(` rapidkit --help - Show all commands
667
- `));}catch(y){m.fail("Failed to create RapidKit environment"),console.error(g.red(`
668
- \u274C Error:`),y);try{await I.remove(l);}catch{}throw y}}async function Ce(t){let e=[];try{let{stdout:i}=await execa("pyenv",["root"]),o=i.trim();e.push(v.join(o,"versions",`${t}.*`,"bin","python"));let[r,n]=t.split(".");e.push(v.join(o,"versions",`${r}.${n}.*`,"bin","python"));}catch{}e.push(`python${t}`,`python3.${t.split(".")[1]}`,"python3","python"),e.push(`/usr/bin/python${t}`,"/usr/bin/python3",`/usr/local/bin/python${t}`,"/usr/local/bin/python3");for(let i of e)try{let o=i;if(i.includes("*")){if(o=(await execa("sh",["-c",`ls -d ${i} 2>/dev/null | head -1`])).stdout.trim(),!o)continue;o=v.join(o.split("/").slice(0,-1).join("/"),"../bin/python");}let{stdout:r}=await execa(o,["--version"],{timeout:2e3}),n=r.match(/Python (\d+\.\d+)/)?.[1];if(n&&parseFloat(n)>=parseFloat(t))return await execa(o,["-c","import sys; sys.exit(0)"],{timeout:2e3}),o}catch{continue}return null}async function _e(t,e,i,o,r,n=false){await vi(i,n),i.start("Finding Python interpreter");let a=await Ce(e);a?(u.debug(`Found working Python: ${a}`),i.succeed("Python found")):i.warn("Could not verify Python path, proceeding with default"),i.start("Initializing Poetry project"),await execa("poetry",["init","--no-interaction","--python",`^${e}`],{cwd:t}),i.succeed("Poetry project initialized");let s=v.join(t,"pyproject.toml"),p=await promises.readFile(s,"utf-8");p.includes("[tool.poetry]")?p=p.replace("[tool.poetry]",`[tool.poetry]
669
- package-mode = false`):p.includes("[project]")&&(p.includes("[build-system]")?p=p.replace("[build-system]",`
663
+ `)),console.log(m.cyan("\u{1F4C2} Location:"),m.white(p)),console.log(m.cyan(`\u{1F680} Get started:
664
+ `)),console.log(m.white(` cd ${l}`)),d.installMethod==="poetry"){let x="source $(poetry env info --path)/bin/activate";try{vt();let{stdout:A}=await execa("poetry",["--version"]),D=A.match(/Poetry.*?(\d+)\.(\d+)/);D&&(parseInt(D[1])>=2?x="source $(poetry env info --path)/bin/activate":x="poetry shell");}catch{}console.log(m.white(` ${x} # Or: poetry run rapidkit`)),console.log(m.white(" rapidkit create # Interactive mode")),console.log(m.white(" cd <project-name> && rapidkit init && rapidkit dev"));}else d.installMethod==="venv"?(console.log(m.white(" source .venv/bin/activate # On Windows: .venv\\Scripts\\activate")),console.log(m.white(" rapidkit create # Interactive mode")),console.log(m.white(" cd <project-name> && rapidkit init && rapidkit dev"))):(console.log(m.white(" rapidkit create # Interactive mode")),console.log(m.white(" cd <project-name> && rapidkit init && rapidkit dev")));console.log(m.white(`
665
+ \u{1F4A1} For more information, check the README.md file.`)),console.log(m.cyan(`
666
+ \u{1F4DA} RapidKit commands:`)),console.log(m.white(" rapidkit create - Create a new project (interactive)")),console.log(m.white(" rapidkit dev - Run development server")),console.log(m.white(" rapidkit add module <name> - Add a module (e.g., settings)")),console.log(m.white(" rapidkit list - List available kits")),console.log(m.white(" rapidkit modules - List available modules")),console.log(m.white(` rapidkit --help - Show all commands
667
+ `));}catch(h){u.fail("Failed to create RapidKit environment"),console.error(m.red(`
668
+ \u274C Error:`),h);try{await k.remove(p);}catch{}throw h}}async function _e(t){let i=[];try{let{stdout:e}=await execa("pyenv",["root"]),o=e.trim();i.push(w.join(o,"versions",`${t}.*`,"bin","python"));let[r,n]=t.split(".");i.push(w.join(o,"versions",`${r}.${n}.*`,"bin","python"));}catch{}i.push(`python${t}`,`python3.${t.split(".")[1]}`,"python3","python"),i.push(`/usr/bin/python${t}`,"/usr/bin/python3",`/usr/local/bin/python${t}`,"/usr/local/bin/python3");for(let e of i)try{let o=e;if(e.includes("*")){if(o=(await execa("sh",["-c",`ls -d ${e} 2>/dev/null | head -1`])).stdout.trim(),!o)continue;o=w.join(o.split("/").slice(0,-1).join("/"),"../bin/python");}let{stdout:r}=await execa(o,["--version"],{timeout:2e3}),n=r.match(/Python (\d+\.\d+)/)?.[1];if(n&&parseFloat(n)>=parseFloat(t))return await execa(o,["-c","import sys; sys.exit(0)"],{timeout:2e3}),o}catch{continue}return null}async function Ee(t,i,e,o,r,n=false){await bi(e,n),e.start("Finding Python interpreter");let a=await _e(i);a?(f.debug(`Found working Python: ${a}`),e.succeed("Python found")):e.warn("Could not verify Python path, proceeding with default"),e.start("Initializing Poetry project"),await execa("poetry",["init","--no-interaction","--python",`^${i}`],{cwd:t}),e.succeed("Poetry project initialized");let s=w.join(t,"pyproject.toml"),l=await promises.readFile(s,"utf-8");l.includes("[tool.poetry]")?l=l.replace("[tool.poetry]",`[tool.poetry]
669
+ package-mode = false`):l.includes("[project]")&&(l.includes("[build-system]")?l=l.replace("[build-system]",`
670
670
  [tool.poetry]
671
671
  package-mode = false
672
672
 
673
- [build-system]`):p+=`
673
+ [build-system]`):l+=`
674
674
 
675
675
  [tool.poetry]
676
676
  package-mode = false
677
- `),await promises.writeFile(s,p,"utf-8"),i.start("Configuring Poetry");try{if(await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:t}),a)try{await execa("poetry",["env","use",a],{cwd:t}),u.debug(`Poetry configured to use: ${a}`);}catch(l){u.debug(`Could not set Poetry env to ${a}: ${l}`);}i.succeed("Poetry configured");}catch{i.warn("Could not configure Poetry virtualenvs.in-project");}i.start("Creating virtualenv");try{await execa("poetry",["install","--no-root"],{cwd:t,timeout:3e4}),i.succeed("Virtualenv created");}catch(l){u.debug(`Failed to create virtualenv: ${l}`),i.warn("Could not create virtualenv, proceeding with add command");}if(i.start("Installing RapidKit"),o){let l=xt(r||{});if(!l)throw new F("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));u.debug(`Installing from local path: ${l}`),i.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",l],{cwd:t});}else {i.text="Installing RapidKit from PyPI";let l=false,d=null;for(let m=1;m<=3;m++)try{await execa("poetry",["add","rapidkit-core"],{cwd:t,timeout:6e4*m}),l=!0;break}catch(y){d=y,u.debug(`Poetry add attempt ${m} failed: ${y}`),m<3&&(i.text=`Retrying installation (attempt ${m+1}/3)`,await new Promise(f=>setTimeout(f,2e3)));}if(!l){let m=d?.stderr||d?.message||"Unknown error";throw u.debug(`All Poetry install attempts failed. Last error: ${m}`),m.includes("Could not find")||m.includes("No matching distribution")?new pt:new F("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
678
- Error: ${m}
677
+ `),await promises.writeFile(s,l,"utf-8"),e.start("Configuring Poetry");try{if(await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:t}),a)try{await execa("poetry",["env","use",a],{cwd:t}),f.debug(`Poetry configured to use: ${a}`);}catch(p){f.debug(`Could not set Poetry env to ${a}: ${p}`);}e.succeed("Poetry configured");}catch{e.warn("Could not configure Poetry virtualenvs.in-project");}e.start("Creating virtualenv");try{await execa("poetry",["install","--no-root"],{cwd:t,timeout:3e4}),e.succeed("Virtualenv created");}catch(p){f.debug(`Failed to create virtualenv: ${p}`),e.warn("Could not create virtualenv, proceeding with add command");}if(e.start("Installing RapidKit"),o){let p=jt(r||{});if(!p)throw new M("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${p}`),e.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",p],{cwd:t});}else {e.text="Installing RapidKit from PyPI";let p=false,d=null;for(let u=1;u<=3;u++)try{await execa("poetry",["add","rapidkit-core"],{cwd:t,timeout:6e4*u}),p=!0;break}catch(h){d=h,f.debug(`Poetry add attempt ${u} failed: ${h}`),u<3&&(e.text=`Retrying installation (attempt ${u+1}/3)`,await new Promise(y=>setTimeout(y,2e3)));}if(!p){let u=d?.stderr||d?.message||"Unknown error";throw f.debug(`All Poetry install attempts failed. Last error: ${u}`),u.includes("Could not find")||u.includes("No matching distribution")?new pt:new M("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
678
+ Error: ${u}
679
679
 
680
680
  Possible solutions:
681
681
  1. Check your internet connection
682
- 2. Try installing manually: cd ${v.basename(t)} && poetry add rapidkit-core
683
- 3. Use venv method instead: npx rapidkit ${v.basename(t)} --install-method=venv`))}}i.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:l}=await Promise.resolve().then(()=>($t(),Gt));if(!await l()&&!o){i.start("Installing RapidKit globally with pipx for CLI access");let m=await Ct(i,n);try{await mt(m,["install","rapidkit-core"]),i.succeed("RapidKit installed globally");}catch(y){i.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),u.debug(`pipx install failed: ${y}`);}}}catch(l){u.debug(`Global install check skipped: ${l}`);}}async function Ht(t,e,i,o,r,n=false){i.start(`Checking Python ${e}`);let a=Rt();try{let{stdout:c}=await execa(a,["--version"]),p=c.match(/Python (\d+\.\d+)/)?.[1];if(p&&parseFloat(p)<parseFloat(e))throw new ct(e,p);i.succeed(`Python ${p} found`);}catch(c){throw c instanceof ct?c:new ct(e)}i.start("Creating virtual environment");try{await execa(a,["-m","venv",".venv"],{cwd:t}),i.succeed("Virtual environment created");}catch(c){if(i.fail("Failed to create virtual environment"),(l=>typeof l=="object"&&l!==null&&"stdout"in l&&typeof l.stdout=="string")(c)&&c.stdout.includes("ensurepip is not")){let l=c.stdout.match(/apt install (python[\d.]+-venv)/),d=l?l[1]:"python3-venv";throw new F("Python venv module not available",new Error(`Virtual environment creation failed.
682
+ 2. Try installing manually: cd ${w.basename(t)} && poetry add rapidkit-core
683
+ 3. Use venv method instead: npx rapidkit ${w.basename(t)} --install-method=venv`))}}e.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:p}=await Promise.resolve().then(()=>(Pt(),Lt));if(!await p()&&!o){e.start("Installing RapidKit globally with pipx for CLI access");let u=await _t(e,n);try{await ft(u,["install","rapidkit-core"]),e.succeed("RapidKit installed globally");}catch(h){e.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${h}`);}}}catch(p){f.debug(`Global install check skipped: ${p}`);}}async function Bt(t,i,e,o,r,n=false){e.start(`Checking Python ${i}`);let a=Rt();try{let{stdout:c}=await execa(a,["--version"]),l=c.match(/Python (\d+\.\d+)/)?.[1];if(l&&parseFloat(l)<parseFloat(i))throw new lt(i,l);e.succeed(`Python ${l} found`);}catch(c){throw c instanceof lt?c:new lt(i)}e.start("Creating virtual environment");try{await execa(a,["-m","venv",".venv"],{cwd:t}),e.succeed("Virtual environment created");}catch(c){if(e.fail("Failed to create virtual environment"),(p=>typeof p=="object"&&p!==null&&"stdout"in p&&typeof p.stdout=="string")(c)&&c.stdout.includes("ensurepip is not")){let p=c.stdout.match(/apt install (python[\d.]+-venv)/),d=p?p[1]:"python3-venv";throw new M("Python venv module not available",new Error(`Virtual environment creation failed.
684
684
 
685
685
  On Debian/Ubuntu systems, install the venv package:
686
686
  sudo apt install ${d}
687
687
 
688
688
  Or use Poetry instead (recommended):
689
- npx rapidkit ${v.basename(t)} --yes`))}throw new F("Virtual environment creation",c instanceof Error?c:new Error(String(c)))}i.start("Installing RapidKit");let s=v.join(t,".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python");if(await execa(s,["-m","pip","install","--upgrade","pip"],{cwd:t}),o){let c=xt(r||{});if(!c)throw new F("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));u.debug(`Installing from local path: ${c}`),i.text="Installing RapidKit from local path (test mode)",await execa(s,["-m","pip","install","-e",c],{cwd:t});}else {i.text="Installing RapidKit from PyPI";let c=false,p=null;for(let l=1;l<=3;l++)try{await execa(s,["-m","pip","install","rapidkit-core"],{cwd:t,timeout:6e4*l}),c=!0;break}catch(d){p=d,u.debug(`pip install attempt ${l} failed: ${d}`),l<3&&(i.text=`Retrying installation (attempt ${l+1}/3)`,await new Promise(m=>setTimeout(m,2e3)));}if(!c){let l=p?.stderr||p?.message||"Unknown error";throw u.debug(`All pip install attempts failed. Last error: ${l}`),l.includes("Could not find")||l.includes("No matching distribution")?new pt:new F("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
690
- Error: ${l}
689
+ npx rapidkit ${w.basename(t)} --yes`))}throw new M("Virtual environment creation",c instanceof Error?c:new Error(String(c)))}e.start("Installing RapidKit");let s=w.join(t,".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python");if(await execa(s,["-m","pip","install","--upgrade","pip"],{cwd:t}),o){let c=jt(r||{});if(!c)throw new M("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${c}`),e.text="Installing RapidKit from local path (test mode)",await execa(s,["-m","pip","install","-e",c],{cwd:t});}else {e.text="Installing RapidKit from PyPI";let c=false,l=null;for(let p=1;p<=3;p++)try{await execa(s,["-m","pip","install","rapidkit-core"],{cwd:t,timeout:6e4*p}),c=!0;break}catch(d){l=d,f.debug(`pip install attempt ${p} failed: ${d}`),p<3&&(e.text=`Retrying installation (attempt ${p+1}/3)`,await new Promise(u=>setTimeout(u,2e3)));}if(!c){let p=l?.stderr||l?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${p}`),p.includes("Could not find")||p.includes("No matching distribution")?new pt:new M("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
690
+ Error: ${p}
691
691
 
692
692
  Possible solutions:
693
693
  1. Check your internet connection
694
- 2. Try installing manually: cd ${v.basename(t)} && .venv/bin/python -m pip install rapidkit-core
695
- 3. Use Poetry instead: npx rapidkit ${v.basename(t)} --install-method=poetry`))}}i.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:c}=await Promise.resolve().then(()=>($t(),Gt));if(!await c()&&!o){i.start("Installing RapidKit globally with pipx for CLI access");let l=await Ct(i,n);try{await mt(l,["install","rapidkit-core"]),i.succeed("RapidKit installed globally");}catch(d){i.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),u.debug(`pipx install failed: ${d}`);}}}catch(c){u.debug(`Global install check skipped: ${c}`);}}async function Ee(t,e,i,o,r=false){let n=await Ct(e,r);if(e.start("Installing RapidKit globally with pipx"),i){let a=xt(o||{});if(!a)throw new F("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));u.debug(`Installing from local path: ${a}`),e.text="Installing RapidKit from local path (test mode)",await mt(n,["install","-e",a]);}else {e.text="Installing RapidKit from PyPI";try{await mt(n,["install","rapidkit-core"]);}catch{throw new pt}}e.succeed("RapidKit installed globally"),await I.outputFile(v.join(t,".rapidkit-global"),`RapidKit installed globally with pipx
696
- `,"utf-8");}async function rt(t,e){let{skipGit:i=false,testMode:o=false,userConfig:r={},yes:n=false,installMethod:a,pythonVersion:s="3.10"}=e||{},c=a||r.defaultInstallMethod||"poetry";await be(t,v.basename(t),c),await $e(t);let p=wt("Registering workspace").start();try{c==="poetry"?await _e(t,s,p,o,r,n):c==="venv"?await Ht(t,s,p,o,r):await Ee(t,p,o,r,n),await Re(t,c),await Ie(t,c),p.succeed("Workspace registered");try{let{registerWorkspace:l}=await Promise.resolve().then(()=>(X(),q));await l(t,v.basename(t));}catch{}if(!i){p.start("Initializing git repository");try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:t}),p.succeed("Git repository initialized");}catch{p.warn("Could not initialize git repository");}}}catch(l){throw p.fail("Failed to register workspace"),l}}async function Ie(t,e){let r=`# RapidKit Workspace
694
+ 2. Try installing manually: cd ${w.basename(t)} && .venv/bin/python -m pip install rapidkit-core
695
+ 3. Use Poetry instead: npx rapidkit ${w.basename(t)} --install-method=poetry`))}}e.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:c}=await Promise.resolve().then(()=>(Pt(),Lt));if(!await c()&&!o){e.start("Installing RapidKit globally with pipx for CLI access");let p=await _t(e,n);try{await ft(p,["install","rapidkit-core"]),e.succeed("RapidKit installed globally");}catch(d){e.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${d}`);}}}catch(c){f.debug(`Global install check skipped: ${c}`);}}async function Ie(t,i,e,o,r=false){let n=await _t(i,r);if(i.start("Installing RapidKit globally with pipx"),e){let a=jt(o||{});if(!a)throw new M("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${a}`),i.text="Installing RapidKit from local path (test mode)",await ft(n,["install","-e",a]);}else {i.text="Installing RapidKit from PyPI";try{await ft(n,["install","rapidkit-core"]);}catch{throw new pt}}i.succeed("RapidKit installed globally"),await k.outputFile(w.join(t,".rapidkit-global"),`RapidKit installed globally with pipx
696
+ `,"utf-8");}async function rt(t,i){let{skipGit:e=false,testMode:o=false,userConfig:r={},yes:n=false,installMethod:a,pythonVersion:s="3.10"}=i||{},c=a||r.defaultInstallMethod||"poetry";await $e(t,w.basename(t),c),await Pe(t);let l=kt("Registering workspace").start();try{c==="poetry"?await Ee(t,s,l,o,r,n):c==="venv"?await Bt(t,s,l,o,r):await Ie(t,l,o,r,n),await Re(t,c),await Se(t,c),l.succeed("Workspace registered");try{let{registerWorkspace:p}=await Promise.resolve().then(()=>(Q(),q));await p(t,w.basename(t));}catch{}if(!e){l.start("Initializing git repository");try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:t}),l.succeed("Git repository initialized");}catch{l.warn("Could not initialize git repository");}}}catch(p){throw l.fail("Failed to register workspace"),p}}async function Se(t,i){let r=`# RapidKit Workspace
697
697
 
698
698
  This directory contains a RapidKit development environment.
699
699
 
700
700
  ## Installation Method
701
701
 
702
- **${e==="poetry"?"Poetry":e==="venv"?"Python venv + pip":"pipx (global)"}**
702
+ **${i==="poetry"?"Poetry":i==="venv"?"Python venv + pip":"pipx (global)"}**
703
703
 
704
704
  ## Getting Started
705
705
 
@@ -708,10 +708,10 @@ This directory contains a RapidKit development environment.
708
708
  This workspace includes a local launcher script so you can run the Python Core CLI without activating the environment:
709
709
 
710
710
  \`\`\`bash
711
- ${e==="poetry"?`# No activation needed (recommended):
711
+ ${i==="poetry"?`# No activation needed (recommended):
712
712
  ./rapidkit --help
713
713
  # or:
714
- poetry run rapidkit --help`:e==="venv"?`# No activation needed (recommended):
714
+ poetry run rapidkit --help`:i==="venv"?`# No activation needed (recommended):
715
715
  ./rapidkit --help
716
716
  # or direct:
717
717
  ./.venv/bin/rapidkit --help`:`# Optional: use the local launcher
@@ -722,8 +722,8 @@ poetry run rapidkit --help`:e==="venv"?`# No activation needed (recommended):
722
722
  ### 1. Activate Environment
723
723
 
724
724
  \`\`\`bash
725
- ${e==="poetry"?`source $(poetry env info --path)/bin/activate
726
- # Or simply use: poetry run rapidkit <command>`:e==="venv"?"source .venv/bin/activate # On Windows: .venv\\Scripts\\activate":"N/A (globally installed)"}
725
+ ${i==="poetry"?`source $(poetry env info --path)/bin/activate
726
+ # Or simply use: poetry run rapidkit <command>`:i==="venv"?"source .venv/bin/activate # On Windows: .venv\\Scripts\\activate":"N/A (globally installed)"}
727
727
  \`\`\`
728
728
 
729
729
  ### 2. Create Your First Project
@@ -790,8 +790,8 @@ For full documentation, visit: [RapidKit Docs](https://getrapidkit.com) *(or app
790
790
  ## Workspace Structure
791
791
 
792
792
  \`\`\`
793
- ${e==="venv"?".venv/ # Python virtual environment":""}
794
- ${e==="poetry"?"pyproject.toml # Poetry configuration":""}
793
+ ${i==="venv"?".venv/ # Python virtual environment":""}
794
+ ${i==="poetry"?"pyproject.toml # Poetry configuration":""}
795
795
  my-project/ # Your RapidKit projects go here
796
796
  README.md # This file
797
797
  \`\`\`
@@ -804,7 +804,7 @@ If you encounter issues:
804
804
  2. Check RapidKit installation: \`rapidkit --version\`
805
805
  3. Run diagnostics: \`rapidkit doctor\`
806
806
  4. Visit RapidKit documentation or GitHub issues
807
- `;await promises.writeFile(v.join(t,"README.md"),r,"utf-8");}async function bi(t,e,i){let o=wt("Creating demo workspace").start();try{await I.ensureDir(t),o.succeed("Directory created"),o.start("Setting up demo kit generator");let r=JSON.stringify({name:`${e}-workspace`,version:"1.0.0",private:!0,description:"RapidKit demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(v.join(t,"package.json"),r,"utf-8"),await promises.writeFile(v.join(t,"generate-demo.js"),`#!/usr/bin/env node
807
+ `;await promises.writeFile(w.join(t,"README.md"),r,"utf-8");}async function Ri(t,i,e){let o=kt("Creating demo workspace").start();try{await k.ensureDir(t),o.succeed("Directory created"),o.start("Setting up demo kit generator");let r=JSON.stringify({name:`${i}-workspace`,version:"1.0.0",private:!0,description:"RapidKit demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(w.join(t,"package.json"),r,"utf-8"),await promises.writeFile(w.join(t,"generate-demo.js"),`#!/usr/bin/env node
808
808
  /**
809
809
  * Demo Kit Generator - Create FastAPI demo projects
810
810
  *
@@ -1200,7 +1200,7 @@ venv/
1200
1200
  }
1201
1201
 
1202
1202
  main().catch(console.error);
1203
- `,"utf-8");try{await execa("chmod",["+x",v.join(t,"generate-demo.js")]);}catch{}let a=`# RapidKit Demo Workspace
1203
+ `,"utf-8");try{await execa("chmod",["+x",w.join(t,"generate-demo.js")]);}catch{}let a=`# RapidKit Demo Workspace
1204
1204
 
1205
1205
  Welcome to your RapidKit demo workspace! This environment lets you generate FastAPI demo projects using bundled RapidKit templates, without needing to install Python RapidKit.
1206
1206
 
@@ -1271,7 +1271,7 @@ pipx install rapidkit
1271
1271
  ## \u{1F6E0}\uFE0F Workspace Structure
1272
1272
 
1273
1273
  \`\`\`
1274
- ${e}/
1274
+ ${i}/
1275
1275
  \u251C\u2500\u2500 generate-demo.js # Demo project generator
1276
1276
  \u251C\u2500\u2500 README.md # This file
1277
1277
  \u2514\u2500\u2500 my-api/ # Your generated projects go here
@@ -1287,7 +1287,7 @@ ${e}/
1287
1287
  ---
1288
1288
 
1289
1289
  **Generated with RapidKit** | [GitHub](https://github.com/getrapidkit/rapidkit-npm)
1290
- `;if(await promises.writeFile(v.join(t,"README.md"),a,"utf-8"),o.succeed("Demo workspace setup complete"),!i){o.start("Initializing git repository");try{await execa("git",["init"],{cwd:t}),await I.outputFile(v.join(t,".gitignore"),`# Dependencies
1290
+ `;if(await promises.writeFile(w.join(t,"README.md"),a,"utf-8"),o.succeed("Demo workspace setup complete"),!e){o.start("Initializing git repository");try{await execa("git",["init"],{cwd:t}),await k.outputFile(w.join(t,".gitignore"),`# Dependencies
1291
1291
  node_modules/
1292
1292
 
1293
1293
  # Generated projects
@@ -1300,19 +1300,19 @@ __pycache__/
1300
1300
  *.pyc
1301
1301
  .venv/
1302
1302
  .env
1303
- `,"utf-8"),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:t}),o.succeed("Git repository initialized");}catch{o.warn("Could not initialize git repository");}}console.log(g.green(`
1303
+ `,"utf-8"),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:t}),o.succeed("Git repository initialized");}catch{o.warn("Could not initialize git repository");}}console.log(m.green(`
1304
1304
  \u2728 Demo workspace created successfully!
1305
- `)),console.log(g.cyan("\u{1F4C2} Location:"),g.white(t)),console.log(g.cyan(`\u{1F680} Get started:
1306
- `)),console.log(g.white(` cd ${e}`)),console.log(g.white(" node generate-demo.js my-api")),console.log(g.white(" cd my-api")),console.log(g.white(" rapidkit init")),console.log(g.white(" rapidkit dev")),console.log(),console.log(g.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For full RapidKit features:"),console.log(g.cyan(" pipx install rapidkit")),console.log();}catch(r){throw o.fail("Failed to create demo workspace"),r}}async function $i(t,e,i,o){console.log(g.cyan(`
1305
+ `)),console.log(m.cyan("\u{1F4C2} Location:"),m.white(t)),console.log(m.cyan(`\u{1F680} Get started:
1306
+ `)),console.log(m.white(` cd ${i}`)),console.log(m.white(" node generate-demo.js my-api")),console.log(m.white(" cd my-api")),console.log(m.white(" rapidkit init")),console.log(m.white(" rapidkit dev")),console.log(),console.log(m.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For full RapidKit features:"),console.log(m.cyan(" pipx install rapidkit")),console.log();}catch(r){throw o.fail("Failed to create demo workspace"),r}}async function Ci(t,i,e,o){console.log(m.cyan(`
1307
1307
  \u{1F50D} Dry-run mode - showing what would be created:
1308
- `)),console.log(g.white("\u{1F4C2} Project path:"),t),console.log(g.white("\u{1F4E6} Project type:"),i?"Demo workspace":"Full RapidKit environment"),i?(console.log(g.white(`
1309
- \u{1F4DD} Files to create:`)),console.log(g.gray(" - package.json")),console.log(g.gray(" - generate-demo.js (project generator)")),console.log(g.gray(" - README.md")),console.log(g.gray(" - .gitignore")),console.log(g.white(`
1310
- \u{1F3AF} Capabilities:`)),console.log(g.gray(" - Generate multiple FastAPI demo projects")),console.log(g.gray(" - No Python RapidKit installation required")),console.log(g.gray(" - Bundled templates included"))):(console.log(g.white(`
1311
- \u2699\uFE0F Configuration:`)),console.log(g.gray(` - Python version: ${o.pythonVersion||"3.10"}`)),console.log(g.gray(` - Install method: ${o.defaultInstallMethod||"poetry"}`)),console.log(g.gray(` - Git initialization: ${o.skipGit?"No":"Yes"}`)),console.log(g.white(`
1312
- \u{1F4DD} Files to create:`)),console.log(g.gray(" - pyproject.toml (Poetry) or .venv/ (venv)")),console.log(g.gray(" - README.md")),console.log(g.gray(" - .gitignore")),console.log(g.white(`
1313
- \u{1F3AF} Next steps after creation:`)),console.log(g.gray(" 1. Install RapidKit Python package")),console.log(g.gray(" 2. Create projects with rapidkit CLI")),console.log(g.gray(" 3. Add modules and customize"))),console.log(g.white(`
1308
+ `)),console.log(m.white("\u{1F4C2} Project path:"),t),console.log(m.white("\u{1F4E6} Project type:"),e?"Demo workspace":"Full RapidKit environment"),e?(console.log(m.white(`
1309
+ \u{1F4DD} Files to create:`)),console.log(m.gray(" - package.json")),console.log(m.gray(" - generate-demo.js (project generator)")),console.log(m.gray(" - README.md")),console.log(m.gray(" - .gitignore")),console.log(m.white(`
1310
+ \u{1F3AF} Capabilities:`)),console.log(m.gray(" - Generate multiple FastAPI demo projects")),console.log(m.gray(" - No Python RapidKit installation required")),console.log(m.gray(" - Bundled templates included"))):(console.log(m.white(`
1311
+ \u2699\uFE0F Configuration:`)),console.log(m.gray(` - Python version: ${o.pythonVersion||"3.10"}`)),console.log(m.gray(` - Install method: ${o.defaultInstallMethod||"poetry"}`)),console.log(m.gray(` - Git initialization: ${o.skipGit?"No":"Yes"}`)),console.log(m.white(`
1312
+ \u{1F4DD} Files to create:`)),console.log(m.gray(" - pyproject.toml (Poetry) or .venv/ (venv)")),console.log(m.gray(" - README.md")),console.log(m.gray(" - .gitignore")),console.log(m.white(`
1313
+ \u{1F3AF} Next steps after creation:`)),console.log(m.gray(" 1. Install RapidKit Python package")),console.log(m.gray(" 2. Create projects with rapidkit CLI")),console.log(m.gray(" 3. Add modules and customize"))),console.log(m.white(`
1314
1314
  \u{1F4A1} To proceed with actual creation, run without --dry-run flag
1315
- `));}$();gt();var _i=fileURLToPath(import.meta.url),Ei=v.dirname(_i);function Ii(t=32){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=Ci.randomBytes(t),o="";for(let r=0;r<t;r++)o+=e[i[r]%e.length];return o}async function Se(t,e){let o=(e.template||"fastapi")==="fastapi",r=o?"FastAPI":"NestJS",n=wt(`Generating ${r} project...`).start();try{let a=v.resolve(Ei,".."),s=o?"fastapi-standard":"nestjs-standard",c=v.join(a,"templates","kits",s),p=Ri.configure(c,{autoescape:!1,trimBlocks:!0,lstripBlocks:!0});p.addFilter("generate_secret",function(f,w=32){return Ii(w)});let l={project_name:e.project_name,author:e.author||"RapidKit User",description:e.description||(o?"FastAPI service generated with RapidKit":"NestJS application generated with RapidKit"),app_version:e.app_version||"0.1.0",license:e.license||"MIT",package_manager:e.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:U()},d;o?d=["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"]:d=["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 f of d){let w=v.join(c,f);try{await promises.access(w);}catch{continue}let A=await promises.readFile(w,"utf-8"),D=p.renderString(A,l),K=f.replace(/\.j2$/,""),At=v.join(t,K);await promises.mkdir(v.dirname(At),{recursive:!0}),await promises.writeFile(At,D),(K.endsWith(".rapidkit/rapidkit")||K.endsWith(".rapidkit/cli.py")||K.endsWith(".rapidkit/activate")||K==="rapidkit")&&await promises.chmod(At,493);}if(o){let f=v.join(c,".rapidkit","context.json"),w=v.join(t,".rapidkit","context.json");try{await promises.mkdir(v.join(t,".rapidkit"),{recursive:!0}),await promises.copyFile(f,w);}catch{await promises.mkdir(v.join(t,".rapidkit"),{recursive:!0});let D=e.engine||"pip";await promises.writeFile(w,JSON.stringify({engine:D,created_by:"rapidkit-npm-fallback"},null,2));}}let m=o?`# Python
1315
+ `));}R();gt();var Si=fileURLToPath(import.meta.url),Ai=w.dirname(Si);function Ni(t=32){let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Ii.randomBytes(t),o="";for(let r=0;r<t;r++)o+=i[e[r]%i.length];return o}async function Ae(t,i){let o=(i.template||"fastapi")==="fastapi",r=o?"FastAPI":"NestJS",n=kt(`Generating ${r} project...`).start();try{let a=w.resolve(Ai,".."),s=o?"fastapi-standard":"nestjs-standard",c=w.join(a,"templates","kits",s),l=_i.configure(c,{autoescape:!1,trimBlocks:!0,lstripBlocks:!0});l.addFilter("generate_secret",function(y,x=32){return Ni(x)});let p={project_name:i.project_name,author:i.author||"RapidKit User",description:i.description||(o?"FastAPI service generated with RapidKit":"NestJS application generated with RapidKit"),app_version:i.app_version||"0.1.0",license:i.license||"MIT",package_manager:i.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:H()},d;o?d=["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"]:d=["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 y of d){let x=w.join(c,y);try{await promises.access(x);}catch{continue}let A=await promises.readFile(x,"utf-8"),D=l.renderString(A,p),O=y.replace(/\.j2$/,""),et=w.join(t,O);await promises.mkdir(w.dirname(et),{recursive:!0}),await promises.writeFile(et,D),(O.endsWith(".rapidkit/rapidkit")||O.endsWith(".rapidkit/cli.py")||O.endsWith(".rapidkit/activate")||O==="rapidkit")&&await promises.chmod(et,493);}if(o){let y=w.join(c,".rapidkit","context.json"),x=w.join(t,".rapidkit","context.json");try{await promises.mkdir(w.join(t,".rapidkit"),{recursive:!0}),await promises.copyFile(y,x);}catch{await promises.mkdir(w.join(t,".rapidkit"),{recursive:!0});let D=i.engine||"pip";await promises.writeFile(x,JSON.stringify({engine:D,created_by:"rapidkit-npm-fallback"},null,2));}}let u=o?`# Python
1316
1316
  __pycache__/
1317
1317
  *.py[cod]
1318
1318
  *$py.class
@@ -1380,15 +1380,15 @@ Thumbs.db
1380
1380
 
1381
1381
  # Coverage
1382
1382
  coverage/
1383
- `;if(await promises.writeFile(v.join(t,".gitignore"),m),n.succeed(`${r} project generated!`),!e.skipGit){let f=wt("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m",`Initial commit: ${r} project via RapidKit`],{cwd:t}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}if(!o&&!e.skipInstall){let f=e.package_manager||"npm",w=wt(`Installing dependencies with ${f}...`).start();try{await execa(f,f==="yarn"?["install"]:f==="pnpm"?["install"]:["install"],{cwd:t}),w.succeed("Dependencies installed");}catch{w.warn(`Could not install dependencies. Run '${f} install' manually.`);}}let y=v.basename(t);console.log(`
1384
- ${g.yellow("\u26A0\uFE0F Limited offline mode:")} This project was created using basic templates.
1385
- ${g.gray("For full kit features, install Python 3.10+ and rapidkit-core:")}
1386
- ${g.cyan(" sudo apt install python3 python3-pip python3-venv")}
1387
- ${g.cyan(" pip install rapidkit-core")}
1383
+ `;if(await promises.writeFile(w.join(t,".gitignore"),u),n.succeed(`${r} project generated!`),!i.skipGit){let y=kt("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m",`Initial commit: ${r} project via RapidKit`],{cwd:t}),y.succeed("Git repository initialized");}catch{y.warn("Could not initialize git repository");}}if(!o&&!i.skipInstall){let y=i.package_manager||"npm",x=kt(`Installing dependencies with ${y}...`).start();try{await execa(y,y==="yarn"?["install"]:y==="pnpm"?["install"]:["install"],{cwd:t}),x.succeed("Dependencies installed");}catch{x.warn(`Could not install dependencies. Run '${y} install' manually.`);}}let h=w.basename(t);console.log(`
1384
+ ${m.yellow("\u26A0\uFE0F Limited offline mode:")} This project was created using basic templates.
1385
+ ${m.gray("For full kit features, install Python 3.10+ and rapidkit-core:")}
1386
+ ${m.cyan(" sudo apt install python3 python3-pip python3-venv")}
1387
+ ${m.cyan(" pip install rapidkit-core")}
1388
1388
  `),console.log(o?`
1389
- ${g.green("\u2728 FastAPI project created successfully!")}
1389
+ ${m.green("\u2728 FastAPI project created successfully!")}
1390
1390
 
1391
- ${g.bold("\u{1F4C2} Project structure:")}
1391
+ ${m.bold("\u{1F4C2} Project structure:")}
1392
1392
  ${t}/
1393
1393
  \u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
1394
1394
  \u251C\u2500\u2500 src/
@@ -1400,12 +1400,12 @@ ${t}/
1400
1400
  \u251C\u2500\u2500 pyproject.toml # Poetry configuration
1401
1401
  \u2514\u2500\u2500 README.md
1402
1402
 
1403
- ${g.bold("\u{1F680} Get started:")}
1404
- ${g.cyan(`cd ${y}`)}
1405
- ${g.cyan("npx rapidkit init")} ${g.gray("# Install dependencies")}
1406
- ${g.cyan("npx rapidkit dev")} ${g.gray("# Start dev server")}
1403
+ ${m.bold("\u{1F680} Get started:")}
1404
+ ${m.cyan(`cd ${h}`)}
1405
+ ${m.cyan("npx rapidkit init")} ${m.gray("# Install dependencies")}
1406
+ ${m.cyan("npx rapidkit dev")} ${m.gray("# Start dev server")}
1407
1407
 
1408
- ${g.bold("\u{1F4DA} Available commands:")}
1408
+ ${m.bold("\u{1F4DA} Available commands:")}
1409
1409
  npx rapidkit init # Install dependencies (poetry install)
1410
1410
  npx rapidkit dev # Start dev server with hot reload
1411
1411
  npx rapidkit start # Start production server
@@ -1413,12 +1413,12 @@ ${g.bold("\u{1F4DA} Available commands:")}
1413
1413
  npx rapidkit lint # Lint code
1414
1414
  npx rapidkit format # Format code
1415
1415
 
1416
- ${g.gray("Alternative: make dev, ./rapidkit dev, poetry run dev")}
1417
- ${g.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
1416
+ ${m.gray("Alternative: make dev, ./rapidkit dev, poetry run dev")}
1417
+ ${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
1418
1418
  `:`
1419
- ${g.green("\u2728 NestJS project created successfully!")}
1419
+ ${m.green("\u2728 NestJS project created successfully!")}
1420
1420
 
1421
- ${g.bold("\u{1F4C2} Project structure:")}
1421
+ ${m.bold("\u{1F4C2} Project structure:")}
1422
1422
  ${t}/
1423
1423
  \u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
1424
1424
  \u251C\u2500\u2500 src/
@@ -1430,13 +1430,13 @@ ${t}/
1430
1430
  \u251C\u2500\u2500 package.json # Dependencies
1431
1431
  \u2514\u2500\u2500 README.md
1432
1432
 
1433
- ${g.bold("\u{1F680} Get started:")}
1434
- ${g.cyan(`cd ${y}`)}
1435
- ${g.cyan("npx rapidkit init")} ${g.gray("# Install dependencies")}
1436
- ${g.cyan("cp .env.example .env")}
1437
- ${g.cyan("npx rapidkit dev")} ${g.gray("# Start dev server")}
1433
+ ${m.bold("\u{1F680} Get started:")}
1434
+ ${m.cyan(`cd ${h}`)}
1435
+ ${m.cyan("npx rapidkit init")} ${m.gray("# Install dependencies")}
1436
+ ${m.cyan("cp .env.example .env")}
1437
+ ${m.cyan("npx rapidkit dev")} ${m.gray("# Start dev server")}
1438
1438
 
1439
- ${g.bold("\u{1F4DA} Available commands:")}
1439
+ ${m.bold("\u{1F4DA} Available commands:")}
1440
1440
  npx rapidkit init # Install dependencies
1441
1441
  npx rapidkit dev # Start dev server with hot reload
1442
1442
  npx rapidkit start # Start production server
@@ -1445,44 +1445,57 @@ ${g.bold("\u{1F4DA} Available commands:")}
1445
1445
  npx rapidkit lint # Lint code
1446
1446
  npx rapidkit format # Format code
1447
1447
 
1448
- ${g.bold("\u{1F310} API endpoints:")}
1448
+ ${m.bold("\u{1F310} API endpoints:")}
1449
1449
  http://localhost:8000/health # Health check
1450
1450
  http://localhost:8000/docs # Swagger docs
1451
1451
  http://localhost:8000/examples/notes # Example API
1452
1452
 
1453
- ${g.gray("Alternative: npm run start:dev, ./rapidkit dev")}
1454
- ${g.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
1455
- `);}catch(a){throw n.fail(`Failed to generate ${r} project`),a}}$();st();async function Ae(){let t=process.platform==="win32"?["python","python3"]:["python3","python"];for(let e of t)try{let{stdout:i}=await execa(e,["--version"],{timeout:3e3}),o=i.match(/Python (\d+\.\d+\.\d+)/);if(o){let r=o[1],[n,a]=r.split(".").map(Number);return n<3||n===3&&a<10?{status:"warn",message:`Python ${r} (requires 3.10+)`,details:`${e} found but version is below minimum requirement`}:{status:"ok",message:`Python ${r}`,details:`Using ${e}`}}}catch{continue}return {status:"error",message:"Python not found",details:"Install Python 3.10+ and ensure it's in PATH"}}async function Ne(){try{let{stdout:t}=await execa("poetry",["--version"],{timeout:3e3}),e=t.match(/Poetry .*version ([\d.]+)/);return e?{status:"ok",message:`Poetry ${e[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 De(){try{let{stdout:t}=await execa("pipx",["--version"],{timeout:3e3});return {status:"ok",message:`pipx ${t.trim()}`,details:"Available for global tool installation"}}catch{return {status:"warn",message:"pipx not installed",details:"Optional: Install for isolated Python tools"}}}async function Te(){let t=process.platform==="win32"?["python","python3"]:["python3","python"],e=process.env.HOME||process.env.USERPROFILE||"",i=[v.join(e,".local","bin","rapidkit"),v.join(e,"AppData","Roaming","Python","Scripts","rapidkit.exe"),v.join(e,".pyenv","shims","rapidkit"),"/usr/local/bin/rapidkit","/usr/bin/rapidkit"];try{let{stdout:o,exitCode:r}=await execa("rapidkit",["--version"],{timeout:3e3,reject:!1});if(r===0&&(o.includes("RapidKit Version")||o.includes("RapidKit"))){let n=o.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(n)return {status:"ok",message:`RapidKit Core ${n[1]}`,details:"Available via PATH"}}}catch{}for(let o of i)try{if(await I.pathExists(o)){let{stdout:r,exitCode:n}=await execa(o,["--version"],{timeout:3e3,reject:!1});if(n===0&&(r.includes("RapidKit Version")||r.includes("RapidKit"))){let a=r.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(a)return {status:"ok",message:`RapidKit Core ${a[1]}`,details:`Installed at ${o}`}}}}catch{continue}try{let o=v.join(process.cwd(),".venv","bin","rapidkit");if(await I.pathExists(o)){let{stdout:r,exitCode:n}=await execa(o,["--version"],{timeout:3e3,reject:!1});if(n===0&&(r.includes("RapidKit Version")||r.includes("RapidKit"))){let a=r.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(a)return {status:"ok",message:`RapidKit Core ${a[1]}`,details:"Installed in workspace virtualenv"}}}}catch{}try{let{stdout:o,exitCode:r}=await execa("poetry",["run","rapidkit","--version"],{timeout:3e3,reject:!1});if(r===0&&(o.includes("RapidKit Version")||o.includes("RapidKit"))){let n=o.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(n)return {status:"ok",message:`RapidKit Core ${n[1]}`,details:"Available via Poetry"}}}catch{}for(let o of t)try{let{stdout:r,exitCode:n}=await execa(o,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:3e3,reject:!1});if(n===0&&r&&!r.includes("Traceback")&&!r.includes("ModuleNotFoundError")){let a=r.trim();if(a)return {status:"ok",message:`RapidKit Core ${a}`,details:`Available in ${o} environment`}}}catch{continue}return {status:"error",message:"RapidKit Core not installed",details:"Install with: pipx install rapidkit-core"}}async function Si(t){let i={name:v.basename(t),path:t,venvActive:false,depsInstalled:false,coreInstalled:false,issues:[]},o=v.join(t,".rapidkit");if(!await I.pathExists(o))return i.issues.push("Not a valid RapidKit project (missing .rapidkit directory)"),i;let r=v.join(t,".venv");if(await I.pathExists(r)){i.venvActive=true;let n=process.platform==="win32"?v.join(r,"Scripts","python.exe"):v.join(r,"bin","python");if(await I.pathExists(n)){try{let{stdout:s}=await execa(n,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:2e3});i.coreInstalled=!0,i.coreVersion=s.trim();}catch{i.issues.push("RapidKit Core not installed in virtual environment");}let a=process.platform==="win32"?v.join(r,"Lib","site-packages"):v.join(r,"lib","python*","site-packages");try{let s=await I.pathExists(v.dirname(a));i.depsInstalled=s,s||i.issues.push("Dependencies not installed (run: rapidkit init)");}catch{i.issues.push("Could not verify dependency installation");}}else i.issues.push("Virtual environment exists but Python executable not found");}else i.issues.push("Virtual environment not created (run: rapidkit init)");return i}async function Ai(t){let e=t,i=v.parse(e).root;for(;e!==i;){let o=[v.join(e,".rapidkit-workspace"),v.join(e,".rapidkit","workspace-marker.json"),v.join(e,".rapidkit","config.json")];for(let r of o)if(await I.pathExists(r))return e;e=v.dirname(e);}return null}async function Ni(t){let e=v.basename(t);try{let o=v.join(t,".rapidkit-workspace");await I.pathExists(o)&&(e=(await I.readJSON(o)).name||e);}catch{try{let o=v.join(t,".rapidkit","config.json");e=(await I.readJSON(o)).workspace_name||e;}catch{}}let i={workspacePath:t,workspaceName:e,python:await Ae(),poetry:await Ne(),pipx:await De(),rapidkitCore:await Te(),projects:[]};try{let o=await I.readdir(t,{withFileTypes:!0});for(let r of o)if(r.isDirectory()&&!r.name.startsWith(".")){let n=v.join(t,r.name),a=v.join(n,".rapidkit");if(await I.pathExists(a)){let s=await Si(n);i.projects.push(s);}}}catch(o){u.debug(`Failed to scan workspace projects: ${o}`);}return i}function Q(t,e){let i=t.status==="ok"?"\u2705":t.status==="warn"?"\u26A0\uFE0F":"\u274C",o=t.status==="ok"?g.green:t.status==="warn"?g.yellow:g.red;console.log(`${i} ${g.bold(e)}: ${o(t.message)}`),t.details&&console.log(` ${g.gray(t.details)}`);}function Di(t){let e=t.issues.length>0,i=e?"\u26A0\uFE0F":"\u2705",o=e?g.yellow:g.green;console.log(`
1456
- ${i} ${g.bold("Project")}: ${o(t.name)}`),console.log(` ${g.gray(`Path: ${t.path}`)}`),t.venvActive?console.log(` \u2705 Virtual environment: ${g.green("Active")}`):console.log(` \u274C Virtual environment: ${g.red("Not found")}`),t.coreInstalled?console.log(` \u2705 RapidKit Core: ${g.green(t.coreVersion||"Installed")}`):console.log(` \u274C RapidKit Core: ${g.red("Not installed")}`),t.depsInstalled?console.log(` \u2705 Dependencies: ${g.green("Installed")}`):console.log(` \u26A0\uFE0F Dependencies: ${g.yellow("Not verified")}`),t.issues.length>0&&(console.log(` ${g.bold("Issues:")}`),t.issues.forEach(r=>{console.log(` \u2022 ${g.yellow(r)}`);}));}async function Oe(t={}){if(console.log(g.bold.cyan(`
1453
+ ${m.gray("Alternative: npm run start:dev, ./rapidkit dev")}
1454
+ ${m.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
1455
+ `);}catch(a){throw n.fail(`Failed to generate ${r} project`),a}}R();ct();async function De(){let t=process.platform==="win32"?["python","python3"]:["python3","python"];for(let i of t)try{let{stdout:e}=await execa(i,["--version"],{timeout:3e3}),o=e.match(/Python (\d+\.\d+\.\d+)/);if(o){let r=o[1],[n,a]=r.split(".").map(Number);return n<3||n===3&&a<10?{status:"warn",message:`Python ${r} (requires 3.10+)`,details:`${i} found but version is below minimum requirement`}:{status:"ok",message:`Python ${r}`,details:`Using ${i}`}}}catch{continue}return {status:"error",message:"Python not found",details:"Install Python 3.10+ and ensure it's in PATH"}}async function Te(){try{let{stdout:t}=await execa("poetry",["--version"],{timeout:3e3}),i=t.match(/Poetry .*version ([\d.]+)/);return i?{status:"ok",message:`Poetry ${i[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 Fe(){try{let{stdout:t}=await execa("pipx",["--version"],{timeout:3e3});return {status:"ok",message:`pipx ${t.trim()}`,details:"Available for global tool installation"}}catch{return {status:"warn",message:"pipx not installed",details:"Optional: Install for isolated Python tools"}}}async function Oe(){let t=process.platform==="win32"?["python","python3"]:["python3","python"],i=process.env.HOME||process.env.USERPROFILE||"",e=[w.join(i,".local","bin","rapidkit"),w.join(i,"AppData","Roaming","Python","Scripts","rapidkit.exe"),w.join(i,".pyenv","shims","rapidkit"),"/usr/local/bin/rapidkit","/usr/bin/rapidkit"];try{let{stdout:o,exitCode:r}=await execa("rapidkit",["--version"],{timeout:3e3,reject:!1});if(r===0&&(o.includes("RapidKit Version")||o.includes("RapidKit"))){let n=o.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(n)return {status:"ok",message:`RapidKit Core ${n[1]}`,details:"Available via PATH"}}}catch{}for(let o of e)try{if(await k__default.pathExists(o)){let{stdout:r,exitCode:n}=await execa(o,["--version"],{timeout:3e3,reject:!1});if(n===0&&(r.includes("RapidKit Version")||r.includes("RapidKit"))){let a=r.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(a)return {status:"ok",message:`RapidKit Core ${a[1]}`,details:`Installed at ${o}`}}}}catch{continue}try{let o=w.join(process.cwd(),".venv","bin","rapidkit");if(await k__default.pathExists(o)){let{stdout:r,exitCode:n}=await execa(o,["--version"],{timeout:3e3,reject:!1});if(n===0&&(r.includes("RapidKit Version")||r.includes("RapidKit"))){let a=r.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(a)return {status:"ok",message:`RapidKit Core ${a[1]}`,details:"Installed in workspace virtualenv"}}}}catch{}try{let{stdout:o,exitCode:r}=await execa("poetry",["run","rapidkit","--version"],{timeout:3e3,reject:!1});if(r===0&&(o.includes("RapidKit Version")||o.includes("RapidKit"))){let n=o.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(n)return {status:"ok",message:`RapidKit Core ${n[1]}`,details:"Available via Poetry"}}}catch{}for(let o of t)try{let{stdout:r,exitCode:n}=await execa(o,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:3e3,reject:!1});if(n===0&&r&&!r.includes("Traceback")&&!r.includes("ModuleNotFoundError")){let a=r.trim();if(a)return {status:"ok",message:`RapidKit Core ${a}`,details:`Available in ${o} environment`}}}catch{continue}return {status:"error",message:"RapidKit Core not installed",details:"Install with: pipx install rapidkit-core"}}async function qt(t,i){let e=w.join(t,"Dockerfile");i.hasDocker=await k__default.pathExists(e);let o=w.join(t,"tests"),r=w.join(t,"test");if(i.hasTests=await k__default.pathExists(o)||await k__default.pathExists(r),i.framework==="NestJS"){let n=w.join(t,".eslintrc.js"),a=w.join(t,".eslintrc.json");i.hasCodeQuality=await k__default.pathExists(n)||await k__default.pathExists(a);}else if(i.framework==="FastAPI"){let n=w.join(t,"ruff.toml"),a=w.join(t,"pyproject.toml");if(await k__default.pathExists(a))try{let s=await k__default.readFile(a,"utf8");i.hasCodeQuality=s.includes("[tool.ruff]")||await k__default.pathExists(n);}catch{i.hasCodeQuality=await k__default.pathExists(n);}}try{if(i.framework==="NestJS"){let{stdout:n}=await execa("npm",["audit","--json"],{cwd:t,reject:!1});if(n)try{let s=JSON.parse(n).metadata?.vulnerabilities;s&&(i.vulnerabilities=(s.high||0)+(s.critical||0)+(s.moderate||0));}catch{}}else if(i.framework==="FastAPI"){let n=w.join(t,".venv"),a=process.platform==="win32"?w.join(n,"Scripts","python.exe"):w.join(n,"bin","python");if(await k__default.pathExists(a))try{let{stdout:s}=await execa(a,["-m","pip","list","--format=json"],{timeout:5e3,reject:!1});if(s){let c=JSON.parse(s);i.vulnerabilities=0;}}catch{}}}catch{}}async function Ti(t){let e={name:w.basename(t),path:t,venvActive:false,depsInstalled:false,coreInstalled:false,issues:[],fixCommands:[]},o=w.join(t,".rapidkit");if(!await k__default.pathExists(o))return e.issues.push("Not a valid RapidKit project (missing .rapidkit directory)"),e;try{let c=w.join(t,"registry.json");if(await k__default.pathExists(c)){let l=await k__default.readJson(c);l.installed_modules&&(e.stats={modules:l.installed_modules.length});}}catch{}try{let c=w.join(o,"project.json");if(await k__default.pathExists(c)){let l=await k__default.readJson(c);l.kit&&(e.kit=l.kit);}}catch{}try{let c=w.join(t,".git");if(await k__default.pathExists(c)){let{stdout:l}=await execa("git",["log","-1","--format=%cr"],{cwd:t,reject:!1});l&&(e.lastModified=l.trim());}else {let l=await k__default.stat(t),d=Date.now()-l.mtime.getTime(),u=Math.floor(d/(1e3*60*60*24));e.lastModified=u===0?"today":`${u} day${u>1?"s":""} ago`;}}catch{}let r=w.join(t,"package.json"),n=w.join(t,"pyproject.toml"),a=await k__default.pathExists(r),s=await k__default.pathExists(n);if(a){e.framework="NestJS",e.venvActive=true;let c=w.join(t,"node_modules");if(await k__default.pathExists(c))try{let u=(await k__default.readdir(c)).filter(h=>!h.startsWith(".")&&!h.startsWith("_"));e.depsInstalled=u.length>0;}catch{e.depsInstalled=false;}e.depsInstalled||(e.issues.push("Dependencies not installed (node_modules empty or missing)"),e.fixCommands?.push(`cd ${t} && rapidkit init`)),e.coreInstalled=false;let l=w.join(t,".env");if(e.hasEnvFile=await k__default.pathExists(l),!e.hasEnvFile){let d=w.join(t,".env.example");await k__default.pathExists(d)&&(e.issues.push("Environment file missing (found .env.example)"),e.fixCommands?.push(`cd ${t} && cp .env.example .env`));}let p=w.join(t,"src");if(e.modulesHealthy=true,e.missingModules=[],await k__default.pathExists(p))try{let d=await k__default.readdir(p);e.modulesHealthy=d.length>0;}catch{e.modulesHealthy=false;}return await qt(t,e),e}if(s){e.framework="FastAPI";let c=w.join(t,".venv");if(await k__default.pathExists(c)){e.venvActive=true;let u=process.platform==="win32"?w.join(c,"Scripts","python.exe"):w.join(c,"bin","python");if(await k__default.pathExists(u)){try{let{stdout:h}=await execa(u,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:2e3});e.coreInstalled=!0,e.coreVersion=h.trim();}catch{e.coreInstalled=false;}try{await execa(u,["-c","import fastapi"],{timeout:2e3}),e.depsInstalled=!0;}catch{try{let h=w.join(c,"lib");if(await k__default.pathExists(h)){let x=(await k__default.readdir(h)).find(A=>A.startsWith("python"));if(x){let A=w.join(h,x,"site-packages");if(await k__default.pathExists(A)){let O=(await k__default.readdir(A)).filter(et=>!et.startsWith("_")&&!et.includes("dist-info")&&!["pip","setuptools","wheel","pkg_resources"].includes(et));e.depsInstalled=O.length>0;}}}e.depsInstalled||(e.issues.push("Dependencies not installed"),e.fixCommands?.push(`cd ${t} && rapidkit init`));}catch{e.issues.push("Could not verify dependency installation");}}}else e.issues.push("Virtual environment exists but Python executable not found");}else e.issues.push("Virtual environment not created"),e.fixCommands?.push(`cd ${t} && rapidkit init`);let l=w.join(t,".env");if(e.hasEnvFile=await k__default.pathExists(l),!e.hasEnvFile){let u=w.join(t,".env.example");await k__default.pathExists(u)&&(e.issues.push("Environment file missing (found .env.example)"),e.fixCommands?.push(`cd ${t} && cp .env.example .env`));}let p=w.join(t,"src"),d=w.join(t,"modules");if(e.modulesHealthy=true,e.missingModules=[],await k__default.pathExists(p)){let u=w.join(p,"__init__.py");await k__default.pathExists(u)||(e.modulesHealthy=false,e.missingModules.push("src/__init__.py"));}if(await k__default.pathExists(d))try{let u=await Me(d);for(let h of u){let y=w.join(d,h,"__init__.py");await k__default.pathExists(y)||(e.modulesHealthy=!1,e.missingModules.push(`modules/${h}/__init__.py`));}}catch{}return !e.modulesHealthy&&e.missingModules.length>0&&e.issues.push(`Missing module init files: ${e.missingModules.join(", ")}`),await qt(t,e),e}return e.issues.push("Unknown project type (no package.json or pyproject.toml)"),await qt(t,e),e}async function Me(t){try{return (await k__default.readdir(t,{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch{try{let i=await k__default.readdir(t),e=[];for(let o of i)try{(await k__default.stat(w.join(t,o))).isDirectory()&&e.push(o);}catch{continue}return e}catch{return []}}}async function Fi(t,i,e){let o=new Set,r=[{dir:t,depth:0}];for(;r.length>0;){let n=r.shift();if(!n)break;try{let a=await k__default.readdir(n.dir);for(let s of a){if(e.has(s))continue;let c=w.join(n.dir,s),l;try{l=await k__default.stat(c);}catch{continue}if(!l.isDirectory())continue;let p=w.join(c,".rapidkit");if(await k__default.pathExists(p)){o.add(c);continue}n.depth<i&&r.push({dir:c,depth:n.depth+1});}}catch{continue}}return Array.from(o)}async function Oi(t){let i=t,e=w.parse(i).root;for(;i!==e;){let o=[w.join(i,".rapidkit-workspace"),w.join(i,".rapidkit","workspace-marker.json"),w.join(i,".rapidkit","config.json")];for(let r of o)if(await k__default.pathExists(r))return i;i=w.dirname(i);}return null}function Mi(t,i){let e=0,o=0,r=0;return t.forEach(a=>{a.status==="ok"?e++:a.status==="warn"?o++:a.status==="error"&&r++;}),i.forEach(a=>{a.issues.length===0&&a.venvActive&&a.depsInstalled?e++:a.issues.length>0&&o++;}),{total:e+o+r,passed:e,warnings:o,errors:r}}async function Ki(t){let i=w.basename(t);try{let r=w.join(t,".rapidkit-workspace");await k__default.pathExists(r)&&(i=(await k__default.readJSON(r)).name||i);}catch{try{let r=w.join(t,".rapidkit","config.json");i=(await k__default.readJSON(r)).workspace_name||i;}catch{}}let e={workspacePath:t,workspaceName:i,python:await De(),poetry:await Te(),pipx:await Fe(),rapidkitCore:await Oe(),projects:[]};try{let r=new Set([".git",".venv","node_modules",".rapidkit","dist","build","coverage","__pycache__"]),n=new Set,a=w.join(t,".rapidkit");await k__default.pathExists(a)&&n.add(t);let s=async(c,l)=>{if(l<0)return;let p=await Me(c);for(let d of p){if(r.has(d))continue;let u=w.join(c,d),h=w.join(u,".rapidkit");if(await k__default.pathExists(h)){n.add(u);continue}l>0&&await s(u,l-1);}};if(await s(t,1),f.debug(`Workspace scan (shallow) found ${n.size} project(s)`),n.size===0){let c=await Fi(t,3,r);c.forEach(l=>n.add(l)),f.debug(`Workspace scan (deep fallback) found ${c.length} project(s)`);}n.size>0&&f.debug(`Workspace projects detected: ${Array.from(n).join(", ")}`);for(let c of n){let l=await Ti(c);e.projects.push(l);}}catch(r){f.debug(`Failed to scan workspace projects: ${r}`);}let o=[e.python,e.poetry,e.pipx,e.rapidkitCore];if(e.healthScore=Mi(o,e.projects),e.rapidkitCore.status==="ok"){let r=e.rapidkitCore.message.match(/([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);r&&(e.coreVersion=r[1]);}return e}function X(t,i){let e=t.status==="ok"?"\u2705":t.status==="warn"?"\u26A0\uFE0F":"\u274C",o=t.status==="ok"?m.green:t.status==="warn"?m.yellow:m.red;console.log(`${e} ${m.bold(i)}: ${o(t.message)}`),t.details&&console.log(` ${m.gray(t.details)}`);}function Wi(t){let i=t.issues.length>0,e=i?"\u26A0\uFE0F":"\u2705",o=i?m.yellow:m.green;if(console.log(`
1456
+ ${e} ${m.bold("Project")}: ${o(t.name)}`),t.framework){let s=t.framework==="FastAPI"?"\u{1F40D}":t.framework==="NestJS"?"\u{1F985}":"\u{1F4E6}";console.log(` ${s} Framework: ${m.cyan(t.framework)}${t.kit?m.gray(` (${t.kit})`):""}`);}if(console.log(` ${m.gray(`Path: ${t.path}`)}`),!(t.venvActive&&!t.coreInstalled)&&(t.venvActive?console.log(` \u2705 Virtual environment: ${m.green("Active")}`):console.log(` \u274C Virtual environment: ${m.red("Not found")}`),t.coreInstalled?console.log(` ${m.dim("\u2139")} RapidKit Core: ${m.gray(t.coreVersion||"In venv")} ${m.dim("(optional)")}`):console.log(` ${m.dim("\u2139")} RapidKit Core: ${m.gray("Using global installation")} ${m.dim("(recommended)")}`)),t.depsInstalled?console.log(` \u2705 Dependencies: ${m.green("Installed")}`):console.log(` \u26A0\uFE0F Dependencies: ${m.yellow("Not installed")}`),t.hasEnvFile!==void 0&&(t.hasEnvFile?console.log(` \u2705 Environment: ${m.green(".env configured")}`):console.log(` \u26A0\uFE0F Environment: ${m.yellow(".env missing")}`)),t.modulesHealthy!==void 0&&(t.modulesHealthy?console.log(` \u2705 Modules: ${m.green("Healthy")}`):t.missingModules&&t.missingModules.length>0&&console.log(` \u26A0\uFE0F Modules: ${m.yellow(`Missing ${t.missingModules.length} init file(s)`)}`)),t.stats){let s=[];t.stats.modules!==void 0&&s.push(`${t.stats.modules} module${t.stats.modules!==1?"s":""}`),s.length>0&&console.log(` \u{1F4CA} Stats: ${m.cyan(s.join(" \u2022 "))}`);}t.lastModified&&console.log(` \u{1F552} Last Modified: ${m.gray(t.lastModified)}`);let a=[];if(t.hasTests!==void 0&&a.push(t.hasTests?"\u2705 Tests":m.dim("\u2298 No tests")),t.hasDocker!==void 0&&a.push(t.hasDocker?"\u2705 Docker":m.dim("\u2298 No Docker")),t.hasCodeQuality!==void 0){let s=t.framework==="NestJS"?"ESLint":"Ruff";a.push(t.hasCodeQuality?`\u2705 ${s}`:m.dim(`\u2298 No ${s}`));}a.length>0&&console.log(` ${a.join(" \u2022 ")}`),t.vulnerabilities!==void 0&&t.vulnerabilities>0&&console.log(` \u26A0\uFE0F Security: ${m.yellow(`${t.vulnerabilities} vulnerability(ies) found`)}`),t.issues.length>0&&(console.log(` ${m.bold("Issues:")}`),t.issues.forEach(s=>{console.log(` \u2022 ${m.yellow(s)}`);}),t.fixCommands&&t.fixCommands.length>0&&(console.log(`
1457
+ ${m.bold.cyan("\u{1F527} Quick Fix:")}`),t.fixCommands.forEach(s=>{console.log(` ${m.cyan("$")} ${m.white(s)}`);})));}async function Ne(t,i=false){let e=t.filter(r=>r.fixCommands&&r.fixCommands.length>0);if(e.length===0){console.log(m.green(`
1458
+ \u2705 No fixes needed - all projects are healthy!`));return}console.log(m.bold.cyan(`
1459
+ \u{1F527} Available Fixes:
1460
+ `));for(let r of e)console.log(m.bold(`Project: ${m.yellow(r.name)}`)),r.fixCommands.forEach((n,a)=>{console.log(` ${a+1}. ${m.cyan(n)}`);}),console.log();if(!i){console.log(m.gray("\u{1F4A1} Run with --fix flag to apply fixes automatically"));return}let{confirm:o}=await Jt.prompt([{type:"confirm",name:"confirm",message:`Apply ${e.reduce((r,n)=>r+n.fixCommands.length,0)} fix(es)?`,default:false}]);if(!o){console.log(m.yellow(`
1461
+ \u26A0\uFE0F Fixes cancelled by user`));return}console.log(m.bold.cyan(`
1462
+ \u{1F680} Applying fixes...
1463
+ `));for(let r of e){console.log(m.bold(`Fixing ${m.cyan(r.name)}...`));for(let n of r.fixCommands)try{console.log(m.gray(` $ ${n}`)),await execa(n,{shell:!0,stdio:"inherit"}),console.log(m.green(` \u2705 Success
1464
+ `));}catch(a){console.log(m.red(` \u274C Failed: ${a instanceof Error?a.message:String(a)}
1465
+ `));}}console.log(m.bold.green(`
1466
+ \u2705 Fix process completed!`));}async function Ke(t={}){if(t.json||console.log(m.bold.cyan(`
1457
1467
  \u{1FA7A} RapidKit Health Check
1458
- `)),t.workspace){let e=await Ai(process.cwd());e||(u.error("No RapidKit workspace found in current directory or parents"),u.info('Run this command from within a workspace, or use "rapidkit doctor" for system check'),process.exit(1)),console.log(g.bold(`Workspace: ${g.cyan(v.basename(e))}`)),console.log(g.gray(`Path: ${e}
1459
- `));let i=await Ni(e);console.log(g.bold(`System Tools:
1460
- `)),Q(i.python,"Python"),Q(i.poetry,"Poetry"),Q(i.pipx,"pipx"),Q(i.rapidkitCore,"RapidKit Core"),i.projects.length>0?(console.log(g.bold(`
1461
- \u{1F4E6} Projects (${i.projects.length}):`)),i.projects.forEach(n=>Di(n))):(console.log(g.bold(`
1462
- \u{1F4E6} Projects:`)),console.log(g.gray(" No RapidKit projects found in workspace")));let o=i.projects.reduce((n,a)=>n+a.issues.length,0),r=[i.python,i.rapidkitCore].some(n=>n.status==="error");r||o>0?(console.log(g.bold.yellow(`
1463
- \u26A0\uFE0F Found ${o} project issue(s)`)),r&&console.log(g.bold.red("\u274C System requirements not met"))):console.log(g.bold.green(`
1464
- \u2705 All checks passed! Workspace is healthy.`));}else {console.log(g.bold(`System Tools:
1465
- `));let e=await Ae(),i=await Ne(),o=await De(),r=await Te();Q(e,"Python"),Q(i,"Poetry"),Q(o,"pipx"),Q(r,"RapidKit Core"),[e,r].some(a=>a.status==="error")?(console.log(g.bold.red(`
1466
- \u274C Some required tools are missing`)),console.log(g.gray(`
1467
- Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`))):(console.log(g.bold.green(`
1468
- \u2705 All required tools are installed!`)),console.log(g.gray(`
1469
- Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`)));}console.log("");}function qt(t){if(!t||typeof t!="object")return null;let e=t.code;return e==="PYTHON_NOT_FOUND"||e==="BRIDGE_VENV_BOOTSTRAP_FAILED"?e:null}function Oi(t){let e=t.trim().toLowerCase();return e?e.startsWith("fastapi")?"fastapi":e.startsWith("nestjs")?"nestjs":null:null}function Fi(t,e){let i=t.indexOf(e);if(i>=0&&i+1<t.length)return t[i+1];let o=t.find(r=>r.startsWith(`${e}=`));if(o)return o.slice(e.length+1)}async function Xt(t,e){if(t.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(t[0]!=="create")return 1;if(t[1]!=="project")return process.stderr.write(`RapidKit (npm) could not run the Python core engine for \`create\`.
1470
- Reason: ${e}.
1468
+ `)),t.workspace){let i=await Oi(process.cwd());i||(f.error("No RapidKit workspace found in current directory or parents"),f.info('Run this command from within a workspace, or use "rapidkit doctor" for system check'),process.exit(1)),t.json||(console.log(m.bold(`Workspace: ${m.cyan(w.basename(i))}`)),console.log(m.gray(`Path: ${i}`)));let e=await Ki(i);if(t.json){let n={workspace:{name:w.basename(i),path:i},healthScore:e.healthScore,system:{python:e.python,poetry:e.poetry,pipx:e.pipx,rapidkitCore:e.rapidkitCore,versions:{core:e.coreVersion,npm:e.npmVersion}},projects:e.projects.map(a=>({name:a.name,path:a.path,venvActive:a.venvActive,depsInstalled:a.depsInstalled,coreInstalled:a.coreInstalled,coreVersion:a.coreVersion,issues:a.issues,fixCommands:a.fixCommands})),summary:{totalProjects:e.projects.length,totalIssues:e.projects.reduce((a,s)=>a+s.issues.length,0),hasSystemErrors:[e.python,e.rapidkitCore].some(a=>a.status==="error")}};console.log(JSON.stringify(n,null,2));return}if(e.healthScore){let n=e.healthScore,a=Math.round(n.passed/n.total*100),s=a>=80?m.green:a>=50?m.yellow:m.red,c="\u2588".repeat(Math.floor(a/5))+"\u2591".repeat(20-Math.floor(a/5));console.log(m.bold(`
1469
+ \u{1F4CA} Health Score:`)),console.log(` ${s(`${a}%`)} ${m.gray(c)}`),console.log(` ${m.green(`\u2705 ${n.passed} passed`)} ${m.gray("|")} ${m.yellow(`\u26A0\uFE0F ${n.warnings} warnings`)} ${m.gray("|")} ${m.red(`\u274C ${n.errors} errors`)}`);}if(console.log(m.bold(`
1470
+
1471
+ System Tools:
1472
+ `)),X(e.python,"Python"),X(e.poetry,"Poetry"),X(e.pipx,"pipx"),X(e.rapidkitCore,"RapidKit Core"),e.coreVersion&&e.npmVersion){let n=e.coreVersion.split(".")[1],a=e.npmVersion.split(".")[1];n!==a&&(console.log(m.yellow(`
1473
+ \u26A0\uFE0F Version mismatch: Core ${e.coreVersion} / CLI ${e.npmVersion}`)),console.log(m.gray(" Consider updating to matching versions for best compatibility")));}e.projects.length>0?(console.log(m.bold(`
1474
+ \u{1F4E6} Projects (${e.projects.length}):`)),e.projects.forEach(n=>Wi(n))):(console.log(m.bold(`
1475
+ \u{1F4E6} Projects:`)),console.log(m.gray(" No RapidKit projects found in workspace")));let o=e.projects.reduce((n,a)=>n+a.issues.length,0),r=[e.python,e.rapidkitCore].some(n=>n.status==="error");r||o>0?(console.log(m.bold.yellow(`
1476
+ \u26A0\uFE0F Found ${o} project issue(s)`)),r&&console.log(m.bold.red("\u274C System requirements not met")),t.fix?await Ne(e.projects,true):o>0&&await Ne(e.projects,false)):console.log(m.bold.green(`
1477
+ \u2705 All checks passed! Workspace is healthy.`));}else {console.log(m.bold(`System Tools:
1478
+ `));let i=await De(),e=await Te(),o=await Fe(),r=await Oe();X(i,"Python"),X(e,"Poetry"),X(o,"pipx"),X(r,"RapidKit Core"),[i,r].some(a=>a.status==="error")?(console.log(m.bold.red(`
1479
+ \u274C Some required tools are missing`)),console.log(m.gray(`
1480
+ Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`))):(console.log(m.bold.green(`
1481
+ \u2705 All required tools are installed!`)),console.log(m.gray(`
1482
+ Tip: Run "rapidkit doctor --workspace" from within a workspace for detailed project checks`)));}console.log("");}function Qt(t){if(!t||typeof t!="object")return null;let i=t.code;return i==="PYTHON_NOT_FOUND"||i==="BRIDGE_VENV_BOOTSTRAP_FAILED"?i:null}function Li(t){let i=t.trim().toLowerCase();return i?i.startsWith("fastapi")?"fastapi":i.startsWith("nestjs")?"nestjs":null:null}function Gi(t,i){let e=t.indexOf(i);if(e>=0&&e+1<t.length)return t[e+1];let o=t.find(r=>r.startsWith(`${i}=`));if(o)return o.slice(i.length+1)}async function Xt(t,i){if(t.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(t[0]!=="create")return 1;if(t[1]!=="project")return process.stderr.write(`RapidKit (npm) could not run the Python core engine for \`create\`.
1483
+ Reason: ${i}.
1471
1484
  Install Python 3.10+ to use the interactive wizard and full kit catalog.
1472
1485
  `),1;let r=t[2],n=t[3];if(!r||!n)return process.stderr.write(`Usage: rapidkit create project <kit> <name> [--output <dir>]
1473
1486
  Tip: offline fallback supports only fastapi* and nestjs* kits.
1474
- `),1;let a=Oi(r);if(!a)return process.stderr.write(`RapidKit (npm) could not run the Python core engine to create this kit.
1475
- Reason: ${e}.
1487
+ `),1;let a=Li(r);if(!a)return process.stderr.write(`RapidKit (npm) could not run the Python core engine to create this kit.
1488
+ Reason: ${i}.
1476
1489
  Requested kit: ${r}
1477
1490
  Offline fallback only supports: fastapi.standard, nestjs.standard (and their shorthands).
1478
1491
  Install Python 3.10+ to access all kits.
1479
- `),1;let s=Fi(t,"--output")||process.cwd(),c=v.resolve(s,n),p=t.includes("--skip-git")||t.includes("--no-git"),l=t.includes("--skip-install");try{if(await I.ensureDir(v.dirname(c)),await I.pathExists(c))return process.stderr.write(`\u274C Directory "${c}" already exists
1480
- `),1;let d="pip",m=It(process.cwd());if(m)try{let{readWorkspaceMarker:y}=await Promise.resolve().then(()=>(Bt(),we)),f=await y(m);f?.metadata?.npm?.installMethod&&(d=f.metadata.npm.installMethod,console.log(`[DEBUG] Detected workspace engine: ${d}`));}catch(y){console.log("[DEBUG] Failed to read workspace marker:",y);}else console.log("[DEBUG] No workspace found, using default engine: pip");if(await I.ensureDir(c),await Se(c,{project_name:n,template:a,skipGit:p,skipInstall:l,engine:d}),m){let{syncWorkspaceProjects:y}=await Promise.resolve().then(()=>(X(),q));await y(m,!0);}return 0}catch(d){return process.stderr.write(`RapidKit (npm) offline fallback failed: ${d?.message??d}
1481
- `),1}}async function Ki(t){let e=new Set(["--yes","-y","--skip-git","--skip-install","--debug","--dry-run","--no-update-check","--create-workspace","--no-workspace"]);try{if(t[0]==="create"&&t[1]==="project"){let i=t.includes("--create-workspace"),o=t.includes("--no-workspace"),r=t.includes("--yes")||t.includes("-y"),n=t.includes("--skip-git")||t.includes("--no-git");if(!!!Et(process.cwd())){if(i)await rt(process.cwd(),{skipGit:n,yes:r,userConfig:await ft()});else if(!o)if(r)await rt(process.cwd(),{skipGit:n,yes:!0,userConfig:await ft()});else {let{createWs:c}=await Jt.prompt([{type:"confirm",name:"createWs",message:"This project will be created outside a RapidKit workspace. Create and register a workspace here?",default:!0}]);c&&await rt(process.cwd(),{skipGit:n,yes:!1,userConfig:await ft()});}}let s=t.filter(c=>{let p=c.split("=")[0];return !e.has(c)&&!e.has(p)});try{await dt();let c=await B(s,{cwd:process.cwd()});if(c===0){let p=It(process.cwd());if(p){try{let d=t[3];if(d){let m=t.indexOf("--output"),y=m>=0?t[m+1]:".",f=v.resolve(process.cwd(),y,d),w=v.join(p,".python-version"),A=v.join(f,".python-version");if(T.existsSync(w)&&T.existsSync(f)){let D=T.readFileSync(w,"utf-8");T.writeFileSync(A,D.trim()+`
1482
- `),u.debug(`Synced Python version ${D.trim()} from workspace to ${d}`);}}}catch(d){u.debug("Could not sync Python version from workspace:",d);}let{syncWorkspaceProjects:l}=await Promise.resolve().then(()=>(X(),q));await l(p,!0);}}return c}catch(c){let p=qt(c);return p?await Xt(s,p):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${c?.message??c}
1483
- `),1)}}if(t[0]==="create"&&t[1]!=="project")try{await dt();let i=await B(t,{cwd:process.cwd()});if(i===0){let o=It(process.cwd());if(o){let{syncWorkspaceProjects:r}=await Promise.resolve().then(()=>(X(),q));await r(o,!0);}}return i}catch(i){let o=qt(i);return o?await Xt(t,o):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${i?.message??i}
1484
- `),1)}return await dt(),await B(t,{cwd:process.cwd()})}catch(i){let o=qt(i);return o?await Xt(t,o):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${i?.message??i}
1485
- `),1)}}var Ke=["init","dev","start","build","test","lint","format","create","help","--help","-h"];function Mi(t){let e=t;for(;;){let i=v.join(e,".rapidkit","context.json");if(T.existsSync(i))return i;let o=v.dirname(e);if(o===e)break;e=o;}return null}function Et(t){let e=t;for(;;){let i=v.join(e,".rapidkit-workspace");if(T.existsSync(i))return i;let o=v.dirname(e);if(o===e)break;e=o;}return null}function It(t){let e=t;for(;;){let i=v.join(e,".rapidkit-workspace");if(T.existsSync(i))return e;let o=v.dirname(e);if(o===e)break;e=o;}return null}async function Wi(){let t=process.cwd(),e=process.argv.slice(2);if(e[0]==="create")return false;try{let c=e[0],p=!c||c==="--help"||c==="-h"||c==="help";if(Et(t)&&p){let d=await B(c?["--help"]:[],{cwd:t});process.exit(d);}}catch{}try{let c=e[0],p=c==="shell"&&e[1]==="activate",l=c==="create",d=await ne(t,{cwd:t,timeoutMs:1200});if(d.ok&&d.data?.isRapidkitProject&&d.data.engine==="python"&&!p&&!l){let m=await B(process.argv.slice(2),{cwd:t});process.exit(m);}}catch{}let i=Mi(t),o=process.platform==="win32",r=o?[v.join(t,"rapidkit.cmd"),v.join(t,"rapidkit"),v.join(t,".rapidkit","rapidkit.cmd"),v.join(t,".rapidkit","rapidkit")]:[v.join(t,"rapidkit"),v.join(t,".rapidkit","rapidkit")],n=null;for(let c of r)if(await I.pathExists(c)){n=c;break}let a=e[0],s=a==="create";if(n&&a&&Ke.includes(a)&&!s){u.debug(`Delegating to local CLI: ${n} ${e.join(" ")}`);let c=spawn(n,e,{stdio:"inherit",cwd:t,shell:o});return c.on("close",p=>{process.exit(p??0);}),c.on("error",p=>{u.error(`Failed to run local rapidkit: ${p.message}`),process.exit(1);}),true}if(i&&await I.pathExists(i))try{if((await I.readJson(i)).engine==="pip"){let p=e[0],d=process.platform==="win32"?[v.join(t,"rapidkit.cmd"),v.join(t,"rapidkit"),v.join(t,".rapidkit","rapidkit.cmd"),v.join(t,".rapidkit","rapidkit")]:[v.join(t,"rapidkit"),v.join(t,".rapidkit","rapidkit")],m=null;for(let f of d)if(await I.pathExists(f)){m=f;break}if(m&&p&&Ke.includes(p)){u.debug(`Delegating to local CLI (early detection): ${m} ${e.join(" ")}`);let f=spawn(m,e,{stdio:"inherit",cwd:t});return f.on("close",w=>process.exit(w??0)),f.on("error",w=>{u.error(`Failed to run local rapidkit: ${w.message}`),process.exit(1);}),!0}if(p==="shell"&&e[1]==="activate"){let f=`# RapidKit: activation snippet - eval "$(rapidkit shell activate)"
1492
+ `),1;let s=Gi(t,"--output")||process.cwd(),c=w.resolve(s,n),l=t.includes("--skip-git")||t.includes("--no-git"),p=t.includes("--skip-install");try{if(await k.ensureDir(w.dirname(c)),await k.pathExists(c))return process.stderr.write(`\u274C Directory "${c}" already exists
1493
+ `),1;let d="pip",u=St(process.cwd());if(u)try{let{readWorkspaceMarker:h}=await Promise.resolve().then(()=>(Ht(),ke)),y=await h(u);y?.metadata?.npm?.installMethod&&(d=y.metadata.npm.installMethod,console.log(`[DEBUG] Detected workspace engine: ${d}`));}catch(h){console.log("[DEBUG] Failed to read workspace marker:",h);}else console.log("[DEBUG] No workspace found, using default engine: pip");if(await k.ensureDir(c),await Ae(c,{project_name:n,template:a,skipGit:l,skipInstall:p,engine:d}),u){let{syncWorkspaceProjects:h}=await Promise.resolve().then(()=>(Q(),q));await h(u,!0);}return 0}catch(d){return process.stderr.write(`RapidKit (npm) offline fallback failed: ${d?.message??d}
1494
+ `),1}}async function Ui(t){let i=new Set(["--yes","-y","--skip-git","--skip-install","--debug","--dry-run","--no-update-check","--create-workspace","--no-workspace"]);try{if(t[0]==="create"&&t[1]==="project"){let e=t.includes("--create-workspace"),o=t.includes("--no-workspace"),r=t.includes("--yes")||t.includes("-y"),n=t.includes("--skip-git")||t.includes("--no-git");if(!!!It(process.cwd())){if(e)await rt(process.cwd(),{skipGit:n,yes:r,userConfig:await ht()});else if(!o)if(r)await rt(process.cwd(),{skipGit:n,yes:!0,userConfig:await ht()});else {let{createWs:c}=await Jt.prompt([{type:"confirm",name:"createWs",message:"This project will be created outside a RapidKit workspace. Create and register a workspace here?",default:!0}]);c&&await rt(process.cwd(),{skipGit:n,yes:!1,userConfig:await ht()});}}let s=t.filter(c=>{let l=c.split("=")[0];return !i.has(c)&&!i.has(l)});try{await ut();let c=await B(s,{cwd:process.cwd()});if(c===0){let l=St(process.cwd());if(l){try{let d=t[3];if(d){let u=t.indexOf("--output"),h=u>=0?t[u+1]:".",y=w.resolve(process.cwd(),h,d),x=w.join(l,".python-version"),A=w.join(y,".python-version");if(F.existsSync(x)&&F.existsSync(y)){let D=F.readFileSync(x,"utf-8");F.writeFileSync(A,D.trim()+`
1495
+ `),f.debug(`Synced Python version ${D.trim()} from workspace to ${d}`);}}}catch(d){f.debug("Could not sync Python version from workspace:",d);}let{syncWorkspaceProjects:p}=await Promise.resolve().then(()=>(Q(),q));await p(l,!0);}}return c}catch(c){let l=Qt(c);return l?await Xt(s,l):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${c?.message??c}
1496
+ `),1)}}if(t[0]==="create"&&t[1]!=="project")try{await ut();let e=await B(t,{cwd:process.cwd()});if(e===0){let o=St(process.cwd());if(o){let{syncWorkspaceProjects:r}=await Promise.resolve().then(()=>(Q(),q));await r(o,!0);}}return e}catch(e){let o=Qt(e);return o?await Xt(t,o):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${e?.message??e}
1497
+ `),1)}return await ut(),await B(t,{cwd:process.cwd()})}catch(e){let o=Qt(e);return o?await Xt(t,o):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${e?.message??e}
1498
+ `),1)}}var Ve=["init","dev","start","build","test","lint","format","create","help","--help","-h"];function Hi(t){let i=t;for(;;){let e=w.join(i,".rapidkit","context.json");if(F.existsSync(e))return e;let o=w.dirname(i);if(o===i)break;i=o;}return null}function It(t){let i=t;for(;;){let e=w.join(i,".rapidkit-workspace");if(F.existsSync(e))return e;let o=w.dirname(i);if(o===i)break;i=o;}return null}function St(t){let i=t;for(;;){let e=w.join(i,".rapidkit-workspace");if(F.existsSync(e))return i;let o=w.dirname(i);if(o===i)break;i=o;}return null}async function Bi(){let t=process.cwd(),i=process.argv.slice(2);if(i[0]==="create")return false;try{let c=i[0],l=!c||c==="--help"||c==="-h"||c==="help";if(It(t)&&l){let d=await B(c?["--help"]:[],{cwd:t});process.exit(d);}}catch{}try{let c=i[0],l=c==="shell"&&i[1]==="activate",p=c==="create",d=await ae(t,{cwd:t,timeoutMs:1200});if(d.ok&&d.data?.isRapidkitProject&&d.data.engine==="python"&&!l&&!p){let u=await B(process.argv.slice(2),{cwd:t});process.exit(u);}}catch{}let e=Hi(t),o=process.platform==="win32",r=o?[w.join(t,"rapidkit.cmd"),w.join(t,"rapidkit"),w.join(t,".rapidkit","rapidkit.cmd"),w.join(t,".rapidkit","rapidkit")]:[w.join(t,"rapidkit"),w.join(t,".rapidkit","rapidkit")],n=null;for(let c of r)if(await k.pathExists(c)){n=c;break}let a=i[0],s=a==="create";if(n&&a&&Ve.includes(a)&&!s){f.debug(`Delegating to local CLI: ${n} ${i.join(" ")}`);let c=spawn(n,i,{stdio:"inherit",cwd:t,shell:o});return c.on("close",l=>{process.exit(l??0);}),c.on("error",l=>{f.error(`Failed to run local rapidkit: ${l.message}`),process.exit(1);}),true}if(e&&await k.pathExists(e))try{if((await k.readJson(e)).engine==="pip"){let l=i[0],d=process.platform==="win32"?[w.join(t,"rapidkit.cmd"),w.join(t,"rapidkit"),w.join(t,".rapidkit","rapidkit.cmd"),w.join(t,".rapidkit","rapidkit")]:[w.join(t,"rapidkit"),w.join(t,".rapidkit","rapidkit")],u=null;for(let y of d)if(await k.pathExists(y)){u=y;break}if(u&&l&&Ve.includes(l)){f.debug(`Delegating to local CLI (early detection): ${u} ${i.join(" ")}`);let y=spawn(u,i,{stdio:"inherit",cwd:t});return y.on("close",x=>process.exit(x??0)),y.on("error",x=>{f.error(`Failed to run local rapidkit: ${x.message}`),process.exit(1);}),!0}if(l==="shell"&&i[1]==="activate"){let y=`# RapidKit: activation snippet - eval "$(rapidkit shell activate)"
1486
1499
  VENV='.venv'
1487
1500
  if [ -f "$VENV/bin/activate" ]; then
1488
1501
  . "$VENV/bin/activate"
@@ -1491,11 +1504,11 @@ elif [ -f "$VENV/bin/activate.fish" ]; then
1491
1504
  fi
1492
1505
  export RAPIDKIT_PROJECT_ROOT="$(pwd)"
1493
1506
  export PATH="$(pwd)/.rapidkit:$(pwd):$PATH"
1494
- `;console.log(g.green.bold(`
1507
+ `;console.log(m.green.bold(`
1495
1508
  \u2705 Activation snippet \u2014 run the following to activate this project in your current shell:
1496
- `)),console.log(f),console.log(g.gray(`
1509
+ `)),console.log(y),console.log(m.gray(`
1497
1510
  \u{1F4A1} After activation you can run: rapidkit dev
1498
- `)),process.exit(0);}let y=await B(e,{cwd:t});process.exit(y);}}catch{}return false}var Z=null,St=false,tt=new Command;async function Gi(t){if(t.length===0)return false;let e=t[0],i=t[1];if(e==="shell"&&i==="activate"||e==="workspace"||e==="doctor")return false;if(t.includes("--tui"))return true;if(e==="--help"||e==="-h"||e==="help"||e==="--version"||e==="-V"||t.includes("--template")||t.includes("-t"))return false;let o=new Set(["--yes","-y","--skip-git","--skip-install","--debug","--dry-run","--no-update-check","--create-workspace","--no-workspace"]);if(t.some(n=>o.has(n)))return false;let r=await Lt();return r?r.has(e):!!(he.has(e)||t.length>1)}tt.name("rapidkit").description("Create RapidKit workspaces and projects").version(U());tt.addHelpText("beforeAll",`RapidKit
1511
+ `)),process.exit(0);}let h=await B(i,{cwd:t});process.exit(h);}}catch{}return false}var Z=null,At=false,tt=new Command;async function Yi(t){if(t.length===0)return false;let i=t[0],e=t[1];if(i==="shell"&&e==="activate"||i==="workspace"||i==="doctor")return false;if(t.includes("--tui"))return true;if(i==="--help"||i==="-h"||i==="help"||i==="--version"||i==="-V"||t.includes("--template")||t.includes("-t"))return false;let o=new Set(["--yes","-y","--skip-git","--skip-install","--debug","--dry-run","--no-update-check","--create-workspace","--no-workspace"]);if(t.some(n=>o.has(n)))return false;let r=await Vt();return r?r.has(i):!!(ye.has(i)||t.length>1)}tt.name("rapidkit").description("Create RapidKit workspaces and projects").version(H());tt.addHelpText("beforeAll",`RapidKit
1499
1512
 
1500
1513
  Global CLI
1501
1514
  Create RapidKit workspaces and projects
@@ -1509,27 +1522,27 @@ Project Commands
1509
1522
  rapidkit dev
1510
1523
 
1511
1524
  Use "rapidkit help <command>" for more information.
1512
- `);tt.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(t,e)=>{try{e.debug&&(u.setDebug(!0),u.debug("Debug mode enabled"));let i=await ft();u.debug("User config loaded",i);let o=await ie();u.debug("RapidKit config loaded",o);let r=oe(i,o,{author:e.author,pythonVersion:void 0,skipGit:e.skipGit});u.debug("Merged config",r),e.updateCheck!==!1&&await te(),console.log(g.blue.bold(`
1525
+ `);tt.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(t,i)=>{try{i.debug&&(f.setDebug(!0),f.debug("Debug mode enabled"));let e=await ht();f.debug("User config loaded",e);let o=await oe();f.debug("RapidKit config loaded",o);let r=ne(e,o,{author:i.author,pythonVersion:void 0,skipGit:i.skipGit});f.debug("Merged config",r),i.updateCheck!==!1&&await ee(),console.log(m.blue.bold(`
1513
1526
  \u{1F680} Welcome to RapidKit!
1514
- `)),t||(Vi(),process.exit(0));try{re(t);}catch(s){throw s instanceof G&&(u.error(`
1515
- \u274C ${s.message}`),s.details&&u.warn(`\u{1F4A1} ${s.details}
1516
- `),process.exit(1)),s}let n=v.resolve(process.cwd(),t);Z=n,await I.pathExists(n)&&(u.error(`
1517
- \u274C Directory "${t}" already exists`),console.log(g.cyan(`
1527
+ `)),t||(zi(),process.exit(0));try{re(t);}catch(s){throw s instanceof G&&(f.error(`
1528
+ \u274C ${s.message}`),s.details&&f.warn(`\u{1F4A1} ${s.details}
1529
+ `),process.exit(1)),s}let n=w.resolve(process.cwd(),t);Z=n,await k.pathExists(n)&&(f.error(`
1530
+ \u274C Directory "${t}" already exists`),console.log(m.cyan(`
1518
1531
  \u{1F4A1} Choose a different name or delete the existing directory.
1519
- `)),process.exit(1));let a=!!e.template;if(e.dryRun){console.log(g.cyan(`
1532
+ `)),process.exit(1));let a=!!i.template;if(i.dryRun){console.log(m.cyan(`
1520
1533
  \u{1F50D} Dry-run mode - showing what would be created:
1521
- `)),console.log(g.white("\u{1F4C2} Path:"),n),console.log(g.white("\u{1F4E6} Type:"),a?`Project (${e.template})`:"Workspace"),console.log();return}if(!e.yes&&!a?await Jt.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"}]):e.yes&&console.log(g.gray(`Using default values (--yes flag)
1522
- `)),a){let s=String(e.template||"").trim(),c=s.toLowerCase(),p=c==="fastapi"?"fastapi.standard":c==="nestjs"?"nestjs.standard":s;if(!!!Et(process.cwd())){if(e.createWorkspace)await rt(process.cwd(),{skipGit:e.skipGit,yes:e.yes,userConfig:i});else if(!e.noWorkspace)if(e.yes)await rt(process.cwd(),{skipGit:e.skipGit,yes:!0,userConfig:i});else {let{createWs:f}=await Jt.prompt([{type:"confirm",name:"createWs",message:"This project will be created outside a RapidKit workspace. Create and register a workspace here?",default:!0}]);f&&await rt(process.cwd(),{skipGit:e.skipGit,yes:!1,userConfig:i});}}let d=["create","project",p,t,"--output",process.cwd(),"--install-essentials"],m=await B(d,{cwd:process.cwd()});m!==0&&process.exit(m);let y=Et(process.cwd());if(y){let f=v.dirname(y),w=v.join(f,".python-version"),A=v.join(n,".python-version");try{if(await I.pathExists(w)){let D=T.readFileSync(w,"utf-8");T.writeFileSync(A,D.trim()+`
1523
- `),u.debug(`Synced Python version ${D.trim()} from workspace to project`);}}catch(D){u.debug("Could not sync Python version from workspace:",D);}}if(!e.skipInstall){let f=await B(["init",n],{cwd:process.cwd()});if(f!==0&&process.exit(f),y){let w=v.dirname(y),A=v.join(w,".python-version"),D=v.join(n,".python-version");try{if(await I.pathExists(A)){let K=T.readFileSync(A,"utf-8");T.writeFileSync(D,K.trim()+`
1524
- `),u.debug(`Re-synced Python version ${K.trim()} after init`);}}catch(K){u.debug("Could not re-sync Python version after init:",K);}}}}else await Pe(t,{skipGit:e.skipGit,dryRun:e.dryRun,yes:e.yes,userConfig:r,installMethod:e.installMethod});}catch(i){i instanceof G?(u.error(`
1525
- \u274C ${i.message}`),i.details&&u.warn(`\u{1F4A1} ${i.details}`),u.debug("Error code:",i.code)):(u.error(`
1526
- \u274C An unexpected error occurred:`),console.error(i)),process.exit(1);}finally{Z=null;}});tt.command("shell <action>").description("Shell helpers (activate virtualenv in current shell)").action(async t=>{t!=="activate"&&(console.log(g.red(`Unknown shell command: ${t}`)),process.exit(1));let e=process.cwd();function i(c){let p=c;for(;;){let l=v.join(p,".rapidkit","context.json");if(T.existsSync(l))return l;let d=v.dirname(p);if(d===p)break;p=d;}return null}let o=i(e);function r(c){let p=c;for(;;){let l=v.join(p,".venv"),d=v.join(p,".rapidkit","activate");if(T.existsSync(d)||T.existsSync(l))return {venv:l,activateFile:d};let m=v.dirname(p);if(m===p)break;p=m;}return null}let n=r(e);!o&&!n&&(console.log(g.yellow("No RapidKit project found in this directory")),process.exit(1));let a;n&&T.existsSync(n.activateFile)?a=n.activateFile:n&&T.existsSync(n.venv)?a=process.platform==="win32"?v.join(n.venv,"Scripts","activate"):v.join(n.venv,"bin","activate"):(console.log(g.yellow("No virtual environment found")),process.exit(1));let s=process.platform==="win32";console.log(s?`call "${a}"`:`. "${a}"`);});tt.command("doctor").description("\u{1FA7A} Check RapidKit environment health").option("--workspace","Check entire workspace (including all projects)").action(async t=>{await Oe(t);});tt.command("workspace <action>").description("Manage RapidKit workspaces (list, sync)").action(async t=>{if(t==="list"){let{listWorkspaces:e}=await Promise.resolve().then(()=>(X(),q));await e();}else if(t==="sync"){let e=It(process.cwd());e||(console.log(g.red("\u274C Not inside a RapidKit workspace")),console.log(g.gray("\u{1F4A1} Run this command from within a workspace directory")),process.exit(1));let{syncWorkspaceProjects:i}=await Promise.resolve().then(()=>(X(),q));console.log(g.cyan(`\u{1F4C2} Scanning workspace: ${v.basename(e)}`)),await i(e);}else console.log(g.red(`Unknown workspace action: ${t}`)),console.log(g.gray("Available: list, sync")),process.exit(1);});function Vi(){console.log(g.white(`Usage:
1527
- `)),console.log(g.cyan(" npx rapidkit <workspace-name> [options]")),console.log(g.cyan(` npx rapidkit create <...>
1528
- `)),console.log(g.bold("Recommended workflow:")),console.log(g.cyan(" npx rapidkit my-workspace")),console.log(g.cyan(" cd my-workspace")),console.log(g.cyan(" npx rapidkit create project fastapi.standard my-api --output .")),console.log(g.cyan(" cd my-api")),console.log(g.cyan(` npx rapidkit init && npx rapidkit dev
1529
- `)),console.log(g.bold("Options (workspace creation):")),console.log(g.gray(" -y, --yes Skip prompts and use defaults")),console.log(g.gray(" --skip-git Skip git initialization")),console.log(g.gray(" --debug Enable debug logging")),console.log(g.gray(" --dry-run Show what would be created")),console.log(g.gray(" --create-workspace When creating a project outside a workspace: create and register a workspace in the current directory")),console.log(g.gray(" --no-workspace When creating a project outside a workspace: do not create a workspace")),console.log(g.gray(` --no-update-check Skip checking for updates
1530
- `)),console.log(g.gray(`Tip: set RAPIDKIT_SHOW_LEGACY=1 to show legacy template flags in help.
1531
- `));}process.on("SIGINT",async()=>{if(!St){if(St=true,console.log(g.yellow(`
1532
-
1533
- \u26A0\uFE0F Interrupted by user`)),Z&&await I.pathExists(Z)){console.log(g.gray("Cleaning up partial installation..."));try{await I.remove(Z),console.log(g.green("\u2713 Cleanup complete"));}catch(t){u.debug("Cleanup failed:",t);}}process.exit(130);}});process.on("SIGTERM",async()=>{if(!St){if(St=true,u.debug("Received SIGTERM"),Z&&await I.pathExists(Z))try{await I.remove(Z);}catch(t){u.debug("Cleanup failed:",t);}process.exit(143);}});Wi().then(async t=>{if(!t){let e=process.argv.slice(2);if(process.env.RAPIDKIT_NPM_DEBUG_ARGS==="1"&&process.stderr.write(`[rapidkit-npm] argv=${JSON.stringify(e)}
1534
- `),e[0]==="create"){let o=await Ki(e);process.exit(o);}let i=await Gi(e);if(process.env.RAPIDKIT_NPM_DEBUG_ARGS==="1"&&process.stderr.write(`[rapidkit-npm] shouldForwardToCore=${i}
1535
- `),i){let o=await B(e,{cwd:process.cwd()});process.exit(o);}tt.parse();}});export{Ki as handleCreateOrFallback};
1534
+ `)),console.log(m.white("\u{1F4C2} Path:"),n),console.log(m.white("\u{1F4E6} Type:"),a?`Project (${i.template})`:"Workspace"),console.log();return}if(!i.yes&&!a?await Jt.prompt([{type:"input",name:"author",message:"Author name:",default:process.env.USER||"RapidKit User"}]):i.yes&&console.log(m.gray(`Using default values (--yes flag)
1535
+ `)),a){let s=String(i.template||"").trim(),c=s.toLowerCase(),l=c==="fastapi"?"fastapi.standard":c==="nestjs"?"nestjs.standard":s;if(!!!It(process.cwd())){if(i.createWorkspace)await rt(process.cwd(),{skipGit:i.skipGit,yes:i.yes,userConfig:e});else if(!i.noWorkspace)if(i.yes)await rt(process.cwd(),{skipGit:i.skipGit,yes:!0,userConfig:e});else {let{createWs:y}=await Jt.prompt([{type:"confirm",name:"createWs",message:"This project will be created outside a RapidKit workspace. Create and register a workspace here?",default:!0}]);y&&await rt(process.cwd(),{skipGit:i.skipGit,yes:!1,userConfig:e});}}let d=["create","project",l,t,"--output",process.cwd(),"--install-essentials"],u=await B(d,{cwd:process.cwd()});u!==0&&process.exit(u);let h=It(process.cwd());if(h){let y=w.dirname(h),x=w.join(y,".python-version"),A=w.join(n,".python-version");try{if(await k.pathExists(x)){let D=F.readFileSync(x,"utf-8");F.writeFileSync(A,D.trim()+`
1536
+ `),f.debug(`Synced Python version ${D.trim()} from workspace to project`);}}catch(D){f.debug("Could not sync Python version from workspace:",D);}}if(!i.skipInstall){let y=await B(["init",n],{cwd:process.cwd()});if(y!==0&&process.exit(y),h){let x=w.dirname(h),A=w.join(x,".python-version"),D=w.join(n,".python-version");try{if(await k.pathExists(A)){let O=F.readFileSync(A,"utf-8");F.writeFileSync(D,O.trim()+`
1537
+ `),f.debug(`Re-synced Python version ${O.trim()} after init`);}}catch(O){f.debug("Could not re-sync Python version after init:",O);}}}}else await Ce(t,{skipGit:i.skipGit,dryRun:i.dryRun,yes:i.yes,userConfig:r,installMethod:i.installMethod});}catch(e){e instanceof G?(f.error(`
1538
+ \u274C ${e.message}`),e.details&&f.warn(`\u{1F4A1} ${e.details}`),f.debug("Error code:",e.code)):(f.error(`
1539
+ \u274C An unexpected error occurred:`),console.error(e)),process.exit(1);}finally{Z=null;}});tt.command("shell <action>").description("Shell helpers (activate virtualenv in current shell)").action(async t=>{t!=="activate"&&(console.log(m.red(`Unknown shell command: ${t}`)),process.exit(1));let i=process.cwd();function e(c){let l=c;for(;;){let p=w.join(l,".rapidkit","context.json");if(F.existsSync(p))return p;let d=w.dirname(l);if(d===l)break;l=d;}return null}let o=e(i);function r(c){let l=c;for(;;){let p=w.join(l,".venv"),d=w.join(l,".rapidkit","activate");if(F.existsSync(d)||F.existsSync(p))return {venv:p,activateFile:d};let u=w.dirname(l);if(u===l)break;l=u;}return null}let n=r(i);!o&&!n&&(console.log(m.yellow("No RapidKit project found in this directory")),process.exit(1));let a;n&&F.existsSync(n.activateFile)?a=n.activateFile:n&&F.existsSync(n.venv)?a=process.platform==="win32"?w.join(n.venv,"Scripts","activate"):w.join(n.venv,"bin","activate"):(console.log(m.yellow("No virtual environment found")),process.exit(1));let s=process.platform==="win32";console.log(s?`call "${a}"`:`. "${a}"`);});tt.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 t=>{await Ke(t);});tt.command("workspace <action>").description("Manage RapidKit workspaces (list, sync)").action(async t=>{if(t==="list"){let{listWorkspaces:i}=await Promise.resolve().then(()=>(Q(),q));await i();}else if(t==="sync"){let i=St(process.cwd());i||(console.log(m.red("\u274C Not inside a RapidKit workspace")),console.log(m.gray("\u{1F4A1} Run this command from within a workspace directory")),process.exit(1));let{syncWorkspaceProjects:e}=await Promise.resolve().then(()=>(Q(),q));console.log(m.cyan(`\u{1F4C2} Scanning workspace: ${w.basename(i)}`)),await e(i);}else console.log(m.red(`Unknown workspace action: ${t}`)),console.log(m.gray("Available: list, sync")),process.exit(1);});function zi(){console.log(m.white(`Usage:
1540
+ `)),console.log(m.cyan(" npx rapidkit <workspace-name> [options]")),console.log(m.cyan(` npx rapidkit create <...>
1541
+ `)),console.log(m.bold("Recommended workflow:")),console.log(m.cyan(" npx rapidkit my-workspace")),console.log(m.cyan(" cd my-workspace")),console.log(m.cyan(" npx rapidkit create project fastapi.standard my-api --output .")),console.log(m.cyan(" cd my-api")),console.log(m.cyan(` npx rapidkit init && npx rapidkit dev
1542
+ `)),console.log(m.bold("Options (workspace creation):")),console.log(m.gray(" -y, --yes Skip prompts and use defaults")),console.log(m.gray(" --skip-git Skip git initialization")),console.log(m.gray(" --debug Enable debug logging")),console.log(m.gray(" --dry-run Show what would be created")),console.log(m.gray(" --create-workspace When creating a project outside a workspace: create and register a workspace in the current directory")),console.log(m.gray(" --no-workspace When creating a project outside a workspace: do not create a workspace")),console.log(m.gray(` --no-update-check Skip checking for updates
1543
+ `)),console.log(m.gray(`Tip: set RAPIDKIT_SHOW_LEGACY=1 to show legacy template flags in help.
1544
+ `));}process.on("SIGINT",async()=>{if(!At){if(At=true,console.log(m.yellow(`
1545
+
1546
+ \u26A0\uFE0F Interrupted by user`)),Z&&await k.pathExists(Z)){console.log(m.gray("Cleaning up partial installation..."));try{await k.remove(Z),console.log(m.green("\u2713 Cleanup complete"));}catch(t){f.debug("Cleanup failed:",t);}}process.exit(130);}});process.on("SIGTERM",async()=>{if(!At){if(At=true,f.debug("Received SIGTERM"),Z&&await k.pathExists(Z))try{await k.remove(Z);}catch(t){f.debug("Cleanup failed:",t);}process.exit(143);}});Bi().then(async t=>{if(!t){let i=process.argv.slice(2);if(process.env.RAPIDKIT_NPM_DEBUG_ARGS==="1"&&process.stderr.write(`[rapidkit-npm] argv=${JSON.stringify(i)}
1547
+ `),i[0]==="create"){let o=await Ui(i);process.exit(o);}let e=await Yi(i);if(process.env.RAPIDKIT_NPM_DEBUG_ARGS==="1"&&process.stderr.write(`[rapidkit-npm] shouldForwardToCore=${e}
1548
+ `),e){let o=await B(i,{cwd:process.cwd()});process.exit(o);}tt.parse();}});export{Ui as handleCreateOrFallback};
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapidkit",
3
- "version": "0.16.5",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "description": "Create RapidKit projects with a single command - The official CLI for RapidKit framework",
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapidkit",
3
- "version": "0.16.5",
3
+ "version": "0.17.0",
4
4
  "type": "module",
5
5
  "description": "Create RapidKit projects with a single command - The official CLI for RapidKit framework",
6
6
  "keywords": [