workspai 0.43.1 → 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 +23 -10
- 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-244S5K6I.js → artifact-remediation-plan-Z7OCSME3.js} +2 -2
- 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-FDDDQMJ2.js → chunk-5PVEQ6CZ.js} +1 -1
- package/dist/{chunk-DOCPUNWS.js → chunk-7EIMPQR3.js} +1 -1
- package/dist/{chunk-U6AXYUQY.js → chunk-7IHLTPZ6.js} +1 -1
- package/dist/chunk-7RIWU5TZ.js +1 -0
- 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-EMTQ6OKI.js → chunk-JP25YL3J.js} +1 -1
- 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-ONU457VN.js → chunk-M4VITK6X.js} +52 -50
- package/dist/chunk-NTXO7BMH.js +4 -0
- package/dist/{chunk-PPHTYJ7G.js → chunk-OW4UNG27.js} +36 -37
- package/dist/chunk-P4SWTY5X.js +33 -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-42RTNLH2.js → create-DFAWAS5C.js} +1 -1
- package/dist/doctor-PVSWDBJL.js +1 -0
- package/dist/index.d.ts +250 -24
- package/dist/index.js +194 -195
- package/dist/pipeline-ND734AJM.js +5 -0
- package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
- package/dist/{pythonRapidkitExec-GCQ3M46E.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
- package/dist/{workspace-DZHWB7BV.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-2TA27LGT.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-FQWHPQGX.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-F3B75TYT.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-OAATQV5T.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 +26 -14
- package/scripts/enterprise-package-smoke.mjs +40 -8
- package/scripts/prepack-enterprise.mjs +8 -0
- package/dist/analyze-5BU4QIPK.js +0 -1
- package/dist/autopilot-release-45YVOBQO.js +0 -1
- package/dist/chunk-3QVTWKUI.js +0 -4
- package/dist/chunk-753LOKFZ.js +0 -2
- package/dist/chunk-AMDKXXLP.js +0 -1
- package/dist/chunk-AQ4XZZC6.js +0 -1
- package/dist/chunk-CDE4Q77U.js +0 -2
- package/dist/chunk-DNAY5ALC.js +0 -1
- package/dist/chunk-FHSMY75W.js +0 -1
- package/dist/chunk-FM7GMFZA.js +0 -2
- package/dist/chunk-HV5ZFXAZ.js +0 -13
- package/dist/chunk-LRW2SAGL.js +0 -4
- package/dist/chunk-LTWYYP6E.js +0 -7
- package/dist/chunk-NAAQMSO3.js +0 -1
- package/dist/chunk-NFUXULIF.js +0 -1
- package/dist/chunk-OL64GWQC.js +0 -9
- package/dist/chunk-SI3AQKIP.js +0 -1
- package/dist/chunk-TH5Y3EMA.js +0 -33
- package/dist/chunk-UQKCCWUL.js +0 -78
- package/dist/chunk-XNGANEXM.js +0 -2
- package/dist/doctor-DK4BON3N.js +0 -1
- package/dist/pipeline-HQ57V6OZ.js +0 -5
- package/dist/workspace-agent-sync-5ADIQS7B.js +0 -1
- package/dist/workspace-archive-GCZNI44O.js +0 -3
- package/dist/workspace-context-GEXDHA7A.js +0 -1
- package/dist/workspace-explain-D5NNL3NG.js +0 -1
- package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
- package/dist/workspace-intelligence-BEM6WGCZ.js +0 -1
- package/dist/workspace-mcp-serve-OMBA5V3C.js +0 -3
- package/dist/workspace-registry-summary-6MFBRWDS.js +0 -1
- package/dist/workspace-run-3WJXIQKR.js +0 -1
- package/dist/workspace-watch-HU2OTQ52.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 +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};
|
package/docs/AI_FEATURES.md
CHANGED
|
@@ -29,6 +29,7 @@ npx workspai ai recommend "user authentication with social login"
|
|
|
29
29
|
**Step 1:** Get OpenAI API key from [OpenAI Platform](https://platform.openai.com/api-keys)
|
|
30
30
|
|
|
31
31
|
**Step 2:** Configure API key
|
|
32
|
+
|
|
32
33
|
```bash
|
|
33
34
|
npx workspai config set-api-key
|
|
34
35
|
# Or (non-interactive environments):
|
|
@@ -36,6 +37,7 @@ export OPENAI_API_KEY="<YOUR_OPENAI_API_KEY>"
|
|
|
36
37
|
```
|
|
37
38
|
|
|
38
39
|
**Step 3:** Generate embeddings (one-time, provider-cost dependent)
|
|
40
|
+
|
|
39
41
|
```bash
|
|
40
42
|
npx workspai ai generate-embeddings
|
|
41
43
|
|
|
@@ -53,6 +55,7 @@ npx workspai ai generate-embeddings
|
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
**Step 4:** Use AI recommendations
|
|
58
|
+
|
|
56
59
|
```bash
|
|
57
60
|
npx workspai ai recommend "user authentication"
|
|
58
61
|
```
|
|
@@ -82,6 +85,7 @@ Mock mode provides realistic (but not perfect) results for development and testi
|
|
|
82
85
|
Get intelligent module suggestions based on natural language descriptions.
|
|
83
86
|
|
|
84
87
|
**Example:**
|
|
88
|
+
|
|
85
89
|
```bash
|
|
86
90
|
$ npx workspai ai recommend "I need user authentication with email"
|
|
87
91
|
|
|
@@ -106,18 +110,20 @@ $ npx workspai ai recommend "I need user authentication with email"
|
|
|
106
110
|
## 💰 Pricing
|
|
107
111
|
|
|
108
112
|
### One-Time Setup Cost (Estimates)
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
|
|
114
|
+
| Item | Cost | Notes |
|
|
115
|
+
| ------------------- | ------ | ------------------------------------------------ |
|
|
111
116
|
| Generate embeddings | Varies | One-time only, depends on model and module count |
|
|
112
|
-
| Update embeddings
|
|
117
|
+
| Update embeddings | Varies | Only when catalog changes |
|
|
113
118
|
|
|
114
119
|
### Per-Query Cost (After Setup, Estimates)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
120
|
+
|
|
121
|
+
| Usage | Cost | Notes |
|
|
122
|
+
| -------------- | -------- | ------------------------- |
|
|
123
|
+
| Single query | Very low | Depends on provider/model |
|
|
124
|
+
| 100 queries | Low | Depends on provider/model |
|
|
125
|
+
| 1,000 queries | Moderate | Depends on provider/model |
|
|
126
|
+
| 10,000 queries | Higher | Depends on provider/model |
|
|
121
127
|
|
|
122
128
|
**Important:** Provider pricing and limits change over time. Always validate current pricing/limits in the provider dashboard before budgeting.
|
|
123
129
|
|
|
@@ -126,21 +132,25 @@ $ npx workspai ai recommend "I need user authentication with email"
|
|
|
126
132
|
## 🔧 Configuration
|
|
127
133
|
|
|
128
134
|
### View Current Config
|
|
135
|
+
|
|
129
136
|
```bash
|
|
130
137
|
npx workspai config show
|
|
131
138
|
```
|
|
132
139
|
|
|
133
140
|
### Set API Key
|
|
141
|
+
|
|
134
142
|
```bash
|
|
135
143
|
npx workspai config set-api-key
|
|
136
144
|
```
|
|
137
145
|
|
|
138
146
|
### Remove API Key
|
|
147
|
+
|
|
139
148
|
```bash
|
|
140
149
|
npx workspai config remove-api-key
|
|
141
150
|
```
|
|
142
151
|
|
|
143
152
|
### Enable/Disable AI
|
|
153
|
+
|
|
144
154
|
```bash
|
|
145
155
|
npx workspai config ai enable
|
|
146
156
|
npx workspai config ai disable
|
|
@@ -180,17 +190,17 @@ npx workspai config ai disable
|
|
|
180
190
|
|
|
181
191
|
### Technical Details
|
|
182
192
|
|
|
183
|
-
1. **Module Catalog**:
|
|
193
|
+
1. **Module Catalog**:
|
|
184
194
|
- 27+ production-ready modules (dynamic from Python Core)
|
|
185
195
|
- Fallback to 11 hardcoded modules if Python unavailable
|
|
186
196
|
- 5-minute cache for performance
|
|
187
197
|
|
|
188
|
-
2. **Embeddings**:
|
|
198
|
+
2. **Embeddings**:
|
|
189
199
|
- AI converts module descriptions to 1536-dimensional vectors
|
|
190
200
|
- Generated once, reused for all queries
|
|
191
201
|
- Stored in `data/modules-embeddings.json` (508KB)
|
|
192
202
|
|
|
193
|
-
3. **Semantic Search**:
|
|
203
|
+
3. **Semantic Search**:
|
|
194
204
|
- User query → embedding vector
|
|
195
205
|
- Cosine similarity with all modules
|
|
196
206
|
- Results sorted by relevance score (0-100%)
|
|
@@ -202,12 +212,14 @@ npx workspai config ai disable
|
|
|
202
212
|
- Installation order calculation
|
|
203
213
|
|
|
204
214
|
**Technology Stack:**
|
|
215
|
+
|
|
205
216
|
- Model: `text-embedding-3-small` (OpenAI)
|
|
206
217
|
- Dimension: 1536 vectors
|
|
207
218
|
- Accuracy: 92%+ match scores
|
|
208
219
|
- Cost: provider-dependent (check current provider pricing)
|
|
209
220
|
|
|
210
221
|
**Performance:**
|
|
222
|
+
|
|
211
223
|
- First query: ~200ms (embedding generation)
|
|
212
224
|
- Subsequent queries: ~50ms (cached embeddings)
|
|
213
225
|
- Catalog refresh: Every 5 minutes
|
|
@@ -215,21 +227,25 @@ npx workspai config ai disable
|
|
|
215
227
|
## 🎯 Use Cases
|
|
216
228
|
|
|
217
229
|
### E-commerce Platform
|
|
230
|
+
|
|
218
231
|
```bash
|
|
219
232
|
workspai ai recommend "e-commerce with payments and inventory"
|
|
220
233
|
```
|
|
221
234
|
|
|
222
235
|
### SaaS Application
|
|
236
|
+
|
|
223
237
|
```bash
|
|
224
238
|
workspai ai recommend "SaaS platform with subscriptions"
|
|
225
239
|
```
|
|
226
240
|
|
|
227
241
|
### Real-time Chat
|
|
242
|
+
|
|
228
243
|
```bash
|
|
229
244
|
workspai ai recommend "real-time chat application"
|
|
230
245
|
```
|
|
231
246
|
|
|
232
247
|
### API Gateway
|
|
248
|
+
|
|
233
249
|
```bash
|
|
234
250
|
workspai ai recommend "API gateway with rate limiting"
|
|
235
251
|
```
|
|
@@ -259,6 +275,7 @@ npx workspai ai recommend "auth"
|
|
|
259
275
|
```
|
|
260
276
|
|
|
261
277
|
Or generate manually:
|
|
278
|
+
|
|
262
279
|
```bash
|
|
263
280
|
npx workspai ai generate-embeddings
|
|
264
281
|
```
|
|
@@ -266,12 +283,14 @@ npx workspai ai generate-embeddings
|
|
|
266
283
|
### "OpenAI API key not configured"
|
|
267
284
|
|
|
268
285
|
**Option 1:** Mock mode (no key needed, for testing)
|
|
286
|
+
|
|
269
287
|
```bash
|
|
270
288
|
# Just use it! Mock mode activates automatically
|
|
271
289
|
npx workspai ai recommend "database"
|
|
272
290
|
```
|
|
273
291
|
|
|
274
292
|
**Option 2:** Get a real API key
|
|
293
|
+
|
|
275
294
|
```bash
|
|
276
295
|
# 1. Get key: https://platform.openai.com/api-keys
|
|
277
296
|
# 2. Configure it:
|
|
@@ -286,6 +305,7 @@ export OPENAI_API_KEY="<YOUR_OPENAI_API_KEY>"
|
|
|
286
305
|
**Cause:** API key is incorrect or expired
|
|
287
306
|
|
|
288
307
|
**Solution:**
|
|
308
|
+
|
|
289
309
|
```bash
|
|
290
310
|
# Update your API key
|
|
291
311
|
npx workspai config set-api-key
|
|
@@ -299,12 +319,14 @@ npx workspai config show
|
|
|
299
319
|
**Cause:** OpenAI API quota or rate limit reached
|
|
300
320
|
|
|
301
321
|
**Solutions:**
|
|
322
|
+
|
|
302
323
|
1. **Check billing:** https://platform.openai.com/account/billing
|
|
303
324
|
2. **Check limits:** https://platform.openai.com/account/limits
|
|
304
325
|
3. **Upgrade tier:** Free tier has lower limits
|
|
305
326
|
4. **Wait:** Rate limits reset automatically
|
|
306
327
|
|
|
307
328
|
**Rate Limits:**
|
|
329
|
+
|
|
308
330
|
- Limits vary by provider account tier and can change over time
|
|
309
331
|
- Check your provider dashboard for current request/token limits
|
|
310
332
|
|
|
@@ -315,6 +337,7 @@ npx workspai config show
|
|
|
315
337
|
**Impact:** Uses fallback catalog instead of the full runtime catalog
|
|
316
338
|
|
|
317
339
|
**Solution (optional):**
|
|
340
|
+
|
|
318
341
|
```bash
|
|
319
342
|
# Install RapidKit Python Core
|
|
320
343
|
pip install -e /path/to/rapidkit-core
|
|
@@ -330,6 +353,7 @@ rapidkit modules list --json
|
|
|
330
353
|
**Symptom:** New modules not appearing in recommendations
|
|
331
354
|
|
|
332
355
|
**Solution:** Update embeddings with latest modules
|
|
356
|
+
|
|
333
357
|
```bash
|
|
334
358
|
npx workspai ai update-embeddings
|
|
335
359
|
|
|
@@ -344,11 +368,13 @@ npx workspai ai update-embeddings
|
|
|
344
368
|
**Symptom:** All results show <70% match
|
|
345
369
|
|
|
346
370
|
**Possible Causes:**
|
|
371
|
+
|
|
347
372
|
1. Query too vague: "build something"
|
|
348
373
|
2. Query too specific: "blockchain NFT marketplace with AI"
|
|
349
374
|
3. No matching modules exist
|
|
350
375
|
|
|
351
376
|
**Solutions:**
|
|
377
|
+
|
|
352
378
|
- Make query more specific: "authentication" → "user authentication with JWT"
|
|
353
379
|
- Try different keywords: "storage" instead of "blockchain"
|
|
354
380
|
- Check available modules: `npx workspai ai info`
|
|
@@ -358,6 +384,7 @@ npx workspai ai update-embeddings
|
|
|
358
384
|
**Cause:** Mock embeddings are deterministic but not trained
|
|
359
385
|
|
|
360
386
|
**Solution:** Use real OpenAI API for production
|
|
387
|
+
|
|
361
388
|
```bash
|
|
362
389
|
# Get API key and generate real embeddings
|
|
363
390
|
npx workspai config set-api-key
|
|
@@ -380,11 +407,13 @@ npx workspai config show
|
|
|
380
407
|
### Still Having Issues?
|
|
381
408
|
|
|
382
409
|
1. **Enable debug logging:**
|
|
410
|
+
|
|
383
411
|
```bash
|
|
384
412
|
DEBUG=rapidkit:* npx workspai ai recommend "auth"
|
|
385
413
|
```
|
|
386
414
|
|
|
387
415
|
2. **Check for updates:**
|
|
416
|
+
|
|
388
417
|
```bash
|
|
389
418
|
npm outdated workspai
|
|
390
419
|
npm update workspai
|
|
@@ -398,25 +427,25 @@ npx workspai config show
|
|
|
398
427
|
|
|
399
428
|
### AI Commands
|
|
400
429
|
|
|
401
|
-
| Command
|
|
402
|
-
|
|
403
|
-
| `workspai ai recommend [query]`
|
|
404
|
-
| `workspai ai recommend [query] -n <N>`
|
|
405
|
-
| `workspai ai recommend [query] --json`
|
|
406
|
-
| `workspai ai generate-embeddings`
|
|
407
|
-
| `workspai ai generate-embeddings --force` | Force regenerate embeddings
|
|
408
|
-
| `workspai ai update-embeddings`
|
|
409
|
-
| `workspai ai info`
|
|
430
|
+
| Command | Description | Example |
|
|
431
|
+
| ----------------------------------------- | ------------------------------ | ----------------------------------------- |
|
|
432
|
+
| `workspai ai recommend [query]` | Get module recommendations | `workspai ai recommend "auth"` |
|
|
433
|
+
| `workspai ai recommend [query] -n <N>` | Get top N recommendations | `workspai ai recommend "database" -n 3` |
|
|
434
|
+
| `workspai ai recommend [query] --json` | Get JSON output | `workspai ai recommend "auth" --json` |
|
|
435
|
+
| `workspai ai generate-embeddings` | Generate embeddings (one-time) | `workspai ai generate-embeddings` |
|
|
436
|
+
| `workspai ai generate-embeddings --force` | Force regenerate embeddings | `workspai ai generate-embeddings --force` |
|
|
437
|
+
| `workspai ai update-embeddings` | Update with latest modules | `workspai ai update-embeddings` |
|
|
438
|
+
| `workspai ai info` | Show AI features info | `workspai ai info` |
|
|
410
439
|
|
|
411
440
|
### Configuration Commands
|
|
412
441
|
|
|
413
|
-
| Command
|
|
414
|
-
|
|
415
|
-
| `workspai config set-api-key`
|
|
416
|
-
| `workspai config show`
|
|
417
|
-
| `workspai config remove-api-key` | Remove API key
|
|
418
|
-
| `workspai config ai enable`
|
|
419
|
-
| `workspai config ai disable`
|
|
442
|
+
| Command | Description | Example |
|
|
443
|
+
| -------------------------------- | -------------------------------- | -------------------------------- |
|
|
444
|
+
| `workspai config set-api-key` | Set OpenAI API key (interactive) | `workspai config set-api-key` |
|
|
445
|
+
| `workspai config show` | Show current config | `workspai config show` |
|
|
446
|
+
| `workspai config remove-api-key` | Remove API key | `workspai config remove-api-key` |
|
|
447
|
+
| `workspai config ai enable` | Enable AI features | `workspai config ai enable` |
|
|
448
|
+
| `workspai config ai disable` | Disable AI features | `workspai config ai disable` |
|
|
420
449
|
|
|
421
450
|
### Recommend Command Options
|
|
422
451
|
|
|
@@ -439,13 +468,17 @@ Options:
|
|
|
439
468
|
-h, --help Display help
|
|
440
469
|
```
|
|
441
470
|
|
|
442
|
-
## 🚀
|
|
471
|
+
## 🚀 Planned Workspace Intelligence Extensions
|
|
472
|
+
|
|
473
|
+
These are roadmap ideas, not current CLI claims. New AI-facing surfaces must be
|
|
474
|
+
grounded in `contracts/workspace-intelligence-architecture.v1.json` before they
|
|
475
|
+
are documented as available features.
|
|
443
476
|
|
|
444
|
-
- [ ]
|
|
445
|
-
- [ ]
|
|
446
|
-
- [ ] Bug detection
|
|
447
|
-
- [ ] Test generation
|
|
448
|
-
- [ ] Architecture suggestions
|
|
477
|
+
- [ ] Workspace Atlas generated from Workspace Intelligence evidence
|
|
478
|
+
- [ ] Repository/project chat over generated evidence artifacts
|
|
479
|
+
- [ ] Bug detection grounded in doctor, verify, and impact reports
|
|
480
|
+
- [ ] Test generation informed by workspace model, runtime signals, and affected subgraphs
|
|
481
|
+
- [ ] Architecture suggestions with evidence/freshness labels
|
|
449
482
|
|
|
450
483
|
## 🤝 Contributing
|
|
451
484
|
|
package/docs/README.md
CHANGED
|
@@ -18,7 +18,8 @@ Hub for user and contributor documentation. Start with the [main README](../READ
|
|
|
18
18
|
| [commands-reference.md](./commands-reference.md) | Full CLI syntax, profiles, and policy keys |
|
|
19
19
|
| [workspace-operations.md](./workspace-operations.md) | Import, adopt, snapshots, archives, contracts, infra |
|
|
20
20
|
| [workspace-run.md](./workspace-run.md) | Polyglot fleet orchestration (`workspace run`) |
|
|
21
|
-
| [create-planner-capabilities.md](./create-planner-capabilities.md) | Native create,
|
|
21
|
+
| [create-planner-capabilities.md](./create-planner-capabilities.md) | Native create, official, and existing lanes |
|
|
22
|
+
| [../contracts/project-entry-capability.v1.json](../contracts/project-entry-capability.v1.json) | Contract: any readable project can enter through adopt/import when it can be registered |
|
|
22
23
|
| [from-code-to-shared-understanding.md](./from-code-to-shared-understanding.md) | GitHub-rendered Workspace Intelligence diagram |
|
|
23
24
|
| [OPEN_SOURCE_USER_SCENARIOS.md](./OPEN_SOURCE_USER_SCENARIOS.md) | Role-based workflows (junior → enterprise) |
|
|
24
25
|
| [doctor-command.md](./doctor-command.md) | Doctor scopes, CI exit codes, JSON evidence |
|
|
@@ -9,9 +9,9 @@ npx workspai create # Prompts: workspace | project
|
|
|
9
9
|
npx workspai create workspace <name> [--profile <profile>] [--author <name>] [--yes] [--here|--output <parent-dir>] [--skip-python-engine]
|
|
10
10
|
npx workspai bootstrap [--profile <profile>] [--ci] [--json] [--compliance-only]
|
|
11
11
|
npx workspai setup <python|node|go|java|dotnet> [--warm-deps]
|
|
12
|
-
npx workspai pipeline [--json] [--strict] [--skip-verify] [--skip-analyze] [--skip-autopilot] [--autopilot-mode <audit|safe-fix|enforce>]
|
|
12
|
+
npx workspai pipeline [--json] [--strict] [--skip-verify] [--skip-analyze] [--skip-autopilot] [--autopilot-mode <audit|safe-fix|enforce>] [--agent-sync|--no-agent-sync]
|
|
13
13
|
npx workspai analyze [--workspace <path>] [--json] [--strict] [--output <file>]
|
|
14
|
-
npx workspai readiness [--json] [--strict] [--skip-verify]
|
|
14
|
+
npx workspai readiness [--workspace <path>] [--json] [--strict] [--skip-verify]
|
|
15
15
|
npx workspai autopilot release [--mode <audit|safe-fix|enforce>] [--json] [--output <file>] [--since <ref>] [--parallel] [--max-workers <n>]
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -49,19 +49,25 @@ npx workspai workspace contract init [--force] [--json]
|
|
|
49
49
|
npx workspai workspace contract inspect [--json]
|
|
50
50
|
npx workspai workspace contract verify [--strict] [--json]
|
|
51
51
|
npx workspai workspace contract graph [--json]
|
|
52
|
-
npx workspai workspace model [--json] [--write] [--strict]
|
|
53
|
-
npx workspai workspace context --for-agent [codex|claude|cursor|orca] [--json] [--write] [--no-agent-sync]
|
|
54
|
-
npx workspai workspace agent-sync [--write] [--refresh-context] [--strict] [--json] [--preset minimal|enterprise] [--target all|vscode|copilot,cursor,claude] [--experimental-hooks]
|
|
52
|
+
npx workspai workspace model [--workspace <path>] [--json] [--write] [--strict] [--cache] [--incremental] [--include-paths] [--include-evidence] [--scan-depth <count>]
|
|
53
|
+
npx workspai workspace context --for-agent [codex|claude|cursor|orca] [--workspace <path>] [--json] [--write] [--agent-sync|--no-agent-sync] [--target <targets>] [--preset minimal|enterprise] [--include-evidence] [--scan-depth <count>]
|
|
54
|
+
npx workspai workspace agent-sync [--workspace <path>] [--write] [--refresh-context] [--strict] [--json] [--preset minimal|enterprise] [--target all|vscode|agents,copilot,cursor,claude,codex,orca] [--experimental-hooks] [--hydrate-prompts]
|
|
55
55
|
npx workspai workspace remediation-plan [--json] [--write] [--ci] [--include-paths]
|
|
56
|
-
npx workspai workspace snapshot [--json]
|
|
57
|
-
npx workspai workspace diff --from <snapshot-or-report|git[:ref]> [--json]
|
|
58
|
-
npx workspai workspace impact --from <
|
|
59
|
-
npx workspai workspace verify [--from-impact <file>] [--scope project:<name>] [--strict] [--json]
|
|
60
|
-
npx workspai workspace
|
|
61
|
-
npx workspai workspace
|
|
62
|
-
npx workspai workspace
|
|
63
|
-
npx workspai workspace
|
|
64
|
-
npx workspai workspace
|
|
56
|
+
npx workspai workspace snapshot [--workspace <path>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
|
|
57
|
+
npx workspai workspace diff --from <snapshot-or-report|git[:ref]> [--workspace <path>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>] [--strict]
|
|
58
|
+
npx workspai workspace impact --from <workspace-diff-report> [--workspace <path>] [--scope project:<name>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>] [--strict]
|
|
59
|
+
npx workspai workspace verify [--from-impact <file>] [--workspace <path>] [--scope project:<name>] [--strict] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
|
|
60
|
+
npx workspai workspace graph [emit|explain|dot|mermaid] [key] [--workspace <path>] [--scope project:<name>] [--json] [--include-paths] [--include-evidence] [--scan-depth <count>]
|
|
61
|
+
npx workspai workspace watch [--workspace <path>] [--json] [--once] [--scan-depth <count>]
|
|
62
|
+
npx workspai workspace explain|why <target> [--workspace <path>] [--json] [--write]
|
|
63
|
+
npx workspai workspace trace --from <workspace-diff-report> [--workspace <path>] [--json] [--write]
|
|
64
|
+
npx workspai workspace feedback record [--workspace <path>] [--json]
|
|
65
|
+
npx workspai workspace mcp serve [--workspace <path>] [--json]
|
|
66
|
+
npx workspai workspace export --output team-workspace.workspai-archive.zip [--archive-compression store|deflate]
|
|
67
|
+
npx workspai workspace archive inspect team-workspace.workspai-archive.zip [--max-download-size <size>] [--max-expanded-size <size>] [--download-timeout-ms <ms>] [--json]
|
|
68
|
+
npx workspai workspace archive verify team-workspace.workspai-archive.zip [--max-download-size <size>] [--max-expanded-size <size>] [--download-timeout-ms <ms>] [--strict] [--json]
|
|
69
|
+
npx workspai workspace archive doctor team-workspace.workspai-archive.zip [--max-download-size <size>] [--max-expanded-size <size>] [--download-timeout-ms <ms>] [--strict] [--json]
|
|
70
|
+
npx workspai workspace hydrate team-workspace.workspai-archive.zip --output ./team-workspace [--max-download-size <size>] [--max-expanded-size <size>] [--download-timeout-ms <ms>]
|
|
65
71
|
npx workspai import <path|git-url> [--workspace <path>] [--name <project-name>] [--git] [--json]
|
|
66
72
|
npx workspai adopt [path] [--workspace <path>] [--name <project-name>] [--dry-run] [--json]
|
|
67
73
|
npx workspai snapshot create [name] [--include-projects] [--reason <text>] [--json]
|
|
@@ -82,6 +88,12 @@ npx workspai infra status [--workspace <path>] [--json] [--strict]
|
|
|
82
88
|
|
|
83
89
|
See [workspace-run.md](./workspace-run.md) for fleet orchestration semantics.
|
|
84
90
|
|
|
91
|
+
After cloning or moving an existing workspace, `workspace sync` repairs its
|
|
92
|
+
machine-local global registry entry before project discovery. For workspaces
|
|
93
|
+
that only have legacy `.rapidkit-workspace` metadata, run `workspace foundation
|
|
94
|
+
ensure` to add the canonical marker and foundation without deleting legacy
|
|
95
|
+
compatibility inputs.
|
|
96
|
+
|
|
85
97
|
Workspace profile compatibility is enforced consistently across `create project`,
|
|
86
98
|
`import`, `adopt`, and `bootstrap` compliance. In default `warn` policy mode,
|
|
87
99
|
cross-runtime additions are allowed with a recommendation such as
|