workspai 0.43.0 → 0.44.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/README.md +26 -13
- package/contracts/agent-customization-pack.v1.json +1 -1
- package/contracts/autopilot-release.v1.json +204 -0
- package/contracts/cli-operation-result.v1.json +119 -0
- package/contracts/command-capabilities.v1.json +138 -0
- package/contracts/compatibility-matrix.v1.json +37 -0
- package/contracts/create-planner-capabilities.v1.json +156 -65
- package/contracts/doctor-project-scan.v2.json +60 -0
- package/contracts/doctor-remediation-plan.v1.json +19 -4
- package/contracts/doctor-remediation-plan.v2.json +7 -0
- package/contracts/doctor-workspace-cache.v2.json +82 -0
- package/contracts/extension-cli-compatibility.v1.json +47 -3
- package/contracts/infra-plan.v1.json +189 -0
- package/contracts/private-product-manifest.v1.json +155 -0
- package/contracts/product-factory-plan.v1.json +200 -0
- package/contracts/project-archive.v1.json +40 -0
- package/contracts/project-entry-capability.v1.json +127 -0
- package/contracts/published-contract-catalog.v1.json +334 -0
- package/contracts/runtime-command-surface.v1.json +239 -10
- package/contracts/version.v1.json +48 -0
- package/contracts/workspace-archive-capabilities.v1.json +90 -0
- package/contracts/workspace-archive-manifest.v1.json +107 -0
- package/contracts/workspace-archive-operation-result.v1.json +565 -0
- package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +98 -0
- package/contracts/workspace-intelligence/agent-hooks.v1.json +38 -0
- package/contracts/workspace-intelligence/agent-reports-index.v1.json +56 -0
- package/contracts/workspace-intelligence/mcp-design.v1.json +42 -0
- package/contracts/workspace-intelligence/workspace-context.v1.json +12 -0
- package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -0
- package/contracts/workspace-intelligence-architecture.v1.json +723 -0
- package/contracts/workspace-intelligence-chain.v1.json +1194 -0
- package/contracts/workspace-list.v1.json +56 -0
- package/contracts/workspace-model-cache.v1.json +55 -0
- package/contracts/workspace-snapshot.v1.json +58 -0
- package/contracts/workspace-snapshot.v2.json +97 -0
- package/contracts/workspace-sync.v1.json +30 -0
- package/contracts/workspace-watch-event.v1.json +112 -0
- package/dist/analyze-6OCBM4ID.js +1 -0
- package/dist/{artifact-remediation-plan-5GJWPPRS.js → artifact-remediation-plan-Z7OCSME3.js} +3 -3
- package/dist/autopilot-release-LI2WJCEW.js +1 -0
- package/dist/{chunk-LZQNVH7D.js → chunk-2K3GYCPS.js} +1 -1
- package/dist/chunk-2QN6BMM7.js +2 -0
- package/dist/chunk-2QOWRBQD.js +1 -0
- package/dist/chunk-5AKYMAIL.js +1 -0
- package/dist/{chunk-RE773WOX.js → chunk-5PVEQ6CZ.js} +5 -5
- package/dist/{chunk-AFSZHLQT.js → chunk-7EIMPQR3.js} +1 -1
- package/dist/{chunk-3KXW53QI.js → chunk-7IHLTPZ6.js} +1 -1
- package/dist/chunk-7RIWU5TZ.js +1 -0
- package/dist/{chunk-T6OR6YOI.js → chunk-7UZVOYF5.js} +1 -1
- package/dist/chunk-B66A4TVP.js +1 -0
- package/dist/chunk-CL6TGI4Q.js +8 -0
- package/dist/chunk-FWJV7CCI.js +2 -0
- package/dist/chunk-J4AICQFB.js +1 -0
- package/dist/chunk-JICOD2GI.js +1 -0
- package/dist/{chunk-OJEWQO3Z.js → chunk-JP25YL3J.js} +17 -17
- package/dist/chunk-L2Q7B2OJ.js +1 -0
- package/dist/chunk-L3E6IRUQ.js +8 -0
- package/dist/chunk-LG6RFLPZ.js +1 -0
- package/dist/chunk-LGP6WXS2.js +4 -0
- package/dist/{chunk-VRDF2J46.js → chunk-M4VITK6X.js} +52 -50
- package/dist/chunk-NTXO7BMH.js +4 -0
- package/dist/{chunk-LPZFK3Y6.js → chunk-OW4UNG27.js} +65 -66
- package/dist/{chunk-LUP4U6EE.js → chunk-P424XYHP.js} +1 -1
- package/dist/chunk-P4SWTY5X.js +33 -0
- package/dist/chunk-TQEMLBAG.js +1 -0
- package/dist/chunk-TRMDODFM.js +13 -0
- package/dist/chunk-UNF72FTB.js +1 -0
- package/dist/chunk-V5JN4TDX.js +2 -0
- package/dist/chunk-VA5MRHKM.js +2 -0
- package/dist/chunk-XIVFLY6G.js +1 -0
- package/dist/chunk-YUX4YFGL.js +78 -0
- package/dist/{create-WRZO4HK2.js → create-DFAWAS5C.js} +1 -1
- package/dist/demo-kit-DZ7TPG7K.js +149 -0
- package/dist/doctor-PVSWDBJL.js +1 -0
- package/dist/{dotnet-webapi-clean-IPY3MCGQ.js → dotnet-webapi-clean-BYUUHX5Y.js} +20 -20
- package/dist/{gofiber-standard-N5N3QGH3.js → gofiber-standard-B6UK5GR7.js} +31 -31
- package/dist/{gogin-standard-LAWQTBWL.js → gogin-standard-BXU44VEM.js} +31 -31
- package/dist/index.d.ts +250 -24
- package/dist/index.js +218 -182
- package/dist/pipeline-ND734AJM.js +5 -0
- package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
- package/dist/{pythonRapidkitExec-3L3XJBSY.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
- package/dist/{springboot-standard-OZYF7ZM7.js → springboot-standard-PEHDKH2L.js} +27 -27
- package/dist/{workspace-PR6VZRBG.js → workspace-FQT3QIRS.js} +1 -1
- package/dist/workspace-agent-sync-ZYCPXTU3.js +1 -0
- package/dist/workspace-archive-EEGLHZDW.js +10 -0
- package/dist/workspace-context-WAGGJCDL.js +1 -0
- package/dist/{workspace-contract-XUGMCUSQ.js → workspace-contract-SEI4SNSG.js} +1 -1
- package/dist/workspace-explain-MVGGRCDN.js +1 -0
- package/dist/workspace-explain-contract-KT757JGQ.js +1 -0
- package/dist/{workspace-feedback-R6H4UFZB.js → workspace-feedback-RCB25NFO.js} +1 -1
- package/dist/{workspace-foundation-KGSV4E6D.js → workspace-foundation-KXDL6P6X.js} +1 -1
- package/dist/{workspace-history-CGCK2DJI.js → workspace-history-M4QQBIPB.js} +1 -1
- package/dist/workspace-intelligence-QOGD2TZS.js +1 -0
- package/dist/workspace-mcp-serve-CEFKEMYG.js +3 -0
- package/dist/{workspace-model-PNXXOGPO.js → workspace-model-GMSRBICO.js} +1 -1
- package/dist/workspace-registry-summary-S52SEJAG.js +1 -0
- package/dist/workspace-run-VC4OUPRF.js +1 -0
- package/dist/{workspace-verify-WSDUUTR5.js → workspace-verify-NP4GMFSV.js} +1 -1
- package/dist/workspace-watch-IIBH3Y25.js +1 -0
- package/docs/AI_FEATURES.md +67 -34
- package/docs/README.md +2 -1
- package/docs/commands-reference.md +26 -14
- package/docs/contracts/ARTIFACT_CATALOG.md +60 -36
- package/docs/contracts/README.md +3 -2
- package/docs/create-planner-capabilities.md +36 -18
- package/docs/workspace-operations.md +25 -0
- package/package.json +35 -13
- package/scripts/enterprise-package-smoke.mjs +40 -8
- package/scripts/prepack-enterprise.mjs +8 -0
- package/templates/kits/fastapi-ddd/.gitignore.j2 +11 -0
- package/templates/kits/fastapi-ddd/README.md.j2 +23 -18
- package/templates/kits/fastapi-ddd/common/env.example.j2 +2 -2
- package/templates/kits/fastapi-ddd/pyproject.toml.j2 +7 -7
- package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +1 -1
- package/templates/kits/fastapi-ddd/src/cli.py.j2 +6 -9
- package/templates/kits/fastapi-ddd/src/main.py.j2 +1 -1
- package/templates/kits/fastapi-standard/.gitignore.j2 +11 -0
- package/templates/kits/fastapi-standard/README.md.j2 +35 -30
- package/templates/kits/fastapi-standard/common/env.example.j2 +2 -2
- package/templates/kits/fastapi-standard/pyproject.toml.j2 +7 -7
- package/templates/kits/fastapi-standard/src/cli.py.j2 +7 -10
- package/templates/kits/fastapi-standard/src/main.py.j2 +1 -1
- package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +1 -1
- package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +1 -1
- package/templates/kits/nestjs-standard/.dockerignore.j2 +11 -0
- package/templates/kits/nestjs-standard/.eslintrc.js.j2 +25 -0
- package/templates/kits/nestjs-standard/.gitignore.j2 +22 -0
- package/templates/kits/nestjs-standard/.node-version.j2 +1 -0
- package/templates/kits/nestjs-standard/.nvmrc.j2 +1 -0
- package/templates/kits/nestjs-standard/.prettierrc.j2 +7 -0
- package/templates/kits/nestjs-standard/README.md.j2 +23 -18
- package/templates/kits/nestjs-standard/docs/README.md.j2 +2 -2
- package/templates/kits/nestjs-standard/jest.config.ts.j2 +1 -7
- package/templates/kits/nestjs-standard/package.json.j2 +1 -1
- package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +4 -4
- package/templates/kits/nestjs-standard/src/main.ts.j2 +1 -1
- package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +1 -1
- package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +1 -1
- package/templates/kits/nestjs-standard/tsconfig.json.j2 +1 -1
- package/dist/analyze-5BU4QIPK.js +0 -1
- package/dist/autopilot-release-QYUOVB26.js +0 -1
- package/dist/chunk-54XJNLYC.js +0 -13
- package/dist/chunk-5SWNSJGW.js +0 -1
- package/dist/chunk-753LOKFZ.js +0 -2
- package/dist/chunk-AAKUNWPR.js +0 -78
- package/dist/chunk-AQ4XZZC6.js +0 -1
- package/dist/chunk-CVTCPPEF.js +0 -1
- package/dist/chunk-DNAY5ALC.js +0 -1
- package/dist/chunk-EWYYLJQY.js +0 -2
- package/dist/chunk-LO4C4VXR.js +0 -4
- package/dist/chunk-LYC6AIF2.js +0 -2
- package/dist/chunk-NAAQMSO3.js +0 -1
- package/dist/chunk-NFUXULIF.js +0 -1
- package/dist/chunk-OL64GWQC.js +0 -9
- package/dist/chunk-PI5KUXDA.js +0 -7
- package/dist/chunk-SI3AQKIP.js +0 -1
- package/dist/chunk-VZKSNUEE.js +0 -2
- package/dist/chunk-WU4ZRRA5.js +0 -4
- package/dist/chunk-XEJD4KCV.js +0 -33
- package/dist/demo-kit-AJ5LIM5G.js +0 -149
- package/dist/doctor-MF3M3FS3.js +0 -1
- package/dist/pipeline-QCUHFWDY.js +0 -5
- package/dist/workspace-agent-sync-KTYF3HQR.js +0 -1
- package/dist/workspace-archive-GCZNI44O.js +0 -3
- package/dist/workspace-context-QUTOP2XV.js +0 -1
- package/dist/workspace-explain-JEONEGZZ.js +0 -1
- package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
- package/dist/workspace-intelligence-QJGVL37U.js +0 -1
- package/dist/workspace-mcp-serve-AK4MYEHQ.js +0 -3
- package/dist/workspace-registry-summary-RUJE6RPH.js +0 -1
- package/dist/workspace-run-Y7YMUIHX.js +0 -1
- package/dist/workspace-watch-AGPOJ74Q.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {a as a$2}from'./chunk-L3E6IRUQ.js';import {c as c$1}from'./chunk-CL6TGI4Q.js';import {e}from'./chunk-YUX4YFGL.js';import {b}from'./chunk-M4VITK6X.js';import {d,c as c$2}from'./chunk-LGP6WXS2.js';import {f as f$1,e as e$1}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-22DT744Z.js';import {f,c,g}from'./chunk-FWJV7CCI.js';import {a as a$1}from'./chunk-5AKYMAIL.js';import c$3 from'chalk';import p from'path';function G(s){return s===0?"pass":s===2?"warn":"fail"}function I(s){return s.some(r=>r.status==="fail")?"blocked":s.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(s,r){if(r)return 3;let t=s.some(i=>i.status==="fail"),n=s.some(i=>i.status==="warn");return t?1:n?2:0}async function N(s){let r=await b(s,true),t=false;try{let{syncWorkspaceContract:n}=await import('./workspace-contract-SEI4SNSG.js');await n({workspacePath:s}),t=true;}catch{t=false;}return {sync:r,contractSynced:t}}async function O(s={}){let r=p.resolve(s.workspacePath??process.cwd()),t=a(r);if(!t)throw new Error("No Workspai workspace found in current directory or parents");let n=[],i=[],l=false,d$1,f$2,m,y=Date.now();try{let{sync:e,contractSynced:a}=await N(t),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";n.push({name:"sync",status:o,durationMs:Date.now()-y,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${a?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||i.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,n.push({name:"sync",status:"fail",durationMs:Date.now()-y,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let w=Date.now();try{let e$1=await e({workspace:true,json:true,quiet:true,strict:s.strict===true,ci:s.strict!==true}),a=G(e$1),o=await f(t,a$1.doctor)??c(t,a$1.doctor);n.push({name:"doctor",status:a,durationMs:Date.now()-w,summary:a==="pass"?"doctor workspace passed":a==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e$1,evidencePath:o}),a==="fail"?i.push("doctor workspace gate failed"):a==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,n.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),i.push("doctor workspace stage failed");}if(s.skipAnalyze)n.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let a=await a$2({workspacePath:t,json:true,strict:s.strict===true});d$1=p.isAbsolute(a.enterpriseControls.evidencePath)?a.enterpriseControls.evidencePath:p.join(t,a.enterpriseControls.evidencePath);let o=a.summary.verdict==="blocked"?"fail":a.summary.verdict==="needs-attention"?"warn":"pass";n.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${a.summary.verdict} (score ${a.summary.score}/100)`,evidencePath:d$1}),o==="fail"?i.push("analyze reported blocked verdict"):o==="warn"&&i.push("analyze reported needs-attention verdict");}catch(a){l=true,n.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${a instanceof Error?a.message:String(a)}`}),i.push("analyze stage failed");}}let h=Date.now();try{let e=await d({startPath:t,writeReport:true,skipVerify:s.skipVerify===true});f$2=e.evidencePath;let a=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";n.push({name:"readiness",status:a,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),a==="fail"?i.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):a==="warn"&&i.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){l=true,n.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),i.push("readiness stage failed");}if(s.skipAutopilot)n.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),a=s.autopilotMode??"audit";try{let o=await c$1({workspacePath:t,mode:a,json:true,skipPipelineStages:true});m=o.artifacts.reportPath;let P=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";n.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${a}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:m}),P!=="pass"&&i.push(...o.blockingReasons.slice(0,5));}catch(o){l=true,n.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),i.push("autopilot release stage failed");}}let M=I(n),k=j(n,l),F=p.join(t,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:t,summary:{verdict:M,exitCode:k,stagesPassed:n.filter(e=>e.status==="pass").length,stagesWarn:n.filter(e=>e.status==="warn").length,stagesFailed:n.filter(e=>e.status==="fail").length},stages:n,blockingReasons:[...new Set(i)],artifacts:{reportPath:F,analyzeEvidencePath:d$1,readinessEvidencePath:f$2,autopilotEvidencePath:m}};if(s.writeReport!==false){let e=f$1(u,{commandId:"workspacePipeline",exitCode:k,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e$1()});await g(t,".workspai/reports/pipeline-last-run.json",e);}if(s.writeReport!==false&&s.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&s.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-ZYCPXTU3.js'),a=await e({workspacePath:t,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:a.indexPath,writtenFiles:a.writtenFiles,blockers:a.blockers};}catch{}return u}async function te(s){let r;try{r=await O(s);}catch(t){let n=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify(c$2({operation:"pipeline",code:"pipeline.failed",message:n}),null,2)):console.log(c$3.red(`Pipeline failed: ${n}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(r,null,2));else {console.log(c$3.bold.cyan(`
|
|
2
|
+
\u{1F517} Workspai Governance Pipeline
|
|
3
|
+
`)),console.log(c$3.bold(`Workspace: ${c$3.cyan(p.basename(r.workspacePath))}`)),console.log(c$3.gray(`Path: ${r.workspacePath}`)),console.log(c$3.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let n=t.status==="pass"?c$3.green("PASS"):t.status==="warn"?c$3.yellow("WARN"):t.status==="skipped"?c$3.gray("SKIP"):c$3.red("FAIL");console.log(` - ${t.name}: ${n} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c$3.bold(`
|
|
4
|
+
Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$3.gray(` \u2022 ${t}`));}console.log(c$3.gray(`
|
|
5
|
+
Evidence: ${r.artifacts.reportPath}`)),r.agentGrounding?.writtenFiles.length&&console.log(c$3.gray(`Agent grounding: ${r.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}r.summary.exitCode!==0&&process.exit(r.summary.exitCode);}export{O as runPipeline,te as runPipelineCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{f as augmentPathWithNodeBin,g as buildPackageRunnerSubprocessEnv,a as detectPlatformKind,h as getDefaultPythonCommand,q as getLegacyWorkspaceRegistryDirectory,i as getPythonCommandCandidates,j as getPythonVersionProbeCandidates,o as getRapidkitLocalScriptCandidates,s as getUserLocalBinCandidates,n as getVenvActivateScriptPath,k as getVenvBinDirectory,l as getVenvPythonPath,m as getVenvRapidkitPath,p as getWorkspaceRegistryDirectory,r as getWorkspaceRegistryFileCandidates,b as isWindowsPlatform,d as resolvePackageRunnerExecutable,e as resolvePackageRunnerInvocation,c as shouldUseShellExecution}from'./chunk-
|
|
1
|
+
export{f as augmentPathWithNodeBin,g as buildPackageRunnerSubprocessEnv,a as detectPlatformKind,h as getDefaultPythonCommand,q as getLegacyWorkspaceRegistryDirectory,i as getPythonCommandCandidates,j as getPythonVersionProbeCandidates,o as getRapidkitLocalScriptCandidates,s as getUserLocalBinCandidates,n as getVenvActivateScriptPath,k as getVenvBinDirectory,l as getVenvPythonPath,m as getVenvRapidkitPath,p as getWorkspaceRegistryDirectory,r as getWorkspaceRegistryFileCandidates,b as isWindowsPlatform,d as resolvePackageRunnerExecutable,e as resolvePackageRunnerInvocation,c as shouldUseShellExecution}from'./chunk-2K3GYCPS.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{k as __test__,b as checkRapidkitCoreAvailable,c as checkRapidkitCoreVersionCompatible,i as getCachedCoreTopLevelCommands,h as getCoreTopLevelCommands,j as getModulesCatalog,d as resolveRapidkitPython,e as runCoreRapidkit,g as runCoreRapidkitCapture,f as runCoreRapidkitStreamed}from'./chunk-
|
|
1
|
+
export{k as __test__,b as checkRapidkitCoreAvailable,c as checkRapidkitCoreVersionCompatible,i as getCachedCoreTopLevelCommands,h as getCoreTopLevelCommands,j as getModulesCatalog,d as resolveRapidkitPython,e as runCoreRapidkit,g as runCoreRapidkitCapture,f as runCoreRapidkitStreamed}from'./chunk-JP25YL3J.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b,c as c$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js';import {promises}from'fs';import g from'path';import i from'chalk';import
|
|
1
|
+
import {b,c as c$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import g from'path';import i from'chalk';import $ from'ora';import {execa}from'execa';var x="21",j="3.5.0",M="2.8.9";function f(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function h(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function E(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function T(e,t){let s=f(e)||"com.workspai.apps",p=f(t)||"service";return `${s}.${p}`}function A(e){return e.replace(/\./g,"/")}function P(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function C(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"workspai",workspai_version:t,rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function D(e){return `<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
3
3
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
4
4
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
@@ -131,7 +131,7 @@ import {b,c as c$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js'
|
|
|
131
131
|
</plugins>
|
|
132
132
|
</build>
|
|
133
133
|
</project>
|
|
134
|
-
`}function
|
|
134
|
+
`}function B(e,t){return `package ${e.package_name};
|
|
135
135
|
|
|
136
136
|
import ${e.package_name}.config.ApplicationInfoProperties;
|
|
137
137
|
import org.springframework.boot.SpringApplication;
|
|
@@ -146,7 +146,7 @@ public class ${t} {
|
|
|
146
146
|
SpringApplication.run(${t}.class, args);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
`}function
|
|
149
|
+
`}function V(e){return `package ${e.package_name}.config;
|
|
150
150
|
|
|
151
151
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
152
152
|
|
|
@@ -157,7 +157,7 @@ public record ApplicationInfoProperties(
|
|
|
157
157
|
String version,
|
|
158
158
|
String owner
|
|
159
159
|
) {}
|
|
160
|
-
`}function
|
|
160
|
+
`}function O(e){return `package ${e.package_name}.config;
|
|
161
161
|
|
|
162
162
|
import io.swagger.v3.oas.models.OpenAPI;
|
|
163
163
|
import io.swagger.v3.oas.models.info.Contact;
|
|
@@ -180,7 +180,7 @@ public class OpenApiConfiguration {
|
|
|
180
180
|
.license(new License().name("MIT")));
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
`}function
|
|
183
|
+
`}function L(e){return `package ${e.package_name}.api.http.dto;
|
|
184
184
|
|
|
185
185
|
import java.time.Instant;
|
|
186
186
|
import java.util.List;
|
|
@@ -193,7 +193,7 @@ public record SystemInfoResponse(
|
|
|
193
193
|
List<String> profiles,
|
|
194
194
|
Instant timestamp
|
|
195
195
|
) {}
|
|
196
|
-
`}function
|
|
196
|
+
`}function q(e){return `package ${e.package_name}.application;
|
|
197
197
|
|
|
198
198
|
import ${e.package_name}.api.http.dto.SystemInfoResponse;
|
|
199
199
|
import ${e.package_name}.config.ApplicationInfoProperties;
|
|
@@ -232,7 +232,7 @@ public class SystemInfoService {
|
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
`}function
|
|
235
|
+
`}function N(e){return `package ${e.package_name}.api.http;
|
|
236
236
|
|
|
237
237
|
import ${e.package_name}.api.http.dto.SystemInfoResponse;
|
|
238
238
|
import ${e.package_name}.application.SystemInfoService;
|
|
@@ -259,7 +259,7 @@ public class SystemInfoController {
|
|
|
259
259
|
return systemInfoService.snapshot();
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
`}function
|
|
262
|
+
`}function W(e){return `package ${e.package_name}.api.http;
|
|
263
263
|
|
|
264
264
|
import java.time.Instant;
|
|
265
265
|
import java.util.Map;
|
|
@@ -292,7 +292,7 @@ public class ApiExceptionHandler {
|
|
|
292
292
|
));
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
`}function
|
|
295
|
+
`}function J(e){return `server:
|
|
296
296
|
port: \${PORT:${e.port}}
|
|
297
297
|
shutdown: graceful
|
|
298
298
|
|
|
@@ -331,7 +331,7 @@ rapidkit:
|
|
|
331
331
|
description: ${e.description}
|
|
332
332
|
version: ${e.app_version}
|
|
333
333
|
owner: ${e.author}
|
|
334
|
-
`}function
|
|
334
|
+
`}function G(){return `spring:
|
|
335
335
|
main:
|
|
336
336
|
banner-mode: off
|
|
337
337
|
|
|
@@ -340,11 +340,11 @@ management:
|
|
|
340
340
|
web:
|
|
341
341
|
exposure:
|
|
342
342
|
include: health,info
|
|
343
|
-
`}function
|
|
343
|
+
`}function U(e){return `PORT=${e.port}
|
|
344
344
|
SPRING_PROFILES_ACTIVE=local
|
|
345
345
|
API_BASE_PATH=/api/v1
|
|
346
346
|
JAVA_OPTS=-Xms256m -Xmx512m
|
|
347
|
-
`}function
|
|
347
|
+
`}function H(){return `FROM maven:3.9.9-eclipse-temurin-21 AS build
|
|
348
348
|
WORKDIR /workspace
|
|
349
349
|
|
|
350
350
|
COPY pom.xml ./
|
|
@@ -362,7 +362,7 @@ EXPOSE 8080
|
|
|
362
362
|
ENV JAVA_OPTS=""
|
|
363
363
|
|
|
364
364
|
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
|
|
365
|
-
`}function
|
|
365
|
+
`}function F(e){return `services:
|
|
366
366
|
${e.artifact_id}:
|
|
367
367
|
build:
|
|
368
368
|
context: .
|
|
@@ -373,20 +373,20 @@ ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
|
|
|
373
373
|
- .env
|
|
374
374
|
environment:
|
|
375
375
|
SPRING_PROFILES_ACTIVE: docker
|
|
376
|
-
`}function
|
|
376
|
+
`}function z(){return `target
|
|
377
377
|
.git
|
|
378
378
|
.idea
|
|
379
379
|
.vscode
|
|
380
380
|
node_modules
|
|
381
381
|
coverage
|
|
382
|
-
`}function
|
|
382
|
+
`}function Y(){return `.idea/
|
|
383
383
|
.vscode/
|
|
384
384
|
target/
|
|
385
385
|
.mvn/
|
|
386
386
|
*.log
|
|
387
387
|
.DS_Store
|
|
388
388
|
.env
|
|
389
|
-
`}function
|
|
389
|
+
`}function X(){return `root = true
|
|
390
390
|
|
|
391
391
|
[*]
|
|
392
392
|
charset = utf-8
|
|
@@ -398,8 +398,8 @@ trim_trailing_whitespace = true
|
|
|
398
398
|
|
|
399
399
|
[*.md]
|
|
400
400
|
trim_trailing_whitespace = false
|
|
401
|
-
`}function
|
|
402
|
-
`)}function
|
|
401
|
+
`}function K(e){return ["name: ci","","on:"," push:"," branches: [main]"," pull_request:","","jobs:"," build-test-e2e:"," runs-on: ${{ matrix.os }}"," strategy:"," fail-fast: false"," matrix:"," os: [ubuntu-latest, windows-latest]",` java: ['${e.java_version}', '22']`," steps:"," - uses: actions/checkout@v4"," - uses: actions/setup-java@v4"," with:"," distribution: temurin"," java-version: ${{ matrix.java }}"," cache: maven"," - name: Generate Maven Wrapper (Unix)"," if: runner.os != 'Windows'"," run: |"," if [ ! -f mvnw ]; then"," mvn -N wrapper:wrapper -Dmaven=3.9.9"," chmod +x mvnw"," fi"," - name: Generate Maven Wrapper (Windows)"," if: runner.os == 'Windows'"," shell: pwsh"," run: |"," if (-not (Test-Path 'mvnw.cmd')) {"," mvn -N wrapper:wrapper -Dmaven=3.9.9"," }"," - name: Verify (Unix)"," if: runner.os != 'Windows'"," run: ./mvnw -B verify"," - name: Verify (Windows)"," if: runner.os == 'Windows'"," run: .\\mvnw.cmd -B verify"," - name: Package (Unix)"," if: runner.os != 'Windows'"," run: ./mvnw -B -DskipTests package"," - name: Package (Windows)"," if: runner.os == 'Windows'"," run: .\\mvnw.cmd -B -DskipTests package"," - name: Security scan (Unix)"," if: runner.os != 'Windows'"," run: ./mvnw -B -DskipTests org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=9"," - name: Security scan (Windows)"," if: runner.os == 'Windows'"," run: .\\mvnw.cmd -B -DskipTests org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=9"," - name: Upload SCA report"," if: always()"," uses: actions/upload-artifact@v4"," with:"," name: dependency-check-report-${{ matrix.os }}-${{ matrix.java }}"," path: target/dependency-check-report.html"," if-no-files-found: ignore"," - name: Upload SBOM"," if: always()"," uses: actions/upload-artifact@v4"," with:"," name: sbom-${{ matrix.os }}-${{ matrix.java }}"," path: target/bom.xml"," if-no-files-found: ignore",""].join(`
|
|
402
|
+
`)}function Q(e){return `# ${e.project_name}
|
|
403
403
|
|
|
404
404
|
Built with Spring Boot and scaffolded by Workspai.
|
|
405
405
|
|
|
@@ -453,7 +453,7 @@ src/main/resources # Spring configuration
|
|
|
453
453
|
- This kit is npm-level and intentionally independent from rapidkit-core modules.
|
|
454
454
|
- Use environment variables for deployment concerns; Spring Boot maps them automatically.
|
|
455
455
|
- CI runs matrix build/test + dependency scan + SBOM artifact generation by default.
|
|
456
|
-
`}function
|
|
456
|
+
`}function Z(e){return `#!/usr/bin/env sh
|
|
457
457
|
set -eu
|
|
458
458
|
|
|
459
459
|
PORT="${e.port}"
|
|
@@ -484,7 +484,7 @@ done
|
|
|
484
484
|
READY_EPOCH=$(date +%s)
|
|
485
485
|
echo "startup_seconds=$((READY_EPOCH - START_EPOCH))" >> "$LOG_FILE"
|
|
486
486
|
cat "$LOG_FILE"
|
|
487
|
-
`}function
|
|
487
|
+
`}function ee(e){return `#!/usr/bin/env sh
|
|
488
488
|
# Workspai Spring Boot project launcher - generated by Workspai CLI
|
|
489
489
|
|
|
490
490
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
@@ -569,7 +569,7 @@ case "$CMD" in
|
|
|
569
569
|
exit 1
|
|
570
570
|
;;
|
|
571
571
|
esac
|
|
572
|
-
`}function
|
|
572
|
+
`}function te(){return `@echo off
|
|
573
573
|
set CMD=%1
|
|
574
574
|
if "%CMD%"=="" goto usage
|
|
575
575
|
shift
|
|
@@ -605,7 +605,7 @@ if "%CMD%"=="start" (
|
|
|
605
605
|
:usage
|
|
606
606
|
echo Available: init, dev, test, build, start
|
|
607
607
|
exit /b 1
|
|
608
|
-
`}function
|
|
608
|
+
`}function ne(e,t){return `package ${e.package_name};
|
|
609
609
|
|
|
610
610
|
import org.junit.jupiter.api.Test;
|
|
611
611
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
@@ -617,7 +617,7 @@ class ${t}Tests {
|
|
|
617
617
|
void contextLoads() {
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
|
-
`}function
|
|
620
|
+
`}function re(e){return `package ${e.package_name}.api.http;
|
|
621
621
|
|
|
622
622
|
import static org.mockito.BDDMockito.given;
|
|
623
623
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
|
@@ -663,7 +663,7 @@ class SystemInfoControllerTest {
|
|
|
663
663
|
.andExpect(jsonPath("$.environment").value("test"));
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
|
-
`}function
|
|
666
|
+
`}function ie(e){return `package ${e.package_name};
|
|
667
667
|
|
|
668
668
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
669
669
|
|
|
@@ -687,11 +687,11 @@ class ServiceRuntimeE2ETest {
|
|
|
687
687
|
assertThat(response.getBody()).containsEntry("status", "UP");
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
`}async function
|
|
690
|
+
`}async function oe(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=g.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function ve(e,t){let s=E(t.artifact_id||t.project_name)||"service",p=f(t.group_id||"com.workspai.apps")||"com.workspai.apps",S=f(t.package_name||T(p,s))||"com.workspai.apps.service",r={project_name:t.project_name,artifact_id:s,group_id:p,package_name:S,author:h(t.author||"","Workspai User"),description:h(t.description||"",`Spring Boot service generated with Workspai - ${t.project_name}`),java_version:t.java_version||x,spring_boot_version:t.spring_boot_version||j,springdoc_version:t.springdoc_version||M,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false,skipInstall:t.skipInstall??false},b$2=c(),l=`${b(r.project_name)}Application`,o=A(r.package_name);try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(i.yellow(`
|
|
691
691
|
\u26A0 Maven not found in PATH - project will be scaffolded, but init/build commands require Maven 3.9+`)),console.log(i.gray(` Install: https://maven.apache.org/install.html
|
|
692
|
-
`));}let c$2
|
|
692
|
+
`));}let c$2=$(`Generating Spring Boot project: ${r.project_name}...`).start();try{let n=(d,v)=>c$1(g.join(e,d),v),y=g.join(e,"rapidkit"),R=g.join(e,"rapidkit.cmd");if(await Promise.all([n("pom.xml",D(r)),n(".gitignore",Y()),n(".editorconfig",X()),n(".env.example",U(r)),n(".dockerignore",z()),n("Dockerfile",H()),n("docker-compose.yml",F(r)),n(".github/workflows/ci.yml",K(r)),n("README.md",Q(r)),n("src/main/resources/application.yml",J(r)),n("src/test/resources/application.yml",G()),n(`src/main/java/${o}/${l}.java`,B(r,l)),n(`src/main/java/${o}/config/ApplicationInfoProperties.java`,V(r)),n(`src/main/java/${o}/config/OpenApiConfiguration.java`,O(r)),n(`src/main/java/${o}/application/SystemInfoService.java`,q(r)),n(`src/main/java/${o}/api/http/dto/SystemInfoResponse.java`,L(r)),n(`src/main/java/${o}/api/http/SystemInfoController.java`,N(r)),n(`src/main/java/${o}/api/http/ApiExceptionHandler.java`,W(r)),n(`src/test/java/${o}/${l}Tests.java`,ne(r,l)),n(`src/test/java/${o}/api/http/SystemInfoControllerTest.java`,re(r)),n(`src/test/java/${o}/ServiceRuntimeE2ETest.java`,ie(r)),n("scripts/perf-smoke.sh",Z(r)),n(".workspai/project.json",C(r,b$2)),n(".workspai/context.json",P()),n("rapidkit",ee(r)),n("rapidkit.cmd",te())]),await promises.chmod(y,493),await promises.chmod(R,493),await promises.chmod(g.join(e,"scripts","perf-smoke.sh"),493),r.skipInstall||await oe(e)||console.log(i.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),c$2.succeed(i.green(`Project created at ${e}`)),r.skipInstall)c$2.info(i.gray("Skipped Maven dependency warm-up (--skip-install)."));else try{c$2.start("Resolving Maven dependencies...");let d=g.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),v=await promises.stat(d).then(()=>d).catch(()=>"mvn");await execa(v,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),c$2.succeed(i.gray("\u2713 maven dependency warm-up completed"));}catch{c$2.warn(i.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!r.skipGit)try{await b$1(e)?console.log(i.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e,env:a()}));}catch{console.log(i.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(i.green(`
|
|
693
693
|
\u2728 Spring Boot project created successfully!
|
|
694
694
|
`)),console.log(i.cyan("\u{1F4C2} Location:"),i.white(e)),console.log(i.cyan(`
|
|
695
695
|
\u{1F680} Get started:
|
|
696
696
|
`)),console.log(i.white(` cd ${r.project_name}`)),console.log(i.white(" npx workspai init")),console.log(i.white(` npx workspai dev
|
|
697
|
-
`)),console.log(i.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(n){c$2.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw n}}export{
|
|
697
|
+
`)),console.log(i.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(n){c$2.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw n}}export{x as DEFAULT_JAVA_VERSION,M as DEFAULT_SPRINGDOC_VERSION,j as DEFAULT_SPRING_BOOT_VERSION,ve as generateSpringBootKit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-
|
|
1
|
+
export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-M4VITK6X.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-P4SWTY5X.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-XIVFLY6G.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {e,c,b as b$1,d}from'./chunk-7RIWU5TZ.js';import {a}from'./chunk-LG6RFLPZ.js';import {f as f$1,o,l,r}from'./chunk-5XATWNME.js';import x from'crypto';import U from'os';import f from'path';import {once}from'events';import {createWriteStream,createReadStream}from'fs';import*as L from'readline';import {Transform,Readable}from'stream';import {pipeline}from'stream/promises';import h from'fs-extra';import*as K from'yauzl';import*as Z from'yazl';var P=".workspai/archive-manifest.json",S=".rapidkit/archive-manifest.json",ie="workspai.workspace.archive",se=1800*1e3,ne=256*1024*1024,oe=new Set(["__pycache__",".venv","venv","node_modules",".git","dist","build","target",".pytest_cache",".mypy_cache",".ruff_cache","htmlcov",".next",".turbo",".cache"]),ce=new Set([".DS_Store","Thumbs.db",".coverage","npm-debug.log","yarn-error.log","pnpm-debug.log"]),he=[/^\.env$/i,/^\.env\.(?!example$|sample$|template$).+/i,/^.*\.pem$/i,/^.*\.key$/i,/^id_rsa$/i,/^id_ed25519$/i];function R(e){return e.replace(/\\/g,"/")}function J(e){return e.replace(/\.workspai-archive\.zip$/i,"").replace(/\.rapidkit-archive\.zip$/i,"").replace(/\.zip$/i,"").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,64)||"imported-workspace"}function q(e){let t=R(e).trim();if(!t||t.startsWith("/")||t.startsWith("~")||/^[a-zA-Z]:\//.test(t)||t.includes("\0"))return false;let r=t.split("/").filter(Boolean);return r.length>0&&!r.some(a=>a===".."||a===".")}function G(e){if(!q(e))throw new Error(`Archive contains an unsafe path: ${e}`)}function fe(e,t){let r=f.relative(t,e);return r===""||!!r&&!r.startsWith("..")&&!f.isAbsolute(r)}function le(e,t){let a=R(e).split("/").filter(Boolean);if((a[0]===".workspai"||a[0]===".rapidkit")&&["cache","reports"].includes(a[1]||"")||a.some(s=>oe.has(s)))return true;let i=a[a.length-1]||"";return ce.has(i)||/\.(?:workspai|rapidkit)-archive\.zip$/i.test(i)||!t?.includeEnv&&he.some(s=>s.test(i))?true:i.endsWith(".pyc")||i.endsWith(".log")}async function*X(e,t,r){let a=(await h.readdir(t,{withFileTypes:true})).sort((i,s)=>i.name.localeCompare(s.name));for(let i of a){let s=f.join(t,i.name),n=R(f.relative(e,s));if(!(!n||le(n,r))){if(i.isDirectory()){yield*X(e,s,r);continue}i.isFile()&&(yield {relativePath:n,fullPath:s});}}}async function pe(e){for(let t of o(e,"workspace.json"))try{let r=await h.readJson(t);if(typeof r.workspace_name=="string"&&r.workspace_name.trim())return r.workspace_name.trim();if(typeof r.name=="string"&&r.name.trim())return r.name.trim()}catch{}return f.basename(f.resolve(e))}async function me(e){let t=await h.stat(e.fullPath),r=x.createHash("sha256"),a=0;for await(let s of createReadStream(e.fullPath)){let n=Buffer.isBuffer(s)?s:Buffer.from(s);a+=n.length,r.update(n);}let i=await h.stat(e.fullPath);if(t.size!==i.size||t.mtimeMs!==i.mtimeMs||a!==i.size)throw new Error(`Workspace file changed while preparing archive: ${e.relativePath}`);return {...e,size:a,mtimeMs:i.mtimeMs,sha256:r.digest("hex")}}async function k(e,t){e.write(t)||await once(e,"drain");}async function Y(e){await new Promise((t,r)=>{e.once("error",r),e.end(t);});}async function*b(e){let t=L.createInterface({input:createReadStream(e),crlfDelay:1/0});for await(let r of t){let a=r.trim();a&&(yield JSON.parse(a));}}async function ue(e){let t=createWriteStream(e.manifestPath,{flags:"wx"});try{await k(t,`{
|
|
2
|
+
`);for(let[a,i]of Object.entries(e.manifestBase))await k(t,` ${JSON.stringify(a)}: ${JSON.stringify(i,null,2)},
|
|
3
|
+
`);await k(t,` "files": [
|
|
4
|
+
`);let r=true;for await(let a of b(e.spoolPath)){let{mtimeMs:i,...s}=a;await k(t,`${r?"":`,
|
|
5
|
+
`} ${JSON.stringify(s)}`),r=false;}await k(t,`
|
|
6
|
+
]
|
|
7
|
+
}
|
|
8
|
+
`),await Y(t);}catch(r){throw t.destroy(),await h.remove(e.manifestPath).catch(()=>{}),r}}async function de(e,t){let r=[];for await(let a of b(t)){let{mtimeMs:i,...s}=a;r.push(s);}return {...e,files:r}}async function ve(e,t){try{await h.rename(e,t);}catch(r){let a=r.code;if(a!=="EEXIST"&&a!=="EPERM")throw r;await h.move(e,t,{overwrite:true});}}async function Fe(e){let t=f.resolve(e.workspacePath);if(!f$1(t))throw new Error("Workspace export requires a Workspai workspace root with .workspai-workspace or a legacy .rapidkit-workspace marker.");let r=await pe(t),a=f.resolve(e.outputPath||`${J(r)}.workspai-archive.zip`),i={schemaVersion:b$1,version:1,kind:ie,workspaceName:r,exportedAt:(e.now??new Date).toISOString(),exportedBy:"workspai",archiveFormat:e.compression==="deflate"?"zip-deflate":"zip-store",containerFormat:"zip64",compression:e.compression==="deflate"?"deflate":"store",streaming:true,security:{envFilesIncluded:e.includeEnv===true,excludedByDefault:[".git","node_modules",".venv","dist","build","target",".env","*.pem","*.key","*.log"]}},s=f.resolve(a);await h.ensureDir(f.dirname(a));let n=`${a}.${process.pid}.${x.randomUUID()}.tmp`,o=await h.mkdtemp(f.join(U.tmpdir(),"workspai-archive-export-")),l=f.join(o,"manifest-files.jsonl"),m=f.join(o,"archive-manifest.json"),d=new Z.ZipFile,y=e.now??new Date,c$1=e.compression==="deflate";try{let p=createWriteStream(l,{flags:"wx"});try{for await(let u of X(t,t,{includeEnv:e.includeEnv===true})){if(f.resolve(u.fullPath)===s)continue;let v=await me(u),E={path:v.relativePath,size:v.size,sha256:v.sha256,mtimeMs:v.mtimeMs};await k(p,`${JSON.stringify(E)}
|
|
9
|
+
`);}await Y(p);}catch(u){throw p.destroy(),u}await ue({manifestBase:i,spoolPath:l,manifestPath:m});for await(let u of b(l)){let v=f.join(t,...u.path.split("/"));d.addFile(v,u.path,{compress:c$1,forceZip64Format:u.size>=4294967295,mtime:y});}d.addFile(m,P,{compress:c$1,mtime:y}),d.end({forceZip64Format:true,comment:""}),await pipeline(d.outputStream,createWriteStream(n,{flags:"wx"}));for await(let u of b(l)){let v=f.join(t,...u.path.split("/")),E=await h.stat(v);if(E.size!==u.size||E.mtimeMs!==u.mtimeMs)throw new Error(`Workspace file changed while writing archive: ${u.path}`)}let w=await h.stat(n);await ve(n,a);let g=await de(i,l);return _({schemaVersion:c,operation:"export",status:"passed",archivePath:a,manifest:g,bytesWritten:w.size})}finally{await h.remove(o).catch(()=>{}),await h.remove(n).catch(()=>{});}}async function Q(e,t={}){if(/^https?:\/\//i.test(e)){let r=await h.mkdtemp(f.join(U.tmpdir(),"workspai-workspace-archive-")),a=f.join(r,"workspace.workspai-archive.zip"),i=new AbortController,s=t.downloadTimeoutMs??se,n=s>0?setTimeout(()=>i.abort(new Error("Download timed out")),s):null;try{let o=await fetch(e,{signal:i.signal});if(!o.ok)throw new Error(`Failed to download workspace archive: HTTP ${o.status}`);if(!o.body)throw new Error("Failed to download workspace archive: response body is empty.");let l=Number(o.headers.get("content-length"));if(t.maxDownloadBytes!==void 0&&Number.isFinite(l)&&l>t.maxDownloadBytes)throw new Error(`Workspace archive download exceeds configured limit (${l} > ${t.maxDownloadBytes} bytes).`);let m=0,d=new Transform({transform(c,p,w){if(m+=c.length,t.maxDownloadBytes!==void 0&&m>t.maxDownloadBytes){w(new Error(`Workspace archive download exceeds configured limit (${t.maxDownloadBytes} bytes).`));return}w(null,c);}}),y=Readable.fromWeb(o.body);return await pipeline(y,d,createWriteStream(a,{flags:"wx"})),{archivePath:a,cleanup:r}}catch(o){throw await h.remove(r).catch(()=>{}),i.signal.aborted?new Error(`Workspace archive download timed out after ${s}ms.`,{cause:o}):o}finally{n&&clearTimeout(n);}}return {archivePath:f.resolve(e)}}function we(e){return new Promise((t,r)=>{K.open(e,{autoClose:false,lazyEntries:true,decodeStrings:true,validateEntrySizes:true,strictFileNames:true},(a,i)=>{a||!i?r(a??new Error("Failed to open workspace archive.")):t(i);});})}function ye(e){return new Promise((t,r)=>{let a=[],i=s=>r(s);e.once("error",i),e.on("entry",s=>{try{if(G(s.fileName),s.isEncrypted())throw new Error(`Encrypted workspace archive entries are not supported: ${s.fileName}`);s.fileName.endsWith("/")||a.push({name:s.fileName,size:s.uncompressedSize,compressedSize:s.compressedSize,crc32:s.crc32,entry:s}),e.readEntry();}catch(n){r(n);}}),e.once("end",()=>{e.removeListener("error",i),t(a);}),e.readEntry();})}function N(e,t){return new Promise((r,a)=>{e.openReadStream(t,(i,s)=>{i||!s?a(i??new Error(`Failed to read ${t.fileName}.`)):r(s);});})}async function ge(e,t,r=ne){if(t.size>r)throw new Error(`Workspace archive manifest exceeds ${r} bytes.`);let a=[],i=0,s=await N(e,t.entry);for await(let n of s){let o=Buffer.isBuffer(n)?n:Buffer.from(n);if(i+=o.length,i>r)throw s.destroy(),new Error(`Workspace archive manifest exceeds ${r} bytes.`);a.push(o);}return Buffer.concat(a,i)}function Ee(e){let t=JSON.parse(e.toString("utf-8"));a(t,d,"Workspace archive manifest");let r=new Set;for(let a of t.files){if(!q(a.path)||R(a.path)!==a.path)throw new Error(`Workspace archive manifest contains an unsafe path: ${a.path}`);if(a.path===P||a.path===S)throw new Error(`Workspace archive manifest cannot inventory itself: ${a.path}`);if(r.has(a.path))throw new Error(`Workspace archive manifest contains duplicate path: ${a.path}`);r.add(a.path);}return t}function _(e$1){return a(e$1,e,"Workspace archive operation result"),e$1}function Ae(e){return r(R(e))}function ke(e){let t=new Map;for(let r of e){if(r.name===P||r.name===S)continue;let a=Ae(r.name),i=t.get(a);if(!i){t.set(a,{...r,sourceName:r.name,targetName:a});continue}let s=r.name===a,n=i.sourceName===i.targetName;if(s&&!n){t.set(a,{...r,sourceName:r.name,targetName:a});continue}if(!(i.size===r.size&&i.crc32===r.crc32)&&!n)throw new Error(`Workspace archive contains conflicting entries for ${a}: ${i.sourceName}, ${r.name}`)}return [...t.values()].sort((r,a)=>r.targetName.localeCompare(a.targetName))}async function C(e,t={}){let r=await Q(e,t),a;try{a=await we(r.archivePath);let i=await ye(a),s=i.reduce((l,m)=>l+m.size,0);if(t.maxExpandedBytes!==void 0&&s>t.maxExpandedBytes)throw new Error(`Workspace archive payload exceeds configured limit (${s} > ${t.maxExpandedBytes} bytes).`);let n=i.find(l=>l.name===P||l.name===S);if(!n)throw new Error(`Workspace archive is missing ${l("","archive-manifest.json").replace(/^\//,"")}.`);let o=Ee(await ge(a,n));return {archivePath:r.archivePath,entries:i,manifest:o,zipFile:a,cleanup:r.cleanup}}catch(i){throw a?.close(),r.cleanup&&await h.remove(r.cleanup).catch(()=>{}),i}}async function M(e){e.zipFile?.close(),e.cleanup&&await h.remove(e.cleanup).catch(()=>{});}async function Pe(e){let t=await C(e.archivePathOrUrl,e.safety);try{let r=new Map(t.entries.filter(i=>i.name!==P&&i.name!==S).map(i=>[i.name,i])),a=t.manifest.files.map(i=>({path:i.path,size:r.get(i.path)?.size??i.size,hasChecksum:typeof i.sha256=="string"&&i.sha256.length>0}));return _({schemaVersion:c,operation:"inspect",status:"passed",archivePath:t.archivePath,manifest:t.manifest,fileCount:a.length,totalBytes:a.reduce((i,s)=>i+s.size,0),entries:a})}finally{await M(t);}}async function ee(e){let t=await C(e.archivePathOrUrl,e.safety);try{let r=new Map(t.entries.filter(c=>c.name!==P&&c.name!==S).map(c=>[c.name,c])),a=new Set(t.manifest.files.map(c=>c.path)),i=[...r.keys()].filter(c=>!a.has(c)).sort(),s=[],n=[],o=[],l=0;for(let c of t.manifest.files){G(c.path);let p=r.get(c.path);if(!p){s.push(c.path);continue}let w=x.createHash("sha256"),g=0,u=await N(t.zipFile,p.entry);for await(let E of u){let $=Buffer.isBuffer(E)?E:Buffer.from(E);g+=$.length,w.update($);}let v={size:g,sha256:w.digest("hex")};if(g!==p.size||g!==c.size){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:v});continue}if(!c.sha256){n.push(c.path);continue}if(v.sha256!==c.sha256){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:v});continue}l+=1;}let m=e.requireChecksums===true&&n.length>0,d=s.length>0||o.length>0||m||i.length>0,y=n.length>0;return _({schemaVersion:c,operation:"verify",archivePath:t.archivePath,manifest:t.manifest,status:d?"failed":y?"warning":"passed",fileCount:t.manifest.files.length,totalBytes:t.manifest.files.reduce((c,p)=>c+p.size,0),verifiedFiles:l,missingChecksumFiles:n,missingArchiveEntries:s,extraArchiveEntries:i,mismatches:o})}finally{await M(t);}}async function Ve(e){let t=await Q(e.archivePathOrUrl,e.safety);try{return await We({archivePath:t.archivePath,strict:e.strict})}finally{t.cleanup&&await h.remove(t.cleanup).catch(()=>{});}}async function We(e){let t=await Pe({archivePathOrUrl:e.archivePath}),r=await ee({archivePathOrUrl:e.archivePath,requireChecksums:e.strict===true}),a=[],i=[];a.push({id:"manifest-present",status:"passed",message:`Archive manifest found for workspace "${t.manifest.workspaceName}".`}),a.push({id:"integrity",status:r.status,message:r.status==="passed"?`Verified ${r.verifiedFiles}/${r.fileCount} files.`:"Archive integrity verification did not fully pass."});let s=t.manifest.security?.envFilesIncluded===true;a.push({id:"secrets-policy",status:s?"warning":"passed",message:s?"Archive manifest says environment/private files were intentionally included.":"Archive manifest excludes environment/private files by default."}),s&&i.push("Share this archive only through trusted internal channels."),r.missingChecksumFiles.length>0&&i.push("Re-export the archive with the latest RapidKit/Workspai tooling."),r.mismatches.length>0&&i.push("Reject this archive and request a fresh export from the owner."),(r.extraArchiveEntries.length>0||r.missingArchiveEntries.length>0)&&i.push("Regenerate the archive so ZIP entries and manifest entries match."),e.strict===true&&r.status!=="passed"&&i.push("Do not hydrate this archive in strict or production workflows.");let n=a.some(l=>l.status==="failed"),o=a.some(l=>l.status==="warning");return _({schemaVersion:c,operation:"doctor",archivePath:t.archivePath,status:n?"failed":o?"warning":"passed",workspaceName:t.manifest.workspaceName,fileCount:t.fileCount,totalBytes:t.totalBytes,checks:a,recommendedActions:i})}async function Se(e,t){let r=await h.lstat(e).catch(i=>{if(i.code==="ENOENT")return null;throw i});if(!r)return false;if(r.isSymbolicLink())throw new Error(`Output directory must not be a symbolic link: ${e}`);if(!r.isDirectory())throw new Error(`Output path is not a directory: ${e}`);if((await h.readdir(e)).length>0&&!t)throw new Error(`Output directory is not empty: ${e}. Use --force to overwrite.`);return true}async function De(e){let t=await C(e.archivePathOrUrl,e.safety);try{let r=await ee({archivePathOrUrl:t.archivePath,requireChecksums:e.strict===true});if(r.status==="failed"){let o=[r.missingArchiveEntries.length?`missing entries: ${r.missingArchiveEntries.join(", ")}`:"",r.extraArchiveEntries.length?`unexpected entries: ${r.extraArchiveEntries.join(", ")}`:"",r.mismatches.length?`checksum/size mismatches: ${r.mismatches.map(l=>l.path).join(", ")}`:"",r.missingChecksumFiles.length&&e.strict===true?`missing checksums: ${r.missingChecksumFiles.join(", ")}`:""].filter(Boolean).join("; ");throw new Error(`Workspace archive verification failed${o?` (${o})`:""}.`)}if(r.status==="warning"&&e.strict===true)throw new Error(`Workspace archive verification requires checksums for every file: ${r.missingChecksumFiles.join(", ")}`);let a=ke(t.entries),i=t.manifest,s=f.resolve(e.outputPath||J(i.workspaceName||"imported-workspace")),n=await Se(s,e.force===true);if(!e.dryRun){let o=f.dirname(s),l=`${process.pid}-${x.randomUUID()}`,m=f.join(o,`.${f.basename(s)}.hydrate-${l}.tmp`),d=f.join(o,`.${f.basename(s)}.hydrate-${l}.backup`),y=false,c=false;await h.ensureDir(o);try{await h.ensureDir(m);for(let p of a){let w=f.resolve(m,p.targetName);if(!fe(w,m))throw new Error(`Archive entry escapes output directory: ${p.targetName}`);await h.ensureDir(f.dirname(w));let g=await N(t.zipFile,p.entry);await pipeline(g,createWriteStream(w,{flags:"wx"}));}n&&(await h.rename(s,d),y=true),await h.rename(m,s),c=true,y&&await h.remove(d).catch(()=>{});}catch(p){throw y&&!await h.pathExists(s)&&await h.rename(d,s).catch(()=>{}),p}finally{await h.remove(m).catch(()=>{}),c&&await h.remove(d).catch(()=>{});}}return _({schemaVersion:c,operation:"hydrate",status:"passed",archivePath:t.archivePath,outputPath:s,dryRun:e.dryRun===true,manifest:i,files:a.map(o=>({path:o.targetName,size:o.size}))})}finally{await M(t);}}
|
|
10
|
+
export{ie as WORKSPACE_ARCHIVE_KIND,P as WORKSPACE_ARCHIVE_MANIFEST_PATH,Ve as doctorWorkspaceArchive,Fe as exportWorkspaceArchive,De as hydrateWorkspaceArchive,Pe as inspectWorkspaceArchive,q as isSafeArchiveEntryName,J as sanitizeWorkspaceArchiveName,le as shouldExcludeWorkspaceArchivePath,ee as verifyWorkspaceArchive};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-V5JN4TDX.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as WORKSPACE_CONTRACT_PATH,d as WORKSPACE_CONTRACT_SCHEMA_VERSION,c as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,e as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,g as buildWorkspaceContract,k as buildWorkspaceContractGraph,f as discoverProjectJsonFiles,j as readWorkspaceContract,i as syncWorkspaceContract,l as verifyWorkspaceContract,h as writeWorkspaceContract,m as writeWorkspaceContractVerifyEvidence}from'./chunk-
|
|
1
|
+
export{b as WORKSPACE_CONTRACT_PATH,d as WORKSPACE_CONTRACT_SCHEMA_VERSION,c as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,e as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,g as buildWorkspaceContract,k as buildWorkspaceContractGraph,f as discoverProjectJsonFiles,j as readWorkspaceContract,i as syncWorkspaceContract,l as verifyWorkspaceContract,h as writeWorkspaceContract,m as writeWorkspaceContractVerifyEvidence}from'./chunk-2QN6BMM7.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-TRMDODFM.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-VA5MRHKM.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-XIVFLY6G.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,e as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget,d as resolveWorkspaceTraceTarget}from'./chunk-J4AICQFB.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-XIVFLY6G.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-L2Q7B2OJ.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await j(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-OW4UNG27.js';import {a}from'./chunk-GSWPGELT.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-S52SEJAG.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-
|
|
1
|
+
export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-L2Q7B2OJ.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{g as WORKSPACE_IMPACT_REPORT_PATH,f as WORKSPACE_IMPACT_SCHEMA_VERSION,e as WORKSPACE_MODEL_DIFF_REPORT_PATH,c as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,d as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,b as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,p as buildWorkspaceImpact,k as buildWorkspaceModelSnapshot,m as diffWorkspaceModel,j as hashWorkspaceModel,h as isGitDiffSource,i as parseGitDiffRef,o as workspaceVerificationPlan,q as writeWorkspaceImpact,n as writeWorkspaceModelDiff,l as writeWorkspaceModelSnapshot}from'./chunk-VA5MRHKM.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {b}from'./chunk-TRMDODFM.js';import {d}from'./chunk-V5JN4TDX.js';import {d as d$1}from'./chunk-UNF72FTB.js';import {c as c$1,e}from'./chunk-J4AICQFB.js';import {c as c$2,b as b$2}from'./chunk-XIVFLY6G.js';import {k}from'./chunk-JICOD2GI.js';import {c as c$3}from'./chunk-2QN6BMM7.js';import {f}from'./chunk-FWJV7CCI.js';import {a as a$1}from'./chunk-LG6RFLPZ.js';import {a,c}from'./chunk-5AKYMAIL.js';import {r}from'./chunk-5XATWNME.js';import m from'path';import v from'readline';import b$1 from'fs-extra';var W=a.agentIndex,I=new Map(Object.keys(a).flatMap(e=>{let t=c[e];return t?[[a[e],t]]:[]}));function N(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var L=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function M(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!m.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function l(e,t){if(!M(t))throw new Error(`Unsafe artifact path: ${t}`);let i=await f(e,t)??m.join(e,t);if(!await b$1.pathExists(i))return null;let r$1=await b$1.readJson(i),s=r(t),a=I.get(s);return a&&a$1(r$1,a,`MCP artifact ${s}`),r$1}async function J(e$1){let t=[],i=new Set,s=((await l(e$1,d$1))?.blockingReasons??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(s.length>0){t.push({artifact:d$1,reasons:s});for(let n of s)i.add(n);}let a=await l(e$1,c$2);if(e(a)){let n=(a.blockingReasons??[]).filter(o=>typeof o=="string"&&o.trim().length>0);if(n.length>0){t.push({artifact:c$2,reasons:n});for(let o of n)i.add(o);}}let c=await l(e$1,c$3),p=(c?.violations??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(p.length>0||String(c?.status??"").toLowerCase()==="failed"){let n=p.length>0?p:["Workspace contract verification failed"];t.push({artifact:c$3,reasons:n});for(let o of n)i.add(o);}return {blockingReasons:[...i],sources:t}}async function O(e$1,t,i){switch(t){case "getWorkspaceModel":return l(e$1,k);case "getEvidenceIndex":return l(e$1,W);case "getBlockers":return J(e$1);case "getSafeCommands":return {safeCommands:(await l(e$1,d))?.safeCommands??[]};case "getProjectContext":{let r=await l(e$1,d);if(!r)return null;let s=String(i.project??"").trim(),a=r.scope?.activeProject??void 0,c=s||a,p=Array.isArray(r.projects)?r.projects:[],n=c&&p.find(o=>typeof o.name=="string"&&o.name.toLowerCase()===c.toLowerCase());return {workspace:r.workspace??null,scope:r.scope??null,validation:r.validation??null,project:n??null,safeCommands:r.safeCommands??[]}}case "getArtifact":{let r=String(i.relativePath??"").trim();return l(e$1,r)}case "listOperationalSkills":return l(e$1,b$2);case "getWorkspaceExplain":{let r=String(i.target??"release-blocked").trim(),s=c$1(r);if(!s)throw new Error(`Invalid explain target: ${r}`);let a=await l(e$1,c$2);return e(a)&&N(a.target,s)?a:b({workspacePath:e$1,target:s})}default:throw new Error(`Unknown tool: ${t}`)}}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
|
|
2
|
+
`);}function w(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
|
|
3
|
+
`);}async function et(e){let t=m.resolve(e.workspacePath),i=v.createInterface({input:process.stdin,terminal:false});for await(let r of i){let s=r.trim();if(!s)continue;let a;try{a=JSON.parse(s);}catch{w(null,"Invalid JSON-RPC request");continue}let{id:c,method:p,params:n}=a;try{if(p==="initialize"){E(c,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(p==="notifications/initialized")continue;if(p==="tools/list"){E(c,{tools:L.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))});continue}if(p==="tools/call"){let o=String(n?.name??""),h=n?.arguments&&typeof n.arguments=="object"?n.arguments:{},A=await O(t,o,h);E(c,{content:[{type:"text",text:JSON.stringify(A,null,2)}],isError:A==null});continue}w(c,`Unsupported method: ${p??"unknown"}`);}catch(o){w(c,o instanceof Error?o.message:String(o));}}}async function nt(e,t,i={}){return O(m.resolve(e),t,i)}export{L as WORKSPACE_MCP_READ_TOOLS,nt as invokeMcpToolForTest,et as runWorkspaceMcpServe};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{k as WORKSPACE_MODEL_REPORT_PATH,j as WORKSPACE_MODEL_SCHEMA_VERSION,n as buildWorkspaceModel,o as buildWorkspaceModelCached,m as buildWorkspaceModelFacts,p as buildWorkspaceModelIncremental,l as validateWorkspaceModelStrict,q as writeWorkspaceModel}from'./chunk-
|
|
1
|
+
export{k as WORKSPACE_MODEL_REPORT_PATH,j as WORKSPACE_MODEL_SCHEMA_VERSION,n as buildWorkspaceModel,o as buildWorkspaceModelCached,m as buildWorkspaceModelFacts,p as buildWorkspaceModelIncremental,l as validateWorkspaceModelStrict,q as writeWorkspaceModel}from'./chunk-JICOD2GI.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-A5FBGRJA.js';import {b as b$1,j}from'./chunk-2QN6BMM7.js';import {f,g}from'./chunk-FWJV7CCI.js';import {r,p}from'./chunk-2K3GYCPS.js';import {o}from'./chunk-5XATWNME.js';import n from'path';import {existsSync}from'fs';import y from'fs-extra';var k=".workspai/workspace-registry.v1.json",w="workspace-registry.v1";function C(t){return {slug:t.slug,relativePath:t.relativePath,framework:t.framework,kit:t.kit,source:t.source}}async function x(t){let r=o(t,"workspace.json").find(e=>existsSync(e));if(!r)return {exists:false,legacyProjectCount:0};try{let e=await y.readJson(r),s=Array.isArray(e.projects)?e.projects.length:0,o=typeof e.workspace_name=="string"&&e.workspace_name.trim()||typeof e.name=="string"&&e.name.trim()||n.basename(t);return {exists:true,manifestPath:r,workspaceName:o,profile:typeof e.profile=="string"?e.profile:void 0,legacyProjectCount:s}}catch{return {exists:true,manifestPath:r,legacyProjectCount:0,workspaceName:n.basename(t)}}}async function A(t){let r$1=a(t);for(let e of r())if(await y.pathExists(e))try{let o=((await y.readJson(e)).workspaces||[]).find(a$1=>a(a$1.path)===r$1);if(o)return {exists:true,projectCount:Array.isArray(o.projects)?o.projects.length:0,registryPath:e}}catch{continue}return {exists:false,projectCount:0,registryPath:n.join(p(),"workspaces.json")}}async function b(t){let r=n.resolve(t),e=await f(r,b$1),s=await x(r),o=await A(r),a=!!e,c=[];if(a)try{let{contract:S}=await j({workspacePath:r});c=S.projects||[];}catch{c=[];}let W={contract:{exists:a,projectCount:c.length,path:b$1},globalRegistry:{exists:o.exists,projectCount:o.projectCount,path:o.registryPath},legacyWorkspaceJson:{exists:s.exists,projectCount:s.legacyProjectCount,path:s.manifestPath?n.relative(r,s.manifestPath):void 0}},i="none",u=[],p=0;return a?(i="workspace.contract.json",u=c.map(C),p=u.length):o.projectCount>0?(i="global-registry",p=o.projectCount):s.legacyProjectCount>0&&(i="legacy-workspace.json",p=s.legacyProjectCount),{contractExists:a,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:r,workspaceName:s.workspaceName||n.basename(r),profile:s.profile,projectCount:p,authority:i,contractPath:b$1,projects:u,sources:W}}}async function J(t){let r=await f(t,k);if(!r)return null;try{let e=await y.readJson(r);return e?.schemaVersion!==w?null:e}catch{return null}}async function V(t,r){let s={...(await b(t)).summary,generatedAt:(r?.now??new Date).toISOString(),registrySummaryPath:k};return await g(t,k,s),s}function Y(t,r=""){return t.projectCount>0?t.authority==="workspace.contract.json"?`${t.projectCount} project(s) registered in workspace contract${r}.`:t.authority==="global-registry"?`${t.projectCount} project(s) registered in global workspace registry${r}.`:`${t.projectCount} project(s) registered in legacy workspace manifest${r}.`:`Workspace state exists, but no projects are registered yet${r}.`}export{k as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,w as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,Y as formatWorkspaceRegistrySyncSummary,V as publishWorkspaceRegistrySummary,J as readWorkspaceRegistrySummary,b as resolveWorkspaceRegisteredProjects};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as runWorkspaceStage}from'./chunk-NTXO7BMH.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-B66A4TVP.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-
|
|
1
|
+
export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-UNF72FTB.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-7IHLTPZ6.js';import {b as b$1,p}from'./chunk-JICOD2GI.js';import {a as a$1}from'./chunk-LG6RFLPZ.js';import P from'fs';var w="workspace-watch-event.v1";function b(t){return a$1(t,"contracts/workspace-watch-event.v1.json","Workspace watch event"),t}function g(t){return `${t.from}\0${t.to}\0${t.kind}`}function f(t){return (t.graph?.edges??[]).map(r=>({from:r.from,to:r.to,kind:r.kind}))}function m(t){let o=[...a(t).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(t).map(g).sort((a,n)=>a.localeCompare(n));return b$1({projects:o,edges:c})}function R(t,r){let o=a(r),c=t?a(t):new Map,a$1=[],n=[];for(let[e,s]of o.entries())c.has(e)?c.get(e)!==s&&a$1.push(e):n.push(e);let d=[];for(let e of c.keys())o.has(e)||d.push(e);let i=new Map(t?f(t).map(e=>[g(e),e]):[]),l=new Map(f(r).map(e=>[g(e),e])),p=[];for(let[e,s]of l.entries())i.has(e)||p.push(s);let h=[];for(let[e,s]of i.entries())l.has(e)||h.push(s);let u=(e,s)=>g(e).localeCompare(g(s));return a$1.sort((e,s)=>e.localeCompare(s)),n.sort((e,s)=>e.localeCompare(s)),d.sort((e,s)=>e.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(r,o){this.rebuild=o?.rebuild??(()=>p({...r})),this.now=o?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let r=Date.now(),{model:o}=await this.rebuild();return this.model=o,this.buildEvent("ready","initial",null,o,Date.now()-r)}async pulse(){let r=Date.now(),o=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(o,c)?"changed":"unchanged",a,o,c,Date.now()-r);return this.model=c,n}hasStructuralChange(r,o){return r?m(r)!==m(o):true}buildEvent(r,o,c,a,n){let d=R(c,a),i=m(a),l=c?m(c)!==i:true;return b({schemaVersion:w,kind:r,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:o,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n})}},C=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),y=new Set(["reports","cache","tmp",".cache"]);function S(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>C.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if((r[o]===".workspai"||r[o]===".rapidkit")&&y.has(r[o+1]))return false;return true}async function I(t){let r=new k(t.buildOptions,t.engineOptions),o=await r.start();if(t.emit(o),t.once)return;let c=t.debounceMs??250,a=t.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let e=await r.pulse();t.emit(e);}catch(e){t.emit(b({schemaVersion:w,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:r.currentModel?m(r.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:e instanceof Error?e.message:String(e)}));}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=e=>{S(e)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};t.onProgress?.(`Watching ${t.workspacePath} for changes (Ctrl+C to stop).`);let u=P.watch(t.workspacePath,{recursive:true},(e,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(e=>{let s=()=>{n&&clearTimeout(n),u.close(),e();};if(t.signal){if(t.signal.aborted){s();return}t.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{w as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,R as diffWatchModels,S as isWatchRelevantPath,I as runWorkspaceWatch};
|