workspai 0.79.0 → 0.79.1

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 (43) hide show
  1. package/README.md +117 -236
  2. package/dist/autopilot-release-E7ADQH2B.js +1 -0
  3. package/dist/{chunk-EPFEUMYF.js → chunk-5MRDPZU7.js} +1 -1
  4. package/dist/{chunk-FVG5FBA4.js → chunk-5NS322HT.js} +28 -28
  5. package/dist/{chunk-B6FJ6RG6.js → chunk-6CZQXEZ7.js} +1 -1
  6. package/dist/{chunk-7MIOAM4A.js → chunk-CAGOLU4Q.js} +1 -1
  7. package/dist/{chunk-ZDLF77IS.js → chunk-DYSFGHV5.js} +1 -1
  8. package/dist/{chunk-4H3VNKOJ.js → chunk-FJMUBFXO.js} +1 -1
  9. package/dist/{chunk-HXTNPR3M.js → chunk-GIP7YFWR.js} +1 -1
  10. package/dist/{chunk-BGUCDG5N.js → chunk-IF2OWXNY.js} +1 -1
  11. package/dist/{chunk-KTOKU6HQ.js → chunk-L3O2QXKH.js} +1 -1
  12. package/dist/{chunk-CJBDYDVC.js → chunk-LQYMYRGI.js} +1 -1
  13. package/dist/{chunk-7SN4V3RC.js → chunk-MJYWGRCY.js} +1 -1
  14. package/dist/{chunk-H24MEOML.js → chunk-NZQKHGPE.js} +1 -1
  15. package/dist/chunk-WJKQTX4V.js +2 -0
  16. package/dist/{chunk-GUCZOQUS.js → chunk-ZXYTWF2R.js} +1 -1
  17. package/dist/{create-M3TWRHV6.js → create-2ETTECFU.js} +1 -1
  18. package/dist/{doctor-FF3WLJSP.js → doctor-3F7OUVYQ.js} +1 -1
  19. package/dist/{goal-interactive-selection-6YJOK4WC.js → goal-interactive-selection-EMHAM5TM.js} +1 -1
  20. package/dist/{goal-lifecycle-O4MYYTRU.js → goal-lifecycle-PR5O7T6B.js} +1 -1
  21. package/dist/{goal-pack-NUDKANPM.js → goal-pack-TEK2PHAV.js} +1 -1
  22. package/dist/index.js +158 -158
  23. package/dist/{pipeline-V5P2FX2P.js → pipeline-E6YY65GU.js} +1 -1
  24. package/dist/{project-agent-entry-6O7FKWSL.js → project-agent-entry-MXAHZSQR.js} +1 -1
  25. package/dist/{project-intelligence-lens-OQTZ4K7L.js → project-intelligence-lens-IUM66OV2.js} +1 -1
  26. package/dist/{proof-carrying-change-GV37YLDQ.js → proof-carrying-change-XA5HRGSB.js} +1 -1
  27. package/dist/{verified-goal-VB7IOTNO.js → verified-goal-V5OVULY7.js} +1 -1
  28. package/dist/{workspace-AXU6ODER.js → workspace-XVPKQG5W.js} +1 -1
  29. package/dist/{workspace-agent-sync-6427FNME.js → workspace-agent-sync-46L7ZOQQ.js} +1 -1
  30. package/dist/{workspace-foundation-GYL3D7TW.js → workspace-foundation-PZNZWUJ4.js} +1 -1
  31. package/dist/{workspace-intelligence-runner-2EJ7GXG5.js → workspace-intelligence-runner-NZFRFCPN.js} +1 -1
  32. package/dist/{workspace-mcp-serve-BSA6Q4EB.js → workspace-mcp-serve-TIYCW364.js} +1 -1
  33. package/dist/{workspace-onboarding-NH4WFJ5N.js → workspace-onboarding-WUO6KCLF.js} +1 -1
  34. package/dist/{workspace-repair-engine-ODTFFM6O.js → workspace-repair-engine-V4Z7TJGS.js} +1 -1
  35. package/dist/workspace-run-T65CCZIN.js +1 -0
  36. package/docs/README.md +48 -116
  37. package/docs/ci-workflows.md +7 -1
  38. package/docs/creating-workspaces-and-projects.md +5 -0
  39. package/package.json +2 -2
  40. package/dist/autopilot-release-MDMVMU67.js +0 -1
  41. package/dist/chunk-ICPL4WNK.js +0 -2
  42. package/dist/workspace-run-VDQ6BYLS.js +0 -1
  43. /package/dist/{chunk-SV7X5LJW.js → chunk-GOOY7I36.js} +0 -0
@@ -1,4 +1,4 @@
1
- import {b as b$1}from'./chunk-B6FJ6RG6.js';import {a as a$3}from'./chunk-7Q7X4X5I.js';import {f as f$1,e as e$1,g as g$2,h as h$1}from'./chunk-XF65LQ6M.js';import {j,g as g$1}from'./chunk-RU3UT7GJ.js';import {e as e$2}from'./chunk-5HNQIMGW.js';import {a as a$a}from'./chunk-4ZUBPFSO.js';import {c as c$3,a as a$8,d as d$1,b as b$5}from'./chunk-N4B2M44I.js';import {a,c as c$4,h as h$2,g as g$3,k as k$1,f as f$2,d as d$3,e as e$4,i as i$1,j as j$3}from'./chunk-AO2ZI42U.js';import {a as a$1,b as b$2}from'./chunk-SVO2GGTV.js';import {c as c$2}from'./chunk-MNZAJ6PP.js';import {a as a$7,b as b$3}from'./chunk-R7R5FX4B.js';import {b as b$4}from'./chunk-RQXZF7BZ.js';import {a as a$5}from'./chunk-NMXGSVMD.js';import {a as a$4}from'./chunk-WU5M6UP7.js';import {D,y}from'./chunk-7HV4U2OV.js';import {d}from'./chunk-ROOPODG6.js';import {j as j$2,l,m as m$1,d as d$2,e as e$3,b as b$7,a as a$d}from'./chunk-7EMG3C3H.js';import {a as a$c}from'./chunk-GR6442P7.js';import {g,h,i}from'./chunk-BLEIUQL6.js';import {a as a$6}from'./chunk-AFIFZTOY.js';import {b,a as a$2}from'./chunk-252EKOR6.js';import {c as c$1,j as j$1,b as b$6,z,t as t$2,v,m as m$2}from'./chunk-6BO4QHKA.js';import {e}from'./chunk-EFHSRPW7.js';import {a as a$b}from'./chunk-TQEMLBAG.js';import {a as a$9}from'./chunk-2FIX2MDC.js';import {c}from'./chunk-25AWHAB5.js';import {t,k,u as u$1}from'./chunk-VQZ5PI5J.js';import {s,p,t as t$1}from'./chunk-ODK4LCEL.js';import f from'chalk';import {createHash}from'crypto';import {execa}from'execa';import m from'fs-extra';import u from'path';import {existsSync}from'fs';var ro=[".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs"],so=["tests","test","src/test","__tests__","e2e","playwright","cypress"],ao=["vitest.config.ts","vitest.config.js","vitest.config.mjs","jest.config.js","jest.config.ts","jest.config.mjs","playwright.config.ts","playwright.config.js","cypress.config.js","cypress.config.ts"],co=["src","app","pages"],lo=["dev","build","test","lint"];function si(e){let t=e?.scripts;if(!t||typeof t!="object"||Array.isArray(t))return {};let i={};for(let[n,o]of Object.entries(t))typeof o=="string"&&o.trim().length>0&&(i[n]=o);return i}async function ai(e,t){for(let o of ro)if(await m.pathExists(u.join(e,o)))return true;let i=t??(await m.pathExists(u.join(e,"package.json"))?await m.readJson(u.join(e,"package.json")):null);if(!i)return false;if(i.eslintConfig)return true;let n={...i.dependencies??{},...i.devDependencies??{}};return !!(n.eslint||n["@eslint/js"]||n["@eslint/eslintrc"])}async function ci(e,t){for(let o of so)if(await m.pathExists(u.join(e,o)))return true;for(let o of ao)if(await m.pathExists(u.join(e,o)))return true;let i=si(t);if(i.test||i["test:unit"]||i["test:e2e"]||i["test:ci"]||i["test:watch"])return true;let n={...t?.dependencies??{},...t?.devDependencies??{}};return n.vitest||n.jest||n["@playwright/test"]||n.cypress?true:await po(e)}async function po(e){let t=["src","app","pages","components"],i=/\.(test|spec)\.(tsx?|jsx?|vue|svelte)$/i,o=new Set(["node_modules",".git","dist","build",".next","coverage",".turbo"]);for(let r of t){let s=u.join(e,r);if(!await m.pathExists(s))continue;let c=[{dir:s,depth:0}];for(;c.length>0;){let a=c.shift();if(!a)break;let l=[];try{l=await m.readdir(a.dir);}catch{continue}for(let d of l){let p=u.join(a.dir,d);if(i.test(d))return true;if(!(a.depth>=3||o.has(d)||d.startsWith(".")))try{(await m.stat(p)).isDirectory()&&c.push({dir:p,depth:a.depth+1});}catch{continue}}}}return false}async function Qt(e){for(let t of co){let i=u.join(e,t);if(await m.pathExists(i))try{if((await m.readdir(i)).some(o=>!o.startsWith(".")))return true}catch{continue}}return false}function uo(e){let t=e.key;return b$7(t).key}function mo(e,t,i){return a$d(t,i).some(o=>!!e[o])}async function li(e){let{projectPath:t,detection:i,packageJsonData:n}=e,o=uo(i),r=b$7(o),s=si(n),c=[],a=await m.pathExists(u.join(t,"package-lock.json"))||await m.pathExists(u.join(t,"pnpm-lock.yaml"))||await m.pathExists(u.join(t,"yarn.lock"))||await m.pathExists(u.join(t,"bun.lockb"));c.push({id:"frontend-lockfile-integrity",label:"Frontend lockfile integrity",status:a?"pass":"warn",severity:"warn",scope:"project-scoped",reason:a?"Node lockfile detected for deterministic dependency restore.":"No Node lockfile detected (package-lock/yarn.lock/pnpm-lock.yaml/bun.lockb).",recommendation:a?void 0:"Commit a lockfile for deterministic installs and CI parity."});let l=await m.pathExists(u.join(t,"tsconfig.json")),d=await m.pathExists(u.join(t,"jsconfig.json")),p=l||d;c.push({id:"frontend-typescript-surface",label:"TypeScript project surface",status:p?"pass":"warn",severity:"warn",scope:"project-scoped",reason:p?l?"tsconfig.json detected.":"jsconfig.json detected.":"No tsconfig.json or jsconfig.json detected.",recommendation:p?void 0:"Add tsconfig.json (or jsconfig.json) for typed frontend builds and IDE parity."});let y=r.fileHints.length>0&&r.fileHints.some(v=>existsSync(u.join(t,v)));c.push({id:"frontend-framework-config",label:`${r.displayName} config surface`,status:y?"pass":"warn",severity:"warn",scope:"project-scoped",reason:y?`${r.displayName} configuration artifacts detected.`:`No ${r.displayName} config markers detected (${r.fileHints.join(", ")||"n/a"}).`,recommendation:y?void 0:"Keep framework config files in-repo for reproducible dev/build behavior."});for(let v of lo){let C=mo(s,o,v),h=v==="dev"||v==="build",w=!C&&v==="test"?h$2({projectPath:t,frameworkDisplayName:r.displayName,scriptName:v,scriptValue:g$3(s)}):void 0;c.push({id:`frontend-script-${v}`,label:`${v} script surface`,status:C?"pass":h?"fail":"warn",severity:h?"error":"warn",scope:"project-scoped",reason:C?`package.json exposes a ${v} script for ${r.displayName}.`:`No ${v} script detected for ${r.displayName}.`,recommendation:C?void 0:`Add a "${a$d(o,v)[0]??v}" script to package.json.`,repairCapability:w});}let k=await Qt(t);return c.push({id:"frontend-source-tree",label:"Frontend source tree",status:k?"pass":"warn",severity:"warn",scope:"project-scoped",reason:k?"Application source directories detected (src/app/pages).":"No frontend source directories detected under src/, app/, or pages/.",recommendation:k?void 0:"Ensure the scaffolded application tree exists before running lifecycle commands."}),c}var fo=s.doctorFixResult.schemaVersion,De="npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json";function Oe(e){return {schemaVersion:fo,generatedAt:new Date().toISOString(),appliedFixes:e.appliedFixes,remainingBlockers:e.remainingBlockers,verifyRecommended:e.verifyRecommended??De}}var go=["python","node","go","java","rust","elixir","clojure","deno","bun","php","ruby","dotnet","scala","kotlin","c","cpp","unknown"],Dt={node:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],deno:["deno.lock"],bun:["bun.lock","bun.lockb"],python:["uv.lock","poetry.lock","requirements.txt","requirements.lock"],go:["go.sum"],java:["gradle.lockfile","gradle/libs.versions.toml"],rust:["Cargo.lock"],elixir:["mix.lock"],clojure:["deps.edn","project.clj"],php:["composer.lock"],ruby:["Gemfile.lock"],dotnet:["packages.lock.json","Directory.Packages.props"],scala:["project/build.properties","project/plugins.sbt"],kotlin:["gradle.lockfile","gradle/libs.versions.toml"],c:["conan.lock","vcpkg-lock.json","MODULE.bazel.lock","requirements.bazel.lock"],cpp:["conan.lock","vcpkg-lock.json","MODULE.bazel.lock","requirements.bazel.lock"],unknown:[]},Rt={node:["package.json"],deno:["deno.json","deno.jsonc"],bun:["package.json","bunfig.toml",".bunfig.toml"],python:["pyproject.toml","requirements.txt","setup.py"],go:["go.mod"],java:["pom.xml","build.gradle","build.gradle.kts"],rust:["Cargo.toml"],elixir:["mix.exs"],clojure:["deps.edn","project.clj"],php:["composer.json"],ruby:["Gemfile"],dotnet:["*.csproj","*.sln"],scala:["build.sbt"],kotlin:["build.gradle","build.gradle.kts","pom.xml"],c:["CMakeLists.txt","meson.build","Makefile","MODULE.bazel","WORKSPACE"],cpp:["CMakeLists.txt","meson.build","Makefile","MODULE.bazel","WORKSPACE"],unknown:[]},yo=["node_modules",".git",".workspai/reports",".venv","dist","build","coverage",".env",".env.*","!.env.example"].join(`
1
+ import {b as b$1}from'./chunk-6CZQXEZ7.js';import {a as a$3}from'./chunk-7Q7X4X5I.js';import {f as f$1,e as e$1,g as g$2,h as h$1}from'./chunk-XF65LQ6M.js';import {j,g as g$1}from'./chunk-RU3UT7GJ.js';import {e as e$2}from'./chunk-5HNQIMGW.js';import {a as a$a}from'./chunk-4ZUBPFSO.js';import {c as c$3,a as a$8,d as d$1,b as b$5}from'./chunk-N4B2M44I.js';import {a,c as c$4,h as h$2,g as g$3,k as k$1,f as f$2,d as d$3,e as e$4,i as i$1,j as j$3}from'./chunk-AO2ZI42U.js';import {a as a$1,b as b$2}from'./chunk-SVO2GGTV.js';import {c as c$2}from'./chunk-MNZAJ6PP.js';import {a as a$7,b as b$3}from'./chunk-R7R5FX4B.js';import {b as b$4}from'./chunk-RQXZF7BZ.js';import {a as a$5}from'./chunk-NMXGSVMD.js';import {a as a$4}from'./chunk-WU5M6UP7.js';import {D,y}from'./chunk-7HV4U2OV.js';import {d}from'./chunk-ROOPODG6.js';import {j as j$2,l,m as m$1,d as d$2,e as e$3,b as b$7,a as a$d}from'./chunk-7EMG3C3H.js';import {a as a$c}from'./chunk-GR6442P7.js';import {g,h,i}from'./chunk-BLEIUQL6.js';import {a as a$6}from'./chunk-AFIFZTOY.js';import {b,a as a$2}from'./chunk-252EKOR6.js';import {c as c$1,j as j$1,b as b$6,z,t as t$2,v,m as m$2}from'./chunk-6BO4QHKA.js';import {e}from'./chunk-EFHSRPW7.js';import {a as a$b}from'./chunk-TQEMLBAG.js';import {a as a$9}from'./chunk-2FIX2MDC.js';import {c}from'./chunk-25AWHAB5.js';import {t,k,u as u$1}from'./chunk-VQZ5PI5J.js';import {s,p,t as t$1}from'./chunk-ODK4LCEL.js';import f from'chalk';import {createHash}from'crypto';import {execa}from'execa';import m from'fs-extra';import u from'path';import {existsSync}from'fs';var ro=[".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs"],so=["tests","test","src/test","__tests__","e2e","playwright","cypress"],ao=["vitest.config.ts","vitest.config.js","vitest.config.mjs","jest.config.js","jest.config.ts","jest.config.mjs","playwright.config.ts","playwright.config.js","cypress.config.js","cypress.config.ts"],co=["src","app","pages"],lo=["dev","build","test","lint"];function si(e){let t=e?.scripts;if(!t||typeof t!="object"||Array.isArray(t))return {};let i={};for(let[n,o]of Object.entries(t))typeof o=="string"&&o.trim().length>0&&(i[n]=o);return i}async function ai(e,t){for(let o of ro)if(await m.pathExists(u.join(e,o)))return true;let i=t??(await m.pathExists(u.join(e,"package.json"))?await m.readJson(u.join(e,"package.json")):null);if(!i)return false;if(i.eslintConfig)return true;let n={...i.dependencies??{},...i.devDependencies??{}};return !!(n.eslint||n["@eslint/js"]||n["@eslint/eslintrc"])}async function ci(e,t){for(let o of so)if(await m.pathExists(u.join(e,o)))return true;for(let o of ao)if(await m.pathExists(u.join(e,o)))return true;let i=si(t);if(i.test||i["test:unit"]||i["test:e2e"]||i["test:ci"]||i["test:watch"])return true;let n={...t?.dependencies??{},...t?.devDependencies??{}};return n.vitest||n.jest||n["@playwright/test"]||n.cypress?true:await po(e)}async function po(e){let t=["src","app","pages","components"],i=/\.(test|spec)\.(tsx?|jsx?|vue|svelte)$/i,o=new Set(["node_modules",".git","dist","build",".next","coverage",".turbo"]);for(let r of t){let s=u.join(e,r);if(!await m.pathExists(s))continue;let c=[{dir:s,depth:0}];for(;c.length>0;){let a=c.shift();if(!a)break;let l=[];try{l=await m.readdir(a.dir);}catch{continue}for(let d of l){let p=u.join(a.dir,d);if(i.test(d))return true;if(!(a.depth>=3||o.has(d)||d.startsWith(".")))try{(await m.stat(p)).isDirectory()&&c.push({dir:p,depth:a.depth+1});}catch{continue}}}}return false}async function Qt(e){for(let t of co){let i=u.join(e,t);if(await m.pathExists(i))try{if((await m.readdir(i)).some(o=>!o.startsWith(".")))return true}catch{continue}}return false}function uo(e){let t=e.key;return b$7(t).key}function mo(e,t,i){return a$d(t,i).some(o=>!!e[o])}async function li(e){let{projectPath:t,detection:i,packageJsonData:n}=e,o=uo(i),r=b$7(o),s=si(n),c=[],a=await m.pathExists(u.join(t,"package-lock.json"))||await m.pathExists(u.join(t,"pnpm-lock.yaml"))||await m.pathExists(u.join(t,"yarn.lock"))||await m.pathExists(u.join(t,"bun.lockb"));c.push({id:"frontend-lockfile-integrity",label:"Frontend lockfile integrity",status:a?"pass":"warn",severity:"warn",scope:"project-scoped",reason:a?"Node lockfile detected for deterministic dependency restore.":"No Node lockfile detected (package-lock/yarn.lock/pnpm-lock.yaml/bun.lockb).",recommendation:a?void 0:"Commit a lockfile for deterministic installs and CI parity."});let l=await m.pathExists(u.join(t,"tsconfig.json")),d=await m.pathExists(u.join(t,"jsconfig.json")),p=l||d;c.push({id:"frontend-typescript-surface",label:"TypeScript project surface",status:p?"pass":"warn",severity:"warn",scope:"project-scoped",reason:p?l?"tsconfig.json detected.":"jsconfig.json detected.":"No tsconfig.json or jsconfig.json detected.",recommendation:p?void 0:"Add tsconfig.json (or jsconfig.json) for typed frontend builds and IDE parity."});let y=r.fileHints.length>0&&r.fileHints.some(v=>existsSync(u.join(t,v)));c.push({id:"frontend-framework-config",label:`${r.displayName} config surface`,status:y?"pass":"warn",severity:"warn",scope:"project-scoped",reason:y?`${r.displayName} configuration artifacts detected.`:`No ${r.displayName} config markers detected (${r.fileHints.join(", ")||"n/a"}).`,recommendation:y?void 0:"Keep framework config files in-repo for reproducible dev/build behavior."});for(let v of lo){let C=mo(s,o,v),h=v==="dev"||v==="build",w=!C&&v==="test"?h$2({projectPath:t,frameworkDisplayName:r.displayName,scriptName:v,scriptValue:g$3(s)}):void 0;c.push({id:`frontend-script-${v}`,label:`${v} script surface`,status:C?"pass":h?"fail":"warn",severity:h?"error":"warn",scope:"project-scoped",reason:C?`package.json exposes a ${v} script for ${r.displayName}.`:`No ${v} script detected for ${r.displayName}.`,recommendation:C?void 0:`Add a "${a$d(o,v)[0]??v}" script to package.json.`,repairCapability:w});}let k=await Qt(t);return c.push({id:"frontend-source-tree",label:"Frontend source tree",status:k?"pass":"warn",severity:"warn",scope:"project-scoped",reason:k?"Application source directories detected (src/app/pages).":"No frontend source directories detected under src/, app/, or pages/.",recommendation:k?void 0:"Ensure the scaffolded application tree exists before running lifecycle commands."}),c}var fo=s.doctorFixResult.schemaVersion,De="npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json";function Oe(e){return {schemaVersion:fo,generatedAt:new Date().toISOString(),appliedFixes:e.appliedFixes,remainingBlockers:e.remainingBlockers,verifyRecommended:e.verifyRecommended??De}}var go=["python","node","go","java","rust","elixir","clojure","deno","bun","php","ruby","dotnet","scala","kotlin","c","cpp","unknown"],Dt={node:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],deno:["deno.lock"],bun:["bun.lock","bun.lockb"],python:["uv.lock","poetry.lock","requirements.txt","requirements.lock"],go:["go.sum"],java:["gradle.lockfile","gradle/libs.versions.toml"],rust:["Cargo.lock"],elixir:["mix.lock"],clojure:["deps.edn","project.clj"],php:["composer.lock"],ruby:["Gemfile.lock"],dotnet:["packages.lock.json","Directory.Packages.props"],scala:["project/build.properties","project/plugins.sbt"],kotlin:["gradle.lockfile","gradle/libs.versions.toml"],c:["conan.lock","vcpkg-lock.json","MODULE.bazel.lock","requirements.bazel.lock"],cpp:["conan.lock","vcpkg-lock.json","MODULE.bazel.lock","requirements.bazel.lock"],unknown:[]},Rt={node:["package.json"],deno:["deno.json","deno.jsonc"],bun:["package.json","bunfig.toml",".bunfig.toml"],python:["pyproject.toml","requirements.txt","setup.py"],go:["go.mod"],java:["pom.xml","build.gradle","build.gradle.kts"],rust:["Cargo.toml"],elixir:["mix.exs"],clojure:["deps.edn","project.clj"],php:["composer.json"],ruby:["Gemfile"],dotnet:["*.csproj","*.sln"],scala:["build.sbt"],kotlin:["build.gradle","build.gradle.kts","pom.xml"],c:["CMakeLists.txt","meson.build","Makefile","MODULE.bazel","WORKSPACE"],cpp:["CMakeLists.txt","meson.build","Makefile","MODULE.bazel","WORKSPACE"],unknown:[]},yo=["node_modules",".git",".workspai/reports",".venv","dist","build","coverage",".env",".env.*","!.env.example"].join(`
2
2
  `),tn=[".env",".env.*","!.env.example"];function He(e){return e&&go.includes(e)?e:"unknown"}async function Re(e,t){for(let i of t){if(i.includes("*")){let n=i.replace("*","");if(await di(e,n,2))return true;continue}if(await m.pathExists(u.join(e,i)))return true}return false}async function di(e,t,i){let n=[{dir:e,depth:0}],o=new Set(["node_modules",".git",".workspai",".rapidkit","dist","build","coverage"]);for(;n.length>0;){let r=n.shift();if(!r)break;let s=[];try{s=await m.readdir(r.dir,{withFileTypes:true});}catch{continue}for(let c of s){if(o.has(c.name))continue;let a=u.join(r.dir,c.name);if(c.isFile()&&c.name.endsWith(t))return true;c.isDirectory()&&r.depth<i&&!c.name.startsWith(".")&&n.push({dir:a,depth:r.depth+1});}}return false}async function nn(e,t=6){let i=await m.pathExists(u.join(e,"Dockerfile")),n=false,o=false,r=new Set(["docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml"]),s=new Set(["node_modules",".git",".workspai",".rapidkit","dist","build","coverage","target","vendor"]),c=[{dir:e,depth:0}];for(;c.length>0&&(!n||!o);){let a=c.shift();if(!a)break;let l=[];try{l=await m.readdir(a.dir,{withFileTypes:true});}catch{continue}for(let d of l)s.has(d.name)||(d.isFile()?(a.depth>0&&d.name==="Dockerfile"&&(n=true),r.has(d.name)&&(o=true)):d.isDirectory()&&a.depth<t&&!d.name.startsWith(".")&&c.push({dir:u.join(a.dir,d.name),depth:a.depth+1}));}return {rootDockerfile:i,nestedDockerfile:n,compose:o}}async function tt(e){try{return await m.pathExists(e)?await m.readFile(e,"utf8"):""}catch{return ""}}async function St(e,t){let i=[];for(let n of t){let o=await tt(u.join(e,n));o&&i.push(o);}return i.join(`
3
3
  `)}async function ho(e){let t=u.join(e,".github","workflows"),i=[];try{i=await m.readdir(t,{withFileTypes:true});}catch{return ""}let n=[],o=0;for(let r of i.filter(s=>s.isFile()&&/\.(?:ya?ml)$/i.test(s.name)).sort((s,c)=>s.name.localeCompare(c.name)).slice(0,64)){let s=u.join(t,r.name);try{let c=await m.stat(s);if(c.size>512*1024||o+c.size>1024*1024)continue;n.push(await m.readFile(s,"utf8")),o+=c.size;}catch{}}return n.join(`
4
4
  `)}var ko=new Set([".c",".cc",".clj",".cljs",".cpp",".cs",".ex",".exs",".go",".h",".hpp",".java",".js",".jsx",".kt",".kts",".mjs",".cjs",".php",".py",".rb",".rs",".scala",".svelte",".ts",".tsx",".vue"]),bo=[/\bprocess\.env(?:\.([A-Z][A-Z0-9_]*)|\[['"]([A-Z][A-Z0-9_]*)['"]\])/g,/\bimport\.meta\.env\.([A-Z][A-Z0-9_]*)/g,/\b(?:Deno\.env\.get|os\.getenv|os\.Getenv|os\.LookupEnv|System\.getenv|std::env::var|env!|option_env!|getenv|Environment\.GetEnvironmentVariable)\(\s*['"]([A-Z][A-Z0-9_]*)['"]/g,/\bos\.environ(?:\.get\(\s*['"]([A-Z][A-Z0-9_]*)['"]|\[\s*['"]([A-Z][A-Z0-9_]*)['"]\s*\])/g,/\bENV(?:\.fetch\(\s*['"]([A-Z][A-Z0-9_]*)['"]|\[\s*['"]([A-Z][A-Z0-9_]*)['"]\s*\])/g,/\$_ENV\[\s*['"]([A-Z][A-Z0-9_]*)['"]\s*\]/g,/@Value\(\s*['"]\$\{([A-Z][A-Z0-9_]*)(?::[^}]*)?\}['"]\s*\)/g],vo=new Set(["BROWSER","CI","GITHUB_WORKSPACE","HOME","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PAGER","PATH","PROCESSOR_ARCHITEW6432","SSH_CLIENT","SSH_TTY","SYSTEMROOT","TEMP","TMP","TMPDIR","XDG_CACHE_HOME"]);async function wo(e){let t=new Set,i=new Set([".git",".next",".nuxt",".output",".rapidkit",".svelte-kit",".venv",".workspai","build","coverage","dist","node_modules","target","vendor"]),n=[{dir:e,depth:0}],o=0;for(;n.length>0&&o<300;){let s=n.shift();if(!s)break;let c=[];try{c=await m.readdir(s.dir,{withFileTypes:true});}catch{continue}for(let a of c){if(i.has(a.name))continue;let l=u.join(s.dir,a.name);if(a.isDirectory()){s.depth<6&&!a.name.startsWith(".")&&n.push({dir:l,depth:s.depth+1});continue}if(!a.isFile()||!ko.has(u.extname(a.name).toLowerCase()))continue;o+=1;let d="";try{if((await m.stat(l)).size>512*1024)continue;d=await m.readFile(l,"utf8");}catch{continue}for(let p of bo){p.lastIndex=0;for(let y of d.matchAll(p)){let k=y.slice(1).find(v=>typeof v=="string"&&v.length>0);k&&!vo.has(k)&&t.add(k);}}}}let r=await tt(u.join(e,".env"));for(let s of r.split(/\r?\n/)){let c=s.match(/^\s*(?:export\s+)?([A-Z][A-Z0-9_]*)\s*=/);c?.[1]&&t.add(c[1]);}return [...t].sort((s,c)=>s.localeCompare(c))}async function jo(e){if(e.runtime==="node"){let t=typeof e.packageJsonData?.packageManager=="string"?e.packageJsonData.packageManager.split("@")[0]:null,i=e.projectKind==="agent"?" --prefix agents/primary":"";return {command:t==="pnpm"?"pnpm install":t==="yarn"?"yarn install":t==="bun"?"bun install":`npm install${i}`,title:e.projectKind==="agent"?"Generate nested Node agent dependency lockfile":"Generate Node dependency lockfile",files:e.projectKind==="agent"?["agents/primary/package.json","agents/primary/package-lock.json"]:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock"],limitations:["Review dependency and lockfile changes before committing."]}}if(e.runtime==="go"&&await m.pathExists(u.join(e.projectPath,"go.mod")))return {command:"go mod tidy",title:"Reconcile Go module graph",files:["go.mod","go.sum"],limitations:["Review go.mod/go.sum changes before committing."]};if(e.runtime==="java"){let t=await m.pathExists(u.join(e.projectPath,"pom.xml")),i=await m.pathExists(u.join(e.projectPath,"mvnw"))||await m.pathExists(u.join(e.projectPath,"mvnw.cmd")),n=await m.pathExists(u.join(e.projectPath,"gradlew"))||await m.pathExists(u.join(e.projectPath,"gradlew.bat")),o=t?i?process.platform==="win32"?".\\mvnw.cmd -B -DskipTests -Dmaven.repo.local=.workspai/cache/java/m2 dependency:go-offline":"./mvnw -B -DskipTests -Dmaven.repo.local=.workspai/cache/java/m2 dependency:go-offline":"mvn -B -DskipTests -Dmaven.repo.local=.workspai/cache/java/m2 dependency:go-offline":n?process.platform==="win32"?".\\gradlew.bat --project-cache-dir .workspai/cache/java/gradle dependencies":"./gradlew --project-cache-dir .workspai/cache/java/gradle dependencies":"gradle --project-cache-dir .workspai/cache/java/gradle dependencies";return t?{command:o,title:"Warm Maven dependency graph",files:["pom.xml"],limitations:["Maven does not provide a native transitive lockfile; dependency:go-offline warms dependencies but does not create reproducibility evidence."]}:{command:o,title:"Prepare Gradle dependency baseline",files:["build.gradle","build.gradle.kts","gradle.lockfile"],limitations:["Review resolved dependency and lockfile changes before committing."]}}if(e.runtime==="scala")return {command:"sbt update",title:"Prepare Scala dependency baseline",files:["build.sbt","project/build.properties","project/plugins.sbt"],limitations:["Review resolved dependency and plugin changes before committing."]};if(e.runtime==="kotlin")return {command:process.platform==="win32"?".\\gradlew.bat dependencies":"./gradlew dependencies",title:"Prepare Kotlin dependency baseline",files:["build.gradle","build.gradle.kts","gradle.lockfile"],limitations:["Review resolved dependency and lockfile changes before committing."]};if(e.runtime==="rust")return {command:"cargo fetch",title:"Generate Rust dependency baseline",files:["Cargo.toml","Cargo.lock"],limitations:["Review Cargo.lock changes before committing."]};if(e.runtime==="php")return {command:"composer install",title:"Generate Composer lockfile",files:["composer.json","composer.lock"],limitations:["Review composer.lock changes before committing."]};if(e.runtime==="ruby")return {command:"bundle install",title:"Generate Bundler lockfile",files:["Gemfile","Gemfile.lock"],limitations:["Review Gemfile.lock changes before committing."]};if(e.runtime==="dotnet")return e.projectKind==="agent"?{command:"dotnet restore agents/primary/tests/Primary.Tests.csproj",title:".NET agent dependency restore",files:["agents/primary/Primary.csproj","agents/primary/tests/Primary.Tests.csproj","agents/primary/**/packages.lock.json"],limitations:["Review the generated NuGet lock files before committing."]}:{command:"dotnet restore",title:".NET dependency restore",files:["*.sln","*.csproj","packages.lock.json","Directory.Packages.props"],limitations:["Enable NuGet lock files in the project when release policy requires deterministic restore."]};if(e.runtime==="elixir")return {command:"mix deps.get",title:"Generate Elixir dependency lockfile",files:["mix.exs","mix.lock"],limitations:["Review mix.lock changes before committing."]};if(e.runtime==="clojure")return {command:"clojure -P",title:"Prepare Clojure dependency baseline",files:["deps.edn","project.clj"],limitations:["Review dependency cache and CI restore policy before release."]};if(e.runtime==="python"){let t=e.projectKind==="agent"?u.join(e.projectPath,"agents","primary","pyproject.toml"):u.join(e.projectPath,"pyproject.toml"),i=await tt(t);if(/\[tool\.poetry\]/.test(i))return {command:"poetry install --no-root",title:"Install Poetry dependency baseline",files:["pyproject.toml","poetry.lock"],limitations:["Review poetry.lock changes before committing when Poetry resolves or updates the lockfile."]};if(/\[tool\.uv\]|\[project\]/.test(i))return {command:e.projectKind==="agent"?"uv lock --project agents/primary":"uv lock",title:"Generate uv lockfile",files:e.projectKind==="agent"?["agents/primary/pyproject.toml","agents/primary/uv.lock"]:["pyproject.toml","uv.lock"],limitations:["Review uv.lock changes before committing."]}}return null}function nt(e){let t=e?.scripts;if(!t||typeof t!="object"||Array.isArray(t))return {};let i={};for(let[n,o]of Object.entries(t))typeof o=="string"&&o.trim().length>0&&(i[n]=o);return i}function xo(e){if(e.runtime==="node"){let i=nt(e.packageJsonData);if(!e.packageJsonData)return null;if(e.kind==="test"){let n=i.lint?"npm run lint":i.build?"npm run build":null;return n?{command:n,title:"Define Node test script",targetName:"test",files:["package.json"],limitations:["Replace this fallback with real tests when product coverage is required."]}:null}if(e.kind==="security"){let n=y(e.projectPath);return {command:n==="pnpm"?"pnpm audit --audit-level=moderate":n==="yarn"?m.existsSync(u.join(e.projectPath,".yarnrc.yml"))?"yarn npm audit --severity moderate":"yarn audit --level moderate":n==="bun"?"bun audit":"npm audit --audit-level=moderate",title:"Define Node security audit script",targetName:"audit",files:["package.json"]}}return null}return {deno:{test:{command:"deno test --allow-none",title:"Define Deno test command",targetName:"test",files:["Makefile","deno.json","deno.jsonc"]},quality:{command:"deno fmt --check && deno lint",title:"Define Deno quality command",targetName:"quality",files:["Makefile","deno.json","deno.jsonc"]},security:{command:"deno info --json",title:"Define Deno dependency inspection command",targetName:"security",files:["Makefile","deno.json","deno.jsonc","deno.lock"],limitations:["Pair dependency inspection with the organization vulnerability service used by CI."]}},bun:{test:{command:"bun test",title:"Define Bun test script",targetName:"test",files:["package.json","bun.lock","bun.lockb"]},quality:{command:"bunx eslint .",title:"Define Bun quality script",targetName:"quality",files:["package.json"],limitations:["Ensure ESLint is declared before enforcing this command in CI."]},security:{command:"bun audit",title:"Define Bun security audit script",targetName:"audit",files:["package.json","bun.lock","bun.lockb"]}},python:{test:{command:"python -m pytest",title:"Define Python test command",targetName:"test",files:["Makefile","pyproject.toml"]},quality:{command:"python -m ruff check .",title:"Define Python quality command",targetName:"quality",files:["Makefile","pyproject.toml"],limitations:["Ensure ruff is declared in project dev dependencies before enforcing in CI."]},security:{command:"python -m pip_audit",title:"Define Python security audit command",targetName:"security",files:["Makefile","pyproject.toml"],limitations:["Ensure pip-audit is available in the project toolchain before enforcing in CI."]}},go:{test:{command:"go test ./...",title:"Define Go test command",targetName:"test",files:["Makefile","go.mod"]},quality:{command:"gofmt -w .",title:"Define Go formatting command",targetName:"quality",files:["Makefile","go.mod"],limitations:["Use CI-specific check mode if formatting should not mutate files in pipelines."]},security:{command:"govulncheck ./...",title:"Define Go vulnerability scan command",targetName:"security",files:["Makefile","go.mod"],limitations:["Ensure govulncheck is installed or provisioned by CI before enforcing."]}},rust:{test:{command:"cargo test",title:"Define Rust test command",targetName:"test",files:["Makefile","Cargo.toml"]},quality:{command:"cargo fmt -- --check && cargo clippy --all-targets -- -D warnings",title:"Define Rust quality command",targetName:"quality",files:["Makefile","Cargo.toml"]},security:{command:"cargo audit",title:"Define Rust security audit command",targetName:"security",files:["Makefile","Cargo.toml"],limitations:["Ensure cargo-audit is installed or provisioned by CI before enforcing."]}},php:{test:{command:"vendor/bin/phpunit",title:"Define PHP test command",targetName:"test",files:["Makefile","composer.json"]},quality:{command:"vendor/bin/phpstan analyse",title:"Define PHP static analysis command",targetName:"quality",files:["Makefile","composer.json"],limitations:["Ensure phpstan is declared in require-dev before enforcing in CI."]},security:{command:"composer audit",title:"Define Composer security audit command",targetName:"security",files:["Makefile","composer.json"]}},ruby:{test:{command:"bundle exec rspec",title:"Define Ruby test command",targetName:"test",files:["Makefile","Gemfile"],limitations:["Use bundle exec ruby -Itest when the project uses minitest instead of RSpec."]},quality:{command:"bundle exec rubocop",title:"Define Ruby quality command",targetName:"quality",files:["Makefile","Gemfile"]},security:{command:"bundle exec bundler-audit check",title:"Define Ruby security audit command",targetName:"security",files:["Makefile","Gemfile"],limitations:["Ensure bundler-audit is installed or provisioned by CI before enforcing."]}},dotnet:{test:{command:"dotnet test",title:"Define .NET test command",targetName:"test",files:["Makefile","*.sln","*.csproj"]},quality:{command:"dotnet format --verify-no-changes",title:"Define .NET formatting gate",targetName:"quality",files:["Makefile","*.sln","*.csproj"]},security:{command:"dotnet list package --vulnerable",title:"Define .NET package vulnerability check",targetName:"security",files:["Makefile","*.sln","*.csproj"]}},java:{test:{command:"mvn test",title:"Define Java test command",targetName:"test",files:["Makefile","pom.xml","build.gradle","build.gradle.kts"],limitations:["Use ./gradlew test when the project is Gradle-first."]},quality:{command:"mvn verify",title:"Define Java verification command",targetName:"quality",files:["Makefile","pom.xml","build.gradle","build.gradle.kts"],limitations:["Use ./gradlew check when the project is Gradle-first."]},security:{command:"mvn org.owasp:dependency-check-maven:check",title:"Define Java dependency vulnerability check",targetName:"security",files:["Makefile","pom.xml"],limitations:["Review OWASP dependency-check policy and cache behavior before enforcing in CI."]}},elixir:{test:{command:"mix test",title:"Define Elixir test command",targetName:"test",files:["Makefile","mix.exs"]},quality:{command:"mix format --check-formatted && mix credo --strict",title:"Define Elixir quality command",targetName:"quality",files:["Makefile","mix.exs",".formatter.exs","credo.exs"],limitations:["Ensure Credo is declared before enforcing the strict quality command."]},security:{command:"mix hex.audit",title:"Define Hex dependency audit command",targetName:"security",files:["Makefile","mix.exs","mix.lock"]}},clojure:{test:{command:"clojure -M:test",title:"Define Clojure test command",targetName:"test",files:["Makefile","deps.edn","project.clj"],limitations:["Align the alias with the test runner declared by the project."]},quality:{command:"clj-kondo --lint src test",title:"Define Clojure quality command",targetName:"quality",files:["Makefile","deps.edn","project.clj"],limitations:["Ensure clj-kondo is provisioned before enforcing this command in CI."]},security:{command:"clojure -Stree",title:"Define Clojure dependency inspection command",targetName:"security",files:["Makefile","deps.edn","project.clj"],limitations:["Pair dependency-tree inspection with the vulnerability scanner selected by the organization."]}},scala:{test:{command:"sbt test",title:"Define Scala test command",targetName:"test",files:["Makefile","build.sbt"]},quality:{command:"sbt scalafmtCheckAll scalafixAll",title:"Define Scala quality command",targetName:"quality",files:["Makefile","build.sbt",".scalafmt.conf"],limitations:["Declare Scalafmt and Scalafix plugins before enforcing this command."]},security:{command:"sbt dependencyTree",title:"Define Scala dependency inspection command",targetName:"security",files:["Makefile","build.sbt"],limitations:["Pair dependency inspection with the organization vulnerability scanner."]}},kotlin:{test:{command:"./gradlew test",title:"Define Kotlin test command",targetName:"test",files:["Makefile","build.gradle","build.gradle.kts"]},quality:{command:"./gradlew check",title:"Define Kotlin quality command",targetName:"quality",files:["Makefile","build.gradle","build.gradle.kts"]},security:{command:"./gradlew dependencies",title:"Define Kotlin dependency inspection command",targetName:"security",files:["Makefile","build.gradle","build.gradle.kts"],limitations:["Pair dependency inspection with the organization vulnerability scanner."]}},c:{test:{command:"ctest --test-dir build --output-on-failure",title:"Define C test command",targetName:"test",files:["Makefile","CMakeLists.txt"]},quality:{command:"clang-tidy src/**/*.c --",title:"Define C quality command",targetName:"quality",files:["Makefile","CMakeLists.txt",".clang-tidy"],limitations:["Align source globs and compile database with the project build."]},security:{command:"cmake --build build --target sbom",title:"Define C dependency evidence command",targetName:"security",files:["Makefile","CMakeLists.txt"],limitations:["Declare the SBOM target or replace it with the organization scanner."]}},cpp:{test:{command:"ctest --test-dir build --output-on-failure",title:"Define C++ test command",targetName:"test",files:["Makefile","CMakeLists.txt"]},quality:{command:"clang-tidy src/**/*.cpp --",title:"Define C++ quality command",targetName:"quality",files:["Makefile","CMakeLists.txt",".clang-tidy"],limitations:["Align source globs and compile database with the project build."]},security:{command:"cmake --build build --target sbom",title:"Define C++ dependency evidence command",targetName:"security",files:["Makefile","CMakeLists.txt"],limitations:["Declare the SBOM target or replace it with the organization scanner."]}}}[e.runtime]?.[e.kind]??null}async function Co(e){return j$3({issueId:e.issueId,title:e.contract.title,projectPath:e.projectPath,targetName:e.contract.targetName,command:e.contract.command,reason:e.reason,risk:"guarded",requiresReview:true,limitations:e.contract.limitations})}async function on(e){let t=xo({runtime:e.runtime,kind:e.kind,projectPath:e.projectPath,packageJsonData:e.packageJsonData});if(t)return (e.runtime==="node"||e.runtime==="bun")&&e.packageJsonData?i$1({issueId:e.issueId,title:t.title,projectPath:e.projectPath,scriptName:t.targetName,scriptValue:t.command,reason:e.reason,risk:"guarded",limitations:t.limitations}):await m.pathExists(u.join(e.projectPath,"Makefile"))?Co({issueId:e.issueId,projectPath:e.projectPath,contract:t,reason:e.reason}):Se({issueId:e.issueId,title:t.title,projectPath:e.projectPath,files:t.files.filter(i=>i!=="Makefile"),reason:`${e.reason} The repository does not expose a Makefile, so Doctor will not invent a new command surface.`,limitations:t.limitations})}function Se(e){return {id:`${e.issueId}.manual`,issueId:e.issueId,title:e.title,status:"manual",fixKind:"manual",risk:"guarded",canAutoFix:false,canEditFiles:false,requiresApproval:true,requiresReview:true,files:e.files.map(t=>u.join(e.projectPath,t)),refreshCommands:["npx workspai doctor project --json","npx workspai workspace verify --json"],reason:e.reason,limitations:e.limitations}}async function en(e,t){let i=[...new Set(t.filter(o=>o&&!o.includes("*")))],n=[];for(let o of i)await m.pathExists(u.join(e,o))&&n.push(o);return n}function Po(e){return d$3({issueId:"surface-dockerignore",title:"Create .dockerignore",projectPath:e,relativePath:".dockerignore",content:`${yo}
@@ -0,0 +1,2 @@
1
+ import {b}from'./chunk-6CZQXEZ7.js';import {N,M,k,q,G,I as I$1,O}from'./chunk-RRZQPFFR.js';import {c}from'./chunk-7HV4U2OV.js';import {e,f}from'./chunk-EFHSRPW7.js';import {b as b$1}from'./chunk-UJXE4UAX.js';import {m,l}from'./chunk-VQZ5PI5J.js';import {AsyncLocalStorage}from'async_hooks';import {promises}from'fs';import d from'path';import B,{homedir}from'os';import {pathToFileURL}from'url';import h from'process';import ue from'fs-extra';var C={schemaVersion:"workspai.model-gateway-qualification.v1",workspaiReleaseAuthority:"source-ready",attach:"unsupported",adapters:[{adapterId:"openrouter-typescript",status:"source-ready",platforms:[]},{adapterId:"openrouter-python",status:"source-ready",platforms:[]}]};var L=["ubuntu-latest","macos-latest","windows-latest"];function ee(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Model gateway qualification document must be an object.");let t=e;if(!Array.isArray(t.adapters)||t.adapters.length===0)throw new Error("Model gateway qualification document contains no adapters.");let r=new Set;for(let a of t.adapters){if(!a||typeof a.adapterId!="string")throw new Error("Model gateway qualification adapter is missing adapterId.");if(r.has(a.adapterId))throw new Error(`Duplicate model gateway qualification adapter: ${a.adapterId}`);r.add(a.adapterId);let s=N(a.adapterId);if(!s)throw new Error(`Qualification adapter ${a.adapterId} is not in the version baseline.`);if(a.status!=="source-ready"&&a.status!=="qualified")throw new Error(`Invalid qualification status for ${a.adapterId}.`);if(!Array.isArray(a.platforms))throw new Error(`Qualification platforms missing for ${a.adapterId}.`);if(a.status==="source-ready"){if(a.platforms.length!==0)throw new Error(`Source-ready adapter ${a.adapterId} must not record platform qualification.`);continue}let c=new Set;for(let o of a.platforms){if(!o||!L.includes(o.os)||o.result!=="pass"||o.skippedRequiredStage!==false||o.sdkVersion!==s.sdkVersion)throw new Error(`Qualified adapter ${a.adapterId} is missing a valid platform record bound to ${s.sdkVersion}.`);if(c.has(o.os))throw new Error(`Duplicate platform ${o.os} for ${a.adapterId}.`);c.add(o.os);}for(let o of L)if(!c.has(o))throw new Error(`Qualified adapter ${a.adapterId} is missing ${o} evidence.`)}for(let a of M)if(!r.has(a.adapterId))throw new Error(`Baseline adapter ${a.adapterId} has no qualification record.`);let n=t.adapters.every(a=>a.status==="qualified");if(n)throw new Error("All adapters are qualified; release authority must match.")}ee(C);var y=C,F=Object.freeze({schemaVersion:y.schemaVersion,workspaiReleaseAuthority:y.workspaiReleaseAuthority,attach:y.attach,adapters:Object.freeze(y.adapters.map(e=>Object.freeze({...e,platforms:Object.freeze(e.platforms.map(t=>Object.freeze(t)))})))}),te=F.workspaiReleaseAuthority;function Q(e){return `${e} \xB7 ${te}`}var A=["backend","frontend","desktop","agent","gateway","extension","gaming"],re=[{id:"backend",label:"Backend",hint:"APIs and services"},{id:"frontend",label:"Frontend",hint:"Web applications"},{id:"desktop",label:"Desktop",hint:"Native desktop applications"},{id:"agent",label:"AI Agent",hint:"Governed agent runtimes"},{id:"gateway",label:"AI Gateway",hint:"Unified model access and routing"},{id:"extension",label:"Extension",hint:"Editor and platform extensions"},{id:"gaming",label:"Gaming",hint:"Game runtimes and tooling"}];function oe(e){let r=e.label.indexOf(" \u2014 ");return r>=0?e.label.slice(r+3).trim():e.label.trim()}function ae(e){return A.includes(e.category)?e.category:null}function V(e){let t=c().flatMap(o=>{let i=ae(o);return i?[{value:o.id,label:`${U(i)} \xB7 ${oe(o)}`,hint:`${o.runtime} \xB7 tested baseline`,name:o.label,category:i}]:[]}),r=k().map(o=>({value:o.kitId,label:`Frontend \xB7 ${o.displayName}`,hint:"official \xB7 latest stable",name:`${o.displayName} \u2014 ${o.framework}`,category:"frontend"})),n=q().map(o=>({value:o.kitId,label:`${U(o.category)} \xB7 ${o.displayName}`,hint:`${o.runtimeCandidates.join(" + ")} \xB7 official latest stable`,name:`${o.displayName} \u2014 ${o.category}`,category:o.category})),a=G().map(o=>({value:o.id,label:`AI Agent \xB7 ${o.label}`,hint:`${o.runtime} \xB7 ${I$1(o)?"release-admitted baseline":`${o.stability} \xB7 awaiting release admission`}`,name:o.label,category:"agent"})),s=O().map(o=>({value:o.id,label:`AI Gateway \xB7 ${o.label}`,hint:Q(o.runtime),name:o.label,category:"gateway"})),c$1=[...t,...r,...n,...a,...s].filter(o=>!e||o.category===e).sort((o,i)=>{let l=A.indexOf(o.category),k=A.indexOf(i.category);return l-k||(o.label??"").localeCompare(i.label??"")});return Y(c$1),c$1}function Pe(){let e=new Set(V().map(t=>t.category));return re.filter(t=>e.has(t.id)).map(t=>({value:t.id,label:t.label,hint:t.hint}))}function U(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Y(e){let t=new Set,r=new Set;for(let n of e){let a=n.label??n.name??String(n.value),s=String(n.value);if(t.has(a))throw new Error(`Duplicate kit picker label: ${a}`);if(r.has(s))throw new Error(`Duplicate kit picker value: ${s}`);t.add(a),r.add(s);}}var E="__workspai_create_back__",g=class extends Error{},w=new AsyncLocalStorage;async function tt(e){if(w.getStore())return e();let t={history:[],cursor:0,active:true};return w.run(t,async()=>{for(;;){t.cursor=0;try{return await e()}catch(r){if(!(r instanceof g)||!t.active)throw r}}})}function rt(e){return e instanceof g}function ot(){let e=w.getStore();e&&(e.active=false,e.history=[]);}async function _(e,t=b){let r=w.getStore();if(!r?.active)return t(e);if(e.length>1){let i={};for(let l of e)l.when===false||typeof l.when=="function"&&!l.when(i)||Object.assign(i,await _([{...l,when:void 0}],t));return i}let n=JSON.stringify(e.map(({name:i,type:l,choices:k})=>[i,l,k?.map(({value:P})=>P)])),a=r.history[r.cursor];if(a?.key===n)return r.cursor+=1,a.answers;r.history.length=r.cursor;let s=r.cursor>0,c=e.map(i=>s?i.type==="list"||i.type==="rawlist"?{...i,choices:[...i.choices??[],{label:"\u2190 Back",value:E,hint:"Return to the previous step"}]}:i.type==="confirm"?{...i,type:"rawlist",default:i.default===true?"__create_yes__":"__create_no__",choices:[{label:"Yes",value:"__create_yes__"},{label:"No",value:"__create_no__"},{label:"\u2190 Back",value:E,hint:"Return to the previous step"}]}:i.type==="input"?{...i,message:`${i.message??i.name} (type /back to return)`,initialValue:"",validate:l=>l.trim()==="/back"||(i.validate?.(l)??true)}:i:i),o=await t(c);if(s&&c.some(i=>{let l=o[i.name];return l===E||i.type==="input"&&typeof l=="string"&&l.trim()==="/back"}))throw r.history.length=r.cursor-1,new g;for(let i of e)if(i.type==="confirm"){let l=o[i.name];(l==="__create_yes__"||l==="__create_no__")&&(o[i.name]=l==="__create_yes__");}return r.history.push({key:n,answers:o}),r.cursor+=1,o}var se=".workspairc.json",ce=".rapidkitrc.json",le=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"],de=["workspai.config.json","rapidkit.config.json"];function H(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function I(e,t){let r=t instanceof Error?t.message:String(t),n=e.endsWith(".js")&&/module is not defined in ES module scope/i.test(r)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${e}.${n} Cause: ${r}`}async function pt(){for(let e$1 of [d.join(B.homedir(),se),d.join(B.homedir(),ce)])try{let t=await promises.readFile(e$1,"utf-8"),r=JSON.parse(t);return e.debug(`Loaded config from ${e$1}`),r}catch{}return e.debug("No user config found, using defaults"),{}}async function ft(e$1=process.cwd(),t={}){let r=e$1,n=d.parse(r).root;for(;r!==n;){for(let a of de){let s=d.join(r,a);try{let c=await promises.readFile(s,"utf-8"),o=JSON.parse(c);if(!o||typeof o!="object"||Array.isArray(o))throw new Error("configuration root must be a JSON object");return e.debug(`Loaded data-only Workspai config from ${a}`),o}catch(c){if(H(c))continue;throw new Error(I(s,c))}}for(let a of le){let s=d.join(r,a);try{await promises.access(s);}catch(c){if(H(c))continue;throw new Error(I(s,c))}if(e.debug(`Found config file: ${s}`),!t.trustExecutableConfig)throw new Error(`Refusing to execute Workspai config at ${s} without explicit trust. Use a data-only workspai.config.json file, pass --trust-config, or set WORKSPAI_TRUST_CONFIG=1.`);try{let o=await import(pathToFileURL(s).href),i=o.default||o;return e.debug(`Loaded Workspai config from ${a}`),i}catch(c){throw new Error(I(s,c))}}r=d.dirname(r);}return e.debug("No Workspai config file found, using defaults"),{}}function mt(e,t,r){return {author:r.author||t.workspace?.defaultAuthor||e.author,pythonVersion:r.pythonVersion||t.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:r.defaultInstallMethod||t.workspace?.installMethod||e.defaultInstallMethod,defaultKit:r.defaultKit||t.projects?.defaultKit||e.defaultKit,skipGit:r.skipGit??t.projects?.skipGit??e.skipGit,license:r.license||e.license,testRapidKitPath:r.testRapidKitPath||e.testRapidKitPath}}function gt(e){return f("DEV_PATH")||e.testRapidKitPath||void 0}var v=class extends Error{constructor(r,n){super(["Workspai workspaces cannot be nested.",`Target: ${r}`,`Containing workspace: ${n}`,"Choose Managed home or pass --output <path> with a location outside the current workspace."].join(`
2
+ `));this.targetPath=r;this.containingWorkspacePath=n;this.name="NestedWorkspaceCreationError";}targetPath;containingWorkspacePath;code="WORKSPACE_NESTING_NOT_SUPPORTED"};async function pe(e){try{return !!await ue.stat(e)}catch{return false}}function fe(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}=`));if(n)return n.slice(t.length+1)}function me(e){return e.includes("--here")}async function J(e){let t=d.resolve(e);for(;;){let r=[d.join(t,".workspai-workspace"),d.join(t,".rapidkit-workspace"),d.join(t,".workspai","workspace.json"),d.join(t,".rapidkit","workspace.json")];if((await Promise.all(r.map(pe))).some(Boolean))return t;let n=d.dirname(t);if(n===t)return;t=n;}}async function It(e){let t=d.resolve(e),r=await J(d.dirname(t));if(r)throw new v(t,r)}async function ge(e,t=homedir()){let n=[{value:"managed",label:"Managed home",hint:l(t)}];return await J(e)||n.push({value:"here",label:"Current directory",hint:e}),n}function z(e,t=h.cwd()){if(me(e))return d.resolve(t);let r=fe(e,"--output");if(r)return d.resolve(r)}function xt(e,t=h.cwd()){let r=d.resolve(e),n=d.resolve(t),a=d.relative(n,r);return a.length>0&&!a.startsWith("..")&&!d.isAbsolute(a)?`cd ${a}`:`cd ${r}`}function vt(e,t={}){let r=t.argv??[],n=t.outputParent??z(r,h.cwd());return m(e.trim(),{homeDir:t.homeDir,outputDir:n})}function Pt(e,t,r={}){return e?d.resolve(e)===d.resolve(t)?true:r.outputParent===void 0:false}async function St(e,t={}){let r=t.cwd??h.cwd(),n=t.homeDir??homedir(),a=z(e,r);if(a!==void 0)return a;let s=t.hasYes??(e.includes("--yes")||e.includes("-y"));if(!(t.interactive??(!s&&!!h.stdin.isTTY&&!b$1())))return;let o=await ge(r,n);if(o.length===1)return;let{location:i}=await _([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:o,default:0}]);if(i==="here")return d.resolve(r)}export{V as a,Pe as b,tt as c,rt as d,ot as e,_ as f,pt as g,ft as h,mt as i,gt as j,It as k,xt as l,vt as m,Pt as n,St as o};
@@ -1,4 +1,4 @@
1
- import {m,a as a$1,l as l$1}from'./chunk-CJBDYDVC.js';import {b as b$5,g as g$2}from'./chunk-HXTNPR3M.js';import {b as b$4,a}from'./chunk-D5LLTUTY.js';import {b as b$2,f as f$2,s as s$1,t as t$1,u,P as P$1,v,q as q$1,r as r$1,R,n,o,p as p$2,h as h$2,i,m as m$1,j,k,l,O,w,x,y,z as z$1,A,B as B$1,C,E,G,I,D as D$1,F,H,J as J$1,K,L,M,N,S,T,U,V,Y as Y$1,X as X$1,W,a as a$3,Q}from'./chunk-QYEQVNBF.js';import {b as b$1,c,d}from'./chunk-U5WP4HDH.js';import {b as b$3}from'./chunk-COICGD62.js';import {d as d$2}from'./chunk-ZONAHZBG.js';import {b as b$7}from'./chunk-R7R5FX4B.js';import {r,m as m$2,d as d$1}from'./chunk-O4TZKLEC.js';import {p as p$1}from'./chunk-WU5M6UP7.js';import {g}from'./chunk-BLEIUQL6.js';import {a as a$2,b as b$6}from'./chunk-VN2MKTQO.js';import {f as f$1,g as g$1,h}from'./chunk-VQZ5PI5J.js';import {q,p,t,s as s$2}from'./chunk-ODK4LCEL.js';import s from'path';import h$1 from'fs-extra';var pe=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var Jt="workspace-operational-skill.v1";function Yt(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ot(e){let t=Yt(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:Jt,skillId:t,canonicalPath:W(t),title:e.title,triggers:[...e.triggers].sort((r,n)=>r.localeCompare(n)),requiredReports:[...e.requiredReports].sort((r,n)=>r.localeCompare(n)),scopedProjects:[...e.scopedProjects??[]].sort((r,n)=>r.localeCompare(n)),verificationCommands:[...e.verificationCommands],answerContractSections:[...pe],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Xt=q.skillsIndex;function Tt(e){let t=[...e.skills].sort((i,c)=>i.skillId.localeCompare(c.skillId)),r=e.inputsHash??d$1({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath),decisions:e.decisions??[]}),n=e.decisions?[...e.decisions].sort((i,c)=>i.skillId.localeCompare(c.skillId)):void 0;return {schemaVersion:Xt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title})),...n?{selection:{generatedCount:n.filter(i=>i.status==="generated").length,suppressedCount:n.filter(i=>i.status==="suppressed").length,decisions:n}}:{}}}var _t=[p.agentIndex,b$1,d$2],B="<!-- WORKSPAI:GENERATED-OPERATIONAL-SKILL -->",Qt=[{skillId:"workspai-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using Workspai evidence before editing application code.",steps:[`Read \`${p.agentIndex}\` and identify fail/warn reports for the scoped project.`,`Read \`${p.doctor}\`, \`doctor-project-last-run.json\`, and project-scoped run evidence if present.`,"If a fix was requested, read `artifact-remediation-plan-last-run.json` for cross-artifact next steps, then `doctor-remediation-plan-last-run.json` for Doctor-specific file edits.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."],applicability:"api"},{skillId:"workspai-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed Workspai gates.",steps:[`Read \`${p.readiness}\` and \`pipeline-last-run.json\`.`,`Read \`${p.verify}\` for verdict and blocking reasons.`,`Read \`${t.artifactRemediationPlan}\` when a Studio or agent repair path is needed.`,"List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."],applicability:"workspace"},{skillId:"workspai-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Run a registered project-scoped test/build command when available; otherwise resolve the repository-authored validation command from cited manifests before promoting the migration.","Document rollback and verification signals."],applicability:"schema"},{skillId:"workspai-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Use registered test/build commands for affected projects; when none are registered, resolve repository-authored commands from cited manifests instead of inventing one.","Re-run `workspace verify` after evidence refresh."],applicability:"dependency"},{skillId:"workspai-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:[`Read \`${t.workspaceContract}\` for publishes/consumes/owns edges.`,"List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."],applicability:"contract"}];function z(e){return `npx workspai ${e}`.trim()}function Zt(e){let t=["---",`name: ${e.template.skillId}`,`description: ${e.template.objective}`,"---","",B,"",`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",..._t.map(r=>`- \`${r}\``),"","## Why this skill exists here","",`Applicability: **${e.decision.confidence} confidence**.`,"",...e.decision.reasons.map(r=>`- ${r}`),...e.decision.signals.length>0?["","Evidence signals:","",...e.decision.signals.map(r=>`- \`${r}\``)]:[],"","## Project-aware execution boundary","",...e.projectEvidence,"",...e.retrievalCommands.length>0?["## Scoped retrieval commands","",...e.retrievalCommands.map(r=>`- \`${r}\``),""]:[],"## Procedure","",...e.template.steps.map((r,n)=>`${n+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
1
+ import {m,a as a$1,l as l$1}from'./chunk-LQYMYRGI.js';import {b as b$5,g as g$2}from'./chunk-GIP7YFWR.js';import {b as b$4,a}from'./chunk-D5LLTUTY.js';import {b as b$2,f as f$2,s as s$1,t as t$1,u,P as P$1,v,q as q$1,r as r$1,R,n,o,p as p$2,h as h$2,i,m as m$1,j,k,l,O,w,x,y,z as z$1,A,B as B$1,C,E,G,I,D as D$1,F,H,J as J$1,K,L,M,N,S,T,U,V,Y as Y$1,X as X$1,W,a as a$3,Q}from'./chunk-QYEQVNBF.js';import {b as b$1,c,d}from'./chunk-U5WP4HDH.js';import {b as b$3}from'./chunk-COICGD62.js';import {d as d$2}from'./chunk-ZONAHZBG.js';import {b as b$7}from'./chunk-R7R5FX4B.js';import {r,m as m$2,d as d$1}from'./chunk-O4TZKLEC.js';import {p as p$1}from'./chunk-WU5M6UP7.js';import {g}from'./chunk-BLEIUQL6.js';import {a as a$2,b as b$6}from'./chunk-VN2MKTQO.js';import {f as f$1,g as g$1,h}from'./chunk-VQZ5PI5J.js';import {q,p,t,s as s$2}from'./chunk-ODK4LCEL.js';import s from'path';import h$1 from'fs-extra';var pe=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var Jt="workspace-operational-skill.v1";function Yt(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ot(e){let t=Yt(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:Jt,skillId:t,canonicalPath:W(t),title:e.title,triggers:[...e.triggers].sort((r,n)=>r.localeCompare(n)),requiredReports:[...e.requiredReports].sort((r,n)=>r.localeCompare(n)),scopedProjects:[...e.scopedProjects??[]].sort((r,n)=>r.localeCompare(n)),verificationCommands:[...e.verificationCommands],answerContractSections:[...pe],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Xt=q.skillsIndex;function Tt(e){let t=[...e.skills].sort((i,c)=>i.skillId.localeCompare(c.skillId)),r=e.inputsHash??d$1({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath),decisions:e.decisions??[]}),n=e.decisions?[...e.decisions].sort((i,c)=>i.skillId.localeCompare(c.skillId)):void 0;return {schemaVersion:Xt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title})),...n?{selection:{generatedCount:n.filter(i=>i.status==="generated").length,suppressedCount:n.filter(i=>i.status==="suppressed").length,decisions:n}}:{}}}var _t=[p.agentIndex,b$1,d$2],B="<!-- WORKSPAI:GENERATED-OPERATIONAL-SKILL -->",Qt=[{skillId:"workspai-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using Workspai evidence before editing application code.",steps:[`Read \`${p.agentIndex}\` and identify fail/warn reports for the scoped project.`,`Read \`${p.doctor}\`, \`doctor-project-last-run.json\`, and project-scoped run evidence if present.`,"If a fix was requested, read `artifact-remediation-plan-last-run.json` for cross-artifact next steps, then `doctor-remediation-plan-last-run.json` for Doctor-specific file edits.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."],applicability:"api"},{skillId:"workspai-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed Workspai gates.",steps:[`Read \`${p.readiness}\` and \`pipeline-last-run.json\`.`,`Read \`${p.verify}\` for verdict and blocking reasons.`,`Read \`${t.artifactRemediationPlan}\` when a Studio or agent repair path is needed.`,"List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."],applicability:"workspace"},{skillId:"workspai-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Run a registered project-scoped test/build command when available; otherwise resolve the repository-authored validation command from cited manifests before promoting the migration.","Document rollback and verification signals."],applicability:"schema"},{skillId:"workspai-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Use registered test/build commands for affected projects; when none are registered, resolve repository-authored commands from cited manifests instead of inventing one.","Re-run `workspace verify` after evidence refresh."],applicability:"dependency"},{skillId:"workspai-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:[`Read \`${t.workspaceContract}\` for publishes/consumes/owns edges.`,"List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."],applicability:"contract"}];function z(e){return `npx workspai ${e}`.trim()}function Zt(e){let t=["---",`name: ${e.template.skillId}`,`description: ${e.template.objective}`,"---","",B,"",`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",..._t.map(r=>`- \`${r}\``),"","## Why this skill exists here","",`Applicability: **${e.decision.confidence} confidence**.`,"",...e.decision.reasons.map(r=>`- ${r}`),...e.decision.signals.length>0?["","Evidence signals:","",...e.decision.signals.map(r=>`- \`${r}\``)]:[],"","## Project-aware execution boundary","",...e.projectEvidence,"",...e.retrievalCommands.length>0?["## Scoped retrieval commands","",...e.retrievalCommands.map(r=>`- \`${r}\``),""]:[],"## Procedure","",...e.template.steps.map((r,n)=>`${n+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
2
2
  `)}function er(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function tr(e){let t=new Map;for(let c of e.projects){let m=new Set([c.runtime,...c.runtimeCandidates??[]].map(er).filter(a=>a&&a!=="unknown"));for(let a of m){let k=t.get(a)??[];k.includes(c.name)||k.push(c.name),t.set(a,k);}}let r=[];for(let[c,m]of [...t.entries()].sort(([a],[k])=>a.localeCompare(k)))r.push({skillId:`workspai-${c}-runtime-validation`,title:`${c.toUpperCase()} runtime validation`,triggers:[`${c} build`,`${c} test`,`${c} runtime failure`],objective:`Validate ${c} changes against the detected runtime boundary, registered project commands, and canonical Workspai evidence.`,steps:["Read the scoped project lens and current fail/warn evidence before changing source.",`Use a registered ${c} command only when the project model identifies ${c} as the primary runtime; for a composite secondary boundary, inspect its manifest and Graph proofs instead of assuming the primary adapter covers it.`,"Run only the affected project validation first, then verify the workspace when the change crosses a contract boundary."],scopedProjects:[...m].sort(),applicability:"derived"});t.size>1&&r.push({skillId:"workspai-polyglot-change-validation",title:"Polyglot change validation",triggers:["cross-language change","polyglot change","binding change","multi-runtime validation"],objective:"Plan and verify a cross-runtime change without assuming that one runtime command proves the whole system.",steps:["Use the project topology and bounded Graph query to identify runtime and contract boundaries.","Validate each affected runtime with its registered project command.","Run workspace impact and canonical verification before declaring the change complete."],scopedProjects:Wt([...t.values()].flat()),applicability:"derived"});let n=e.projects.filter(c=>c.commands.supported.includes("test")).map(c=>c.name).sort();n.length>0&&r.push({skillId:"workspai-test-evidence-recovery",title:"Test evidence recovery",triggers:["test failure","coverage","regression","test evidence"],objective:"Repair a test or coverage blocker by proving changed behavior, not merely improving a metric.",steps:["Read the exact Analyze, Doctor, or Goal evidence that owns the test finding.","Inspect the behavior and relevant test boundary before proposing a source change.","Run the scoped test command, then the exact producer and canonical verification."],scopedProjects:n,applicability:"derived"});let i=e.projects.filter(c=>c.importantFiles.some(m=>/(?:^|\/)(?:Dockerfile|docker-compose|compose\.|Chart\.yaml|\.github\/workflows)/i.test(m))).map(c=>c.name).sort();return i.length>0&&r.push({skillId:"workspai-delivery-evidence",title:"Delivery evidence and CI recovery",triggers:["ci failure","workflow failure","container build","deployment evidence"],objective:"Diagnose delivery evidence with the owning project and CI/container artifacts before changing application source.",steps:["Identify whether the failing evidence is project-owned or workspace-owned.","Inspect the referenced workflow or delivery artifact and its bounded proof paths.","Validate the affected project first, then refresh the exact evidence producer and verify the workspace."],scopedProjects:i,applicability:"derived"}),r}function rr(e,t){if(!e?.safeCommands?.length)return [z("workspace verify --json"),z("doctor workspace --json")];let r=new Set(t);return e.safeCommands.filter(n=>n.scope==="workspace"||n.project&&r.has(n.project)).slice(0,8).map(n=>n.display)}function nr(e,t){if(!e?.projects?.length)return;let r=new Set(t),n=e.projects.filter(i=>r.has(i.slug)).filter(i=>(i.contracts?.owns?.length??0)>0||(i.contracts?.publishes?.length??0)>0||(i.contracts?.consumes?.length??0)>0||(i.contracts?.apis?.length??0)>0).slice(0,12).map(i=>{let c=i.contracts?.owns?.join(", ")||"none",m=i.contracts?.publishes?.join(", ")||"none",a=i.contracts?.consumes?.join(", ")||"none";return `- **${i.slug}**: owns \`${c}\`; publishes \`${m}\`; consumes \`${a}\``});return n.length>0?n.join(`
3
3
  `):void 0}var ar=/(?:^|\/)(?:package(?:-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|pyproject\.toml|poetry\.lock|requirements[^/]*\.txt|Pipfile(?:\.lock)?|uv\.lock|Cargo\.toml|Cargo\.lock|go\.mod|go\.sum|pom\.xml|build\.gradle(?:\.kts)?|settings\.gradle(?:\.kts)?|Gemfile(?:\.lock)?|composer\.(?:json|lock)|mix\.exs|deps\.edn|project\.clj|[^/]+\.(?:csproj|fsproj|vbproj)|Directory\.Packages\.props)$/i,or=/(?:^|\/)(?:openapi|swagger|asyncapi)\.(?:json|ya?ml)$|(?:^|\/)(?:routes?|controllers?|endpoints?|proto)(?:\/|\.)/i,ir=/(?:^|\/)(?:migrations?|database|db|prisma)(?:\/|\.)|(?:^|\/)schema\.(?:sql|prisma)$/i;function sr(e){let t=e.attributes.artifact;return typeof t=="string"&&t.trim()?t.trim():null}function cr(e){let t=e.attributes.ports;return Array.isArray(t)&&t.length>0}function lr(e,t){return e?.entities.filter(r=>r.projectId===t)??[]}function ue(e,t=12){return [...new Set([...e].map(r=>r.trim()).filter(Boolean))].sort((r,n)=>r.localeCompare(n)).slice(0,t)}function Wt(e){return [...new Set([...e].map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function dr(e){if(e.template.scopedProjects)return {projects:[...e.template.scopedProjects].sort(),reasons:["The canonical workspace model directly derived this capability."],signals:ue(e.template.scopedProjects.map(i=>`model:project:${i}:${e.template.skillId}`)),confidence:"high",applicable:true};if(e.template.applicability==="workspace")return {projects:e.model.projects.map(i=>i.name).sort(),reasons:["Workspace-level release and verification gates are always available."],signals:["model:workspace",`model:project-count:${e.model.projects.length}`],confidence:"high",applicable:true};let t=[],r=[],n=new Set;for(let i of e.model.projects){let c=lr(e.graph,i.name),m=Wt([...i.importantFiles,...c.map(sr).filter(l=>!!l)]),a=e.contract?.projects.find(l=>l.slug===i.name),k=false;switch(e.template.applicability){case "dependency":{let l=m.filter(d=>ar.test(d)),p=c.filter(d=>d.kind==="package");k=l.length>0||p.length>0,r.push(...l.map(d=>`artifact:${d}`),...p.slice(0,4).map(d=>`graph:package:${d.label}`)),k&&n.add("Dependency manifests or package entities were observed.");break}case "api":{let l=c.filter(w=>w.kind==="api"||w.kind==="endpoint"||w.kind==="service"&&cr(w)),p=m.filter(w=>or.test(w)),d=a?.contracts?.apis??[],R=(a?.ports??[]).filter(w=>["http","https","grpc"].includes(w.protocol));k=l.length>0||p.length>0||d.length>0||R.length>0,r.push(...l.slice(0,4).map(w=>`graph:${w.kind}:${w.label}`),...p.map(w=>`artifact:${w}`),...d.map(w=>`contract:api:${w.name}:${w.basePath}`),...R.map(w=>`contract:port:${w.name}:${w.protocol}:${w.port}`)),k&&n.add("An API, endpoint, routed artifact, or network contract was observed.");break}case "schema":{let l=c.filter(d=>{if(d.kind==="database")return true;if(d.kind!=="schema")return false;let R=`${d.label} ${JSON.stringify(d.attributes)}`;return /database|migration|sql|prisma|orm/i.test(R)}),p=m.filter(d=>ir.test(d));k=l.length>0||p.length>0,r.push(...l.slice(0,4).map(d=>`graph:${d.kind}:${d.label}`),...p.map(d=>`artifact:${d}`)),k&&n.add("A database, schema, or migration artifact was observed.");break}case "contract":{let l=a?[...a.contracts?.owns??[],...a.contracts?.publishes??[],...a.contracts?.consumes??[],...(a.contracts?.apis??[]).map(d=>d.name)]:[],p=c.filter(d=>["api","protocol"].includes(d.kind));k=l.length>0||p.length>0,r.push(...l.map(d=>`contract:${i.name}:${d}`),...p.slice(0,6).map(d=>`graph:${d.kind}:${d.label}`)),k&&n.add("A shared API, protocol, schema, or authored contract edge was observed.");break}case "derived":k=true;break}k&&t.push(i.name);}return {projects:ue(t,e.model.projects.length),reasons:[...n],signals:ue(r),confidence:e.graph||e.contract?"high":"medium",applicable:t.length>0}}function pr(e,t,r){let n=[];for(let i of t){let c=e.projects.find(l=>l.name===i);if(!c)continue;let m=c.commands.supported.filter(l=>["build","test","lint","format"].includes(l)),a=c.commands.supported.filter(l=>["docs","doctor"].includes(l)),k=r.filter(l=>l.startsWith("artifact:")).map(l=>l.slice(9)).filter(l=>c.importantFiles.includes(l)||l.includes(c.name));n.push(`- **${c.name}** \u2014 runtime \`${c.runtime}\`, framework \`${c.framework}\`, confidence \`${c.confidence}\`.`),n.push(m.length>0?` Registered lifecycle commands: ${m.map(l=>`\`${l}\``).join(", ")}.`:" No project-native build/test command is registered; inspect repository-authored manifests and Graph proofs before running a command."),a.length>0&&n.push(` Registered evidence commands: ${a.map(l=>`\`${l}\``).join(", ")}.`),k.length>0&&n.push(` Relevant artifacts: ${ue(k,6).map(l=>`\`${l}\``).join(", ")}.`);}return n.length>0?n:["- No project boundary was proven; do not infer repository-specific commands or files."]}function ur(e,t){let r=e.applicability==="api"?"api endpoint route service failure":e.applicability==="schema"?"database schema migration persistence":e.applicability==="dependency"?"package dependency manifest lockfile":e.applicability==="contract"?"api protocol published consumed contract":e.applicability==="workspace"?"release pipeline deployment verification":`${e.title.toLowerCase()} manifest command test`;return t.slice(0,8).map(n=>z(`workspace graph search "${r}" --scope project:${n} --limit 12 --json`))}function jt(e){let t=e.model.workspace.name,r=[],n=[];for(let i of [...Qt,...tr(e.model)]){let c=dr({template:i,model:e.model,contract:e.contract??null,graph:e.graph??null}),m={skillId:i.skillId,title:i.title,status:c.applicable?"generated":"suppressed",confidence:c.confidence,reasons:c.reasons.length>0?c.reasons:["No authoritative workspace signal proves this capability is present."],signals:c.signals,scopedProjects:c.projects};if(n.push(m),m.status==="suppressed")continue;let a=m.scopedProjects,k=rr(e.context??null,a),l=nr(e.contract??null,a),p=Zt({template:i,workspaceName:t,scopedProjects:a,verificationCommands:k,contractSummary:l,decision:m,projectEvidence:pr(e.model,a,m.signals),retrievalCommands:ur(i,a)});r.push(Ot({skillId:i.skillId,title:i.title,triggers:i.triggers,requiredReports:[..._t],scopedProjects:a,verificationCommands:k,...X$1(i.skillId)?{promptStem:Y$1[i.skillId]}:{},markdown:p}));}return {skills:r,decisions:n}}async function Nt(e){let t=s.resolve(e.workspacePath),r=[],n=d$1({skills:e.skills.map(a=>({id:a.skillId,path:a.canonicalPath,hash:d$1({markdown:a.markdown})})),decisions:e.decisions??[]}),i=Tt({generatedAt:e.generatedAt,skills:e.skills,inputsHash:n,decisions:e.decisions}),c=new Set(e.skills.map(a=>a.skillId)),m=[];if(e.write){let a=s.join(t,".workspai","skills");if(await h$1.pathExists(a))for(let l of await h$1.readdir(a,{withFileTypes:true})){if(!l.isFile()||!l.name.endsWith(".md"))continue;let p=l.name.slice(0,-3);if(c.has(p))continue;let d=s.join(a,l.name);(await h$1.readFile(d,"utf8")).includes(B)&&(await h$1.remove(d),m.push(p));}for(let l of e.skills){let p=s.join(t,l.canonicalPath);await h$1.ensureDir(s.dirname(p)),await h$1.writeFile(p,l.markdown,"utf8"),r.push(l.canonicalPath);}let k=s.join(t,b$2);await h$1.ensureDir(s.dirname(k)),await h$1.writeJson(k,i,{spaces:2}),r.push(b$2);}return {skills:e.skills,index:i,writtenPaths:r,removedSkillIds:m.sort()}}function Lt(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.workspai/skills/` before generic repo scans. Legacy `.rapidkit/skills/` playbooks are read only when already present from older workspaces:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""].join(`
4
4
  `)}var gr={"workspai-diagnose-api-failure":A,"workspai-release-readiness":E},Je="## Workspace verification (hydrated)";function mr(e){let t=[Je,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx workspai workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
@@ -1 +1 @@
1
- export{b as buildWorkspaceManifest,f as createProject,a as initializeStandaloneGitRepository,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,c as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-FVG5FBA4.js';
1
+ export{b as buildWorkspaceManifest,f as createProject,a as initializeStandaloneGitRepository,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,c as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-5NS322HT.js';
@@ -1 +1 @@
1
- export{d as DOCTOR_WORKSPACE_REPORT_PATH,r as applyEnvKeyAddFix,n as applyFileAppendFix,o as applyFileCopyFix,m as applyFileCreateFix,q as applyJsonEditFix,s as applyMakefileTargetFix,l as applyPackageScriptFix,j as assertOperationPathInsideProject,k as assertOperationPathInsideProjectResolved,i as buildRepairOperationIdentity,u as computeDoctorFixAwareExitCode,t as computeDoctorGateExitCode,p as decodeJsonPointerSegment,h as parseInternalRepairCommand,g as parsePackageScriptFix,f as pythonPackageListProvesDependencies,e as resolveDoctorPolicyProfile,v as runDoctor}from'./chunk-H24MEOML.js';
1
+ export{d as DOCTOR_WORKSPACE_REPORT_PATH,r as applyEnvKeyAddFix,n as applyFileAppendFix,o as applyFileCopyFix,m as applyFileCreateFix,q as applyJsonEditFix,s as applyMakefileTargetFix,l as applyPackageScriptFix,j as assertOperationPathInsideProject,k as assertOperationPathInsideProjectResolved,i as buildRepairOperationIdentity,u as computeDoctorFixAwareExitCode,t as computeDoctorGateExitCode,p as decodeJsonPointerSegment,h as parseInternalRepairCommand,g as parsePackageScriptFix,f as pythonPackageListProvesDependencies,e as resolveDoctorPolicyProfile,v as runDoctor}from'./chunk-NZQKHGPE.js';
@@ -1 +1 @@
1
- import {b}from'./chunk-B6FJ6RG6.js';function c(e){let a=e.runtimeCandidates.length?e.runtimeCandidates.join(", "):e.runtime;return `${e.framework} \xB7 ${a}`}async function p(e){let a=await b([{type:"list",name:"mode",message:"Where should this Goal apply?",choices:[{label:"One project",hint:"Keep the Goal inside one canonical project boundary",value:"project"},{label:"Multiple projects",hint:"Select a bounded cross-project scope",value:"project-set"},{label:"Entire workspace",hint:`Apply the Goal to every project in ${e.workspaceName}`,value:"workspace"}]}]);if(a.mode==="workspace")return {kind:"workspace"};if(a.mode==="project")return {kind:"projects",projects:[(await b([{type:"list",name:"project",message:"Which project should this Goal target?",choices:e.projects.map(o=>({label:o.name,hint:c(o),value:o.name}))}])).project]};let s=await b([{type:"checkbox",name:"projects",message:"Which projects should this Goal target?",choices:e.projects.map(t=>({label:t.name,hint:c(t),value:t.name}))}]);if(s.projects.length<2)throw new Error("Select at least two projects for a multi-project Goal.");return {kind:"projects",projects:s.projects}}async function m(e){let a=new Map(e.runtimes.map(t=>[t,e.projects.filter(o=>o.runtimeCandidates.includes(t)).map(o=>o.name).sort()]));return (await b([{type:"list",name:"runtime",message:"Which canonical runtime should this coverage Goal measure?",choices:e.runtimes.map(t=>({label:t,hint:`Detected in ${a.get(t)?.join(", ")||e.workspaceName}`,value:t}))}])).runtime}export{m as selectGoalCoverageRuntimeInteractively,p as selectGoalScopeInteractively};
1
+ import {b}from'./chunk-6CZQXEZ7.js';function c(e){let a=e.runtimeCandidates.length?e.runtimeCandidates.join(", "):e.runtime;return `${e.framework} \xB7 ${a}`}async function p(e){let a=await b([{type:"list",name:"mode",message:"Where should this Goal apply?",choices:[{label:"One project",hint:"Keep the Goal inside one canonical project boundary",value:"project"},{label:"Multiple projects",hint:"Select a bounded cross-project scope",value:"project-set"},{label:"Entire workspace",hint:`Apply the Goal to every project in ${e.workspaceName}`,value:"workspace"}]}]);if(a.mode==="workspace")return {kind:"workspace"};if(a.mode==="project")return {kind:"projects",projects:[(await b([{type:"list",name:"project",message:"Which project should this Goal target?",choices:e.projects.map(o=>({label:o.name,hint:c(o),value:o.name}))}])).project]};let s=await b([{type:"checkbox",name:"projects",message:"Which projects should this Goal target?",choices:e.projects.map(t=>({label:t.name,hint:c(t),value:t.name}))}]);if(s.projects.length<2)throw new Error("Select at least two projects for a multi-project Goal.");return {kind:"projects",projects:s.projects}}async function m(e){let a=new Map(e.runtimes.map(t=>[t,e.projects.filter(o=>o.runtimeCandidates.includes(t)).map(o=>o.name).sort()]));return (await b([{type:"list",name:"runtime",message:"Which canonical runtime should this coverage Goal measure?",choices:e.runtimes.map(t=>({label:t,hint:`Detected in ${a.get(t)?.join(", ")||e.workspaceName}`,value:t}))}])).runtime}export{m as selectGoalCoverageRuntimeInteractively,p as selectGoalScopeInteractively};
@@ -1 +1 @@
1
- export{f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,k as buildGoalLifecycleResult,l as inspectGoalLifecycle,q as linkGoalChangeTransaction,p as linkGoalRepairTransaction,n as prepareGoalVerification,m as transitionGoalLifecycle,o as verifyGoalLifecycle}from'./chunk-4H3VNKOJ.js';
1
+ export{f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,k as buildGoalLifecycleResult,l as inspectGoalLifecycle,q as linkGoalChangeTransaction,p as linkGoalRepairTransaction,n as prepareGoalVerification,m as transitionGoalLifecycle,o as verifyGoalLifecycle}from'./chunk-FJMUBFXO.js';
@@ -1 +1 @@
1
- export{a as planGoalPack}from'./chunk-BGUCDG5N.js';export{b as GOAL_AGENT_HANDOFF_SCHEMA_VERSION,f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,g as GOAL_LIFECYCLE_RESULT_SCHEMA_VERSION,d as GOAL_PACK_LAST_RUN_PATH,a as GOAL_PACK_SCHEMA_VERSION,c as GOAL_PLAN_RESULT_SCHEMA_VERSION}from'./chunk-4H3VNKOJ.js';
1
+ export{a as planGoalPack}from'./chunk-IF2OWXNY.js';export{b as GOAL_AGENT_HANDOFF_SCHEMA_VERSION,f as GOAL_INDEX_PATH,e as GOAL_INDEX_SCHEMA_VERSION,g as GOAL_LIFECYCLE_RESULT_SCHEMA_VERSION,d as GOAL_PACK_LAST_RUN_PATH,a as GOAL_PACK_SCHEMA_VERSION,c as GOAL_PLAN_RESULT_SCHEMA_VERSION}from'./chunk-FJMUBFXO.js';