workspai 0.75.0 → 0.75.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/analyze-6UEBC5OJ.js +1 -0
- package/dist/{artifact-remediation-plan-HD5K52UJ.js → artifact-remediation-plan-SRH2Q6N2.js} +1 -1
- package/dist/autopilot-release-H5TO6NYY.js +1 -0
- package/dist/chunk-2DZLCINC.js +1 -0
- package/dist/{chunk-W7I65IXY.js → chunk-3HXEPDFF.js} +2 -2
- package/dist/chunk-3N27P3KO.js +7 -0
- package/dist/{chunk-J4J3RYCL.js → chunk-3RNWBFRP.js} +1 -1
- package/dist/{chunk-GE46XKD2.js → chunk-4JXJRIJM.js} +1 -1
- package/dist/chunk-5HNQIMGW.js +1 -0
- package/dist/chunk-5K4O3TAW.js +4 -0
- package/dist/{chunk-CGNMS32W.js → chunk-66O62XNJ.js} +49 -49
- package/dist/{chunk-GIFAGOMK.js → chunk-ADHX7D3F.js} +1 -1
- package/dist/chunk-DTNOF3MP.js +1 -0
- package/dist/{chunk-OH6LV5JP.js → chunk-E42IFQFR.js} +4 -4
- package/dist/{chunk-6B7L4NZE.js → chunk-EFHSRPW7.js} +6 -6
- package/dist/{chunk-CK73SQFF.js → chunk-EP7SUMAX.js} +1 -1
- package/dist/chunk-EWD6QTAM.js +2 -0
- package/dist/{chunk-HLSOZOL3.js → chunk-FNVWDXK2.js} +3 -3
- package/dist/{chunk-RX3U7JKF.js → chunk-FZWLWFR4.js} +1 -1
- package/dist/chunk-G5UCEXP6.js +1 -0
- package/dist/{chunk-WOPZX56J.js → chunk-GDOO2YZW.js} +1 -1
- package/dist/{chunk-V5WVGPOP.js → chunk-IKBE3HOH.js} +1 -1
- package/dist/{chunk-NGU7RYXA.js → chunk-K52IQX3J.js} +1 -1
- package/dist/{chunk-DT3LRKZQ.js → chunk-KDVNRNDU.js} +1 -1
- package/dist/chunk-LARREYZN.js +1 -0
- package/dist/{chunk-MXI2DWLL.js → chunk-LFY7KTPD.js} +1 -1
- package/dist/{chunk-SRCZX2KC.js → chunk-P36TACKN.js} +1 -1
- package/dist/{chunk-4KEZQLBU.js → chunk-PFAGXI3G.js} +1 -1
- package/dist/chunk-ROOPODG6.js +2 -0
- package/dist/{chunk-G3ZC5W4U.js → chunk-SZHRPELL.js} +1 -1
- package/dist/{chunk-DJH2CH42.js → chunk-UHIN3RS6.js} +1 -1
- package/dist/{chunk-FS3WLRQ4.js → chunk-VWBWDDU2.js} +1 -1
- package/dist/chunk-VXFIMEC6.js +2 -0
- package/dist/{chunk-ZW4QV6SB.js → chunk-WHBKKJ7L.js} +1 -1
- package/dist/chunk-WXUCAVFT.js +681 -0
- package/dist/chunk-X7OI24LO.js +418 -0
- package/dist/{chunk-RPM67N7A.js → chunk-XHUM372O.js} +1 -1
- package/dist/chunk-ZGVODK5C.js +12 -0
- package/dist/{create-7UENFCJK.js → create-ZFSFWAW3.js} +1 -1
- package/dist/{demo-kit-ALW6OSQV.js → demo-kit-QNGY4KQ5.js} +1 -1
- package/dist/{doctor-KGADT4PI.js → doctor-4KL4XUCS.js} +1 -1
- package/dist/{dotnet-webapi-clean-6Z4EXEJY.js → dotnet-webapi-clean-GXTNZMKO.js} +1 -1
- package/dist/{goal-lifecycle-HIQGDEEP.js → goal-lifecycle-EXQZD7IA.js} +1 -1
- package/dist/{goal-pack-63PEP2ND.js → goal-pack-DKJU2DEP.js} +1 -1
- package/dist/{gofiber-standard-TDJQIVQZ.js → gofiber-standard-PFBIAMGR.js} +1 -1
- package/dist/{gogin-standard-UEF3IHSJ.js → gogin-standard-DW5GL7YG.js} +1 -1
- package/dist/index.js +182 -174
- package/dist/{pipeline-VFI35PR4.js → pipeline-4GVAOCEN.js} +1 -1
- package/dist/{project-agent-entry-Z3OY3S7T.js → project-agent-entry-7QKNEEXP.js} +1 -1
- package/dist/{project-intelligence-lens-YWICXW6P.js → project-intelligence-lens-IHRYCLNU.js} +1 -1
- package/dist/{proof-carrying-change-BAP2C3KV.js → proof-carrying-change-O37XUPIZ.js} +1 -1
- package/dist/{rust-axum-4TRVPFMB.js → rust-axum-L7UAYARA.js} +1 -1
- package/dist/{springboot-standard-COWL75GT.js → springboot-standard-CZH24KWD.js} +1 -1
- package/dist/verified-goal-XI4RQESU.js +1 -0
- package/dist/{workspace-PAXTJCMH.js → workspace-EYXAKMVI.js} +1 -1
- package/dist/{workspace-agent-sync-MGCEF4ON.js → workspace-agent-sync-SN55KT6N.js} +1 -1
- package/dist/{workspace-context-2G6QZ6D3.js → workspace-context-PW6ESEHH.js} +1 -1
- package/dist/{workspace-contract-VWPOIYHJ.js → workspace-contract-FPLFL4G3.js} +1 -1
- package/dist/{workspace-explain-HLEBUK4K.js → workspace-explain-TVQ5IF5D.js} +1 -1
- package/dist/{workspace-foundation-X7LOGTS3.js → workspace-foundation-DWIJPZRH.js} +1 -1
- package/dist/{workspace-graph-stream-XGSRDRLI.js → workspace-graph-stream-RUTNWLQB.js} +1 -1
- package/dist/workspace-graph-token-efficiency-WF6TGSK7.js +1 -0
- package/dist/{workspace-intelligence-GFJKIWBX.js → workspace-intelligence-4CA2CSPZ.js} +1 -1
- package/dist/{workspace-intelligence-benchmark-R5MEGJQS.js → workspace-intelligence-benchmark-V6AEVDMB.js} +1 -1
- package/dist/{workspace-intelligence-runner-BU6JKNUD.js → workspace-intelligence-runner-VM5SXXAT.js} +1 -1
- package/dist/{workspace-knowledge-graph-OUTCLYS2.js → workspace-knowledge-graph-JXN2ZOAF.js} +1 -1
- package/dist/workspace-knowledge-graph-query-BROIV27M.js +1 -0
- package/dist/workspace-knowledge-graph-snapshot-KBNUXA64.js +1 -0
- package/dist/{workspace-mcp-serve-JYUKX3YS.js → workspace-mcp-serve-4WN4CSD7.js} +1 -1
- package/dist/{workspace-model-DUGPW5IB.js → workspace-model-D4IECQML.js} +1 -1
- package/dist/{workspace-onboarding-C4CKWTJ3.js → workspace-onboarding-6XWDKLM5.js} +1 -1
- package/dist/{workspace-registry-summary-4KX4QD55.js → workspace-registry-summary-Y3ET36NH.js} +1 -1
- package/dist/{workspace-repair-engine-OVW4J3DI.js → workspace-repair-engine-HBUXRHDY.js} +1 -1
- package/dist/workspace-run-VN7KV4BU.js +1 -0
- package/dist/{workspace-verify-B7HEFYO6.js → workspace-verify-OOAZ3NMZ.js} +1 -1
- package/dist/{workspace-watch-TQYAMLIV.js → workspace-watch-BNM5B6HU.js} +1 -1
- package/docs/README.md +1 -1
- package/docs/agent-framework-adapters.md +33 -14
- package/docs/ci-workflows.md +31 -8
- package/docs/commands-reference.md +24 -11
- package/docs/creating-workspaces-and-projects.md +28 -10
- package/docs/doctor-command.md +4 -0
- package/docs/native-kit-baselines.md +3 -0
- package/docs/workspace-operations.md +12 -2
- package/docs/workspace-run.md +8 -0
- package/package.json +5 -4
- package/dist/analyze-FRQVJ3VJ.js +0 -1
- package/dist/autopilot-release-D3UES53H.js +0 -1
- package/dist/chunk-36VNERGC.js +0 -1
- package/dist/chunk-4DX4HBG3.js +0 -4
- package/dist/chunk-CMLLERGG.js +0 -418
- package/dist/chunk-D4AMCZJU.js +0 -7
- package/dist/chunk-LMOTDLJF.js +0 -2
- package/dist/chunk-NFWUAEVQ.js +0 -12
- package/dist/chunk-O2CFT2A3.js +0 -1
- package/dist/chunk-O5XQP5E7.js +0 -1
- package/dist/chunk-P5RZO5BY.js +0 -681
- package/dist/chunk-TXVMHEJS.js +0 -1
- package/dist/chunk-YP436V7Q.js +0 -2
- package/dist/chunk-ZKYH44ER.js +0 -1
- package/dist/verified-goal-A6WOMNTU.js +0 -1
- package/dist/workspace-graph-token-efficiency-YHXFGH3Z.js +0 -1
- package/dist/workspace-knowledge-graph-query-TT2KK3SF.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-XWJRUMAC.js +0 -1
- package/dist/workspace-run-NVQGRZYO.js +0 -1
package/dist/chunk-P5RZO5BY.js
DELETED
|
@@ -1,681 +0,0 @@
|
|
|
1
|
-
import {m,g,f,h as h$2}from'./chunk-YP436V7Q.js';import {b as b$3}from'./chunk-MXI2DWLL.js';import {b as b$6,a as a$3}from'./chunk-D5LLTUTY.js';import {b as b$1}from'./chunk-B6FJ6RG6.js';import {a as a$2}from'./chunk-GE46XKD2.js';import {e as e$1,g as g$1,h as h$1,c as c$2,i as i$1,f as f$1,b as b$5,d as d$3}from'./chunk-CMLLERGG.js';import {g as g$2}from'./chunk-LMOTDLJF.js';import {e,c as c$1}from'./chunk-252EKOR6.js';import {i,b as b$4,k as k$1,j,m as m$1,t,s as s$1,q}from'./chunk-RGNCL5OB.js';import {h,e as e$2,b as b$2,d as d$1}from'./chunk-6B7L4NZE.js';import {a}from'./chunk-TQEMLBAG.js';import {b,a as a$1,c,d as d$2}from'./chunk-VQZ5PI5J.js';import {promises}from'fs';import*as k from'fs-extra';import d from'path';import s from'chalk';import {execa}from'execa';function ct(e){let n=e.projectCount??0,t=n===1?"project":"projects",o=e.pythonEngine==="installed"?`Python ${e.pythonVersion||"3.10+"} \xB7 ${e.installMethod||"local environment"}`:e.pythonEngine==="skipped"?"Python engine not installed":"Runtime-neutral foundation";return ["","\u2713 Workspace ready",`${e.workspaceName} \xB7 ${e.profile} \xB7 ${n} registered ${t}`,`Location ${e.workspacePath}`,`Runtime ${o}`,...e.note?[`Note ${e.note}`]:[],"","Workspace Intelligence"," \u2713 Contract and project registry"," \u2713 Canonical model and proof-backed graph"," \u2713 Agent context, grounding, and evidence index","","Next",` ${h$2(e.workspacePath)}`," npx workspai create"," npx workspai workspace intelligence run --for-agent generic --strict --json","","Evidence .workspai/reports/INDEX.json","Guide README.md",""]}function B(e){let n=ct(e);for(let t of n)t==="\u2713 Workspace ready"?console.log(s.green.bold(t)):t==="Workspace Intelligence"||t==="Next"?console.log(s.cyan.bold(t)):t.startsWith(" \u2713")?console.log(s.green(t)):t.startsWith("Location")||t.startsWith("Runtime")?console.log(s.gray(t)):console.log(t);}function T(){return i()}var pt="transactions";function dt(){return d.join(q(),pt)}async function He(){let e=dt();return await b$6(e),a$3({journalDirectory:e})}async function Ue(e){for(let n of s$1())await e.captureFile(n);}async function se(e){let n=await He();try{return await Ue(n),await n.captureOwnedTree(e),n}catch(t){return F(n,t)}}async function ut(e){let n=await He();try{await Ue(n),await n.captureOwnedTree(d.join(e,a$1)),await n.captureOwnedTree(d.join(e,".venv"));let t=[c,".gitignore",d.join(a$1,"workspace.json"),d.join(a$1,"toolchain.lock"),d.join(a$1,"policies.yml"),d.join(a$1,"cache-config.yml"),g$2,a$2,"pyproject.toml","poetry.toml","poetry.lock","rapidkit","rapidkit.cmd","README.md",".rapidkit-global"];for(let o of t)await n.captureFile(d.join(e,o));return n}catch(t){return F(n,t)}}async function J(e){await e.commit(),e.journalPath&&await promises.rm(d.dirname(e.journalPath),{recursive:true,force:true}).catch(n=>e$2.debug(`Could not remove committed lifecycle journal: ${n}`));}async function F(e,n){try{await e.rollback();}catch(t){throw new AggregateError([n,t],"Workspace lifecycle failed and rollback was incomplete.")}throw n}async function Q(e$1,n,t,o,a){let l=e(n,h(),t,a?.pythonEngine?{coreStatus:a.pythonEngine,...a.pythonEngineReason?{coreReason:a.pythonEngineReason}:{},...o?{pythonVersion:o}:{}}:void 0);o&&!a?.pythonEngine&&(l.metadata||(l.metadata={}),l.metadata.python={pythonVersion:o}),await c$1(e$1,l);}async function H(e){await k.outputFile(d.join(e,".gitignore"),`.venv/
|
|
2
|
-
__pycache__/
|
|
3
|
-
*.pyc
|
|
4
|
-
.env
|
|
5
|
-
${d$2}
|
|
6
|
-
${b}/
|
|
7
|
-
|
|
8
|
-
`,"utf-8");}async function qe(e){try{let n=await execa("git",["rev-parse","--show-toplevel"],{cwd:e,env:a()});return n.stdout.trim()?d.resolve(e,n.stdout.trim()):null}catch{return null}}function mt(e){if(!e||typeof e!="object")return String(e??"");let n=e;return [n.message,n.shortMessage,n.stderr].filter(t=>typeof t=="string").join(`
|
|
9
|
-
`)}function yt(e){return /(?:gpg|sign(?:ed|ing|ature)?|pinentry|cancel(?:led|ed))/i.test(mt(e))}async function X(e,n,t){if(await qe(e)){n.warn("Git initialization skipped because target is already inside a git worktree");return}n.start("Initializing git repository");try{await execa("git",["init"],{cwd:e,env:a()});}catch{n.warn("Could not initialize git repository");return}try{await execa("git",["add","."],{cwd:e,env:a()});}catch{n.warn("Git repository initialized, but generated files could not be staged");return}try{await execa("git",["-c","user.name=Workspai","-c","user.email=workspai@localhost","commit","-m",t],{cwd:e,env:a()}),n.succeed("Git repository initialized");}catch(a){n.warn(yt(a)?"Git repository initialized; signed initial commit was not created. Files remain staged.":"Git repository initialized; initial commit was not created. Files remain staged.");}}async function Ye(e,n){let t=n.replace(/[^a-z0-9-]/gi,"-").toLowerCase();await k.outputFile(d.join(e,"poetry.toml"),`[virtualenvs]
|
|
10
|
-
in-project = true
|
|
11
|
-
`,"utf-8"),await k.outputFile(d.join(e,"pyproject.toml"),`[tool.poetry]
|
|
12
|
-
name = "${t}"
|
|
13
|
-
version = "0.1.0"
|
|
14
|
-
description = "Workspai workspace"
|
|
15
|
-
authors = []
|
|
16
|
-
package-mode = false
|
|
17
|
-
|
|
18
|
-
[tool.poetry.dependencies]
|
|
19
|
-
python = "^3.10"
|
|
20
|
-
rapidkit-core = "*"
|
|
21
|
-
|
|
22
|
-
[build-system]
|
|
23
|
-
requires = ["poetry-core"]
|
|
24
|
-
build-backend = "poetry.core.masonry.api"
|
|
25
|
-
`,"utf-8");}function ze(e,n,t,o,a){return JSON.stringify({schema_version:"1.0",workspace_name:e,workspai_version:h(),rapidkit_version:h(),created_at:new Date().toISOString(),created_by:"workspai",profile:o||"minimal",...a?.profileRequested?{profile_requested:a.profileRequested}:{},...a?.bootstrapNote?{bootstrap_note:a.bootstrapNote}:{},engine:{install_method:n,python_version:t||null,...a?.pythonEngine?{python_core:{status:a.pythonEngine,...a.pythonEngineReason?{reason:a.pythonEngineReason}:{}}}:{}}},null,2)}function Be(e,n,t,o,a,l){return JSON.stringify({schema_version:"1.0",generated_by:"workspai",generated_at:new Date().toISOString(),runtime:{python:{version:n||null,install_method:e,...l?.pythonEngine?{core:{status:l.pythonEngine,...l.pythonEngineReason?{reason:l.pythonEngineReason}:{}}}:{}},node:{version:t||process.version},go:{version:o||null},java:{version:null,build_tool:null,build_tool_version:null},dotnet:{version:a||null,sdk:a||null}}},null,2)}function Je(){return `version: "1.0"
|
|
26
|
-
mode: warn # "warn" or "strict"
|
|
27
|
-
dependency_sharing_mode: isolated # "isolated" or "shared-runtime-caches" or "shared-node-deps"
|
|
28
|
-
# change profile (recommended): npx workspai bootstrap --profile polyglot
|
|
29
|
-
# change mode/dependency manually: edit this file and rerun npx workspai init
|
|
30
|
-
rules:
|
|
31
|
-
enforce_workspace_marker: true
|
|
32
|
-
enforce_toolchain_lock: false
|
|
33
|
-
disallow_untrusted_tool_sources: false
|
|
34
|
-
`}function Qe(){return `version: "1.0"
|
|
35
|
-
cache:
|
|
36
|
-
strategy: shared # "shared" or "on-demand"
|
|
37
|
-
prune_on_bootstrap: false
|
|
38
|
-
self_heal: true
|
|
39
|
-
verify_integrity: false
|
|
40
|
-
`}async function Xe(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),n=e.match(/go(\d+\.\d+(?:\.\d+)?)/i);return n?n[1]:void 0}catch{return}}async function Ze(){try{let{stdout:e}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),n=e.trim();return n.length>0?n:void 0}catch{return}}async function Z(e,n,t,o,a,l){let[u,g]=await Promise.all([Xe(),Ze()]),c=[{fileName:"workspace.json",content:ze(n,t,o,a,l)},{fileName:"toolchain.lock",content:Be(t,o,process.version,u,g,l)},{fileName:"policies.yml",content:Je()},{fileName:"cache-config.yml",content:Qe()}];for(let h of c)await k.outputFile(d.join(e,a$1,h.fileName),h.content,"utf-8");}async function nn(e$1,n){let{workspaceName:t=d.basename(e$1),installMethod:o="venv",pythonVersion:a,profile:l,writeMarker:u=true,writeGitignore:g=true,onlyIfMissing:c$2=true}=n||{},h$1=[],[y,f]=await Promise.all([Xe(),Ze()]),p=[{relPath:d.join(a$1,"workspace.json"),legacyRelPath:d.join(b,"workspace.json"),content:ze(t,o,a,l)},{relPath:d.join(a$1,"toolchain.lock"),legacyRelPath:d.join(b,"toolchain.lock"),content:Be(o,a,process.version,y,f)},{relPath:d.join(a$1,"policies.yml"),legacyRelPath:d.join(b,"policies.yml"),content:Je()},{relPath:d.join(a$1,"cache-config.yml"),legacyRelPath:d.join(b,"cache-config.yml"),content:Qe()}];for(let r of p){let i=d.join(e$1,r.relPath),_=d.join(e$1,r.legacyRelPath),P=await k.pathExists(i),R=await k.pathExists(_);c$2&&P||(c$2&&R?(await k.copy(_,i),h$1.push(r.relPath)):(await k.outputFile(i,r.content,"utf-8"),h$1.push(r.relPath)));}if(u&&(!await k.pathExists(d.join(e$1,c))||!c$2)){let i=e(t,h(),o);a&&(i.metadata||(i.metadata={}),i.metadata.python={pythonVersion:a}),await c$1(e$1,i),h$1.push(c);}if(g){let r=d.join(e$1,".gitignore");(!c$2||!await k.pathExists(r))&&(await H(e$1),h$1.push(".gitignore"));}return h$1}var gt={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"};function ht(e){let n=e,t=new Set;for(;!m(n);){if(t.has(n))return "minimal";t.add(n);let o=gt[n];if(!o)return "minimal";n=o;}return n}var G="3.10",et=["3.10","3.11","3.12"];async function xe(e){try{let{stdout:n}=await execa(e,["--version"],{timeout:3e3}),t=n.match(/Python (\d+\.\d+\.\d+)/);if(t)return t[1]}catch{}return null}async function ft(e,n){try{await promises.writeFile(d.join(e,".python-version"),`${n}
|
|
41
|
-
`,"utf-8"),e$2.debug(`Created .python-version with ${n}`);}catch(t){e$2.warn(`Failed to create .python-version: ${t}`);}}function le(){let t$1=[...(process.env.PATH||"").split(d.delimiter).filter(Boolean)];for(let o of t())t$1.includes(o)||t$1.unshift(o);process.env.PATH=t$1.join(d.delimiter);}async function he(e,n){le(),e.start("Checking pipx installation");try{return await execa("pipx",["--version"]),e.succeed("pipx found"),{kind:"binary"}}catch{}let t=T();try{return await execa(t,["-m","pipx","--version"]),e.succeed("pipx found"),{kind:"python-module",pythonCmd:t}}catch{}if(n)throw new d$3;try{await execa(t,["-m","pip","--version"],{timeout:2500});}catch{throw new h$1}e.stop?.();let{installPipx:o}=await b$1([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!o)throw new d$3;e.start("Installing pipx (user install)");try{try{await execa(t,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(t,["-m","pip","install","--user","--upgrade","pipx"]);}catch(a){let l=a,u=String(l?.stderr||l?.shortMessage||l?.message||"");throw new f$1("Install pipx with python -m pip",a instanceof Error?a:new Error(u))}e.succeed("pipx installed"),le();try{return await execa(t,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:t}}catch(a){let l=a,u=String(l?.stderr||l?.shortMessage||l?.message||"pipx not runnable after install");throw new f$1("Verify pipx after install",new Error(`${u}
|
|
42
|
-
|
|
43
|
-
Try reopening your terminal or run: ${t} -m pipx ensurepath`))}}async function U(e,n){return e.kind==="binary"?execa("pipx",n):execa(e.pythonCmd,["-m","pipx",...n])}function tt(e){let n=e.match(/^(\d+)\.(\d+)/);return n?`${n[1]}.${n[2]}`:null}function Ge(e){if(!e)return null;let n=e.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return n?`${n[1]}.${n[2]}`:null}function Ie(e,n){let[t,o]=e.split(".").map(u=>Number(u)),[a,l]=n.split(".").map(u=>Number(u));return t!==a?t-a:o-l}function ee(e,n){return Ie(e,n)>=0}async function wt(e){let n=new Set,t=k$1(14,10);for(let f of t)try{let p=await execa(f.command,f.args,{timeout:2500}),r=Ge(`${p.stdout||""}
|
|
44
|
-
${p.stderr||""}`);r&&ee(r,G)&&n.add(r);}catch{}let o=null;try{let f=await execa(T(),["--version"],{timeout:2500}),p=Ge(`${f.stdout||""}
|
|
45
|
-
${f.stderr||""}`);p&&ee(p,G)&&(o=p,n.add(p));}catch{}let a=et.filter(f=>ee(f,G)),l=new Set([...a,...n]),u=Array.from(l).sort((f,p)=>Ie(p,f)),g=e?tt(e):null,c=g&&ee(g,G)?g:o||u[0]||G;return l.has(c)||l.add(c),{choices:Array.from(l).sort((f,p)=>Ie(p,f)).map(f=>{let p=[];return f===o&&p.push("current system"),f===G&&p.push("minimum supported"),n.has(f)&&f!==o&&p.push("detected"),{name:p.length>0?`${f} (${p.join(", ")})`:f,value:f}}),defaultValue:c}}async function vt(){le();let e=false,n=false,t=false,o=false;try{await execa("poetry",["--version"],{timeout:2500}),e=true;}catch{e=false;}try{await execa("pipx",["--version"],{timeout:2500}),n=true;}catch{let l=i();try{await execa(l,["-m","pipx","--version"],{timeout:2500}),n=true;}catch{n=false;}}let a=i();try{await execa(a,["-m","pip","--version"],{timeout:2500}),t=true;}catch{t=false;}try{await execa(a,["-c","import venv, ensurepip"],{timeout:2500}),o=true;}catch{o=false;}return {poetry:e,pipx:n,pip:t,venv:o}}function kt(e,n){return e==="poetry"&&n.poetry?"poetry":e==="pipx"&&n.pipx?"pipx":e==="venv"&&n.venv?"venv":n.poetry?"poetry":n.venv?"venv":"pipx"}async function Pt(e,n){le(),e.start("Checking Poetry installation");try{await execa("poetry",["--version"]),e.succeed("Poetry found");return}catch{}if(n)throw new c$2;let{installPoetry:t}=await b$1([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!t)throw new c$2;let o=await he(e,n);e.start("Installing Poetry with pipx");try{await U(o,["install","poetry"]);}catch(a){let l=a,u=String(l?.stderr||l?.shortMessage||l?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(u))try{await U(o,["upgrade","poetry"]);}catch{}else throw new f$1("Install Poetry with pipx",a instanceof Error?a:new Error(u))}e.succeed("Poetry installed"),le();try{await execa("poetry",["--version"]);}catch(a){let l=a,u=String(l?.stderr||l?.shortMessage||l?.message||"Poetry not found on PATH");throw new f$1("Verify Poetry after pipx install",new Error(`${u}
|
|
46
|
-
|
|
47
|
-
Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function bt(e,n={}){let t=e==="poetry",o=n.pythonEngineSkipped?`echo "- Python engine installation was intentionally skipped for this workspace." 1>&2
|
|
48
|
-
echo "- For npm-owned workspace commands, run: npx workspai <command>" 1>&2
|
|
49
|
-
echo "- To install the local Python engine later, create a RapidKit Core module-enabled project, then run: npx workspai workspace run init" 1>&2
|
|
50
|
-
`:`echo "- If you used venv: ensure .venv exists (or re-run the installer)." 1>&2
|
|
51
|
-
`;return `#!/usr/bin/env sh
|
|
52
|
-
set -eu
|
|
53
|
-
|
|
54
|
-
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
55
|
-
|
|
56
|
-
VENV_RAPIDKIT="$SCRIPT_DIR/.venv/bin/rapidkit"
|
|
57
|
-
if [ -x "$VENV_RAPIDKIT" ]; then
|
|
58
|
-
exec "$VENV_RAPIDKIT" "$@"
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
|
-
${t?`if command -v poetry >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/pyproject.toml" ]; then
|
|
62
|
-
exec poetry run rapidkit "$@"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
`:""}if command -v rapidkit >/dev/null 2>&1; then
|
|
66
|
-
RAPIDKIT_CMD=$(command -v rapidkit)
|
|
67
|
-
if [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/rapidkit" ] && [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/.workspai/rapidkit" ] && [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/.rapidkit/rapidkit" ]; then
|
|
68
|
-
RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1 exec "$RAPIDKIT_CMD" "$@"
|
|
69
|
-
fi
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
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
|
|
73
|
-
if [ -x "$RAPIDKIT_CORE" ]; then
|
|
74
|
-
exec "$RAPIDKIT_CORE" "$@"
|
|
75
|
-
fi
|
|
76
|
-
done
|
|
77
|
-
|
|
78
|
-
echo "RapidKit launcher could not find a local Python CLI." 1>&2
|
|
79
|
-
${o}${n.pythonEngineSkipped?"":t?`echo "- If you used Poetry: run 'poetry install' and retry, or activate the env." 1>&2
|
|
80
|
-
`:""}${n.pythonEngineSkipped?`echo "Tip: use 'npx workspai workspace model --json' for Workspace Intelligence without the Python engine." 1>&2
|
|
81
|
-
`:`echo "Tip: you can also run: ./.venv/bin/rapidkit --help" 1>&2
|
|
82
|
-
`}exit 1
|
|
83
|
-
`}function Rt(e,n={}){let t=e==="poetry",o=n.pythonEngineSkipped?`echo - Python engine installation was intentionally skipped for this workspace. 1>&2
|
|
84
|
-
echo - For npm-owned workspace commands, run: npx workspai ^<command^> 1>&2
|
|
85
|
-
echo - To install the local Python engine later, create a RapidKit Core module-enabled project, then run: npx workspai workspace run init 1>&2
|
|
86
|
-
`:`echo Tip: run .venv\\Scripts\\rapidkit.exe --help 1>&2
|
|
87
|
-
`;return `@echo off
|
|
88
|
-
setlocal
|
|
89
|
-
|
|
90
|
-
set "SCRIPT_DIR=%~dp0"
|
|
91
|
-
|
|
92
|
-
if exist "%SCRIPT_DIR%\\.venv\\Scripts\\rapidkit.exe" (
|
|
93
|
-
"%SCRIPT_DIR%\\.venv\\Scripts\\rapidkit.exe" %*
|
|
94
|
-
exit /b %ERRORLEVEL%
|
|
95
|
-
)
|
|
96
|
-
|
|
97
|
-
${t?`where poetry >nul 2>nul
|
|
98
|
-
if %ERRORLEVEL%==0 if exist "%SCRIPT_DIR%\\pyproject.toml" (
|
|
99
|
-
poetry run rapidkit %*
|
|
100
|
-
exit /b %ERRORLEVEL%
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
`:""}:rapidkit_npm_wrapper_fallback
|
|
104
|
-
for /f "delims=" %%R in ('where rapidkit.cmd 2^>nul') do (
|
|
105
|
-
if /I not "%%~fR"=="%SCRIPT_DIR%rapidkit.cmd" if /I not "%%~fR"=="%SCRIPT_DIR%.workspai\\rapidkit.cmd" if /I not "%%~fR"=="%SCRIPT_DIR%.rapidkit\\rapidkit.cmd" (
|
|
106
|
-
set "RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1"
|
|
107
|
-
"%%~fR" %*
|
|
108
|
-
exit /b %ERRORLEVEL%
|
|
109
|
-
)
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
:rapidkit_core_fallback
|
|
113
|
-
for %%R in ("%USERPROFILE%\\.local\\bin\\rapidkit.exe" "%APPDATA%\\Python\\Scripts\\rapidkit.exe" "%LOCALAPPDATA%\\Programs\\Python\\Scripts\\rapidkit.exe") do (
|
|
114
|
-
if exist "%%~R" (
|
|
115
|
-
"%%~R" %*
|
|
116
|
-
exit /b %ERRORLEVEL%
|
|
117
|
-
)
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
echo RapidKit launcher could not find a local Python CLI. 1>&2
|
|
121
|
-
${o}echo Tip: for npm-owned workspace commands, run npx --yes --package workspai workspai %* from a shell where npm is on PATH. 1>&2
|
|
122
|
-
exit /b 1
|
|
123
|
-
`}async function ge(e,n,t={}){await k.outputFile(d.join(e,"rapidkit"),bt(n,t),{encoding:"utf-8",mode:493}),await k.outputFile(d.join(e,"rapidkit.cmd"),Rt(n,t),"utf-8");}async function on(e,n){let{skipGit:t=false,skipPythonEngine:o=false,testMode:a=false,demoMode:l=false,dryRun:u=false,yes:g$2=false,userConfig:c={},installMethod:h,profile:y,parentDirectory:f,suppressReceipt:p=false}=n,r=e||"rapidkit",i$1=f?d.resolve(f,r):d.resolve(process.cwd(),r);if(await k.pathExists(i$1))throw new e$1(r);if(await g(i$1),u){let w=y||(g$2?"minimal":void 0),I=h||c.defaultInstallMethod||"poetry",E=c.pythonVersion||"3.10";await It(i$1,r,l,c,w,I,E,t,o);return}if(l){await xt(i$1,r,t);return}let _=new Set(["python-only","polyglot","enterprise"]),P=y||"";if(!g$2&&!y){let{selectedProfile:w}=await b$1([{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}]);P=w;}else P||(P="minimal");let R=!g$2&&_.has(P),O=_.has(P)?o?"skip":R?(await b$1([{type:"confirm",name:"installPythonEngine",message:"Install the optional RapidKit Python engine now? (needed for Python-backed kits/modules)",default:true}])).installPythonEngine!==false?"install":"skip":"install":"skip",ce=R&&O==="install",at=typeof c.pythonVersion=="string"&&c.pythonVersion.trim().length>0?c.pythonVersion.trim():void 0,rt=h||c.defaultInstallMethod||"poetry",A=O==="install"?await vt():{poetry:true,pipx:true,pip:true,venv:true},_e=ce?await wt(at):{choices:et.map(w=>({name:w,value:w})),defaultValue:G},st=kt(rt,A),lt=[{name:A.poetry?"\u{1F3AF} Poetry (Recommended - includes virtual env + dependency mgmt)":A.pipx||A.pip?"\u{1F3AF} Poetry (Recommended) \u2014 not detected (can be installed)":"\u{1F3AF} Poetry (Recommended) \u2014 unavailable (system pipx package required)",value:"poetry"},{name:A.venv?"\u{1F4E6} pip with venv (Standard, zero extra tools)":"\u{1F4E6} pip with venv \u2014 unavailable (system venv package required)",value:"venv"},{name:A.pipx?"\u{1F527} pipx (Global isolated - RapidKit Core only, no local venv)":A.pip?"\u{1F527} pipx (Global isolated) \u2014 not detected (can be installed)":"\u{1F527} pipx (Global isolated) \u2014 unavailable (system pipx package required)",value:"pipx"}],x=ce?await b$1([{type:"rawlist",name:"pythonVersion",message:"Select minimum Python version for RapidKit:",choices:_e.choices,default:_e.defaultValue},{type:"rawlist",name:"installMethod",message:"How would you like to manage the workspace environment?",choices:lt,default:st}]):await(async()=>{if(O==="skip")return {pythonVersion:c.pythonVersion||"3.10",installMethod:"venv"};let w=h||c.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return e$2.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})();return {pythonVersion:c.pythonVersion||"3.10",installMethod:w}})();if(m(P)){let w=b$2("Creating workspace",{component:"create",phase:"workspace.python-free"}),I=await se(i$1);try{await k.ensureDir(i$1),w.succeed("Directory created"),await Q(i$1,r,"venv",void 0),await Z(i$1,r,"venv",void 0,P,{bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"workspace-profile-does-not-install-python-at-create"}),await H(i$1);let E=await b$3(i$1,{workspaceName:r,silent:true});await J(I),t||await X(i$1,w,"Initial commit: Workspai workspace"),p||B({workspaceName:r,workspacePath:i$1,profile:P,projectCount:E?.projectCount??0});}catch(E){return w.fail("Failed to create workspace"),F(I,E)}return}if(_.has(P)&&O==="skip"){let w=b$2("Creating workspace",{component:"create",phase:"workspace.python-engine-skipped"}),I=await se(i$1);try{await k.ensureDir(i$1),w.succeed("Directory created");let E={bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"user-opted-out"};await Q(i$1,r,"venv",void 0,E),await Z(i$1,r,"venv",void 0,P,E),await H(i$1),await ge(i$1,"venv",{pythonEngineSkipped:true});let b=await b$3(i$1,{workspaceName:r,silent:true});await J(I),t||await X(i$1,w,`Initial commit: Workspai workspace (${P})`),p||B({workspaceName:r,workspacePath:i$1,profile:P,projectCount:b?.projectCount??0,pythonEngine:"skipped",note:"Install the optional Python engine later only when a Python-backed kit needs it."});return}catch(E){return w.fail("Failed to create workspace"),F(I,E)}}{let w=T(),I=false;try{await execa(w,["--version"],{timeout:5e3}),I=true;}catch{try{await execa("python",["--version"],{timeout:5e3}),I=true;}catch{I=false;}}if(!I){let E=P,b=ht(P);if(R&&!g$2){console.log(s.yellow(`
|
|
124
|
-
\u26A0\uFE0F Python 3.10+ is not detected on this system.
|
|
125
|
-
`)),console.log(s.cyan(`You have 3 options:
|
|
126
|
-
`));let{pythonAction:D}=await b$1([{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 "${b}" profile (no Python required)`,value:"fallback"},{name:"\u274C Cancel and install Python manually",value:"cancel"}]}]);if(D==="cancel"&&(console.log(s.cyan(`
|
|
127
|
-
\u{1F4A1} How to install Python:
|
|
128
|
-
`)),console.log(s.white(" Ubuntu / Debian: sudo apt install python3.10")),console.log(s.white(" macOS (Homebrew): brew install python@3.10")),console.log(s.white(` Windows: https://python.org/downloads
|
|
129
|
-
`)),console.log(s.gray(` After installing Python, run: npx workspai ${r}
|
|
130
|
-
`)),process.exit(1)),D==="install"){console.log(s.cyan(`
|
|
131
|
-
\u{1F4A1} Install Python on your system:
|
|
132
|
-
`));let S=process.platform;S==="linux"?console.log(s.white(` sudo apt update && sudo apt install python3.10 python3.10-venv
|
|
133
|
-
`)):S==="darwin"?console.log(s.white(` brew install python@3.10
|
|
134
|
-
`)):S==="win32"&&(console.log(s.white(` Download: https://python.org/downloads
|
|
135
|
-
`)),console.log(s.white(` Run the installer and check "Add Python to PATH"
|
|
136
|
-
`))),console.log(s.gray(` After installing, run: npx workspai ${r}
|
|
137
|
-
`)),process.exit(0);}if(D==="fallback"&&(console.log(s.green(`
|
|
138
|
-
\u2705 Switching to "${b}" profile (no Python required).
|
|
139
|
-
`)),P=b,m(b))){let S=b$2("Creating workspace",{component:"create",phase:"workspace.python-free"}),q=await se(i$1);try{await k.ensureDir(i$1),S.succeed("Directory created"),await Q(i$1,r,"venv",void 0),await Z(i$1,r,"venv",void 0,b,{profileRequested:E,bootstrapNote:"python-free-fallback",pythonEngine:"skipped",pythonEngineReason:"python-runtime-unavailable"}),await H(i$1);let fe=await b$3(i$1,{workspaceName:r,silent:true});await J(q),t||await X(i$1,S,`Initial commit: Workspai workspace (${b} profile)`),p||B({workspaceName:r,workspacePath:i$1,profile:b,projectCount:fe?.projectCount??0,note:`Requested ${E}; used ${b} because Python was unavailable.`});return}catch(fe){return S.fail("Failed to create workspace"),F(q,fe)}}}else if(console.log(s.yellow(`
|
|
140
|
-
\u26A0\uFE0F Python not detected. Auto-switching to "${b}" profile (no Python required).
|
|
141
|
-
`)),P=b,m(b)){let D=b$2("Creating workspace",{component:"create",phase:"workspace.python-free"}),S=await se(i$1);try{await k.ensureDir(i$1),D.succeed("Directory created"),await Q(i$1,r,"venv",void 0),await Z(i$1,r,"venv",void 0,b,{profileRequested:E,bootstrapNote:"python-free-fallback",pythonEngine:"skipped",pythonEngineReason:"python-runtime-unavailable"}),await H(i$1);let q=await b$3(i$1,{workspaceName:r,silent:true});await J(S),t||await X(i$1,D,`Initial commit: Workspai workspace (${b})`),p||B({workspaceName:r,workspacePath:i$1,profile:b,projectCount:q?.projectCount??0,note:`Requested ${E}; used ${b} because Python was unavailable.`});return}catch(q){return D.fail("Failed to create workspace"),F(S,q)}}}}if(x.installMethod==="venv"&&!A.venv){let w=await xe(i()),I=w?tt(w):null;throw new g$1(`python${I||x.pythonVersion}-venv`,d.basename(i$1))}if(x.installMethod==="pipx"&&!A.pipx&&!A.pip)throw new h$1;if(x.installMethod==="poetry"&&!A.poetry&&!A.pipx&&!A.pip)throw new c$2;let C=b$2("Creating directory",{component:"create",phase:"workspace.directory"}),Ce=await se(i$1);try{await k.ensureDir(i$1),C.succeed("Directory created"),C.start("Detecting Python version");let w=null,I=await nt(x.pythonVersion);if(I)w=await xe(I),w?(e$2.info(` Detected Python ${w}`),C.succeed(`Python ${w} detected`)):C.warn("Could not detect exact Python version");else {let b=T();w=await xe(b),w?C.succeed(`Python ${w} detected`):C.warn("Could not detect Python version, proceeding with defaults");}if(await Q(i$1,r,x.installMethod,w||void 0),await Z(i$1,r,x.installMethod,w||x.pythonVersion,P||y),await H(i$1),await Ye(i$1,r),x.installMethod==="poetry")try{await ot(i$1,x.pythonVersion,C,a,c,g$2);}catch(b){let te=b?.details||b?.message||String(b);if(te.includes("pyenv")||te.includes("exit status 127")||te.includes("returned non-zero exit status 127")){C.warn("Poetry encountered Python discovery issues, trying venv method"),e$2.debug(`Poetry error (attempting venv fallback): ${te}`);try{await Ee(i$1,x.pythonVersion,C,a,c),x.installMethod="venv";}catch(S){throw S}}else throw b}else x.installMethod==="venv"?await Ee(i$1,x.pythonVersion,C,a,c):await it(i$1,C,a,c,g$2);w&&await ft(i$1,w),await ge(i$1,x.installMethod),C.succeed("Workspai environment ready!");let E=await b$3(i$1,{workspaceName:r,silent:true});await J(Ce),n.skipGit||await X(i$1,C,"Initial commit: Workspai environment"),p||B({workspaceName:r,workspacePath:i$1,profile:P,projectCount:E?.projectCount??0,pythonEngine:"installed",pythonVersion:x.pythonVersion,installMethod:x.installMethod});}catch(w){return C.fail("Failed to create Workspai environment"),F(Ce,w)}}async function nt(e){let n=[];if(!b$4())try{let{stdout:l}=await execa("pyenv",["which","python"]),u=l.trim();u&&n.push(u);}catch{}let t=Number(e.split(".")[1]),o=k$1(t,10).map(l=>l.command).filter(Boolean);n.push(`python${e}`,...o,...j());let a=[...new Set(n)];for(let l of a)try{let u=l==="py"?["-3","--version"]:["--version"],g=l==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:c}=await execa(l,u,{timeout:2e3}),h=c.match(/Python (\d+\.\d+)/)?.[1];if(h&&ee(h,e))return await execa(l,g,{timeout:2e3}),l}catch{continue}return null}async function ot(e,n,t,o,a,l=false){await Pt(t,l),t.start("Finding Python interpreter");let u=await nt(n);u?(e$2.debug(`Found working Python: ${u}`),t.succeed("Python found")):t.warn("Could not verify Python path, proceeding with default"),t.start("Initializing Poetry project");let g=d.join(e,"pyproject.toml"),h=(await k.pathExists(g)?await promises.readFile(g,"utf-8"):"").includes("rapidkit-core");if(h)t.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${n}`],{cwd:e}),t.succeed("Poetry project initialized");let r=await promises.readFile(g,"utf-8");r.includes("[tool.poetry]")?r=r.replace("[tool.poetry]",`[tool.poetry]
|
|
142
|
-
package-mode = false`):r.includes("[project]")&&(r.includes("[build-system]")?r=r.replace("[build-system]",`
|
|
143
|
-
[tool.poetry]
|
|
144
|
-
package-mode = false
|
|
145
|
-
|
|
146
|
-
[build-system]`):r+=`
|
|
147
|
-
|
|
148
|
-
[tool.poetry]
|
|
149
|
-
package-mode = false
|
|
150
|
-
`),await promises.writeFile(g,r,"utf-8");}t.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:e}),t.succeed("Poetry configured");}catch{t.warn("Could not configure Poetry virtualenvs.in-project");}t.start("Creating virtualenv");let y=u||T(),f$2=m$1(d.join(e,".venv"));try{await execa(y,["-m","venv",".venv"],{cwd:e,timeout:6e4}),t.succeed("Virtualenv created");}catch(p){e$2.debug(`python -m venv failed: ${p}`),t.warn("Could not pre-create virtualenv, Poetry will try"),f$2=u||T();}try{await execa("poetry",["env","use",f$2||T()],{cwd:e}),e$2.debug(`Poetry env set to: ${f$2}`);}catch(p){e$2.debug(`Could not set Poetry env: ${p}`);}if(t.start("Installing RapidKit"),h&&!o){let p=f(a||{}),r=p?await k.pathExists(p):false,i=r&&p?p:"rapidkit-core";p&&!r&&e$2.warn(`WORKSPAI_DEV_PATH/RAPIDKIT_DEV_PATH points to a path that does not exist: ${p}. Falling back to PyPI.`),t.text=r?"Installing RapidKit from local path":"Installing RapidKit from PyPI";let _=false,P=null;for(let R=1;R<=3;R++)try{r||d$1({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:R,maxAttempts:3}),await execa(f$2,["-m","pip","install",i,"--quiet"],{cwd:e,timeout:18e4}),_=true,r||d$1({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:R,maxAttempts:3});break}catch(O){P=O,e$2.debug(`pip install rapidkit-core attempt ${R} failed: ${O}`),R<3&&(t.text=`Retrying installation (attempt ${R+1}/3)`,await new Promise(ce=>setTimeout(ce,2e3)));}if(!_){let R=P?.stderr||P?.message||"Unknown error";throw e$2.debug(`All pip install attempts failed. Last error: ${R}`),R.includes("Could not find")||R.includes("No matching distribution")?new i$1:new f$1("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
151
|
-
Error: ${R}
|
|
152
|
-
|
|
153
|
-
Possible solutions:
|
|
154
|
-
1. Check your internet connection
|
|
155
|
-
2. Try installing manually: cd ${d.basename(e)} && poetry add rapidkit-core
|
|
156
|
-
3. Use venv method instead: npx workspai ${d.basename(e)} --install-method=venv`))}}else {t.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:e,timeout:12e4}),t.succeed("Poetry environment synced");}catch(p){e$2.debug(`poetry install --no-root failed: ${p}`),t.warn("Could not sync Poetry environment, proceeding with add command");}if(t.start("Installing RapidKit"),o){let p=f(a||{});if(!p)throw new f$1("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));e$2.debug(`Installing from local path: ${p}`),t.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",p],{cwd:e});}else {t.text="Installing RapidKit from PyPI";let p=false,r=null;for(let i=1;i<=3;i++)try{d$1({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:i,maxAttempts:3}),await execa("poetry",["add","rapidkit-core"],{cwd:e,timeout:6e4*i}),p=true,d$1({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:i,maxAttempts:3});break}catch(_){r=_,e$2.debug(`Poetry add attempt ${i} failed: ${_}`),i<3&&(t.text=`Retrying installation (attempt ${i+1}/3)`,await new Promise(P=>setTimeout(P,2e3)));}if(!p){let i=r?.stderr||r?.message||"Unknown error";throw e$2.debug(`All Poetry install attempts failed. Last error: ${i}`),i.includes("Could not find")||i.includes("No matching distribution")?new i$1:new f$1("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
157
|
-
Error: ${i}
|
|
158
|
-
|
|
159
|
-
Possible solutions:
|
|
160
|
-
1. Check your internet connection
|
|
161
|
-
2. Try installing manually: cd ${d.basename(e)} && poetry add rapidkit-core
|
|
162
|
-
3. Use venv method instead: npx workspai ${d.basename(e)} --install-method=venv`))}}}t.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:p}=await import('./pythonRapidkitExec-UMFLDIYR.js');if(!await p()&&!o){t.start("Checking optional global pipx installation");let i=await he(t,true);try{t.start("Installing RapidKit globally with pipx for CLI access"),await U(i,["install","rapidkit-core"]),t.succeed("RapidKit installed globally");}catch(_){t.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),e$2.debug(`pipx install failed: ${_}`);}}}catch(p){t.succeed("Skipped optional global pipx installation"),e$2.debug(`Global install check skipped: ${p}`);}}async function Ee(e,n,t,o,a,l=false){t.start(`Checking Python ${n}`);let u=T();try{let{stdout:c}=await execa(u,["--version"]),h=c.match(/Python (\d+\.\d+)/)?.[1];if(h&&!ee(h,n))throw new b$5(n,h);t.succeed(`Python ${h} found`);}catch(c){throw c instanceof b$5?c:new b$5(n)}t.start("Creating virtual environment");try{await execa(u,["-m","venv",".venv"],{cwd:e}),t.succeed("Virtual environment created");}catch(c){if(t.fail("Failed to create virtual environment"),(y=>typeof y=="object"&&y!==null&&"stdout"in y&&typeof y.stdout=="string")(c)&&c.stdout.includes("ensurepip is not")){let y=c.stdout.match(/apt install (python[\d.]+-venv)/),f=y?y[1]:"python3-venv";throw new g$1(f,d.basename(e))}throw new f$1("Virtual environment creation",c instanceof Error?c:new Error(String(c)))}t.start("Installing RapidKit");let g=m$1(d.join(e,".venv"));if(await execa(g,["-m","pip","install","--upgrade","pip"],{cwd:e}),o){let c=f(a||{});if(!c)throw new f$1("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));e$2.debug(`Installing from local path: ${c}`),t.text="Installing RapidKit from local path (test mode)",await execa(g,["-m","pip","install","-e",c],{cwd:e});}else {t.text="Installing RapidKit from PyPI";let c=false,h=null;for(let y=1;y<=3;y++)try{d$1({status:"started",message:"Installing RapidKit from PyPI",installMethod:"venv",attempt:y,maxAttempts:3}),await execa(g,["-m","pip","install","rapidkit-core"],{cwd:e,timeout:6e4*y}),c=true,d$1({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"venv",attempt:y,maxAttempts:3});break}catch(f){h=f,e$2.debug(`pip install attempt ${y} failed: ${f}`),y<3&&(t.text=`Retrying installation (attempt ${y+1}/3)`,await new Promise(p=>setTimeout(p,2e3)));}if(!c){let y=h?.stderr||h?.message||"Unknown error";throw e$2.debug(`All pip install attempts failed. Last error: ${y}`),y.includes("Could not find")||y.includes("No matching distribution")?new i$1:new f$1("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
163
|
-
Error: ${y}
|
|
164
|
-
|
|
165
|
-
Possible solutions:
|
|
166
|
-
1. Check your internet connection
|
|
167
|
-
2. Try installing manually: cd ${d.basename(e)} && ${m$1(".venv")} -m pip install rapidkit-core
|
|
168
|
-
3. Use Poetry instead: npx workspai ${d.basename(e)} --install-method=poetry`))}}t.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:c}=await import('./pythonRapidkitExec-UMFLDIYR.js');if(!await c()&&!o){t.start("Checking optional global pipx installation");let y=await he(t,true);try{t.start("Installing RapidKit globally with pipx for CLI access"),await U(y,["install","rapidkit-core"]),t.succeed("RapidKit installed globally");}catch(f){t.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),e$2.debug(`pipx install failed: ${f}`);}}}catch(c){t.succeed("Skipped optional global pipx installation"),e$2.debug(`Global install check skipped: ${c}`);}}async function it(e,n,t,o,a=false){if(!t)try{let{checkRapidkitCoreVersionCompatible:u}=await import('./pythonRapidkitExec-UMFLDIYR.js'),g=await u();if(g.isCompatible){n.succeed(`RapidKit ${g.installedVersion??""} already compatible globally; skipping pipx installation`),await k.outputFile(d.join(e,".rapidkit-global"),`RapidKit already available globally (version ${g.installedVersion??"unknown"}) and satisfies expected constraint ${g.expectedConstraint??"n/a"}; workspace will reuse the existing installation
|
|
169
|
-
`,"utf-8");return}g.reason==="constraint-missing"?e$2.debug('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.'):g.reason==="constraint-unsupported"&&e$2.debug('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.'),e$2.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${g.reason}, installed=${g.installedVersion??"unknown"}, expected=${g.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(u){e$2.debug(`Global RapidKit version-aware check failed before pipx install: ${u}`);}let l=await he(n,a);if(n.start("Installing RapidKit globally with pipx"),t){let u=f(o||{});if(!u)throw new f$1("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));e$2.debug(`Installing from local path: ${u}`),n.text="Installing RapidKit from local path (test mode)",await U(l,["install","-e",u]);}else {n.text="Installing RapidKit from PyPI",d$1({status:"started",message:"Installing RapidKit from PyPI",installMethod:"pipx"});try{await U(l,["install","rapidkit-core"]),d$1({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"pipx"});}catch(u){try{n.text="RapidKit already installed globally, upgrading to match expected version",await U(l,["upgrade","rapidkit-core"]),d$1({status:"succeeded",message:"RapidKit upgraded from PyPI",installMethod:"pipx"});}catch(g){throw e$2.debug(`pipx install/upgrade failed: install=${u}, upgrade=${g}`),new i$1}}}n.succeed("RapidKit installed globally"),await k.outputFile(d.join(e,".rapidkit-global"),`RapidKit installed globally with pipx
|
|
170
|
-
`,"utf-8");}async function an(e,n){let{skipGit:t=false,installPythonEngine:o=false,testMode:a=false,userConfig:l={},yes:u=false,installMethod:g,pythonVersion:c="3.10"}=n||{},h="venv";o&&(h=g||l.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return e$2.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})());let y=b$2("Registering workspace",{component:"create",phase:"workspace.register"}),f=await ut(e);try{let p=d.basename(e),r=o?void 0:{bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"project-workspace-foundation"};await Q(e,p,h,o?c:void 0,r),await H(e),await Z(e,p,h,o?c:void 0,n?.profile??"minimal",r),o?h==="poetry"?(await Ye(e,p),await ot(e,c,y,a,l,u)):h==="venv"?await Ee(e,c,y,a,l):await it(e,y,a,l,u):await ge(e,h,{pythonEngineSkipped:true}),o&&await ge(e,h),y.succeed(o?"Workspace registered":"Workspace registered (Python engine skipped)"),await b$3(e,{workspaceName:d.basename(e),silent:a}),await J(f),t||await X(e,y,"Initial commit: Workspai workspace");}catch(p){return y.fail("Failed to register workspace"),F(f,p)}}async function xt(e,n,t){let o=b$2("Creating demo workspace",{component:"create",phase:"workspace.demo"});try{await k.ensureDir(e),o.succeed("Directory created"),o.start("Setting up demo kit generator");let a$1=JSON.stringify({name:`${n}-workspace`,version:"1.0.0",private:true,description:"Workspai demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(d.join(e,"package.json"),a$1,"utf-8"),await promises.writeFile(d.join(e,"generate-demo.js"),`#!/usr/bin/env node
|
|
171
|
-
/**
|
|
172
|
-
* Demo Kit Generator - Create FastAPI demo projects
|
|
173
|
-
*
|
|
174
|
-
* This workspace contains bundled Workspai templates that you can use
|
|
175
|
-
* to generate demo projects without installing Python RapidKit Core.
|
|
176
|
-
*
|
|
177
|
-
* Usage:
|
|
178
|
-
* npm run generate <project-name>
|
|
179
|
-
* node generate-demo.js <project-name>
|
|
180
|
-
*
|
|
181
|
-
* Example:
|
|
182
|
-
* npm run generate my-api
|
|
183
|
-
*/
|
|
184
|
-
|
|
185
|
-
const fs = require('fs');
|
|
186
|
-
const path = require('path');
|
|
187
|
-
const readline = require('readline');
|
|
188
|
-
|
|
189
|
-
const projectName = process.argv[2];
|
|
190
|
-
|
|
191
|
-
if (!projectName) {
|
|
192
|
-
console.error('\\n\u274C Please provide a project name');
|
|
193
|
-
console.log('\\nUsage: npm run generate <project-name>\\n');
|
|
194
|
-
console.log('Example: npm run generate my-api\\n');
|
|
195
|
-
process.exit(1);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const rl = readline.createInterface({
|
|
199
|
-
input: process.stdin,
|
|
200
|
-
output: process.stdout
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
function ask(question, defaultValue) {
|
|
204
|
-
return new Promise((resolve) => {
|
|
205
|
-
rl.question(\`\${question} (\${defaultValue}): \`, (answer) => {
|
|
206
|
-
resolve(answer || defaultValue);
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
async function main() {
|
|
212
|
-
const targetPath = path.join(process.cwd(), projectName);
|
|
213
|
-
|
|
214
|
-
if (fs.existsSync(targetPath)) {
|
|
215
|
-
console.error(\`\\n\u274C Directory "\${projectName}" already exists\\n\`);
|
|
216
|
-
process.exit(1);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
console.log(\`\\n\u{1F680} Creating FastAPI project: \${projectName}\\n\`);
|
|
220
|
-
|
|
221
|
-
const snakeName = projectName.replace(/-/g, '_').toLowerCase();
|
|
222
|
-
const project_name = await ask('Project name (snake_case)', snakeName);
|
|
223
|
-
const author = await ask('Author name', process.env.USER || 'Workspai User');
|
|
224
|
-
const description = await ask('Description', 'FastAPI service generated with Workspai');
|
|
225
|
-
|
|
226
|
-
rl.close();
|
|
227
|
-
|
|
228
|
-
// Create project structure
|
|
229
|
-
const dirs = [
|
|
230
|
-
'',
|
|
231
|
-
'src',
|
|
232
|
-
'src/routing',
|
|
233
|
-
'src/modules',
|
|
234
|
-
'tests',
|
|
235
|
-
'.workspai'
|
|
236
|
-
];
|
|
237
|
-
|
|
238
|
-
for (const dir of dirs) {
|
|
239
|
-
fs.mkdirSync(path.join(targetPath, dir), { recursive: true });
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Template files with content
|
|
243
|
-
const files = {
|
|
244
|
-
'src/__init__.py': '"""' + project_name + ' package."""\\n',
|
|
245
|
-
'src/modules/__init__.py': '"""Modules package."""\\n',
|
|
246
|
-
'tests/__init__.py': '"""Tests package."""\\n',
|
|
247
|
-
'src/main.py': \`"""\${project_name} application entrypoint."""
|
|
248
|
-
|
|
249
|
-
from __future__ import annotations
|
|
250
|
-
|
|
251
|
-
from contextlib import asynccontextmanager
|
|
252
|
-
from typing import AsyncIterator
|
|
253
|
-
|
|
254
|
-
from fastapi import FastAPI
|
|
255
|
-
from fastapi.middleware.cors import CORSMiddleware
|
|
256
|
-
|
|
257
|
-
from .routing import api_router
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
@asynccontextmanager
|
|
261
|
-
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
|
262
|
-
"""Application lifespan context manager for startup/shutdown events."""
|
|
263
|
-
yield
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
app = FastAPI(
|
|
267
|
-
title="\${project_name}",
|
|
268
|
-
description="\${description}",
|
|
269
|
-
version="0.1.0",
|
|
270
|
-
docs_url="/docs",
|
|
271
|
-
redoc_url="/redoc",
|
|
272
|
-
lifespan=lifespan,
|
|
273
|
-
)
|
|
274
|
-
|
|
275
|
-
app.add_middleware(
|
|
276
|
-
CORSMiddleware,
|
|
277
|
-
allow_origins=["*"],
|
|
278
|
-
allow_credentials=True,
|
|
279
|
-
allow_methods=["*"],
|
|
280
|
-
allow_headers=["*"],
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
app.include_router(api_router, prefix="/api")
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if __name__ == "__main__":
|
|
287
|
-
import uvicorn
|
|
288
|
-
uvicorn.run("src.main:app", host="0.0.0.0", port=8001, reload=True)
|
|
289
|
-
\`,
|
|
290
|
-
'src/routing/__init__.py': \`"""API routing configuration."""
|
|
291
|
-
|
|
292
|
-
from fastapi import APIRouter
|
|
293
|
-
|
|
294
|
-
from .health import router as health_router
|
|
295
|
-
|
|
296
|
-
api_router = APIRouter()
|
|
297
|
-
|
|
298
|
-
api_router.include_router(health_router)
|
|
299
|
-
\`,
|
|
300
|
-
'src/routing/health.py': \`"""Health check endpoints."""
|
|
301
|
-
|
|
302
|
-
from __future__ import annotations
|
|
303
|
-
|
|
304
|
-
from fastapi import APIRouter
|
|
305
|
-
|
|
306
|
-
router = APIRouter(prefix="/health", tags=["health"])
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
@router.get("/", summary="Health check")
|
|
310
|
-
async def heartbeat() -> dict[str, str]:
|
|
311
|
-
"""Return basic service heartbeat."""
|
|
312
|
-
return {"status": "ok"}
|
|
313
|
-
\`,
|
|
314
|
-
'src/cli.py': \`"""CLI commands for \${project_name}."""
|
|
315
|
-
|
|
316
|
-
import subprocess
|
|
317
|
-
import sys
|
|
318
|
-
from pathlib import Path
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
def dev():
|
|
322
|
-
"""Start development server with hot reload."""
|
|
323
|
-
print("\u{1F680} Starting development server...")
|
|
324
|
-
subprocess.run([
|
|
325
|
-
sys.executable, "-m", "uvicorn",
|
|
326
|
-
"src.main:app", "--reload",
|
|
327
|
-
"--host", "0.0.0.0", "--port", "8000"
|
|
328
|
-
])
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
def start():
|
|
332
|
-
"""Start production server."""
|
|
333
|
-
print("\u26A1 Starting production server...")
|
|
334
|
-
subprocess.run([
|
|
335
|
-
sys.executable, "-m", "uvicorn",
|
|
336
|
-
"src.main:app",
|
|
337
|
-
"--host", "0.0.0.0", "--port", "8000"
|
|
338
|
-
])
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
def test():
|
|
342
|
-
"""Run tests."""
|
|
343
|
-
print("\u{1F9EA} Running tests...")
|
|
344
|
-
subprocess.run([sys.executable, "-m", "pytest", "-q"])
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
if __name__ == "__main__":
|
|
348
|
-
if len(sys.argv) < 2:
|
|
349
|
-
print("Usage: python -m src.cli <command>")
|
|
350
|
-
print("Commands: dev, start, test")
|
|
351
|
-
sys.exit(1)
|
|
352
|
-
|
|
353
|
-
cmd = sys.argv[1]
|
|
354
|
-
if cmd == "dev":
|
|
355
|
-
dev()
|
|
356
|
-
elif cmd == "start":
|
|
357
|
-
start()
|
|
358
|
-
elif cmd == "test":
|
|
359
|
-
test()
|
|
360
|
-
else:
|
|
361
|
-
print(f"Unknown command: {cmd}")
|
|
362
|
-
sys.exit(1)
|
|
363
|
-
\`,
|
|
364
|
-
'pyproject.toml': \`[tool.poetry]
|
|
365
|
-
name = "\${project_name}"
|
|
366
|
-
version = "0.1.0"
|
|
367
|
-
description = "\${description}"
|
|
368
|
-
authors = ["\${author}"]
|
|
369
|
-
license = "MIT"
|
|
370
|
-
readme = "README.md"
|
|
371
|
-
package-mode = false
|
|
372
|
-
|
|
373
|
-
[tool.poetry.dependencies]
|
|
374
|
-
python = "^3.10"
|
|
375
|
-
fastapi = "^0.128.0"
|
|
376
|
-
uvicorn = {extras = ["standard"], version = "^0.40.0"}
|
|
377
|
-
pydantic = "^2.12.5"
|
|
378
|
-
pydantic-settings = "^2.12.0"
|
|
379
|
-
|
|
380
|
-
[tool.poetry.group.dev.dependencies]
|
|
381
|
-
pytest = "^9.0.2"
|
|
382
|
-
pytest-asyncio = "^1.3.0"
|
|
383
|
-
pytest-cov = "^7.0.0"
|
|
384
|
-
httpx = "^0.28.1"
|
|
385
|
-
black = "^25.12.0"
|
|
386
|
-
ruff = "^0.14.10"
|
|
387
|
-
mypy = "^1.19.1"
|
|
388
|
-
|
|
389
|
-
[tool.poetry.scripts]
|
|
390
|
-
dev = "src.cli:dev"
|
|
391
|
-
start = "src.cli:start"
|
|
392
|
-
test = "src.cli:test"
|
|
393
|
-
|
|
394
|
-
[build-system]
|
|
395
|
-
requires = ["poetry-core"]
|
|
396
|
-
build-backend = "poetry.core.masonry.api"
|
|
397
|
-
|
|
398
|
-
[tool.pytest.ini_options]
|
|
399
|
-
asyncio_mode = "auto"
|
|
400
|
-
testpaths = ["tests"]
|
|
401
|
-
|
|
402
|
-
[tool.ruff]
|
|
403
|
-
line-length = 100
|
|
404
|
-
target-version = "py311"
|
|
405
|
-
|
|
406
|
-
[tool.black]
|
|
407
|
-
line-length = 100
|
|
408
|
-
target-version = ["py311"]
|
|
409
|
-
\`,
|
|
410
|
-
'README.md': \`# \${project_name}
|
|
411
|
-
|
|
412
|
-
\${description}
|
|
413
|
-
|
|
414
|
-
## Quick start
|
|
415
|
-
|
|
416
|
-
\\\`\\\`\\\`bash
|
|
417
|
-
npx workspai init # Install dependencies
|
|
418
|
-
npx workspai dev # Start dev server
|
|
419
|
-
\\\`\\\`\\\`
|
|
420
|
-
|
|
421
|
-
## Available commands
|
|
422
|
-
|
|
423
|
-
\\\`\\\`\\\`bash
|
|
424
|
-
npx workspai init # \u{1F527} Install dependencies
|
|
425
|
-
npx workspai dev # \u{1F680} Start development server with hot reload
|
|
426
|
-
npx workspai start # \u26A1 Start production server
|
|
427
|
-
npx workspai test # \u{1F9EA} Run tests
|
|
428
|
-
npx workspai help # \u{1F4DA} Show available commands
|
|
429
|
-
\\\`\\\`\\\`
|
|
430
|
-
|
|
431
|
-
## Project layout
|
|
432
|
-
|
|
433
|
-
\\\`\\\`\\\`
|
|
434
|
-
\${project_name}/
|
|
435
|
-
\u251C\u2500\u2500 src/
|
|
436
|
-
\u2502 \u251C\u2500\u2500 main.py # FastAPI application
|
|
437
|
-
\u2502 \u251C\u2500\u2500 cli.py # CLI commands
|
|
438
|
-
\u2502 \u251C\u2500\u2500 routing/ # API routes
|
|
439
|
-
\u2502 \u2514\u2500\u2500 modules/ # Module system
|
|
440
|
-
\u251C\u2500\u2500 tests/ # Test suite
|
|
441
|
-
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
442
|
-
\u2514\u2500\u2500 README.md
|
|
443
|
-
\\\`\\\`\\\`
|
|
444
|
-
\`,
|
|
445
|
-
'.workspai/project.json': JSON.stringify({
|
|
446
|
-
kit_name: "fastapi.standard",
|
|
447
|
-
profile: "fastapi/standard",
|
|
448
|
-
created_at: new Date().toISOString(),
|
|
449
|
-
created_by: "workspai-cli-fallback",
|
|
450
|
-
workspai_version: "npm-demo",
|
|
451
|
-
rapidkit_version: "npm-demo"
|
|
452
|
-
}, null, 2),
|
|
453
|
-
'.workspai/cli.py': \`#!/usr/bin/env python3
|
|
454
|
-
"""RapidKit Core wrapper for demo projects."""
|
|
455
|
-
|
|
456
|
-
import subprocess
|
|
457
|
-
import sys
|
|
458
|
-
from pathlib import Path
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
def dev(port=8000, host="0.0.0.0"):
|
|
462
|
-
"""Start development server."""
|
|
463
|
-
print("\u{1F680} Starting development server with hot reload...")
|
|
464
|
-
subprocess.run([
|
|
465
|
-
sys.executable, "-m", "uvicorn",
|
|
466
|
-
"src.main:app", "--reload",
|
|
467
|
-
"--host", host, "--port", str(port)
|
|
468
|
-
])
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
def start(port=8000, host="0.0.0.0"):
|
|
472
|
-
"""Start production server."""
|
|
473
|
-
print("\u26A1 Starting production server...")
|
|
474
|
-
subprocess.run([
|
|
475
|
-
sys.executable, "-m", "uvicorn",
|
|
476
|
-
"src.main:app",
|
|
477
|
-
"--host", host, "--port", str(port)
|
|
478
|
-
])
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
def init():
|
|
482
|
-
"""Install dependencies."""
|
|
483
|
-
print("\u{1F4E6} Installing dependencies...")
|
|
484
|
-
subprocess.run(["poetry", "install"])
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
def test():
|
|
488
|
-
"""Run tests."""
|
|
489
|
-
print("\u{1F9EA} Running tests...")
|
|
490
|
-
subprocess.run([sys.executable, "-m", "pytest", "-q"])
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
def help_cmd():
|
|
494
|
-
"""Show help."""
|
|
495
|
-
print("\u{1F4DA} Available commands:")
|
|
496
|
-
print(" init - Install dependencies")
|
|
497
|
-
print(" dev - Start dev server")
|
|
498
|
-
print(" start - Start production server")
|
|
499
|
-
print(" test - Run tests")
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
if __name__ == "__main__":
|
|
503
|
-
cmd = sys.argv[1] if len(sys.argv) > 1 else "help"
|
|
504
|
-
cmds = {"dev": dev, "start": start, "init": init, "test": test, "help": help_cmd}
|
|
505
|
-
cmds.get(cmd, help_cmd)()
|
|
506
|
-
\`,
|
|
507
|
-
'.workspai/rapidkit': '#!/usr/bin/env bash\\n# Local RapidKit Core launcher for demo projects\\nset -euo pipefail\\nSCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"\\nROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"\\ncd "$ROOT_DIR"\\n\\nif [ -f "pyproject.toml" ]; then\\n if command -v poetry >/dev/null 2>&1; then\\n exec poetry run python "$SCRIPT_DIR/cli.py" "$@"\\n fi\\nfi\\n\\necho "Poetry not found. Install with: pip install poetry"\\nexit 1\\n',
|
|
508
|
-
'.gitignore': \`# Python
|
|
509
|
-
__pycache__/
|
|
510
|
-
*.py[cod]
|
|
511
|
-
*.so
|
|
512
|
-
.Python
|
|
513
|
-
build/
|
|
514
|
-
dist/
|
|
515
|
-
*.egg-info/
|
|
516
|
-
|
|
517
|
-
# Virtual environments
|
|
518
|
-
.venv/
|
|
519
|
-
venv/
|
|
520
|
-
|
|
521
|
-
# IDEs
|
|
522
|
-
.vscode/
|
|
523
|
-
.idea/
|
|
524
|
-
|
|
525
|
-
# OS
|
|
526
|
-
.DS_Store
|
|
527
|
-
|
|
528
|
-
# Project
|
|
529
|
-
.env
|
|
530
|
-
.env.local
|
|
531
|
-
\`
|
|
532
|
-
};
|
|
533
|
-
|
|
534
|
-
for (const [filePath, content] of Object.entries(files)) {
|
|
535
|
-
fs.writeFileSync(path.join(targetPath, filePath), content);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// Make scripts executable
|
|
539
|
-
try {
|
|
540
|
-
fs.chmodSync(path.join(targetPath, '.workspai/cli.py'), 0o755);
|
|
541
|
-
fs.chmodSync(path.join(targetPath, '.workspai/rapidkit'), 0o755);
|
|
542
|
-
} catch (e) {
|
|
543
|
-
// Ignore on Windows
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
console.log(\`
|
|
547
|
-
\u2728 Demo project created successfully!
|
|
548
|
-
|
|
549
|
-
\u{1F4C2} Project: \${targetPath}
|
|
550
|
-
|
|
551
|
-
\u{1F680} Get started:
|
|
552
|
-
cd \${projectName}
|
|
553
|
-
npx workspai init # Install dependencies
|
|
554
|
-
npx workspai dev # Start dev server
|
|
555
|
-
|
|
556
|
-
\u{1F4DA} Available commands:
|
|
557
|
-
npx workspai init # \u{1F527} Install dependencies
|
|
558
|
-
npx workspai dev # \u{1F680} Start dev server with hot reload
|
|
559
|
-
npx workspai start # \u26A1 Start production server
|
|
560
|
-
npx workspai test # \u{1F9EA} Run tests
|
|
561
|
-
npx workspai help # \u{1F4DA} Show help
|
|
562
|
-
|
|
563
|
-
\u{1F4A1} For Python engine features: pipx install rapidkit-core
|
|
564
|
-
\`);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
main().catch(console.error);
|
|
568
|
-
`,"utf-8");try{await execa("chmod",["+x",d.join(e,"generate-demo.js")]);}catch{}let u=`# Workspai Demo Workspace
|
|
569
|
-
|
|
570
|
-
Welcome to your Workspai demo workspace! This environment lets you generate FastAPI demo projects using bundled Workspai templates, without needing to install Python RapidKit Core.
|
|
571
|
-
|
|
572
|
-
## \u{1F680} Quick Start
|
|
573
|
-
|
|
574
|
-
### Generate Your First Demo Project
|
|
575
|
-
|
|
576
|
-
\`\`\`bash
|
|
577
|
-
# Generate a demo project:
|
|
578
|
-
node generate-demo.js my-api
|
|
579
|
-
|
|
580
|
-
# Navigate to the project:
|
|
581
|
-
cd my-api
|
|
582
|
-
|
|
583
|
-
# Install dependencies:
|
|
584
|
-
workspai init
|
|
585
|
-
|
|
586
|
-
# Run the development server:
|
|
587
|
-
workspai dev
|
|
588
|
-
\`\`\`
|
|
589
|
-
|
|
590
|
-
Your API will be available at \`http://localhost:8000\`
|
|
591
|
-
|
|
592
|
-
## \u{1F4E6} Generate Multiple Projects
|
|
593
|
-
|
|
594
|
-
You can create multiple demo projects in this workspace:
|
|
595
|
-
|
|
596
|
-
\`\`\`bash
|
|
597
|
-
node generate-demo.js api-service
|
|
598
|
-
node generate-demo.js auth-service
|
|
599
|
-
node generate-demo.js data-service
|
|
600
|
-
\`\`\`
|
|
601
|
-
|
|
602
|
-
Each project is independent and has its own dependencies.
|
|
603
|
-
|
|
604
|
-
## \u{1F3AF} What's Included
|
|
605
|
-
|
|
606
|
-
Each generated demo project contains:
|
|
607
|
-
|
|
608
|
-
- **FastAPI Application** - Modern async web framework
|
|
609
|
-
- **Routing System** - Organized API routes
|
|
610
|
-
- **Module System** - Extensible module architecture
|
|
611
|
-
- **CLI Commands** - Built-in command system
|
|
612
|
-
- **Testing Setup** - pytest configuration
|
|
613
|
-
- **Poetry Configuration** - Dependency management
|
|
614
|
-
|
|
615
|
-
## \u{1F4DA} Next Steps
|
|
616
|
-
|
|
617
|
-
1. **Explore the Generated Code** - Check out \`src/main.py\` and \`src/routing/\`
|
|
618
|
-
2. **Add Routes** - Create new endpoints in \`src/routing/\`
|
|
619
|
-
3. **Install RapidKit Core** - For Python engine features: \`pipx install rapidkit-core\`
|
|
620
|
-
4. **Read the Documentation** - Visit [Workspai Docs](https://workspai.dev/docs)
|
|
621
|
-
|
|
622
|
-
## \u26A0\uFE0F Demo Mode Limitations
|
|
623
|
-
|
|
624
|
-
This is a demo workspace with:
|
|
625
|
-
- \u2705 Pre-built FastAPI templates
|
|
626
|
-
- \u2705 Project generation without Python RapidKit Core
|
|
627
|
-
- \u274C No Python RapidKit Core module commands (\`rapidkit add module\`)
|
|
628
|
-
- \u274C No interactive module system
|
|
629
|
-
|
|
630
|
-
For Python engine features, install RapidKit Core:
|
|
631
|
-
|
|
632
|
-
\`\`\`bash
|
|
633
|
-
pipx install rapidkit-core
|
|
634
|
-
\`\`\`
|
|
635
|
-
|
|
636
|
-
## \u{1F6E0}\uFE0F Workspace Structure
|
|
637
|
-
|
|
638
|
-
\`\`\`
|
|
639
|
-
${n}/
|
|
640
|
-
\u251C\u2500\u2500 generate-demo.js # Demo project generator
|
|
641
|
-
\u251C\u2500\u2500 README.md # This file
|
|
642
|
-
\u2514\u2500\u2500 my-api/ # Your generated projects go here
|
|
643
|
-
\`\`\`
|
|
644
|
-
|
|
645
|
-
## \u{1F4A1} Tips
|
|
646
|
-
|
|
647
|
-
- Run \`node generate-demo.js --help\` for more options (coming soon)
|
|
648
|
-
- Each project can have different configurations
|
|
649
|
-
- Demo projects are production-ready FastAPI applications
|
|
650
|
-
- You can copy and modify templates as needed
|
|
651
|
-
|
|
652
|
-
---
|
|
653
|
-
|
|
654
|
-
**Generated with Workspai** | [GitHub](https://github.com/chistiq/workspai)
|
|
655
|
-
`;if(await promises.writeFile(d.join(e,"README.md"),u,"utf-8"),o.succeed("Demo workspace setup complete"),!t)if(await qe(e))o.warn("Git initialization skipped because target is already inside a git worktree");else {o.start("Initializing git repository");try{await execa("git",["init"],{cwd:e,env:a()}),await k.outputFile(d.join(e,".gitignore"),`# Dependencies
|
|
656
|
-
node_modules/
|
|
657
|
-
|
|
658
|
-
# Generated projects
|
|
659
|
-
*/
|
|
660
|
-
!generate-demo.js
|
|
661
|
-
!README.md
|
|
662
|
-
|
|
663
|
-
# Python
|
|
664
|
-
__pycache__/
|
|
665
|
-
*.pyc
|
|
666
|
-
.venv/
|
|
667
|
-
.env
|
|
668
|
-
`,"utf-8"),await execa("git",["add","."],{cwd:e,env:a()}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:e,env:a()}),o.succeed("Git repository initialized");}catch{o.warn("Could not initialize git repository");}}console.log(s.green(`
|
|
669
|
-
\u2728 Demo workspace created successfully!
|
|
670
|
-
`)),console.log(s.cyan("\u{1F4C2} Location:"),s.white(e)),console.log(s.cyan(`\u{1F680} Get started:
|
|
671
|
-
`)),console.log(s.white(` ${h$2(e)}`)),console.log(s.white(" node generate-demo.js my-api")),console.log(s.white(" cd my-api")),console.log(s.white(" workspai init")),console.log(s.white(" workspai dev")),console.log(),console.log(s.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For Python engine features:"),console.log(s.cyan(" pipx install rapidkit-core")),console.log();}catch(a){throw o.fail("Failed to create demo workspace"),a}}async function It(e,n,t,o,a,l,u,g=false,c=false){if(console.log(s.cyan(`
|
|
672
|
-
\u{1F50D} Dry-run mode - what would be created:
|
|
673
|
-
`)),console.log(s.white("\u{1F4C2} Workspace path:"),e),console.log(s.white("\u{1F4DB} Name:"),s.cyan(n)),t)console.log(s.white("\u{1F4E6} Type:"),"Demo environment"),console.log(s.white(`
|
|
674
|
-
\u{1F4DD} Files to create:`)),console.log(s.gray(" - package.json")),console.log(s.gray(" - generate-demo.js (project generator)")),console.log(s.gray(" - README.md")),console.log(s.gray(" - .gitignore")),console.log(s.white(`
|
|
675
|
-
\u{1F3AF} Capabilities:`)),console.log(s.gray(" - Generate FastAPI/NestJS demo projects")),console.log(s.gray(" - No Python RapidKit installation required")),console.log(s.gray(" - Bundled templates"));else {let h=a||"minimal",y=l,f=u,r=new Set(["python-only","polyglot","enterprise"]).has(h);console.log(s.white("\u{1F4E6} Profile:"),s.cyan(h)),console.log(s.white("\u{1F4DD} Configuration:")),r?(console.log(s.gray(` - Python version: ${f}`)),console.log(s.gray(` - Python engine: ${c?"Skipped":`Install with ${y}`}`)),console.log(s.gray(` - Git init: ${g?"No":"Yes"}`))):(console.log(s.gray(" - Python-free profile (no Python needed)")),console.log(s.gray(` - Git init: ${g?"No":"Yes"}`))),console.log(s.white(`
|
|
676
|
-
\u{1F4CB} Files to create:`)),console.log(s.gray(" - .workspai-workspace (workspace marker)")),console.log(s.gray(" - .workspai/ (workspace config directory)")),console.log(s.gray(" - README.md")),console.log(s.gray(" - .gitignore")),r&&!c&&console.log(s.gray(` - ${y==="poetry"?"pyproject.toml + poetry.lock":".venv/ (virtual environment)"}`)),console.log(s.white(`
|
|
677
|
-
\u2699\uFE0F Environment setup:`)),r&&c?console.log(s.gray(" - Python engine setup skipped")):r&&console.log(y==="poetry"?s.gray(" - Poetry virtual environment created (recommended, includes dependency management)"):y==="venv"?s.gray(" - Python venv created in .venv/ (standard, zero extra tools)"):s.gray(" - Global pipx install (isolated, not local to workspace)")),console.log(s.white(`
|
|
678
|
-
\u{1F680} Next steps:`)),console.log(s.gray(` 1. ${h$2(e)}`)),console.log(s.gray(" 2. npx workspai create project")),console.log(s.gray(" 3. npx workspai init")),console.log(s.gray(" 4. npx workspai dev")),console.log(s.white(`
|
|
679
|
-
\u{1F4A1} Learn more:`)),console.log(s.gray(" \u2022 Change profile later: workspai bootstrap --profile <profile>")),console.log(s.gray(" \u2022 Profile options: minimal|java-only|python-only|node-only|go-only|dotnet-only|polyglot|enterprise")),console.log(s.gray(" \u2022 Help: npx workspai --help"));}console.log(s.white(`
|
|
680
|
-
\u2728 To proceed: remove --dry-run flag
|
|
681
|
-
`));}export{X as a,ze as b,nn as c,ht as d,ge as e,on as f,an as g};
|