@lssm/bundle.contractspec-workspace 0.0.0-canary-20251221153314 → 0.0.0-canary-20251221164004
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 +1 -1
- package/dist/index.js +2 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Reusable use-cases and services for ContractSpec workspace operations.
|
|
|
6
6
|
|
|
7
7
|
This bundle provides platform-agnostic services that can be used by:
|
|
8
8
|
|
|
9
|
-
- CLI tools (`@lssm/app.cli-
|
|
9
|
+
- CLI tools (`@lssm/app.cli-contractspec`)
|
|
10
10
|
- Web applications
|
|
11
11
|
- VS Code extensions
|
|
12
12
|
- API servers
|
package/dist/index.js
CHANGED
|
@@ -3244,7 +3244,7 @@ contractspec integrity
|
|
|
3244
3244
|
|
|
3245
3245
|
More specific instructions may exist in subdirectories. Check for \`AGENTS.md\` files in the relevant package or module.
|
|
3246
3246
|
`}function gb(){let $=process.platform,z=process.env.HOME??process.env.USERPROFILE??"";switch($){case"darwin":return`${z}/Library/Application Support/Claude/claude_desktop_config.json`;case"win32":return`${process.env.APPDATA??z}/Claude/claude_desktop_config.json`;default:return`${z}/.config/claude/claude_desktop_config.json`}}function Y7($,z){let Y={...$};for(let U of Object.keys(z)){let W=$[U],Q=z[U];if(W===void 0)Y[U]=Q;else if(xb(W)&&xb(Q))Y[U]=Y7(W,Q)}return Y}function ya0($,z){let Y={...$};for(let U of Object.keys(z)){let W=$[U],Q=z[U];if(Q===void 0)continue;if(xb(W)&&xb(Q))Y[U]=ya0(W,Q);else Y[U]=Q}return Y}function xb($){return typeof $==="object"&&$!==null&&!Array.isArray($)&&Object.getPrototypeOf($)===Object.prototype}function IX($){try{return JSON.parse($)}catch{return null}}function f4($){return JSON.stringify($,null,2)+`
|
|
3247
|
-
`}async function Oi($,z,Y){let U=z.isMonorepo&&z.scope==="package"?z.packageRoot??z.workspaceRoot:z.workspaceRoot,W=$.join(U,".contractsrc.json");try{let Q=await $.exists(W),X=Eq(z);if(Q){let H=await $.readFile(W),O=IX(H);if(!O)return{target:"cli-config",filePath:W,action:"error",message:"Existing file is not valid JSON"};if(z.interactive){if(!await Y.confirm(`${W} exists. Merge ContractSpec defaults?`))return{target:"cli-config",filePath:W,action:"skipped",message:"User skipped merge"}}let G=Y7(O,X);return await $.writeFile(W,f4(G)),{target:"cli-config",filePath:W,action:"merged",message:"Merged with existing configuration"}}return await $.writeFile(W,f4(X)),{target:"cli-config",filePath:W,action:"created",message:"Created CLI configuration"}}catch(Q){return{target:"cli-config",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}async function Gi($,z,Y){let U=z.isMonorepo&&z.scope==="package"?z.packageRoot??z.workspaceRoot:z.workspaceRoot,W=$.join(U,".vscode"),Q=$.join(W,"settings.json");try{if(!await $.exists(W))await $.mkdir(W);let H=await $.exists(Q),O=YN$();if(H){let G=await $.readFile(Q),Z=IX(G);if(!Z)return{target:"vscode-settings",filePath:Q,action:"error",message:"Existing file is not valid JSON"};if(z.interactive){if(!await Y.confirm(`${Q} exists. Add ContractSpec settings?`))return{target:"vscode-settings",filePath:Q,action:"skipped",message:"User skipped merge"}}let B=Y7(Z,O);return await $.writeFile(Q,f4(B)),{target:"vscode-settings",filePath:Q,action:"merged",message:"Added ContractSpec settings"}}return await $.writeFile(Q,f4(O)),{target:"vscode-settings",filePath:Q,action:"created",message:"Created VS Code settings"}}catch(X){return{target:"vscode-settings",filePath:Q,action:"error",message:X instanceof Error?X.message:"Unknown error"}}}async function qi($,z,Y){let U=$.join(z.workspaceRoot,".cursor"),W=$.join(U,"mcp.json");try{if(!await $.exists(U))await $.mkdir(U);let X=await $.exists(W),H=w2();if(X){let O=await $.readFile(W),G=IX(O);if(!G)return{target:"mcp-cursor",filePath:W,action:"error",message:"Existing file is not valid JSON"};if(z.interactive){if(!await Y.confirm(`${W} exists. Add ContractSpec MCP server?`))return{target:"mcp-cursor",filePath:W,action:"skipped",message:"User skipped merge"}}let Z=Y7(G,H);return await $.writeFile(W,f4(Z)),{target:"mcp-cursor",filePath:W,action:"merged",message:"Added ContractSpec MCP server"}}return await $.writeFile(W,f4(H)),{target:"mcp-cursor",filePath:W,action:"created",message:"Created Cursor MCP configuration"}}catch(Q){return{target:"mcp-cursor",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}async function Zi($,z,Y){let U=gb();try{let W=await $.exists(U),Q=WN$();if(z.interactive){if(!await Y.confirm(`Configure Claude Desktop at ${U}?`))return{target:"mcp-claude",filePath:U,action:"skipped",message:"User skipped Claude Desktop configuration"}}if(W){let O=await $.readFile(U),G=IX(O);if(!G)return{target:"mcp-claude",filePath:U,action:"error",message:"Existing file is not valid JSON"};let Z=Y7(G,Q);return await $.writeFile(U,f4(Z)),{target:"mcp-claude",filePath:U,action:"merged",message:"Added ContractSpec to Claude Desktop"}}let X=U.substring(0,U.lastIndexOf("/"));if(!await $.exists(X))await $.mkdir(X);return await $.writeFile(U,f4(Q)),{target:"mcp-claude",filePath:U,action:"created",message:"Created Claude Desktop configuration"}}catch(W){return{target:"mcp-claude",filePath:U,action:"error",message:W instanceof Error?W.message:"Unknown error"}}}async function Bi($,z,Y){let U=$.join(z.workspaceRoot,".cursor","rules"),W=$.join(U,"contractspec.mdc");try{let Q=$.join(z.workspaceRoot,".cursor");if(!await $.exists(Q))await $.mkdir(Q);if(!await $.exists(U))await $.mkdir(U);let X=await $.exists(W),H=UN$(z);if(X)if(z.interactive){if(!await Y.confirm(`${W} exists. Overwrite with latest rules?`))return{target:"cursor-rules",filePath:W,action:"skipped",message:"User kept existing rules"}}else return{target:"cursor-rules",filePath:W,action:"skipped",message:"File already exists"};return await $.writeFile(W,H),{target:"cursor-rules",filePath:W,action:X?"merged":"created",message:X?"Updated Cursor rules":"Created Cursor rules"}}catch(Q){return{target:"cursor-rules",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}async function Ji($,z,Y){let U=z.isMonorepo&&z.scope==="package"?z.packageRoot??z.workspaceRoot:z.workspaceRoot,W=$.join(U,"AGENTS.md");try{let Q=await $.exists(W),X=QN$(z);if(Q)if(z.interactive){if(!await Y.confirm(`${W} exists. Overwrite?`))return{target:"agents-md",filePath:W,action:"skipped",message:"User kept existing AGENTS.md"}}else return{target:"agents-md",filePath:W,action:"skipped",message:"File already exists"};return await $.writeFile(W,X),{target:"agents-md",filePath:W,action:Q?"merged":"created",message:Q?"Updated AGENTS.md":"Created AGENTS.md"}}catch(Q){return{target:"agents-md",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}var ga0={confirm:async()=>!0,multiSelect:async($,z)=>z.filter((Y)=>Y.selected!==!1).map((Y)=>Y.value),input:async($,z)=>z??""};async function fl1($,z,Y=ga0){let U=[],W=z.targets.length>0?z.targets:Hi,Q=z.workspaceRoot,X=oO(Q),H=z.packageRoot??pO(Q),O=z.isMonorepo??pB(X),G=z.packageName??(O?oB(H):void 0),Z=z.scope??"workspace",B=H!==X;if(O&&z.interactive&&B)Z=(await Y.multiSelect("Monorepo detected. Configure at which level?",[{value:"package",label:`Package level (${G??H})`,selected:!0},{value:"workspace",label:`Workspace level (${X})`}]))[0]??"package";let J=W;if(z.interactive)J=await Y.multiSelect("Select components to configure:",Hi.map((j)=>({value:j,label:zN$[j],selected:W.includes(j)})));let K=z.projectName;if(z.interactive&&!K){let j=Z==="package"&&G?G:Q.split("/").pop()??"my-project";K=await Y.input("Project name:",j)}let D={...z,workspaceRoot:X,packageRoot:H,isMonorepo:O,scope:Z,packageName:G,projectName:K,targets:J};for(let j of J){let A=await xa0($,j,D,Y);U.push(A)}let V=U.filter((j)=>j.action!=="error").length,w=U.filter((j)=>j.action==="error").length,I=O?` (${Z} level)`:"";return{success:w===0,files:U,summary:`Setup complete${I}: ${V} configured, ${w} failed.`}}async function xa0($,z,Y,U){switch(z){case"cli-config":return Oi($,Y,U);case"vscode-settings":return Gi($,Y,U);case"mcp-cursor":return qi($,Y,U);case"mcp-claude":return Zi($,Y,U);case"cursor-rules":return Bi($,Y,U);case"agents-md":return Ji($,Y,U);default:return{target:z,filePath:"",action:"error",message:`Unknown target: ${z}`}}}var XN$=["cli","config","mcp","deps","workspace","ai"],HN$={cli:"CLI Installation",config:"Configuration Files",mcp:"MCP Server",deps:"Dependencies",workspace:"Workspace Structure",ai:"AI Provider"};import{exec as ha0}from"node:child_process";import{promisify as ma0}from"node:util";var hb=ma0(ha0);async function Ki($,z){let Y=[];return Y.push(await ca0(z)),Y.push(await la0(z)),Y.push(await da0($,z)),Y}async function ca0($){try{return await hb("npx contractspec --version",{cwd:$.workspaceRoot,timeout:1e4}),{category:"cli",name:"CLI Accessible",status:"pass",message:"ContractSpec CLI is accessible"}}catch{return{category:"cli",name:"CLI Accessible",status:"fail",message:"ContractSpec CLI is not accessible",details:'Could not run "npx contractspec --version"',fix:{description:"Install ContractSpec CLI globally",apply:async()=>{try{return await hb("npm install -g @lssm/app.cli-contracts",{cwd:$.workspaceRoot,timeout:60000}),{success:!0,message:"CLI installed globally"}}catch(z){return{success:!1,message:`Failed to install: ${z instanceof Error?z.message:String(z)}`}}}}}}}async function la0($){try{let{stdout:z}=await hb("npx contractspec --version",{cwd:$.workspaceRoot,timeout:1e4});return{category:"cli",name:"CLI Version",status:"pass",message:`CLI version: ${z.trim()}`}}catch{return{category:"cli",name:"CLI Version",status:"skip",message:"Could not determine CLI version"}}}async function da0($,z){let Y=$.join(z.workspaceRoot,"package.json");try{if(!await $.exists(Y))return{category:"cli",name:"Local Installation",status:"skip",message:"No package.json found"};let W=await $.readFile(Y),Q=JSON.parse(W);if(Q.dependencies?.["@lssm/app.cli-contracts"]!==void 0||Q.devDependencies?.["@lssm/app.cli-contracts"]!==void 0)return{category:"cli",name:"Local Installation",status:"pass",message:"CLI is installed as a project dependency"};return{category:"cli",name:"Local Installation",status:"warn",message:"CLI is not installed as a project dependency",details:"Consider adding @lssm/app.cli-contracts to devDependencies",fix:{description:"Add CLI as a dev dependency",apply:async()=>{try{return await hb("npm install -D @lssm/app.cli-contracts",{cwd:z.workspaceRoot,timeout:60000}),{success:!0,message:"CLI added as dev dependency"}}catch(H){return{success:!1,message:`Failed to install: ${H instanceof Error?H.message:String(H)}`}}}}}}catch{return{category:"cli",name:"Local Installation",status:"skip",message:"Could not check local installation"}}}async function Di($,z){let Y=[];return Y.push(await ia0($,z)),Y.push(await na0($,z)),Y.push(await ra0($,z)),Y}async function ia0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");if(await $.exists(Y))return{category:"config",name:"Config File Exists",status:"pass",message:".contractsrc.json found"};return{category:"config",name:"Config File Exists",status:"fail",message:".contractsrc.json not found",fix:{description:"Create .contractsrc.json with defaults",apply:async()=>{try{let W=Eq({workspaceRoot:z.workspaceRoot,interactive:!1,targets:[]});return await $.writeFile(Y,f4(W)),{success:!0,message:"Created .contractsrc.json"}}catch(W){return{success:!1,message:`Failed to create: ${W instanceof Error?W.message:String(W)}`}}}}}}async function na0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");if(!await $.exists(Y))return{category:"config",name:"Config Valid JSON",status:"skip",message:"Config file does not exist"};try{let W=await $.readFile(Y);return JSON.parse(W),{category:"config",name:"Config Valid JSON",status:"pass",message:".contractsrc.json is valid JSON"}}catch(W){return{category:"config",name:"Config Valid JSON",status:"fail",message:".contractsrc.json is not valid JSON",details:W instanceof Error?W.message:String(W),fix:{description:"Replace with valid default config",apply:async()=>{try{let X=Eq({workspaceRoot:z.workspaceRoot,interactive:!1,targets:[]});return await $.writeFile(Y,f4(X)),{success:!0,message:"Replaced with valid config"}}catch(X){return{success:!1,message:`Failed: ${X instanceof Error?X.message:String(X)}`}}}}}}}async function ra0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");if(!await $.exists(Y))return{category:"config",name:"Config Fields",status:"skip",message:"Config file does not exist"};try{let W=await $.readFile(Y),Q=JSON.parse(W),X=[];if(!Q.outputDir)X.push("outputDir");if(!Q.conventions)X.push("conventions");if(X.length===0)return{category:"config",name:"Config Fields",status:"pass",message:"All recommended fields present"};return{category:"config",name:"Config Fields",status:"warn",message:`Missing recommended fields: ${X.join(", ")}`,fix:{description:"Add missing fields with defaults",apply:async()=>{try{let H=Eq({workspaceRoot:z.workspaceRoot,interactive:!1,targets:[]});for(let O of X)if(H[O]!==void 0)Q[O]=H[O];return await $.writeFile(Y,f4(Q)),{success:!0,message:"Added missing fields"}}catch(H){return{success:!1,message:`Failed: ${H instanceof Error?H.message:String(H)}`}}}}}}catch{return{category:"config",name:"Config Fields",status:"skip",message:"Could not parse config"}}}async function Vi($,z){let Y=[];return Y.push(await pa0($,z)),Y.push(await oa0($,z)),Y.push(await ta0($,z)),Y}async function pa0($,z){let Y=$.join(z.workspaceRoot,".cursor","mcp.json");if(await $.exists(Y))return{category:"mcp",name:"Cursor MCP Config",status:"pass",message:".cursor/mcp.json found"};return{category:"mcp",name:"Cursor MCP Config",status:"warn",message:".cursor/mcp.json not found",details:"MCP integration with Cursor will not work",fix:{description:"Create .cursor/mcp.json",apply:async()=>{try{let W=$.join(z.workspaceRoot,".cursor");if(!await $.exists(W))await $.mkdir(W);let Q=w2();return await $.writeFile(Y,f4(Q)),{success:!0,message:"Created .cursor/mcp.json"}}catch(W){return{success:!1,message:`Failed: ${W instanceof Error?W.message:String(W)}`}}}}}}async function oa0($,z){let Y=$.join(z.workspaceRoot,".cursor","mcp.json");if(!await $.exists(Y))return{category:"mcp",name:"MCP Server Registered",status:"skip",message:"Cursor MCP config does not exist"};try{let W=await $.readFile(Y),Q=JSON.parse(W);if(Q.mcpServers?.["contractspec-local"]!==void 0)return{category:"mcp",name:"MCP Server Registered",status:"pass",message:"ContractSpec MCP server is registered"};return{category:"mcp",name:"MCP Server Registered",status:"fail",message:"ContractSpec MCP server not registered",fix:{description:"Register ContractSpec MCP server",apply:async()=>{try{let H=w2(),O=Y7(Q,H);return await $.writeFile(Y,f4(O)),{success:!0,message:"Registered MCP server"}}catch(H){return{success:!1,message:`Failed: ${H instanceof Error?H.message:String(H)}`}}}}}}catch{return{category:"mcp",name:"MCP Server Registered",status:"skip",message:"Could not parse Cursor MCP config"}}}async function ta0($,z){let Y=gb();try{if(!await $.exists(Y))return{category:"mcp",name:"Claude Desktop MCP",status:"skip",message:"Claude Desktop config not found (optional)"};let W=await $.readFile(Y);if(JSON.parse(W).mcpServers?.["contractspec-local"]!==void 0)return{category:"mcp",name:"Claude Desktop MCP",status:"pass",message:"ContractSpec registered in Claude Desktop"};return{category:"mcp",name:"Claude Desktop MCP",status:"warn",message:"ContractSpec not registered in Claude Desktop",details:"Optional: Run setup to configure Claude Desktop"}}catch{return{category:"mcp",name:"Claude Desktop MCP",status:"skip",message:"Could not check Claude Desktop config"}}}import{exec as aa0}from"node:child_process";import{promisify as sa0}from"node:util";var jH=sa0(aa0);async function wi($,z){let Y=[];return Y.push(await ea0(z)),Y.push(await $s0(z)),Y.push(await zs0($,z)),Y.push(await Ys0($,z)),Y.push(await Ws0($,z)),Y}async function ea0($){try{let{stdout:z}=await jH("node --version",{cwd:$.workspaceRoot,timeout:5000});return{category:"deps",name:"Node.js",status:"pass",message:`Node.js ${z.trim()} available`}}catch{return{category:"deps",name:"Node.js",status:"fail",message:"Node.js not found",details:"Install Node.js from https://nodejs.org"}}}async function $s0($){try{let{stdout:z}=await jH("bun --version",{cwd:$.workspaceRoot,timeout:5000});return{category:"deps",name:"Bun Runtime",status:"pass",message:`Bun ${z.trim()} available`}}catch{return{category:"deps",name:"Bun Runtime",status:"warn",message:"Bun not found (optional but recommended)",details:"Install Bun from https://bun.sh for faster execution"}}}async function zs0($,z){let Y=[{file:"bun.lockb",name:"bun"},{file:"pnpm-lock.yaml",name:"pnpm"},{file:"yarn.lock",name:"yarn"},{file:"package-lock.json",name:"npm"}],U=null;for(let{file:W,name:Q}of Y){let X=$.join(z.workspaceRoot,W);if(await $.exists(X)){U=Q;break}}if(!U)return{category:"deps",name:"Package Manager",status:"warn",message:"No lock file found",details:"Run npm install, yarn, pnpm install, or bun install"};try{return await jH(`${U} --version`,{cwd:z.workspaceRoot,timeout:5000}),{category:"deps",name:"Package Manager",status:"pass",message:`Using ${U}`}}catch{return{category:"deps",name:"Package Manager",status:"fail",message:`${U} detected but not available`,details:`Install ${U} or use a different package manager`}}}async function Ys0($,z){let Y=$.join(z.workspaceRoot,"node_modules");if(await $.exists(Y))return{category:"deps",name:"Dependencies Installed",status:"pass",message:"node_modules directory exists"};return{category:"deps",name:"Dependencies Installed",status:"fail",message:"node_modules not found",details:"Run your package manager install command",fix:{description:"Install dependencies",apply:async()=>{try{try{return await jH("bun install",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with bun"}}catch{return await jH("npm install",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with npm"}}}catch(W){return{success:!1,message:`Failed: ${W instanceof Error?W.message:String(W)}`}}}}}}async function Ws0($,z){let Y=$.join(z.workspaceRoot,"package.json");try{let U=await $.readFile(Y),W=JSON.parse(U),Q={...W.dependencies,...W.devDependencies};if("@lssm/lib.contracts"in Q)return{category:"deps",name:"ContractSpec Library",status:"pass",message:`@lssm/lib.contracts installed (${Q["@lssm/lib.contracts"]})`};return{category:"deps",name:"ContractSpec Library",status:"fail",message:"@lssm/lib.contracts not installed",details:'Run "contractspec quickstart" to install required packages',fix:{description:"Install @lssm/lib.contracts and dependencies",apply:async()=>{try{try{return await jH("bun add @lssm/lib.contracts zod",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with bun"}}catch{return await jH("npm install @lssm/lib.contracts zod",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with npm"}}}catch(X){return{success:!1,message:`Failed: ${X instanceof Error?X.message:String(X)}`}}}}}}catch{return{category:"deps",name:"ContractSpec Library",status:"skip",message:"Could not read package.json"}}}var Us0=["src/contracts","contracts","src/specs","specs"];async function Ai($,z){let Y=[];return Y.push(Qs0(z)),Y.push(await Xs0($,z)),Y.push(await Hs0($,z)),Y.push(await Os0($,z)),Y.push(await qs0($,z)),Y}function Qs0($){if($.isMonorepo){let z=$.packageName?` in package "${$.packageName}"`:"",Y=$.packageRoot!==$.workspaceRoot?` (package root: ${$.packageRoot})`:"";return{category:"workspace",name:"Monorepo Detection",status:"pass",message:`Monorepo detected${z}`,details:$.verbose?`Workspace root: ${$.workspaceRoot}${Y}`:void 0}}return{category:"workspace",name:"Monorepo Detection",status:"pass",message:"Single project (not a monorepo)"}}async function Xs0($,z){let Y=z.isMonorepo?[z.packageRoot,z.workspaceRoot]:[z.workspaceRoot];for(let U of Y){let W=$.join(U,"package.json");if(await $.exists(W))return{category:"workspace",name:"Valid Workspace",status:"pass",message:"package.json found",details:z.verbose&&z.isMonorepo?`Found at: ${U}`:void 0}}return{category:"workspace",name:"Valid Workspace",status:"fail",message:"No package.json found",details:"This does not appear to be a Node.js/TypeScript project"}}async function Hs0($,z){let Y=z.isMonorepo?[z.packageRoot,z.workspaceRoot]:[z.workspaceRoot],U=z.isMonorepo?z.packageRoot:z.workspaceRoot;for(let X of Y)for(let H of Us0){let O=$.join(X,H);if(await $.exists(O)){let G=X===z.packageRoot?"package":"workspace";return{category:"workspace",name:"Contracts Directory",status:"pass",message:`Contracts directory found: ${H}`,details:z.isMonorepo?`Found at ${G} level`:void 0}}}let W=z.isMonorepo?"src/contracts":"src/contracts",Q=z.isMonorepo?` in package "${z.packageName??z.packageRoot}"`:"";return{category:"workspace",name:"Contracts Directory",status:"warn",message:"No contracts directory found",details:`Create ${W}/${Q} to organize your specs`,fix:{description:`Create ${W}/ directory${Q}`,apply:async()=>{try{let X=$.join(U,"src","contracts");return await $.mkdir(X),{success:!0,message:`Created ${W}/`}}catch(X){return{success:!1,message:`Failed: ${X instanceof Error?X.message:String(X)}`}}}}}}async function Os0($,z){try{let Y=["**/*.operation.ts","**/*.event.ts","**/*.presentation.ts","**/*.feature.ts"],U=z.isMonorepo?z.packageRoot:z.workspaceRoot,W=await $.glob({patterns:Y,ignore:["node_modules/**","dist/**"],cwd:U});if(W.length>0){let X=z.isMonorepo?" (in current package)":"";return{category:"workspace",name:"Contract Files",status:"pass",message:`Found ${W.length} contract file(s)${X}`,details:z.verbose?W.slice(0,5).join(", "):void 0}}return{category:"workspace",name:"Contract Files",status:"warn",message:z.isMonorepo?`No contract files found in package "${z.packageName??"current"}"`:"No contract files found",details:'Create specs using "contractspec create" or VS Code command'}}catch{return{category:"workspace",name:"Contract Files",status:"skip",message:"Could not search for contract files"}}}async function Gs0($,z){if(z.isMonorepo&&z.packageRoot!==z.workspaceRoot){let U=$.join(z.packageRoot,".contractsrc.json");if(await $.exists(U))return{path:U,root:z.packageRoot,level:"package"}}let Y=$.join(z.workspaceRoot,".contractsrc.json");if(await $.exists(Y))return{path:Y,root:z.workspaceRoot,level:"workspace"};return null}async function qs0($,z){try{let Y=await Gs0($,z);if(!Y)return{category:"workspace",name:"Output Directory",status:"skip",message:z.isMonorepo?"No config file found at package or workspace level":"No config file to check output directory"};let U=await $.readFile(Y.path),Q=JSON.parse(U).outputDir??"./src",X=$.join(Y.root,Q),H=z.isMonorepo?` (${Y.level} level)`:"";if(await $.exists(X))return{category:"workspace",name:"Output Directory",status:"pass",message:`Output directory exists: ${Q}${H}`,details:z.verbose?`Resolved to: ${X}`:void 0};return{category:"workspace",name:"Output Directory",status:"warn",message:`Output directory not found: ${Q}${H}`,details:z.verbose?`Expected at: ${X}`:void 0,fix:{description:`Create ${Q} directory`,apply:async()=>{try{return await $.mkdir(X),{success:!0,message:`Created ${Q}`}}catch(G){return{success:!1,message:`Failed: ${G instanceof Error?G.message:String(G)}`}}}}}}catch{return{category:"workspace",name:"Output Directory",status:"skip",message:"Could not check output directory"}}}async function Ii($,z,Y){let U=[],W=await Zs0($,z);if(U.push(W),W.status==="pass")U.push(await Bs0($,z,Y));return U}async function Zs0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");try{if(!await $.exists(Y))return{category:"ai",name:"AI Provider",status:"skip",message:"No config file found"};let W=await $.readFile(Y),Q=JSON.parse(W),X=Q.aiProvider??"claude",H=Q.aiModel??"default";return{category:"ai",name:"AI Provider",status:"pass",message:`Provider: ${X}, Model: ${H}`}}catch{return{category:"ai",name:"AI Provider",status:"skip",message:"Could not read AI config"}}}async function Bs0($,z,Y){let U=$.join(z.workspaceRoot,".contractsrc.json");try{let W=await $.readFile(U),X=JSON.parse(W).aiProvider??"claude",O={claude:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",ollama:"",custom:"CONTRACTSPEC_LLM_API_KEY"}[X];if(!O)return{category:"ai",name:"API Key",status:"pass",message:`${X} does not require an API key`};if(!!process.env[O])return{category:"ai",name:"API Key",status:"pass",message:`${O} is set`};return{category:"ai",name:"API Key",status:"warn",message:`${O} not set`,details:`Set ${O} in your environment to use AI features`,fix:Y?{description:`Set ${O} environment variable`,apply:async()=>{let Z=await Y.input(`Enter your ${X} API key:`,{password:!0});if(!Z)return{success:!1,message:"No API key provided"};let B=$.join(z.workspaceRoot,".env");try{let J="";if(await $.exists(B)){if(J=await $.readFile(B),J.includes(`${O}=`))return{success:!1,message:`${O} already in .env, update manually`};J+=`
|
|
3247
|
+
`}async function Oi($,z,Y){let U=z.isMonorepo&&z.scope==="package"?z.packageRoot??z.workspaceRoot:z.workspaceRoot,W=$.join(U,".contractsrc.json");try{let Q=await $.exists(W),X=Eq(z);if(Q){let H=await $.readFile(W),O=IX(H);if(!O)return{target:"cli-config",filePath:W,action:"error",message:"Existing file is not valid JSON"};if(z.interactive){if(!await Y.confirm(`${W} exists. Merge ContractSpec defaults?`))return{target:"cli-config",filePath:W,action:"skipped",message:"User skipped merge"}}let G=Y7(O,X);return await $.writeFile(W,f4(G)),{target:"cli-config",filePath:W,action:"merged",message:"Merged with existing configuration"}}return await $.writeFile(W,f4(X)),{target:"cli-config",filePath:W,action:"created",message:"Created CLI configuration"}}catch(Q){return{target:"cli-config",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}async function Gi($,z,Y){let U=z.isMonorepo&&z.scope==="package"?z.packageRoot??z.workspaceRoot:z.workspaceRoot,W=$.join(U,".vscode"),Q=$.join(W,"settings.json");try{if(!await $.exists(W))await $.mkdir(W);let H=await $.exists(Q),O=YN$();if(H){let G=await $.readFile(Q),Z=IX(G);if(!Z)return{target:"vscode-settings",filePath:Q,action:"error",message:"Existing file is not valid JSON"};if(z.interactive){if(!await Y.confirm(`${Q} exists. Add ContractSpec settings?`))return{target:"vscode-settings",filePath:Q,action:"skipped",message:"User skipped merge"}}let B=Y7(Z,O);return await $.writeFile(Q,f4(B)),{target:"vscode-settings",filePath:Q,action:"merged",message:"Added ContractSpec settings"}}return await $.writeFile(Q,f4(O)),{target:"vscode-settings",filePath:Q,action:"created",message:"Created VS Code settings"}}catch(X){return{target:"vscode-settings",filePath:Q,action:"error",message:X instanceof Error?X.message:"Unknown error"}}}async function qi($,z,Y){let U=$.join(z.workspaceRoot,".cursor"),W=$.join(U,"mcp.json");try{if(!await $.exists(U))await $.mkdir(U);let X=await $.exists(W),H=w2();if(X){let O=await $.readFile(W),G=IX(O);if(!G)return{target:"mcp-cursor",filePath:W,action:"error",message:"Existing file is not valid JSON"};if(z.interactive){if(!await Y.confirm(`${W} exists. Add ContractSpec MCP server?`))return{target:"mcp-cursor",filePath:W,action:"skipped",message:"User skipped merge"}}let Z=Y7(G,H);return await $.writeFile(W,f4(Z)),{target:"mcp-cursor",filePath:W,action:"merged",message:"Added ContractSpec MCP server"}}return await $.writeFile(W,f4(H)),{target:"mcp-cursor",filePath:W,action:"created",message:"Created Cursor MCP configuration"}}catch(Q){return{target:"mcp-cursor",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}async function Zi($,z,Y){let U=gb();try{let W=await $.exists(U),Q=WN$();if(z.interactive){if(!await Y.confirm(`Configure Claude Desktop at ${U}?`))return{target:"mcp-claude",filePath:U,action:"skipped",message:"User skipped Claude Desktop configuration"}}if(W){let O=await $.readFile(U),G=IX(O);if(!G)return{target:"mcp-claude",filePath:U,action:"error",message:"Existing file is not valid JSON"};let Z=Y7(G,Q);return await $.writeFile(U,f4(Z)),{target:"mcp-claude",filePath:U,action:"merged",message:"Added ContractSpec to Claude Desktop"}}let X=U.substring(0,U.lastIndexOf("/"));if(!await $.exists(X))await $.mkdir(X);return await $.writeFile(U,f4(Q)),{target:"mcp-claude",filePath:U,action:"created",message:"Created Claude Desktop configuration"}}catch(W){return{target:"mcp-claude",filePath:U,action:"error",message:W instanceof Error?W.message:"Unknown error"}}}async function Bi($,z,Y){let U=$.join(z.workspaceRoot,".cursor","rules"),W=$.join(U,"contractspec.mdc");try{let Q=$.join(z.workspaceRoot,".cursor");if(!await $.exists(Q))await $.mkdir(Q);if(!await $.exists(U))await $.mkdir(U);let X=await $.exists(W),H=UN$(z);if(X)if(z.interactive){if(!await Y.confirm(`${W} exists. Overwrite with latest rules?`))return{target:"cursor-rules",filePath:W,action:"skipped",message:"User kept existing rules"}}else return{target:"cursor-rules",filePath:W,action:"skipped",message:"File already exists"};return await $.writeFile(W,H),{target:"cursor-rules",filePath:W,action:X?"merged":"created",message:X?"Updated Cursor rules":"Created Cursor rules"}}catch(Q){return{target:"cursor-rules",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}async function Ji($,z,Y){let U=z.isMonorepo&&z.scope==="package"?z.packageRoot??z.workspaceRoot:z.workspaceRoot,W=$.join(U,"AGENTS.md");try{let Q=await $.exists(W),X=QN$(z);if(Q)if(z.interactive){if(!await Y.confirm(`${W} exists. Overwrite?`))return{target:"agents-md",filePath:W,action:"skipped",message:"User kept existing AGENTS.md"}}else return{target:"agents-md",filePath:W,action:"skipped",message:"File already exists"};return await $.writeFile(W,X),{target:"agents-md",filePath:W,action:Q?"merged":"created",message:Q?"Updated AGENTS.md":"Created AGENTS.md"}}catch(Q){return{target:"agents-md",filePath:W,action:"error",message:Q instanceof Error?Q.message:"Unknown error"}}}var ga0={confirm:async()=>!0,multiSelect:async($,z)=>z.filter((Y)=>Y.selected!==!1).map((Y)=>Y.value),input:async($,z)=>z??""};async function fl1($,z,Y=ga0){let U=[],W=z.targets.length>0?z.targets:Hi,Q=z.workspaceRoot,X=oO(Q),H=z.packageRoot??pO(Q),O=z.isMonorepo??pB(X),G=z.packageName??(O?oB(H):void 0),Z=z.scope??"workspace",B=H!==X;if(O&&z.interactive&&B)Z=(await Y.multiSelect("Monorepo detected. Configure at which level?",[{value:"package",label:`Package level (${G??H})`,selected:!0},{value:"workspace",label:`Workspace level (${X})`}]))[0]??"package";let J=W;if(z.interactive)J=await Y.multiSelect("Select components to configure:",Hi.map((j)=>({value:j,label:zN$[j],selected:W.includes(j)})));let K=z.projectName;if(z.interactive&&!K){let j=Z==="package"&&G?G:Q.split("/").pop()??"my-project";K=await Y.input("Project name:",j)}let D={...z,workspaceRoot:X,packageRoot:H,isMonorepo:O,scope:Z,packageName:G,projectName:K,targets:J};for(let j of J){let A=await xa0($,j,D,Y);U.push(A)}let V=U.filter((j)=>j.action!=="error").length,w=U.filter((j)=>j.action==="error").length,I=O?` (${Z} level)`:"";return{success:w===0,files:U,summary:`Setup complete${I}: ${V} configured, ${w} failed.`}}async function xa0($,z,Y,U){switch(z){case"cli-config":return Oi($,Y,U);case"vscode-settings":return Gi($,Y,U);case"mcp-cursor":return qi($,Y,U);case"mcp-claude":return Zi($,Y,U);case"cursor-rules":return Bi($,Y,U);case"agents-md":return Ji($,Y,U);default:return{target:z,filePath:"",action:"error",message:`Unknown target: ${z}`}}}var XN$=["cli","config","mcp","deps","workspace","ai"],HN$={cli:"CLI Installation",config:"Configuration Files",mcp:"MCP Server",deps:"Dependencies",workspace:"Workspace Structure",ai:"AI Provider"};import{exec as ha0}from"node:child_process";import{promisify as ma0}from"node:util";var hb=ma0(ha0);async function Ki($,z){let Y=[];return Y.push(await ca0(z)),Y.push(await la0(z)),Y.push(await da0($,z)),Y}async function ca0($){try{return await hb("npx contractspec --version",{cwd:$.workspaceRoot,timeout:1e4}),{category:"cli",name:"CLI Accessible",status:"pass",message:"ContractSpec CLI is accessible"}}catch{return{category:"cli",name:"CLI Accessible",status:"fail",message:"ContractSpec CLI is not accessible",details:'Could not run "npx contractspec --version"',fix:{description:"Install ContractSpec CLI globally",apply:async()=>{try{return await hb("npm install -g @lssm/app.cli-contractspec",{cwd:$.workspaceRoot,timeout:60000}),{success:!0,message:"CLI installed globally"}}catch(z){return{success:!1,message:`Failed to install: ${z instanceof Error?z.message:String(z)}`}}}}}}}async function la0($){try{let{stdout:z}=await hb("npx contractspec --version",{cwd:$.workspaceRoot,timeout:1e4});return{category:"cli",name:"CLI Version",status:"pass",message:`CLI version: ${z.trim()}`}}catch{return{category:"cli",name:"CLI Version",status:"skip",message:"Could not determine CLI version"}}}async function da0($,z){let Y=$.join(z.workspaceRoot,"package.json");try{if(!await $.exists(Y))return{category:"cli",name:"Local Installation",status:"skip",message:"No package.json found"};let W=await $.readFile(Y),Q=JSON.parse(W);if(Q.dependencies?.["@lssm/app.cli-contractspec"]!==void 0||Q.devDependencies?.["@lssm/app.cli-contractspec"]!==void 0)return{category:"cli",name:"Local Installation",status:"pass",message:"CLI is installed as a project dependency"};return{category:"cli",name:"Local Installation",status:"warn",message:"CLI is not installed as a project dependency",details:"Consider adding @lssm/app.cli-contractspec to devDependencies",fix:{description:"Add CLI as a dev dependency",apply:async()=>{try{return await hb("npm install -D @lssm/app.cli-contractspec",{cwd:z.workspaceRoot,timeout:60000}),{success:!0,message:"CLI added as dev dependency"}}catch(H){return{success:!1,message:`Failed to install: ${H instanceof Error?H.message:String(H)}`}}}}}}catch{return{category:"cli",name:"Local Installation",status:"skip",message:"Could not check local installation"}}}async function Di($,z){let Y=[];return Y.push(await ia0($,z)),Y.push(await na0($,z)),Y.push(await ra0($,z)),Y}async function ia0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");if(await $.exists(Y))return{category:"config",name:"Config File Exists",status:"pass",message:".contractsrc.json found"};return{category:"config",name:"Config File Exists",status:"fail",message:".contractsrc.json not found",fix:{description:"Create .contractsrc.json with defaults",apply:async()=>{try{let W=Eq({workspaceRoot:z.workspaceRoot,interactive:!1,targets:[]});return await $.writeFile(Y,f4(W)),{success:!0,message:"Created .contractsrc.json"}}catch(W){return{success:!1,message:`Failed to create: ${W instanceof Error?W.message:String(W)}`}}}}}}async function na0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");if(!await $.exists(Y))return{category:"config",name:"Config Valid JSON",status:"skip",message:"Config file does not exist"};try{let W=await $.readFile(Y);return JSON.parse(W),{category:"config",name:"Config Valid JSON",status:"pass",message:".contractsrc.json is valid JSON"}}catch(W){return{category:"config",name:"Config Valid JSON",status:"fail",message:".contractsrc.json is not valid JSON",details:W instanceof Error?W.message:String(W),fix:{description:"Replace with valid default config",apply:async()=>{try{let X=Eq({workspaceRoot:z.workspaceRoot,interactive:!1,targets:[]});return await $.writeFile(Y,f4(X)),{success:!0,message:"Replaced with valid config"}}catch(X){return{success:!1,message:`Failed: ${X instanceof Error?X.message:String(X)}`}}}}}}}async function ra0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");if(!await $.exists(Y))return{category:"config",name:"Config Fields",status:"skip",message:"Config file does not exist"};try{let W=await $.readFile(Y),Q=JSON.parse(W),X=[];if(!Q.outputDir)X.push("outputDir");if(!Q.conventions)X.push("conventions");if(X.length===0)return{category:"config",name:"Config Fields",status:"pass",message:"All recommended fields present"};return{category:"config",name:"Config Fields",status:"warn",message:`Missing recommended fields: ${X.join(", ")}`,fix:{description:"Add missing fields with defaults",apply:async()=>{try{let H=Eq({workspaceRoot:z.workspaceRoot,interactive:!1,targets:[]});for(let O of X)if(H[O]!==void 0)Q[O]=H[O];return await $.writeFile(Y,f4(Q)),{success:!0,message:"Added missing fields"}}catch(H){return{success:!1,message:`Failed: ${H instanceof Error?H.message:String(H)}`}}}}}}catch{return{category:"config",name:"Config Fields",status:"skip",message:"Could not parse config"}}}async function Vi($,z){let Y=[];return Y.push(await pa0($,z)),Y.push(await oa0($,z)),Y.push(await ta0($,z)),Y}async function pa0($,z){let Y=$.join(z.workspaceRoot,".cursor","mcp.json");if(await $.exists(Y))return{category:"mcp",name:"Cursor MCP Config",status:"pass",message:".cursor/mcp.json found"};return{category:"mcp",name:"Cursor MCP Config",status:"warn",message:".cursor/mcp.json not found",details:"MCP integration with Cursor will not work",fix:{description:"Create .cursor/mcp.json",apply:async()=>{try{let W=$.join(z.workspaceRoot,".cursor");if(!await $.exists(W))await $.mkdir(W);let Q=w2();return await $.writeFile(Y,f4(Q)),{success:!0,message:"Created .cursor/mcp.json"}}catch(W){return{success:!1,message:`Failed: ${W instanceof Error?W.message:String(W)}`}}}}}}async function oa0($,z){let Y=$.join(z.workspaceRoot,".cursor","mcp.json");if(!await $.exists(Y))return{category:"mcp",name:"MCP Server Registered",status:"skip",message:"Cursor MCP config does not exist"};try{let W=await $.readFile(Y),Q=JSON.parse(W);if(Q.mcpServers?.["contractspec-local"]!==void 0)return{category:"mcp",name:"MCP Server Registered",status:"pass",message:"ContractSpec MCP server is registered"};return{category:"mcp",name:"MCP Server Registered",status:"fail",message:"ContractSpec MCP server not registered",fix:{description:"Register ContractSpec MCP server",apply:async()=>{try{let H=w2(),O=Y7(Q,H);return await $.writeFile(Y,f4(O)),{success:!0,message:"Registered MCP server"}}catch(H){return{success:!1,message:`Failed: ${H instanceof Error?H.message:String(H)}`}}}}}}catch{return{category:"mcp",name:"MCP Server Registered",status:"skip",message:"Could not parse Cursor MCP config"}}}async function ta0($,z){let Y=gb();try{if(!await $.exists(Y))return{category:"mcp",name:"Claude Desktop MCP",status:"skip",message:"Claude Desktop config not found (optional)"};let W=await $.readFile(Y);if(JSON.parse(W).mcpServers?.["contractspec-local"]!==void 0)return{category:"mcp",name:"Claude Desktop MCP",status:"pass",message:"ContractSpec registered in Claude Desktop"};return{category:"mcp",name:"Claude Desktop MCP",status:"warn",message:"ContractSpec not registered in Claude Desktop",details:"Optional: Run setup to configure Claude Desktop"}}catch{return{category:"mcp",name:"Claude Desktop MCP",status:"skip",message:"Could not check Claude Desktop config"}}}import{exec as aa0}from"node:child_process";import{promisify as sa0}from"node:util";var jH=sa0(aa0);async function wi($,z){let Y=[];return Y.push(await ea0(z)),Y.push(await $s0(z)),Y.push(await zs0($,z)),Y.push(await Ys0($,z)),Y.push(await Ws0($,z)),Y}async function ea0($){try{let{stdout:z}=await jH("node --version",{cwd:$.workspaceRoot,timeout:5000});return{category:"deps",name:"Node.js",status:"pass",message:`Node.js ${z.trim()} available`}}catch{return{category:"deps",name:"Node.js",status:"fail",message:"Node.js not found",details:"Install Node.js from https://nodejs.org"}}}async function $s0($){try{let{stdout:z}=await jH("bun --version",{cwd:$.workspaceRoot,timeout:5000});return{category:"deps",name:"Bun Runtime",status:"pass",message:`Bun ${z.trim()} available`}}catch{return{category:"deps",name:"Bun Runtime",status:"warn",message:"Bun not found (optional but recommended)",details:"Install Bun from https://bun.sh for faster execution"}}}async function zs0($,z){let Y=[{file:"bun.lockb",name:"bun"},{file:"pnpm-lock.yaml",name:"pnpm"},{file:"yarn.lock",name:"yarn"},{file:"package-lock.json",name:"npm"}],U=null;for(let{file:W,name:Q}of Y){let X=$.join(z.workspaceRoot,W);if(await $.exists(X)){U=Q;break}}if(!U)return{category:"deps",name:"Package Manager",status:"warn",message:"No lock file found",details:"Run npm install, yarn, pnpm install, or bun install"};try{return await jH(`${U} --version`,{cwd:z.workspaceRoot,timeout:5000}),{category:"deps",name:"Package Manager",status:"pass",message:`Using ${U}`}}catch{return{category:"deps",name:"Package Manager",status:"fail",message:`${U} detected but not available`,details:`Install ${U} or use a different package manager`}}}async function Ys0($,z){let Y=$.join(z.workspaceRoot,"node_modules");if(await $.exists(Y))return{category:"deps",name:"Dependencies Installed",status:"pass",message:"node_modules directory exists"};return{category:"deps",name:"Dependencies Installed",status:"fail",message:"node_modules not found",details:"Run your package manager install command",fix:{description:"Install dependencies",apply:async()=>{try{try{return await jH("bun install",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with bun"}}catch{return await jH("npm install",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with npm"}}}catch(W){return{success:!1,message:`Failed: ${W instanceof Error?W.message:String(W)}`}}}}}}async function Ws0($,z){let Y=$.join(z.workspaceRoot,"package.json");try{let U=await $.readFile(Y),W=JSON.parse(U),Q={...W.dependencies,...W.devDependencies};if("@lssm/lib.contracts"in Q)return{category:"deps",name:"ContractSpec Library",status:"pass",message:`@lssm/lib.contracts installed (${Q["@lssm/lib.contracts"]})`};return{category:"deps",name:"ContractSpec Library",status:"fail",message:"@lssm/lib.contracts not installed",details:'Run "contractspec quickstart" to install required packages',fix:{description:"Install @lssm/lib.contracts and dependencies",apply:async()=>{try{try{return await jH("bun add @lssm/lib.contracts zod",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with bun"}}catch{return await jH("npm install @lssm/lib.contracts zod",{cwd:z.workspaceRoot,timeout:120000}),{success:!0,message:"Installed with npm"}}}catch(X){return{success:!1,message:`Failed: ${X instanceof Error?X.message:String(X)}`}}}}}}catch{return{category:"deps",name:"ContractSpec Library",status:"skip",message:"Could not read package.json"}}}var Us0=["src/contracts","contracts","src/specs","specs"];async function Ai($,z){let Y=[];return Y.push(Qs0(z)),Y.push(await Xs0($,z)),Y.push(await Hs0($,z)),Y.push(await Os0($,z)),Y.push(await qs0($,z)),Y}function Qs0($){if($.isMonorepo){let z=$.packageName?` in package "${$.packageName}"`:"",Y=$.packageRoot!==$.workspaceRoot?` (package root: ${$.packageRoot})`:"";return{category:"workspace",name:"Monorepo Detection",status:"pass",message:`Monorepo detected${z}`,details:$.verbose?`Workspace root: ${$.workspaceRoot}${Y}`:void 0}}return{category:"workspace",name:"Monorepo Detection",status:"pass",message:"Single project (not a monorepo)"}}async function Xs0($,z){let Y=z.isMonorepo?[z.packageRoot,z.workspaceRoot]:[z.workspaceRoot];for(let U of Y){let W=$.join(U,"package.json");if(await $.exists(W))return{category:"workspace",name:"Valid Workspace",status:"pass",message:"package.json found",details:z.verbose&&z.isMonorepo?`Found at: ${U}`:void 0}}return{category:"workspace",name:"Valid Workspace",status:"fail",message:"No package.json found",details:"This does not appear to be a Node.js/TypeScript project"}}async function Hs0($,z){let Y=z.isMonorepo?[z.packageRoot,z.workspaceRoot]:[z.workspaceRoot],U=z.isMonorepo?z.packageRoot:z.workspaceRoot;for(let X of Y)for(let H of Us0){let O=$.join(X,H);if(await $.exists(O)){let G=X===z.packageRoot?"package":"workspace";return{category:"workspace",name:"Contracts Directory",status:"pass",message:`Contracts directory found: ${H}`,details:z.isMonorepo?`Found at ${G} level`:void 0}}}let W=z.isMonorepo?"src/contracts":"src/contracts",Q=z.isMonorepo?` in package "${z.packageName??z.packageRoot}"`:"";return{category:"workspace",name:"Contracts Directory",status:"warn",message:"No contracts directory found",details:`Create ${W}/${Q} to organize your specs`,fix:{description:`Create ${W}/ directory${Q}`,apply:async()=>{try{let X=$.join(U,"src","contracts");return await $.mkdir(X),{success:!0,message:`Created ${W}/`}}catch(X){return{success:!1,message:`Failed: ${X instanceof Error?X.message:String(X)}`}}}}}}async function Os0($,z){try{let Y=["**/*.operation.ts","**/*.event.ts","**/*.presentation.ts","**/*.feature.ts"],U=z.isMonorepo?z.packageRoot:z.workspaceRoot,W=await $.glob({patterns:Y,ignore:["node_modules/**","dist/**"],cwd:U});if(W.length>0){let X=z.isMonorepo?" (in current package)":"";return{category:"workspace",name:"Contract Files",status:"pass",message:`Found ${W.length} contract file(s)${X}`,details:z.verbose?W.slice(0,5).join(", "):void 0}}return{category:"workspace",name:"Contract Files",status:"warn",message:z.isMonorepo?`No contract files found in package "${z.packageName??"current"}"`:"No contract files found",details:'Create specs using "contractspec create" or VS Code command'}}catch{return{category:"workspace",name:"Contract Files",status:"skip",message:"Could not search for contract files"}}}async function Gs0($,z){if(z.isMonorepo&&z.packageRoot!==z.workspaceRoot){let U=$.join(z.packageRoot,".contractsrc.json");if(await $.exists(U))return{path:U,root:z.packageRoot,level:"package"}}let Y=$.join(z.workspaceRoot,".contractsrc.json");if(await $.exists(Y))return{path:Y,root:z.workspaceRoot,level:"workspace"};return null}async function qs0($,z){try{let Y=await Gs0($,z);if(!Y)return{category:"workspace",name:"Output Directory",status:"skip",message:z.isMonorepo?"No config file found at package or workspace level":"No config file to check output directory"};let U=await $.readFile(Y.path),Q=JSON.parse(U).outputDir??"./src",X=$.join(Y.root,Q),H=z.isMonorepo?` (${Y.level} level)`:"";if(await $.exists(X))return{category:"workspace",name:"Output Directory",status:"pass",message:`Output directory exists: ${Q}${H}`,details:z.verbose?`Resolved to: ${X}`:void 0};return{category:"workspace",name:"Output Directory",status:"warn",message:`Output directory not found: ${Q}${H}`,details:z.verbose?`Expected at: ${X}`:void 0,fix:{description:`Create ${Q} directory`,apply:async()=>{try{return await $.mkdir(X),{success:!0,message:`Created ${Q}`}}catch(G){return{success:!1,message:`Failed: ${G instanceof Error?G.message:String(G)}`}}}}}}catch{return{category:"workspace",name:"Output Directory",status:"skip",message:"Could not check output directory"}}}async function Ii($,z,Y){let U=[],W=await Zs0($,z);if(U.push(W),W.status==="pass")U.push(await Bs0($,z,Y));return U}async function Zs0($,z){let Y=$.join(z.workspaceRoot,".contractsrc.json");try{if(!await $.exists(Y))return{category:"ai",name:"AI Provider",status:"skip",message:"No config file found"};let W=await $.readFile(Y),Q=JSON.parse(W),X=Q.aiProvider??"claude",H=Q.aiModel??"default";return{category:"ai",name:"AI Provider",status:"pass",message:`Provider: ${X}, Model: ${H}`}}catch{return{category:"ai",name:"AI Provider",status:"skip",message:"Could not read AI config"}}}async function Bs0($,z,Y){let U=$.join(z.workspaceRoot,".contractsrc.json");try{let W=await $.readFile(U),X=JSON.parse(W).aiProvider??"claude",O={claude:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",ollama:"",custom:"CONTRACTSPEC_LLM_API_KEY"}[X];if(!O)return{category:"ai",name:"API Key",status:"pass",message:`${X} does not require an API key`};if(!!process.env[O])return{category:"ai",name:"API Key",status:"pass",message:`${O} is set`};return{category:"ai",name:"API Key",status:"warn",message:`${O} not set`,details:`Set ${O} in your environment to use AI features`,fix:Y?{description:`Set ${O} environment variable`,apply:async()=>{let Z=await Y.input(`Enter your ${X} API key:`,{password:!0});if(!Z)return{success:!1,message:"No API key provided"};let B=$.join(z.workspaceRoot,".env");try{let J="";if(await $.exists(B)){if(J=await $.readFile(B),J.includes(`${O}=`))return{success:!1,message:`${O} already in .env, update manually`};J+=`
|
|
3248
3248
|
`}return J+=`${O}=${Z}
|
|
3249
3249
|
`,await $.writeFile(B,J),{success:!0,message:`Added ${O} to .env (restart required)`}}catch(J){return{success:!1,message:`Failed: ${J instanceof Error?J.message:String(J)}`}}}}:void 0}}catch{return{category:"ai",name:"API Key",status:"skip",message:"Could not check API key"}}}var Js0={confirm:async()=>!1,input:async()=>""};async function ON$($,z,Y=Js0){let{fs:U,logger:W}=$,Q=z.categories??XN$,X=oO(z.workspaceRoot),H=pO(z.workspaceRoot),O=pB(X),G=O?oB(H):void 0,Z={workspaceRoot:X,packageRoot:H,isMonorepo:O,packageName:G,verbose:z.verbose??!1};if(O){let w=G?` (package: ${G})`:"";W.info(`Detected monorepo${w}`)}let B=[];for(let w of Q){if(z.skipAi&&w==="ai")continue;W.info(`Checking ${HN$[w]}...`);let I=await Ks0(w,U,Z,Y);for(let j of I){if(j.fix&&(j.status==="fail"||j.status==="warn")){if(z.autoFix?!0:await Y.confirm(`Fix "${j.name}"? ${j.fix.description}`)){W.info(`Applying fix: ${j.fix.description}`);let L=await j.fix.apply();if(L.success)W.info(`✓ ${L.message}`),j.status="pass",j.message=`Fixed: ${L.message}`,j.fix=void 0;else W.warn(`✗ ${L.message}`)}}B.push(j)}}let J=B.filter((w)=>w.status==="pass").length,K=B.filter((w)=>w.status==="warn").length,D=B.filter((w)=>w.status==="fail").length,V=B.filter((w)=>w.status==="skip").length;return{checks:B,passed:J,warnings:K,failures:D,skipped:V,healthy:D===0}}async function Ks0($,z,Y,U){switch($){case"cli":return Ki(z,Y);case"config":return Di(z,Y);case"mcp":return Vi(z,Y);case"deps":return wi(z,Y);case"workspace":return Ai(z,Y);case"ai":return Ii(z,Y,U);default:return[]}}function Kd1($){let z=[];if(z.push(""),z.push("=== Health Check Summary ==="),z.push(""),$.healthy)z.push("✓ All checks passed!");else z.push("✗ Some issues found");return z.push(""),z.push(` Passed: ${$.passed}`),z.push(` Warnings: ${$.warnings}`),z.push(` Failures: ${$.failures}`),z.push(` Skipped: ${$.skipped}`),z.join(`
|
|
3250
3250
|
`)}function Dd1($){let Y=`${$.status==="pass"?"✓":$.status==="warn"?"⚠":$.status==="fail"?"✗":"○"} ${$.name}: ${$.message}`;if($.details)Y+=`
|
|
@@ -3334,7 +3334,7 @@ Match types:
|
|
|
3334
3334
|
`}function ss0($){let z=[],Y=(U,W)=>{try{let X=U?._def?.shape;if(X&&typeof X==="function"){let H=X();for(let[O,G]of Object.entries(H)){let B=G?._def?.typeName??"unknown";z.push(`- ${O}: ${String(B).replace("Zod","").toLowerCase()} (${W})`)}}}catch{z.push(`- [unable to extract ${W} fields]`)}};if($.io.input)Y($.io.input,"input");if($.io.output&&!("resourceRef"in $.io.output))Y($.io.output,"output");if(z.length===0)return"- [no schema fields could be extracted]";return z.join(`
|
|
3335
3335
|
`)}function es0($){let z=$.match(/```json\n?([\s\S]*?)\n?```/);if(z?.[1])try{let Y=JSON.parse(z[1]);return{fieldMappings:(Y.fieldMappings??[]).map((U)=>({specField:String(U.specField??""),specType:String(U.specType??"unknown"),implementationField:U.implementationField?String(U.implementationField):void 0,implementationType:U.implementationType?String(U.implementationType):void 0,match:U.match??"missing",aiConfidence:typeof U.aiConfidence==="number"?U.aiConfidence:0.5,suggestion:U.suggestion?String(U.suggestion):void 0})),intentAlignment:{score:typeof Y.intentAlignment?.score==="number"?Y.intentAlignment.score:50,issues:Array.isArray(Y.intentAlignment?.issues)?Y.intentAlignment.issues:[],suggestions:Array.isArray(Y.intentAlignment?.suggestions)?Y.intentAlignment.suggestions:[]},semanticIssues:(Y.semanticIssues??[]).map((U)=>({category:String(U.category??"semantic"),severity:U.severity??"warning",message:String(U.message??""),suggestion:U.suggestion?String(U.suggestion):void 0})),rawResponse:$}}catch{}return{fieldMappings:[],intentAlignment:{score:50,issues:["Unable to parse AI response for semantic analysis"],suggestions:[]},semanticIssues:[],rawResponse:$}}async function VN$($,z={}){let{spec:Y,implementationCode:U}=$,W=ss0(Y),Q=as0(W,U),X=await DN$(Q,z);return es0(X)}async function $e0($,z={}){let{spec:Y,implementationCode:U,implementationPath:W}=$,Q=Date.now(),X=await F2($,z),H;if(z.aiApiKey)try{H=await VN$($,z)}catch{}if(H){let O=[];for(let J of H.fieldMappings)if(J.match==="missing")O.push({severity:"error",category:"semantic",message:`Missing field: '${J.specField}' (${J.specType}) not found in implementation`,suggestion:J.suggestion??`Add field '${J.specField}' to implementation`});else if(J.match==="mismatch")O.push({severity:"warning",category:"semantic",message:`Field mismatch: '${J.specField}' has incorrect implementation as '${J.implementationField}'`,suggestion:J.suggestion});else if(J.match==="compatible"&&J.aiConfidence<0.8)O.push({severity:"info",category:"semantic",message:`Field naming: '${J.specField}' implemented as '${J.implementationField}' (compatible but not exact)`,suggestion:J.suggestion});for(let J of H.intentAlignment.issues)O.push({severity:"warning",category:"semantic",message:J});for(let J of H.semanticIssues)O.push({severity:J.severity,category:"semantic",message:J.message,suggestion:J.suggestion});X.issues=[...X.issues,...O];let G=H.fieldMappings.length,Z=H.fieldMappings.filter((J)=>J.match==="exact"||J.match==="compatible").length;if(G>0){let J=Math.round(Z/G*100);X.score=Math.round((X.score+J)/2),X.coverage.fields={total:G,implemented:Z}}if(O.some((J)=>J.severity==="error"))X.passed=!1;X.suggestions=[...X.suggestions,...H.intentAlignment.suggestions]}return X.meta={...X.meta,duration:Date.now()-Q},X}var ze0={verbose:!1},Ye0=["structure","behavior","ai_review"];class tb{config;constructor($={}){this.config={...ze0,...$}}async verify($,z,Y={}){let U=Date.now(),W=new Map,Q=[],X={spec:$,implementationCode:z},H=Y.tiers??["structure","behavior"];for(let J of Ye0){if(!H.includes(J))continue;let K;switch(J){case"structure":K=j2(X);break;case"behavior":K=pb(X);break;case"ai_review":if(this.config.aiApiKey)K=await F2(X,this.config);else K=ob(X);break;default:continue}if(W.set(J,K),Q.push(...K.issues),Y.failFast&&!K.passed)break}let O=Array.from(W.values()),G=O.every((J)=>J.passed),Z=O.length>0?Math.round(O.reduce((J,K)=>J+K.score,0)/O.length):100,B=this.generateSummary(O,Q);return{passed:G,score:Z,reports:W,allIssues:Q,summary:B,duration:Date.now()-U}}verifyStructure($,z,Y){return j2({spec:$,implementationCode:z,implementationPath:Y})}verifyBehavior($,z,Y){return pb({spec:$,implementationCode:z,implementationPath:Y})}async verifyAI($,z,Y){let U={spec:$,implementationCode:z,implementationPath:Y};if(this.config.aiApiKey)return F2(U,this.config);return ob(U)}quickVerify($,z){return j2({spec:$,implementationCode:z})}formatAsMarkdown($){let z=[];z.push("# Verification Report"),z.push(""),z.push(`**Status:** ${$.passed?"✓ Passed":"✗ Failed"}`),z.push(`**Score:** ${$.score}/100`),z.push(`**Duration:** ${$.duration}ms`),z.push("");for(let[U,W]of $.reports){if(z.push(`## ${this.formatTierName(U)}`),z.push(""),z.push(`**Status:** ${W.passed?"✓ Passed":"✗ Failed"}`),z.push(`**Score:** ${W.score}/100`),z.push(""),W.issues.length>0){z.push("### Issues"),z.push("");for(let Q of W.issues){let X=Q.severity==="error"?"❌":Q.severity==="warning"?"⚠️":"ℹ️";if(z.push(`${X} **${Q.category}**: ${Q.message}`),Q.suggestion)z.push(` - Suggestion: ${Q.suggestion}`)}z.push("")}if(W.coverage.scenarios.total>0)z.push(`**Scenarios:** ${W.coverage.scenarios.covered}/${W.coverage.scenarios.total}`);if(W.coverage.errors.total>0)z.push(`**Errors handled:** ${W.coverage.errors.handled}/${W.coverage.errors.total}`);z.push("")}let Y=Array.from($.reports.values()).flatMap((U)=>U.suggestions);if(Y.length>0){z.push("## Suggestions"),z.push("");for(let U of Y.slice(0,10))z.push(`- ${U}`);if(Y.length>10)z.push(`- ... and ${Y.length-10} more`);z.push("")}return z.join(`
|
|
3336
3336
|
`)}configure($){this.config={...this.config,...$}}generateSummary($,z){let Y=[],U=$.every((O)=>O.passed),W=$.length>0?Math.round($.reduce((O,G)=>O+G.score,0)/$.length):100;Y.push(U?"✓ Verification passed":"✗ Verification failed"),Y.push(`Score: ${W}/100`),Y.push("");for(let O of $){let G=O.passed?"✓":"✗";Y.push(`${G} ${O.tier}: ${O.score}/100`)}Y.push("");let Q=z.filter((O)=>O.severity==="error"),X=z.filter((O)=>O.severity==="warning"),H=z.filter((O)=>O.severity==="info");if(Q.length>0)Y.push(`Errors: ${Q.length}`);if(X.length>0)Y.push(`Warnings: ${X.length}`);if(H.length>0)Y.push(`Info: ${H.length}`);return Y.join(`
|
|
3337
|
-
`)}formatTierName($){switch($){case"structure":return"Tier 1: Structure";case"behavior":return"Tier 2: Behavior";case"ai_review":return"Tier 3: AI Review";default:return $}}}function We0($){return new tb($)}var Ue0=new tb;var wN$={maxEntries:1000,defaultTtlMs:86400000,structureTtlMs:604800000,behaviorTtlMs:86400000,aiTtlMs:86400000,transitiveInvalidation:!0};import{createHash as Qe0}from"crypto";function AN$($){return Qe0("sha256").update($).digest("hex")}function IN$($){let z=[`spec:${$.specHash.substring(0,16)}`,`impl:${$.implHash.substring(0,16)}`,`tier:${$.tier}`];if($.aiModelVersion)z.push(`model:${$.aiModelVersion}`);return z.join("|")}function Xe0($){try{let z=$.split("|"),Y=new Map;for(let X of z){let[H,O]=X.split(":");if(H&&O)Y.set(H,O)}let U=Y.get("spec"),W=Y.get("impl"),Q=Y.get("tier");if(!U||!W||!Q)return null;return{specHash:U,implHash:W,tier:Q,aiModelVersion:Y.get("model")}}catch{return null}}function He0($,z){switch($){case"structure":return z.structureTtlMs;case"behavior":return z.behaviorTtlMs;case"ai_review":return z.aiTtlMs;default:return z.defaultTtlMs}}class jN${storage;config;stats;constructor($,z={}){this.storage=$,this.config={...wN$,...z},this.stats={hits:0,misses:0}}createKey($,z,Y,U){return{specHash:AN$($),implHash:AN$(z),tier:Y,aiModelVersion:Y==="ai_review"?U:void 0}}async lookup($){let z=IN$($),Y=await this.storage.get(z);if(!Y)return this.stats.misses++,{hit:!1,reason:"not_found"};if(Y.meta.expiresAt){let U=new Date(Y.meta.expiresAt).getTime();if(Date.now()>U)return this.stats.misses++,await this.storage.delete(z),{hit:!1,reason:"expired"}}if(Y.key.specHash!==$.specHash)return this.stats.misses++,{hit:!1,reason:"spec_changed"};if(Y.key.implHash!==$.implHash)return this.stats.misses++,{hit:!1,reason:"impl_changed"};if($.tier==="ai_review"&&$.aiModelVersion&&Y.key.aiModelVersion!==$.aiModelVersion)return this.stats.misses++,{hit:!1,reason:"model_changed"};return this.stats.hits++,{hit:!0,entry:Y}}async store($,z,Y={}){let U=IN$($),W=He0($.tier,this.config),Q={key:$,result:z,meta:{createdAt:new Date().toISOString(),expiresAt:new Date(Date.now()+W).toISOString(),dependencies:Y.dependencies??[],specName:Y.specName,implPath:Y.implPath}};await this.storage.set(U,Q),await this.pruneIfNeeded()}async invalidateForFile($){if(!this.config.transitiveInvalidation)return 0;let z=await this.storage.keys(),Y=0;for(let U of z){let W=await this.storage.get(U);if(!W)continue;if(W.meta.dependencies.includes($))await this.storage.delete(U),Y++;if(W.meta.specName===$||W.meta.implPath===$)await this.storage.delete(U),Y++}return Y}async invalidateForSpec($){let z=await this.storage.keys(),Y=0;for(let U of z){let W=Xe0(U);if(W&&W.specHash.startsWith($.substring(0,16)))await this.storage.delete(U),Y++}return Y}async clear(){await this.storage.clear(),this.stats={hits:0,misses:0}}async getStats(){let $=await this.storage.stats?.();return{totalEntries:$?.entryCount??(await this.storage.keys()).length,hits:this.stats.hits,misses:this.stats.misses,hitRate:this.stats.hits+this.stats.misses>0?Math.round(this.stats.hits/(this.stats.hits+this.stats.misses)*100):0,memoryUsage:$?.memoryUsage}}async pruneIfNeeded(){let $=await this.storage.keys();if($.length<=this.config.maxEntries)return;let z=[];for(let U of $){let W=await this.storage.get(U);if(W)z.push({key:U,createdAt:new Date(W.meta.createdAt).getTime()})}z.sort((U,W)=>U.createdAt-W.createdAt);let Y=z.length-this.config.maxEntries;for(let U=0;U<Y;U++){let W=z[U];if(W)await this.storage.delete(W.key)}}}function Si1($,z){return new jN$($,z)}class FN${cache=new Map;async get($){return this.cache.get($)??null}async set($,z){this.cache.set($,z)}async delete($){return this.cache.delete($)}async has($){return this.cache.has($)}async keys(){return Array.from(this.cache.keys())}async clear(){this.cache.clear()}async stats(){let $=0;for(let[z,Y]of this.cache.entries())$+=z.length*2,$+=JSON.stringify(Y).length*2;return{entryCount:this.cache.size,memoryUsage:$}}}function Ti1(){return new FN$}import{existsSync as bi,mkdirSync as Oe0,readFileSync as Ge0,writeFileSync as qe0,statSync as Ze0,renameSync as Be0}from"fs";import{dirname as Je0,join as Ke0}from"path";var De0=".contractspec/verification-cache.json",LN$=1;class bN${filePath;cache;isDirty=!1;constructor($,z){let Y=z??process.cwd();this.filePath=$??Ke0(Y,De0),this.cache=new Map,this.loadSync()}loadSync(){try{if(!bi(this.filePath))return;let $=Ge0(this.filePath,"utf-8"),z=JSON.parse($);if(z.version!==LN$)return;for(let[Y,U]of Object.entries(z.entries))this.cache.set(Y,U)}catch{}}saveSync(){if(!this.isDirty)return;try{let $=Je0(this.filePath);if(!bi($))Oe0($,{recursive:!0});let z={version:LN$,entries:Object.fromEntries(this.cache.entries())},Y=`${this.filePath}.tmp`;qe0(Y,JSON.stringify(z,null,2),"utf-8"),Be0(Y,this.filePath),this.isDirty=!1}catch{}}async get($){return this.cache.get($)??null}async set($,z){this.cache.set($,z),this.isDirty=!0,this.saveSync()}async delete($){let z=this.cache.delete($);if(z)this.isDirty=!0,this.saveSync();return z}async has($){return this.cache.has($)}async keys(){return Array.from(this.cache.keys())}async clear(){this.cache.clear(),this.isDirty=!0,this.saveSync()}async stats(){let $=0;try{if(bi(this.filePath))$=Ze0(this.filePath).size}catch{}return{entryCount:this.cache.size,memoryUsage:$}}flush(){this.saveSync()}reload(){this.cache.clear(),this.loadSync(),this.isDirty=!1}}function ui1($,z){return new bN$($,z)}class MN${store;keyIndex;constructor($){this.store=$,this.keyIndex=new Set(this.loadKeyIndex())}loadKeyIndex(){try{return this.store.get("contractspec.verification-cache.__index__")??[]}catch{return[]}}async saveKeyIndex(){await this.store.update("contractspec.verification-cache.__index__",Array.from(this.keyIndex))}getStorageKey($){return`contractspec.verification-cache.${$}`}async get($){let z=this.getStorageKey($);return this.store.get(z)??null}async set($,z){let Y=this.getStorageKey($);if(await this.store.update(Y,z),!this.keyIndex.has($))this.keyIndex.add($),await this.saveKeyIndex()}async delete($){let z=this.getStorageKey($),Y=this.keyIndex.has($);if(Y)await this.store.update(z,void 0),this.keyIndex.delete($),await this.saveKeyIndex();return Y}async has($){return this.keyIndex.has($)}async keys(){return Array.from(this.keyIndex)}async clear(){for(let $ of this.keyIndex){let z=this.getStorageKey($);await this.store.update(z,void 0)}this.keyIndex.clear(),await this.saveKeyIndex()}async stats(){return{entryCount:this.keyIndex.size}}}function yi1($){return new MN$($)}var PN$=[{name:"@lssm/lib.contracts",description:"Core ContractSpec library for defining commands, queries, and events"},{name:"zod",description:"Schema validation library (peer dependency)"}],Ve0=[...PN$,{name:"@lssm/lib.schema",description:"Extended schema utilities and common types"},{name:"@lssm/app.cli-contracts",dev:!0,description:"ContractSpec CLI for validation, scaffolding, and code generation"},{name:"typescript",dev:!0,description:"TypeScript compiler for type checking"}];function Mi($){return $==="minimal"?PN$:Ve0}function Pi($){return $.filter((z)=>!z.dev)}function Ni($){return $.filter((z)=>z.dev)}import{exec as we0}from"node:child_process";import{promisify as Ae0}from"node:util";var Ie0=Ae0(we0),je0={confirm:async()=>!0,select:async($,z)=>z[0]?.value??""};async function si1($,z,Y=je0){let U=Mi(z.mode),W=Pi(U),Q=Ni(U),X=[],H=[],O=[],G=$.join(z.workspaceRoot,"package.json");if(!await $.exists(G))return{success:!1,installed:[],skipped:[],errors:[{name:"package.json",action:"error",message:"No package.json found. Run `npm init` first."}],summary:"No package.json found in workspace root."};let B=await $.readFile(G),J=JSON.parse(B),K=new Set([...Object.keys(J.dependencies??{}),...Object.keys(J.devDependencies??{})]),D=fI(z.workspaceRoot),V=W.filter((A)=>{if(K.has(A.name)&&!z.force)return H.push({name:A.name,action:"skipped",message:"Already installed",dev:!1}),!1;return!0}),w=Q.filter((A)=>{if(K.has(A.name)&&!z.force)return H.push({name:A.name,action:"skipped",message:"Already installed",dev:!0}),!1;return!0});if(z.dryRun){let A=[...V,...w];return{success:!0,installed:A.map((L)=>({name:L.name,action:"installed",message:`Would install: ${L.description}`,dev:L.dev})),skipped:H,errors:[],summary:`Dry run: would install ${A.length} package(s), skip ${H.length}.`}}if(!z.skipPrompts&&(V.length>0||w.length>0)){let A=V.length+w.length;if(!await Y.confirm(`Install ${A} package(s) using ${D}?`))return{success:!0,installed:[],skipped:[...H,...V.map((F)=>({name:F.name,action:"skipped",message:"User cancelled"})),...w.map((F)=>({name:F.name,action:"skipped",message:"User cancelled",dev:!0}))],errors:[],summary:"Installation cancelled by user."}}if(V.length>0){let A=await NN$(V,D,z.workspaceRoot,!1);for(let L of A)if(L.action==="installed")X.push(L);else O.push(L)}if(w.length>0){let A=await NN$(w,D,z.workspaceRoot,!0);for(let L of A)if(L.action==="installed")X.push(L);else O.push(L)}let I=O.length===0,j=I?`Successfully installed ${X.length} package(s), skipped ${H.length}.`:`Installed ${X.length}, skipped ${H.length}, failed ${O.length}.`;return{success:I,installed:X,skipped:H,errors:O,summary:j}}async function NN$($,z,Y,U){let W=[],Q=$.map((X)=>X.version?`${X.name}@${X.version}`:X.name);try{let H=`${gW$(z,U)} ${Q.join(" ")}`;await Ie0(H,{cwd:Y,timeout:120000});for(let O of $)W.push({name:O.name,action:"installed",message:O.description,dev:U})}catch(X){let H=X instanceof Error?X.message:String(X);for(let O of $)W.push({name:O.name,action:"error",message:`Failed to install: ${H}`,dev:U})}return W}async function ei1($,z){let Y=$.join(z,"package.json");try{let U=await $.readFile(Y),W=JSON.parse(U);return"@lssm/lib.contracts"in{...W.dependencies,...W.devDependencies}}catch{return!1}}function $n1($){let z=Mi($),Y=[];Y.push(`ContractSpec ${$} installation:`),Y.push("");let U=Pi(z);if(U.length>0){Y.push("Dependencies:");for(let Q of U)Y.push(` • ${Q.name} - ${Q.description}`)}let W=Ni(z);if(W.length>0){Y.push(""),Y.push("Dev Dependencies:");for(let Q of W)Y.push(` • ${Q.name} - ${Q.description}`)}return Y.join(`
|
|
3337
|
+
`)}formatTierName($){switch($){case"structure":return"Tier 1: Structure";case"behavior":return"Tier 2: Behavior";case"ai_review":return"Tier 3: AI Review";default:return $}}}function We0($){return new tb($)}var Ue0=new tb;var wN$={maxEntries:1000,defaultTtlMs:86400000,structureTtlMs:604800000,behaviorTtlMs:86400000,aiTtlMs:86400000,transitiveInvalidation:!0};import{createHash as Qe0}from"crypto";function AN$($){return Qe0("sha256").update($).digest("hex")}function IN$($){let z=[`spec:${$.specHash.substring(0,16)}`,`impl:${$.implHash.substring(0,16)}`,`tier:${$.tier}`];if($.aiModelVersion)z.push(`model:${$.aiModelVersion}`);return z.join("|")}function Xe0($){try{let z=$.split("|"),Y=new Map;for(let X of z){let[H,O]=X.split(":");if(H&&O)Y.set(H,O)}let U=Y.get("spec"),W=Y.get("impl"),Q=Y.get("tier");if(!U||!W||!Q)return null;return{specHash:U,implHash:W,tier:Q,aiModelVersion:Y.get("model")}}catch{return null}}function He0($,z){switch($){case"structure":return z.structureTtlMs;case"behavior":return z.behaviorTtlMs;case"ai_review":return z.aiTtlMs;default:return z.defaultTtlMs}}class jN${storage;config;stats;constructor($,z={}){this.storage=$,this.config={...wN$,...z},this.stats={hits:0,misses:0}}createKey($,z,Y,U){return{specHash:AN$($),implHash:AN$(z),tier:Y,aiModelVersion:Y==="ai_review"?U:void 0}}async lookup($){let z=IN$($),Y=await this.storage.get(z);if(!Y)return this.stats.misses++,{hit:!1,reason:"not_found"};if(Y.meta.expiresAt){let U=new Date(Y.meta.expiresAt).getTime();if(Date.now()>U)return this.stats.misses++,await this.storage.delete(z),{hit:!1,reason:"expired"}}if(Y.key.specHash!==$.specHash)return this.stats.misses++,{hit:!1,reason:"spec_changed"};if(Y.key.implHash!==$.implHash)return this.stats.misses++,{hit:!1,reason:"impl_changed"};if($.tier==="ai_review"&&$.aiModelVersion&&Y.key.aiModelVersion!==$.aiModelVersion)return this.stats.misses++,{hit:!1,reason:"model_changed"};return this.stats.hits++,{hit:!0,entry:Y}}async store($,z,Y={}){let U=IN$($),W=He0($.tier,this.config),Q={key:$,result:z,meta:{createdAt:new Date().toISOString(),expiresAt:new Date(Date.now()+W).toISOString(),dependencies:Y.dependencies??[],specName:Y.specName,implPath:Y.implPath}};await this.storage.set(U,Q),await this.pruneIfNeeded()}async invalidateForFile($){if(!this.config.transitiveInvalidation)return 0;let z=await this.storage.keys(),Y=0;for(let U of z){let W=await this.storage.get(U);if(!W)continue;if(W.meta.dependencies.includes($))await this.storage.delete(U),Y++;if(W.meta.specName===$||W.meta.implPath===$)await this.storage.delete(U),Y++}return Y}async invalidateForSpec($){let z=await this.storage.keys(),Y=0;for(let U of z){let W=Xe0(U);if(W&&W.specHash.startsWith($.substring(0,16)))await this.storage.delete(U),Y++}return Y}async clear(){await this.storage.clear(),this.stats={hits:0,misses:0}}async getStats(){let $=await this.storage.stats?.();return{totalEntries:$?.entryCount??(await this.storage.keys()).length,hits:this.stats.hits,misses:this.stats.misses,hitRate:this.stats.hits+this.stats.misses>0?Math.round(this.stats.hits/(this.stats.hits+this.stats.misses)*100):0,memoryUsage:$?.memoryUsage}}async pruneIfNeeded(){let $=await this.storage.keys();if($.length<=this.config.maxEntries)return;let z=[];for(let U of $){let W=await this.storage.get(U);if(W)z.push({key:U,createdAt:new Date(W.meta.createdAt).getTime()})}z.sort((U,W)=>U.createdAt-W.createdAt);let Y=z.length-this.config.maxEntries;for(let U=0;U<Y;U++){let W=z[U];if(W)await this.storage.delete(W.key)}}}function Si1($,z){return new jN$($,z)}class FN${cache=new Map;async get($){return this.cache.get($)??null}async set($,z){this.cache.set($,z)}async delete($){return this.cache.delete($)}async has($){return this.cache.has($)}async keys(){return Array.from(this.cache.keys())}async clear(){this.cache.clear()}async stats(){let $=0;for(let[z,Y]of this.cache.entries())$+=z.length*2,$+=JSON.stringify(Y).length*2;return{entryCount:this.cache.size,memoryUsage:$}}}function Ti1(){return new FN$}import{existsSync as bi,mkdirSync as Oe0,readFileSync as Ge0,writeFileSync as qe0,statSync as Ze0,renameSync as Be0}from"fs";import{dirname as Je0,join as Ke0}from"path";var De0=".contractspec/verification-cache.json",LN$=1;class bN${filePath;cache;isDirty=!1;constructor($,z){let Y=z??process.cwd();this.filePath=$??Ke0(Y,De0),this.cache=new Map,this.loadSync()}loadSync(){try{if(!bi(this.filePath))return;let $=Ge0(this.filePath,"utf-8"),z=JSON.parse($);if(z.version!==LN$)return;for(let[Y,U]of Object.entries(z.entries))this.cache.set(Y,U)}catch{}}saveSync(){if(!this.isDirty)return;try{let $=Je0(this.filePath);if(!bi($))Oe0($,{recursive:!0});let z={version:LN$,entries:Object.fromEntries(this.cache.entries())},Y=`${this.filePath}.tmp`;qe0(Y,JSON.stringify(z,null,2),"utf-8"),Be0(Y,this.filePath),this.isDirty=!1}catch{}}async get($){return this.cache.get($)??null}async set($,z){this.cache.set($,z),this.isDirty=!0,this.saveSync()}async delete($){let z=this.cache.delete($);if(z)this.isDirty=!0,this.saveSync();return z}async has($){return this.cache.has($)}async keys(){return Array.from(this.cache.keys())}async clear(){this.cache.clear(),this.isDirty=!0,this.saveSync()}async stats(){let $=0;try{if(bi(this.filePath))$=Ze0(this.filePath).size}catch{}return{entryCount:this.cache.size,memoryUsage:$}}flush(){this.saveSync()}reload(){this.cache.clear(),this.loadSync(),this.isDirty=!1}}function ui1($,z){return new bN$($,z)}class MN${store;keyIndex;constructor($){this.store=$,this.keyIndex=new Set(this.loadKeyIndex())}loadKeyIndex(){try{return this.store.get("contractspec.verification-cache.__index__")??[]}catch{return[]}}async saveKeyIndex(){await this.store.update("contractspec.verification-cache.__index__",Array.from(this.keyIndex))}getStorageKey($){return`contractspec.verification-cache.${$}`}async get($){let z=this.getStorageKey($);return this.store.get(z)??null}async set($,z){let Y=this.getStorageKey($);if(await this.store.update(Y,z),!this.keyIndex.has($))this.keyIndex.add($),await this.saveKeyIndex()}async delete($){let z=this.getStorageKey($),Y=this.keyIndex.has($);if(Y)await this.store.update(z,void 0),this.keyIndex.delete($),await this.saveKeyIndex();return Y}async has($){return this.keyIndex.has($)}async keys(){return Array.from(this.keyIndex)}async clear(){for(let $ of this.keyIndex){let z=this.getStorageKey($);await this.store.update(z,void 0)}this.keyIndex.clear(),await this.saveKeyIndex()}async stats(){return{entryCount:this.keyIndex.size}}}function yi1($){return new MN$($)}var PN$=[{name:"@lssm/lib.contracts",description:"Core ContractSpec library for defining commands, queries, and events"},{name:"zod",description:"Schema validation library (peer dependency)"}],Ve0=[...PN$,{name:"@lssm/lib.schema",description:"Extended schema utilities and common types"},{name:"@lssm/app.cli-contractspec",dev:!0,description:"ContractSpec CLI for validation, scaffolding, and code generation"},{name:"typescript",dev:!0,description:"TypeScript compiler for type checking"}];function Mi($){return $==="minimal"?PN$:Ve0}function Pi($){return $.filter((z)=>!z.dev)}function Ni($){return $.filter((z)=>z.dev)}import{exec as we0}from"node:child_process";import{promisify as Ae0}from"node:util";var Ie0=Ae0(we0),je0={confirm:async()=>!0,select:async($,z)=>z[0]?.value??""};async function si1($,z,Y=je0){let U=Mi(z.mode),W=Pi(U),Q=Ni(U),X=[],H=[],O=[],G=$.join(z.workspaceRoot,"package.json");if(!await $.exists(G))return{success:!1,installed:[],skipped:[],errors:[{name:"package.json",action:"error",message:"No package.json found. Run `npm init` first."}],summary:"No package.json found in workspace root."};let B=await $.readFile(G),J=JSON.parse(B),K=new Set([...Object.keys(J.dependencies??{}),...Object.keys(J.devDependencies??{})]),D=fI(z.workspaceRoot),V=W.filter((A)=>{if(K.has(A.name)&&!z.force)return H.push({name:A.name,action:"skipped",message:"Already installed",dev:!1}),!1;return!0}),w=Q.filter((A)=>{if(K.has(A.name)&&!z.force)return H.push({name:A.name,action:"skipped",message:"Already installed",dev:!0}),!1;return!0});if(z.dryRun){let A=[...V,...w];return{success:!0,installed:A.map((L)=>({name:L.name,action:"installed",message:`Would install: ${L.description}`,dev:L.dev})),skipped:H,errors:[],summary:`Dry run: would install ${A.length} package(s), skip ${H.length}.`}}if(!z.skipPrompts&&(V.length>0||w.length>0)){let A=V.length+w.length;if(!await Y.confirm(`Install ${A} package(s) using ${D}?`))return{success:!0,installed:[],skipped:[...H,...V.map((F)=>({name:F.name,action:"skipped",message:"User cancelled"})),...w.map((F)=>({name:F.name,action:"skipped",message:"User cancelled",dev:!0}))],errors:[],summary:"Installation cancelled by user."}}if(V.length>0){let A=await NN$(V,D,z.workspaceRoot,!1);for(let L of A)if(L.action==="installed")X.push(L);else O.push(L)}if(w.length>0){let A=await NN$(w,D,z.workspaceRoot,!0);for(let L of A)if(L.action==="installed")X.push(L);else O.push(L)}let I=O.length===0,j=I?`Successfully installed ${X.length} package(s), skipped ${H.length}.`:`Installed ${X.length}, skipped ${H.length}, failed ${O.length}.`;return{success:I,installed:X,skipped:H,errors:O,summary:j}}async function NN$($,z,Y,U){let W=[],Q=$.map((X)=>X.version?`${X.name}@${X.version}`:X.name);try{let H=`${gW$(z,U)} ${Q.join(" ")}`;await Ie0(H,{cwd:Y,timeout:120000});for(let O of $)W.push({name:O.name,action:"installed",message:O.description,dev:U})}catch(X){let H=X instanceof Error?X.message:String(X);for(let O of $)W.push({name:O.name,action:"error",message:`Failed to install: ${H}`,dev:U})}return W}async function ei1($,z){let Y=$.join(z,"package.json");try{let U=await $.readFile(Y),W=JSON.parse(U);return"@lssm/lib.contracts"in{...W.dependencies,...W.devDependencies}}catch{return!1}}function $n1($){let z=Mi($),Y=[];Y.push(`ContractSpec ${$} installation:`),Y.push("");let U=Pi(z);if(U.length>0){Y.push("Dependencies:");for(let Q of U)Y.push(` • ${Q.name} - ${Q.description}`)}let W=Ni(z);if(W.length>0){Y.push(""),Y.push("Dev Dependencies:");for(let Q of W)Y.push(` • ${Q.name} - ${Q.description}`)}return Y.join(`
|
|
3338
3338
|
`)}var TN$={};R4(TN$,{sarifToJson:()=>Pe0,formatAsTextLines:()=>CN$,formatAsText:()=>Ee0,formatAsSarif:()=>Le0,formatAsJsonFull:()=>SN$,formatAsJsonCompact:()=>RN$,formatAsJson:()=>Ne0});var Fe0={"spec-structure-error":{name:"Spec Structure Error",description:"Contract specification is missing required structure elements"},"spec-structure-warning":{name:"Spec Structure Warning",description:"Contract specification has recommended but missing elements"},"integrity-orphaned":{name:"Orphaned Spec",description:"Contract specification is not linked to any feature"},"integrity-unresolved-ref":{name:"Unresolved Reference",description:"Contract specification references a non-existent spec"},"integrity-missing-feature":{name:"Missing Feature",description:"Feature referenced by spec does not exist"},"integrity-broken-link":{name:"Broken Link",description:"Link between specs is broken"},"deps-circular":{name:"Circular Dependency",description:"Circular dependency detected between contracts"},"deps-missing":{name:"Missing Dependency",description:"Contract depends on a non-existent contract"},"handler-missing":{name:"Missing Handler",description:"Handler implementation file does not exist for this contract"},"handler-warning":{name:"Handler Warning",description:"Handler implementation has potential issues"},"test-missing":{name:"Missing Test",description:"Test file does not exist for this contract"},"test-warning":{name:"Test Warning",description:"Test implementation has potential issues"}};function Le0($,z={}){let{toolName:Y="ContractSpec",toolVersion:U="1.0.0",toolUri:W="https://contractspec.dev",repositoryUri:Q,workingDirectory:X}=z,H=new Map,O=new Map;for(let J of $.issues)if(!H.has(J.ruleId)){let K=Fe0[J.ruleId]??{name:J.ruleId,description:`Rule: ${J.ruleId}`},D={id:J.ruleId,name:K.name,shortDescription:{text:K.description},defaultConfiguration:{level:EN$(J.severity)}};if(K.helpUri)D.helpUri=K.helpUri;O.set(J.ruleId,H.size),H.set(J.ruleId,D)}let G=$.issues.map((J)=>{let K={ruleId:J.ruleId,ruleIndex:O.get(J.ruleId)??0,level:EN$(J.severity),message:{text:J.message}};if(J.file){let D={physicalLocation:{artifactLocation:{uri:be0(J.file),uriBaseId:"%SRCROOT%"}}};if(J.line!==void 0)D.physicalLocation.region={startLine:J.line,startColumn:J.column??1,endLine:J.endLine??J.line,endColumn:J.endColumn};K.locations=[D]}return K.partialFingerprints={primaryLocationLineHash:Me0(J)},K}),Z=[];if(Q||$.commitSha||$.branch)Z.push({repositoryUri:Q,revisionId:$.commitSha,branch:$.branch});let B={tool:{driver:{name:Y,version:U,informationUri:W,rules:Array.from(H.values())}},results:G,invocations:[{executionSuccessful:$.success,endTimeUtc:$.timestamp,...X&&{workingDirectory:{uri:X}}}]};if(Z.length>0)B.versionControlProvenance=Z;return{$schema:"https://json.schemastore.org/sarif-2.1.0.json",version:"2.1.0",runs:[B]}}function EN$($){switch($){case"error":return"error";case"warning":return"warning";case"note":return"note";default:return"warning"}}function be0($){return $.replace(/^\.\//,"").replace(/\\/g,"/")}function Me0($){let z=[$.ruleId,$.file??"",$.message];return Buffer.from(z.join("|")).toString("base64").slice(0,16)}function Pe0($){return JSON.stringify($,null,2)}function RN$($){return{success:$.success,errors:$.totalErrors,warnings:$.totalWarnings,duration:$.durationMs,timestamp:$.timestamp,commit:$.commitSha,branch:$.branch,issues:$.issues.map((z)=>({rule:z.ruleId,severity:z.severity,message:z.message,file:z.file,line:z.line}))}}function SN$($){return{success:$.success,summary:{totalErrors:$.totalErrors,totalWarnings:$.totalWarnings,totalNotes:$.totalNotes,durationMs:$.durationMs,timestamp:$.timestamp,commitSha:$.commitSha,branch:$.branch},categories:$.categories.map((z)=>({category:z.category,label:z.label,passed:z.passed,errors:z.errors,warnings:z.warnings,notes:z.notes,durationMs:z.durationMs})),issues:$.issues.map((z)=>({ruleId:z.ruleId,severity:z.severity,message:z.message,category:z.category,file:z.file,line:z.line,column:z.column,endLine:z.endLine,endColumn:z.endColumn,context:z.context}))}}function Ne0($,z={}){let{pretty:Y=!0,includeDetails:U=!0}=z,W=U?SN$($):RN$($);return Y?JSON.stringify(W,null,2):JSON.stringify(W)}function CN$($,z={}){let Y=[],{verbose:U=!1,showTiming:W=!0,groupByFile:Q=!1}=z;if(Y.push({text:"",style:"normal"}),Y.push({text:"\uD83D\uDCCB ContractSpec CI Check Results",style:"bold"}),Y.push({text:"",style:"normal"}),$.commitSha||$.branch){let H=[$.branch?`branch: ${$.branch}`:null,$.commitSha?`commit: ${$.commitSha.slice(0,7)}`:null].filter(Boolean).join(", ");Y.push({text:`Git: ${H}`,style:"muted"})}Y.push({text:"",style:"normal"}),Y.push({text:"Check Results:",style:"bold"});for(let H of $.categories){let O=H.passed?"✓":"✗",G=H.passed?"success":"error",Z=Re0(H),B=W?` (${H.durationMs}ms)`:"";Y.push({text:` ${O} ${H.label}: ${Z}${B}`,style:G})}if($.issues.length>0)if(Y.push({text:"",style:"normal"}),Y.push({text:"Issues:",style:"bold"}),Q){let H=Se0($.issues);for(let[O,G]of H){Y.push({text:"",style:"normal"}),Y.push({text:` ${O||"(no file)"}`,style:"bold",indent:1});for(let Z of G)Y.push(...ab(Z,U,2))}}else{let H=$.issues.filter((Z)=>Z.severity==="error"),O=$.issues.filter((Z)=>Z.severity==="warning"),G=$.issues.filter((Z)=>Z.severity==="note");if(H.length>0){Y.push({text:"",style:"normal"}),Y.push({text:" Errors:",style:"error",indent:1});for(let Z of H)Y.push(...ab(Z,U,2))}if(O.length>0){Y.push({text:"",style:"normal"}),Y.push({text:" Warnings:",style:"warning",indent:1});for(let Z of O)Y.push(...ab(Z,U,2))}if(G.length>0&&U){Y.push({text:"",style:"normal"}),Y.push({text:" Notes:",style:"muted",indent:1});for(let Z of G)Y.push(...ab(Z,U,2))}}Y.push({text:"",style:"normal"}),Y.push({text:"─".repeat(50),style:"muted"});let X=[$.totalErrors>0?`${$.totalErrors} error(s)`:null,$.totalWarnings>0?`${$.totalWarnings} warning(s)`:null,$.totalNotes>0&&U?`${$.totalNotes} note(s)`:null].filter(Boolean);if(X.length>0)Y.push({text:`Found: ${X.join(", ")}`,style:$.success?"warning":"error"});if(W)Y.push({text:`Duration: ${$.durationMs}ms`,style:"muted"});if(Y.push({text:"",style:"normal"}),$.success)Y.push({text:"✅ All CI checks passed!",style:"success"});else Y.push({text:"❌ CI checks failed",style:"error"});return Y.push({text:"",style:"normal"}),Y}function Ee0($,z={}){return CN$($,z).map((U)=>" ".repeat(U.indent??0)+U.text).join(`
|
|
3339
3339
|
`)}function Re0($){let z=[];if($.errors>0)z.push(`${$.errors} error(s)`);if($.warnings>0)z.push(`${$.warnings} warning(s)`);if(z.length===0)return"passed";return z.join(", ")}function ab($,z,Y){let U=[],W=$.severity==="error"?"✗":$.severity==="warning"?"⚠":"○",Q=$.severity==="error"?"error":$.severity==="warning"?"warning":"muted",X=`${W} ${$.message}`;if($.file){let H=$.line?`:${$.line}`:"";X+=` (${$.file}${H})`}if(U.push({text:X,style:Q,indent:Y}),z&&$.context){let H=JSON.stringify($.context);if(H!=="{}")U.push({text:`Context: ${H}`,style:"muted",indent:Y+1})}return U}function Se0($){let z=new Map;for(let Y of $){let U=Y.file??"";if(!z.has(U))z.set(U,[]);let W=z.get(U);if(W)W.push(Y)}return new Map([...z.entries()].sort(([Y],[U])=>Y.localeCompare(U)))}var yN$={};R4(yN$,{generateWorkflowSpec:()=>fe0,generateWorkflowRunnerTemplate:()=>N$1,generateTestTemplate:()=>M$1,generateTelemetrySpec:()=>me0,generatePresentationSpec:()=>ke0,generateOperationSpec:()=>Ce0,generateMigrationSpec:()=>xe0,generateKnowledgeSpaceSpec:()=>V$1,generateIntegrationSpec:()=>X$1,generateHandlerTemplate:()=>L$1,generateExperimentSpec:()=>de0,generateEventSpec:()=>ve0,generateDataViewSpec:()=>U$1,generateComponentTemplate:()=>b$1,generateAppBlueprintSpec:()=>pe0});function Ce0($){let{name:z,version:Y,kind:U,description:W,goal:Q,context:X,stability:H,owners:O,tags:G,auth:Z,flags:B}=$,J=Te0(z.split(".").pop()||"Unknown")+"Spec",K=J.replace("Spec","Input"),D=J.replace("Spec","Output");return`import { define${Ei(U)} } from '@lssm/lib.contracts';
|
|
3340
3340
|
import { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/bundle.contractspec-workspace",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251221164004",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,20 +28,20 @@
|
|
|
28
28
|
"@ai-sdk/mistral": "beta",
|
|
29
29
|
"@ai-sdk/openai": "beta",
|
|
30
30
|
"ollama-ai-provider": "^1.2.0",
|
|
31
|
-
"@lssm/module.contractspec-workspace": "0.0.0-canary-
|
|
32
|
-
"@lssm/lib.contracts": "0.0.0-canary-
|
|
33
|
-
"@lssm/lib.contracts-transformers": "0.0.0-canary-
|
|
34
|
-
"@lssm/lib.ai-providers": "0.0.0-canary-
|
|
35
|
-
"@lssm/lib.schema": "0.0.0-canary-
|
|
36
|
-
"@lssm/lib.testing": "0.0.0-canary-
|
|
31
|
+
"@lssm/module.contractspec-workspace": "0.0.0-canary-20251221164004",
|
|
32
|
+
"@lssm/lib.contracts": "0.0.0-canary-20251221164004",
|
|
33
|
+
"@lssm/lib.contracts-transformers": "0.0.0-canary-20251221164004",
|
|
34
|
+
"@lssm/lib.ai-providers": "0.0.0-canary-20251221164004",
|
|
35
|
+
"@lssm/lib.schema": "0.0.0-canary-20251221164004",
|
|
36
|
+
"@lssm/lib.testing": "0.0.0-canary-20251221164004",
|
|
37
37
|
"ai": "beta",
|
|
38
38
|
"zod": "^4.1.13",
|
|
39
39
|
"glob": "^13.0.0",
|
|
40
40
|
"chokidar": "^5.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@lssm/tool.tsdown": "0.0.0-canary-
|
|
44
|
-
"@lssm/tool.typescript": "0.0.0-canary-
|
|
43
|
+
"@lssm/tool.tsdown": "0.0.0-canary-20251221164004",
|
|
44
|
+
"@lssm/tool.typescript": "0.0.0-canary-20251221164004",
|
|
45
45
|
"@types/node": "^22.10.2",
|
|
46
46
|
"tsdown": "^0.18.1",
|
|
47
47
|
"typescript": "^5.9.3"
|