rapidkit 0.40.0 → 0.40.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,7 +23,9 @@ contracts, and release gates.
23
23
  npm install -g rapidkit
24
24
  ```
25
25
 
26
- or run without installing:
26
+ ### CLI help
27
+
28
+ Browse all commands without a global install (first run fetches from npm):
27
29
 
28
30
  ```bash
29
31
  npx rapidkit --help
@@ -32,11 +34,8 @@ npx rapidkit --help
32
34
  ### Create a governed workspace
33
35
 
34
36
  ```bash
35
- mkdir -p ~/rapidkit/workspaces
36
- cd ~/rapidkit/workspaces
37
-
38
- npx rapidkit create workspace platform --yes --profile polyglot --output .
39
- cd platform
37
+ npx rapidkit my-workspace --yes --profile polyglot
38
+ cd ~/rapidkit/workspaces/my-workspace
40
39
 
41
40
  npx rapidkit bootstrap --profile polyglot
42
41
  npx rapidkit create project
@@ -50,13 +49,9 @@ npx rapidkit pipeline --json --strict
50
49
  ### Adopt an existing project
51
50
 
52
51
  ```bash
53
- mkdir -p ~/rapidkit/workspaces
54
- cd ~/rapidkit/workspaces
52
+ npx rapidkit adopt /path/to/project
53
+ cd ~/rapidkit/workspaces/workspai
55
54
 
56
- npx rapidkit create workspace platform --yes --profile polyglot --output .
57
- npx rapidkit adopt /path/to/project --workspace ~/rapidkit/workspaces/platform
58
-
59
- cd ~/rapidkit/workspaces/platform
60
55
  npx rapidkit workspace model --json
61
56
  npx rapidkit workspace context --for-agent --json --write
62
57
  npx rapidkit pipeline --json --strict
@@ -361,8 +356,6 @@ CI template: [docs/examples/ci-agent-grounding.yml](docs/examples/ci-agent-groun
361
356
 
362
357
  ```bash
363
358
  npm install -g rapidkit
364
- # or
365
- npx rapidkit --help
366
359
  ```
367
360
 
368
361
  ## Project workflows
@@ -370,8 +363,10 @@ npx rapidkit --help
370
363
  ### I already have a project
371
364
 
372
365
  ```bash
373
- npx rapidkit adopt /path/to/project --workspace /path/to/workspace
374
- npx rapidkit import ../orders-api --workspace ./platform
366
+ npx rapidkit adopt /path/to/project
367
+ npx rapidkit import ../orders-api
368
+ cd ~/rapidkit/workspaces/workspai
369
+
375
370
  npx rapidkit workspace model --json
376
371
  npx rapidkit doctor workspace --json
377
372
  ```
@@ -379,11 +374,8 @@ npx rapidkit doctor workspace --json
379
374
  ### I want a new project
380
375
 
381
376
  ```bash
382
- mkdir -p ~/rapidkit/workspaces
383
- cd ~/rapidkit/workspaces
384
-
385
- npx rapidkit create workspace platform --yes --profile polyglot --output .
386
- cd platform
377
+ npx rapidkit my-workspace --yes --profile polyglot
378
+ cd ~/rapidkit/workspaces/my-workspace
387
379
 
388
380
  npx rapidkit bootstrap --profile polyglot
389
381
  npx rapidkit create project # interactive kit picker
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": "rapidkit-extension-cli-compatibility.v1",
3
3
  "cli": "rapidkit-npm",
4
- "minimumVerifiedCliVersion": "0.40.0",
4
+ "minimumVerifiedCliVersion": "0.40.1",
5
5
  "publishedContractSchemas": {
6
6
  "runtimeCommandSurface": "rapidkit-runtime-command-surface-v1",
7
7
  "cliLogEvent": "cli-log-event-v1",
@@ -0,0 +1 @@
1
+ export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-5VBRMLRU.js';
@@ -1,4 +1,4 @@
1
- import {a}from'./chunk-NAMOYGLS.js';import {a as a$1,d}from'./chunk-FV5A3N3I.js';import {a as a$2}from'./chunk-KMUWWZRT.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-7VI4U7Q5.js';import {a as a$1,d}from'./chunk-FV5A3N3I.js';import {a as a$2}from'./chunk-KMUWWZRT.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=[],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.push(`doctor workspace execution error: ${i.stderr||"unknown error"}`);else if(i.exitCode===1)c="fail",e.push("doctor workspace command failed or reported errors");else if(i.exitCode===2)c="warn",e.push("doctor workspace reported warnings");else if(i.exitCode!==0)c="fail",e.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.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.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.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)n=w.exitCode===2?"warn":"fail",e.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.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.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.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)p="fail",e.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.push(...k.map(E=>`readiness: ${E}`)):e.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.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.push(`doctor remediation plan execution error: ${M.stderr||"unknown error"}`);else if(M.exitCode!==0)S="fail",e.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.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.push(`doctor remediation apply execution error: ${i.stderr||"unknown error"}`);else if(g==="fail")e.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.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",e.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.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.push(`post-apply readiness execution error: ${v.stderr||"unknown error"}`);else if(v.exitCode!==0)p="fail",e.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.push(...h.map(R=>`post-apply readiness: ${R}`)):e.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 d(t,r),O=C;let i=se(r);if(i==="fail")x="fail",A="workspace test stage failed for selected projects",e.push("workspace run test failed for selected projects");else {i==="warn"&&(x="warn",A="workspace test stage completed with warnings",o==="enforce"&&e.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 d(t,m),J=C;let g=se(m);g==="fail"?(x="fail",A="workspace build stage failed for selected projects",e.push("workspace run build failed for selected projects")):g==="warn"&&(x="warn",A="workspace test/build completed with warnings",o==="enforce"&&e.push("workspace run test/build reported warnings under enforce mode"));}}catch(r){x="fail",A="workspace test/build orchestration failed",f=true,e.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)],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(`