workspai 0.50.0 → 0.51.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.
Files changed (91) hide show
  1. package/README.md +126 -497
  2. package/contracts/create-planner-capabilities.v1.json +10 -1
  3. package/contracts/extension-cli-compatibility.v1.json +1 -1
  4. package/dist/analyze-4H33PAUB.js +1 -0
  5. package/dist/{artifact-remediation-plan-ICN3KOFG.js → artifact-remediation-plan-TQ6KTTXD.js} +1 -1
  6. package/dist/autopilot-release-BHZYM5KX.js +1 -0
  7. package/dist/chunk-3D2PAIRH.js +3 -0
  8. package/dist/{chunk-C35UXTDM.js → chunk-4WJC5QCD.js} +1 -1
  9. package/dist/{chunk-MV7KF75Q.js → chunk-6HLPTJZ3.js} +1 -1
  10. package/dist/{chunk-CV5HKU4P.js → chunk-7T4TSV5C.js} +1 -1
  11. package/dist/chunk-BBGNDMRU.js +2 -0
  12. package/dist/{chunk-VKTUWUS6.js → chunk-BG4FWJJ3.js} +1 -1
  13. package/dist/chunk-BYTFXQ6G.js +1 -0
  14. package/dist/chunk-DLM6C7FU.js +8 -0
  15. package/dist/chunk-E3CT7TYT.js +1 -0
  16. package/dist/chunk-EPVFKJF4.js +1 -0
  17. package/dist/{chunk-5EXZBCAZ.js → chunk-FKWB66NQ.js} +1 -1
  18. package/dist/{chunk-RTVRZFIJ.js → chunk-FZ76CF2W.js} +1 -1
  19. package/dist/{chunk-C3FLCDRN.js → chunk-GBAO4GSW.js} +1 -1
  20. package/dist/{chunk-AL2A7Q4X.js → chunk-GQRWRHSR.js} +31 -31
  21. package/dist/{chunk-BQGBU2Y3.js → chunk-HE4PUMU4.js} +1 -1
  22. package/dist/{chunk-KXG6E5VK.js → chunk-HMGPELXS.js} +1 -1
  23. package/dist/chunk-HSZCINFX.js +2 -0
  24. package/dist/chunk-L2E2Z4OE.js +5 -0
  25. package/dist/chunk-MAF3LLGK.js +691 -0
  26. package/dist/chunk-PS5F4DCT.js +1 -0
  27. package/dist/{chunk-LZQUZGXB.js → chunk-Q6TKQVKQ.js} +1 -1
  28. package/dist/chunk-TROHVI2V.js +2 -0
  29. package/dist/{chunk-IPJ5URDF.js → chunk-U2LR73E2.js} +1 -1
  30. package/dist/chunk-U2QL5733.js +36 -0
  31. package/dist/{chunk-DDQ3XK3H.js → chunk-VCW5HSPC.js} +2 -2
  32. package/dist/{chunk-6UTM5AJI.js → chunk-VU2BKKMB.js} +1 -1
  33. package/dist/chunk-WJVB6SSD.js +16 -0
  34. package/dist/{chunk-SS2VV3D5.js → chunk-XBM2P45G.js} +2 -2
  35. package/dist/{create-I23DC7SN.js → create-SBFBFXKN.js} +1 -1
  36. package/dist/{doctor-DOOMYLIH.js → doctor-OPCMTBJB.js} +1 -1
  37. package/dist/index.js +229 -229
  38. package/dist/{pipeline-U77HSINC.js → pipeline-7BUXAFS2.js} +1 -1
  39. package/dist/{project-test-coverage-4TEHZJFC.js → project-test-coverage-BALEHHTT.js} +1 -1
  40. package/dist/{workspace-ZEYUVR26.js → workspace-U6ZQLELX.js} +1 -1
  41. package/dist/{workspace-agent-sync-DKYJLUDP.js → workspace-agent-sync-L4SY7B4Q.js} +1 -1
  42. package/dist/workspace-context-KOBSLZTI.js +1 -0
  43. package/dist/{workspace-contract-PVLGPBBV.js → workspace-contract-SOD3OOVF.js} +1 -1
  44. package/dist/{workspace-explain-64HNKAHO.js → workspace-explain-2CTMW2YW.js} +1 -1
  45. package/dist/{workspace-feedback-RATRXFUC.js → workspace-feedback-ZZ4HPW2T.js} +1 -1
  46. package/dist/{workspace-foundation-D33LJLGT.js → workspace-foundation-PUIYBQUF.js} +1 -1
  47. package/dist/{workspace-graph-stream-THNG2T7R.js → workspace-graph-stream-BLKIC7VN.js} +1 -1
  48. package/dist/workspace-graph-token-efficiency-5FNH4JZ5.js +1 -0
  49. package/dist/{workspace-history-EWFPT74O.js → workspace-history-SPKNRHIX.js} +1 -1
  50. package/dist/{workspace-intelligence-MCNSWWDV.js → workspace-intelligence-I3ABOH2F.js} +1 -1
  51. package/dist/workspace-intelligence-runner-Q2XSR3ZL.js +1 -0
  52. package/dist/{workspace-knowledge-graph-2EYR7N56.js → workspace-knowledge-graph-5MKEI4Z5.js} +1 -1
  53. package/dist/{workspace-knowledge-graph-query-VOSPPH4W.js → workspace-knowledge-graph-query-EKHIE3E2.js} +1 -1
  54. package/dist/{workspace-mcp-serve-FLAVKWYW.js → workspace-mcp-serve-ETNUA72W.js} +1 -1
  55. package/dist/{workspace-model-FMFYLHE4.js → workspace-model-HHA37SNH.js} +1 -1
  56. package/dist/{workspace-onboarding-MYROZDI2.js → workspace-onboarding-ELHZABJE.js} +1 -1
  57. package/dist/workspace-readme-HGGZ4AZB.js +77 -0
  58. package/dist/{workspace-registry-summary-6VXIAQLX.js → workspace-registry-summary-D2QM5JF6.js} +1 -1
  59. package/dist/workspace-run-DAAZBCN7.js +1 -0
  60. package/dist/{workspace-verify-FKYI65UQ.js → workspace-verify-4WJTLXRA.js} +1 -1
  61. package/dist/{workspace-watch-RP5KMVP2.js → workspace-watch-2PIFTQ6B.js} +1 -1
  62. package/docs/README_CONTENT_CONTRACT.md +98 -124
  63. package/docs/ci-workflows.md +13 -4
  64. package/docs/commands-reference.md +4 -2
  65. package/docs/workspace-knowledge-graph.md +39 -0
  66. package/docs/workspace-operations.md +9 -6
  67. package/package.json +6 -3
  68. package/scripts/enterprise-package-smoke.mjs +11 -0
  69. package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
  70. package/templates/kits/fastapi-standard/README.md.j2 +1 -1
  71. package/templates/kits/nestjs-standard/Dockerfile.j2 +1 -1
  72. package/templates/kits/nestjs-standard/README.md.j2 +1 -1
  73. package/templates/kits/nestjs-standard/package.json.j2 +11 -2
  74. package/dist/analyze-ZFQWTCJQ.js +0 -1
  75. package/dist/autopilot-release-VKXQ7BS7.js +0 -1
  76. package/dist/chunk-2AXEGYPL.js +0 -1
  77. package/dist/chunk-GNQRYISX.js +0 -5
  78. package/dist/chunk-I42F552T.js +0 -2
  79. package/dist/chunk-IDQKVJUF.js +0 -2
  80. package/dist/chunk-JFUD73OZ.js +0 -933
  81. package/dist/chunk-KKAOTTYO.js +0 -8
  82. package/dist/chunk-KMLPHFLD.js +0 -2
  83. package/dist/chunk-L2YK5RV2.js +0 -1
  84. package/dist/chunk-LAJM2SBP.js +0 -15
  85. package/dist/chunk-UETZ7USY.js +0 -36
  86. package/dist/chunk-WDKNMTJQ.js +0 -1
  87. package/dist/chunk-YPKNQCLK.js +0 -2
  88. package/dist/workspace-context-IHUFMZT3.js +0 -1
  89. package/dist/workspace-graph-token-efficiency-CFGFCJ5V.js +0 -1
  90. package/dist/workspace-intelligence-runner-TG2VLHNZ.js +0 -1
  91. package/dist/workspace-run-2ZI5UMJ2.js +0 -1
@@ -1,2 +0,0 @@
1
- import {a,c,i as i$1,g as g$1,h as h$1}from'./chunk-GNQRYISX.js';import {t,u as u$1}from'./chunk-MOSXTVPU.js';import T from'fs';import i from'path';import C from'fs-extra';var V=[{id:"fastapi.standard",aliases:["fastapi","fastapi.standard"],label:"fastapi \u2014 FastAPI Standard Kit",description:"Core-backed FastAPI service scaffold.",owner:"core",runtime:"python",framework:"fastapi",category:"backend",moduleSupport:true,stability:"stable",versionPolicy:"tested-baseline"},{id:"fastapi.ddd",aliases:["fastapi.ddd","fastapi-ddd"],label:"fastapi \u2014 FastAPI DDD Kit",description:"Core-backed FastAPI DDD service scaffold.",owner:"core",runtime:"python",framework:"fastapi",category:"backend",moduleSupport:true,stability:"stable",versionPolicy:"tested-baseline"},{id:"nestjs.standard",aliases:["nestjs","nest","nestjs.standard"],label:"nestjs \u2014 NestJS Standard Kit",description:"Core-backed NestJS service scaffold.",owner:"core",runtime:"node",framework:"nestjs",category:"backend",moduleSupport:true,stability:"stable",versionPolicy:"tested-baseline"},{id:"springboot.standard",aliases:["spring","springboot","springboot.standard","java"],label:"spring \u2014 Spring Boot Standard Kit",description:"npm-backed Spring Boot service scaffold.",owner:"npm",runtime:"java",framework:"springboot",category:"backend",moduleSupport:false,stability:"stable",versionPolicy:"tested-baseline",generator:"springboot",createUsage:"workspai create project springboot.standard <name> [--java-version <major>] [--spring-boot-version <semver>] [--group-id <com.example>] [--package-name <com.example.app>] [--port <number>]"},{id:"gofiber.standard",aliases:["go","go.standard","fiber","gofiber","gofiber.standard","go/fiber"],label:"go/fiber \u2014 Go Fiber Standard Kit",description:"npm-backed Go Fiber service scaffold.",owner:"npm",runtime:"go",framework:"gofiber",category:"backend",moduleSupport:false,stability:"stable",versionPolicy:"tested-baseline",generator:"gofiber",createUsage:"workspai create project gofiber.standard <name> [--output <dir>]"},{id:"gogin.standard",aliases:["gin","gogin","gogin.standard","go/gin"],label:"go/gin \u2014 Go Gin Standard Kit",description:"npm-backed Go Gin service scaffold.",owner:"npm",runtime:"go",framework:"gogin",category:"backend",moduleSupport:false,stability:"stable",versionPolicy:"tested-baseline",generator:"gogin",createUsage:"workspai create project gogin.standard <name> [--output <dir>]"},{id:"dotnet.webapi.clean",aliases:["dotnet","dotnet.webapi","dotnet.webapi.clean","aspnet","aspnetcore","asp.net","asp.net-core","csharp","c#"],label:"dotnet \u2014 ASP.NET Core Clean Web API",description:"npm-backed ASP.NET Core Web API with clean architecture boundaries.",owner:"npm",runtime:"dotnet",framework:"dotnet",category:"backend",moduleSupport:false,stability:"preview",versionPolicy:"tested-baseline",generator:"dotnet-webapi-clean",createUsage:"workspai create project dotnet.webapi.clean <name> [--target-framework net8.0] [--root-namespace <Company.Product>] [--port <number>]"},{id:"rust.axum",aliases:["rust.axum","axum","rust-axum"],label:"rust/axum \u2014 Rust Axum API",description:"Workspai-owned Axum service with health, tests, CI, and container baseline.",owner:"npm",runtime:"rust",framework:"axum",category:"backend",moduleSupport:false,stability:"preview",versionPolicy:"tested-baseline",generator:"rust-axum",createUsage:"workspai create project rust.axum <name> [--port <number>] [--output <dir>] [--skip-git]"}],O=new Map;for(let e of V){O.set(e.id.toLowerCase(),e);for(let t of e.aliases)O.set(t.toLowerCase(),e);}function R(e){return e?O.get(e.trim().toLowerCase())??null:null}function ze(e){return R(e)?.id??e}function Ve(){return V.filter(e=>e.owner==="core"||e.generator)}function Xe(e){return R(e)?.owner==="npm"}async function Qe(e,t){if(!e.generator)throw new Error(`Kit is not backed by an npm generator: ${e.id}`);if(e.generator==="gofiber"){let{generateGoFiberKit:r}=await import('./gofiber-standard-AQGSC7ON.js');await r(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="gogin"){let{generateGoGinKit:r}=await import('./gogin-standard-7DU3OCBX.js');await r(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="springboot"){let{generateSpringBootKit:r}=await import('./springboot-standard-EK6GYN5T.js');await r(t.projectPath,{project_name:t.projectName,artifact_id:t.projectName,java_version:m(t.args,"--java-version")?.trim(),spring_boot_version:m(t.args,"--spring-boot-version")?.trim(),springdoc_version:m(t.args,"--springdoc-version")?.trim(),group_id:m(t.args,"--group-id")?.trim(),package_name:m(t.args,"--package-name")?.trim(),description:m(t.args,"--description")?.trim(),port:m(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="dotnet-webapi-clean"){let{generateDotnetWebApiCleanKit:r}=await import('./dotnet-webapi-clean-VXEF4SHM.js');await r(t.projectPath,{project_name:t.projectName,target_framework:m(t.args,"--target-framework")?.trim(),root_namespace:m(t.args,"--root-namespace")?.trim(),description:m(t.args,"--description")?.trim(),port:m(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="rust-axum"){let{generateRustAxumKit:r}=await import('./rust-axum-4HXDICIB.js');await r(t.projectPath,{project_name:t.projectName,description:m(t.args,"--description")?.trim(),port:m(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}throw new Error(`Unhandled npm kit generator: ${e.generator}`)}function m(e,t){let r=e.indexOf(t);if(r>=0&&r+1<e.length)return e[r+1];let n=e.find(a=>a.startsWith(`${t}=`));return n?n.slice(t.length+1):void 0}var f=["init","dev","start","build","test","lint","format","help"],X={python:{runtime:"python",displayName:"Python",tier:"first-class",scaffoldSupport:true,importSupport:true,lifecycleCommands:f,moduleCommands:true,doctorSupport:"full",notes:["Core-backed Python projects support RapidKit Core modules and lifecycle commands."]},node:{runtime:"node",displayName:"Node.js",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:f,moduleCommands:true,doctorSupport:"full",notes:["Node projects support npm-owned lifecycle commands; NestJS is the first-class Node framework."]},go:{runtime:"go",displayName:"Go",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:f,moduleCommands:false,doctorSupport:"readiness",notes:["Go projects support workspace governance and lifecycle commands via Go tooling."]},java:{runtime:"java",displayName:"Java / Spring Boot",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:f,moduleCommands:false,doctorSupport:"readiness",notes:["Java projects support Maven/Gradle lifecycle commands and workspace governance."]},dotnet:{runtime:"dotnet",displayName:".NET / ASP.NET Core",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:f,moduleCommands:false,doctorSupport:"readiness",notes:[".NET projects support dotnet CLI lifecycle commands and workspace governance."]},php:{runtime:"php",displayName:"PHP",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:f,moduleCommands:false,doctorSupport:"readiness",notes:["Laravel projects use the official Composer generator and PHP/Composer lifecycle adapter."]},ruby:{runtime:"ruby",displayName:"Ruby",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Ruby projects are importable and governed as observed projects until a kit exists."]},rust:{runtime:"rust",displayName:"Rust",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:f,moduleCommands:false,doctorSupport:"readiness",notes:["Rust projects support Axum and Tauri scaffolding plus Cargo lifecycle commands."]},elixir:{runtime:"elixir",displayName:"Elixir",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Elixir projects are importable and governed as observed projects until a kit exists."]},clojure:{runtime:"clojure",displayName:"Clojure",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Clojure projects are importable and governed as observed projects until a kit exists."]},scala:{runtime:"scala",displayName:"Scala",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Scala projects are importable and governed as observed projects until a kit exists."]},kotlin:{runtime:"kotlin",displayName:"Kotlin",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Kotlin projects are importable and governed as observed projects until a kit exists."]},deno:{runtime:"deno",displayName:"Deno",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Deno projects are importable and governed as observed projects until a kit exists."]},bun:{runtime:"bun",displayName:"Bun",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Bun projects are importable and governed as observed projects until a kit exists."]},c:{runtime:"c",displayName:"C",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["C projects are importable and receive manifest, test, quality, security, and coverage evidence without assuming a package manager."]},cpp:{runtime:"cpp",displayName:"C++",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["C++ projects are importable and receive manifest, test, quality, security, and coverage evidence without assuming a package manager."]},unknown:{runtime:"unknown",displayName:"Unknown",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Unknown projects are tracked safely but require manual command configuration."]}},fe=["fastapi","nestjs"],ge=["django","flask","nextjs","remix","nuxt","react","vite","vue","sveltekit","svelte","angular","astro","solid","express","fastify","koa","echo","gofiber","gogin","springboot","dotnet","laravel","symfony","rails","sinatra","actix","axum","rocket","phoenix","clojure","scala","kotlin","deno","bun","tauri","electron","vscode-extension","c","cpp"];function x(e){return X[e||"unknown"]??X.unknown}function Q(e){return fe.includes(e)?"first-class":ge.includes(e)?"extended":"observed"}function Z(e){let t=x(e.runtime);return {lifecycleCommands:t.lifecycleCommands,moduleCommands:e.moduleSupport&&t.moduleCommands,unsupportedLifecycleCommands:f.filter(r=>!t.lifecycleCommands.includes(r))}}var ye=["python","node","go","java","dotnet","rust","php"];function w(e){return !!e&&ye.includes(e)}function E(e,t){return t!=="lint"&&t!=="format"&&t!=="docs"?false:e==="python"}function ee(e){let t=x(e),r=w(t.runtime),n=be[t.runtime]??[],a=Ce[t.runtime]??[];return {runtime:t.runtime,displayName:t.displayName,lifecycleCommands:t.lifecycleCommands,hasExecutor:r,packageManagers:n,primaryFiles:a,notes:t.notes}}var be={python:["poetry","pip","uv"],node:["npm","pnpm","yarn","bun"],go:["go"],java:["maven","gradle"],dotnet:["dotnet"],php:["composer"],ruby:["bundle"],rust:["cargo"],elixir:["mix"],kotlin:["gradle"],deno:["deno"],bun:["bun"]},Ce={python:["pyproject.toml","requirements.txt","requirements.in"],node:["package.json"],go:["go.mod"],java:["pom.xml","build.gradle","build.gradle.kts"],dotnet:["*.csproj","*.sln"],php:["composer.json"],ruby:["Gemfile"],rust:["Cargo.toml"],elixir:["mix.exs"],kotlin:["settings.gradle.kts"],deno:["deno.json","deno.jsonc"],bun:["package.json","bunfig.toml"]};function h(e,t){let r=g$1({runtime:typeof e?.runtime=="string"?e.runtime:void 0,framework:typeof e?.framework=="string"?e.framework:void 0,kitName:typeof e?.kit_name=="string"?e.kit_name:typeof e?.kit=="string"?e.kit:void 0});return r.runtime!=="unknown"?r.runtime:i$1(t,e).runtime}function re(e){let t$1=e;for(;;){for(let n of t(t$1,"project.json"))if(T.existsSync(n))try{return JSON.parse(T.readFileSync(n,"utf8"))}catch{return null}let r=i.dirname(t$1);if(r===t$1)break;t$1=r;}return null}function pt(e,t){return h(e,t)==="go"}function lt(e,t){return h(e,t)==="node"}function dt(e,t){return h(e,t)==="java"}function ut(e,t){return h(e,t)==="dotnet"}function ft(e,t){return h(e,t)==="python"}var Se=["project.json","context.json","file-hashes.json"];async function ht(e){let t=i.resolve(e),r=[];for(let n of Se){let a=u$1(t,n);if(await C.pathExists(a))continue;let c=i.join(t,".rapidkit",n);if(!await C.pathExists(c))continue;let y=await C.readJson(c);await C.ensureDir(i.dirname(a));let k=`${a}.${process.pid}.${Date.now()}.tmp`;try{await C.writeJson(k,y,{spaces:2}),await C.move(k,a,{overwrite:false}),r.push(a);}finally{await C.remove(k).catch(()=>{});}}return r}function je(e){for(let t$1 of t(e,"context.json"))if(T.existsSync(t$1))try{return JSON.parse(T.readFileSync(t$1,"utf8"))}catch{return null}return null}function we(e){let t=e?.engine;return t==="npm"||t==="pip"||t==="python"?t:"unknown"}function xe(e,t){if(e?.module_support===false||t?.module_support===false||!e&&t)return false;let r=typeof e?.kit_name=="string"?e.kit_name:typeof e?.kit=="string"?e.kit:typeof t?.kit=="string"?t.kit:void 0,n=r?R(r):void 0;return n?.owner==="core"&&n.moduleSupport===true}function he(e,t,r){let n=g$1({runtime:typeof t?.runtime=="string"?t.runtime:typeof r?.runtime=="string"?r.runtime:void 0,framework:typeof t?.framework=="string"?t.framework:typeof r?.framework=="string"?r.framework:void 0,kitName:typeof t?.kit_name=="string"?t.kit_name:typeof t?.kit=="string"?t.kit:typeof r?.kit=="string"?r.kit:void 0});return n.key!=="unknown"?n:i$1(e,t)}function ne(e){let t$1=i.resolve(e);if(![...t(t$1,"project.json"),...t(t$1,"context.json")].some(y=>T.existsSync(y)))return null;let n=re(t$1),a=je(t$1),c=he(t$1,n,a);return {projectRoot:t$1,projectJson:n,contextJson:a,detection:c,moduleSupport:xe(n,a),engine:we(a)}}var ve=["build","dev","start","test","lint","format"],I=["init","test","build","start"],Pt=["lint","format","docs"];function Rt(e){return !!e&&ve.includes(e)}var Ne={dev:["dev","start:dev"],start:["start","start:prod","preview"],build:["build"],test:["test","test:unit","test:ci"],lint:["lint"],format:["format","prettier"]},ae={nestjs:{dev:["dev","start:dev"],start:["start","start:prod"],build:["build"],test:["test","test:e2e"],lint:["lint"],format:["format"]},express:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},fastify:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},koa:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]}};function Pe(e){let t=i.join(e,"package.json");if(!T.existsSync(t))return {};try{let n=JSON.parse(T.readFileSync(t,"utf8")).scripts??{};return Object.fromEntries(Object.entries(n).filter(a=>typeof a[1]=="string"))}catch{return {}}}function Re(e,t){let r=t?c(t):"unknown",n=r!=="unknown"?a(r,e):[],a$1=t?ae[t]?.[e]??[]:[],c$1=Ne[e]??[],y=[...n,...a$1,...c$1];return [...new Set(y)]}function ie(e,t,r){let n=Pe(e),a$1=new Set(Object.keys(n));if(a$1.has(t))return {scriptName:t,source:"package.json"};for(let c$1 of Re(t,r?.framework))if(a$1.has(c$1))return {scriptName:c$1,source:a(c(r?.framework??"unknown"),t).includes(c$1)||ae[r?.framework??""]?.[t]?.includes(c$1)?"framework-candidate":"generic-candidate"};return null}function B(e){return T.existsSync(i.join(e,"package.json"))}function se(e){let t=ee(e);return t.runtime==="unknown"&&e!=="unknown"?null:{runtime:t.runtime,displayName:t.displayName,supportedCommands:t.lifecycleCommands,packageManagers:t.packageManagers,primaryFiles:t.primaryFiles,notes:t.notes,hasExecutor:t.hasExecutor}}function s(e){try{return T.existsSync(e)}catch{return false}}function g(e){try{return s(e)?T.readFileSync(e,"utf8"):""}catch{return ""}}function u(e,t){let r=g(i.join(e,"Makefile"));return r?new RegExp(`^${t}\\s*:`).test(r):false}function Ee(e){let t=[e];for(;t.length>0;){let r=t.shift();if(!r)break;let n=[];try{n=T.readdirSync(r,{withFileTypes:true});}catch{continue}for(let a of n){if(a.name==="node_modules"||a.name===".git"||a.name==="dist")continue;let c=i.join(r,a.name);if(a.isFile()&&a.name.endsWith(".csproj"))return true;a.isDirectory()&&t.push(c);}}return false}function ce(e,t){let r=s(i.join(e,"pyproject.toml")),n=s(i.join(e,"requirements.txt"))||s(i.join(e,"requirements.in")),a=s(i.join(e,"manage.py"));switch(t){case "init":return r||n;case "dev":case "start":return r||a||n;case "test":return r||n||s(i.join(e,"tests"));case "build":return r||n;case "lint":case "format":return r||n||a||s(i.join(e,"setup.py"))||s(i.join(e,"setup.cfg"));default:return false}}function Me(e,t){if(!s(i.join(e,"go.mod")))return false;switch(t){case "init":return true;case "dev":return u(e,"run")||s(i.join(e,"main.go"));case "test":return true;case "build":return true;case "start":return u(e,"run")||s(i.join(e,"main.go"))||s(i.join(e,"cmd"));case "lint":return s(i.join(e,".golangci.yml"))||s(i.join(e,".golangci.yaml"))||u(e,"lint");case "format":return u(e,"fmt")||u(e,"format");default:return false}}function _e(e,t){let r=s(i.join(e,"pom.xml")),n=s(i.join(e,"build.gradle"))||s(i.join(e,"build.gradle.kts"));if(!r&&!n)return false;switch(t){case "init":case "test":case "build":case "dev":case "start":return true;case "lint":return u(e,"lint")||g(i.join(e,"pom.xml")).includes("checkstyle")||g(i.join(e,"build.gradle")).includes("checkstyle")||g(i.join(e,"build.gradle.kts")).includes("checkstyle");case "format":return u(e,"format")||g(i.join(e,"build.gradle")).includes("spotless")||g(i.join(e,"build.gradle.kts")).includes("spotless");default:return false}}function Ae(e,t){if(!Ee(e))return false;switch(t){case "init":case "dev":case "test":case "build":case "start":return true;case "lint":return u(e,"lint")||g(i.join(e,"Directory.Build.props")).includes("EnforceCodeStyleInBuild");case "format":return u(e,"format")||s(i.join(e,".editorconfig"));default:return false}}function Fe(e,t,r){return t==="init"?B(e):ie(e,t,{framework:r})!==null}function Le(e,t,r){switch(t){case "php":return r==="init"&&s(i.join(e,"composer.json"));case "ruby":return r==="init"&&s(i.join(e,"Gemfile"));case "rust":return s(i.join(e,"Cargo.toml"))?r==="init"||r==="test"||r==="build"||r==="start":false;case "elixir":return r==="init"&&s(i.join(e,"mix.exs"));case "deno":return s(i.join(e,"deno.json"))||s(i.join(e,"deno.jsonc"))?r==="init"||r==="dev"||r==="test"||r==="start":r==="init"&&s(i.join(e,"package.json"));case "bun":return s(i.join(e,"bunfig.toml"))||s(i.join(e,"bun.lock"))?r==="init"||r==="dev"||r==="test"||r==="build"||r==="start":r==="init"&&s(i.join(e,"package.json"));default:return false}}function De(e){try{let t=JSON.parse(g(i.join(e,"composer.json")));return new Set(Object.keys(t.scripts??{}))}catch{return new Set}}function Oe(e,t){if(!s(i.join(e,"composer.json")))return false;let r=De(e),n=s(i.join(e,"artisan"));switch(t){case "init":return true;case "dev":return n||r.has("dev");case "start":return n||r.has("start");case "test":return n||r.has("test");case "build":return r.has("build");case "lint":return r.has("lint")||r.has("analyse")||r.has("analyze");case "format":return r.has("format")||r.has("fmt")||s(i.join(e,"pint.json"))||s(i.join(e,"vendor","bin","pint"));default:return false}}function Te(e,t){return s(i.join(e,"Cargo.toml"))?t==="init"||t==="dev"||t==="start"||t==="build"||t==="test"||t==="lint"||t==="format":false}function _(e,t,r,n){if(E(t,r))return ce(e,r);if(!w(t))return Le(e,t,r);switch(t){case "node":return Fe(e,r,n);case "python":return ce(e,r);case "go":return Me(e,r);case "java":return _e(e,r);case "dotnet":return Ae(e,r);case "rust":return Te(e,r);case "php":return Oe(e,r);default:return false}}function Ie(e,t,r){return ["init","dev","start","build","test","lint","format"].filter(a=>_(e,t,a,r))}function me(e){let t=Z({runtime:e.runtime,moduleSupport:e.moduleSupport});if(!e.projectPath)return t;let r=Ie(e.projectPath,e.runtime,e.framework),n=new Set(["help"]);for(let c of r)t.lifecycleCommands.includes(c)&&n.add(c);e.runtime==="node"&&B(e.projectPath)&&n.add("init");let a=[...n].sort();return {lifecycleCommands:a,moduleCommands:t.moduleCommands,unsupportedLifecycleCommands:t.lifecycleCommands.filter(c=>!a.includes(c)).sort()}}var W=["version","commands","doctor","project","help"],A=["init","dev","start","build","test","lint","format"],$=["add","modules","upgrade","diff","merge","reconcile","rollback","uninstall","checkpoint","snapshot","optimize"],J=["create","list","info","frameworks","license"];W.filter(e=>e!=="help");function Be(e){let t$1=i.resolve(e);for(;;){if([...t(t$1,"project.json"),...t(t$1,"context.json")].some(a=>T.existsSync(a)))return t$1;let n=i.dirname(t$1);if(n===t$1)break;t$1=n;}return null}function v(e,t){return {command:e,...t}}var Ge=new Set(["dev","lint","format"]),Ue=new Set(I);function We(e,t){return t?Ue.has(e)?{executionScope:"fleet",fleetEligible:true}:Ge.has(e)?{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}}function $e(e,t){return E(t.runtime,e)?"core":"runtime"}function Je(e,t,r,n){return !e||!n.lifecycleCommands.includes(t)?false:_(e,r.runtime,t,r.key)}function qe(e,t){let r=!!e&&(t.runtime==="python"||w(t.runtime)&&_(e,t.runtime,"build",t.key));return v("docs",{owner:t.runtime==="python"?"core":"runtime",status:r?"supported":"unsupported",reason:r?t.runtime==="python"?"Documentation generation is delegated to Python Core for this project.":"Project documentation commands are available through the npm wrapper for this runtime.":"Documentation commands require a supported Python or npm-executor project manifest."})}function Ye(e){let t=i.resolve(e),r=Be(e);return r||(h$1(t).length>0?t:null)}function He(e=process.cwd()){let t=Ye(e),r=t?ne(t):null,n=r?.detection??i$1(e,r?.projectJson??null),a=r?.moduleSupport??false,c=r?.engine??"unknown",y=se(n.runtime),k=x(n.runtime),le=me({runtime:n.runtime,moduleSupport:a,projectPath:t??void 0,framework:n.key}),b={};for(let o of W)b[o]=v(o,{owner:o==="project"?"core":"npm",status:"supported",reason:o==="project"?"Project detection is a Core contract; workspace project lifecycle remains npm-owned.":o==="help"?"Help is available for every Workspai project through the npm CLI.":"Universal command available across Workspai project types."});for(let o of A){let S=Je(t,o,n,le),Y=$e(o,n),F=We(o,S);b[o]=v(o,{owner:Y,status:S?"supported":"unsupported",executionScope:F.executionScope,fleetEligible:F.fleetEligible,reason:S?Y==="core"?`Delegated to Python Core for ${n.displayName} projects.`:F.fleetEligible?`Handled by runtime adapter and eligible for workspace fleet stages (${o}).`:o==="dev"?"Local development command only; workspace fleet excludes dev by design.":n.runtime==="node"?`Handled by npm/pnpm/yarn via the resolved ${o} script in package.json.`:`Handled by the ${y?.displayName??n.displayName} runtime adapter for local project execution.`:t?n.runtime==="node"?`No ${o} script was found in package.json for this ${n.displayName} project.`:w(n.runtime)?`The ${n.displayName} runtime is tracked, but ${o} is not available from detected project manifests.`:`${n.displayName} is tracked as an observed runtime; ${o} requires project manifests or explicit scripts.`:"No Workspai project was detected."});}b.docs=qe(t,n);for(let o of $)b[o]=v(o,{owner:a?"core":"none",status:a?"supported":"unsupported",reason:a?"Core module/template command supported for this project.":`Core module/template commands are not available for ${n.displayName} projects.`});for(let o of J)b[o]=v(o,{owner:o==="create"?"npm":"core",status:"global",reason:o==="create"?"Create is orchestrated by npm for multi-language workspace support.":"Engine catalog command; not specific to the selected project runtime."});let N=Object.values(b),q=N.filter(o=>A.includes(o.command)).filter(o=>o.status==="supported"),de=I.filter(o=>q.some(S=>S.fleetEligible===true&&S.command===o)),ue=q.filter(o=>o.executionScope==="local-only").map(o=>o.command).sort();return {schemaVersion:1,scope:"project",projectRoot:t,engine:c,runtime:n.runtime,framework:n.key,frameworkDisplayName:n.displayName,frameworkConfidence:n.confidence,frameworkSupportTier:Q(n.key),runtimeSupportTier:k.tier,runtimeDoctorSupport:k.doctorSupport,moduleSupport:a,fleetStages:de,localOnlyCommands:ue,commandMap:b,supportedCommands:N.filter(o=>o.status==="supported").map(o=>o.command).sort(),unsupportedCommands:N.filter(o=>o.status==="unsupported").map(o=>o.command).sort(),globalCommands:N.filter(o=>o.status==="global").map(o=>o.command).sort()}}function cr(e,t=process.cwd()){let r=e[0];return r?He(t).commandMap[r]??null:null}function mr(e){if(e[0]==="project"&&e[1]==="commands")return true;if(e[0]==="commands"&&e.includes("--scope")){let t=e.indexOf("--scope");return e[t+1]==="project"}return e.some(t=>t==="--scope=project")&&e[0]==="commands"}function pr(e,t){return [`Workspai command not supported for this project: ${e.command}`,"",`Project: ${t.projectRoot??"not detected"}`,`Runtime: ${t.runtime}`,`Framework: ${t.frameworkDisplayName}`,`Reason: ${e.reason??"Unsupported for this project type."}`,"","Run `workspai project commands` to inspect supported commands for this project."].join(`
2
- `)}export{R as a,ze as b,Ve as c,Xe as d,Qe as e,x as f,Q as g,w as h,re as i,pt as j,lt as k,dt as l,ut as m,ft as n,ht as o,ne as p,ve as q,Pt as r,Rt as s,ie as t,me as u,Be as v,He as w,cr as x,mr as y,pr as z};
@@ -1,2 +0,0 @@
1
- import {c as c$1}from'./chunk-YPKNQCLK.js';import {p,h,i as i$1}from'./chunk-L2YK5RV2.js';import {d as d$1}from'./chunk-KMLPHFLD.js';import {e,d as d$2}from'./chunk-SS2VV3D5.js';import {b,a,i,c}from'./chunk-AHLMIL2T.js';import G from'path';import O from'fs-extra';var V="workspai-workspace-intelligence-chain-v1",z="contracts/workspace-intelligence-chain.v1.json";function T(){let e=a,t=i,s=[{id:"model",ordinal:1,phase:"understand",label:"Model",command:[...t.model.command],consumes:["workspace markers","project metadata","registry","contract","policies"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules","existing-evidence"],consumesArtifacts:[],produces:[...t.model.produces],dependsOn:[],exitPolicy:"stop-on-error",purpose:"Build the canonical current model and its structurally bound, derived Knowledge Graph."},{id:"diff",ordinal:2,phase:"change",label:"Diff",command:[...t.diff.command],consumes:[e.model,e.snapshot],inputRefs:["changes","model-baseline"],consumesArtifacts:[e.model,e.snapshot],produces:[...t.diff.produces],dependsOn:["model"],exitPolicy:"stop-on-error",purpose:"Describe structural change against the selected baseline."},{id:"impact",ordinal:3,phase:"change",label:"Impact",command:[...t.impact.command],consumes:[e.model,e.diff],inputRefs:[],consumesArtifacts:[e.model,e.diff],produces:[...t.impact.produces],dependsOn:["diff"],exitPolicy:"stop-on-error",purpose:"Calculate transitive blast radius over the workspace graph."},{id:"doctor-evidence",ordinal:4,phase:"evidence",label:"Doctor Evidence",command:[...t["doctor-evidence"].command],consumes:["workspace runtime and project health signals"],inputRefs:["projects-repositories","runtime-dependencies","existing-evidence"],consumesArtifacts:[],produces:[...t["doctor-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh health evidence after the impact artifact exists."},{id:"contract-evidence",ordinal:5,phase:"evidence",label:"Contract Evidence",command:[...t["contract-evidence"].command],consumes:[".workspai/workspace.contract.json"],inputRefs:["workspace-rules"],consumesArtifacts:[],produces:[...t["contract-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh structural contract evidence without hiding failed verdicts."},{id:"analyze-evidence",ordinal:6,phase:"evidence",label:"Analyze Evidence",command:[...t["analyze-evidence"].command],consumes:[e.model,"workspace runtime and dependency signals"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules"],consumesArtifacts:[e.model],produces:[...t["analyze-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh analysis evidence required by the release-readiness gate."},{id:"readiness-evidence",ordinal:7,phase:"evidence",label:"Readiness Evidence",command:[...t["readiness-evidence"].command],consumes:["doctor, analysis, runtime, and release signals"],inputRefs:["runtime-dependencies","existing-evidence"],consumesArtifacts:[e.doctor,e.contractVerify,e.analyze],produces:[...t["readiness-evidence"].produces],dependsOn:["doctor-evidence","contract-evidence","analyze-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh release-readiness evidence before the definitive gate."},{id:"verify",ordinal:8,phase:"gate",label:"Verify",command:[...t.verify.command],consumes:[e.impact,e.doctor,e.contractVerify,e.readiness],inputRefs:[],consumesArtifacts:[e.impact,e.doctor,e.contractVerify,e.readiness],produces:[...t.verify.produces],dependsOn:["impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Emit the definitive evidence-backed workspace gate."},{id:"context",ordinal:9,phase:"ground",label:"Agent Context",command:[...t.context.command],consumes:[e.model,e.impact,e.verify],inputRefs:[],consumesArtifacts:[e.model,e.impact,e.verify],produces:[...t.context.produces],dependsOn:["verify"],exitPolicy:"stop-on-error",purpose:"Build compact agent context from the same verified evidence."},{id:"agent-sync",ordinal:10,phase:"distribute",label:"Agent Grounding",command:[...t["agent-sync"].command],consumerArgs:{vscode:["--target","vscode"]},consumes:[e.agentContext],inputRefs:[],consumesArtifacts:[e.agentContext],produces:[...t["agent-sync"].produces],dependsOn:["context"],exitPolicy:"stop-on-error",purpose:"Distribute one context into portable agent and IDE surfaces."},{id:"explain",ordinal:11,phase:"explain",label:"Explain",command:[...t.explain.command],consumes:[e.verify,e.impact],inputRefs:[],consumesArtifacts:[e.verify,e.impact],produces:[...t.explain.produces],dependsOn:["verify"],exitPolicy:"continue-on-structured-verdict",purpose:"Translate evidence and blockers into a human and agent-readable narrative."}];return {schemaVersion:V,name:"Workspace Intelligence Chain",contractPath:z,invariant:"Every consumer must preserve step identity, dependencies, artifact flow, and verdict semantics; presentation may change, chain meaning may not.",invariants:["Missing or unreadable input is unknown or unavailable; it must not be presented as verified absence.","Freshness and provenance travel with evidence and must not be discarded by projections.","The current graph is an evidence-backed workspace knowledge graph with bounded source intelligence, not a complete cross-language symbol or call graph.","Simple and standard presentations summarize the contract; their contractRefs must preserve complete traceability.","Conditional provider outputs must be resolved through their dedicated inventory contract.","Auxiliary capabilities expose or refresh intelligence but are not mandatory execution-chain steps.","Canonical step commands are stage-pure: they must not implicitly execute a downstream chain step or regenerate an upstream artifact.","Canonical JSON artifacts must satisfy their registered schema both when produced and when consumed across CLI, MCP, IDE, and CI trust boundaries.","Schema validity is necessary but not sufficient: hashes, embedded models, summaries, counts, graph statistics, and artifact references must remain semantically coherent.","Persisted impact evidence must be rejected as stale when the current workspace model or Git observation no longer matches its embedded diff.","Canonical artifact replacement must be atomic and workspace-contained; an interrupted or denied write must preserve the last valid artifact.","Concurrent history updates must be serialized without silently dropping entries, and invalid history must never be overwritten as if it were absent.","The canonical global registry is ~/.workspai/workspaces.json; ~/.rapidkit/workspaces.json is a non-authoritative compatibility mirror for legacy consumers and must not diverge after a CLI registry mutation."],semantics:{workspace:"The governed operating boundary that relates one or more projects and repositories to shared metadata, policies, contracts, evidence, and consumers.",repository:"A source-control boundary that may contain one or more projects and may live inside or outside the workspace root.",project:"A discoverable build or runtime unit with its own path, metadata or observable manifests, command capabilities, and evidence.",evidence:"A sourced observation or generated verification result with provenance and freshness; evidence may be consumed by a later run.",artifact:"A durable generated file that another command or consumer can read without parsing terminal prose.",gate:"A structured verdict with reasons and exit semantics derived from current evidence."},workspaceLifecycle:{ingestionRoutes:[{id:"create",label:"Create",commands:["create workspace","create project"],result:"Create a workspace or supported project and write canonical Workspai metadata."},{id:"adopt",label:"Adopt",commands:["adopt"],result:"Register an existing project in place without requiring source relocation."},{id:"import",label:"Import",commands:["import","workspace import"],result:"Attach an existing project or repository path to the workspace inventory."}],durableState:[{id:"workspace-identity",paths:[".workspai-workspace",".workspai/workspace.json"],purpose:"Identify the workspace boundary, profile, and canonical root."},{id:"project-inventory",paths:[".workspai/project.json",".workspai/context.json",".workspai/adopt.json","~/.workspai/workspaces.json","~/.rapidkit/workspaces.json (legacy compatibility mirror)"],purpose:"Record native, adopted, imported, and globally registered project locations while preserving a non-authoritative mirror for legacy extension discovery."},{id:"governance",paths:[".workspai/policies.yml",".workspai/workspace.contract.json"],purpose:"Define workspace policy and explicit structural relationships."},{id:"graph-overrides",paths:[".workspai/workspace-graph.overrides.json"],purpose:"Provide explicit dependency edges that override inferred relationships."}],rule:"Create, adopt, and import are ingestion routes, not intelligence facts. Their durable state becomes observable input to Model."},runtimeRegistry:{authority:"contracts/workspace-intelligence-runtime-registry.ts",artifacts:Object.entries(a).map(([r,a])=>({id:r,path:a,schemaVersion:b[r],schemaContract:c[r]}))},executionEnvelope:{rule:"Sync and baseline resolution are deterministic execution prerequisites, not canonical intelligence stages; every run reports them separately and preserves the exact canonical stage sequence.",operations:[{id:"sync",executionPoint:"before:model",artifacts:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],failurePolicy:"stop-and-report",purpose:"Reconcile portable workspace inventory and contract inputs before modeling."},{id:"baseline",executionPoint:"after:model-before:diff",artifacts:[e.snapshot],failurePolicy:"stop-and-report",purpose:"Create an initial structural baseline when absent or reuse the existing baseline before Diff."}],report:{artifact:e.intelligenceRun,schemaVersion:b.intelligenceRun,invariant:"The report must preserve exact preflight and stage order, registry-owned artifacts, failure propagation, and aggregate status/exit semantics."}},boundaries:{inputs:[{id:"projects-repositories",label:"Projects and repositories",sources:["projects","repositories","services","modules","imported paths"],entersAt:"model"},{id:"runtime-dependencies",label:"Runtime and dependencies",sources:["runtime manifests","lockfiles","scripts","framework markers","package dependencies","bounded multi-language source observations for supported file extensions"],entersAt:"model"},{id:"workspace-rules",label:"Workspace rules",sources:["workspace markers","registry","project metadata","contracts","policies","ownership","graph overrides"],entersAt:"model"},{id:"changes",label:"Changes",sources:["repository state","git state","model baseline","workspace diff"],entersAt:"diff"},{id:"model-baseline",label:"Explicit model baseline",sources:[e.snapshot],entersAt:"diff"},{id:"existing-evidence",label:"Existing evidence",sources:["doctor reports","analysis reports","contract verification","release readiness","pipeline results","tests and runtime evidence","previous intelligence artifacts"],entersAt:"doctor-evidence"}],outputs:[{id:"understanding",label:"System understanding",artifacts:[e.model,e.knowledgeGraph,e.diff,e.impact],producedBy:["model","diff","impact"],inventory:"complete-for-chain"},{id:"governance-evidence",label:"Governance evidence",artifacts:[e.doctor,e.contractVerify,e.analyze,e.readiness,e.verify,e.history],producedBy:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify"],inventory:"complete-for-chain"},{id:"agent-grounding",label:"Agent grounding",artifacts:[e.agentContext,e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents],producedBy:["context","agent-sync"],inventory:"canonical-minimum",inventoryContract:"contracts/agent-customization-pack.v1.json"},{id:"explanations",label:"Explainable decisions",artifacts:[e.explain],producedBy:["explain"],inventory:"complete-for-chain"}],consumers:[{id:"developers",label:"Developers",channels:["CLI","reports","AGENTS.md"]},{id:"ci",label:"CI",channels:["JSON artifacts","exit codes","release gates"]},{id:"ides",label:"IDEs",channels:["synced contracts","extension","agent context"]},{id:"ai-agents",label:"AI agents",channels:["INDEX.json","context","skills","MCP"]}]},deliveryChannels:[{id:"artifacts",carries:["reports","models","context","grounding","skills"],authority:"canonical"},{id:"json-stdout",carries:["structured command results"],authority:"projection"},{id:"human-cli",carries:["summaries","diagnostics","next actions"],authority:"projection"},{id:"exit-codes",carries:["gate and command status"],authority:"projection"},{id:"watch-events",carries:["incremental workspace change events"],authority:"projection"},{id:"mcp",carries:["read-mostly access to current workspace artifacts"],authority:"projection"}],feedback:{from:["developers","ci","ides","ai-agents"],signals:["source commits","dependency updates","policy and contract edits","repairs","test and runtime results","agent action outcomes"],reentersThrough:["projects-repositories","runtime-dependencies","workspace-rules","changes","existing-evidence"],rule:"Consumer actions are not silently treated as truth. They re-enter as observable changes or evidence and must be modeled and verified again."},auxiliaryCapabilities:[{id:"graph",commands:["workspace graph emit","workspace graph explain","workspace graph entities","workspace graph evidence","workspace graph path","workspace graph search","workspace graph benchmark","workspace graph overlay","workspace graph dot","workspace graph mermaid","workspace graph jsonld","workspace graph graphml","workspace graph gexf"],reads:[e.model,e.knowledgeGraph],role:"Query the proof-backed graph derived from the canonical workspace model.",chainStep:false},{id:"evaluation",commands:["workspace eval init","workspace eval record","workspace eval status","workspace eval report","workspace eval compare"],reads:[e.evaluationLive,e.evaluationLastRun],produces:[e.evaluationLive,e.evaluationLastRun],role:"Measure model usage, activity, cost provenance, and verified outcomes without storing prompt or response bodies.",chainStep:false},{id:"watch",commands:["workspace watch"],reads:["workspace inputs",e.model],role:"Refresh the model incrementally and emit deterministic change events.",chainStep:false},{id:"mcp",commands:["workspace mcp serve"],reads:["workspace evidence artifacts"],role:"Expose read-mostly workspace evidence to compatible clients.",chainStep:false}],presentations:{simple:{layers:["inputs","intelligence","outputs","consumers"],nodes:[{id:"input-layer",kind:"inputs",label:"Input Layer",summary:"Projects \xB7 Repositories \xB7 Dependencies \xB7 Changes",contractRefs:["projects-repositories","runtime-dependencies","workspace-rules","changes","model-baseline","existing-evidence"]},{id:"workspace-intelligence",kind:"intelligence",label:"Workspace Intelligence",summary:"Model \xB7 Graph \xB7 Impact \xB7 Verify",contractRefs:s.map(r=>r.id)},{id:"agent-grounding",kind:"outputs",label:"Agent Grounding",summary:"AGENTS.md \xB7 Skills \xB7 Context",contractRefs:["agent-grounding"]},{id:"evidence-and-decisions",kind:"outputs",label:"Evidence Contracts",summary:"Reports \xB7 Artifacts \xB7 Gates",contractRefs:["understanding","governance-evidence","explanations"]},{id:"shared-consumers",kind:"consumers",label:"Shared Consumers",summary:"Developers \xB7 CI \xB7 IDEs \xB7 AI agents",contractRefs:["developers","ci","ides","ai-agents"]}],rule:"Use concrete user-facing language for first-contact explanations. Every input, output, consumer, and chain step must remain traceable through contractRefs even when details are summarized."},standard:{phases:["understand","change","evidence","gate","ground","distribute","explain"],nodes:[{id:"understand",label:"Understand",question:"What exists in the current workspace?",stepRefs:["model"]},{id:"change",label:"Change",question:"What changed, and what can it affect?",stepRefs:["diff","impact"]},{id:"evidence",label:"Evidence",question:"What health, contract, and readiness facts were observed?",stepRefs:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"]},{id:"gate",label:"Gate",question:"Is the current state acceptable and trustworthy?",stepRefs:["verify"]},{id:"ground",label:"Ground",question:"What should an agent know before acting?",stepRefs:["context"]},{id:"distribute",label:"Distribute",question:"Which durable agent and IDE surfaces receive that context?",stepRefs:["agent-sync"]},{id:"explain",label:"Explain",question:"Why did the system reach this result or verdict?",stepRefs:["explain"]}],rule:"Use for architecture education and product surfaces. Every phase must appear once and in order."},advanced:{steps:s.map(r=>r.id),requiredFields:["command","inputRefs","consumesArtifacts","produces","dependsOn","exitPolicy","purpose"],rule:"Use for implementers, adapters, IDEs, and CI. Preserve every step and its artifact and verdict semantics."}},steps:s,diagram:{direction:"TB",nodes:s.map(({id:r,label:a,phase:o})=>({id:r,label:a,phase:o})),edges:s.flatMap(r=>r.dependsOn.map(a=>({from:a,to:r.id,meaning:"required before"})))},consumers:{agents:{canonicalReadOrder:[e.agentIndex,e.agentContext,e.verify,e.impact,e.explain,e.model,e.knowledgeGraph,e.agentCustomizationPack,e.skillsIndex],entrypoints:[e.agents,".workspai/AGENT-GROUNDING.md"],rule:"Agents must cite current artifacts, preserve verified versus inferred status, and re-run the producing step when evidence is missing or stale."},ideAndCi:{requiredArtifacts:[e.model,e.knowledgeGraph,e.impact,e.verify],rule:"IDEs and CI must consume structured artifacts and verdict exit semantics rather than parse human help or terminal prose."},docsAndDiagrams:{rule:"Documentation and diagrams must derive labels, ordering, and edges from this contract and must not invent implemented steps."}}}}var K=b.agentContext,H=a.agentContext;function B(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function N(e){return `npx --yes --package workspai workspai ${e}`.trim()}function u(e){return `npx workspai ${e}`.trim()}function d(e){return {id:e.id,scope:e.scope,display:u(e.args),execute:N(e.args),description:e.description,...e.project?{project:e.project}:{},freshness:h({id:`command.${e.id}`,label:`${e.id} command`,scope:"command",value:{display:u(e.args),execute:N(e.args)},...e.project?{project:e.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e.generatedAt,now:e.now,sourceArtifact:a.model,sourcePath:`safeCommands.${e.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function _(e,t){return `workspace run ${t} --scope project:${e.name}`}function U(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function J(e){return [e.name,e.path,G.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function X(e,t,s){let r={generatedAt:e.generatedAt,now:s},a=[d({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...r}),d({id:"workspace.graph.entities",scope:"workspace",args:"workspace graph entities --json",description:"Query proof-backed workspace entities without loading the full graph.",...r}),d({id:"workspace.graph.evidence",scope:"workspace",args:"workspace graph evidence <entity-or-relation> --json",description:"Resolve portable evidence for a graph entity or relation.",...r}),d({id:"workspace.graph.path",scope:"workspace",args:"workspace graph path <from> <to> --json",description:"Find a shortest proof-carrying path between workspace entities.",...r}),d({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...r}),d({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...r}),d({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...r}),d({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...r})],o=t?[t]:e.projects;for(let i of o)i.commands.fleetStages.includes("test")&&a.push(d({id:`project.${i.name}.test`,scope:"project",project:i.name,args:_(i,"test"),description:`Run tests for ${i.name} through workspace orchestration.`,...r})),i.commands.fleetStages.includes("build")&&a.push(d({id:`project.${i.name}.build`,scope:"project",project:i.name,args:_(i,"build"),description:`Build ${i.name} through workspace orchestration.`,...r}));return a}function Q(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function Y(e,t){if(!t?.startsWith("project:"))return;let s=U(t);if(s)return e.projects.find(r=>J(r).includes(s))}function Z(e,t,s){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!s&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let a=r.filter(i=>i.severity==="error").length,o=r.filter(i=>i.severity==="warning").length;return {status:a>0?"failed":o>0?"warning":"passed",errors:a,warnings:o,issues:r}}async function ee(e,t){let s=[],r=[];for(let[a,o]of Object.entries(e.evidence))o&&await d$2(t,o.path)!==null?s.push(`${a}: ${o.path}`):r.push(a);return {available:s.sort(),missing:r.sort()}}function te(e){let t=e.summary.projectCount,s=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${s}, and ${r}.`}function re(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function fe(e){let t=e.model??await p({workspacePath:e.workspacePath,includeEvidence:e.includeEvidence===true,observableScanDepth:e.observableScanDepth,now:e.now}),s=B(e.agent),r=Y(t,e.scope),a$1=Z(t,e.scope,r);if(e.strict===true&&a$1.status!=="passed"){let n=a$1.issues.map(m=>`${m.severity}:${m.code}:${m.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${n}`)}let o=e.now??new Date,i=t.facts??[],M=new Set((r?[r]:t.projects).map(n=>n.name)),v=i.filter(n=>n.project?M.has(n.project):true),L=(r?[r]:t.projects).map(n=>{let m=v.filter($=>$.project===n.name);return {name:n.name,path:n.path,kind:n.kind,category:n.category,runtime:n.runtime,framework:n.frameworkDisplayName,...n.generator?{generator:n.generator}:{},createCapability:n.createCapability,supportTier:n.supportTier,safeCommands:Q(n),importantFiles:n.importantFiles,facts:m}}),g=await ee(t,e.workspacePath),k=G.join(e.workspacePath,a.knowledgeGraph),p$1=await O.pathExists(k)?await O.readJson(k).catch(()=>null):null,w=false;if(p$1?.schemaVersion===b.knowledgeGraph)try{c$1(p$1,t),w=true;}catch{}let b$1=te(t),C=X(t,r,o),F=C.map(n=>h({id:`context.command.${n.id}`,label:`${n.id} safe command`,scope:"command",value:{display:n.display,execute:n.execute,scope:n.scope},...n.project?{project:n.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:o,sourceArtifact:a.agentContext,sourcePath:`safeCommands.${n.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),x=[...v,...F],h$1=i$1({facts:x,generatedAt:o.toISOString(),now:o}),f=T();return {schemaVersion:K,generatedAt:o.toISOString(),agent:s,workspaceSummary:b$1,modelRef:a.model,knowledgeGraph:{artifact:a.knowledgeGraph,schemaVersion:b.knowledgeGraph,available:w,...typeof p$1?.quality?.entityCount=="number"?{entityCount:p$1.quality.entityCount}:{},...typeof p$1?.quality?.relationCount=="number"?{relationCount:p$1.quality.relationCount}:{},...typeof p$1?.quality?.proofCount=="number"?{proofCount:p$1.quality.proofCount}:{},queryCommands:[u("workspace graph search <query> --limit 12 --json"),u("workspace graph entities [kind] --json"),u("workspace graph evidence <entity-or-relation> --json"),u("workspace graph path <from> <to> --json")]},intelligenceChain:{schemaVersion:f.schemaVersion,contractPath:f.contractPath,currentStep:"context",canonicalReadOrder:[...f.consumers.agents.canonicalReadOrder]},workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e.scope??"workspace",...r?{activeProject:r.name}:{}},projects:L,safeCommands:C,facts:x,factFreshness:h$1,evidence:g,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:a$1,agentInstructions:[`Read \`${a.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use `workspace graph search <query> --limit 12 --json` for bounded, proof-backed retrieval before loading the full graph.",`Load \`${a.knowledgeGraph}\` only when a complete graph export is explicitly required.`,"Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx workspai workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[...re(t),...h$1.verifyBeforeUseFacts>0?[`${h$1.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[b$1,`Evidence available: ${g.available.length}. Missing evidence groups: ${g.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
2
- `)}}async function ye(e$1,t){return e(t,H,d$1(e$1))}export{V as a,T as b,K as c,H as d,fe as e,ye as f};