rapidkit 0.33.1 → 0.33.2
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/dist/{autopilot-release-AOPUECK6.js → autopilot-release-OTGKHLH7.js} +1 -1
- package/dist/{chunk-MSW2I3F3.js → chunk-GAHPNUQJ.js} +64 -33
- package/dist/chunk-GX7UU7LL.js +33 -0
- package/dist/{create-M7LT6WF6.js → create-ZUS2NTVR.js} +1 -1
- package/dist/index.js +67 -67
- package/dist/{pythonRapidkitExec-JXOKKTXZ.js → pythonRapidkitExec-MNWRC4F2.js} +1 -1
- package/dist/{workspace-4VGM2NPS.js → workspace-F56NUNVG.js} +1 -1
- package/dist/{workspace-foundation-4EYME5VM.js → workspace-foundation-FJC2TO3N.js} +1 -1
- package/dist/workspace-run-QATZ6ED2.js +1 -0
- package/package.json +1 -1
- package/dist/chunk-W62Q2D3K.js +0 -33
- package/dist/workspace-run-SWN34LVQ.js +0 -1
- /package/dist/{chunk-BDJHZ3XW.js → chunk-F5CNV47O.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-F5CNV47O.js';import n from'chalk';import W from'fs';import g from'path';import {execa}from'execa';function b(s){try{return JSON.parse(s)}catch{return null}}function ie(s){let t=g.resolve(s);for(;;){if(W.existsSync(g.join(t,".rapidkit-workspace"))||W.existsSync(g.join(t,".rapidkit","workspace.json")))return t;let a=g.dirname(t);if(a===t)return null;t=a;}}function le(s){let t=g.resolve(s),a=ie(t);if(!a)throw new Error("No RapidKit workspace found in current directory or parents");return a}async function S(s,t){let a=process.argv[1];if(!a)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let o=await execa(process.execPath,[a,...s],{cwd:t,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr,crashed:false}}catch(o){return {exitCode:1,stdout:"",stderr:o instanceof Error?o.message:String(o),crashed:true}}}function H(s){let t=s.toLowerCase();return t==="pass"?"pass":t==="warn"?"warn":t==="fail"?"fail":"warn"}function U(s){return s.summary.failed>0?"fail":s.gates.results.some(t=>t.status==="warn")?"warn":"pass"}function ce(s){let t=s.filter(o=>o.status!=="skipped");if(t.length===0)return 100;let a=t.reduce((o,r)=>r.status==="pass"?o+1:r.status==="warn"?o+.6:o,0);return Math.round(a/t.length*100)}function ue(s){return s.executionError?["Re-run: npx rapidkit autopilot release --mode audit --json","Inspect .rapidkit/reports/autopilot-release-last-run.json for execution failure details"]:s.blockers.length>0?["Run: npx rapidkit doctor workspace --plan","Run: npx rapidkit readiness --json --strict","Run: npx rapidkit workspace run test --affected --strict"]:s.hasWarnings&&s.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx rapidkit autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function N(s,t){await W.promises.mkdir(g.dirname(s),{recursive:true}),await W.promises.writeFile(s,`${JSON.stringify(t,null,2)}
|
|
2
2
|
`,"utf-8");}async function ke(s){let t=le(s.workspacePath),a$1=s.mode,o=[],r=[],M,F,E,J=0,f=false,I=0,T=0,_=Date.now(),x=await S(["doctor","workspace","--json"],t),q=Date.now()-_,u="pass";if(x.crashed)u="fail",f=true,r.push(`doctor workspace execution error: ${x.stderr||"unknown error"}`);else if(x.exitCode!==0)u="fail",r.push("doctor workspace command failed");else {let e=b(x.stdout),i=e&&e.healthScore&&typeof e.healthScore=="object"?e.healthScore:{},l=Number(i.errors??0),c=Number(i.warnings??0);Number.isFinite(l)&&l>0?(u="fail",r.push(`doctor workspace reports ${l} error(s)`)):Number.isFinite(c)&&c>0&&(u="warn");}let L=o.push({name:"doctor-workspace",status:u,durationMs:q,summary:u==="pass"?"doctor workspace passed":u==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1;a$1==="enforce"&&u==="warn"&&r.push("doctor workspace reported warnings under enforce mode");let z=Date.now(),A=await S(["readiness","--json"],t),O=Date.now()-z,p="fail";if(A.crashed)p="fail",f=true,r.push(`readiness execution error: ${A.stderr||"unknown error"}`);else if(A.exitCode!==0)p="fail",r.push("readiness command failed");else {let e=b(A.stdout),i=String(e?.overallStatus??"fail");if(p=H(i),typeof e?.evidencePath=="string"&&e.evidencePath.trim().length>0&&(M=e.evidencePath),p==="fail"){let l=Array.isArray(e?.blockingReasons)?e?.blockingReasons.filter(c=>typeof c=="string"):[];l.length>0?r.push(...l.map(c=>`readiness: ${c}`)):r.push("readiness overall status is fail");}}let V=o.push({name:"readiness",status:p,durationMs:O,summary:`readiness overall status is ${p}`})-1;a$1==="enforce"&&p==="warn"&&r.push("readiness reported warnings under enforce mode");let Q=Date.now(),v=await S(["doctor","workspace","--plan","--json"],t),X=Date.now()-Q,w="warn";if(v.crashed)w="fail",f=true,r.push(`doctor remediation plan execution error: ${v.stderr||"unknown error"}`);else if(v.exitCode!==0)w="fail",r.push("doctor remediation plan command failed");else {let e=b(v.stdout),i=e&&e.remediationPlan&&typeof e.remediationPlan=="object"?e.remediationPlan:null,l=Number(i?.totalSteps??0),c=Number(i?.executableSteps??0);Number.isFinite(l)&&l>0&&(I=l),Number.isFinite(c)&&c>0&&(T=c),Number.isFinite(l)&&l===0?w="pass":w="warn";}if(o.push({name:"remediation-plan",status:w,durationMs:X,summary:w==="pass"?"no remediation steps required":"remediation steps available"}),a$1==="enforce"&&w==="warn"&&r.push("remediation plan has pending steps under enforce mode"),a$1==="safe-fix"){let e=Date.now(),i=await S(["doctor","workspace","--apply"],t),l=Date.now()-e,c=i.crashed||i.exitCode!==0?"fail":"pass";if(i.crashed)f=true,r.push(`doctor remediation apply execution error: ${i.stderr||"unknown error"}`);else if(c==="fail")r.push("doctor remediation apply failed");else {J=T>0?T:I>0?I:1;let $=await S(["doctor","workspace","--json"],t);if($.crashed)u="fail",f=true,r.push(`post-apply doctor execution error: ${$.stderr||"unknown error"}`);else if($.exitCode!==0)u="fail",r.push("post-apply doctor workspace command failed");else {let m=b($.stdout),C=m&&m.healthScore&&typeof m.healthScore=="object"?m.healthScore:{},R=Number(C.errors??0),y=Number(C.warnings??0);Number.isFinite(R)&&R>0?(u="fail",r.push(`post-apply doctor reports ${R} error(s)`)):Number.isFinite(y)&&y>0?u="warn":u="pass";}o[L].status=u,o[L].summary=`doctor workspace post-apply status is ${u}`;let D=await S(["readiness","--json"],t);if(D.crashed)p="fail",f=true,r.push(`post-apply readiness execution error: ${D.stderr||"unknown error"}`);else if(D.exitCode!==0)p="fail",r.push("post-apply readiness command failed");else {let m=b(D.stdout),C=String(m?.overallStatus??"fail");if(p=H(C),typeof m?.evidencePath=="string"&&m.evidencePath.trim().length>0&&(M=m.evidencePath),p==="fail"){let R=Array.isArray(m?.blockingReasons)?m?.blockingReasons.filter(y=>typeof y=="string"):[];R.length>0?r.push(...R.map(y=>`post-apply readiness: ${y}`)):r.push("post-apply readiness overall status is fail");}}o[V].status=p,o[V].summary=`readiness post-apply overall status is ${p}`;}o.push({name:"remediation-apply",status:c,durationMs:l,summary:c==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else o.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let Y=Date.now(),h="pass",k="workspace test/build completed for selected projects";try{let e=await a({workspacePath:t,stage:"test",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});F=g.join(t,".rapidkit","reports","autopilot-workspace-run-test.json"),await N(F,e);let i=U(e);if(i==="fail")h="fail",k="workspace test stage failed for selected projects",r.push("workspace run test failed for selected projects");else {i==="warn"&&(h="warn",k="workspace test stage completed with warnings",a$1==="enforce"&&r.push("workspace run test reported warnings under enforce mode"));let l=await a({workspacePath:t,stage:"build",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});E=g.join(t,".rapidkit","reports","autopilot-workspace-run-build.json"),await N(E,l);let c=U(l);c==="fail"?(h="fail",k="workspace build stage failed for selected projects",r.push("workspace run build failed for selected projects")):c==="warn"&&(h="warn",k="workspace test/build completed with warnings",a$1==="enforce"&&r.push("workspace run test/build reported warnings under enforce mode"));}}catch(e){h="fail",k="workspace test/build orchestration failed",f=true,r.push(`workspace run orchestration error: ${e instanceof Error?e.message:String(e)}`);}let Z=Date.now()-Y;o.push({name:"workspace-run-test-build",status:h,durationMs:Z,summary:k});let P=o.filter(e=>e.status==="warn").length,ee=o.filter(e=>e.status==="fail").length,B=a$1==="enforce"?o.some(e=>e.status==="warn"||e.status==="fail"):ee>0,j=[...new Set(r)],te=f||B?Math.max(1,j.length):0,se=ce(o),re=f||B?"blocked":P>0?"partial":"approved",oe=f?3:B?1:P>0?2:0,ae=ue({mode:a$1,executionError:f,blockers:j,hasWarnings:P>0}),G=g.join(t,".rapidkit","reports","autopilot-release-last-run.json"),d={schemaVersion:"autopilot-release-v1",generatedAt:new Date().toISOString(),workspacePath:t,mode:a$1,summary:{releaseScore:se,verdict:re,blockers:te,warnings:P,safeFixesApplied:J,manualActions:j.length,exitCode:oe},stages:o,blockingReasons:j,nextActions:ae,artifacts:{reportPath:G,readinessEvidencePath:M,workspaceRunTestPath:F,workspaceRunBuildPath:E}};if(await N(G,d),s.output&&await N(g.resolve(s.output),d),!s.json){console.log(n.bold.cyan(`
|
|
3
3
|
\u{1F680} RapidKit Autopilot Release
|
|
4
4
|
`)),console.log(n.bold(`Workspace: ${n.cyan(g.basename(t))}`)),console.log(n.gray(`Path: ${t}`)),console.log(n.white(`Mode: ${a$1}`)),console.log(n.white(`Verdict: ${d.summary.verdict==="approved"?n.green("approved"):d.summary.verdict==="partial"?n.yellow("partial"):n.red("blocked")}`)),console.log(n.white(`Release score: ${d.summary.releaseScore}`));for(let e of d.stages){let i=e.status==="pass"?n.green("PASS"):e.status==="warn"?n.yellow("WARN"):e.status==="skipped"?n.gray("SKIP"):n.red("FAIL");console.log(` - ${e.name}: ${i} ${e.summary} (${e.durationMs}ms)`);}if(d.blockingReasons.length>0){console.log(n.bold.red(`
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {i,d as d$2,l,k as k$1,f as f$1,g,h}from'./chunk-7OGOVP5U.js';import {a,d,b as b$1}from'./chunk-RV6HBTFC.js';import {a as a$2,e,d as d$1,f,c,k as k$2}from'./chunk-Z5LKRG57.js';import {b}from'./chunk-AC6KIKII.js';import {a as a$1}from'./chunk-VM2TOHNX.js';import {promises}from'fs';import*as k from'fs-extra';import m from'path';import q from'inquirer';import t from'chalk';import
|
|
1
|
+
import {i,d as d$2,l,k as k$1,f as f$1,g,h}from'./chunk-7OGOVP5U.js';import {a,d,b as b$1}from'./chunk-RV6HBTFC.js';import {a as a$2,e,d as d$1,f,c,k as k$2}from'./chunk-Z5LKRG57.js';import {b}from'./chunk-AC6KIKII.js';import {a as a$1}from'./chunk-VM2TOHNX.js';import {promises}from'fs';import*as k from'fs-extra';import m from'path';import q from'inquirer';import t from'chalk';import F from'ora';import {execa}from'execa';function A(){return c()}async function U(e,o,n,r){let l=d(o,b(),n);r&&(l.metadata||(l.metadata={}),l.metadata.python={version:r}),await b$1(e,l);}async function L(e){await k.outputFile(m.join(e,".gitignore"),`.venv/
|
|
2
2
|
__pycache__/
|
|
3
3
|
*.pyc
|
|
4
4
|
.env
|
|
5
5
|
.rapidkit-workspace/
|
|
6
6
|
|
|
7
|
-
`,"utf-8");}async function
|
|
7
|
+
`,"utf-8");}async function z(e,o){let n=o.replace(/[^a-z0-9-]/gi,"-").toLowerCase();await k.outputFile(m.join(e,"poetry.toml"),`[virtualenvs]
|
|
8
8
|
in-project = true
|
|
9
9
|
`,"utf-8"),await k.outputFile(m.join(e,"pyproject.toml"),`[tool.poetry]
|
|
10
10
|
name = "${n}"
|
|
@@ -35,14 +35,14 @@ cache:
|
|
|
35
35
|
prune_on_bootstrap: false
|
|
36
36
|
self_heal: true
|
|
37
37
|
verify_integrity: false
|
|
38
|
-
`}async function kt(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),o=e.match(/go(\d+\.\d+(?:\.\d+)?)/i);return o?o[1]:void 0}catch{return}}async function Pt(){try{let{stdout:e}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),o=e.trim();return o.length>0?o:void 0}catch{return}}async function Y(e,o,n,r,l){let[p,c]=await Promise.all([kt(),Pt()]);await k.outputFile(m.join(e,".rapidkit","workspace.json"),ht(o,n,r,l),"utf-8"),await k.outputFile(m.join(e,".rapidkit","toolchain.lock"),ft(n,r,process.version,p,c),"utf-8"),await k.outputFile(m.join(e,".rapidkit","policies.yml"),wt(),"utf-8"),await k.outputFile(m.join(e,".rapidkit","cache-config.yml"),vt(),"utf-8");}async function se(e,o){let{workspaceName:n=m.basename(e),installMethod:r="venv",pythonVersion:l,profile:p,writeMarker:c=true,writeGitignore:u=true,onlyIfMissing:g=true}=o||{},h=[],[a$1,i]=await Promise.all([kt(),Pt()]),y=[{relPath:m.join(".rapidkit","workspace.json"),content:ht(n,r,l,p)},{relPath:m.join(".rapidkit","toolchain.lock"),content:ft(r,l,process.version,a$1,i)},{relPath:m.join(".rapidkit","policies.yml"),content:wt()},{relPath:m.join(".rapidkit","cache-config.yml"),content:vt()}];for(let d of y){let P=m.join(e,d.relPath);g&&await k.pathExists(P)||(await k.outputFile(P,d.content,"utf-8"),h.push(d.relPath));}if(c&&(!!!await a(e)||!g)){let P=d(n,b(),r);l&&(P.metadata||(P.metadata={}),P.metadata.python={version:l}),await b$1(e,P),h.push(".rapidkit-workspace");}if(u){let d=m.join(e,".gitignore");(!g||!await k.pathExists(d))&&(await
|
|
39
|
-
`,"utf-8"),a$1.debug(`Created .python-version with ${o}`);}catch(n){a$1.warn(`Failed to create .python-version: ${n}`);}}function
|
|
38
|
+
`}async function kt(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),o=e.match(/go(\d+\.\d+(?:\.\d+)?)/i);return o?o[1]:void 0}catch{return}}async function Pt(){try{let{stdout:e}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),o=e.trim();return o.length>0?o:void 0}catch{return}}async function Y(e,o,n,r,l){let[p,c]=await Promise.all([kt(),Pt()]);await k.outputFile(m.join(e,".rapidkit","workspace.json"),ht(o,n,r,l),"utf-8"),await k.outputFile(m.join(e,".rapidkit","toolchain.lock"),ft(n,r,process.version,p,c),"utf-8"),await k.outputFile(m.join(e,".rapidkit","policies.yml"),wt(),"utf-8"),await k.outputFile(m.join(e,".rapidkit","cache-config.yml"),vt(),"utf-8");}async function se(e,o){let{workspaceName:n=m.basename(e),installMethod:r="venv",pythonVersion:l,profile:p,writeMarker:c=true,writeGitignore:u=true,onlyIfMissing:g=true}=o||{},h=[],[a$1,i]=await Promise.all([kt(),Pt()]),y=[{relPath:m.join(".rapidkit","workspace.json"),content:ht(n,r,l,p)},{relPath:m.join(".rapidkit","toolchain.lock"),content:ft(r,l,process.version,a$1,i)},{relPath:m.join(".rapidkit","policies.yml"),content:wt()},{relPath:m.join(".rapidkit","cache-config.yml"),content:vt()}];for(let d of y){let P=m.join(e,d.relPath);g&&await k.pathExists(P)||(await k.outputFile(P,d.content,"utf-8"),h.push(d.relPath));}if(c&&(!!!await a(e)||!g)){let P=d(n,b(),r);l&&(P.metadata||(P.metadata={}),P.metadata.python={version:l}),await b$1(e,P),h.push(".rapidkit-workspace");}if(u){let d=m.join(e,".gitignore");(!g||!await k.pathExists(d))&&(await L(e),h.push(".gitignore"));}return h}var K="3.10",bt=["3.10","3.11","3.12"];async function gt(e){try{let{stdout:o}=await execa(e,["--version"],{timeout:3e3}),n=o.match(/Python (\d+\.\d+\.\d+)/);if(n)return n[1]}catch{}return null}async function Mt(e,o){try{await promises.writeFile(m.join(e,".python-version"),`${o}
|
|
39
|
+
`,"utf-8"),a$1.debug(`Created .python-version with ${o}`);}catch(n){a$1.warn(`Failed to create .python-version: ${n}`);}}function O(){let n=[...(process.env.PATH||"").split(m.delimiter).filter(Boolean)];for(let r of k$2())n.includes(r)||n.unshift(r);process.env.PATH=n.join(m.delimiter);}async function tt(e,o){O(),e.start("Checking pipx installation");try{return await execa("pipx",["--version"]),e.succeed("pipx found"),{kind:"binary"}}catch{}let n=A();try{return await execa(n,["-m","pipx","--version"]),e.succeed("pipx found"),{kind:"python-module",pythonCmd:n}}catch{}if(o)throw new h;e.stop?.();let{installPipx:r}=await q.prompt([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!r)throw new h;e.start("Installing pipx (user install)");try{try{await execa(n,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(n,["-m","pip","install","--user","--upgrade","pipx"]);}catch(l){let p=l,c=String(p?.stderr||p?.shortMessage||p?.message||"");throw new k$1("Install pipx with python -m pip",l instanceof Error?l:new Error(c))}e.succeed("pipx installed"),O();try{return await execa(n,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:n}}catch(l){let p=l,c=String(p?.stderr||p?.shortMessage||p?.message||"pipx not runnable after install");throw new k$1("Verify pipx after install",new Error(`${c}
|
|
40
40
|
|
|
41
|
-
Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function N(e,o){return e.kind==="binary"?execa("pipx",o):execa(e.pythonCmd,["-m","pipx",...o])}function
|
|
42
|
-
${y.stderr||""}`);d&&
|
|
43
|
-
${i.stderr||""}`);y&&
|
|
41
|
+
Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function N(e,o){return e.kind==="binary"?execa("pipx",o):execa(e.pythonCmd,["-m","pipx",...o])}function Dt(e){let o=e.match(/^(\d+)\.(\d+)/);return o?`${o[1]}.${o[2]}`:null}function mt(e){if(!e)return null;let o=e.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return o?`${o[1]}.${o[2]}`:null}function lt(e,o){let[n,r]=e.split(".").map(c=>Number(c)),[l,p]=o.split(".").map(c=>Number(c));return n!==l?n-l:r-p}function V(e,o){return lt(e,o)>=0}async function Tt(e$1){let o=new Set,n=e(14,10);for(let i of n)try{let y=await execa(i.command,i.args,{timeout:2500}),d=mt(`${y.stdout||""}
|
|
42
|
+
${y.stderr||""}`);d&&V(d,K)&&o.add(d);}catch{}let r=null;try{let i=await execa(A(),["--version"],{timeout:2500}),y=mt(`${i.stdout||""}
|
|
43
|
+
${i.stderr||""}`);y&&V(y,K)&&(r=y,o.add(y));}catch{}let l=bt.filter(i=>V(i,K)),p=new Set([...l,...o]),c=Array.from(p).sort((i,y)=>lt(y,i)),u=e$1?Dt(e$1):null,g=u&&V(u,K)?u:r||c[0]||K;return p.has(g)||p.add(g),{choices:Array.from(p).sort((i,y)=>lt(y,i)).map(i=>{let y=[];return i===r&&y.push("current system"),i===K&&y.push("minimum supported"),o.has(i)&&i!==r&&y.push("detected"),{name:y.length>0?`${i} (${y.join(", ")})`:i,value:i}}),defaultValue:g}}async function Kt(){O();let e=false,o=false;try{await execa("poetry",["--version"],{timeout:2500}),e=true;}catch{e=false;}try{await execa("pipx",["--version"],{timeout:2500}),o=true;}catch{let n=c();try{await execa(n,["-m","pipx","--version"],{timeout:2500}),o=true;}catch{o=false;}}return {poetry:e,pipx:o}}async function xt(){O();try{return await execa("poetry",["--version"],{timeout:2500}),true}catch{return false}}function Nt(e,o){return e==="poetry"&&o.poetry?"poetry":e==="pipx"&&o.pipx?"pipx":e==="venv"?"venv":o.poetry?"poetry":"venv"}async function Ot(e,o){O(),e.start("Checking Poetry installation");try{await execa("poetry",["--version"]),e.succeed("Poetry found");return}catch{}if(o)throw new g;let{installPoetry:n}=await q.prompt([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!n)throw new g;let r=await tt(e,o);e.start("Installing Poetry with pipx");try{await N(r,["install","poetry"]);}catch(l){let p=l,c=String(p?.stderr||p?.shortMessage||p?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(c))try{await N(r,["upgrade","poetry"]);}catch{}else throw new k$1("Install Poetry with pipx",l instanceof Error?l:new Error(c))}e.succeed("Poetry installed"),O();try{await execa("poetry",["--version"]);}catch(l){let p=l,c=String(p?.stderr||p?.shortMessage||p?.message||"Poetry not found on PATH");throw new k$1("Verify Poetry after pipx install",new Error(`${c}
|
|
44
44
|
|
|
45
|
-
Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function
|
|
45
|
+
Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function Ft(e){let o=e==="poetry";return `#!/usr/bin/env sh
|
|
46
46
|
set -eu
|
|
47
47
|
|
|
48
48
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
@@ -56,12 +56,25 @@ ${o?`if command -v poetry >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/pyproject.toml" ]
|
|
|
56
56
|
exec poetry run rapidkit "$@"
|
|
57
57
|
fi
|
|
58
58
|
|
|
59
|
-
`:""}
|
|
59
|
+
`:""}if command -v rapidkit >/dev/null 2>&1; then
|
|
60
|
+
RAPIDKIT_CMD=$(command -v rapidkit)
|
|
61
|
+
if [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/rapidkit" ] && [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/.rapidkit/rapidkit" ]; then
|
|
62
|
+
RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1 exec "$RAPIDKIT_CMD" "$@"
|
|
63
|
+
fi
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
for RAPIDKIT_CORE in "$HOME/.local/bin/rapidkit" "$HOME/Library/Python/3.14/bin/rapidkit" "$HOME/Library/Python/3.13/bin/rapidkit" "$HOME/Library/Python/3.12/bin/rapidkit" "$HOME/Library/Python/3.11/bin/rapidkit" "$HOME/Library/Python/3.10/bin/rapidkit"; do
|
|
67
|
+
if [ -x "$RAPIDKIT_CORE" ]; then
|
|
68
|
+
exec "$RAPIDKIT_CORE" "$@"
|
|
69
|
+
fi
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
echo "RapidKit launcher could not find a local Python CLI." 1>&2
|
|
60
73
|
echo "- If you used venv: ensure .venv exists (or re-run the installer)." 1>&2
|
|
61
74
|
${o?`echo "- If you used Poetry: run 'poetry install' and retry, or activate the env." 1>&2
|
|
62
75
|
`:""}echo "Tip: you can also run: ./.venv/bin/rapidkit --help" 1>&2
|
|
63
76
|
exit 1
|
|
64
|
-
`}function
|
|
77
|
+
`}function Lt(e){return `@echo off
|
|
65
78
|
setlocal
|
|
66
79
|
|
|
67
80
|
set "SCRIPT_DIR=%~dp0"
|
|
@@ -77,11 +90,29 @@ if %ERRORLEVEL%==0 if exist "%SCRIPT_DIR%\\pyproject.toml" (
|
|
|
77
90
|
exit /b %ERRORLEVEL%
|
|
78
91
|
)
|
|
79
92
|
|
|
80
|
-
`:""}
|
|
93
|
+
`:""}:rapidkit_npm_wrapper_fallback
|
|
94
|
+
for /f "delims=" %%R in ('where rapidkit.cmd 2^>nul') do (
|
|
95
|
+
if /I not "%%~fR"=="%SCRIPT_DIR%rapidkit.cmd" if /I not "%%~fR"=="%SCRIPT_DIR%.rapidkit\\rapidkit.cmd" (
|
|
96
|
+
set "RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1"
|
|
97
|
+
"%%~fR" %*
|
|
98
|
+
exit /b %ERRORLEVEL%
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
:rapidkit_core_fallback
|
|
103
|
+
for %%R in ("%USERPROFILE%\\.local\\bin\\rapidkit.exe" "%APPDATA%\\Python\\Scripts\\rapidkit.exe" "%LOCALAPPDATA%\\Programs\\Python\\Scripts\\rapidkit.exe") do (
|
|
104
|
+
if exist "%%~R" (
|
|
105
|
+
"%%~R" %*
|
|
106
|
+
exit /b %ERRORLEVEL%
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
echo RapidKit launcher could not find a local Python CLI. 1>&2
|
|
81
111
|
echo Tip: run .venv\\Scripts\\rapidkit.exe --help 1>&2
|
|
112
|
+
echo Tip: for npm-owned workspace commands, run npx --yes --package rapidkit rapidkit %* from a shell where npm is on PATH. 1>&2
|
|
82
113
|
exit /b 1
|
|
83
|
-
`}async function It(e,o){await k.outputFile(m.join(e,"rapidkit"),
|
|
84
|
-
\u{1F4CC} Configuration notes:`)),x.pythonVersion==="3.10"?console.log(t.gray(" \u2022 Python 3.10: Latest stable with widespread compatibility")):x.pythonVersion==="3.11"?console.log(t.gray(" \u2022 Python 3.11: Newer, faster (3.10-3.11: ~10% speed improvement)")):x.pythonVersion==="3.12"&&console.log(t.gray(" \u2022 Python 3.12: Cutting edge, excellent for performance")),x.installMethod==="poetry"?console.log(t.gray(" \u2022 Poetry: Dependency management + virtual env (recommended for teams)")):x.installMethod==="venv"?console.log(t.gray(" \u2022 venv: Standard library approach, lightweight, zero dependencies")):console.log(t.gray(" \u2022 pipx: Global isolated, RapidKit CLI only, no local venv")),console.log("")),new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(d)){let f=
|
|
114
|
+
`}async function It(e,o){await k.outputFile(m.join(e,"rapidkit"),Ft(o),{encoding:"utf-8",mode:493}),await k.outputFile(m.join(e,"rapidkit.cmd"),Lt(o),"utf-8");}async function le(e,o){let{skipGit:n=false,testMode:r=false,demoMode:l=false,dryRun:p=false,yes:c=false,userConfig:u={},installMethod:g,profile:h}=o,a=e||"rapidkit",i$1=m.resolve(process.cwd(),a);if(await k.pathExists(i$1))throw new i(a);if(p){let f=h||(c?"minimal":void 0),R=g||u.defaultInstallMethod||"poetry",b=u.pythonVersion||"3.10";await Gt(i$1,a,l,u,f,R,b);return}if(l){await Vt(i$1,a,n);return}let y=new Set(["python-only","polyglot","enterprise"]),d=h||"";if(!c&&!h){let{selectedProfile:f}=await q.prompt([{type:"rawlist",name:"selectedProfile",message:"Select workspace profile:",choices:[{name:"minimal \u2014 Foundation files only (fastest bootstrap, mixed projects)",value:"minimal"},{name:"java-only \u2014 Java runtime (Spring Boot services)",value:"java-only"},{name:"python-only \u2014 Python + Poetry (FastAPI, Django, ML pipelines)",value:"python-only"},{name:"node-only \u2014 Node.js runtime (NestJS, Express, Next.js)",value:"node-only"},{name:"go-only \u2014 Go runtime (Fiber, Gin, gRPC, microservices)",value:"go-only"},{name:"dotnet-only \u2014 .NET runtime (ASP.NET Core services)",value:"dotnet-only"},{name:"polyglot \u2014 Python + Node.js + Go + Java + .NET multi-runtime workspace",value:"polyglot"},{name:"enterprise \u2014 Polyglot + governance + Sigstore verification",value:"enterprise"}],default:1}]);d=f;}else d||(d="minimal");let P=!c&&y.has(d),$=typeof u.pythonVersion=="string"&&u.pythonVersion.trim().length>0?u.pythonVersion.trim():void 0,D=g||u.defaultInstallMethod||"poetry",_=P?await Kt():{poetry:true,pipx:true},G=P?await Tt($):{choices:bt.map(f=>({name:f,value:f})),defaultValue:K},et=Nt(D,_),Ct=[{name:_.poetry?"\u{1F3AF} Poetry (Recommended - includes virtual env + dependency mgmt)":"\u{1F3AF} Poetry (Recommended) \u2014 not detected (we can install it)",value:"poetry"},{name:"\u{1F4E6} pip with venv (Standard, zero extra tools)",value:"venv"},{name:_.pipx?"\u{1F527} pipx (Global isolated - RapidKit CLI only, no local venv)":"\u{1F527} pipx (Global isolated) \u2014 not detected (we can install it)",value:"pipx"}],x=P?await q.prompt([{type:"rawlist",name:"pythonVersion",message:"Select Python version for RapidKit:",choices:G.choices,default:G.defaultValue},{type:"rawlist",name:"installMethod",message:"How would you like to manage the workspace environment?",choices:Ct,default:et}]):await(async()=>{let f=g||u.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return a$1.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})();return {pythonVersion:u.pythonVersion||"3.10",installMethod:f}})();if(P&&(console.log(t.gray(`
|
|
115
|
+
\u{1F4CC} Configuration notes:`)),x.pythonVersion==="3.10"?console.log(t.gray(" \u2022 Python 3.10: Latest stable with widespread compatibility")):x.pythonVersion==="3.11"?console.log(t.gray(" \u2022 Python 3.11: Newer, faster (3.10-3.11: ~10% speed improvement)")):x.pythonVersion==="3.12"&&console.log(t.gray(" \u2022 Python 3.12: Cutting edge, excellent for performance")),x.installMethod==="poetry"?console.log(t.gray(" \u2022 Poetry: Dependency management + virtual env (recommended for teams)")):x.installMethod==="venv"?console.log(t.gray(" \u2022 venv: Standard library approach, lightweight, zero dependencies")):console.log(t.gray(" \u2022 pipx: Global isolated, RapidKit CLI only, no local venv")),console.log("")),new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(d)){let f=F("Creating workspace").start();try{await k.ensureDir(i$1),f.succeed("Directory created"),await U(i$1,a,"venv",void 0),await Y(i$1,a,"venv",void 0,d),await L(i$1),await z(i$1,a);let R={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};if(await k.outputFile(m.join(i$1,"README.md"),`# ${a}
|
|
85
116
|
|
|
86
117
|
RapidKit **${R[d]}** workspace.
|
|
87
118
|
|
|
@@ -108,12 +139,12 @@ npx rapidkit dev
|
|
|
108
139
|
cd <project-name>
|
|
109
140
|
npx rapidkit init
|
|
110
141
|
npx rapidkit dev
|
|
111
|
-
`)+"```\n","utf-8"),!n){f.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:i$1}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}try{let{registerWorkspace:b}=await import('./workspace-
|
|
142
|
+
`)+"```\n","utf-8"),!n){f.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:i$1}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}try{let{registerWorkspace:b}=await import('./workspace-F56NUNVG.js');await b(i$1,a);}catch{}if(console.log(t.green(`
|
|
112
143
|
\u2728 Workspace created!
|
|
113
144
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan(`
|
|
114
145
|
\u{1F680} Get started:
|
|
115
146
|
`)),console.log(t.white(` cd ${a}`)),d==="go-only"){console.log(t.white(" npx rapidkit create project gofiber.standard my-api")),console.log(t.white(" cd my-api")),console.log(t.white(" npx rapidkit init")),console.log(t.white(` npx rapidkit dev
|
|
116
|
-
`)),console.log(t.gray("\u{1F4A1} No Python required \u2014 Go kits run entirely through the npm package."));try{let{stdout:b}=await execa("go",["version"],{timeout:3e3}),w=b.match(/go version go(\d+\.\d+(?:\.\d+)?)/),
|
|
147
|
+
`)),console.log(t.gray("\u{1F4A1} No Python required \u2014 Go kits run entirely through the npm package."));try{let{stdout:b}=await execa("go",["version"],{timeout:3e3}),w=b.match(/go version go(\d+\.\d+(?:\.\d+)?)/),S=w?w[1]:"unknown";console.log(t.gray(`\u{1F439} Go ${S} detected \u2014 ready for gofiber.standard / gogin.standard projects`));}catch{console.log(t.yellow(`
|
|
117
148
|
\u26A0\uFE0F Go is not installed \u2014 install it from https://go.dev/dl/`));}}else if(d==="java-only")console.log(t.white(" npx rapidkit create project springboot.standard my-service")),console.log(t.white(" cd my-service")),console.log(t.white(" npx rapidkit init")),console.log(t.white(` npx rapidkit dev
|
|
118
149
|
`)),console.log(t.gray("\u{1F4A1} No Python required \u2014 Spring Boot kit runs through the npm package with Java tooling."));else if(d==="dotnet-only"){console.log(t.white(" npx rapidkit create project dotnet.webapi.clean my-api")),console.log(t.white(" cd my-api")),console.log(t.white(" npx rapidkit init")),console.log(t.white(` npx rapidkit dev
|
|
119
150
|
`)),console.log(t.gray("\u{1F4A1} No Python required \u2014 ASP.NET Core kit runs through the npm package with .NET tooling."));try{let{stdout:b}=await execa("dotnet",["--version"],{timeout:3e3});console.log(t.gray(`\u2699\uFE0F .NET SDK ${b.trim()} detected \u2014 ready for ASP.NET Core projects`));}catch{console.log(t.yellow(`
|
|
@@ -121,23 +152,23 @@ npx rapidkit dev
|
|
|
121
152
|
`)),console.log(t.gray("\u{1F4A1} Python engine will be installed automatically on first `create project nestjs.standard`."))):(console.log(t.white(" npx rapidkit create project")),console.log(t.white(" cd <project-name>")),console.log(t.white(" npx rapidkit init")),console.log(t.white(` npx rapidkit dev
|
|
122
153
|
`)),console.log(t.gray("\u{1F4A1} Bootstrap a specific runtime: rapidkit bootstrap --profile java-only|python-only|node-only|go-only|dotnet-only|polyglot|enterprise")));console.log(t.cyan(`
|
|
123
154
|
\u{1F4DA} More info:`)),console.log(t.gray(" \u2022 Change profile anytime: rapidkit bootstrap --profile <profile>")),console.log(t.gray(" \u2022 View config: cat "+a+"/.rapidkit-workspace")),console.log(t.gray(" \u2022 Check health: rapidkit doctor")),console.log("");}catch(R){throw f.fail("Failed to create workspace"),console.error(t.red(`
|
|
124
|
-
\u274C Error:`),R),R}return}{let f=
|
|
155
|
+
\u274C Error:`),R),R}return}{let f=A(),R=false;try{await execa(f,["--version"],{timeout:5e3}),R=true;}catch{try{await execa("python",["--version"],{timeout:5e3}),R=true;}catch{R=false;}}if(!R){let w={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"}[d];if(P&&!c){console.log(t.yellow(`
|
|
125
156
|
\u26A0\uFE0F Python 3.10+ is not detected on this system.
|
|
126
157
|
`)),console.log(t.cyan(`You have 3 options:
|
|
127
|
-
`));let{pythonAction:
|
|
158
|
+
`));let{pythonAction:T}=await q.prompt([{type:"rawlist",name:"pythonAction",message:"What would you like to do?",choices:[{name:"\u{1F4E5} Install Python now (I'll show you the command for your OS)",value:"install"},{name:`\u{1F504} Switch to "${w}" profile (no Python required)`,value:"fallback"},{name:"\u274C Cancel and install Python manually",value:"cancel"}]}]);if(T==="cancel"&&(console.log(t.cyan(`
|
|
128
159
|
\u{1F4A1} How to install Python:
|
|
129
160
|
`)),console.log(t.white(" Ubuntu / Debian: sudo apt install python3.10")),console.log(t.white(" macOS (Homebrew): brew install python@3.10")),console.log(t.white(` Windows: https://python.org/downloads
|
|
130
161
|
`)),console.log(t.gray(` After installing Python, run: npx rapidkit ${a}
|
|
131
|
-
`)),process.exit(1)),
|
|
162
|
+
`)),process.exit(1)),T==="install"){console.log(t.cyan(`
|
|
132
163
|
\u{1F4A1} Install Python on your system:
|
|
133
164
|
`));let j=process.platform;j==="linux"?console.log(t.white(` sudo apt update && sudo apt install python3.10 python3.10-venv
|
|
134
165
|
`)):j==="darwin"?console.log(t.white(` brew install python@3.10
|
|
135
166
|
`)):j==="win32"&&(console.log(t.white(` Download: https://python.org/downloads
|
|
136
167
|
`)),console.log(t.white(` Run the installer and check "Add Python to PATH"
|
|
137
168
|
`))),console.log(t.gray(` After installing, run: npx rapidkit ${a}
|
|
138
|
-
`)),process.exit(0);}if(
|
|
169
|
+
`)),process.exit(0);}if(T==="fallback"&&(console.log(t.green(`
|
|
139
170
|
\u2705 Switching to "${w}" profile (no Python required).
|
|
140
|
-
`)),d=w,new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(w))){let C=
|
|
171
|
+
`)),d=w,new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(w))){let C=F("Creating workspace").start();try{await k.ensureDir(i$1),C.succeed("Directory created"),await U(i$1,a,"venv",void 0),await Y(i$1,a,"venv",void 0,w),await L(i$1),await z(i$1,a);let B={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};if(await k.outputFile(m.join(i$1,"README.md"),`# ${a}
|
|
141
172
|
|
|
142
173
|
RapidKit **${B[w]}** workspace (switched from ${d} due to missing Python).
|
|
143
174
|
|
|
@@ -164,7 +195,7 @@ npx rapidkit dev
|
|
|
164
195
|
cd <project-name>
|
|
165
196
|
npx rapidkit init
|
|
166
197
|
npx rapidkit dev
|
|
167
|
-
`)+"```\n","utf-8"),!n){C.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m",`Initial commit: RapidKit workspace (${w} profile)`],{cwd:i$1}),C.succeed("Git repository initialized");}catch{C.warn("Could not initialize git repository");}}try{let{registerWorkspace:$t}=await import('./workspace-
|
|
198
|
+
`)+"```\n","utf-8"),!n){C.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m",`Initial commit: RapidKit workspace (${w} profile)`],{cwd:i$1}),C.succeed("Git repository initialized");}catch{C.warn("Could not initialize git repository");}}try{let{registerWorkspace:$t}=await import('./workspace-F56NUNVG.js');await $t(i$1,a);}catch{}console.log(t.green(`
|
|
168
199
|
\u2728 Workspace created with fallback profile!
|
|
169
200
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan(`
|
|
170
201
|
\u{1F680} Get started:
|
|
@@ -174,7 +205,7 @@ npx rapidkit dev
|
|
|
174
205
|
`)),console.log("");return}catch(B){throw C.fail("Failed to create workspace"),console.error(t.red(`
|
|
175
206
|
\u274C Error:`),B),B}}}else if(console.log(t.yellow(`
|
|
176
207
|
\u26A0\uFE0F Python not detected. Auto-switching to "${w}" profile (no Python required).
|
|
177
|
-
`)),d=w,new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(w)){let j=
|
|
208
|
+
`)),d=w,new Set(["go-only","java-only","dotnet-only","node-only","minimal"]).has(w)){let j=F("Creating workspace").start();try{if(await k.ensureDir(i$1),j.succeed("Directory created"),await U(i$1,a,"venv",void 0),await Y(i$1,a,"venv",void 0,w),await L(i$1),await z(i$1,a),!n){j.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m",`Initial commit: RapidKit workspace (${w})`],{cwd:i$1}),j.succeed("Git repository initialized");}catch{j.warn("Could not initialize git repository");}}try{let{registerWorkspace:C}=await import('./workspace-F56NUNVG.js');await C(i$1,a);}catch{}console.log(t.green(`
|
|
178
209
|
\u2728 Workspace created (auto-fallback profile)!
|
|
179
210
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan("\u{1F4E6} Profile:"),t.yellow(w)),console.log(t.cyan("\u{1F4A1} Reason:"),t.gray("Python not detected; switched from "+d)),console.log(t.cyan(`
|
|
180
211
|
\u{1F680} Get started:
|
|
@@ -182,19 +213,19 @@ npx rapidkit dev
|
|
|
182
213
|
`)),console.log(t.cyan(`\u{1F4A1} Add Python later:
|
|
183
214
|
`)),console.log(t.gray(" 1. Install Python 3.10+")),console.log(t.gray(` 2. Run: cd ${a} && rapidkit bootstrap --profile ${d}
|
|
184
215
|
`)),console.log("");return}catch(C){throw j.fail("Failed to create workspace"),console.error(t.red(`
|
|
185
|
-
\u274C Error:`),C),C}}}}a$1.step(1,3,"Setting up RapidKit environment");let I=
|
|
216
|
+
\u274C Error:`),C),C}}}}a$1.step(1,3,"Setting up RapidKit environment");let I=F("Creating directory").start();try{await k.ensureDir(i$1),I.succeed("Directory created"),I.start("Detecting Python version");let f=null,R=await Rt(x.pythonVersion);if(R)f=await gt(R),f?(a$1.info(` Detected Python ${f}`),I.succeed(`Python ${f} detected`)):I.warn("Could not detect exact Python version");else {let b=A();f=await gt(b),f?I.succeed(`Python ${f} detected`):I.warn("Could not detect Python version, proceeding with defaults");}if(x.installMethod==="poetry"&&!await xt()&&(I.warn("Poetry not found \u2014 auto-fallback to pip + venv"),x.installMethod="venv"),await U(i$1,a,x.installMethod,f||void 0),f&&await Mt(i$1,f),await Y(i$1,a,x.installMethod,f||x.pythonVersion,d||h),await L(i$1),await z(i$1,a),x.installMethod==="poetry")try{await _t(i$1,x.pythonVersion,I,r,u,c);}catch(b){let w=b?.details||b?.message||String(b);if(w.includes("pyenv")||w.includes("exit status 127")||w.includes("returned non-zero exit status 127")){I.warn("Poetry encountered Python discovery issues, trying venv method"),a$1.debug(`Poetry error (attempting venv fallback): ${w}`);try{await ct(i$1,x.pythonVersion,I,r,u),x.installMethod="venv";}catch(T){throw T}}else throw b}else x.installMethod==="venv"?await ct(i$1,x.pythonVersion,I,r,u):await Et(i$1,I,r,u,c);if(await It(i$1,x.installMethod),await jt(i$1,x.installMethod),I.succeed("RapidKit environment ready!"),!o.skipGit){I.start("Initializing git repository");try{await execa("git",["init"],{cwd:i$1}),await execa("git",["add","."],{cwd:i$1}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:i$1}),I.succeed("Git repository initialized");}catch{I.warn("Could not initialize git repository");}}try{let{registerWorkspace:b}=await import('./workspace-F56NUNVG.js');await b(i$1,a);}catch{console.warn(t.gray("Note: Could not register workspace in shared registry"));}if(console.log(t.green(`
|
|
186
217
|
\u2728 RapidKit environment created successfully!
|
|
187
218
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(i$1)),console.log(t.cyan("\u2699\uFE0F Configuration:")),console.log(t.gray(` \u2022 Profile: ${d}`)),console.log(t.gray(` \u2022 Python: ${x.pythonVersion}`)),console.log(t.gray(` \u2022 Install method: ${x.installMethod}`)),console.log(t.cyan(`
|
|
188
219
|
\u{1F680} Get started:
|
|
189
|
-
`)),console.log(t.white(` cd ${a}`)),x.installMethod==="poetry"){let b="source $(poetry env info --path)/bin/activate";try{
|
|
220
|
+
`)),console.log(t.white(` cd ${a}`)),x.installMethod==="poetry"){let b="source $(poetry env info --path)/bin/activate";try{O();let{stdout:w}=await execa("poetry",["--version"]),S=w.match(/Poetry.*?(\d+)\.(\d+)/);S&&(parseInt(S[1])>=2?b="source $(poetry env info --path)/bin/activate":b="poetry shell");}catch{}console.log(t.white(` ${b} # Or: poetry run rapidkit`)),console.log(t.white(" rapidkit create # Interactive mode")),console.log(t.white(" cd <project-name>")),console.log(t.white(" rapidkit init")),console.log(t.white(" rapidkit dev")),console.log(t.gray(`
|
|
190
221
|
\u{1F4E6} Why Poetry? Includes dependency management + virtual environment`));}else x.installMethod==="venv"?(console.log(t.white(" source .venv/bin/activate # On Windows: .venv\\Scripts\\activate")),console.log(t.white(" rapidkit create # Interactive mode")),console.log(t.white(" cd <project-name>")),console.log(t.white(" rapidkit init")),console.log(t.white(" rapidkit dev")),console.log(t.gray(`
|
|
191
222
|
\u{1F4E6} Why venv? Standard, zero extra tools, lightweight`))):(console.log(t.white(" rapidkit create # Interactive mode")),console.log(t.white(" cd <project-name>")),console.log(t.white(" rapidkit init")),console.log(t.white(" rapidkit dev")),console.log(t.gray(`
|
|
192
223
|
\u{1F4E6} Why pipx? Global isolated install, no local venv`)));console.log(t.cyan(`
|
|
193
224
|
\u{1F4DA} Next steps:`)),console.log(t.gray(" 1. Check README.md for workspace details")),console.log(t.gray(" 2. Create your first project: rapidkit create project")),console.log(t.gray(" 3. See all runtimes: rapidkit list # Shows: fastapi, nestjs, springboot, gofiber, gogin, dotnet")),console.log(t.cyan(`
|
|
194
225
|
\u{1F4A1} Profile management:`)),console.log(t.gray(" \u2022 Add Python? \u2192 rapidkit bootstrap --profile python-only|polyglot")),console.log(t.gray(" \u2022 Add Node.js? \u2192 rapidkit bootstrap --profile node-only|polyglot")),console.log(t.gray(" \u2022 Add Go? \u2192 rapidkit bootstrap --profile go-only|polyglot")),console.log(t.gray(" \u2022 Add .NET? \u2192 rapidkit bootstrap --profile dotnet-only|polyglot")),console.log(t.gray(" \u2022 Full setup? \u2192 rapidkit bootstrap --profile enterprise")),console.log(t.cyan(`
|
|
195
226
|
\u{1F4D6} Common commands:`)),console.log(t.white(" rapidkit create - Create a new project (interactive)")),console.log(t.white(" rapidkit list - List available kits")),console.log(t.white(" rapidkit modules - List available modules")),console.log(t.white(" rapidkit doctor - Check workspace health")),console.log(t.white(` rapidkit bootstrap --help - Advanced workspace configuration
|
|
196
|
-
`));try{let{stdout:b}=await execa("go",["version"],{timeout:3e3}),w=b.match(/go version go(\d+\.\d+(?:\.\d+)?)/),
|
|
197
|
-
\u274C Error:`),f);try{await k.remove(i$1);}catch{}throw f}}async function Rt(e$1){let o=[];if(!a$2())try{let{stdout:p}=await execa("pyenv",["which","python"]),c=p.trim();c&&o.push(c);}catch{}let n=Number(e$1.split(".")[1]),r=e(n,10).map(p=>p.command).filter(Boolean);o.push(`python${e$1}`,...r,...d$1());let l=[...new Set(o)];for(let p of l)try{let c=p==="py"?["-3","--version"]:["--version"],u=p==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:g}=await execa(p,c,{timeout:2e3}),h=g.match(/Python (\d+\.\d+)/)?.[1];if(h&&
|
|
227
|
+
`));try{let{stdout:b}=await execa("go",["version"],{timeout:3e3}),w=b.match(/go version go(\d+\.\d+(?:\.\d+)?)/),S=w?w[1]:"unknown";console.log(t.gray(`\u{1F439} Go ${S} detected \u2014 ready for gofiber.standard projects`));}catch{console.log(t.yellow("\u26A0\uFE0F Go not installed \u2014 needed for gofiber.standard/gogin.standard projects")),console.log(t.gray(" Install: https://go.dev/dl/"));}console.log("");}catch(f){I.fail("Failed to create RapidKit environment"),console.error(t.red(`
|
|
228
|
+
\u274C Error:`),f);try{await k.remove(i$1);}catch{}throw f}}async function Rt(e$1){let o=[];if(!a$2())try{let{stdout:p}=await execa("pyenv",["which","python"]),c=p.trim();c&&o.push(c);}catch{}let n=Number(e$1.split(".")[1]),r=e(n,10).map(p=>p.command).filter(Boolean);o.push(`python${e$1}`,...r,...d$1());let l=[...new Set(o)];for(let p of l)try{let c=p==="py"?["-3","--version"]:["--version"],u=p==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:g}=await execa(p,c,{timeout:2e3}),h=g.match(/Python (\d+\.\d+)/)?.[1];if(h&&V(h,e$1))return await execa(p,u,{timeout:2e3}),p}catch{continue}return null}async function _t(e,o,n,r,l$1,p=false){await Ot(n,p),n.start("Finding Python interpreter");let c=await Rt(o);c?(a$1.debug(`Found working Python: ${c}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let u=m.join(e,"pyproject.toml"),h=(await k.pathExists(u)?await promises.readFile(u,"utf-8"):"").includes("rapidkit-core");if(h)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${o}`],{cwd:e}),n.succeed("Poetry project initialized");let d=await promises.readFile(u,"utf-8");d.includes("[tool.poetry]")?d=d.replace("[tool.poetry]",`[tool.poetry]
|
|
198
229
|
package-mode = false`):d.includes("[project]")&&(d.includes("[build-system]")?d=d.replace("[build-system]",`
|
|
199
230
|
[tool.poetry]
|
|
200
231
|
package-mode = false
|
|
@@ -203,19 +234,19 @@ package-mode = false
|
|
|
203
234
|
|
|
204
235
|
[tool.poetry]
|
|
205
236
|
package-mode = false
|
|
206
|
-
`),await promises.writeFile(u,d,"utf-8");}n.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:e}),n.succeed("Poetry configured");}catch{n.warn("Could not configure Poetry virtualenvs.in-project");}n.start("Creating virtualenv");let a=c||
|
|
237
|
+
`),await promises.writeFile(u,d,"utf-8");}n.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:e}),n.succeed("Poetry configured");}catch{n.warn("Could not configure Poetry virtualenvs.in-project");}n.start("Creating virtualenv");let a=c||A(),i=f(m.join(e,".venv"));try{await execa(a,["-m","venv",".venv"],{cwd:e,timeout:6e4}),n.succeed("Virtualenv created");}catch(y){a$1.debug(`python -m venv failed: ${y}`),n.warn("Could not pre-create virtualenv, Poetry will try"),i=c||A();}try{await execa("poetry",["env","use",i||A()],{cwd:e}),a$1.debug(`Poetry env set to: ${i}`);}catch(y){a$1.debug(`Could not set Poetry env: ${y}`);}if(n.start("Installing RapidKit"),h&&!r){let y=d$2(l$1||{}),d=y?await k.pathExists(y):false,P=d&&y?y:"rapidkit-core";y&&!d&&a$1.warn(`RAPIDKIT_DEV_PATH is set but path does not exist: ${y}. Falling back to PyPI.`),n.text=d?"Installing RapidKit from local path":"Installing RapidKit from PyPI";let $=false,D=null;for(let _=1;_<=3;_++)try{await execa(i,["-m","pip","install",P,"--quiet"],{cwd:e,timeout:18e4}),$=true;break}catch(G){D=G,a$1.debug(`pip install rapidkit-core attempt ${_} failed: ${G}`),_<3&&(n.text=`Retrying installation (attempt ${_+1}/3)`,await new Promise(et=>setTimeout(et,2e3)));}if(!$){let _=D?.stderr||D?.message||"Unknown error";throw a$1.debug(`All pip install attempts failed. Last error: ${_}`),_.includes("Could not find")||_.includes("No matching distribution")?new l:new k$1("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
207
238
|
Error: ${_}
|
|
208
239
|
|
|
209
240
|
Possible solutions:
|
|
210
241
|
1. Check your internet connection
|
|
211
242
|
2. Try installing manually: cd ${m.basename(e)} && poetry add rapidkit-core
|
|
212
|
-
3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}else {n.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:e,timeout:12e4}),n.succeed("Poetry environment synced");}catch(y){a$1.debug(`poetry install --no-root failed: ${y}`),n.warn("Could not sync Poetry environment, proceeding with add command");}if(n.start("Installing RapidKit"),r){let y=d$2(l$1||{});if(!y)throw new k$1("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a$1.debug(`Installing from local path: ${y}`),n.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",y],{cwd:e});}else {n.text="Installing RapidKit from PyPI";let y=false,d=null;for(let P=1;P<=3;P++)try{await execa("poetry",["add","rapidkit-core"],{cwd:e,timeout:6e4*P}),y=true;break}catch($){d=$,a$1.debug(`Poetry add attempt ${P} failed: ${$}`),P<3&&(n.text=`Retrying installation (attempt ${P+1}/3)`,await new Promise(
|
|
243
|
+
3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}else {n.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:e,timeout:12e4}),n.succeed("Poetry environment synced");}catch(y){a$1.debug(`poetry install --no-root failed: ${y}`),n.warn("Could not sync Poetry environment, proceeding with add command");}if(n.start("Installing RapidKit"),r){let y=d$2(l$1||{});if(!y)throw new k$1("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a$1.debug(`Installing from local path: ${y}`),n.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",y],{cwd:e});}else {n.text="Installing RapidKit from PyPI";let y=false,d=null;for(let P=1;P<=3;P++)try{await execa("poetry",["add","rapidkit-core"],{cwd:e,timeout:6e4*P}),y=true;break}catch($){d=$,a$1.debug(`Poetry add attempt ${P} failed: ${$}`),P<3&&(n.text=`Retrying installation (attempt ${P+1}/3)`,await new Promise(D=>setTimeout(D,2e3)));}if(!y){let P=d?.stderr||d?.message||"Unknown error";throw a$1.debug(`All Poetry install attempts failed. Last error: ${P}`),P.includes("Could not find")||P.includes("No matching distribution")?new l:new k$1("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
213
244
|
Error: ${P}
|
|
214
245
|
|
|
215
246
|
Possible solutions:
|
|
216
247
|
1. Check your internet connection
|
|
217
248
|
2. Try installing manually: cd ${m.basename(e)} && poetry add rapidkit-core
|
|
218
|
-
3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:y}=await import('./pythonRapidkitExec-
|
|
249
|
+
3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:y}=await import('./pythonRapidkitExec-MNWRC4F2.js');if(!await y()&&!r){n.start("Checking optional global pipx installation");let P=await tt(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await N(P,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch($){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),a$1.debug(`pipx install failed: ${$}`);}}}catch(y){n.succeed("Skipped optional global pipx installation"),a$1.debug(`Global install check skipped: ${y}`);}}async function ct(e,o,n,r,l$1,p=false){n.start(`Checking Python ${o}`);let c=A();try{let{stdout:g}=await execa(c,["--version"]),h=g.match(/Python (\d+\.\d+)/)?.[1];if(h&&!V(h,o))throw new f$1(o,h);n.succeed(`Python ${h} found`);}catch(g){throw g instanceof f$1?g:new f$1(o)}n.start("Creating virtual environment");try{await execa(c,["-m","venv",".venv"],{cwd:e}),n.succeed("Virtual environment created");}catch(g){if(n.fail("Failed to create virtual environment"),(a=>typeof a=="object"&&a!==null&&"stdout"in a&&typeof a.stdout=="string")(g)&&g.stdout.includes("ensurepip is not")){let a=g.stdout.match(/apt install (python[\d.]+-venv)/),i=a?a[1]:"python3-venv";throw new k$1("Python venv module not available",new Error(`Virtual environment creation failed.
|
|
219
250
|
|
|
220
251
|
On Debian/Ubuntu systems, install the venv package:
|
|
221
252
|
sudo apt install ${i}
|
|
@@ -227,9 +258,9 @@ Error: ${a}
|
|
|
227
258
|
Possible solutions:
|
|
228
259
|
1. Check your internet connection
|
|
229
260
|
2. Try installing manually: cd ${m.basename(e)} && ${f(".venv")} -m pip install rapidkit-core
|
|
230
|
-
3. Use Poetry instead: npx rapidkit ${m.basename(e)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:g}=await import('./pythonRapidkitExec-
|
|
261
|
+
3. Use Poetry instead: npx rapidkit ${m.basename(e)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:g}=await import('./pythonRapidkitExec-MNWRC4F2.js');if(!await g()&&!r){n.start("Checking optional global pipx installation");let a=await tt(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await N(a,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(i){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),a$1.debug(`pipx install failed: ${i}`);}}}catch(g){n.succeed("Skipped optional global pipx installation"),a$1.debug(`Global install check skipped: ${g}`);}}async function Et(e,o,n,r,l$1=false){if(!n)try{let{checkRapidkitCoreVersionCompatible:c}=await import('./pythonRapidkitExec-MNWRC4F2.js'),u=await c();if(u.isCompatible){o.succeed(`RapidKit ${u.installedVersion??""} already compatible globally; skipping pipx installation`),await k.outputFile(m.join(e,".rapidkit-global"),`RapidKit already available globally (version ${u.installedVersion??"unknown"}) and satisfies expected constraint ${u.expectedConstraint??"n/a"}; workspace will reuse the existing installation
|
|
231
262
|
`,"utf-8");return}u.reason==="constraint-missing"?o.warn('Version-aware global reuse skipped: no explicit rapidkit-core version constraint found. Set RAPIDKIT_CORE_PYTHON_PACKAGE (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core>=0.4.0,<0.9.0") to enable version-aware reuse. Proceeding with pipx install/upgrade.'):u.reason==="constraint-unsupported"&&o.warn('Version-aware global reuse skipped: RAPIDKIT_CORE_PYTHON_PACKAGE uses an unsupported spec (path/url/git). Use a version range instead (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core==0.4.0" or "rapidkit-core>=0.4.0,<0.9.0"). Proceeding with pipx install/upgrade.'),a$1.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${u.reason}, installed=${u.installedVersion??"unknown"}, expected=${u.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(c){a$1.debug(`Global RapidKit version-aware check failed before pipx install: ${c}`);}let p=await tt(o,l$1);if(o.start("Installing RapidKit globally with pipx"),n){let c=d$2(r||{});if(!c)throw new k$1("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a$1.debug(`Installing from local path: ${c}`),o.text="Installing RapidKit from local path (test mode)",await N(p,["install","-e",c]);}else {o.text="Installing RapidKit from PyPI";try{await N(p,["install","rapidkit-core"]);}catch(c){try{o.text="RapidKit already installed globally, upgrading to match expected version",await N(p,["upgrade","rapidkit-core"]);}catch(u){throw a$1.debug(`pipx install/upgrade failed: install=${c}, upgrade=${u}`),new l}}}o.succeed("RapidKit installed globally"),await k.outputFile(m.join(e,".rapidkit-global"),`RapidKit installed globally with pipx
|
|
232
|
-
`,"utf-8");}async function ce(e,o){let{skipGit:n=false,testMode:r=false,userConfig:l={},yes:p=false,installMethod:c,pythonVersion:u="3.10"}=o||{},g=c||l.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return a$1.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=g==="poetry"&&!await xt()?"venv":g;await
|
|
263
|
+
`,"utf-8");}async function ce(e,o){let{skipGit:n=false,testMode:r=false,userConfig:l={},yes:p=false,installMethod:c,pythonVersion:u="3.10"}=o||{},g=c||l.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return a$1.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=g==="poetry"&&!await xt()?"venv":g;await U(e,m.basename(e),h),await L(e),await Y(e,m.basename(e),h,u,o?.profile);let a=F("Registering workspace").start();try{h==="poetry"?(await z(e,m.basename(e)),await _t(e,u,a,r,l,p)):h==="venv"?await ct(e,u,a,r,l):await Et(e,a,r,l,p),await It(e,h),await jt(e,h),a.succeed("Workspace registered");try{let{registerWorkspace:i}=await import('./workspace-F56NUNVG.js');await i(e,m.basename(e));}catch{}if(!n){a.start("Initializing git repository");try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:e}),a.succeed("Git repository initialized");}catch{a.warn("Could not initialize git repository");}}}catch(i){throw a.fail("Failed to register workspace"),i}}async function jt(e,o){let n=o==="poetry"?`source $(poetry env info --path)/bin/activate
|
|
233
264
|
# Or simply use: poetry run rapidkit <command>`:o==="venv"?"source .venv/bin/activate # On Windows: .venv\\Scripts\\activate":"N/A (globally installed)",r=o==="poetry"?`# No activation needed (recommended):
|
|
234
265
|
./rapidkit --help
|
|
235
266
|
# or:
|
|
@@ -340,7 +371,7 @@ If you encounter issues:
|
|
|
340
371
|
2. Check RapidKit installation: \`rapidkit --version\`
|
|
341
372
|
3. Run diagnostics: \`rapidkit doctor\`
|
|
342
373
|
4. Visit RapidKit documentation or GitHub issues
|
|
343
|
-
`;await promises.writeFile(m.join(e,"README.md"),p,"utf-8");}async function
|
|
374
|
+
`;await promises.writeFile(m.join(e,"README.md"),p,"utf-8");}async function Vt(e,o,n){let r=F("Creating demo workspace").start();try{await k.ensureDir(e),r.succeed("Directory created"),r.start("Setting up demo kit generator");let l=JSON.stringify({name:`${o}-workspace`,version:"1.0.0",private:true,description:"RapidKit demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(m.join(e,"package.json"),l,"utf-8"),await promises.writeFile(m.join(e,"generate-demo.js"),`#!/usr/bin/env node
|
|
344
375
|
/**
|
|
345
376
|
* Demo Kit Generator - Create FastAPI demo projects
|
|
346
377
|
*
|
|
@@ -839,7 +870,7 @@ __pycache__/
|
|
|
839
870
|
`,"utf-8"),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:e}),r.succeed("Git repository initialized");}catch{r.warn("Could not initialize git repository");}}console.log(t.green(`
|
|
840
871
|
\u2728 Demo workspace created successfully!
|
|
841
872
|
`)),console.log(t.cyan("\u{1F4C2} Location:"),t.white(e)),console.log(t.cyan(`\u{1F680} Get started:
|
|
842
|
-
`)),console.log(t.white(` cd ${o}`)),console.log(t.white(" node generate-demo.js my-api")),console.log(t.white(" cd my-api")),console.log(t.white(" rapidkit init")),console.log(t.white(" rapidkit dev")),console.log(),console.log(t.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For full RapidKit features:"),console.log(t.cyan(" pipx install rapidkit")),console.log();}catch(l){throw r.fail("Failed to create demo workspace"),l}}async function
|
|
873
|
+
`)),console.log(t.white(` cd ${o}`)),console.log(t.white(" node generate-demo.js my-api")),console.log(t.white(" cd my-api")),console.log(t.white(" rapidkit init")),console.log(t.white(" rapidkit dev")),console.log(),console.log(t.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For full RapidKit features:"),console.log(t.cyan(" pipx install rapidkit")),console.log();}catch(l){throw r.fail("Failed to create demo workspace"),l}}async function Gt(e,o,n,r,l,p,c){if(console.log(t.cyan(`
|
|
843
874
|
\u{1F50D} Dry-run mode - what would be created:
|
|
844
875
|
`)),console.log(t.white("\u{1F4C2} Workspace path:"),e),console.log(t.white("\u{1F4DB} Name:"),t.cyan(o)),n)console.log(t.white("\u{1F4E6} Type:"),"Demo environment"),console.log(t.white(`
|
|
845
876
|
\u{1F4DD} Files to create:`)),console.log(t.gray(" - package.json")),console.log(t.gray(" - generate-demo.js (project generator)")),console.log(t.gray(" - README.md")),console.log(t.gray(" - .gitignore")),console.log(t.white(`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {f,e,d,a as a$1,k as k$1,g as g$1,c}from'./chunk-Z5LKRG57.js';import {a}from'./chunk-2FIX2MDC.js';import ft from'crypto';import q from'os';import u from'path';import*as p from'fs-extra';import {execa}from'execa';var mt=["version","project","create","add","list","info","upgrade","diff","doctor","license","commands","reconcile","rollback","uninstall","checkpoint","optimize","snapshot","frameworks","modules","merge"],M=new Set(mt);var g=a();function O(){let t=[],e$1=i=>{let o=i?.trim();o&&t.push(o);};e$1(process.env.RAPIDKIT_BRIDGE_PYTHON),e$1(process.env.RAPIDKIT_PYTHON_CMD),e$1(process.env.POETRY_PYTHON);let r=_();(r.startsWith("/")||r.startsWith(".")||r.startsWith(".."))&&!r.startsWith("file:")&&e$1(f(u.join(u.resolve(r),".venv")));for(let i of e())i.args.length===1&&i.args[0]==="--version"&&e$1(i.command);for(let i of d())e$1(i);return [...new Set(t)]}function v(t,e){return t==="py"?["-3",...e]:e}function J(t){if(!t)return t;let e=["Installed Poetry version does not support '--no-update'. Falling back to 'poetry lock'."];return t.split(/\r?\n/).filter(i=>!e.some(o=>i.includes(o))).join(`
|
|
2
|
+
`)}var w=class extends Error{code;constructor(e,r){super(r),this.code=e;}};function S(t){if(t instanceof w)switch(t.code){case "PYTHON_NOT_FOUND":return `RapidKit (npm) could not find Python (python3/python/py) on your PATH.
|
|
3
|
+
Install Python 3.10+ and ensure \`${c()}\` is available, then retry.
|
|
4
|
+
Tip: if you are inside a RapidKit project, use the local ./rapidkit launcher.`;case "BRIDGE_VENV_CREATE_FAILED":return `RapidKit (npm) failed to create its bridge virtual environment.
|
|
5
|
+
`+(a$1()?`Ensure Python is installed with venv support.
|
|
6
|
+
`:`Ensure Python venv support is installed (e.g., python3-venv).
|
|
7
|
+
`)+`Details: ${t.message}`;case "BRIDGE_PIP_BOOTSTRAP_FAILED":return `RapidKit (npm) could not bootstrap pip inside the bridge virtual environment.
|
|
8
|
+
`+(a$1()?`Ensure pip is available for your Python installation and retry.
|
|
9
|
+
`:`Install python3-venv/python3-pip and retry.
|
|
10
|
+
`)+`Details: ${t.message}`;case "BRIDGE_PIP_UPGRADE_FAILED":return `RapidKit (npm) could not upgrade pip in the bridge virtual environment.
|
|
11
|
+
Check your network/proxy or disable RAPIDKIT_BRIDGE_UPGRADE_PIP.
|
|
12
|
+
Details: ${t.message}`;case "BRIDGE_PIP_INSTALL_FAILED":return `RapidKit (npm) could not install rapidkit-core in the bridge virtual environment.
|
|
13
|
+
Check your network/proxy, or install manually with: pipx install rapidkit-core.
|
|
14
|
+
Details: ${t.message}`;default:return `RapidKit (npm) bridge error: ${t.message}`}return `RapidKit (npm) failed to run the Python core engine: ${t instanceof Error?t.message:String(t)}`}function _(){let t=process.env.RAPIDKIT_CORE_PYTHON_PACKAGE;return t&&t.trim()?t.trim():"rapidkit-core"}function ht(){let t=_(),e=process.env.RAPIDKIT_CORE_PYTHON_PACKAGE_ID,r=e&&e.trim()?`${t}|${e.trim()}`:t;return ft.createHash("sha256").update(r).digest("hex").slice(0,12)}function j(){let t=process.env.XDG_CACHE_HOME;return t&&t.trim()?t:u.join(q.homedir(),".cache")}function gt(){return u.join(j(),"rapidkit","npm-bridge","venv")}function Q(){let t=ht();return u.join(j(),"rapidkit","npm-bridge",`venv-${t}`)}function H(t){return f(t)}function U(t){return g$1(t)}async function tt(t=process.platform,e=process.env){let r=a$1(t)?["rapidkit.exe","rapidkit.cmd"]:["rapidkit"],n=k$1(e,t).flatMap(i=>r.map(o=>u.join(i,o)));for(let i of [...new Set(n)])try{if(!await p.pathExists(i))continue;let o=await execa(i,["--version","--json"],{reject:false,stdio:"pipe",timeout:4e3});if(o.exitCode===0&&await D(o.stdout))return {cmd:i,baseArgs:[]}}catch{}return null}function et(t){return /[<>=!~]=|@|\.whl$|\.tar\.gz$|\.zip$|git\+|https?:\/\//.test(t)}function yt(t){return u.dirname(u.dirname(t))}function nt(){return u.join(j(),"rapidkit","npm-bridge","core-commands.json")}async function rt(t){let e=!!process.env.RAPIDKIT_DEBUG,r=n=>{e&&process.stderr.write(`[DEBUG] tryRapidkit(${t}): ${n}
|
|
15
|
+
`);};try{r("probing interpreter-specific rapidkit script");let i=((await execa(t,v(t,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"]),{reject:false,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(r(`script path: ${i}`),i)try{if(await p.pathExists(i)){r(`found script at ${i}; invoking --version --json`);let o=await execa(i,["--version","--json"],{reject:false,stdio:"pipe",timeout:4e3});if(r(`script exitCode=${o.exitCode}`),o.exitCode===0){let a=(o.stdout??"").toString().trim();try{let s=JSON.parse(a),c=!!s&&typeof s=="object"&&s!==null&&"version"in s;if(r(`script JSON parse ok=${c}`),c)return true}catch{r("script output not valid JSON");}}}}catch(o){r(`interpreter-specific script probe failed: ${String(o)}`);}}catch(n){r(`interpreter-specific script probe error: ${String(n)}`);}try{r('probing importlib.find_spec("rapidkit")');let n=await execa(t,v(t,["-c","import importlib.util; print(1 if importlib.util.find_spec('rapidkit') else 0)"]),{reject:false,stdio:"pipe",timeout:2e3});if(r(`import probe exitCode=${n.exitCode} stdout=${(n.stdout??"").toString().trim()}`),n.exitCode===0&&(n.stdout??"").toString().trim()==="1")return true}catch(n){r(`import probe error: ${String(n)}`);}try{r("probing python -m rapidkit");let n=await execa(t,v(t,["-m","rapidkit","--version","--json"]),{reject:false,stdio:"pipe",timeout:8e3});if(r(`-m probe exitCode=${n.exitCode}`),n.exitCode===0)return true}catch(n){r(`-m probe error: ${String(n)}`);}try{r("probing PATH for rapidkit executables");let n=(process.env.PATH??"").split(u.delimiter).filter(Boolean);for(let i of n){let o=u.join(i,a$1()?"rapidkit.exe":"rapidkit");try{if(await p.pathExists(o)){r(`found candidate on PATH: ${o}; invoking --version --json`);let a=await execa(o,["--version","--json"],{reject:false,stdio:"pipe",timeout:4e3});if(r(`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 true}catch{r("candidate output not valid JSON, skipping");}}}}catch(a){r(`error probing candidate ${o}: ${String(a)}`);}}return r("no valid rapidkit found on PATH"),false}catch(n){return r(`PATH probe error: ${String(n)}`),false}}async function D(t){let e=(t??"").toString().trim();if(!e)return false;try{let r=JSON.parse(e);return !!r&&typeof r=="object"&&r!==null&&"version"in r}catch{return false}}async function it(t,e=process.platform){let r=async o=>{try{let a=u.join(o,".rapidkit-workspace");if(!await p.pathExists(a))return null;let c=(await p.readJson(a))?.metadata?.python?.venvPath;return typeof c!="string"||!c.trim()?null:u.isAbsolute(c)?c:u.join(o,c)}catch{return null}},n=async(o,a)=>{let s=g$1(a,e);if(await p.pathExists(s)){let l=await execa(s,["--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:o});if(l.exitCode===0&&await D(l.stdout))return {cmd:s,baseArgs:[],workspaceDir:o}}let c=f(a,e);if(await p.pathExists(c)){let l=await execa(c,["-m","rapidkit","--version","--json"],{reject:false,stdio:"pipe",timeout:1500,cwd:o});if(l.exitCode===0&&await D(l.stdout))return {cmd:c,baseArgs:["-m","rapidkit"],workspaceDir:o}}return null},i=t;for(let o=0;o<25;o+=1){let a=await r(i),s=[u.join(i,".venv"),a].filter(l=>!!l);for(let l of [...new Set(s)]){let P=await n(i,l);if(P)return P}let c=u.dirname(i);if(c===i)break;i=c;}return null}async function wt(t){try{let e=u.join(t,".python-version");if(await p.pathExists(e)){let n=(await p.readFile(e,"utf-8")).trim();if(n)return n}}catch{}try{let e=u.join(t,".rapidkit-workspace");if(await p.pathExists(e)){let r=await p.readJson(e);if(typeof r?.pythonVersion=="string"&&r.pythonVersion.trim())return r.pythonVersion.trim();let n=r?.metadata?.python?.pythonVersion;if(typeof n=="string"&&n.trim())return n.trim()}}catch{}return null}async function F(t){if(t&&t.trim())try{let a=await it(t);if(a){let s=a.workspaceDir??(u.dirname(a.cmd).includes(".venv")?u.dirname(u.dirname(u.dirname(a.cmd))):u.dirname(a.cmd)),c=await wt(s);return c&&(process.env.PYENV_VERSION=c),a}}catch{}let e=await xt();if(e.kind==="venv"){let a=yt(e.pythonPath),s=U(a);return await p.pathExists(s)?{cmd:s,baseArgs:[]}:{cmd:e.pythonPath,baseArgs:["-m","rapidkit"]}}try{if((await execa(e.cmd,["-m","rapidkit","--version","--json"],{reject:false,stdio:"pipe",timeout:4e3})).exitCode===0)return {cmd:e.cmd,baseArgs:["-m","rapidkit"]}}catch{}try{let s=((await execa(e.cmd,["-c","import sysconfig, os; print(os.path.join(sysconfig.get_path('scripts'), 'rapidkit'))"],{reject:false,stdio:"pipe",timeout:2e3})).stdout??"").toString().trim();if(s&&await p.pathExists(s))try{let c=await execa(s,["--version","--json"],{reject:false,stdio:"pipe",timeout:4e3});if(c.exitCode===0&&await D(c.stdout))return {cmd:s,baseArgs:[]}}catch{}}catch{}let r=await tt();if(r)return r;let n=Q(),i=await N(e.cmd),o=U(n);return await p.pathExists(o)?{cmd:o,baseArgs:[]}:{cmd:i,baseArgs:["-m","rapidkit"]}}async function ot(){for(let t of O())try{return await execa(t,v(t,["--version"]),{reject:false,stdio:"pipe",timeout:2e3}),t}catch{}return null}async function B(){let t=null;for(let e of O()){try{await execa(e,v(e,["--version"]),{reject:false,stdio:"pipe",timeout:2e3});}catch(r){t=r;continue}try{return await N(e)}catch(r){t=r;continue}}throw t instanceof w?t:t instanceof Error?new w("BRIDGE_VENV_BOOTSTRAP_FAILED",t.message):new w("PYTHON_NOT_FOUND","No Python interpreter found (python3/python/py).")}async function vt(){let t=!!process.env.RAPIDKIT_DEBUG,e$1=n=>{t&&process.stderr.write(`[DEBUG] checkRapidkitCore: ${n}
|
|
16
|
+
`);},r=Array.from(new Set([...d(),...e(14,10).map(n=>n.command)]));for(let n of r)try{e$1(`Method 1: trying ${n} import`);let i=await execa(n,v(n,["-c","import rapidkit_core; print(1)"]),{reject:false,stdio:"pipe",timeout:g});if(i.exitCode===0&&i.stdout?.trim()==="1")return e$1(`\u2713 Found via ${n} import`),true}catch{continue}for(let n of r)try{e$1(`Method 2: trying ${n} -m pip show`);let i=await execa(n,v(n,["-m","pip","show","rapidkit-core"]),{reject:false,stdio:"pipe",timeout:g});if(i.exitCode===0&&i.stdout?.includes("Name: rapidkit-core"))return e$1(`\u2713 Found via ${n} -m pip show`),true}catch{continue}for(let n of ["pip","pip3"])try{e$1(`Method 3: trying ${n} show`);let i=await execa(n,["show","rapidkit-core"],{reject:false,stdio:"pipe",timeout:g});if(i.exitCode===0&&i.stdout?.includes("Name: rapidkit-core"))return e$1(`\u2713 Found via ${n} show`),true}catch{continue}try{e$1("Method 4: checking pyenv versions");let n=await execa("pyenv",["versions","--bare"],{reject:false,stdio:"pipe",timeout:g});if(n.exitCode===0&&n.stdout){let i=n.stdout.split(`
|
|
17
|
+
`).filter(o=>o.trim());e$1(`Found pyenv versions: ${i.join(", ")}`);for(let o of i){let a=process.env.PYENV_ROOT||u.join(q.homedir(),".pyenv"),s=u.join(a,"versions",o.trim(),"bin","pip");try{let c=await execa(s,["show","rapidkit-core"],{reject:false,stdio:"pipe",timeout:g});if(c.exitCode===0&&c.stdout?.includes("Name: rapidkit-core"))return e$1(`\u2713 Found in pyenv ${o}`),true}catch{try{let c=await execa("pyenv",["exec","pip","show","rapidkit-core"],{reject:false,stdio:"pipe",timeout:g,env:{...process.env,PYENV_VERSION:o.trim()}});if(c.exitCode===0&&c.stdout?.includes("Name: rapidkit-core"))return e$1(`\u2713 Found in pyenv ${o} via PYENV_VERSION`),true}catch{continue}}}}}catch{e$1("pyenv not available");}for(let n of r)try{e$1(`Method 5: checking ${n} user site`);let i=await execa(n,v(n,["-m","site","--user-site"]),{reject:false,stdio:"pipe",timeout:g});if(i.exitCode===0&&i.stdout){let o=i.stdout.trim(),a=u.join(o,"rapidkit_core");if(await p.pathExists(a))return e$1("\u2713 Found in user site-packages"),true}}catch{continue}try{e$1("Method 6: checking pipx");let n=await execa("pipx",["list"],{reject:false,stdio:"pipe",timeout:g});if(n.exitCode===0&&n.stdout?.includes("rapidkit-core"))return e$1("\u2713 Found via pipx"),true}catch{e$1("pipx not available");}for(let n of r)try{e$1(`Method 6: checking ${n} -m pipx list`);let i=await execa(n,v(n,["-m","pipx","list"]),{reject:false,stdio:"pipe",timeout:g});if(i.exitCode===0&&i.stdout?.includes("rapidkit-core"))return e$1(`\u2713 Found via ${n} -m pipx list`),true}catch{continue}try{if(e$1("Method 7: checking poetry"),(await execa("poetry",["show","rapidkit-core"],{reject:false,stdio:"pipe",timeout:g})).exitCode===0)return e$1("\u2713 Found via poetry"),true}catch{e$1("poetry check failed");}for(let n of r)try{if(e$1(`Method 7: checking ${n} -m poetry show rapidkit-core`),(await execa(n,v(n,["-m","poetry","show","rapidkit-core"]),{reject:false,stdio:"pipe",timeout:g})).exitCode===0)return e$1(`\u2713 Found via ${n} -m poetry`),true}catch{continue}try{e$1("Method 8: checking conda");let n=await execa("conda",["list","rapidkit-core"],{reject:false,stdio:"pipe",timeout:g});if(n.exitCode===0&&n.stdout?.includes("rapidkit-core"))return e$1("\u2713 Found via conda"),true}catch{e$1("conda not available");}return e$1("\u2717 Not found in any environment"),false}function Pt(t){let e=t.trim();if(!e||!e.startsWith("rapidkit-core"))return null;let r=e.slice(13).trim();return !r||/[\/@]|\.whl$|\.tar\.gz$|\.zip$|git\+|https?:\/\//.test(r)?null:r}function Y(t){let e=t.trim();if(!e)return null;let r=e.split("."),n=[];for(let i of r){let o=i.match(/^(\d+)/);if(!o){n.push(0);continue}n.push(Number.parseInt(o[1],10));}return n}function W(t,e){let r=Math.max(t.length,e.length);for(let n=0;n<r;n+=1){let i=n<t.length?t[n]:0,o=n<e.length?e[n]:0;if(i>o)return 1;if(i<o)return -1}return 0}function Ct(t){return t.length<=1?[t[0]+1]:t.length===2?[t[0]+1,0]:[t[0],t[1]+1,0]}function Et(t){let e=t.split(",").map(n=>n.trim()).filter(Boolean);if(e.length===0)return null;let r=[];for(let n of e){let i=n.match(/^(==|>=|<=|>|<|~=)\s*([0-9][0-9A-Za-z+._-]*)$/);if(!i)return null;r.push({op:i[1],version:i[2]});}return r}function st(t,e){let r=Y(t);if(!r)return false;let n=Et(e);if(!n)return false;for(let i of n){let o=Y(i.version);if(!o)return false;let a=W(r,o);if(i.op==="=="&&a!==0||i.op===">="&&a<0||i.op==="<="&&a>0||i.op===">"&&a<=0||i.op==="<"&&a>=0)return false;if(i.op==="~="){if(a<0)return false;let s=Ct(o);if(W(r,s)>=0)return false}}return true}async function _t(){let t=Array.from(new Set([...d(),...e(14,10).map(r=>r.command)])),e$1=r=>{let n=r.match(/^Version:\s*(.+)$/m);return n?n[1].trim():null};for(let r of t)try{let n=await execa(r,v(r,["-m","pip","show","rapidkit-core"]),{reject:false,stdio:"pipe",timeout:g});if(n.exitCode===0){let i=e$1(n.stdout||"");if(i)return i}}catch{continue}for(let r of ["pip","pip3"])try{let n=await execa(r,["show","rapidkit-core"],{reject:false,stdio:"pipe",timeout:g});if(n.exitCode===0){let i=e$1(n.stdout||"");if(i)return i}}catch{continue}try{let r=await execa("pipx",["list"],{reject:false,stdio:"pipe",timeout:g});if(r.exitCode===0&&r.stdout){let n=r.stdout.match(/rapidkit-core\s+([0-9][0-9A-Za-z+._-]*)/i);if(n?.[1])return n[1]}}catch{}return null}async function kt(){let t=_(),e=Pt(t);if(!e)return {isCompatible:false,installedVersion:null,expectedConstraint:null,reason:et(t)?"constraint-unsupported":"constraint-missing"};let r=await _t();if(!r)return {isCompatible:false,installedVersion:null,expectedConstraint:e,reason:"version-not-detected"};let n=st(r,e);return {isCompatible:n,installedVersion:r,expectedConstraint:e,reason:n?"compatible":"incompatible-version"}}async function N(t){let e=Q(),r=gt(),n=_(),i=[e];!et(n)&&!await p.pathExists(e)&&await p.pathExists(r)&&i.push(r);for(let m of i){let h=H(m);if(await p.pathExists(h))try{let f=await execa(h,["-c","import importlib.util; print(1 if importlib.util.find_spec('rapidkit') else 0)"],{reject:false,stdio:"pipe",timeout:2e3});if(f.exitCode===0&&(f.stdout??"").toString().trim()==="1")return h;await p.remove(m);}catch{await p.remove(m);}}let o=e,a={...process.env,PIP_DISABLE_PIP_VERSION_CHECK:"1",PIP_NO_PYTHON_VERSION_WARNING:"1"},s=Math.max(0,Number(process.env.RAPIDKIT_BRIDGE_PIP_RETRY??"2")),c=Math.max(200,Number(process.env.RAPIDKIT_BRIDGE_PIP_RETRY_DELAY_MS??"800")),l=Math.max(1e4,Number(process.env.RAPIDKIT_BRIDGE_PIP_TIMEOUT_MS??"120000")),P=m=>new Promise(h=>setTimeout(h,m)),C=async(m,h,f)=>{let y=await execa(m,h,{reject:false,stdio:["ignore","pipe","inherit"],env:a,timeout:f});if(y.exitCode===0)return;let T=(y.stdout??"").toString(),$=(y.stderr??"").toString(),R=[T,$].filter(Boolean).join(`
|
|
18
|
+
`),pt=R?`${m} ${h.join(" ")}
|
|
19
|
+
${R}`:`${m} ${h.join(" ")}`;throw new Error(pt)},x=async(m,h,f)=>{let y=0;for(;;)try{await C(m,h,f);return}catch(T){if(y>=s)throw T;let $=Math.floor(Math.random()*200),R=c*Math.pow(2,y)+$;y+=1,await P(R);}};try{await p.ensureDir(u.dirname(o));try{await C(t,v(t,["-m","venv",o]),6e4);}catch(f){let y=f instanceof Error?f.message:String(f);throw new w("BRIDGE_VENV_CREATE_FAILED",y)}let m=H(o);if((await execa(m,["-m","pip","--version"],{reject:false,stdio:"pipe",timeout:2e3})).exitCode!==0&&(await execa(m,["-m","ensurepip","--default-pip"],{reject:false,stdio:["ignore","pipe","inherit"],env:a,timeout:6e4})).exitCode!==0)throw new w("BRIDGE_PIP_BOOTSTRAP_FAILED","ensurepip failed; install python3-venv/python3-pip and retry.");if(process.env.RAPIDKIT_BRIDGE_UPGRADE_PIP==="1")try{await x(m,["-m","pip","install","-U","pip"],l);}catch(f){let y=f instanceof Error?f.message:String(f);throw new w("BRIDGE_PIP_UPGRADE_FAILED",y)}try{await x(m,["-m","pip","install","-U",_()],l);}catch(f){let y=f instanceof Error?f.message:String(f);throw new w("BRIDGE_PIP_INSTALL_FAILED",y)}return m}catch(m){if(m instanceof w)throw m;let h=m instanceof Error?m.message:String(m);throw new w("BRIDGE_VENV_BOOTSTRAP_FAILED",h)}}async function xt(){if(process.env.RAPIDKIT_BRIDGE_FORCE_VENV==="1")return {kind:"venv",pythonPath:await B()};for(let r of O())if(await rt(r))return {kind:"system",cmd:r};let t=await ot();if(!t)throw new w("PYTHON_NOT_FOUND","No Python interpreter found (python3/python/py).");let e;try{e=await N(t);}catch{e=await B();}return {kind:"venv",pythonPath:e}}async function Bt(t,e){try{let r=await F(e?.cwd),n=r.cmd,i=[...r.baseArgs,...t];if(t[0]==="init"){let s=await execa(n,i,{cwd:e?.cwd,env:{...process.env,...e?.env},reject:false,stdio:"pipe"}),c=J((s.stdout??"").toString()),l=J((s.stderr??"").toString());return c&&process.stdout.write(c.endsWith(`
|
|
20
|
+
`)?c:`${c}
|
|
21
|
+
`),l&&process.stderr.write(l.endsWith(`
|
|
22
|
+
`)?l:`${l}
|
|
23
|
+
`),typeof s.exitCode=="number"?s.exitCode:1}let a=await execa(n,i,{cwd:e?.cwd,env:{...process.env,...e?.env},reject:false,stdio:"inherit"});return typeof a.exitCode=="number"?a.exitCode:1}catch(r){return process.stderr.write(`${S(r)}
|
|
24
|
+
`),1}}var Rt=[{pattern:/RapidKitError:\s*Directory '([^']+)' exists and force is not set/,message:t=>`\u274C Directory "${u.basename(t[1])}" already exists.
|
|
25
|
+
\u{1F4A1} Choose a different name, or remove the existing directory first:
|
|
26
|
+
rm -rf ${t[1]}`},{pattern:/RapidKitError:\s*Project name '([^']+)' is (invalid|not allowed)/i,message:t=>`\u274C Invalid project name: "${t[1]}"
|
|
27
|
+
\u{1F4A1} Use lowercase letters, numbers, and hyphens only (e.g. my-api).`},{pattern:/RapidKitError:\s*Kit '([^']+)' not found/i,message:t=>`\u274C Unknown kit: "${t[1]}"
|
|
28
|
+
\u{1F4A1} Run "npx rapidkit list" to see available kits.`},{pattern:/RapidKitError:\s*(.+)/,message:t=>`\u274C ${t[1].trim()}`}];async function Ft(t,e){let{spawn:r}=await import('child_process');try{let n=await F(e?.cwd),i=n.cmd,o=[...n.baseArgs,...t];return await new Promise(a=>{let s=r(i,o,{cwd:e?.cwd,env:{...process.env,...e?.env},stdio:["inherit","inherit","pipe"]}),c=[];s.stderr?.on("data",l=>{c.push(l);}),s.on("close",l=>{let P=l??1;if(P!==0&&c.length>0){let C=Buffer.concat(c).toString("utf8");for(let{pattern:x,message:m}of Rt){let h=C.match(x);if(h){process.stderr.write(m(h)+`
|
|
29
|
+
`),a(P);return}}process.stderr.write(C);}a(P);}),s.on("error",l=>{process.stderr.write(`${S(l)}
|
|
30
|
+
`),a(1);});})}catch(n){return process.stderr.write(`${S(n)}
|
|
31
|
+
`),1}}async function k(t,e){try{let r=await F(e?.cwd),n=r.cmd,i=[...r.baseArgs,...t],o=await execa(n,i,{cwd:e?.cwd,env:{...process.env,...e?.env},reject:false,stdio:"pipe"});return {exitCode:typeof o.exitCode=="number"?o.exitCode:1,stdout:(o.stdout??"").toString(),stderr:(o.stderr??"").toString()}}catch(r){return {exitCode:1,stdout:"",stderr:`${S(r)}
|
|
32
|
+
`}}}function at(t){let e=new Set,r=t.split(`
|
|
33
|
+
`),n=false;for(let i of r){let o=i.replace(/\r$/,"");if(!n){/^\s*Commands:\s*$/i.test(o)&&(n=true);let c=o.match(/^\s*rapidkit\s+([a-z0-9_-]+)\b/i);if(c){let l=c[1].trim();l&&!l.startsWith("-")&&e.add(l);}continue}if(!o.trim())break;if(/^\s*(Options|Arguments|Usage|Commands)\s*:/i.test(o))continue;let a=o.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 ct(){let t=nt();if(!await p.pathExists(t))return null;try{let e=await p.readJson(t);if(e&&e.schema_version===1&&Array.isArray(e.commands))return e}catch{}return null}async function z(t){let e=nt();await p.ensureDir(u.dirname(e)),await p.writeJson(e,t,{spaces:2});}async function bt(){let t=await k(["version","--json"],{cwd:process.cwd()});if(t.exitCode===0)try{let r=JSON.parse(t.stdout)?.version;return typeof r=="string"?r:void 0}catch{return}}async function At(){let t=await k(["commands","--json"],{cwd:process.cwd()});if(t.exitCode!==0)return null;try{let e=JSON.parse(t.stdout);if(e?.schema_version!==1||!Array.isArray(e.commands))return null;let r=e.commands.filter(n=>typeof n=="string");return r.length?r:null}catch{return null}}async function Gt(){let e=Date.now(),r=await ct(),n=await bt(),i=!!r?.commands?.length;if(i&&e-r.fetched_at<864e5&&(!n||!r.rapidkit_version||r.rapidkit_version===n))return new Set(r.commands);let o=await At();if(o?.length){let l=Array.from(new Set(o)).sort();return await z({schema_version:1,fetched_at:e,rapidkit_version:n,commands:l}),new Set(l)}let a=await k(["--help"],{cwd:process.cwd()});if(a.exitCode!==0)return i&&r?.commands?new Set(r.commands):new Set(M);let s=at(a.stdout);if(s.size===0)return new Set(M);let c=Array.from(s).sort();return await z({schema_version:1,fetched_at:e,rapidkit_version:n,commands:c}),s}async function Lt(){let e=Date.now(),r=await ct();return !r||e-r.fetched_at>=864e5||!r.commands?.length?null:new Set(r.commands)}function dt(){return u.join(j(),"rapidkit","npm-bridge","modules-catalog.json")}async function It(){let t=dt();if(!await p.pathExists(t))return null;try{let e=await p.readJson(t);if(e&&e.schema_version===1&&Array.isArray(e.modules))return e}catch{}return null}async function Z(t){let e=dt();await p.ensureDir(u.dirname(e)),await p.writeJson(e,t,{spaces:2});}function X(t){try{return JSON.parse(t)}catch{return null}}async function Kt(t={}){let e=typeof t.ttlMs=="number"?t.ttlMs:18e5,r=Date.now(),n=await It();if(n?.fetched_at&&r-n.fetched_at<e)return n;let i=["modules","list","--json-schema","1"];t.category&&i.push("--category",t.category),t.tag&&i.push("--tag",t.tag),t.detailed&&i.push("--detailed");let o=await k(i,{cwd:t.cwd,env:t.env});if(o.exitCode===0){let s=X(o.stdout);if(s&&s.schema_version===1&&Array.isArray(s.modules)){let c={...s,fetched_at:r};return await Z(c),c}}let a=await k(["modules","list","--json"],{cwd:t.cwd,env:t.env});if(a.exitCode===0){let s=X(a.stdout);if(Array.isArray(s)){let c={schema_version:1,generated_at:new Date().toISOString(),filters:{category:t.category??null,tag:t.tag??null,detailed:!!t.detailed},stats:{total:s.length,returned:s.length,invalid:0},modules:s,source:"legacy-json",fetched_at:r};return await Z(c),c}}return n||null}var Jt={pythonCommandCandidates:O,pickSystemPython:ot,ensureBridgeVenv:N,ensureBridgeVenvFromCandidates:B,parseCoreCommandsFromHelp:at,tryRapidkit:rt,findUserLocalRapidkitRunner:tt,findWorkspaceRunner:it,checkRapidkitCoreAvailable:vt,checkRapidkitCoreVersionCompatible:kt,isVersionSatisfyingConstraint:st};export{M as a,vt as b,kt as c,xt as d,Bt as e,Ft as f,k as g,Gt as h,Lt as i,Kt as j,Jt as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as createProject,d as registerWorkspaceAtPath,a as syncWorkspaceFoundationFiles,b as writeWorkspaceLauncher}from'./chunk-
|
|
1
|
+
export{c as createProject,d as registerWorkspaceAtPath,a as syncWorkspaceFoundationFiles,b as writeWorkspaceLauncher}from'./chunk-GAHPNUQJ.js';
|