rapidkit 0.25.3 → 0.25.4
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 +39 -11
- package/dist/chunk-EDH5S5JF.js +6 -0
- package/dist/{chunk-CD534JH4.js → chunk-KAV65WZO.js} +4 -4
- package/dist/{create-UUKDMKMT.js → create-PIVSRLDS.js} +1 -1
- package/dist/index.js +8 -8
- package/dist/package.json +3 -1
- package/dist/{workspace-M2Y2ZVTK.js → workspace-KRZ3DWL4.js} +1 -1
- package/package.json +3 -1
- package/dist/chunk-N64Z3XVF.js +0 -4
package/README.md
CHANGED
|
@@ -6,11 +6,13 @@ FastAPI, NestJS, Go/Fiber, and Go/Gin scaffolding with production-ready defaults
|
|
|
6
6
|
**27+ plug-and-play modules** are available for FastAPI & NestJS projects.
|
|
7
7
|
Clean architecture • Zero boilerplate • Instant deployment.
|
|
8
8
|
|
|
9
|
+
> **💡 Recommended:** Install the [Workspai VS Code extension](https://github.com/getrapidkit/rapidkit-vscode) for AI-powered project creation, a visual workspace explorer, and context-aware coding assistance — all backed by this CLI.
|
|
10
|
+
|
|
9
11
|
[](https://www.npmjs.com/package/rapidkit)
|
|
10
12
|
[](https://www.npmjs.com/package/rapidkit)
|
|
11
13
|
[](https://opensource.org/licenses/MIT)
|
|
12
14
|
[](https://github.com/getrapidkit/rapidkit-npm/stargazers)
|
|
13
|
-
[](https://www.getrapidkit.com)
|
|
14
16
|
|
|
15
17
|
Official CLI for creating and operating RapidKit workspaces and projects.
|
|
16
18
|
|
|
@@ -19,16 +21,18 @@ Official CLI for creating and operating RapidKit workspaces and projects.
|
|
|
19
21
|
- Profile + policy enforcement (`warn` / `strict`)
|
|
20
22
|
- Cache and mirror lifecycle commands for stable environments
|
|
21
23
|
|
|
22
|
-
##
|
|
24
|
+
## RapidKit CLI in the Workspai Ecosystem
|
|
25
|
+
|
|
26
|
+
The `rapidkit` npm package remains the official RapidKit CLI.
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
It works alongside Workspai, which is a product developed by RapidKit.
|
|
25
29
|
|
|
26
|
-
|
|
|
27
|
-
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| Core Engine | [getrapidkit/rapidkit-core](https://github.com/getrapidkit/rapidkit-core) |
|
|
31
|
-
| Examples | [getrapidkit/rapidkit-examples](https://github.com/getrapidkit/rapidkit-examples) |
|
|
30
|
+
| Component | Repository | Role |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| CLI | [getrapidkit/rapidkit-npm](https://github.com/getrapidkit/rapidkit-npm) | Official RapidKit npm CLI |
|
|
33
|
+
| VS Code Extension | [getrapidkit/rapidkit-vscode](https://github.com/getrapidkit/rapidkit-vscode) | **Workspai** — visual explorer + AI features (recommended) |
|
|
34
|
+
| Core Engine | [getrapidkit/rapidkit-core](https://github.com/getrapidkit/rapidkit-core) | Official RapidKit Core |
|
|
35
|
+
| Examples | [getrapidkit/rapidkit-examples](https://github.com/getrapidkit/rapidkit-examples) | Example workspaces and starter references |
|
|
32
36
|
|
|
33
37
|
## Requirements
|
|
34
38
|
|
|
@@ -179,9 +183,33 @@ Supported keys:
|
|
|
179
183
|
|
|
180
184
|
Warm-deps behavior is non-fatal by design and reports explicit outcome (`completed` / `failed` / `skipped`).
|
|
181
185
|
|
|
182
|
-
## VS Code Extension
|
|
186
|
+
## VS Code Extension (Recommended)
|
|
187
|
+
|
|
188
|
+
For the best RapidKit experience, use the **Workspai VS Code extension** — it wraps this CLI with a
|
|
189
|
+
visual workspace explorer, AI-powered project creation, and context-aware coding assistance.
|
|
190
|
+
|
|
191
|
+
### Why use the extension?
|
|
192
|
+
|
|
193
|
+
| Feature | CLI | Extension |
|
|
194
|
+
|---|---|---|
|
|
195
|
+
| Create workspace / project | ✅ | ✅ Visual wizard |
|
|
196
|
+
| AI Create — describe → scaffold | ❌ | ✅ |
|
|
197
|
+
| Project Assistant (context-aware Q&A) | ❌ | ✅ |
|
|
198
|
+
| Workspace tree explorer | ❌ | ✅ |
|
|
199
|
+
| Module catalog browser | ❌ | ✅ |
|
|
200
|
+
| One-click `rapidkit init / dev / test` | ❌ | ✅ |
|
|
201
|
+
| Inline AI on every workspace item | ❌ | ✅ |
|
|
202
|
+
|
|
203
|
+
### Install
|
|
204
|
+
|
|
205
|
+
Search **Workspai** in the VS Code Extensions marketplace, or:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
code --install-extension getrapidkit.workspai
|
|
209
|
+
```
|
|
183
210
|
|
|
184
|
-
|
|
211
|
+
> The extension calls this CLI under the hood — both tools work together seamlessly.
|
|
212
|
+
> You do **not** need to install the CLI separately when using the extension.
|
|
185
213
|
|
|
186
214
|
- Extension repository: https://github.com/getrapidkit/rapidkit-vscode
|
|
187
215
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import o from'chalk';import {execa}from'execa';import {createRequire}from'module';import {promises}from'fs';import p from'path';import b from'os';var d=class{debugEnabled=false;setDebug(r){this.debugEnabled=r;}debug(r,...e){this.debugEnabled&&console.log(o.gray(`[DEBUG] ${r}`),...e);}info(r,...e){console.log(o.blue(r),...e);}success(r,...e){console.log(o.green(r),...e);}warn(r,...e){console.log(o.yellow(r),...e);}error(r,...e){console.error(o.red(r),...e);}step(r,e,n){console.log(o.cyan(`
|
|
2
|
+
[${r}/${e}]`),o.white(n));}},l=new d;var E="rapidkit",U=createRequire(import.meta.url),_=U("../package.json"),i=_?.version??"0.0.0";function k(t){let e=t.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return null;let n=e[4]?e[4].split(".").map(a=>a.match(/^\d+$/)?Number(a):a):[];return {major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:n}}function w(t,r){let e=k(t),n=k(r);if(!e||!n)return 0;if(e.major!==n.major)return e.major>n.major?1:-1;if(e.minor!==n.minor)return e.minor>n.minor?1:-1;if(e.patch!==n.patch)return e.patch>n.patch?1:-1;if(e.prerelease.length===0&&n.prerelease.length===0)return 0;if(e.prerelease.length===0)return 1;if(n.prerelease.length===0)return -1;let a=Math.max(e.prerelease.length,n.prerelease.length);for(let u=0;u<a;u+=1){let s=e.prerelease[u],c=n.prerelease[u];if(s===void 0)return -1;if(c===void 0)return 1;if(s===c)continue;let h=typeof s=="number",f=typeof c=="number";return h&&f?s>c?1:-1:h?-1:f||String(s)>String(c)?1:-1}return 0}var R=14400*1e3;function y(){let t=process.env.RAPIDKIT_CACHE_DIR?.trim()||(process.env.VITEST_WORKER_ID?p.join(b.homedir(),".rapidkit","cache",`vitest-${process.env.VITEST_WORKER_ID}`):p.join(b.homedir(),".rapidkit","cache"));return p.join(t,"update-check.json")}async function j(){try{let t=await promises.readFile(y(),"utf-8"),r=JSON.parse(t);return typeof r.latestVersion=="string"&&typeof r.checkedAt=="number"&&r.currentVersion===i&&Date.now()-r.checkedAt<R?r:null}catch{return null}}async function N(t){try{let r=y();await promises.mkdir(p.dirname(r),{recursive:true}),await promises.writeFile(r,JSON.stringify({latestVersion:t,checkedAt:Date.now(),currentVersion:i}),"utf-8");}catch{}}async function M(){try{l.debug("Checking for updates...");let t=await j();if(t){let n=Math.round((Date.now()-t.checkedAt)/6e4);l.debug(`Update check: cache hit (${n}m old)`),w(t.latestVersion,i)>0&&(console.log(o.yellow(`
|
|
3
|
+
\u26A0\uFE0F Update available: ${i} \u2192 ${t.latestVersion}`)),console.log(o.cyan(`Run: npm install -g rapidkit@latest
|
|
4
|
+
`)));return}let{stdout:r}=await execa("npm",["view",E,"version"],{timeout:3e3}),e=r.trim();await N(e),e&&w(e,i)>0?(console.log(o.yellow(`
|
|
5
|
+
\u26A0\uFE0F Update available: ${i} \u2192 ${e}`)),console.log(o.cyan(`Run: npm install -g rapidkit@latest
|
|
6
|
+
`))):l.debug("You are using the latest version");}catch{l.debug("Could not check for updates");}}function J(){return i}export{l as a,M as b,J as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1,d,b}from'./chunk-RV6HBTFC.js';import {a,c}from'./chunk-
|
|
1
|
+
import {a as a$1,d,b}from'./chunk-RV6HBTFC.js';import {a,c}from'./chunk-EDH5S5JF.js';import {a as a$2,e,d as d$1,f,c as c$1,k}from'./chunk-Z5LKRG57.js';import {promises}from'fs';import*as v from'fs-extra';import m from'path';import B from'inquirer';import n from'chalk';import J from'ora';import {execa}from'execa';import Mt from'os';import {pathToFileURL}from'url';var At=".rapidkitrc.json",Kt=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function Qt(){let t=m.join(Mt.homedir(),At);try{let o=await promises.readFile(t,"utf-8"),e=JSON.parse(o);return a.debug(`Loaded config from ${t}`),e}catch{return a.debug("No user config found, using defaults"),{}}}async function Xt(t=process.cwd()){let o=t,e=m.parse(o).root;for(;o!==e;){for(let r of Kt){let a$1=m.join(o,r);try{await promises.access(a$1),a.debug(`Found config file: ${a$1}`);let p=await import(pathToFileURL(a$1).href),g=p.default||p;return a.debug(`Loaded RapidKit config from ${r}`),g}catch{continue}}o=m.dirname(o);}return a.debug("No RapidKit config file found, using defaults"),{}}function Zt(t,o,e){return {author:e.author||o.workspace?.defaultAuthor||t.author,pythonVersion:e.pythonVersion||o.workspace?.pythonVersion||t.pythonVersion,defaultInstallMethod:e.defaultInstallMethod||o.workspace?.installMethod||t.defaultInstallMethod,defaultKit:e.defaultKit||o.projects?.defaultKit||t.defaultKit,skipGit:e.skipGit??o.projects?.skipGit??t.skipGit,license:e.license||t.license,testRapidKitPath:e.testRapidKitPath||t.testRapidKitPath}}function L(t){return process.env.RAPIDKIT_DEV_PATH||t.testRapidKitPath||void 0}var C=class extends Error{constructor(e,r,a){super(e);this.code=r;this.details=a;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}},F=class extends C{constructor(o,e){let r=e?`Python ${o}+ required, found ${e}`:`Python ${o}+ not found`;super(r,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},G=class extends C{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},U=class extends C{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},q=class extends C{constructor(o){super(`Directory "${o}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},ht=class extends C{constructor(o,e){super(`Invalid project name: "${o}"`,"INVALID_PROJECT_NAME",e);}},I=class extends C{constructor(o,e){let r=`Installation failed at: ${o}`,a=`${e.message}
|
|
2
2
|
|
|
3
3
|
Troubleshooting:
|
|
4
4
|
- Check your internet connection
|
|
@@ -109,7 +109,7 @@ npx rapidkit dev
|
|
|
109
109
|
cd <project-name>
|
|
110
110
|
npx rapidkit init
|
|
111
111
|
npx rapidkit dev
|
|
112
|
-
`)+"```\n","utf-8"),!e){w.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:i}),w.succeed("Git repository initialized");}catch{w.warn("Could not initialize git repository");}}try{let{registerWorkspace:k}=await import('./workspace-
|
|
112
|
+
`)+"```\n","utf-8"),!e){w.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:i}),w.succeed("Git repository initialized");}catch{w.warn("Could not initialize git repository");}}try{let{registerWorkspace:k}=await import('./workspace-KRZ3DWL4.js');await k(i,d);}catch{}if(console.log(n.green(`
|
|
113
113
|
\u2728 Workspace created!
|
|
114
114
|
`)),console.log(n.cyan("\u{1F4C2} Location:"),n.white(i)),console.log(n.cyan(`
|
|
115
115
|
\u{1F680} Get started:
|
|
@@ -123,7 +123,7 @@ npx rapidkit dev
|
|
|
123
123
|
`)),console.log(n.cyan(`\u{1F4A1} How to install Python:
|
|
124
124
|
`)),console.log(n.white(" Ubuntu / Debian: sudo apt install python3.10")),console.log(n.white(" macOS (Homebrew): brew install python@3.10")),console.log(n.white(` Windows: https://python.org/downloads
|
|
125
125
|
`)),console.log(n.gray(` After installing Python, run: npx rapidkit ${d}
|
|
126
|
-
`)),process.exit(1));}a.step(1,3,"Setting up RapidKit environment");let b=J("Creating directory").start();try{await v.ensureDir(i),b.succeed("Directory created"),b.start("Detecting Python version");let w=null,_=await _t(x.pythonVersion);if(_)w=await ft(_),w?(a.info(` Detected Python ${w}`),b.succeed(`Python ${w} detected`)):b.warn("Could not detect exact Python version");else {let k=$();w=await ft(k),w?b.succeed(`Python ${w} detected`):b.warn("Could not detect Python version, proceeding with defaults");}if(x.installMethod==="poetry"&&!await It()&&(b.warn("Poetry not found \u2014 auto-fallback to pip + venv"),x.installMethod="venv"),await at(i,d,x.installMethod,w||void 0),w&&await Dt(i,w),await lt(i,d,x.installMethod,w||x.pythonVersion,u||h),await Q(i),await st(i,d),x.installMethod==="poetry")try{await jt(i,x.pythonVersion,b,r,g,p);}catch(k){let j=k?.details||k?.message||String(k);if(j.includes("pyenv")||j.includes("exit status 127")||j.includes("returned non-zero exit status 127")){b.warn("Poetry encountered Python discovery issues, trying venv method"),a.debug(`Poetry error (attempting venv fallback): ${j}`);try{await dt(i,x.pythonVersion,b,r,g),x.installMethod="venv";}catch(pt){throw pt}}else throw k}else x.installMethod==="venv"?await dt(i,x.pythonVersion,b,r,g):await Et(i,b,r,g,p);if(await Rt(i,x.installMethod),await Ct(i,x.installMethod),b.succeed("RapidKit environment ready!"),!o.skipGit){b.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:i}),b.succeed("Git repository initialized");}catch{b.warn("Could not initialize git repository");}}try{let{registerWorkspace:k}=await import('./workspace-
|
|
126
|
+
`)),process.exit(1));}a.step(1,3,"Setting up RapidKit environment");let b=J("Creating directory").start();try{await v.ensureDir(i),b.succeed("Directory created"),b.start("Detecting Python version");let w=null,_=await _t(x.pythonVersion);if(_)w=await ft(_),w?(a.info(` Detected Python ${w}`),b.succeed(`Python ${w} detected`)):b.warn("Could not detect exact Python version");else {let k=$();w=await ft(k),w?b.succeed(`Python ${w} detected`):b.warn("Could not detect Python version, proceeding with defaults");}if(x.installMethod==="poetry"&&!await It()&&(b.warn("Poetry not found \u2014 auto-fallback to pip + venv"),x.installMethod="venv"),await at(i,d,x.installMethod,w||void 0),w&&await Dt(i,w),await lt(i,d,x.installMethod,w||x.pythonVersion,u||h),await Q(i),await st(i,d),x.installMethod==="poetry")try{await jt(i,x.pythonVersion,b,r,g,p);}catch(k){let j=k?.details||k?.message||String(k);if(j.includes("pyenv")||j.includes("exit status 127")||j.includes("returned non-zero exit status 127")){b.warn("Poetry encountered Python discovery issues, trying venv method"),a.debug(`Poetry error (attempting venv fallback): ${j}`);try{await dt(i,x.pythonVersion,b,r,g),x.installMethod="venv";}catch(pt){throw pt}}else throw k}else x.installMethod==="venv"?await dt(i,x.pythonVersion,b,r,g):await Et(i,b,r,g,p);if(await Rt(i,x.installMethod),await Ct(i,x.installMethod),b.succeed("RapidKit environment ready!"),!o.skipGit){b.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m","Initial commit: RapidKit environment"],{cwd:i}),b.succeed("Git repository initialized");}catch{b.warn("Could not initialize git repository");}}try{let{registerWorkspace:k}=await import('./workspace-KRZ3DWL4.js');await k(i,d);}catch{console.warn(n.gray("Note: Could not register workspace in shared registry"));}if(console.log(n.green(`
|
|
127
127
|
\u2728 RapidKit environment created successfully!
|
|
128
128
|
`)),console.log(n.cyan("\u{1F4C2} Location:"),n.white(i)),console.log(n.cyan(`\u{1F680} Get started:
|
|
129
129
|
`)),console.log(n.white(` cd ${d}`)),x.installMethod==="poetry"){let k="source $(poetry env info --path)/bin/activate";try{T();let{stdout:j}=await execa("poetry",["--version"]),A=j.match(/Poetry.*?(\d+)\.(\d+)/);A&&(parseInt(A[1])>=2?k="source $(poetry env info --path)/bin/activate":k="poetry shell");}catch{}console.log(n.white(` ${k} # Or: poetry run rapidkit`)),console.log(n.white(" rapidkit create # Interactive mode")),console.log(n.white(" cd <project-name>")),console.log(n.white(" rapidkit init")),console.log(n.white(" rapidkit dev"));}else x.installMethod==="venv"?(console.log(n.white(" source .venv/bin/activate # On Windows: .venv\\Scripts\\activate")),console.log(n.white(" rapidkit create # Interactive mode")),console.log(n.white(" cd <project-name>")),console.log(n.white(" rapidkit init")),console.log(n.white(" rapidkit dev"))):(console.log(n.white(" rapidkit create # Interactive mode")),console.log(n.white(" cd <project-name>")),console.log(n.white(" rapidkit init")),console.log(n.white(" rapidkit dev")));console.log(n.white(`
|
|
@@ -164,7 +164,7 @@ Possible solutions:
|
|
|
164
164
|
1. Check your internet connection
|
|
165
165
|
2. Try installing manually: cd ${m.basename(t)} && ${f(".venv")} -m pip install rapidkit-core
|
|
166
166
|
3. Use Poetry instead: npx rapidkit ${m.basename(t)} --install-method=poetry`))}}e.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:y}=await import('./pythonRapidkitExec-K2SFGAYJ.js');if(!await y()&&!r){e.start("Checking optional global pipx installation");let d=await X(e,true);try{e.start("Installing RapidKit globally with pipx for CLI access"),await O(d,["install","rapidkit-core"]),e.succeed("RapidKit installed globally");}catch(i){e.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),a.debug(`pipx install failed: ${i}`);}}}catch(y){e.succeed("Skipped optional global pipx installation"),a.debug(`Global install check skipped: ${y}`);}}async function Et(t,o,e,r,a$1=false){let c=await X(o,a$1);if(o.start("Installing RapidKit globally with pipx"),e){let p=L(r||{});if(!p)throw new I("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));a.debug(`Installing from local path: ${p}`),o.text="Installing RapidKit from local path (test mode)",await O(c,["install","-e",p]);}else {o.text="Installing RapidKit from PyPI";try{await O(c,["install","rapidkit-core"]);}catch{throw new K}}o.succeed("RapidKit installed globally"),await v.outputFile(m.join(t,".rapidkit-global"),`RapidKit installed globally with pipx
|
|
167
|
-
`,"utf-8");}async function xe(t,o){let{skipGit:e=false,testMode:r=false,userConfig:a$1={},yes:c=false,installMethod:p,pythonVersion:g="3.10"}=o||{},y=p||a$1.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return a.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=y==="poetry"&&!await It()?"venv":y;await at(t,m.basename(t),h),await Q(t),await lt(t,m.basename(t),h,g,o?.profile);let d=J("Registering workspace").start();try{h==="poetry"?(await st(t,m.basename(t)),await jt(t,g,d,r,a$1,c)):h==="venv"?await dt(t,g,d,r,a$1):await Et(t,d,r,a$1,c),await Rt(t,h),await Ct(t,h),d.succeed("Workspace registered");try{let{registerWorkspace:i}=await import('./workspace-
|
|
167
|
+
`,"utf-8");}async function xe(t,o){let{skipGit:e=false,testMode:r=false,userConfig:a$1={},yes:c=false,installMethod:p,pythonVersion:g="3.10"}=o||{},y=p||a$1.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return a.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=y==="poetry"&&!await It()?"venv":y;await at(t,m.basename(t),h),await Q(t),await lt(t,m.basename(t),h,g,o?.profile);let d=J("Registering workspace").start();try{h==="poetry"?(await st(t,m.basename(t)),await jt(t,g,d,r,a$1,c)):h==="venv"?await dt(t,g,d,r,a$1):await Et(t,d,r,a$1,c),await Rt(t,h),await Ct(t,h),d.succeed("Workspace registered");try{let{registerWorkspace:i}=await import('./workspace-KRZ3DWL4.js');await i(t,m.basename(t));}catch{}if(!e){d.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}),d.succeed("Git repository initialized");}catch{d.warn("Could not initialize git repository");}}}catch(i){throw d.fail("Failed to register workspace"),i}}async function Ct(t,o){let e=o==="poetry"?`source $(poetry env info --path)/bin/activate
|
|
168
168
|
# 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):
|
|
169
169
|
./rapidkit --help
|
|
170
170
|
# or:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{h as createProject,i as registerWorkspaceAtPath,f as syncWorkspaceFoundationFiles,g as writeWorkspaceLauncher}from'./chunk-
|
|
1
|
+
export{h as createProject,i as registerWorkspaceAtPath,f as syncWorkspaceFoundationFiles,g as writeWorkspaceLauncher}from'./chunk-KAV65WZO.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {e,d as d$1,c as c$2,h as h$3,a as a$3}from'./chunk-UOGFCKQ5.js';import {a as a$2,b as b$1,c as c$1,d,i,h as h$1,e as e$1,f}from'./chunk-
|
|
2
|
+
import {e,d as d$1,c as c$2,h as h$3,a as a$3}from'./chunk-UOGFCKQ5.js';import {a as a$2,b as b$1,c as c$1,d,i,h as h$1,e as e$1,f}from'./chunk-KAV65WZO.js';import {c,a as a$1,b as b$2}from'./chunk-EDH5S5JF.js';import {a,h as h$2,i as i$1,b as b$3,c as c$3,d as d$2,f as f$1,k,g}from'./chunk-Z5LKRG57.js';import {Command,Option}from'commander';import l from'chalk';import xe from'inquirer';import h from'path';import {fileURLToPath}from'url';import {exec,spawn}from'child_process';import Gr from'validate-npm-package-name';import*as b from'fs-extra';import b__default from'fs-extra';import _,{promises,createWriteStream}from'fs';import {execa}from'execa';import Wr from'nunjucks';import Ut from'ora';import Vr,{createHash,createVerify,createHmac}from'crypto';import Tn from'os';import {promisify}from'util';import cr from'http';import lr from'https';function Wt(e){let o=Gr(e);if(!o.validForNewPackages){let r=o.errors||[],i=o.warnings||[],n=[...r,...i];throw new e$1(e,`NPM validation failed: ${n.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(e))throw new e$1(e,"Must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores");if(["test","tests","src","dist","build","lib","python","pip","poetry","node","npm","rapidkit","rapidkit"].includes(e.toLowerCase()))throw new e$1(e,`"${e}" is a reserved name. Please choose a different name.`);if(e.length<2)throw new e$1(e,"Name must be at least 2 characters long");if(e.length>214)throw new e$1(e,"Name must be less than 214 characters");return true}function Lr(){return d$2()}function qr(e,o){return e==="py"?["-3",...o]:o}function Fr(e){return typeof e=="object"&&e!==null}async function Hr(e,o,t,r=8e3){try{let i=await execa(e,o,{cwd:t,timeout:r,reject:false,stdio:"pipe"});return {ok:i.exitCode===0,exitCode:i.exitCode,stdout:i.stdout,stderr:i.stderr}}catch(i){return {ok:false,exitCode:void 0,stdout:"",stderr:i instanceof Error?i.message:String(i)}}}async function Kr(e,o){let t=["-m","rapidkit",...e],r=Lr();for(let i of r){let n=await Hr(i,qr(i,t),o?.cwd,o?.timeoutMs);if(!n.ok)continue;let a=(n.stdout??"").trim();try{let s=JSON.parse(a);return Fr(s)?{ok:true,command:i,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,data:s}:{ok:false,command:i,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr}}catch{return {ok:false,command:i,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr}}}return {ok:false}}async function vo(e,o){let t=await Kr(["project","detect","--path",e,"--json"],o);return !t.ok||!t.data||t.data.schema_version!==1?{ok:false,command:t.command,exitCode:t.exitCode,stdout:t.stdout,stderr:t.stderr}:t}var Br=fileURLToPath(import.meta.url),Jr=h.dirname(Br);function Yr(e=32){let o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Vr.randomBytes(e),r="";for(let i=0;i<e;i++)r+=o[t[i]%o.length];return r}async function ko(e,o){let t=o.template||"fastapi",r=t==="fastapi",i=r?"FastAPI":"NestJS",n=Ut(`Generating ${i} project...`).start();try{let a=h.resolve(Jr,".."),s=o.kit_name||`${t}.standard`,c$1;s==="fastapi.ddd"?c$1="fastapi-ddd":s.startsWith("fastapi")?c$1="fastapi-standard":c$1="nestjs-standard";let p=h.join(a,"templates","kits",c$1),d=Wr.configure(p,{autoescape:false,trimBlocks:true,lstripBlocks:true});d.addFilter("generate_secret",function(g,R=32){return Yr(R)});let u={project_name:o.project_name,author:o.author||"RapidKit User",description:o.description||(r?"FastAPI service generated with RapidKit":"NestJS application generated with RapidKit"),app_version:o.app_version||"0.1.0",license:o.license||"MIT",package_manager:o.package_manager||"npm",node_version:o.node_version||"20.0.0",database_type:o.database_type||"postgresql",include_caching:o.include_caching||false,created_at:new Date().toISOString(),rapidkit_version:c()},m;r?m=["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"]:m=["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 g of m){let R=h.join(p,g);try{await promises.access(R);}catch{continue}let x=await promises.readFile(R,"utf-8"),T;try{T=d.renderString(x,u);}catch(G){throw console.error(`Failed to render template: ${g}`),G}let C=g.replace(/\.j2$/,""),P=h.join(e,C);await promises.mkdir(h.dirname(P),{recursive:true}),await promises.writeFile(P,T),(C.endsWith(".rapidkit/rapidkit")||C.endsWith(".rapidkit/cli.py")||C.endsWith(".rapidkit/activate")||C==="rapidkit")&&await promises.chmod(P,493);}if(r){let g=h.join(p,".rapidkit","context.json"),R=h.join(e,".rapidkit","context.json");try{await promises.mkdir(h.join(e,".rapidkit"),{recursive:true}),await promises.copyFile(g,R);}catch{await promises.mkdir(h.join(e,".rapidkit"),{recursive:true});let T=o.engine||"pip";await promises.writeFile(R,JSON.stringify({engine:T,created_by:"rapidkit-npm-fallback"},null,2));}}let w=r?`# Python
|
|
3
3
|
__pycache__/
|
|
4
4
|
*.py[cod]
|
|
5
5
|
*$py.class
|
|
@@ -3504,10 +3504,10 @@ No modules selected
|
|
|
3504
3504
|
`,"utf-8"),r.lockWritten=true,t.push({id:"mirror.lock.write",status:"passed",message:`Mirror lock updated at ${h.relative(e,a)}.`}),r.transparencyEvidenceRecords=Re.length,Re.length>0){let z={schemaVersion:"1.0",generatedAt:new Date().toISOString(),environment:P,records:Re},L=new Date().toISOString().replace(/[:.]/g,"-"),S=h.join(c,`transparency-evidence-${L}.json`),se=h.join(c,"transparency-evidence.latest.json");if(await b.ensureDir(c),await ir(S,z),await ir(se,z),r.transparencyEvidenceWritten=true,t.push({id:"sigstore.evidence.write",status:"passed",message:`Transparency evidence written to ${h.relative(e,se)}.`}),C?.enabled){let ae=Math.max(1e3,C.timeoutMs??1e4);if(C.target==="file")if(!C.filePath)t.push({id:"sigstore.evidence.export.file",status:"failed",message:"Evidence export target=file requires security.evidenceExport.filePath."});else try{let H=be(e,C.filePath);await b.ensureDir(h.dirname(H)),await promises.appendFile(H,`${JSON.stringify(z)}
|
|
3505
3505
|
`,"utf-8"),r.evidenceExported=true,r.evidenceExportTarget=H,t.push({id:"sigstore.evidence.export.file",status:"passed",message:`Transparency evidence exported to file sink ${H}.`});}catch(H){t.push({id:"sigstore.evidence.export.file",status:"failed",message:`Evidence file export failed: ${H.message}`});}else if(C.target==="http")if(!C.endpoint)t.push({id:"sigstore.evidence.export.http",status:"failed",message:"Evidence export target=http requires security.evidenceExport.endpoint."});else {let H=Math.max(0,C.retries??0),re=Math.max(0,C.backoffMs??500),le=as(z,C.signing);le.error&&t.push({id:"sigstore.evidence.export.http",status:"failed",message:le.error});try{let I=C.authTokenEnv?process.env[C.authTokenEnv]:void 0,O=false,M=null;for(let j=1;j<=H+1;j+=1)try{if(le.error)throw new Error(le.error);await ns(C.endpoint,z,ae,I,le.headers),r.evidenceExported=true,r.evidenceExportTarget=C.endpoint,t.push({id:"sigstore.evidence.export.http",status:"passed",message:j>1?`Transparency evidence exported to HTTP endpoint ${C.endpoint} after ${j} attempts.`:`Transparency evidence exported to HTTP endpoint ${C.endpoint}.`}),O=true;break}catch(ge){M=ge,j<=H&&await nr(re*j);}if(!O)throw M||new Error("unknown evidence export error")}catch(I){let O=`Evidence HTTP export failed: ${I.message}`;t.push({id:"sigstore.evidence.export.http",status:"failed",message:O});try{let M=await ss(e,C.deadLetterPath,z,O);t.push({id:"sigstore.evidence.export.deadletter",status:"passed",message:`Evidence export failure persisted to dead-letter sink ${M}.`});}catch(M){t.push({id:"sigstore.evidence.export.deadletter",status:"failed",message:`Evidence dead-letter write failed: ${M.message}`});}}}if(C.failOnError&&t.some(re=>re.status==="failed"&&(re.id==="sigstore.evidence.export.file"||re.id==="sigstore.evidence.export.http")))return {checks:t,details:r}}else t.push({id:"sigstore.evidence.export",status:"skipped",message:"Central evidence export not configured (security.evidenceExport.enabled=false)."});}else t.push({id:"sigstore.evidence.write",status:"skipped",message:"No Sigstore records available for transparency evidence output."}),t.push({id:"sigstore.evidence.export",status:"skipped",message:"Central evidence export skipped because no transparency evidence records exist."});return {checks:t,details:r}}function oo(e){if(!e||typeof e!="object")return null;let o=e.code;return o==="PYTHON_NOT_FOUND"||o==="BRIDGE_VENV_BOOTSTRAP_FAILED"?o:null}function us(e){let o=e.trim().toLowerCase();return o?o.startsWith("fastapi")?"fastapi":o.startsWith("nestjs")?"nestjs":null:null}function qt(e){let o=e.trim().toLowerCase();return o.startsWith("gofiber")||o==="go"||o==="go.standard"||o==="fiber"}function lt(e){let o=e.trim().toLowerCase();return o.startsWith("gogin")||o==="gin"}function pt(e,o){let t=e.indexOf(o);if(t>=0&&t+1<e.length)return e[t+1];let r=e.find(i=>i.startsWith(`${o}=`));if(r)return r.slice(o.length+1)}function co(){return d$2()}function pr(){let e={...process.env},o=e.PATH||"";return o&&(e.PATH=o.split(h.delimiter).filter(t=>!t.replace(/\\/g,"/").includes("/.pyenv/shims")).join(h.delimiter)),e.PYENV_VERSION="system",e.POETRY_PYTHON||(e.POETRY_PYTHON=c$3()),e.RAPIDKIT_SKIP_LOCK_SYNC||(e.RAPIDKIT_SKIP_LOCK_SYNC="1"),e.POETRY_KEYRING_ENABLED||(e.POETRY_KEYRING_ENABLED="false"),e.PYTHON_KEYRING_BACKEND||(e.PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring"),e.POETRY_NO_INTERACTION||(e.POETRY_NO_INTERACTION="1"),e}function gs(e){return f$1(h.join(e,".venv"))}async function _r(e,o){return await W(e,["--version"],o)===0}async function ro(e){let o=h.join(e,"go.mod");if(await b.pathExists(o))return "go";let t=h.join(e,"package.json");if(await b.pathExists(t))return "node";let r=h.join(e,"pyproject.toml"),i=h.join(e,"requirements.txt"),n=h.join(e,"poetry.lock");return await b.pathExists(r)||await b.pathExists(i)||await b.pathExists(n)?"python":null}async function ms(e){for(let o of co())if(await W(o,o==="py"?["-3","-m","venv",".venv"]:["-m","venv",".venv"],e)===0)return 0;return 1}async function Cr(e){for(let o of co())if(await W(o,o==="py"?["-3","-m","venv",".venv"]:["-m","venv",".venv"],e)===0)return 0;return 1}async function fs(e){let o=f$1(h.join(e,".venv"));if(!await b.pathExists(o)){let n=await Cr(e);if(n!==0)return n}if(!await _r("poetry",e))return 0;let r=await W("poetry",["config","virtualenvs.in-project","true","--local"],e);if(r!==0)return r;let i=await W("poetry",["env","use",o],e);return i!==0?i:0}async function hs(e){let o=f$1(h.join(e,".venv"));if(!await b.pathExists(o)){let i=await Cr(e);if(i!==0)return i}await W(o,["-m","pip","install","--upgrade","pip","setuptools","wheel"],e);let t=h.join(e,"requirements.txt");if(await b.pathExists(t)&&await W(o,["-m","pip","install","-r","requirements.txt"],e)===0)return 0;let r=h.join(e,"pyproject.toml");return await b.pathExists(r)&&(await W(o,["-m","pip","install","-e","."],e)===0||await W(o,["-m","pip","install","."],e)===0)?0:1}async function Dt(e,o){return await fs(e)!==0&&console.log(l.yellow("\u26A0\uFE0F Could not fully configure Poetry local venv. Trying fallback installer...")),(await o.initProject(e)).exitCode===0&&await b.pathExists(h.join(e,".venv"))?0:(console.log(l.yellow("\u26A0\uFE0F Python init fallback: installing dependencies directly into project .venv")),await hs(e))}async function Gt(e){let o=await dt("init",e);if(o===0)return 0;let t=["npm","pnpm","yarn"];for(let r of t){if(!await _r(r,e))continue;if(await W(r,["install"],e)===0)return console.log(l.green(`\u2705 Node init fallback succeeded with ${r} install`)),0}return o}async function ur(e){if(e[0]!=="create"||e[1]!=="project")return 1;let o=e[2],t=e[3];if(!o||!t)return process.stderr.write(`Usage: rapidkit create project gofiber.standard <name> [--output <dir>]
|
|
3506
3506
|
`),1;let r=pt(e,"--output")||process.cwd(),i=h.resolve(r,t),n=e.includes("--skip-git")||e.includes("--no-git");try{let{default:a}=await import('fs-extra');if(await a.ensureDir(h.dirname(i)),await a.pathExists(i))return process.stderr.write(`\u274C Directory "${i}" already exists
|
|
3507
|
-
`),1;await a.ensureDir(i),await Vt(i,{project_name:t,module_path:t,skipGit:n});let s=Y(process.cwd());if(s){let{syncWorkspaceProjects:c}=await import('./workspace-
|
|
3507
|
+
`),1;await a.ensureDir(i),await Vt(i,{project_name:t,module_path:t,skipGit:n});let s=Y(process.cwd());if(s){let{syncWorkspaceProjects:c}=await import('./workspace-KRZ3DWL4.js');await c(s,true);}return 0}catch(a){return process.stderr.write(`RapidKit Go/Fiber generator failed: ${a?.message??a}
|
|
3508
3508
|
`),1}}async function gr(e){if(e[0]!=="create"||e[1]!=="project")return 1;let o=e[2],t=e[3];if(!o||!t)return process.stderr.write(`Usage: rapidkit create project gogin.standard <name> [--output <dir>]
|
|
3509
3509
|
`),1;let r=pt(e,"--output")||process.cwd(),i=h.resolve(r,t),n=e.includes("--skip-git")||e.includes("--no-git");try{let{default:a}=await import('fs-extra');if(await a.ensureDir(h.dirname(i)),await a.pathExists(i))return process.stderr.write(`\u274C Directory "${i}" already exists
|
|
3510
|
-
`),1;await a.ensureDir(i),await Bt(i,{project_name:t,module_path:t,skipGit:n});let s=Y(process.cwd());if(s){let{syncWorkspaceProjects:c}=await import('./workspace-
|
|
3510
|
+
`),1;await a.ensureDir(i),await Bt(i,{project_name:t,module_path:t,skipGit:n});let s=Y(process.cwd());if(s){let{syncWorkspaceProjects:c}=await import('./workspace-KRZ3DWL4.js');await c(s,true);}return 0}catch(a){return process.stderr.write(`RapidKit Go/Gin generator failed: ${a?.message??a}
|
|
3511
3511
|
`),1}}async function io(e,o){if(e.includes("--json"))return process.stderr.write("RapidKit (npm) offline fallback does not support --json for `create` commands.\nInstall Python 3.10+ and retry the same command.\n"),1;if(e[0]!=="create")return 1;if(e[1]!=="project")return process.stderr.write(`RapidKit (npm) could not run the Python core engine for \`create\`.
|
|
3512
3512
|
Reason: ${o}.
|
|
3513
3513
|
Install Python 3.10+ to use the interactive wizard and full kit catalog.
|
|
@@ -3519,7 +3519,7 @@ Requested kit: ${i}
|
|
|
3519
3519
|
Offline fallback only supports: fastapi.standard, nestjs.standard (and their shorthands).
|
|
3520
3520
|
Install Python 3.10+ to access all kits.
|
|
3521
3521
|
`),1;let s=pt(e,"--output")||process.cwd(),c=h.resolve(s,n),p=e.includes("--skip-git")||e.includes("--no-git"),d=e.includes("--skip-install");try{if(await b.ensureDir(h.dirname(c)),await b.pathExists(c))return process.stderr.write(`\u274C Directory "${c}" already exists
|
|
3522
|
-
`),1;let u="pip",m=Y(process.cwd());if(m)try{let{readWorkspaceMarker:w}=await import('./workspace-marker-IOPQ42A7.js'),f=await w(m);f?.metadata?.npm?.installMethod&&(u=f.metadata.npm.installMethod,a$1.debug(`Detected workspace engine: ${u}`));}catch(w){a$1.debug("Failed to read workspace marker",w);}else a$1.debug("No workspace found, using default engine: pip");if(await b.ensureDir(c),await ko(c,{project_name:n,template:a,kit_name:i,skipGit:p,skipInstall:d,engine:u}),m){let{syncWorkspaceProjects:w}=await import('./workspace-
|
|
3522
|
+
`),1;let u="pip",m=Y(process.cwd());if(m)try{let{readWorkspaceMarker:w}=await import('./workspace-marker-IOPQ42A7.js'),f=await w(m);f?.metadata?.npm?.installMethod&&(u=f.metadata.npm.installMethod,a$1.debug(`Detected workspace engine: ${u}`));}catch(w){a$1.debug("Failed to read workspace marker",w);}else a$1.debug("No workspace found, using default engine: pip");if(await b.ensureDir(c),await ko(c,{project_name:n,template:a,kit_name:i,skipGit:p,skipInstall:d,engine:u}),m){let{syncWorkspaceProjects:w}=await import('./workspace-KRZ3DWL4.js');await w(m,true);}return 0}catch(u){return process.stderr.write(`RapidKit (npm) offline fallback failed: ${u?.message??u}
|
|
3523
3523
|
`),1}}async function Sr(e){let o=new Set(["--yes","-y","--skip-git","--skip-install","--debug","--dry-run","--no-update-check","--create-workspace","--no-workspace"]);if(e[0]==="create"&&(!e[1]||e[1].startsWith("-"))){let t=e.includes("--yes")||e.includes("-y"),r=e.slice(1),i;!process.stdin.isTTY||t?(i="workspace",process.stdin.isTTY&&console.log(l.gray("\u2139\uFE0F No subcommand provided for `create`; defaulting to `create workspace`."))):i=(await xe.prompt([{type:"rawlist",name:"createTarget",message:"What do you want to create?",choices:[{name:"workspace",value:"workspace"},{name:"project",value:"project"}]}])).createTarget;let n=["create",i,...r];return await Sr(n)}if(e[0]==="create"&&e[1]==="workspace")try{let t=e.includes("--yes")||e.includes("-y"),r=e.includes("--skip-git")||e.includes("--no-git"),i=e[2]&&!e[2].startsWith("-")?e[2]:void 0,n=pt(e,"--install-method"),a=n==="poetry"||n==="venv"||n==="pipx"?n:void 0,s=pt(e,"--profile"),c=s==="minimal"||s==="go-only"||s==="python-only"||s==="node-only"||s==="polyglot"||s==="enterprise"?s:void 0,p=i||(t?"my-workspace":(await xe.prompt([{type:"input",name:"workspaceName",message:"Workspace name:",default:"my-workspace"}])).workspaceName);if(!p||!p.trim())return process.stderr.write(`Workspace name is required.
|
|
3524
3524
|
`),1;try{Wt(p);}catch(w){if(w instanceof d)return process.stderr.write(`${w.message}
|
|
3525
3525
|
`),1;throw w}let d$1=h.resolve(process.cwd(),p);if(await b.pathExists(d$1))return process.stderr.write(`\u274C Directory "${p}" already exists
|
|
@@ -3528,8 +3528,8 @@ Install Python 3.10+ to access all kits.
|
|
|
3528
3528
|
`),1}if(!e[2]||e[2].startsWith("-")){console.log(l.bold(`
|
|
3529
3529
|
\u{1F680} RapidKit
|
|
3530
3530
|
`));let{kitChoice:f}=await xe.prompt([{type:"rawlist",name:"kitChoice",message:"Select a kit to scaffold:",choices:[{name:"fastapi \u2014 FastAPI Standard Kit",value:"fastapi.standard"},{name:"fastapi \u2014 FastAPI DDD Kit",value:"fastapi.ddd"},{name:"nestjs \u2014 NestJS Standard Kit",value:"nestjs.standard"},{name:"go/fiber \u2014 Go Fiber Standard Kit",value:"gofiber.standard"},{name:"go/gin \u2014 Go Gin Standard Kit",value:"gogin.standard"}]}]);if(qt(f)||lt(f)){let{projectName:R}=await xe.prompt([{type:"input",name:"projectName",message:"Project name:",validate:T=>T.trim().length>0||"Project name is required"}]),x=e.slice(2).filter(T=>T.startsWith("-"));return lt(f)?await gr(["create","project",f,R.trim(),...x]):await ur(["create","project",f,R.trim(),...x])}let{projectName:g}=await xe.prompt([{type:"input",name:"projectName",message:"Project name:",validate:R=>R.trim().length>0||"Project name is required"}]);e.splice(2,0,f,g.trim());}{let f=Y(process.cwd()),g=(e[2]||"").toLowerCase();if(f&&g){let R=h.join(f,".rapidkit","workspace.json"),x=h.join(f,".rapidkit","policies.yml");try{let[T,C]=await Promise.all([b.pathExists(R).then(fe=>fe?_.promises.readFile(R,"utf-8"):"{}"),b.pathExists(x).then(fe=>fe?_.promises.readFile(x,"utf-8"):"")]),P=JSON.parse(T).profile,N=C.match(/^\s*mode:\s*(warn|strict)\s*(?:#.*)?$/m)?.[1]??"warn",$=qt(g)||lt(g)||g.startsWith("go"),Re=["nestjs","react","vue","nextjs","next","vite","angular","svelte","express","koa","fastify"].some(fe=>g.includes(fe)),Ze=!$&&!Re,we=null;if(P==="python-only"&&!Ze?we=`Kit "${g}" is not a Python kit, but workspace profile is "python-only".`:P==="node-only"&&!Re?we=`Kit "${g}" is not a Node kit, but workspace profile is "node-only".`:P==="go-only"&&!$&&(we=`Kit "${g}" is not a Go kit, but workspace profile is "go-only".`),we){if(N==="strict")return console.log(l.red(`\u274C Profile violation (strict mode): ${we}`)),console.log(l.gray("\u{1F4A1} Change workspace profile or use --no-workspace to skip enforcement.")),1;console.log(l.yellow(`\u26A0\uFE0F Profile warning: ${we}`)),console.log(l.gray('\u{1F4A1} Consider using a "polyglot" workspace profile for multi-language projects.'));}}catch{}}}if(qt(e[2]||""))return await ur(e);if(lt(e[2]||""))return await gr(e);let r=e.includes("--create-workspace"),i$1=e.includes("--no-workspace"),n=e.includes("--yes")||e.includes("-y"),a=e.includes("--skip-git")||e.includes("--no-git");if(!!!so(process.cwd())){if(r)await i(process.cwd(),{skipGit:a,yes:n,userConfig:await a$2()});else if(!i$1)if(n)await i(process.cwd(),{skipGit:a,yes:true,userConfig:await a$2()});else {let{createWs:f}=await xe.prompt([{type:"confirm",name:"createWs",message:"This project will be created outside a RapidKit workspace. Create and register a workspace here?",default:true}]);f&&await i(process.cwd(),{skipGit:a,yes:false,userConfig:await a$2()});}}let p=[...e.filter(f=>{let g=f.split("=")[0];return !o.has(f)&&!o.has(g)})],d=Y(process.cwd()),w=e.includes("--skip-install")||!!d?{...process.env,RAPIDKIT_SKIP_LOCKS:"1",RAPIDKIT_GENERATE_LOCKS:"0"}:void 0;try{await c$2();let f=await d$1(p,{cwd:process.cwd(),env:w});if(f===0&&d&&!e.includes("--skip-install")&&(console.log(l.gray("\u2139\uFE0F Fast create mode (workspace): dependencies were deferred.")),console.log(l.white(" Next: cd <project-name> && npx rapidkit init"))),f===0){let g=d||Y(process.cwd());if(g){try{let x=e[3];if(x){let T=e.indexOf("--output"),C=T>=0?e[T+1]:".",P=h.resolve(process.cwd(),C,x),G=h.join(g,".python-version"),N=h.join(P,".python-version");if(_.existsSync(G)&&_.existsSync(P)){let $=_.readFileSync(G,"utf-8");_.writeFileSync(N,$.trim()+`
|
|
3531
|
-
`),a$1.debug(`Synced Python version ${$.trim()} from workspace to ${x}`);}}}catch(x){a$1.debug("Could not sync Python version from workspace:",x);}let{syncWorkspaceProjects:R}=await import('./workspace-
|
|
3532
|
-
`),1)}}if(e[0]==="create"&&e[1]!=="project")try{await c$2();let t=await d$1(e,{cwd:process.cwd()});if(t===0){let r=Y(process.cwd());if(r){let{syncWorkspaceProjects:i}=await import('./workspace-
|
|
3531
|
+
`),a$1.debug(`Synced Python version ${$.trim()} from workspace to ${x}`);}}}catch(x){a$1.debug("Could not sync Python version from workspace:",x);}let{syncWorkspaceProjects:R}=await import('./workspace-KRZ3DWL4.js');await R(g,true);}}return f}catch(f){let g=oo(f);return g?await io(p,g):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${f?.message??f}
|
|
3532
|
+
`),1)}}if(e[0]==="create"&&e[1]!=="project")try{await c$2();let t=await d$1(e,{cwd:process.cwd()});if(t===0){let r=Y(process.cwd());if(r){let{syncWorkspaceProjects:i}=await import('./workspace-KRZ3DWL4.js');await i(r,true);}}return t}catch(t){let r=oo(t);return r?await io(e,r):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${t?.message??t}
|
|
3533
3533
|
`),1)}return await c$2(),await d$1(e,{cwd:process.cwd()})}catch(t){let r=oo(t);return r?await io(e,r):(process.stderr.write(`RapidKit (npm) failed to run the Python core engine: ${t?.message??t}
|
|
3534
3534
|
`),1)}}var mr=["init","dev","start","build","test","docs","lint","format","create","help","--help","-h"],ys=["doctor","workspace","bootstrap","setup","cache","mirror","ai","config","shell"],ws=["doctor","workspace","ai","config","shell"],vs=["bootstrap","setup","cache","mirror"],xr=["lint","format","docs"],ks=["init"],Pr=["build","dev","start","test"],fr=[...Pr,...xr];function Ft(e){return !!e&&ys.includes(e)}function hr(e){return !!e&&ws.includes(e)}function bs(e){return !!e&&vs.includes(e)}function Er(e){return _.existsSync(h.join(e,".rapidkit-workspace"))||_.existsSync(h.join(e,".rapidkit","workspace.json"))}function Ir(e){let o=e;for(;;){let t=h.join(o,".rapidkit","context.json");if(_.existsSync(t))return t;let r=h.dirname(o);if(r===o)break;o=r;}return null}function so(e){let o=e;for(;;){let t=h.join(o,".rapidkit-workspace");if(_.existsSync(t))return t;let r=h.dirname(o);if(r===o)break;o=r;}return null}function Y(e){let o=e;for(;;){let t=h.join(o,".rapidkit-workspace");if(_.existsSync(t))return o;let r=h.dirname(o);if(r===o)break;o=r;}return null}function Rs(e){let o=e;for(;;){let t=h.join(o,".rapidkit-workspace"),r=h.join(o,".rapidkit","workspace.json");if(!_.existsSync(t)&&_.existsSync(r))return o;let i=h.dirname(o);if(i===o)break;o=i;}return null}var Tr={enforce_workspace_marker:true,enforce_toolchain_lock:false,disallow_untrusted_tool_sources:false,enforce_compatibility_matrix:false,require_mirror_lock_for_offline:true};function _s(e){return e&&e.match(/^[\t ]*mode:\s*(warn|strict)\s*(?:#.*)?$/m)?.[1]==="strict"?"strict":"warn"}function ct(e,o){let t=e.match(new RegExp(`^[\\t ]*${o}:\\s*(true|false)\\s*(?:#.*)?$`,"m"));return t?t[1]==="true":Tr[o]}function yr(e){let o=e??"";return {mode:_s(o),dependency_sharing_mode:Ar(o),rules:{enforce_workspace_marker:ct(o,"enforce_workspace_marker"),enforce_toolchain_lock:ct(o,"enforce_toolchain_lock"),disallow_untrusted_tool_sources:ct(o,"disallow_untrusted_tool_sources"),enforce_compatibility_matrix:ct(o,"enforce_compatibility_matrix"),require_mirror_lock_for_offline:ct(o,"require_mirror_lock_for_offline")}}}function wr(e,o,t){let r=`${o}: ${t}`,i=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`^[\\t ]*${i}:\\s*.*$`,"m");if(n.test(e))return e.replace(n,r);let a=/^[\t ]*rules:\s*(?:#.*)?$/m;return a.test(e)?e.replace(a,`${r}
|
|
3535
3535
|
rules:`):`${e.endsWith(`
|
|
@@ -3544,7 +3544,7 @@ ${r}
|
|
|
3544
3544
|
`)}async function vr(e){let o=h.join(e,".rapidkit","policies.yml");return await b.pathExists(o)?_.promises.readFile(o,"utf-8"):Ss()}async function xs(e,o){let t=h.join(e,".rapidkit"),r=h.join(t,"policies.yml");await b.ensureDir(t);let i=o.endsWith(`
|
|
3545
3545
|
`)?o:`${o}
|
|
3546
3546
|
`;await _.promises.writeFile(r,i,"utf-8");}function Ps(e){let o=e.trim().toLowerCase();return o==="true"||o==="1"||o==="on"?true:o==="false"||o==="0"||o==="off"?false:null}function Ar(e){if(!e)return "isolated";let t=e.match(/^\s*dependency_sharing_mode:\s*([a-zA-Z\-]+)\s*(?:#.*)?$/m)?.[1]?.toLowerCase();return t==="shared-runtime-caches"||t==="shared-node-deps"||t==="isolated"?t:"isolated"}function Or(e){if(!e)return {mode:"isolated",status:"skipped",message:"No policies.yml found; dependency_sharing_mode defaults to isolated."};let o=e.match(/^\s*dependency_sharing_mode:\s*([a-zA-Z\-]+)\s*(?:#.*)?$/m);if(!o)return {mode:"isolated",status:"skipped",message:"dependency_sharing_mode is not set; defaulting to isolated."};let t=o[1].toLowerCase();return t==="isolated"||t==="shared-runtime-caches"||t==="shared-node-deps"?{mode:t,status:"passed",message:`dependency_sharing_mode is valid: ${t}.`}:{mode:"isolated",status:"failed",message:`Invalid dependency_sharing_mode: ${t}. Use one of: isolated, shared-runtime-caches, shared-node-deps.`}}async function Nr(e,o){let t=Y(e),r=t?h.join(t,".rapidkit","policies.yml"):null,i="isolated";if(r&&await b.pathExists(r))try{let s=await _.promises.readFile(r,"utf-8"),c=Or(s);if(c.status==="failed")return console.log(l.red(`\u274C ${c.message}`)),{ok:false,code:1};i=c.mode;}catch{return console.log(l.red("\u274C Failed to read workspace policy file (.rapidkit/policies.yml).")),{ok:false,code:1}}let n=process.env.RAPIDKIT_DEP_SHARING_MODE,a=process.env.RAPIDKIT_WORKSPACE_PATH;process.env.RAPIDKIT_DEP_SHARING_MODE=i,t&&(process.env.RAPIDKIT_WORKSPACE_PATH=t);try{return {ok:true,value:await o()}}finally{typeof n>"u"?delete process.env.RAPIDKIT_DEP_SHARING_MODE:process.env.RAPIDKIT_DEP_SHARING_MODE=n,typeof a>"u"?delete process.env.RAPIDKIT_WORKSPACE_PATH:process.env.RAPIDKIT_WORKSPACE_PATH=a;}}async function W(e,o,t){return await new Promise(r=>{let i=spawn(e,o,{stdio:"inherit",cwd:t,shell:b$3()});i.on("close",n=>r(n??1)),i.on("error",()=>r(1));})}async function Xe(e,o){await b.outputFile(e,`${JSON.stringify(o,null,2)}
|
|
3547
|
-
`,"utf-8");}async function Es(e){let o=new Set(["go-only"]);try{let r=h.join(e,".rapidkit","workspace.json"),i=JSON.parse(await _.promises.readFile(r,"utf-8"));if(o.has(i.profile??""))return 0}catch{}let t="poetry";try{let{readWorkspaceMarker:r}=await import('./workspace-marker-IOPQ42A7.js'),n=(await r(e))?.metadata?.npm?.installMethod;(n==="poetry"||n==="venv"||n==="pipx"||n==="pip")&&(t=n);}catch{}if(t==="poetry"||t==="venv"){let r=h.join(e,"pyproject.toml"),i=false;try{i=(await _.promises.readFile(r,"utf-8")).includes("rapidkit-core");}catch{i=false;}let n=process.env.RAPIDKIT_DEV_PATH,a=n?await b.pathExists(n):false;if(i){let s=gs(e);if(!await b.pathExists(s)){let d=await ms(e);if(d!==0)return d}let p=await W(s,a&&n?["-m","pip","install",n,"--quiet","--disable-pip-version-check"]:["-m","pip","install","rapidkit-core","--quiet","--disable-pip-version-check"],e);if(p!==0)return p}else {let s=await W("poetry",["install","--no-root"],e);if(s!==0)return s;let c=await W("poetry",["add","rapidkit-core"],e);if(c!==0)return c}try{let{writeWorkspaceLauncher:s}=await import('./create-
|
|
3547
|
+
`,"utf-8");}async function Es(e){let o=new Set(["go-only"]);try{let r=h.join(e,".rapidkit","workspace.json"),i=JSON.parse(await _.promises.readFile(r,"utf-8"));if(o.has(i.profile??""))return 0}catch{}let t="poetry";try{let{readWorkspaceMarker:r}=await import('./workspace-marker-IOPQ42A7.js'),n=(await r(e))?.metadata?.npm?.installMethod;(n==="poetry"||n==="venv"||n==="pipx"||n==="pip")&&(t=n);}catch{}if(t==="poetry"||t==="venv"){let r=h.join(e,"pyproject.toml"),i=false;try{i=(await _.promises.readFile(r,"utf-8")).includes("rapidkit-core");}catch{i=false;}let n=process.env.RAPIDKIT_DEV_PATH,a=n?await b.pathExists(n):false;if(i){let s=gs(e);if(!await b.pathExists(s)){let d=await ms(e);if(d!==0)return d}let p=await W(s,a&&n?["-m","pip","install",n,"--quiet","--disable-pip-version-check"]:["-m","pip","install","rapidkit-core","--quiet","--disable-pip-version-check"],e);if(p!==0)return p}else {let s=await W("poetry",["install","--no-root"],e);if(s!==0)return s;let c=await W("poetry",["add","rapidkit-core"],e);if(c!==0)return c}try{let{writeWorkspaceLauncher:s}=await import('./create-PIVSRLDS.js');await s(e,"poetry");}catch{}return 0}return 0}async function jr(e){let o=await _.promises.readdir(e,{withFileTypes:true}),t=[];for(let r of o){if(!r.isDirectory()||r.name.startsWith("."))continue;let i=h.join(e,r.name),n=h.join(i,".rapidkit","context.json"),a=h.join(i,".rapidkit","project.json");(await b.pathExists(n)||await b.pathExists(a))&&t.push(i);}return t}function Is(e){let o="my-workspace",t=1;for(;;){let r=t===1?o:`${o}-${t}`,i=h.join(e,r);if(!_.existsSync(i))return {name:r,targetPath:i};t+=1;}}async function Mt(e){let t=await He("go",{runCommandInCwd:W,runCoreRapidkit:d$1}).initProject(e);return t.message&&console.log(l.red(`\u274C ${t.message}`)),t.exitCode}async function dt(e,o){let t=He("node",{runCommandInCwd:W,runCoreRapidkit:d$1});return e==="init"?(await t.initProject(o)).exitCode:e==="dev"?(await t.runDev(o)).exitCode:e==="test"?(await t.runTest(o)).exitCode:e==="build"?(await t.runBuild(o)).exitCode:(await t.runStart(o)).exitCode}async function Ts(e,o=ao){let t=process.env.RAPIDKIT_SKIP_LOCK_SYNC;typeof t>"u"&&(process.env.RAPIDKIT_SKIP_LOCK_SYNC="1");try{let n=function(I){if(!I)return null;let O=I.trim().toLowerCase();return O==="minimal"||O==="go-only"||O==="python-only"||O==="node-only"||O==="polyglot"||O==="enterprise"?O:null},a=function(I){let j=I.match(/^\s*mode:\s*([a-zA-Z]+)\s*(?:#.*)?$/m)?.[1]?.toLowerCase()==="strict"?"strict":"warn",ge=(U,Te)=>{let Pe=I.match(new RegExp(`^\\s*${U}:\\s*(true|false)\\s*(?:#.*)?$`,"m"));return Pe?Pe[1].toLowerCase()==="true":Te};return {mode:j,dependency_sharing_mode:Ar(I),rules:{enforce_workspace_marker:ge("enforce_workspace_marker",true),enforce_toolchain_lock:ge("enforce_toolchain_lock",false),disallow_untrusted_tool_sources:ge("disallow_untrusted_tool_sources",false),enforce_compatibility_matrix:ge("enforce_compatibility_matrix",false),require_mirror_lock_for_offline:ge("require_mirror_lock_for_offline",true)}}};let s=["init"],c,p=false,d=false,u=false;for(let I=1;I<e.length;I+=1){let O=e[I];if(O==="--ci"){p=true;continue}if(O==="--offline"){d=true;continue}if(O==="--json"){u=true;continue}if(O==="--profile"){let M=e[I+1];if(!M||M.startsWith("-"))return console.log(l.yellow("Usage: rapidkit bootstrap [path] [--profile <minimal|go-only|python-only|node-only|polyglot|enterprise>] [--ci] [--offline] [--json]")),1;c=M,I+=1;continue}if(O.startsWith("--profile=")){c=O.slice(10);continue}s.push(O);}let m=n(c);if(c&&!m)return console.log(l.red(`Invalid profile: ${c}. Use one of: minimal, go-only, python-only, node-only, polyglot, enterprise.`)),1;let w=process.cwd(),f$1=Y(w);f$1||(f$1=Rs(w));let g=[],R=null,x=null;if(f$1)try{let I=h.join(f$1,".rapidkit","workspace.json"),O=await _.promises.readFile(I,"utf-8"),M=JSON.parse(O);x=n(M.profile);}catch{x=null;}let T=["minimal","python-only","node-only","go-only","polyglot","enterprise"],C={minimal:"minimal \u2014 Foundation files only (fastest bootstrap, mixed projects)","python-only":"python-only \u2014 Python + Poetry (FastAPI, Django, ML pipelines)","node-only":"node-only \u2014 Node.js runtime (NestJS, Express, Next.js)","go-only":"go-only \u2014 Go runtime (Fiber, Gin, gRPC, microservices)",polyglot:"polyglot \u2014 Python + Node.js + Go multi-runtime workspace",enterprise:"enterprise \u2014 Polyglot + governance + Sigstore verification"},P=m;if(!!f$1&&!m&&!p&&!u&&!!process.stdin.isTTY&&!!process.stdout.isTTY){let I=x||"minimal",{chosenProfile:O}=await xe.prompt([{type:"rawlist",name:"chosenProfile",message:`Select workspace profile for bootstrap (current: ${I})`,choices:T.map(M=>({name:M===I?`${C[M]} \u2190 current`:C[M],value:M})),default:T.indexOf(I)}]);P=O;}let N=P||x||"minimal";if(f$1)try{let O=N==="python-only"||N==="polyglot"||N==="enterprise"?"poetry":"venv",M;try{let U=(await _.promises.readFile(h.join(f$1,".python-version"),"utf-8")).trim();U&&(M=U);}catch{}let j=await f(f$1,{workspaceName:h.basename(f$1),installMethod:O,pythonVersion:M,profile:N,writeMarker:true,writeGitignore:true,onlyIfMissing:true});g.push({id:"workspace.legacy.sync",status:j.length>0?"passed":"skipped",message:j.length>0?`Legacy workspace foundation synchronized: ${j.join(", ")}`:"Workspace foundation files are already up to date."});}catch(I){g.push({id:"workspace.legacy.sync",status:"failed",message:`Failed to synchronize legacy workspace foundation files: ${I.message}`});}if(f$1&&P&&P!==x)try{let I=h.join(f$1,".rapidkit","workspace.json"),O=await _.promises.readFile(I,"utf-8"),M=JSON.parse(O);M.profile=P,await _.promises.writeFile(I,JSON.stringify(M,null,2)+`
|
|
3548
3548
|
`,"utf-8");}catch{}let $={mode:"warn",dependency_sharing_mode:"isolated",rules:{enforce_workspace_marker:true,enforce_toolchain_lock:false,disallow_untrusted_tool_sources:false,enforce_compatibility_matrix:false,require_mirror_lock_for_offline:true}},Re=null;if(f$1)try{let I=await _.promises.readFile(h.join(f$1,".rapidkit","policies.yml"),"utf-8");Re=I,$=a(I);}catch{g.push({id:"policy.file",status:"skipped",message:"No workspace policy file found; using default bootstrap policy."});}else g.push({id:"workspace.detect",status:"skipped",message:"No workspace marker found; bootstrap runs in project/single-path mode."});if(f$1){let I=Or(Re);$.dependency_sharing_mode=I.mode,g.push({id:"policy.schema.dependency_sharing_mode",status:I.status,message:I.message}),g.push({id:"policy.dependency_sharing_mode.effective",status:"passed",message:$.dependency_sharing_mode==="isolated"?"Effective dependency mode: isolated (default secure mode).":$.dependency_sharing_mode==="shared-node-deps"?"Effective dependency mode: shared-node-deps (Node projects share workspace-level caches).":"Effective dependency mode: shared-runtime-caches (Node/Python/Go share workspace-level caches)."});let O=_.existsSync(h.join(f$1,".rapidkit-workspace"));g.push({id:"policy.enforce_workspace_marker",status:!$.rules.enforce_workspace_marker||O?"passed":"failed",message:!$.rules.enforce_workspace_marker||O?"Workspace marker policy satisfied.":"Workspace marker policy failed: .rapidkit-workspace is missing."});let M=_.existsSync(h.join(f$1,".rapidkit","toolchain.lock"));g.push({id:"policy.enforce_toolchain_lock",status:!$.rules.enforce_toolchain_lock||M?"passed":"failed",message:!$.rules.enforce_toolchain_lock||M?"Toolchain lock policy satisfied.":"Toolchain lock policy failed: .rapidkit/toolchain.lock is missing."});let j=process.env.RAPIDKIT_TRUSTED_SOURCES==="1"||_.existsSync(h.join(f$1,".rapidkit","trusted-sources.lock"));g.push({id:"policy.disallow_untrusted_tool_sources",status:!$.rules.disallow_untrusted_tool_sources||j?"passed":"failed",message:!$.rules.disallow_untrusted_tool_sources||j?"Trusted tool sources policy satisfied.":"Trusted tool sources policy failed: set RAPIDKIT_TRUSTED_SOURCES=1 or provide .rapidkit/trusted-sources.lock."});let ge=h.join(f$1,".rapidkit","compatibility-matrix.json"),U=_.existsSync(ge),Te=$.rules.enforce_compatibility_matrix;if(g.push({id:"policy.enforce_compatibility_matrix",status:!Te||U?"passed":"failed",message:!Te||U?"Compatibility matrix policy satisfied.":"Compatibility matrix policy failed: .rapidkit/compatibility-matrix.json is missing."}),U)try{let F=await _.promises.readFile(ge,"utf-8"),X=JSON.parse(F),gt=!!X&&typeof X=="object";g.push({id:"compatibility.matrix.parse",status:gt?"passed":"failed",message:gt?"Compatibility matrix parsed successfully.":"Compatibility matrix parse failed: invalid JSON object."});}catch{g.push({id:"compatibility.matrix.parse",status:"failed",message:"Compatibility matrix parse failed: invalid JSON."});}let Pe=h.join(f$1,".rapidkit","mirror-config.json"),ie=h.join(f$1,".rapidkit","mirror.lock"),Ae=_.existsSync(Pe),Ee=_.existsSync(ie),ut={};if(Ae)try{ut=JSON.parse(await _.promises.readFile(Pe,"utf-8")),g.push({id:"mirror.config.parse",status:"passed",message:"Mirror configuration parsed successfully."});}catch{g.push({id:"mirror.config.parse",status:"failed",message:"Mirror configuration parse failed: invalid JSON in .rapidkit/mirror-config.json."});}let Ht=await to(f$1,{ciMode:p,offlineMode:d});if(g.push(...Ht.checks.map(F=>({id:F.id,status:F.status,message:F.message}))),R=Ht.details,Ht.details.lockWritten&&(Ee=true),d){let F=process.env.RAPIDKIT_MIRROR_ENABLED==="1"||ut.enabled===true;g.push({id:"offline.mirror.enabled",status:F?"passed":"failed",message:F?"Offline mode mirror is enabled.":'Offline mode requires mirror enablement (set RAPIDKIT_MIRROR_ENABLED=1 or .rapidkit/mirror-config.json {"enabled": true}).'});let X=$.rules.require_mirror_lock_for_offline;g.push({id:"offline.mirror.lock",status:!X||Ee?"passed":"failed",message:!X||Ee?"Offline mode mirror lock policy satisfied.":"Offline mode mirror lock policy failed: .rapidkit/mirror.lock is missing."});}else g.push({id:"offline.mirror.enabled",status:"skipped",message:"Offline mirror checks skipped (offline mode is disabled)."});let Dr=await jr(f$1),de=new Set;for(let F of Dr){let X=Se(F);if(pe(X,F)){de.add("go");continue}if(ue(X,F)){de.add("node");continue}if(me(X,F)){de.add("python");continue}de.add("unknown");}if(N==="go-only"){let F=de.size===0||[...de].every(X=>X==="go");g.push({id:"profile.go-only",status:F?"passed":"failed",message:F?"go-only profile validated for discovered projects.":`go-only profile mismatch: detected runtimes [${[...de].join(", ")}].`});}else if(N==="python-only"){let F=de.size===0||[...de].every(X=>X==="python");g.push({id:"profile.python-only",status:F?"passed":"failed",message:F?"python-only profile validated for discovered projects.":`python-only profile mismatch: detected runtimes [${[...de].join(", ")}].`});}else if(N==="node-only"){let F=de.size===0||[...de].every(X=>X==="node");g.push({id:"profile.node-only",status:F?"passed":"failed",message:F?"node-only profile validated for discovered projects.":`node-only profile mismatch: detected runtimes [${[...de].join(", ")}].`});}else if(N==="minimal"){let F=[...de].filter(gt=>gt!=="unknown"),X=F.length<=1;g.push({id:"profile.minimal",status:X?"passed":"failed",message:X?"minimal profile is compatible with detected runtime mix.":`minimal profile mismatch: multiple runtimes detected [${F.join(", ")}].`});}else N==="enterprise"&&(g.push({id:"profile.enterprise.ci",status:p?"passed":"failed",message:p?"enterprise profile running with --ci.":"enterprise profile expects --ci for deterministic non-interactive mode."}),g.push({id:"profile.enterprise.compatibility-matrix",status:U?"passed":"failed",message:U?"enterprise profile has compatibility matrix.":"enterprise profile requires .rapidkit/compatibility-matrix.json."}),g.push({id:"profile.enterprise.mirror-config",status:Ae?"passed":"failed",message:Ae?"enterprise profile has mirror configuration.":"enterprise profile requires .rapidkit/mirror-config.json."}));}p&&(process.env.RAPIDKIT_BOOTSTRAP_CI="1"),d&&(process.env.RAPIDKIT_OFFLINE_MODE="1");let we=g.some(I=>I.id.startsWith("policy.schema.")&&I.status==="failed")||$.mode==="strict"&&g.some(I=>I.status==="failed"),fe=f$1||w,Ve=h.join(fe,".rapidkit","reports"),z=new Date().toISOString().replace(/[:.]/g,"-"),L=h.join(Ve,`bootstrap-compliance-${z}.json`),S=h.join(Ve,"bootstrap-compliance.latest.json"),se={command:"bootstrap",timestamp:new Date().toISOString(),workspacePath:f$1,profile:N,options:{ci:p,offline:d,strict:$.mode==="strict"},policyMode:$.mode,policyRules:$.rules,mirrorLifecycle:R,checks:g};if(we){let I={...se,result:"blocked",initExitCode:null};return await b.ensureDir(Ve),await Xe(L,I),await Xe(S,I),u?process.stdout.write(`${JSON.stringify(I,null,2)}
|
|
3549
3549
|
`):(console.log(l.red("\u274C Bootstrap blocked by strict policy checks.")),console.log(l.gray(`Compliance report: ${L}`))),1}let ae=0;u||(ae=await o(s));let H=g.filter(I=>I.status==="failed").length,re=ae!==0?"failed":H>0?"ok_with_warnings":"ok",le={...se,result:re,initExitCode:ae};if(await b.ensureDir(Ve),await Xe(L,le),await Xe(S,le),u)process.stdout.write(`${JSON.stringify(le,null,2)}
|
|
3550
3550
|
`);else {let I=g.filter(O=>O.status==="failed").length;I>0&&console.log(l.yellow(`\u26A0\uFE0F Bootstrap completed with ${I} policy/profile warnings.`)),console.log(l.gray(`Compliance report: ${L}`));}return ae}finally{typeof t>"u"?delete process.env.RAPIDKIT_SKIP_LOCK_SYNC:process.env.RAPIDKIT_SKIP_LOCK_SYNC=t;}}async function As(e){let o=(e[1]||"").toLowerCase(),t=e.includes("--warm-deps")||e.includes("--warm-dependencies");if(!o||!["python","node","go"].includes(o))return console.log(l.yellow("Usage: rapidkit setup <python|node|go> [--warm-deps]")),1;let r=async(p,d)=>{if(p==="node"){if(!_.existsSync(h.join(d,"package.json")))return {exitCode:0,message:"Node warm-up skipped: package.json not found in current directory."};let m=_.existsSync(h.join(d,"pnpm-lock.yaml")),w=_.existsSync(h.join(d,"yarn.lock"));return m?{exitCode:await W("pnpm",["install","--lockfile-only","--ignore-scripts"],d)}:w?{exitCode:await W("yarn",["install","--ignore-scripts"],d)}:{exitCode:await W("npm",["install","--package-lock-only","--ignore-scripts"],d)}}return p==="go"?_.existsSync(h.join(d,"go.mod"))?{exitCode:await W("go",["mod","download"],d)}:{exitCode:0,message:"Go warm-up skipped: go.mod not found in current directory."}:{exitCode:0,message:"Dependency warm-up currently applies to node/go runtimes."}},i=He(o,{runCommandInCwd:W,runCoreRapidkit:(p,d)=>d$1(p,{...d,cwd:void 0})}),n=await i.checkPrereqs(),a=await i.doctorHints(process.cwd()),s=Y(process.cwd()),c=s||process.cwd();if(n.exitCode===0){console.log(l.green(`\u2705 ${o} prerequisites look good.`));let p=["python","node","go"].filter(d=>d!==o).join("/");if(console.log(l.gray(` Scope: validated ${o} runtime only. ${p} checks are optional unless your workspace profile uses them.`)),o==="python"&&console.log(l.gray(" Note: Poetry is recommended, but venv/pipx-based flows are supported in workspace creation.")),i.warmSetupCache&&((await i.warmSetupCache(c)).exitCode===0?console.log(l.gray(` ${o} cache warm-up completed.`)):console.log(l.yellow(` ${o} cache warm-up skipped (non-fatal).`))),t){let d=await r(o,c),u=/skipped/i.test(d.message||"");d.message&&console.log(l.gray(` ${d.message}`)),d.exitCode===0&&!u?console.log(l.gray(` ${o} dependency warm-up completed (--warm-deps).`)):d.exitCode!==0&&console.log(l.yellow(` ${o} dependency warm-up failed (non-fatal).`));}if(s)try{let d=h.join(s,".rapidkit","toolchain.lock"),u={};try{u=JSON.parse(await _.promises.readFile(d,"utf-8"));}catch{}(!u.runtime||typeof u.runtime!="object")&&(u.runtime={});let m=u.runtime;if(o==="python"){let w=null;try{let{execa:f}=await import('execa');for(let g of co()){let x=await f(g,g==="py"?["-3","--version"]:["--version"],{cwd:s,stdio:"pipe",reject:false,timeout:3e3});if(x.exitCode===0){let C=(x.stdout||x.stderr||"").match(/Python\s+(\S+)/);if(w=C?C[1]:null,w)break}}}catch{}m.python={...m.python||{},version:w,last_setup:new Date().toISOString()};}else if(o==="node")m.node={...m.node||{},version:process.version,last_setup:new Date().toISOString()};else if(o==="go"){let w=null;try{let{execa:f}=await import('execa'),R=((await f("go",["version"],{cwd:s,stdio:"pipe"})).stdout||"").match(/go(\d+\.\d+(?:\.\d+)?)/i);w=R?R[1]:null;}catch{}m.go={...m.go||{},version:w,last_setup:new Date().toISOString()};}u.updated_at=new Date().toISOString(),await _.promises.writeFile(d,JSON.stringify(u,null,2)+`
|
|
@@ -3628,7 +3628,7 @@ Use "rapidkit help <command>" for more information.
|
|
|
3628
3628
|
`),a$1.debug(`Synced Python version ${G.trim()} from workspace to project`);}}catch(G){a$1.debug("Could not sync Python version from workspace:",G);}}if(!o.skipInstall){let T=await d$1(["init",n],{cwd:process.cwd()});if(T!==0&&process.exit(T),x){let C=h.dirname(x),P=h.join(C,".python-version"),G=h.join(n,".python-version");try{if(await b.pathExists(P)){let N=_.readFileSync(P,"utf-8");_.writeFileSync(G,N.trim()+`
|
|
3629
3629
|
`),a$1.debug(`Re-synced Python version ${N.trim()} after init`);}}catch(N){a$1.debug("Could not re-sync Python version after init:",N);}}}}else await h$1(e$1,{skipGit:o.skipGit,dryRun:o.dryRun,yes:o.yes,userConfig:i$1,installMethod:o.installMethod,profile:o.profile});}catch(t){t instanceof d?(a$1.error(`
|
|
3630
3630
|
\u274C ${t.message}`),t.details&&a$1.warn(`\u{1F4A1} ${t.details}`),a$1.debug("Error code:",t.code)):(a$1.error(`
|
|
3631
|
-
\u274C An unexpected error occurred:`),console.error(t)),process.exit(1);}finally{$e=null;}});er(ye);$o(ye);ye.command("shell <action>").description("Shell helpers (activate virtualenv in current shell)").action(async e=>{e!=="activate"&&(console.log(l.red(`Unknown shell command: ${e}`)),process.exit(1));let o=process.cwd();function t(c){let p=c;for(;;){let d=h.join(p,".rapidkit","context.json");if(_.existsSync(d))return d;let u=h.dirname(p);if(u===p)break;p=u;}return null}let r=t(o);function i(c){let p=c;for(;;){let d=h.join(p,".venv"),u=h.join(p,".rapidkit","activate");if(_.existsSync(u)||_.existsSync(d))return {venv:d,activateFile:u};let m=h.dirname(p);if(m===p)break;p=m;}return null}let n=i(o);!r&&!n&&(console.log(l.yellow("No RapidKit project found in this directory")),process.exit(1));let a$1;n&&_.existsSync(n.activateFile)?a$1=n.activateFile:n&&_.existsSync(n.venv)?a$1=h$2(n.venv):(console.log(l.yellow("No virtual environment found")),process.exit(1));let s=a();console.log(s?`call "${a$1}"`:`. "${a$1}"`);});ye.command("doctor [scope]").description("\u{1FA7A} Check RapidKit system health by default; use workspace for full workspace checks").option("--workspace","Check entire workspace (including all projects)").option("--json","Output results in JSON format (for CI/CD pipelines)").option("--fix","Automatically fix common issues (with confirmation)").action(async(e,o)=>{e&&e!=="workspace"&&(console.log(l.red(`Unknown doctor scope: ${e}`)),console.log(l.gray("Available: workspace")),console.log(l.gray("Usage: npx rapidkit doctor or npx rapidkit doctor workspace")),process.exit(1)),await Oo({...o,workspace:o.workspace||e==="workspace"});});ye.command("workspace <action> [subaction] [key] [value]").description("Manage RapidKit workspaces (list, sync, policy)").action(async(e,o,t,r)=>{if(e==="list"){let{listWorkspaces:i}=await import('./workspace-
|
|
3631
|
+
\u274C An unexpected error occurred:`),console.error(t)),process.exit(1);}finally{$e=null;}});er(ye);$o(ye);ye.command("shell <action>").description("Shell helpers (activate virtualenv in current shell)").action(async e=>{e!=="activate"&&(console.log(l.red(`Unknown shell command: ${e}`)),process.exit(1));let o=process.cwd();function t(c){let p=c;for(;;){let d=h.join(p,".rapidkit","context.json");if(_.existsSync(d))return d;let u=h.dirname(p);if(u===p)break;p=u;}return null}let r=t(o);function i(c){let p=c;for(;;){let d=h.join(p,".venv"),u=h.join(p,".rapidkit","activate");if(_.existsSync(u)||_.existsSync(d))return {venv:d,activateFile:u};let m=h.dirname(p);if(m===p)break;p=m;}return null}let n=i(o);!r&&!n&&(console.log(l.yellow("No RapidKit project found in this directory")),process.exit(1));let a$1;n&&_.existsSync(n.activateFile)?a$1=n.activateFile:n&&_.existsSync(n.venv)?a$1=h$2(n.venv):(console.log(l.yellow("No virtual environment found")),process.exit(1));let s=a();console.log(s?`call "${a$1}"`:`. "${a$1}"`);});ye.command("doctor [scope]").description("\u{1FA7A} Check RapidKit system health by default; use workspace for full workspace checks").option("--workspace","Check entire workspace (including all projects)").option("--json","Output results in JSON format (for CI/CD pipelines)").option("--fix","Automatically fix common issues (with confirmation)").action(async(e,o)=>{e&&e!=="workspace"&&(console.log(l.red(`Unknown doctor scope: ${e}`)),console.log(l.gray("Available: workspace")),console.log(l.gray("Usage: npx rapidkit doctor or npx rapidkit doctor workspace")),process.exit(1)),await Oo({...o,workspace:o.workspace||e==="workspace"});});ye.command("workspace <action> [subaction] [key] [value]").description("Manage RapidKit workspaces (list, sync, policy)").action(async(e,o,t,r)=>{if(e==="list"){let{listWorkspaces:i}=await import('./workspace-KRZ3DWL4.js');await i();}else if(e==="sync"){let i=Y(process.cwd());i||(console.log(l.red("\u274C Not inside a RapidKit workspace")),console.log(l.gray("\u{1F4A1} Run this command from within a workspace directory")),process.exit(1));let{syncWorkspaceProjects:n}=await import('./workspace-KRZ3DWL4.js');console.log(l.cyan(`\u{1F4C2} Scanning workspace: ${h.basename(i)}`)),await n(i);}else if(e==="policy"){let i=Y(process.cwd());i||(console.log(l.red("\u274C Not inside a RapidKit workspace")),console.log(l.gray("\u{1F4A1} Run this command from within a workspace directory")),process.exit(1));let n=await js(i,o,t,r);n!==0&&process.exit(n);}else console.log(l.red(`Unknown workspace action: ${e}`)),console.log(l.gray("Available: list, sync, policy")),process.exit(1);});function $r(){let e=a()?"npx rapidkit init; npx rapidkit dev":"npx rapidkit init && npx rapidkit dev";console.log(l.white(`Usage:
|
|
3632
3632
|
`)),console.log(l.cyan(` npx rapidkit <workspace-name> [options]
|
|
3633
3633
|
`)),console.log(l.bold("Quick start \u2014 workspace workflow:")),console.log(l.cyan(" npx rapidkit my-workspace ")+l.gray("# Create workspace (interactive profile picker)")),console.log(l.cyan(" cd my-workspace")),console.log(l.cyan(" npx rapidkit bootstrap ")+l.gray("# Bootstrap all runtime toolchains")),console.log(l.cyan(" npx rapidkit create project ")+l.gray("# Interactive kit picker")),console.log(l.cyan(" cd my-api")),console.log(l.cyan(` ${e}
|
|
3634
3634
|
`)),console.log(l.bold("Workspace profiles (asked during creation):")),console.log(l.gray(" minimal Foundation files only \u2014 fastest bootstrap (default)")),console.log(l.gray(" python-only Python + Poetry (FastAPI, Django, ML)")),console.log(l.gray(" node-only Node.js runtime (NestJS, Express, Next.js)")),console.log(l.gray(" go-only Go runtime (Fiber, Gin, gRPC)")),console.log(l.gray(" polyglot Python + Node.js + Go multi-runtime")),console.log(l.gray(` enterprise Polyglot + governance + Sigstore
|
package/dist/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapidkit",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official CLI for RapidKit, an open-source workspace platform that standardizes how teams build, scale, and deploy backend services.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rapidkit",
|
|
8
|
+
"workspai",
|
|
9
|
+
"ai",
|
|
8
10
|
"cli",
|
|
9
11
|
"create",
|
|
10
12
|
"fastapi",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-EDH5S5JF.js';import {j}from'./chunk-Z5LKRG57.js';import {promises}from'fs';import d from'path';import r from'chalk';import w from'ora';import {execa}from'execa';function f(e){let t=d.resolve(e);return process.platform==="win32"?t.toLowerCase():t}function S(e){let t=f(e.path),i=Array.isArray(e.projects)?e.projects:[],a=[],o=new Set;for(let s of i){if(!s||typeof s.name!="string"||typeof s.path!="string")continue;let n=f(s.path);o.has(n)||(o.add(n),a.push({name:s.name,path:n}));}return {name:e.name,path:t,mode:e.mode,projects:a}}function v(e){let t=[],i=new Set;for(let a of e.workspaces||[]){if(!a||typeof a.name!="string"||typeof a.path!="string")continue;let o=S(a);i.has(o.path)||(i.add(o.path),t.push(o));}return {workspaces:t}}async function N(e,t){try{let i=f(e),a=j(),o=d.join(a,"workspaces.json");await promises.mkdir(a,{recursive:true});let s={workspaces:[]};try{let p=await promises.readFile(o,"utf8"),m=JSON.parse(p);m&&Array.isArray(m.workspaces)&&(s=v(m));}catch{}s.workspaces.some(p=>p.path===i)||(s.workspaces.push({name:t,path:i,mode:"full",projects:[]}),await promises.writeFile(o,JSON.stringify(s,null,2)));}catch{console.warn(r.gray("Note: Could not register workspace in shared registry"));}}async function J(e,t=false){try{let i=f(e),a=j(),o=d.join(a,"workspaces.json"),s={workspaces:[]};try{let c=await promises.readFile(o,"utf8"),g=JSON.parse(c);g&&Array.isArray(g.workspaces)&&(s=v(g));}catch{t||console.log("\u26A0\uFE0F Workspace registry not found");return}let n=s.workspaces.find(c=>c.path===i);if(!n){t||console.log("\u26A0\uFE0F Workspace not registered in registry");return}Array.isArray(n.projects)||(n.projects=[]);let p=await promises.readdir(e,{withFileTypes:true}),m=0,h=0;for(let c of p)if(c.isDirectory()&&!c.name.startsWith(".")){let g=f(d.join(e,c.name)),R=d.join(g,".rapidkit","context.json"),j=d.join(g,".rapidkit","project.json");try{let k=false;try{await promises.access(R),k=true;}catch{await promises.access(j),k=true;}k&&(n.projects.some(_=>_.path===g||_.name===c.name)?h++:(n.projects.push({name:c.name,path:g}),m++,t||console.log(`\u2714 Added: ${c.name}`)));}catch{}}m>0?(await promises.writeFile(o,JSON.stringify(s,null,2)),t||console.log(`
|
|
2
2
|
\u2705 Synced ${m} project(s) to registry`)):t||console.log(`
|
|
3
3
|
\u2705 All projects already registered (${h} found)`);}catch(i){t||console.error("\u274C Failed to sync projects:",i.message);}}async function K(e,t,i){try{let a=f(e),o=f(i),s=j(),n=d.join(s,"workspaces.json"),p={workspaces:[]};try{let c=await promises.readFile(n,"utf8"),g=JSON.parse(c);g&&Array.isArray(g.workspaces)&&(p=v(g));}catch{return}let m=p.workspaces.find(c=>c.path===a);if(!m)return;Array.isArray(m.projects)||(m.projects=[]),m.projects.some(c=>c.path===o||c.name===t)||(m.projects.push({name:t,path:o}),await promises.writeFile(n,JSON.stringify(p,null,2)));}catch{}}async function G(e,t){let i=w("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(d.join(e,".rapidkit"),{recursive:true});let a={workspace_name:t.name,author:t.author,rapidkit_version:c(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(d.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let o=E();await promises.writeFile(d.join(e,"rapidkit"),o),await promises.chmod(d.join(e,"rapidkit"),493);let s=L();await promises.writeFile(d.join(e,"rapidkit.cmd"),s);let n=b(t.name);if(await promises.writeFile(d.join(e,"README.md"),n),await promises.writeFile(d.join(e,".gitignore"),`# RapidKit workspace
|
|
4
4
|
.env
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapidkit",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Official CLI for RapidKit, an open-source workspace platform that standardizes how teams build, scale, and deploy backend services.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rapidkit",
|
|
8
|
+
"workspai",
|
|
9
|
+
"ai",
|
|
8
10
|
"cli",
|
|
9
11
|
"create",
|
|
10
12
|
"fastapi",
|
package/dist/chunk-N64Z3XVF.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import o from'chalk';import {execa}from'execa';import {createRequire}from'module';var c=class{debugEnabled=false;setDebug(r){this.debugEnabled=r;}debug(r,...e){this.debugEnabled&&console.log(o.gray(`[DEBUG] ${r}`),...e);}info(r,...e){console.log(o.blue(r),...e);}success(r,...e){console.log(o.green(r),...e);}warn(r,...e){console.log(o.yellow(r),...e);}error(r,...e){console.error(o.red(r),...e);}step(r,e,n){console.log(o.cyan(`
|
|
2
|
-
[${r}/${e}]`),o.white(n));}},l=new c;var y="rapidkit",N=createRequire(import.meta.url),v=N("../package.json"),m=v?.version??"0.0.0";function d(t){let e=t.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return null;let n=e[4]?e[4].split(".").map(s=>s.match(/^\d+$/)?Number(s):s):[];return {major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:n}}function E(t,r){let e=d(t),n=d(r);if(!e||!n)return 0;if(e.major!==n.major)return e.major>n.major?1:-1;if(e.minor!==n.minor)return e.minor>n.minor?1:-1;if(e.patch!==n.patch)return e.patch>n.patch?1:-1;if(e.prerelease.length===0&&n.prerelease.length===0)return 0;if(e.prerelease.length===0)return 1;if(n.prerelease.length===0)return -1;let s=Math.max(e.prerelease.length,n.prerelease.length);for(let u=0;u<s;u+=1){let i=e.prerelease[u],a=n.prerelease[u];if(i===void 0)return -1;if(a===void 0)return 1;if(i===a)continue;let g=typeof i=="number",p=typeof a=="number";return g&&p?i>a?1:-1:g?-1:p||String(i)>String(a)?1:-1}return 0}async function C(){try{l.debug("Checking for updates...");let{stdout:t}=await execa("npm",["view",y,"version"],{timeout:3e3}),r=t.trim();r&&E(r,m)>0?(console.log(o.yellow(`
|
|
3
|
-
\u26A0\uFE0F Update available: ${m} \u2192 ${r}`)),console.log(o.cyan(`Run: npm install -g rapidkit@latest
|
|
4
|
-
`))):l.debug("You are using the latest version");}catch{l.debug("Could not check for updates");}}function P(){return m}export{l as a,C as b,P as c};
|