workspai 0.75.1 → 0.76.0
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/contracts/agent-framework-capabilities.v1.json +2 -2
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +12 -0
- package/contracts/create-planner-capabilities.v1.json +24 -0
- package/contracts/extension-cli-compatibility.v1.json +4 -2
- package/contracts/published-contract-catalog.v1.json +10 -0
- package/contracts/runtime-command-surface.v1.json +3 -1
- package/contracts/workspace-intelligence/agent-framework-admission-candidate.v2.json +217 -0
- package/contracts/workspace-intelligence/agent-framework-conformance-report.v2.json +274 -0
- package/contracts/workspace-intelligence-architecture.v1.json +5 -3
- package/dist/analyze-QVRVJB7I.js +1 -0
- package/dist/{artifact-remediation-plan-HD5K52UJ.js → artifact-remediation-plan-SRH2Q6N2.js} +1 -1
- package/dist/autopilot-release-DOGIETAT.js +1 -0
- package/dist/capabilities-command-FYBUVHZ7.js +1 -0
- package/dist/{chunk-SCKEFXF5.js → chunk-23CNBYIW.js} +1 -1
- package/dist/chunk-2DZLCINC.js +1 -0
- package/dist/{chunk-2GWQ6NZV.js → chunk-2I2A55RE.js} +1 -1
- package/dist/{chunk-W7I65IXY.js → chunk-3HXEPDFF.js} +2 -2
- package/dist/{chunk-2OCJKLTW.js → chunk-4BBFEHPL.js} +1 -1
- package/dist/{chunk-VHMDWRDG.js → chunk-4BPZJR4Z.js} +4 -4
- package/dist/{chunk-UE7ART6X.js → chunk-4MXKXHLW.js} +1 -1
- package/dist/{chunk-JKAAKE4Z.js → chunk-4R44E7HN.js} +1 -1
- package/dist/chunk-5HNQIMGW.js +1 -0
- package/dist/chunk-5S6IZ6PY.js +2 -0
- package/dist/chunk-6BO4QHKA.js +1 -0
- package/dist/{chunk-25V5XMWB.js → chunk-AGI46TSQ.js} +1 -1
- package/dist/{chunk-2CT5SN2L.js → chunk-BZLDCASY.js} +1 -1
- package/dist/{chunk-OA2YJN22.js → chunk-DWDYLKVW.js} +1 -1
- package/dist/{chunk-6B7L4NZE.js → chunk-EFHSRPW7.js} +6 -6
- package/dist/{chunk-RTD5D35M.js → chunk-FBF767WP.js} +1 -1
- package/dist/{chunk-NGZF4YJS.js → chunk-FD2ZGGCQ.js} +1 -1
- package/dist/chunk-H4YHIOCT.js +7 -0
- package/dist/{chunk-ZI54C2AO.js → chunk-HRGIHWYH.js} +1 -1
- package/dist/{chunk-HDISUL3F.js → chunk-IKNWNGLY.js} +1 -1
- package/dist/{chunk-NRIMJMTF.js → chunk-KO4DM2AV.js} +8 -8
- package/dist/{chunk-6KMR5PKQ.js → chunk-KW35SWG6.js} +5 -5
- package/dist/{chunk-NI5QWBZK.js → chunk-L6VNI4DN.js} +1 -1
- package/dist/chunk-NSC4VWV2.js +1 -0
- package/dist/chunk-P5LI5DL3.js +1 -0
- package/dist/chunk-PSQPKK6H.js +97 -0
- package/dist/chunk-PUH3TSPC.js +1 -0
- package/dist/chunk-QFDTKOYS.js +2649 -0
- package/dist/chunk-QIPW3G2H.js +1 -0
- package/dist/chunk-QVFIR64T.js +10 -0
- package/dist/{chunk-AICCXYY5.js → chunk-R3Z4LY3O.js} +1 -1
- package/dist/chunk-RKFTUIZ4.js +4 -0
- package/dist/chunk-ROOPODG6.js +2 -0
- package/dist/{chunk-COOVCORC.js → chunk-SVO2GGTV.js} +1 -1
- package/dist/chunk-TFFNHWXY.js +4 -0
- package/dist/chunk-TJ3MDZMC.js +6 -0
- package/dist/{chunk-DJH2CH42.js → chunk-UHIN3RS6.js} +1 -1
- package/dist/chunk-UOTOJJI4.js +681 -0
- package/dist/chunk-VODNLROY.js +1 -0
- package/dist/{chunk-3WQ5TYCO.js → chunk-X7MDTBX5.js} +1 -1
- package/dist/{chunk-RPM67N7A.js → chunk-XHUM372O.js} +1 -1
- package/dist/chunk-YLLCZMKP.js +2 -0
- package/dist/{chunk-4VSQNSGH.js → chunk-Z2M2XCIB.js} +1 -1
- package/dist/chunk-ZXQC36NJ.js +1 -0
- package/dist/{create-P4XJVZCL.js → create-ZRUQ3KNZ.js} +1 -1
- package/dist/{demo-kit-ALW6OSQV.js → demo-kit-QNGY4KQ5.js} +1 -1
- package/dist/{doctor-PFN6KB6P.js → doctor-7V7LJLHX.js} +1 -1
- package/dist/{dotnet-webapi-clean-6Z4EXEJY.js → dotnet-webapi-clean-GXTNZMKO.js} +1 -1
- package/dist/{goal-lifecycle-BDWTWS55.js → goal-lifecycle-EM4DUJCR.js} +1 -1
- package/dist/{goal-pack-5JDNZFKV.js → goal-pack-YMWZHAH6.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.d.ts +12 -6
- package/dist/index.js +255 -253
- package/dist/{pipeline-OUYS4ZYV.js → pipeline-6MBH3MU2.js} +1 -1
- package/dist/platform-capabilities-RWOWND5Q.js +1 -0
- package/dist/{project-agent-entry-75WO3QWP.js → project-agent-entry-ZXAE2MAJ.js} +1 -1
- package/dist/{project-intelligence-lens-JCHFOIA7.js → project-intelligence-lens-NBTPOK2R.js} +1 -1
- package/dist/{project-test-coverage-3P5FH6E5.js → project-test-coverage-HOZC72EK.js} +1 -1
- package/dist/proof-carrying-change-WJFAKK3C.js +1 -0
- package/dist/{pythonRapidkitExec-UMFLDIYR.js → pythonRapidkitExec-S35OEIEF.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-B7EX2PBE.js +1 -0
- package/dist/{workspace-CBQDOUSH.js → workspace-EBPYCSEM.js} +1 -1
- package/dist/{workspace-agent-sync-RTOTO3DY.js → workspace-agent-sync-Y4F6FBBC.js} +1 -1
- package/dist/{workspace-context-STRZO2N3.js → workspace-context-Y7F7GJCQ.js} +1 -1
- package/dist/{workspace-contract-PMHUUKFM.js → workspace-contract-XJMWMVQE.js} +1 -1
- package/dist/{workspace-explain-CATMJUMN.js → workspace-explain-T2J5ZLY7.js} +1 -1
- package/dist/{workspace-foundation-OULCDCXG.js → workspace-foundation-2UP6IMTH.js} +1 -1
- package/dist/{workspace-graph-stream-Q55CI4K4.js → workspace-graph-stream-MZVL3OCX.js} +1 -1
- package/dist/workspace-graph-token-efficiency-WF6TGSK7.js +1 -0
- package/dist/{workspace-intelligence-3RPZRWSF.js → workspace-intelligence-FZRQIFFM.js} +1 -1
- package/dist/{workspace-intelligence-benchmark-R5MEGJQS.js → workspace-intelligence-benchmark-V6AEVDMB.js} +1 -1
- package/dist/{workspace-intelligence-runner-BNZUYUUN.js → workspace-intelligence-runner-IXT62JG7.js} +1 -1
- package/dist/{workspace-knowledge-graph-VJLD35ES.js → workspace-knowledge-graph-EFC4TUDZ.js} +1 -1
- package/dist/workspace-knowledge-graph-query-BROIV27M.js +1 -0
- package/dist/workspace-knowledge-graph-snapshot-QIMF7TCF.js +1 -0
- package/dist/{workspace-mcp-serve-67NTYD67.js → workspace-mcp-serve-C42UUU7W.js} +1 -1
- package/dist/{workspace-model-6TKZMNEF.js → workspace-model-72SJ6WXT.js} +1 -1
- package/dist/{workspace-onboarding-7V7EH3RH.js → workspace-onboarding-TFDAIHTS.js} +1 -1
- package/dist/{workspace-registry-summary-ILVO7DEU.js → workspace-registry-summary-ZNTXSUI4.js} +1 -1
- package/dist/{workspace-repair-engine-2VGFB3DJ.js → workspace-repair-engine-542TAL3Z.js} +1 -1
- package/dist/workspace-run-NAPJYNSZ.js +1 -0
- package/dist/{workspace-verify-VQWYDAF2.js → workspace-verify-UXKENOQU.js} +1 -1
- package/dist/{workspace-watch-2Z636HWS.js → workspace-watch-DV5AHLOK.js} +1 -1
- package/docs/README.md +2 -2
- package/docs/agent-framework-adapters.md +190 -46
- package/docs/ci-workflows.md +37 -14
- package/docs/commands-reference.md +30 -14
- package/docs/creating-workspaces-and-projects.md +30 -10
- package/docs/doctor-command.md +6 -0
- package/docs/native-kit-baselines.md +4 -0
- package/docs/workspace-run.md +10 -0
- package/package.json +7 -4
- package/scripts/enterprise-package-smoke.mjs +98 -5
- package/dist/analyze-Z3EZNJRI.js +0 -1
- package/dist/autopilot-release-T6XFRWZT.js +0 -1
- package/dist/capabilities-command-VK3LQLP2.js +0 -1
- package/dist/chunk-566NQQTJ.js +0 -97
- package/dist/chunk-5EEXLM45.js +0 -1
- package/dist/chunk-65AE7EC5.js +0 -2
- package/dist/chunk-6NSJBKKK.js +0 -4
- package/dist/chunk-7NKM6EHE.js +0 -7
- package/dist/chunk-ABUSBLBH.js +0 -1
- package/dist/chunk-BR6QIYQS.js +0 -1
- package/dist/chunk-CMLLERGG.js +0 -418
- package/dist/chunk-DFREJHG7.js +0 -1
- package/dist/chunk-FU6SQ2ND.js +0 -1
- package/dist/chunk-M6DVNC6X.js +0 -2
- package/dist/chunk-O5XQP5E7.js +0 -1
- package/dist/chunk-OH6LV5JP.js +0 -6
- package/dist/chunk-PTI743SC.js +0 -7
- package/dist/chunk-QBKOPXKC.js +0 -1
- package/dist/chunk-RGNCL5OB.js +0 -1
- package/dist/chunk-VJQPIH2S.js +0 -681
- package/dist/chunk-WPPRUFJW.js +0 -4
- package/dist/chunk-ZKYH44ER.js +0 -1
- package/dist/platform-capabilities-DB4BZPTD.js +0 -1
- package/dist/proof-carrying-change-LAYV4LTI.js +0 -1
- package/dist/verified-goal-75KGBWTE.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-TQAKDDUA.js +0 -1
- package/dist/workspace-run-X7KV6MIT.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {c}from'./chunk-N4B2M44I.js';import {a}from'./chunk-A5FBGRJA.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {b}from'./chunk-VN2MKTQO.js';import {
|
|
1
|
+
import {c}from'./chunk-N4B2M44I.js';import {a}from'./chunk-A5FBGRJA.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {b}from'./chunk-VN2MKTQO.js';import {w,x,y}from'./chunk-6BO4QHKA.js';import {h}from'./chunk-EFHSRPW7.js';import {a as a$1}from'./chunk-TQEMLBAG.js';import {u,t}from'./chunk-VQZ5PI5J.js';import {t as t$1,s}from'./chunk-ODK4LCEL.js';import {promises}from'fs';import {randomUUID}from'crypto';import n from'path';import p from'chalk';import le from'fs-extra';import N from'ora';import {execa}from'execa';var de=3e4,me=45e3;async function ge(e){try{let r=await execa("git",["rev-parse","--show-toplevel"],{cwd:e,env:a$1()});return r.stdout.trim()?n.resolve(e,r.stdout.trim()):null}catch{return null}}async function re(e,r,t){if(await ge(e)){r.warn("Git initialization skipped because target is already inside a git worktree");return}r.start("Initializing git repository...");try{await execa("git",["init"],{cwd:e,env:a$1()}),await execa("git",["add","."],{cwd:e,env:a$1()}),await execa("git",["-c","user.name=Workspai","-c","user.email=workspai@localhost","commit","-m",t],{cwd:e,env:a$1()}),r.succeed("Git repository initialized");}catch{r.warn("Could not initialize git repository");}}function G(e){let r=a(e.path),t=Array.isArray(e.projects)?e.projects:[],o=[],a$1=new Set;for(let s of t){if(!s||typeof s.name!="string"||typeof s.path!="string")continue;let i=a(s.path);a$1.has(i)||(a$1.add(i),o.push({name:s.name,path:i}));}return {name:e.name,path:r,mode:e.mode,projects:o}}function I(e){let r=[],t=new Set;for(let o of e.workspaces||[]){if(!o||typeof o.name!="string"||typeof o.path!="string")continue;let a=G(o);t.has(a.path)||(t.add(a.path),r.push(a));}return {workspaces:r}}async function ue(e){let r;try{r=await promises.readFile(e,"utf8");}catch(t){if(t.code==="ENOENT")return {workspaces:[]};throw t}try{let t=JSON.parse(r);if(!t||!Array.isArray(t.workspaces))throw new Error("missing workspaces array");return I(t)}catch(t){throw new Error(`Workspace registry is invalid: ${e}`,{cause:t})}}async function ke(e){let r;try{r=await promises.readFile(e,"utf8");}catch(o){if(o.code==="ENOENT")return {workspaces:[]};throw o}let t;try{t=JSON.parse(r);}catch(o){throw new Error(`Workspace registry is invalid: ${e}`,{cause:o})}if(!t||typeof t!="object"||!Array.isArray(t.workspaces))throw new Error(`Workspace registry is invalid: ${e}`);for(let o of t.workspaces)if(!o||typeof o.name!="string"||typeof o.path!="string"||o.mode!==void 0&&typeof o.mode!="string"||o.projects!==void 0&&!Array.isArray(o.projects)||Array.isArray(o.projects)&&o.projects.some(a=>!a||typeof a.name!="string"||typeof a.path!="string"))throw new Error(`Workspace registry contains an invalid entry: ${e}`);return I(t)}async function z(){let e={workspaces:[]},r=new Set;for(let t of y()){let o=await ue(t);for(let a of o.workspaces)r.has(a.path)||(r.add(a.path),e.workspaces.push(a));}return e}async function oe(e=y()){let r={workspaces:[]},t=new Set;for(let o of e){let a=await ke(o);for(let s of a.workspaces)t.has(s.path)||(t.add(s.path),r.workspaces.push(s));}return r}function fe(e){let r=e?.code;return process.platform==="win32"&&(r==="EPERM"||r==="EINVAL"||r==="ENOSYS")}async function ae(e){try{await e.sync();}catch(r){if(!fe(r))throw r}}async function X(e,r){let t=n.dirname(e);await promises.mkdir(t,{recursive:true});let o=`${n.basename(e)}.`,a=Date.now();for(let i of await promises.readdir(t)){if(!i.startsWith(o)||!i.endsWith(".tmp"))continue;let c=n.join(t,i),d=await promises.stat(c).catch(()=>null);d&&a-d.mtimeMs>3e4&&await promises.rm(c,{force:true}).catch(()=>{});}let s=await promises.readFile(e,"utf8").catch(()=>null);if(s!==null){let i=false;try{let c=JSON.parse(s);i=Array.isArray(c.workspaces);}catch{i=false;}if(!i){let c=`${e}.corrupt-${Date.now()}`;await promises.copyFile(e,c);}}await se(e,`${JSON.stringify(I(r),null,2)}
|
|
2
2
|
`);}async function se(e,r){let t=n.dirname(e);await promises.mkdir(t,{recursive:true});let o=`${e}.${process.pid}.${randomUUID()}.tmp`;try{await promises.writeFile(o,r);let a=await promises.open(o,"r");try{await ae(a);}finally{await a.close();}try{await promises.rename(o,e);}catch(s){let i=s.code;if(i!=="EEXIST"&&i!=="EPERM")throw s;await le.move(o,e,{overwrite:true});}}finally{await promises.rm(o,{force:true}).catch(()=>{});}}async function Z(e){try{return {exists:true,content:await promises.readFile(e)}}catch(r){if(r.code==="ENOENT")return {exists:false};throw r}}async function ee(e,r){if(!r.exists){await promises.rm(e,{force:true});return}await se(e,r.content);}async function we(e,r){let t=n.join(e,"workspaces.json.lock"),o=randomUUID();await promises.mkdir(e,{recursive:true});let a=Date.now(),s;for(;!s;)try{s=await promises.open(t,"wx"),await s.writeFile(`${JSON.stringify({pid:process.pid,lockId:o,createdAt:new Date().toISOString()})}
|
|
3
|
-
`),await ae(s);}catch(i){if(i.code!=="EEXIST")throw i;let c=await promises.stat(t).catch(()=>null);if(c&&Date.now()-c.mtimeMs>de){let d=await promises.readFile(t,"utf8").then(g=>JSON.parse(g)).catch(()=>null),u=Number(d?.pid),f=false;if(Number.isInteger(u)&&u>0)try{process.kill(u,0),f=true;}catch(g){f=g.code==="EPERM";}if(!f){await promises.rm(t,{force:true}).catch(()=>{});continue}}if(Date.now()-a>me)throw new Error(`Timed out waiting for workspace registry lock: ${t}`);await new Promise(d=>setTimeout(d,25));}try{return await r()}finally{await s.close().catch(()=>{}),await promises.readFile(t,"utf8").then(c=>JSON.parse(c).lockId===o).catch(()=>false)&&await promises.rm(t,{force:true}).catch(()=>{});}}async function S(e){let r
|
|
3
|
+
`),await ae(s);}catch(i){if(i.code!=="EEXIST")throw i;let c=await promises.stat(t).catch(()=>null);if(c&&Date.now()-c.mtimeMs>de){let d=await promises.readFile(t,"utf8").then(g=>JSON.parse(g)).catch(()=>null),u=Number(d?.pid),f=false;if(Number.isInteger(u)&&u>0)try{process.kill(u,0),f=true;}catch(g){f=g.code==="EPERM";}if(!f){await promises.rm(t,{force:true}).catch(()=>{});continue}}if(Date.now()-a>me)throw new Error(`Timed out waiting for workspace registry lock: ${t}`);await new Promise(d=>setTimeout(d,25));}try{return await r()}finally{await s.close().catch(()=>{}),await promises.readFile(t,"utf8").then(c=>JSON.parse(c).lockId===o).catch(()=>false)&&await promises.rm(t,{force:true}).catch(()=>{});}}async function S(e){let r=w(),t=n.join(r,"workspaces.json"),o=n.join(x(),"workspaces.json"),a=[...new Set(y())];return we(r,async()=>{let[s,i]=await Promise.all([Z(t),Z(o)]),c=await oe(a);await e(c);let d=I(c);try{await X(t,d),await X(o,d);}catch(u){let g=(await Promise.allSettled([ee(t,s),ee(o,i)])).filter(k=>k.status==="rejected").map(k=>k.reason);throw g.length>0?new AggregateError([u,...g],"Workspace registry transaction failed and could not be fully restored"):u}return d})}async function ie(e,r){let t=a(e);await S(o=>{let a=o.workspaces.find(s=>s.path===t);if(a){a.name=r,a.mode=a.mode||"full",a.projects=Array.isArray(a.projects)?a.projects:[];return}o.workspaces.push({name:r,path:t,mode:"full",projects:[]});});}async function He(e){let r=a(e),o=(await oe()).workspaces.find(a=>a.path===r);return o?{...o,projects:o.projects.map(a=>({...a}))}:null}async function Ke(e,r){let t=a(e);await S(o=>{let a=o.workspaces.findIndex(i=>i.path===t);if(!r){a>=0&&o.workspaces.splice(a,1);return}let s=G(r);a>=0?o.workspaces[a]=s:o.workspaces.push(s);});}async function qe(e){let r=a(e);await S(t=>{t.workspaces=t.workspaces.filter(o=>o.path!==r);});}async function he(e,r){try{await ie(e,r);}catch{console.warn(p.gray("Note: Could not register workspace in shared registry"));}}async function Qe(e,r=false){let t=a(e),o={workspacePath:t,workspaceFound:false,added:[],skipped:0};try{let a$1=await z(),s=a$1.workspaces.find(k=>k.path===t);if(!s){if(await he(t,n.basename(n.resolve(e))),a$1=await z(),s=a$1.workspaces.find(k=>k.path===t),!s)return r||console.log("\u26A0\uFE0F Workspace could not be registered in registry"),o;r||console.log("\u2714 Registered workspace in shared registry");}Array.isArray(s.projects)||(s.projects=[]);let i=0,c=0,d=[],u$1=[],f=[e],g=new Set;for(;f.length>0;){let k=f.shift();if(!k||g.has(k))continue;g.add(k);let w=await promises.readdir(k,{withFileTypes:true});for(let h of w){if(!h.isDirectory()||h.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(h.name))continue;let v=n.join(k,h.name),y=a(v);try{let x=false;for(let P of [...u(y,"context.json"),...u(y,"project.json")])try{await promises.access(P),x=true;break}catch{}if(x){let P=n.basename(y),m=s.projects.some($=>$.path===y);u$1.push({name:P,path:y}),m?c++:(s.projects.push({name:P,path:y}),i++,d.push(y),r||console.log(`\u2714 Added: ${n.relative(e,y)}`));continue}}catch{}f.push(v);}}return await S(k=>{let w=k.workspaces.find(y=>y.path===t);if(!w)return;let h=`${t}${n.sep}`,v=(w.projects||[]).filter(y=>y.path!==t&&!y.path.startsWith(h));w.projects=G({...w,projects:[...v,...u$1]}).projects;}),i>0?r||console.log(`
|
|
4
4
|
\u2705 Synced ${i} project(s) to registry`):r||console.log(`
|
|
5
|
-
\u2705 All projects already registered (${c} found)`),{workspacePath:t,workspaceFound:true,added:d,skipped:c}}catch(a){return r||console.error("\u274C Failed to sync projects:",a.message),o}}async function ye(e,r,t){let o=a(e),a$1=a(t);await S(s=>{let i=s.workspaces.find(u=>u.path===o);if(!i)throw new Error(`Workspace is not registered: ${o}`);i.projects=Array.isArray(i.projects)?i.projects:[];let c=i.projects.findIndex(u=>u.path===a$1||u.name===r),d={name:r,path:a$1};c>=0?i.projects[c]=d:i.projects.push(d);});}async function Xe(e,r,t){try{await ye(e,r,t);}catch{}}async function Ze(e,r){let t=N("Creating Workspai workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(n.join(e,".workspai"),{recursive:true});let o={workspace_name:r.name,author:r.author,rapidkit_version:h(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(n.join(e,".workspai","config.json"),JSON.stringify(o,null,2));let{syncWorkspaceFoundationFiles:a}=await import('./create-
|
|
5
|
+
\u2705 All projects already registered (${c} found)`),{workspacePath:t,workspaceFound:true,added:d,skipped:c}}catch(a){return r||console.error("\u274C Failed to sync projects:",a.message),o}}async function ye(e,r,t){let o=a(e),a$1=a(t);await S(s=>{let i=s.workspaces.find(u=>u.path===o);if(!i)throw new Error(`Workspace is not registered: ${o}`);i.projects=Array.isArray(i.projects)?i.projects:[];let c=i.projects.findIndex(u=>u.path===a$1||u.name===r),d={name:r,path:a$1};c>=0?i.projects[c]=d:i.projects.push(d);});}async function Xe(e,r,t){try{await ye(e,r,t);}catch{}}async function Ze(e,r){let t=N("Creating Workspai workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(n.join(e,".workspai"),{recursive:true});let o={workspace_name:r.name,author:r.author,rapidkit_version:h(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(n.join(e,".workspai","config.json"),JSON.stringify(o,null,2));let{syncWorkspaceFoundationFiles:a}=await import('./create-ZRUQ3KNZ.js');await a(e,{workspaceName:r.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let s=$e();await promises.writeFile(n.join(e,"rapidkit"),s),await promises.chmod(n.join(e,"rapidkit"),493);let i=je();await promises.writeFile(n.join(e,"rapidkit.cmd"),i);let c=ve(r.name);await promises.writeFile(n.join(e,"README.md"),c),await promises.writeFile(n.join(e,".gitignore"),`# Workspai workspace
|
|
6
6
|
.env
|
|
7
7
|
.env.*
|
|
8
8
|
!.env.example
|
|
@@ -17,7 +17,7 @@ Thumbs.db
|
|
|
17
17
|
|
|
18
18
|
# Logs
|
|
19
19
|
*.log
|
|
20
|
-
`),await _e(e),t.succeed("Workspace created!"),r.skipGit||await re(e,N(),"Initial commit: Workspai workspace"),await ie(e,r.name);let{publishWorkspaceRegistrySummary:u}=await import('./workspace-registry-summary-
|
|
20
|
+
`),await _e(e),t.succeed("Workspace created!"),r.skipGit||await re(e,N(),"Initial commit: Workspai workspace"),await ie(e,r.name);let{publishWorkspaceRegistrySummary:u}=await import('./workspace-registry-summary-ZNTXSUI4.js');await u(e),console.log(`
|
|
21
21
|
${p.green("\u2728 Workspai workspace created successfully!")}
|
|
22
22
|
|
|
23
23
|
${p.bold("\u{1F4C2} Workspace structure:")}
|
|
@@ -651,7 +651,7 @@ ${p.bold("\u{1F310} API endpoints:")}
|
|
|
651
651
|
http://localhost:8000/examples/notes # Example API
|
|
652
652
|
|
|
653
653
|
${p.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
654
|
-
`);}catch(s){throw a.fail(`Failed to create ${o} project`),s}}async function ne(e,r,t){let o=await promises.readdir(e,{withFileTypes:true});for(let a of o){let s=n.join(e,a.name),i=a.name.replace(/\.j2$/,""),c=n.join(r,i);if(a.isDirectory())await promises.mkdir(c,{recursive:true}),await ne(s,c,t);else {let d=await promises.readFile(s,"utf-8");a.name.endsWith(".j2")&&(d=Pe(d,t)),await promises.writeFile(c,d),(i==="rapidkit"||i==="activate"||i.endsWith(".py")&&(c.includes(".workspai")||c.includes(".rapidkit")))&&await promises.chmod(c,493);}}}function Pe(e,r){let t=e;for(let[o,a]of Object.entries(r)){let s=new RegExp(`\\{\\{\\s*${o}\\s*\\}\\}`,"g");t=t.replace(s,String(a));let i=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");t=t.replace(i,(u,f,g)=>String(a).replace(new RegExp(f,"g"),g));let c=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(c,String(a).toLowerCase());let d=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(d,(u,f,g)=>String(a).replace(new RegExp(f,"g"),g).toLowerCase());}return t}async function tt(e={}){let r=
|
|
654
|
+
`);}catch(s){throw a.fail(`Failed to create ${o} project`),s}}async function ne(e,r,t){let o=await promises.readdir(e,{withFileTypes:true});for(let a of o){let s=n.join(e,a.name),i=a.name.replace(/\.j2$/,""),c=n.join(r,i);if(a.isDirectory())await promises.mkdir(c,{recursive:true}),await ne(s,c,t);else {let d=await promises.readFile(s,"utf-8");a.name.endsWith(".j2")&&(d=Pe(d,t)),await promises.writeFile(c,d),(i==="rapidkit"||i==="activate"||i.endsWith(".py")&&(c.includes(".workspai")||c.includes(".rapidkit")))&&await promises.chmod(c,493);}}}function Pe(e,r){let t=e;for(let[o,a]of Object.entries(r)){let s=new RegExp(`\\{\\{\\s*${o}\\s*\\}\\}`,"g");t=t.replace(s,String(a));let i=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");t=t.replace(i,(u,f,g)=>String(a).replace(new RegExp(f,"g"),g));let c=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(c,String(a).toLowerCase());let d=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(d,(u,f,g)=>String(a).replace(new RegExp(f,"g"),g).toLowerCase());}return t}async function tt(e={}){let r=w(),t=n.join(r,"workspaces.json"),o=await z();if(o.workspaces.length===0){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:false}},null,2));return}console.log(p.yellow(`
|
|
655
655
|
\u26A0\uFE0F No workspaces registered yet.
|
|
656
656
|
`)),console.log(p.gray(`Create a workspace with: npx workspai <workspace-name>
|
|
657
657
|
`));return}try{let a=o;if(!a||typeof a!="object"||!Array.isArray(a.workspaces)){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.invalid",message:"Workspace registry is invalid."}},null,2));return}console.log(p.yellow(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-QVFIR64T.js';import {a as a$1,e}from'./chunk-P5LI5DL3.js';import {a as a$3}from'./chunk-SVO2GGTV.js';import {g,a,h}from'./chunk-BLEIUQL6.js';import {p,s}from'./chunk-ODK4LCEL.js';import a$2 from'chalk';import re from'fs';import b$1 from'path';import {execa}from'execa';var V="autopilot-release-last-run.json",G="autopilot-release.json";function $(r){try{return JSON.parse(r)}catch{return null}}function Se(r){let e=b$1.resolve(r),n=a$3(e);if(!n)throw new Error("No Workspai workspace found in current directory or parents");return n}async function S(r,e){let n=process.argv[1];if(!n)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let o=await execa(process.execPath,[n,...r],{cwd:e,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr,crashed:false}}catch(o){return {exitCode:1,stdout:"",stderr:o instanceof Error?o.message:String(o),crashed:true}}}function oe(r){let e=r.toLowerCase();return e==="pass"?"pass":e==="warn"?"warn":e==="fail"?"fail":"warn"}function ae(r){return r.summary.failed>0||r.gates.results.some(e=>e.status==="fail")?"fail":r.gates.results.some(e=>e.status==="warn")?"warn":"pass"}function be(r){let e=r.filter(o=>o.status!=="skipped");if(e.length===0)return 100;let n=e.reduce((o,t)=>t.status==="pass"?o+1:t.status==="warn"?o+.6:o,0);return Math.round(n/e.length*100)}function Ae(r){return r.executionError?["Re-run: npx workspai autopilot release --mode audit --json","Inspect .workspai/reports/autopilot-release-last-run.json for execution failure details"]:r.blockers.length>0?["Run: npx workspai doctor workspace --plan","Run: npx workspai readiness --json --strict","Run: npx workspai workspace run test --affected --strict"]:r.hasWarnings&&r.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx workspai autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function xe(r,e){await re.promises.mkdir(b$1.dirname(r),{recursive:true}),await re.promises.writeFile(r,`${JSON.stringify(e,null,2)}
|
|
2
2
|
`,"utf-8");}async function ze(r){let e$1=Se(r.workspacePath),n=r.mode,o=[],t=[],L,H,N,q,Q,X=0,f=false,I=0,_=0,W=-1,T=-1,c="skipped",d="skipped",ne=n==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(r.skipPipelineStages)o.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 s=Date.now(),l=await S([...ne],e$1),m=Date.now()-s;if(c="pass",l.crashed)c="fail",f=true,t.push(`doctor workspace execution error: ${l.stderr||"unknown error"}`);else if(l.exitCode===1)c="fail",t.push("doctor workspace command failed or reported errors");else if(l.exitCode===2)c="warn",t.push("doctor workspace reported warnings");else if(l.exitCode!==0)c="fail",t.push("doctor workspace command failed");else {let p=$(l.stdout),E=p&&p.healthScore&&typeof p.healthScore=="object"?p.healthScore:{},k=Number(E.errors??0),C=Number(E.warnings??0);Number.isFinite(k)&&k>0?(c="fail",t.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(C)&&C>0&&(c="warn");}W=o.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,n==="enforce"&&c==="warn"&&t.push("doctor workspace reported warnings under enforce mode");let g$1=Date.now(),w=await S(["analyze","--json"],e$1),P=Date.now()-g$1;H=await g(e$1,p.analyze)??a(e$1,p.analyze);let i="pass";if(w.crashed)i="fail",f=true,t.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)i=w.exitCode===2?"warn":"fail",t.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let p=$(w.stdout),E=p&&p.summary&&typeof p.summary=="object"?p.summary:{},k=String(E.verdict??"ready");k==="blocked"?(i="fail",t.push("analyze reported blocked verdict")):k==="needs-attention"&&(i="warn");}o.push({name:"analyze",status:i,durationMs:P,summary:i==="pass"?"analyze passed":i==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),n==="enforce"&&i==="warn"&&t.push("analyze reported warnings under enforce mode");let v=Date.now(),h=await S(["readiness","--json"],e$1),y=Date.now()-v;if(d="fail",h.crashed)d="fail",f=true,t.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)d="fail",t.push("readiness command failed");else {let p=$(h.stdout),E=String(p?.overallStatus??"fail");if(d=oe(E),typeof p?.evidencePath=="string"&&p.evidencePath.trim().length>0&&(L=p.evidencePath),d==="fail"){let k=Array.isArray(p?.blockingReasons)?p?.blockingReasons.filter(C=>typeof C=="string"):[];k.length>0?t.push(...k.map(C=>`readiness: ${C}`)):t.push("readiness overall status is fail");}}T=o.push({name:"readiness",status:d,durationMs:y,summary:`readiness overall status is ${d}`})-1,n==="enforce"&&d==="warn"&&t.push("readiness reported warnings under enforce mode");}let ie=Date.now(),D=await S(["doctor","workspace","--plan","--json"],e$1),le=Date.now()-ie,R="warn";if(D.crashed)R="fail",f=true,t.push(`doctor remediation plan execution error: ${D.stderr||"unknown error"}`);else if(D.exitCode!==0)R="fail",t.push("doctor remediation plan command failed");else {let s=$(D.stdout),l=s&&s.remediationPlan&&typeof s.remediationPlan=="object"?s.remediationPlan:null,m=Number(l?.totalSteps??0),g=Number(l?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(_=g),Number.isFinite(m)&&m===0?R="pass":R="warn";}if(o.push({name:"remediation-plan",status:R,durationMs:le,summary:R==="pass"?"no remediation steps required":"remediation steps available"}),n==="enforce"&&R==="warn"&&t.push("remediation plan has pending steps under enforce mode"),n==="safe-fix"){let s=Date.now(),l=await S(["doctor","workspace","--apply"],e$1),m=Date.now()-s,g=l.crashed||l.exitCode!==0?"fail":"pass";if(l.crashed)f=true,t.push(`doctor remediation apply execution error: ${l.stderr||"unknown error"}`);else if(g==="fail")t.push("doctor remediation apply failed");else {X=_>0?_:I>0?I:1;let w=await S(["doctor","workspace","--json"],e$1);if(w.crashed)c="fail",f=true,t.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",t.push("post-apply doctor workspace command failed");else {let i=$(w.stdout),v=i&&i.healthScore&&typeof i.healthScore=="object"?i.healthScore:{},h=Number(v.errors??0),y=Number(v.warnings??0);Number.isFinite(h)&&h>0?(c="fail",t.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(y)&&y>0?c="warn":c="pass";}W>=0&&(o[W].status=c,o[W].summary=`doctor workspace post-apply status is ${c}`);let P=await S(["readiness","--json"],e$1);if(P.crashed)d="fail",f=true,t.push(`post-apply readiness execution error: ${P.stderr||"unknown error"}`);else if(P.exitCode!==0)d="fail",t.push("post-apply readiness command failed");else {let i=$(P.stdout),v=String(i?.overallStatus??"fail");if(d=oe(v),typeof i?.evidencePath=="string"&&i.evidencePath.trim().length>0&&(L=i.evidencePath),d==="fail"){let h=Array.isArray(i?.blockingReasons)?i?.blockingReasons.filter(y=>typeof y=="string"):[];h.length>0?t.push(...h.map(y=>`post-apply readiness: ${y}`)):t.push("post-apply readiness overall status is fail");}}T>=0&&(o[T].status=d,o[T].summary=`readiness post-apply overall status is ${d}`);}o.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else o.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ce=Date.now(),A="pass",x="workspace test/build completed for selected projects";try{let s=await b({workspacePath:e$1,stage:"test",affected:true,since:r.since,parallel:r.parallel,maxWorkers:r.maxWorkers,strict:true,json:true,enforceGates:false});N=a(e$1,b$1.join(".workspai","reports",a$1)),await e(e$1,s),q=N;let l=ae(s);if(l==="fail")A="fail",x="workspace test stage failed for selected projects",t.push("workspace run test failed for selected projects");else {l==="warn"&&(A="warn",x="workspace test stage completed with warnings",n==="enforce"&&t.push("workspace run test reported warnings under enforce mode"));let m=await b({workspacePath:e$1,stage:"build",affected:true,since:r.since,parallel:r.parallel,maxWorkers:r.maxWorkers,strict:true,json:true,enforceGates:false});await e(e$1,m),Q=N;let g=ae(m);g==="fail"?(A="fail",x="workspace build stage failed for selected projects",t.push("workspace run build failed for selected projects")):g==="warn"&&(A="warn",x="workspace test/build completed with warnings",n==="enforce"&&t.push("workspace run test/build reported warnings under enforce mode"));}}catch(s){A="fail",x="workspace test/build orchestration failed",f=true,t.push(`workspace run orchestration error: ${s instanceof Error?s.message:String(s)}`);}let pe=Date.now()-ce;o.push({name:"workspace-run-test-build",status:A,durationMs:pe,summary:x});let M=o.filter(s=>s.status==="warn").length,ue=o.filter(s=>s.status==="fail").length,F=n==="enforce"?o.some(s=>s.status==="warn"||s.status==="fail"):ue>0,j=[...new Set(t)],O=f||F?Math.max(1,j.length):0,de=O>0?j:[],fe=O===0?j:[],me=be(o),ge=f||F?"blocked":M>0?"partial":"approved",we=f?3:F?1:M>0?2:0,he=Ae({mode:n,executionError:f,blockers:j,hasWarnings:M>0}),Y=a(e$1,".workspai/reports"),ke=b$1.join(Y,V),ye=b$1.join(Y,G),u={schemaVersion:s.autopilotReleaseLastRun.schemaVersion,generatedAt:new Date().toISOString(),workspacePath:e$1,mode:n,summary:{releaseScore:me,verdict:ge,blockers:O,warnings:M,safeFixesApplied:X,manualActions:j.length,exitCode:we},stages:o,blockingReasons:de,warningReasons:fe,nextActions:he,artifacts:{reportPath:ke,aliasEvidencePath:ye,analyzeEvidencePath:H,readinessEvidencePath:L,workspaceRunEvidencePath:N,workspaceRunTestPath:q,workspaceRunBuildPath:Q},enterpriseControls:{jsonReady:true,evidencePath:`.workspai/reports/${V}`,aliasEvidencePath:`.workspai/reports/${G}`}};if(await h(e$1,`.workspai/reports/${V}`,u),await h(e$1,`.workspai/reports/${G}`,u),r.output&&await xe(b$1.resolve(r.output),u),!r.json){console.log(a$2.bold.cyan(`
|
|
3
3
|
\u{1F680} Workspai Autopilot Release
|
|
4
4
|
`)),console.log(a$2.bold(`Workspace: ${a$2.cyan(b$1.basename(e$1))}`)),console.log(a$2.gray(`Path: ${e$1}`)),console.log(a$2.white(`Mode: ${n}`)),console.log(a$2.white(`Verdict: ${u.summary.verdict==="approved"?a$2.green("approved"):u.summary.verdict==="partial"?a$2.yellow("partial"):a$2.red("blocked")}`)),console.log(a$2.white(`Release score: ${u.summary.releaseScore}`));for(let s of u.stages){let l=s.status==="pass"?a$2.green("PASS"):s.status==="warn"?a$2.yellow("WARN"):s.status==="skipped"?a$2.gray("SKIP"):a$2.red("FAIL");console.log(` - ${s.name}: ${l} ${s.summary} (${s.durationMs}ms)`);}if(u.blockingReasons.length>0){console.log(a$2.bold.red(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {j,m,e}from'./chunk-H4YHIOCT.js';import {u}from'./chunk-VQZ5PI5J.js';import {t}from'./chunk-ODK4LCEL.js';import u$1 from'path';import d from'fs-extra';import {parse}from'yaml';import w from'fs';var F=new Set(["backend","desktop","extension","service","frontend","worker","agent","platform","library","infra","docs","test-suite","unknown"]),O=new Set([".git",".workspai","vendor","node_modules","test","tests","testdata","fixtures","samples","examples","third_party"]),I=new Set([...O,".cache",".venv","build","dist","target"]);async function L(e){let n=0,t=async(o,r)=>{if(r>5)return false;let s;try{s=await d.readdir(o,{withFileTypes:true});}catch{return false}for(let a of s.sort((f,l)=>f.name.localeCompare(l.name))){if(a.isFile()&&a.name==="main.go"){let f=await d.readFile(u$1.join(o,a.name),"utf8").catch(()=>"");if(/^\s*package\s+main\b/m.test(f)&&(n+=1,n>1))return true}if(a.isDirectory()&&!O.has(a.name)&&await t(u$1.join(o,a.name),r+1))return true}return false};return t(e,0)}async function M(e,n){if(n!=="c"&&n!=="cpp")return false;let t=new Set,o=async(r,s)=>{if(s>3||t.size>=3)return;let a;try{a=await d.readdir(r,{withFileTypes:true});}catch{return}for(let f of a)if(f.isFile()){let l=f.name.toLowerCase();l==="cmakelists.txt"||l==="meson.build"?t.add("native"):l==="pyproject.toml"||l==="setup.py"?t.add("python"):l==="description"&&u$1.basename(r).toLowerCase()==="r"?t.add("r"):l.endsWith(".gemspec")?t.add("ruby"):l==="pom.xml"||l==="build.gradle"||l==="build.gradle.kts"?t.add("java"):l==="cargo.toml"?t.add("rust"):l==="go.mod"?t.add("go"):l==="package.json"&&t.add("node");}else f.isDirectory()&&!I.has(f.name)&&await o(u$1.join(r,f.name),s+1);};return await o(e,0),t.has("native")&&t.size>=3}async function K(e){if((((await d.readFile(u$1.join(e,"pom.xml"),"utf8").catch(()=>"")).match(/<modules\b[^>]*>([\s\S]*?)<\/modules>/iu)?.[1]??"").match(/<module\b[^>]*>[^<]+<\/module>/giu)??[]).length>=2)return true;for(let o of ["settings.gradle","settings.gradle.kts"]){let r=await d.readFile(u$1.join(e,o),"utf8").catch(()=>"");if(!r)continue;if(new Set([...r.matchAll(/['"](:[^'"]+)['"]/gu)].map(a=>a[1])).size>=2)return true}return false}async function $(e){for(let n of ["compose.yaml","compose.yml","docker-compose.yaml","docker-compose.yml"]){let t=await d.readFile(u$1.join(e,n),"utf8").catch(()=>"");if(t)try{let r=parse(t)?.services??{},s=Object.entries(r).map(([i,p])=>{let g=(()=>{if(typeof p?.build=="string")return `${p.build}|Dockerfile`;if(!p?.build||typeof p.build!="object")return null;let c=p.build.context;if(typeof c!="string"||c.length===0)return null;let j="dockerfile"in p.build&&typeof p.build.dockerfile=="string"?p.build.dockerfile:"Dockerfile";return `${c}|${j}`})();return g?{serviceName:i,service:p,identity:g.replaceAll("\\","/").replace(/\/$/,"")}:null}).filter(i=>i!==null);if(new Set(s.map(i=>i.identity)).size<2)continue;let f=new Set(s.map(i=>i.serviceName)),l=new Set(s.filter(({service:i})=>Array.isArray(i.ports)&&i.ports.length>0).map(({identity:i})=>i)),y=s.some(({service:i})=>(Array.isArray(i.depends_on)?i.depends_on:i.depends_on&&typeof i.depends_on=="object"?Object.keys(i.depends_on):[]).some(g=>typeof g=="string"&&f.has(g)));if(l.size>=2||y)return true}catch{}}return false}async function A(e){try{if(!await d.pathExists(e))return null;let n=await d.readJSON(e);return n&&typeof n=="object"?n:null}catch{return null}}async function z(e){for(let n of e){let t=await A(n);if(t)return t}return null}function S(e){if(typeof e!="string")return null;let n=e.trim().toLowerCase();return F.has(n)?n==="service"?"backend":n:null}function re(e){switch(e){case "backend":case "service":case "worker":return "backend";case "agent":return "agent";case "frontend":case "desktop":case "extension":case "library":case "platform":return e;case "infra":return "infrastructure";case "docs":return "documentation";case "test-suite":return "quality";default:return "unknown"}}async function oe(e$1,n,t={}){let o=n??await z(u(e$1,"project.json")),r=j(o)?null:o,s=r===null&&o!==null?m(e$1,null):null,a=S(r?.kind)??S(r?.type);if(a)return a==="worker"&&typeof r?.framework=="string"&&(r.framework.trim().toLowerCase()==="microsoft-agent-framework"||r.framework.trim().toLowerCase()==="openai-agents")?"agent":a;let f=typeof r?.kit_name=="string"?r.kit_name:typeof r?.kit=="string"?r.kit:t.kit,l=typeof r?.framework=="string"?r.framework:t.framework??s?.key,y=typeof r?.runtime=="string"?r.runtime:t.runtime??s?.runtime,i=`${typeof f=="string"?f:""} ${l??""} ${y??""}`.trim().toLowerCase();if(await $(e$1))return "platform";if(/\b(tauri|electron|wails|desktop)\b/.test(i))return "desktop";if(/\b(vscode-extension|visual studio code extension|jetbrains-plugin|browser-extension)\b/.test(i))return "extension";let p=await d.readFile(u$1.join(e$1,"Cargo.toml"),"utf8").catch(()=>""),g=/^\s*\[workspace\]\s*$/m.test(p)&&!/^\s*\[package\]\s*$/m.test(p),c=await A(u$1.join(e$1,"package.json"));if(c!==null&&(Array.isArray(c.workspaces)||c.workspaces!==null&&typeof c.workspaces=="object")||g||e(e$1))return "platform";if(/\b(frontend|nextjs|next\.js|react|vue|svelte|vite|angular|astro|remix|nuxt)\b/.test(i))return "frontend";if(/\b(fastapi|nestjs|springboot|spring boot|gofiber|gogin|webapi|django|flask|express|fastify|laravel|rails|phoenix|axum|actix|rocket)\b/.test(i))return "backend";if(c){let m={...c.dependencies??{},...c.devDependencies??{}},D=c.scripts??{},b=Object.values(D).filter(k=>typeof k=="string").join(" ").toLowerCase(),_=c.engines??{},N=Array.isArray(c.categories)?c.categories.filter(k=>typeof k=="string"):[];if(m["@tauri-apps/api"]||m["@tauri-apps/cli"]||await d.pathExists(u$1.join(e$1,"src-tauri","tauri.conf.json"))||await d.pathExists(u$1.join(e$1,"src-tauri","tauri.conf.json5"))||m.electron||m["@electron-forge/cli"]||b.includes("electron-forge")||b.includes("electron "))return "desktop";if(typeof _.vscode=="string"||N.some(k=>k.toLowerCase()==="extension packs")||c.publisher&&(c.activationEvents||c.contributes))return "extension";if(m.next||m.react||m.vue||m.svelte||m.vite||m["@angular/core"]||b.includes("next ")||b.includes("vite "))return "frontend";if(c.private===true&&!m.express&&!m["@nestjs/core"])return "library"}return g||await K(e$1)||await d.pathExists(u$1.join(e$1,"go.work"))||await d.pathExists(u$1.join(e$1,"go.mod"))&&await L(e$1)?"platform":await M(e$1,y)?"library":await d.pathExists(u$1.join(e$1,"compose.yaml"))||await d.pathExists(u$1.join(e$1,"compose.yml"))||await d.pathExists(u$1.join(e$1,"docker-compose.yml"))||await d.pathExists(u$1.join(e$1,"docker-compose.yaml"))||await d.pathExists(u$1.join(e$1,"terraform.tf"))?"infra":"backend"}var B={ci:[".github/workflows",".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml","Jenkinsfile",".buildkite/pipeline.yml","prow"],release:[".changeset",".releaserc",".releaserc.json","release.config.js",".goreleaser.yml",".goreleaser.yaml","RELEASING.md","RELEASE.md","tools/release","scripts/release","docs/release","doc/release","build/release.sh","hack/lib/release.sh"],ownership:[".github/CODEOWNERS",".gitlab/CODEOWNERS","CODEOWNERS","docs/CODEOWNERS","OWNERS","OWNERS_ALIASES","MAINTAINERS"]},J=/(?:^|[-_.])(?:release|publish|publishing|distribution)(?:[-_.]|$)/i,V={ci:/\b(?:prow|buildkite|jenkins|teamcity|travis|external ci|test-infra)\b/i,release:/\b(?:release automation|release engineering|release infrastructure|external release)\b/i,ownership:/\b(?:external ownership|central owners|maintainer team|code owners)\b/i};async function U(e,n){let t=[];for(let o of n)try{await w.promises.access(u$1.join(e,o),w.constants.F_OK),t.push(o);}catch{}return t}async function Y(e,n){let t=["README.md","CONTRIBUTING.md","DEVELOPMENT.md","docs/devel/README.md"],o=[];for(let r of t)try{let s=u$1.join(e,r),a=await w.promises.stat(s);if(!a.isFile()||a.size>1024*1024)continue;let f=await w.promises.readFile(s,"utf8");n.test(f)&&o.push(r);}catch{}return o}async function q(e){let n=u$1.join(e,".github","workflows");try{return (await w.promises.readdir(n,{withFileTypes:true})).filter(o=>o.isFile()&&/\.(?:ya?ml)$/i.test(o.name)&&J.test(o.name)).map(o=>`.github/workflows/${o.name}`).sort()}catch{return []}}function H(e,n){let t$1=e?.[n];return t$1?.mode?{status:t$1.mode==="external"?"external-declared":"repository",provider:t$1.provider?.trim()||null,evidence:[t.workspaceContract],reference:t$1.reference?.trim()||null}:null}async function v(e,n,t){let o=H(n,t);if(o)return o;let r=[...await U(e,B[t]),...t==="release"?await q(e):[]];if(r.length>0)return {status:"repository",provider:null,evidence:r,reference:null};let s=await Y(e,V[t]);return s.length>0?{status:"external-observed",provider:null,evidence:s,reference:null}:{status:"unknown",provider:null,evidence:[],reference:null}}async function ue(e){let[n,t,o]=await Promise.all([v(e.projectPath,e.declaration,"ci"),v(e.projectPath,e.declaration,"release"),v(e.projectPath,e.declaration,"ownership")]);return {schemaVersion:"workspai.project-governance.v1",ci:n,release:t,ownership:o}}export{re as a,oe as b,ue as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,h as h$1}from'./chunk-BLEIUQL6.js';import {t as t$1}from'./chunk-VQZ5PI5J.js';import {t,s}from'./chunk-ODK4LCEL.js';import g from'fs';import W from'path';var c=s.workspaceRunLast.schemaVersion,P="workspace-run-last.json",a=t.workspaceRunLast;var _=new Set(["init","test","build","start"]);function C(e){return _.has(e)}async function A(e){try{return await g.promises.access(e,g.constants.F_OK),true}catch{return false}}async function w(e){try{let t=await g.promises.readFile(e,"utf-8");return JSON.parse(t)}catch{return null}}function h(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function N(e){let t=e.stage;return typeof t!="string"||t.trim().length===0||!Array.isArray(e.projects)?false:C(t)||/^[a-z][a-z0-9_-]*$/i.test(t)}function v(e){let t=h(e);return !t||t.schemaVersion===c?false:N(t)}function j(e){let t=h(e);return t?t.schemaVersion===c&&t.stages!=null:false}function l(e){if(j(e)){let t=e.enterpriseControls;return {...e,projectStages:e.projectStages??t.projectStages,enterpriseControls:t}}if(v(e)){let t=e.stage;return {schemaVersion:c,generatedAt:e.generatedAt,workspacePath:e.workspacePath,latestStage:t,stages:{[t]:e},enterpriseControls:e.enterpriseControls??{jsonReady:true,evidencePath:a}}}return null}function V(e,t){let n=l(e);if(!n)return null;let s=t??n.latestStage;return n.stages[s]??null}async function K(e){let t=(await Promise.all(t$1(W.resolve(e),"reports",P).map(async s=>await A(s)?s:null))).find(s=>typeof s=="string");if(!t)return null;let n=await w(t);return l(n)}function T(e){let t=typeof e.relativePath=="string"?e.relativePath.replace(/\\/g,"/"):"";if(t)return t.toLowerCase();let n=typeof e.path=="string"?e.path.replace(/\\/g,"/"):"";return n?n.toLowerCase():(e.projectName??"").toLowerCase()}async function F(e,t){let n=W.resolve(e);return f(n,a,async()=>{let s=(await Promise.all(t$1(n,"reports",P).map(async r=>await A(r)?r:null))).find(r=>typeof r=="string"),R=s?await w(s):null,o=l(R);if(s&&!o)throw new Error(`Workspace run evidence is unreadable or invalid; refusing to overwrite: ${s}`);let k=o?{...o.stages}:{};k[t.stage]=t;let i={...o?.projectStages??o?.enterpriseControls?.projectStages??{}};for(let r of t.projects){if(!r.selected)continue;let u=T(r);u&&(i[u]={...i[u],[t.stage]:{generatedAt:t.generatedAt,status:r.status,projectName:r.projectName,relativePath:r.relativePath,command:r.executionCommand,exitCode:r.exitCode,runtime:r.runtimeDetected}});}let d={schemaVersion:c,generatedAt:t.generatedAt,workspacePath:t.workspacePath,latestStage:t.stage,stages:k,enterpriseControls:{jsonReady:true,evidencePath:a,projectStages:i}};return await h$1(n,a,d),d})}export{P as a,a as b,V as c,K as d,F as e};
|