rapidkit 0.42.1 → 0.42.3

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.
Files changed (40) hide show
  1. package/README.md +127 -585
  2. package/dist/autopilot-release-PBDTSW4X.js +1 -0
  3. package/dist/{chunk-JN6R5UP4.js → chunk-4SYXFC4M.js} +1 -1
  4. package/dist/{chunk-NN3IV4U6.js → chunk-LK66ATAQ.js} +2 -2
  5. package/dist/{chunk-CXWWNQDF.js → chunk-MWVOWE5T.js} +1 -1
  6. package/dist/{create-TPFUONHK.js → create-XPYW3WJF.js} +1 -1
  7. package/dist/index.js +17 -17
  8. package/dist/{pipeline-PX6ZUINW.js → pipeline-YT57V6AL.js} +1 -1
  9. package/dist/{workspace-MPKEUHFP.js → workspace-NJFK6DAP.js} +1 -1
  10. package/dist/{workspace-foundation-2OVUZXPT.js → workspace-foundation-OTL2RSZP.js} +1 -1
  11. package/dist/workspace-run-BV2PIE3Y.js +1 -0
  12. package/docs/AI_DYNAMIC_INTEGRATION.md +5 -1
  13. package/docs/AI_EXAMPLES.md +5 -1
  14. package/docs/AI_FEATURES.md +6 -2
  15. package/docs/AI_QUICKSTART.md +4 -0
  16. package/docs/MIGRATING_TO_WORKSPAI.md +139 -0
  17. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +4 -0
  18. package/docs/OPTIMIZATION_GUIDE.md +4 -0
  19. package/docs/README.md +12 -3
  20. package/docs/UTILITIES.md +4 -0
  21. package/docs/WORKSPACE_MARKER_SPEC.md +5 -0
  22. package/docs/commands-reference.md +5 -0
  23. package/docs/config-file-guide.md +4 -0
  24. package/docs/create-planner-capabilities.md +5 -0
  25. package/docs/doctor-command.md +5 -0
  26. package/docs/from-code-to-shared-understanding.md +5 -1
  27. package/docs/workspace-operations.md +5 -0
  28. package/docs/workspace-run.md +5 -0
  29. package/package.json +11 -6
  30. package/templates/kits/fastapi-ddd/README.md.j2 +6 -6
  31. package/templates/kits/fastapi-ddd/pyproject.toml.j2 +5 -5
  32. package/templates/kits/fastapi-ddd/src/cli.py.j2 +3 -3
  33. package/templates/kits/fastapi-standard/README.md.j2 +9 -9
  34. package/templates/kits/fastapi-standard/pyproject.toml.j2 +5 -5
  35. package/templates/kits/fastapi-standard/src/cli.py.j2 +3 -3
  36. package/templates/kits/nestjs-standard/README.md.j2 +8 -8
  37. package/templates/kits/nestjs-standard/package.json.j2 +1 -1
  38. package/dist/autopilot-release-5J55NPXF.js +0 -1
  39. package/dist/workspace-run-NULA72JV.js +0 -1
  40. /package/dist/{chunk-FLFZC7ZV.js → chunk-YVTVFYSI.js} +0 -0
@@ -0,0 +1 @@
1
+ export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-MWVOWE5T.js';
@@ -1,6 +1,6 @@
1
1
  import {c}from'./chunk-NFUXULIF.js';import {a}from'./chunk-A5FBGRJA.js';import {a as a$1}from'./chunk-TDSIF42O.js';import {b}from'./chunk-KEMWZUGO.js';import {p}from'./chunk-WRMCPKGA.js';import {promises}from'fs';import n from'path';import i from'chalk';import E from'ora';import {execa}from'execa';function B(e){let r=a(e.path),t=Array.isArray(e.projects)?e.projects:[],a$1=[],o=new Set;for(let d of t){if(!d||typeof d.name!="string"||typeof d.path!="string")continue;let c=a(d.path);o.has(c)||(o.add(c),a$1.push({name:d.name,path:c}));}return {name:e.name,path:r,mode:e.mode,projects:a$1}}function P(e){let r=[],t=new Set;for(let a of e.workspaces||[]){if(!a||typeof a.name!="string"||typeof a.path!="string")continue;let o=B(a);t.has(o.path)||(t.add(o.path),r.push(o));}return {workspaces:r}}async function A(e){try{let r=await promises.readFile(e,"utf8"),t=JSON.parse(r);if(t&&Array.isArray(t.workspaces))return P(t)}catch{}return {workspaces:[]}}async function T(e,r){try{let t=a(e),a$1=p(),o=n.join(a$1,"workspaces.json");await promises.mkdir(a$1,{recursive:true});let d={name:r,path:t,mode:"full",projects:[]};for(let c=0;c<3;c+=1){let s=await A(o);if(s.workspaces.some(u=>u.path===t)||(s.workspaces.push(d),await promises.writeFile(o,JSON.stringify(s,null,2)),(await A(o)).workspaces.some(u=>u.path===t)))return}console.warn(i.gray("Note: Could not register workspace in shared registry"));}catch{console.warn(i.gray("Note: Could not register workspace in shared registry"));}}async function ne(e,r=false){let t=a(e),a$1={workspacePath:t,workspaceFound:false,added:[],skipped:0};try{let o=p(),d=n.join(o,"workspaces.json"),c={workspaces:[]};try{let f=await promises.readFile(d,"utf8"),h=JSON.parse(f);h&&Array.isArray(h.workspaces)&&(c=P(h));}catch{return r||console.log("\u26A0\uFE0F Workspace registry not found"),a$1}let s=c.workspaces.find(f=>f.path===t);if(!s)return r||console.log("\u26A0\uFE0F Workspace not registered in registry"),a$1;Array.isArray(s.projects)||(s.projects=[]);let p$1=0,u=0,k=[],m=[e],y=new Set;for(;m.length>0;){let f=m.shift();if(!f||y.has(f))continue;y.add(f);let h=await promises.readdir(f,{withFileTypes:true});for(let w of h){if(!w.isDirectory()||w.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(w.name))continue;let S=n.join(f,w.name),g=a(S),$=n.join(g,".rapidkit","context.json"),W=n.join(g,".rapidkit","project.json");try{let b=false;try{await promises.access($),b=true;}catch{await promises.access(W),b=true;}if(b){let v=n.basename(g);s.projects.some(_=>_.path===g||_.name===v)?u++:(s.projects.push({name:v,path:g}),p$1++,k.push(g),r||console.log(`\u2714 Added: ${n.relative(e,g)}`));continue}}catch{}m.push(S);}}return p$1>0?(await promises.writeFile(d,JSON.stringify(c,null,2)),r||console.log(`
2
2
  \u2705 Synced ${p$1} project(s) to registry`)):r||console.log(`
3
- \u2705 All projects already registered (${u} found)`),{workspacePath:t,workspaceFound:true,added:k,skipped:u}}catch(o){return r||console.error("\u274C Failed to sync projects:",o.message),a$1}}async function se(e,r,t){try{let a$1=a(e),o=a(t),d=p(),c=n.join(d,"workspaces.json"),s={workspaces:[]};try{let m=await promises.readFile(c,"utf8"),y=JSON.parse(m);y&&Array.isArray(y.workspaces)&&(s=P(y));}catch{return}let p$1=s.workspaces.find(m=>m.path===a$1);if(!p$1)return;Array.isArray(p$1.projects)||(p$1.projects=[]);let u=p$1.projects.findIndex(m=>m.path===o||m.name===r),k={name:r,path:o};if(u>=0){let m=p$1.projects[u];(m.name!==k.name||m.path!==k.path)&&(p$1.projects[u]=k,await promises.writeFile(c,JSON.stringify(s,null,2)));}else p$1.projects.push({name:r,path:o}),await promises.writeFile(c,JSON.stringify(s,null,2));}catch{}}async function ce(e,r){let t=E("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(n.join(e,".rapidkit"),{recursive:true});let a={workspace_name:r.name,author:r.author,rapidkit_version:b(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(n.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:o}=await import('./create-TPFUONHK.js');await o(e,{workspaceName:r.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let{publishWorkspaceRegistrySummary:d}=await import('./workspace-registry-summary-X5WRUU3T.js');await d(e);let c=J();await promises.writeFile(n.join(e,"rapidkit"),c),await promises.chmod(n.join(e,"rapidkit"),493);let s=z();await promises.writeFile(n.join(e,"rapidkit.cmd"),s);let p=U(r.name);if(await promises.writeFile(n.join(e,"README.md"),p),await promises.writeFile(n.join(e,".gitignore"),`# RapidKit workspace
3
+ \u2705 All projects already registered (${u} found)`),{workspacePath:t,workspaceFound:true,added:k,skipped:u}}catch(o){return r||console.error("\u274C Failed to sync projects:",o.message),a$1}}async function se(e,r,t){try{let a$1=a(e),o=a(t),d=p(),c=n.join(d,"workspaces.json"),s={workspaces:[]};try{let m=await promises.readFile(c,"utf8"),y=JSON.parse(m);y&&Array.isArray(y.workspaces)&&(s=P(y));}catch{return}let p$1=s.workspaces.find(m=>m.path===a$1);if(!p$1)return;Array.isArray(p$1.projects)||(p$1.projects=[]);let u=p$1.projects.findIndex(m=>m.path===o||m.name===r),k={name:r,path:o};if(u>=0){let m=p$1.projects[u];(m.name!==k.name||m.path!==k.path)&&(p$1.projects[u]=k,await promises.writeFile(c,JSON.stringify(s,null,2)));}else p$1.projects.push({name:r,path:o}),await promises.writeFile(c,JSON.stringify(s,null,2));}catch{}}async function ce(e,r){let t=E("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(n.join(e,".rapidkit"),{recursive:true});let a={workspace_name:r.name,author:r.author,rapidkit_version:b(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(n.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:o}=await import('./create-XPYW3WJF.js');await o(e,{workspaceName:r.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let{publishWorkspaceRegistrySummary:d}=await import('./workspace-registry-summary-X5WRUU3T.js');await d(e);let c=J();await promises.writeFile(n.join(e,"rapidkit"),c),await promises.chmod(n.join(e,"rapidkit"),493);let s=z();await promises.writeFile(n.join(e,"rapidkit.cmd"),s);let p=U(r.name);if(await promises.writeFile(n.join(e,"README.md"),p),await promises.writeFile(n.join(e,".gitignore"),`# RapidKit workspace
4
4
  .env
5
5
  .env.*
6
6
  !.env.example
@@ -1,4 +1,4 @@
1
- import {k,e as e$2}from'./chunk-4EIQRQSA.js';import {b as b$2}from'./chunk-CDCYRBAY.js';import {e,g,f as f$1,b as b$4,c as c$1,d as d$1}from'./chunk-RQIHAPF3.js';import {a,d,b as b$1}from'./chunk-2LBPX5K3.js';import {b}from'./chunk-KEMWZUGO.js';import {f,c,e as e$3}from'./chunk-OLDPVVSV.js';import {b as b$3,j,i,l,h,q as q$1}from'./chunk-WRMCPKGA.js';import {promises}from'fs';import*as v from'fs-extra';import y from'path';import e$1 from'chalk';import {execa}from'execa';async function L(t,o={}){let n=y.resolve(t),s=o.workspaceName??y.basename(n);try{let{registerWorkspace:a}=await import('./workspace-MPKEUHFP.js');await a(n,s);}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not register workspace in shared registry: ${a?.message??a}`));}try{let{syncWorkspaceContract:a}=await import('./workspace-contract-OO4GMENV.js'),l=await a({workspacePath:n});if(o.silent||console.log(e$1.gray(`\u2139\uFE0F Workspace intelligence synced (contract + registry summary, ${l.contract.projects.length} project(s)).`)),!o.silent&&l.verification.status!=="passed"){console.log(e$1.yellow("\u26A0\uFE0F Workspace contract verification reported issues."));for(let d of l.verification.violations)console.log(e$1.gray(` Violation: ${d}`));console.log(e$1.white(" Next: npx rapidkit workspace contract inspect"));}}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not sync workspace intelligence layer: ${a?.message??a}`));}}function K(){return h()}async function U(t,o,n,s,a){let l=d(o,b(),n,a?.pythonEngine?{coreStatus:a.pythonEngine,...a.pythonEngineReason?{coreReason:a.pythonEngineReason}:{},...s?{pythonVersion:s}:{}}:void 0);s&&!a?.pythonEngine&&(l.metadata||(l.metadata={}),l.metadata.python={pythonVersion:s}),await b$1(t,l);}async function G(t){await v.outputFile(y.join(t,".gitignore"),`.venv/
1
+ import {k,e as e$2}from'./chunk-4EIQRQSA.js';import {b as b$2}from'./chunk-CDCYRBAY.js';import {e,g,f as f$1,b as b$4,c as c$1,d as d$1}from'./chunk-RQIHAPF3.js';import {a,d,b as b$1}from'./chunk-2LBPX5K3.js';import {b}from'./chunk-KEMWZUGO.js';import {f,c,e as e$3}from'./chunk-OLDPVVSV.js';import {b as b$3,j,i,l,h,q as q$1}from'./chunk-WRMCPKGA.js';import {promises}from'fs';import*as v from'fs-extra';import y from'path';import e$1 from'chalk';import {execa}from'execa';async function L(t,o={}){let n=y.resolve(t),s=o.workspaceName??y.basename(n);try{let{registerWorkspace:a}=await import('./workspace-NJFK6DAP.js');await a(n,s);}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not register workspace in shared registry: ${a?.message??a}`));}try{let{syncWorkspaceContract:a}=await import('./workspace-contract-OO4GMENV.js'),l=await a({workspacePath:n});if(o.silent||console.log(e$1.gray(`\u2139\uFE0F Workspace intelligence synced (contract + registry summary, ${l.contract.projects.length} project(s)).`)),!o.silent&&l.verification.status!=="passed"){console.log(e$1.yellow("\u26A0\uFE0F Workspace contract verification reported issues."));for(let d of l.verification.violations)console.log(e$1.gray(` Violation: ${d}`));console.log(e$1.white(" Next: npx rapidkit workspace contract inspect"));}}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not sync workspace intelligence layer: ${a?.message??a}`));}}function K(){return h()}async function U(t,o,n,s,a){let l=d(o,b(),n,a?.pythonEngine?{coreStatus:a.pythonEngine,...a.pythonEngineReason?{coreReason:a.pythonEngineReason}:{},...s?{pythonVersion:s}:{}}:void 0);s&&!a?.pythonEngine&&(l.metadata||(l.metadata={}),l.metadata.python={pythonVersion:s}),await b$1(t,l);}async function G(t){await v.outputFile(y.join(t,".gitignore"),`.venv/
2
2
  __pycache__/
3
3
  *.pyc
4
4
  .env
@@ -886,7 +886,7 @@ ${o}/
886
886
 
887
887
  ---
888
888
 
889
- **Generated with RapidKit** | [GitHub](https://github.com/rapidkitlabs/rapidkit-npm)
889
+ **Generated with RapidKit** | [GitHub](https://github.com/chistiq/rapidkit-npm)
890
890
  `;if(await promises.writeFile(y.join(t,"README.md"),d,"utf-8"),s.succeed("Demo workspace setup complete"),!n){s.start("Initializing git repository");try{await execa("git",["init"],{cwd:t}),await v.outputFile(y.join(t,".gitignore"),`# Dependencies
891
891
  node_modules/
892
892
 
@@ -1,4 +1,4 @@
1
- import {a}from'./chunk-FLFZC7ZV.js';import {a as a$2}from'./chunk-KMUWWZRT.js';import {a as a$1,e}from'./chunk-64RTZBHU.js';import l from'chalk';import Y from'fs';import y from'path';import {execa}from'execa';var Z="autopilot-release-last-run.json",ee="autopilot-release.json";function $(s){try{return JSON.parse(s)}catch{return null}}function ge(s){let t=y.resolve(s),o=a$2(t);if(!o)throw new Error("No RapidKit workspace found in current directory or parents");return o}async function b(s,t){let o=process.argv[1];if(!o)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let a=await execa(process.execPath,[o,...s],{cwd:t,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(a.exitCode??1),stdout:a.stdout,stderr:a.stderr,crashed:false}}catch(a){return {exitCode:1,stdout:"",stderr:a instanceof Error?a.message:String(a),crashed:true}}}function te(s){let t=s.toLowerCase();return t==="pass"?"pass":t==="warn"?"warn":t==="fail"?"fail":"warn"}function se(s){return s.summary.failed>0||s.gates.results.some(t=>t.status==="fail")?"fail":s.gates.results.some(t=>t.status==="warn")?"warn":"pass"}function we(s){let t=s.filter(a=>a.status!=="skipped");if(t.length===0)return 100;let o=t.reduce((a,e)=>e.status==="pass"?a+1:e.status==="warn"?a+.6:a,0);return Math.round(o/t.length*100)}function he(s){return s.executionError?["Re-run: npx rapidkit autopilot release --mode audit --json","Inspect .rapidkit/reports/autopilot-release-last-run.json for execution failure details"]:s.blockers.length>0?["Run: npx rapidkit doctor workspace --plan","Run: npx rapidkit readiness --json --strict","Run: npx rapidkit workspace run test --affected --strict"]:s.hasWarnings&&s.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx rapidkit autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function U(s,t){await Y.promises.mkdir(y.dirname(s),{recursive:true}),await Y.promises.writeFile(s,`${JSON.stringify(t,null,2)}
1
+ import {a}from'./chunk-YVTVFYSI.js';import {a as a$2}from'./chunk-KMUWWZRT.js';import {a as a$1,e}from'./chunk-64RTZBHU.js';import l from'chalk';import Y from'fs';import y from'path';import {execa}from'execa';var Z="autopilot-release-last-run.json",ee="autopilot-release.json";function $(s){try{return JSON.parse(s)}catch{return null}}function ge(s){let t=y.resolve(s),o=a$2(t);if(!o)throw new Error("No RapidKit workspace found in current directory or parents");return o}async function b(s,t){let o=process.argv[1];if(!o)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let a=await execa(process.execPath,[o,...s],{cwd:t,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(a.exitCode??1),stdout:a.stdout,stderr:a.stderr,crashed:false}}catch(a){return {exitCode:1,stdout:"",stderr:a instanceof Error?a.message:String(a),crashed:true}}}function te(s){let t=s.toLowerCase();return t==="pass"?"pass":t==="warn"?"warn":t==="fail"?"fail":"warn"}function se(s){return s.summary.failed>0||s.gates.results.some(t=>t.status==="fail")?"fail":s.gates.results.some(t=>t.status==="warn")?"warn":"pass"}function we(s){let t=s.filter(a=>a.status!=="skipped");if(t.length===0)return 100;let o=t.reduce((a,e)=>e.status==="pass"?a+1:e.status==="warn"?a+.6:a,0);return Math.round(o/t.length*100)}function he(s){return s.executionError?["Re-run: npx rapidkit autopilot release --mode audit --json","Inspect .rapidkit/reports/autopilot-release-last-run.json for execution failure details"]:s.blockers.length>0?["Run: npx rapidkit doctor workspace --plan","Run: npx rapidkit readiness --json --strict","Run: npx rapidkit workspace run test --affected --strict"]:s.hasWarnings&&s.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx rapidkit autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function U(s,t){await Y.promises.mkdir(y.dirname(s),{recursive:true}),await Y.promises.writeFile(s,`${JSON.stringify(t,null,2)}
2
2
  `,"utf-8");}async function je(s){let t=ge(s.workspacePath),o=s.mode,a$2=[],e$1=[],F,B,C,O,J,G=0,f=false,I=0,T=0,D=-1,N=-1,c="skipped",p="skipped",re=o==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(s.skipPipelineStages)a$2.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let r=Date.now(),i=await b([...re],t),m=Date.now()-r;if(c="pass",i.crashed)c="fail",f=true,e$1.push(`doctor workspace execution error: ${i.stderr||"unknown error"}`);else if(i.exitCode===1)c="fail",e$1.push("doctor workspace command failed or reported errors");else if(i.exitCode===2)c="warn",e$1.push("doctor workspace reported warnings");else if(i.exitCode!==0)c="fail",e$1.push("doctor workspace command failed");else {let d=$(i.stdout),j=d&&d.healthScore&&typeof d.healthScore=="object"?d.healthScore:{},k=Number(j.errors??0),E=Number(j.warnings??0);Number.isFinite(k)&&k>0?(c="fail",e$1.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(E)&&E>0&&(c="warn");}D=a$2.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,o==="enforce"&&c==="warn"&&e$1.push("doctor workspace reported warnings under enforce mode");let g=Date.now(),w=await b(["analyze","--json"],t),v=Date.now()-g;B=y.join(t,".rapidkit","reports","analyze-last-run.json");let n="pass";if(w.crashed)n="fail",f=true,e$1.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)n=w.exitCode===2?"warn":"fail",e$1.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let d=$(w.stdout),j=d&&d.summary&&typeof d.summary=="object"?d.summary:{},k=String(j.verdict??"ready");k==="blocked"?(n="fail",e$1.push("analyze reported blocked verdict")):k==="needs-attention"&&(n="warn");}a$2.push({name:"analyze",status:n,durationMs:v,summary:n==="pass"?"analyze passed":n==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),o==="enforce"&&n==="warn"&&e$1.push("analyze reported warnings under enforce mode");let P=Date.now(),h=await b(["readiness","--json"],t),R=Date.now()-P;if(p="fail",h.crashed)p="fail",f=true,e$1.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)p="fail",e$1.push("readiness command failed");else {let d=$(h.stdout),j=String(d?.overallStatus??"fail");if(p=te(j),typeof d?.evidencePath=="string"&&d.evidencePath.trim().length>0&&(F=d.evidencePath),p==="fail"){let k=Array.isArray(d?.blockingReasons)?d?.blockingReasons.filter(E=>typeof E=="string"):[];k.length>0?e$1.push(...k.map(E=>`readiness: ${E}`)):e$1.push("readiness overall status is fail");}}N=a$2.push({name:"readiness",status:p,durationMs:R,summary:`readiness overall status is ${p}`})-1,o==="enforce"&&p==="warn"&&e$1.push("readiness reported warnings under enforce mode");}let ae=Date.now(),M=await b(["doctor","workspace","--plan","--json"],t),oe=Date.now()-ae,S="warn";if(M.crashed)S="fail",f=true,e$1.push(`doctor remediation plan execution error: ${M.stderr||"unknown error"}`);else if(M.exitCode!==0)S="fail",e$1.push("doctor remediation plan command failed");else {let r=$(M.stdout),i=r&&r.remediationPlan&&typeof r.remediationPlan=="object"?r.remediationPlan:null,m=Number(i?.totalSteps??0),g=Number(i?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(T=g),Number.isFinite(m)&&m===0?S="pass":S="warn";}if(a$2.push({name:"remediation-plan",status:S,durationMs:oe,summary:S==="pass"?"no remediation steps required":"remediation steps available"}),o==="enforce"&&S==="warn"&&e$1.push("remediation plan has pending steps under enforce mode"),o==="safe-fix"){let r=Date.now(),i=await b(["doctor","workspace","--apply"],t),m=Date.now()-r,g=i.crashed||i.exitCode!==0?"fail":"pass";if(i.crashed)f=true,e$1.push(`doctor remediation apply execution error: ${i.stderr||"unknown error"}`);else if(g==="fail")e$1.push("doctor remediation apply failed");else {G=T>0?T:I>0?I:1;let w=await b(["doctor","workspace","--json"],t);if(w.crashed)c="fail",f=true,e$1.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",e$1.push("post-apply doctor workspace command failed");else {let n=$(w.stdout),P=n&&n.healthScore&&typeof n.healthScore=="object"?n.healthScore:{},h=Number(P.errors??0),R=Number(P.warnings??0);Number.isFinite(h)&&h>0?(c="fail",e$1.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(R)&&R>0?c="warn":c="pass";}D>=0&&(a$2[D].status=c,a$2[D].summary=`doctor workspace post-apply status is ${c}`);let v=await b(["readiness","--json"],t);if(v.crashed)p="fail",f=true,e$1.push(`post-apply readiness execution error: ${v.stderr||"unknown error"}`);else if(v.exitCode!==0)p="fail",e$1.push("post-apply readiness command failed");else {let n=$(v.stdout),P=String(n?.overallStatus??"fail");if(p=te(P),typeof n?.evidencePath=="string"&&n.evidencePath.trim().length>0&&(F=n.evidencePath),p==="fail"){let h=Array.isArray(n?.blockingReasons)?n?.blockingReasons.filter(R=>typeof R=="string"):[];h.length>0?e$1.push(...h.map(R=>`post-apply readiness: ${R}`)):e$1.push("post-apply readiness overall status is fail");}}N>=0&&(a$2[N].status=p,a$2[N].summary=`readiness post-apply overall status is ${p}`);}a$2.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else a$2.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ne=Date.now(),x="pass",A="workspace test/build completed for selected projects";try{let r=await a({workspacePath:t,stage:"test",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});C=y.join(t,".rapidkit","reports",a$1),await e(t,r),O=C;let i=se(r);if(i==="fail")x="fail",A="workspace test stage failed for selected projects",e$1.push("workspace run test failed for selected projects");else {i==="warn"&&(x="warn",A="workspace test stage completed with warnings",o==="enforce"&&e$1.push("workspace run test reported warnings under enforce mode"));let m=await a({workspacePath:t,stage:"build",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});await e(t,m),J=C;let g=se(m);g==="fail"?(x="fail",A="workspace build stage failed for selected projects",e$1.push("workspace run build failed for selected projects")):g==="warn"&&(x="warn",A="workspace test/build completed with warnings",o==="enforce"&&e$1.push("workspace run test/build reported warnings under enforce mode"));}}catch(r){x="fail",A="workspace test/build orchestration failed",f=true,e$1.push(`workspace run orchestration error: ${r instanceof Error?r.message:String(r)}`);}let ie=Date.now()-ne;a$2.push({name:"workspace-run-test-build",status:x,durationMs:ie,summary:A});let z=a$2.filter(r=>r.status==="warn").length,le=a$2.filter(r=>r.status==="fail").length,L=o==="enforce"?a$2.some(r=>r.status==="warn"||r.status==="fail"):le>0,W=[...new Set(e$1)],ce=f||L?Math.max(1,W.length):0,de=we(a$2),pe=f||L?"blocked":z>0?"partial":"approved",ue=f?3:L?1:z>0?2:0,fe=he({mode:o,executionError:f,blockers:W,hasWarnings:z>0}),V=y.join(t,".rapidkit","reports"),H=y.join(V,Z),q=y.join(V,ee),u={schemaVersion:"autopilot-release-v1",generatedAt:new Date().toISOString(),workspacePath:t,mode:o,summary:{releaseScore:de,verdict:pe,blockers:ce,warnings:z,safeFixesApplied:G,manualActions:W.length,exitCode:ue},stages:a$2,blockingReasons:W,nextActions:fe,artifacts:{reportPath:H,aliasEvidencePath:q,analyzeEvidencePath:B,readinessEvidencePath:F,workspaceRunEvidencePath:C,workspaceRunTestPath:O,workspaceRunBuildPath:J},enterpriseControls:{jsonReady:true,evidencePath:`.rapidkit/reports/${Z}`,aliasEvidencePath:`.rapidkit/reports/${ee}`}};if(await U(H,u),await U(q,u),s.output&&await U(y.resolve(s.output),u),!s.json){console.log(l.bold.cyan(`
3
3
  \u{1F680} RapidKit Autopilot Release
4
4
  `)),console.log(l.bold(`Workspace: ${l.cyan(y.basename(t))}`)),console.log(l.gray(`Path: ${t}`)),console.log(l.white(`Mode: ${o}`)),console.log(l.white(`Verdict: ${u.summary.verdict==="approved"?l.green("approved"):u.summary.verdict==="partial"?l.yellow("partial"):l.red("blocked")}`)),console.log(l.white(`Release score: ${u.summary.releaseScore}`));for(let r of u.stages){let i=r.status==="pass"?l.green("PASS"):r.status==="warn"?l.yellow("WARN"):r.status==="skipped"?l.gray("SKIP"):l.red("FAIL");console.log(` - ${r.name}: ${i} ${r.summary} (${r.durationMs}ms)`);}if(u.blockingReasons.length>0){console.log(l.bold.red(`
@@ -1 +1 @@
1
- export{c as PYTHON_FREE_WORKSPACE_PROFILES,a as buildWorkspaceManifest,f as createProject,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,b as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-NN3IV4U6.js';
1
+ export{c as PYTHON_FREE_WORKSPACE_PROFILES,a as buildWorkspaceManifest,f as createProject,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,b as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-LK66ATAQ.js';