workspai 0.65.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -23
- package/contracts/agent-customization-pack.v1.json +4 -2
- package/contracts/analyze-last-run.v1.json +9 -1
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +117 -0
- package/contracts/extension-cli-compatibility.v1.json +6 -0
- package/contracts/published-contract-catalog.v1.json +30 -0
- package/contracts/runtime-command-surface.v1.json +100 -2
- package/contracts/workspace-activity-board.v1.json +114 -0
- package/contracts/workspace-activity-event.v1.json +132 -0
- package/contracts/workspace-activity-monitor-fleet.v1.json +18 -0
- package/contracts/workspace-activity-monitor-snapshot.v1.json +161 -0
- package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
- package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
- package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
- package/contracts/workspace-intelligence/project-context-agent.v1.json +49 -7
- package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
- package/contracts/workspace-intelligence/workspace-intelligence-benchmark.v1.json +196 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +97 -2
- package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
- package/contracts/workspace-intelligence-architecture.v1.json +17 -0
- package/contracts/workspace-intelligence-chain.v1.json +17 -0
- package/dist/analyze-IC2KRVCG.js +1 -0
- package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-GFFHC2ZU.js} +1 -1
- package/dist/autopilot-release-RECEZAZI.js +1 -0
- package/dist/capabilities-command-X4WZIJNR.js +1 -0
- package/dist/chunk-2LIVMG5C.js +2 -0
- package/dist/chunk-2M62CU3O.js +2 -0
- package/dist/chunk-2MTJWPQ4.js +1 -0
- package/dist/chunk-2MVIRJJR.js +1 -0
- package/dist/chunk-2RPFCBS4.js +1 -0
- package/dist/chunk-3O7LZPKA.js +4 -0
- package/dist/chunk-3OGPTLI2.js +1 -0
- package/dist/{chunk-6TBTMWNA.js → chunk-4RV4JVGR.js} +1 -1
- package/dist/{chunk-YYQEWAES.js → chunk-4WVOAX2V.js} +1 -1
- package/dist/{chunk-N4QQADXX.js → chunk-5EVDW7JM.js} +1 -1
- package/dist/{chunk-J3X56S7L.js → chunk-5ME4W4LN.js} +1 -1
- package/dist/chunk-5OA33JH2.js +2 -0
- package/dist/chunk-5TY74LLW.js +2 -0
- package/dist/chunk-6254CWUY.js +49 -0
- package/dist/{chunk-D5YJOQYK.js → chunk-6E2Y3XGT.js} +1 -1
- package/dist/chunk-ARUFY5W3.js +1 -0
- package/dist/chunk-B4IVVTMQ.js +2 -0
- package/dist/{chunk-HDNATYW7.js → chunk-BHFRP7TV.js} +1 -1
- package/dist/{chunk-KTN2ARZJ.js → chunk-BHM6RHTA.js} +3 -3
- package/dist/chunk-BRYJTW6S.js +2 -0
- package/dist/{chunk-HCFWT42C.js → chunk-BUYLM6QV.js} +1 -1
- package/dist/chunk-CPR2CMOY.js +1 -0
- package/dist/{chunk-XGE2FDI4.js → chunk-CZVT7T2X.js} +1 -1
- package/dist/chunk-EHCKITR4.js +2 -0
- package/dist/chunk-ENZPM52J.js +1 -0
- package/dist/chunk-FPDH3N3A.js +7 -0
- package/dist/{chunk-PXWKMPPI.js → chunk-FX5J6JCK.js} +1 -1
- package/dist/chunk-FY4X2VOE.js +39 -0
- package/dist/chunk-GIQ4SDRJ.js +1 -0
- package/dist/chunk-H77ZNH5O.js +1 -0
- package/dist/{chunk-2RL6RRT2.js → chunk-HQLBO23O.js} +50 -50
- package/dist/chunk-HYE5UHPV.js +2 -0
- package/dist/{chunk-D65FCQIO.js → chunk-IKUFNK46.js} +1 -1
- package/dist/{chunk-WRQWVSBJ.js → chunk-IQQMFRWM.js} +1 -1
- package/dist/chunk-JCGSIDMC.js +2 -0
- package/dist/chunk-KENOAC2Q.js +13 -0
- package/dist/chunk-KQ2TMI26.js +97 -0
- package/dist/chunk-L5Q2S5GY.js +3 -0
- package/dist/chunk-LPCZHKD5.js +1 -0
- package/dist/chunk-N4QFNOAI.js +1 -0
- package/dist/chunk-NMXGSVMD.js +1 -0
- package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
- package/dist/{chunk-W6FHVXNL.js → chunk-OCNPOYMA.js} +1 -1
- package/dist/chunk-PSYQ6IJA.js +12 -0
- package/dist/{chunk-VRGEPPUB.js → chunk-QMQBX3RV.js} +1 -1
- package/dist/{chunk-YUGKQ44M.js → chunk-SLFOUSRW.js} +1 -1
- package/dist/chunk-SRLWHOLF.js +1 -0
- package/dist/chunk-SVYY55IS.js +157 -0
- package/dist/chunk-SX6A656X.js +1 -0
- package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
- package/dist/chunk-THIG2YQP.js +681 -0
- package/dist/chunk-TP7VKEUF.js +1 -0
- package/dist/chunk-U5ENEDJA.js +7 -0
- package/dist/chunk-UTV4DTNM.js +1 -0
- package/dist/chunk-VI4ZRAY6.js +1 -0
- package/dist/chunk-VQZ5PI5J.js +1 -0
- package/dist/chunk-VWBMDGPY.js +9 -0
- package/dist/chunk-XDPTAV2T.js +2 -0
- package/dist/chunk-XWKGZRHN.js +1 -0
- package/dist/chunk-Y35VLVF6.js +5 -0
- package/dist/{chunk-VYDURWN7.js → chunk-Y4Z6CEII.js} +1 -1
- package/dist/chunk-YYY2WXOH.js +1 -0
- package/dist/chunk-ZGHJIQXL.js +1 -0
- package/dist/chunk-ZI2E7P6O.js +4 -0
- package/dist/{create-ALT2ME6H.js → create-72ITVZXV.js} +1 -1
- package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
- package/dist/{doctor-RW4R3O5C.js → doctor-CVYUESRQ.js} +1 -1
- package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
- package/dist/{goal-lifecycle-VYOKS6E6.js → goal-lifecycle-H55AGFCB.js} +1 -1
- package/dist/goal-pack-6OBZOPCD.js +1 -0
- package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
- package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +177 -177
- package/dist/live-command-5VXPR43F.js +15 -0
- package/dist/{pipeline-U4N2DVD7.js → pipeline-SKYOXWHW.js} +1 -1
- package/dist/{project-agent-entry-YAQCHIMP.js → project-agent-entry-5IUBEREI.js} +1 -1
- package/dist/project-intelligence-lens-LQCN65P2.js +1 -0
- package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-KD4LLFGV.js} +1 -1
- package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
- package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
- package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
- package/dist/verified-goal-HN7G532B.js +1 -0
- package/dist/{workspace-HGUZWNAB.js → workspace-5W7FYGDQ.js} +1 -1
- package/dist/{workspace-agent-sync-GEN3KBAX.js → workspace-agent-sync-OZCDQORK.js} +1 -1
- package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-NOSGRKRZ.js} +1 -1
- package/dist/{workspace-context-4WIWFW26.js → workspace-context-L65BR5L6.js} +1 -1
- package/dist/{workspace-contract-7DXK4GF5.js → workspace-contract-JYHNEJPV.js} +1 -1
- package/dist/workspace-explain-SUBK6FLO.js +1 -0
- package/dist/workspace-explain-contract-WMREJWHF.js +1 -0
- package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-MWGCT5R2.js} +1 -1
- package/dist/{workspace-foundation-J3NNRMI3.js → workspace-foundation-VIB3PXNH.js} +1 -1
- package/dist/{workspace-graph-stream-PQI7OGCE.js → workspace-graph-stream-45JHE4MG.js} +1 -1
- package/dist/workspace-graph-token-efficiency-NPECU6Y5.js +1 -0
- package/dist/{workspace-history-SYCDK7FO.js → workspace-history-JKW3VJO3.js} +1 -1
- package/dist/{workspace-intelligence-6FS26JOQ.js → workspace-intelligence-3C47PK4L.js} +1 -1
- package/dist/workspace-intelligence-benchmark-SRDIHX3X.js +1 -0
- package/dist/workspace-intelligence-evaluation-OJIQS5SN.js +1 -0
- package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-OWN5ZI6W.js} +1 -1
- package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-UKFB3BI7.js} +1 -1
- package/dist/workspace-knowledge-graph-AKG5NUU6.js +1 -0
- package/dist/{workspace-knowledge-graph-contract-L3CLAM2M.js → workspace-knowledge-graph-contract-X52KXBXJ.js} +1 -1
- package/dist/{workspace-knowledge-graph-query-FZXSPWGK.js → workspace-knowledge-graph-query-DXA4CROE.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-SNI5K2RL.js +1 -0
- package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
- package/dist/workspace-mcp-serve-PK226GMV.js +3 -0
- package/dist/workspace-model-R4ISKDB2.js +1 -0
- package/dist/{workspace-onboarding-X3PWRIIS.js → workspace-onboarding-Y5RPEFUD.js} +1 -1
- package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
- package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-PL5V3UDH.js} +2 -2
- package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-STGUGROG.js} +1 -1
- package/dist/workspace-repair-engine-FNLL5ZDK.js +3 -0
- package/dist/workspace-run-GFBFGUFM.js +1 -0
- package/dist/{workspace-verify-USRRIM2F.js → workspace-verify-AXVX3PF3.js} +1 -1
- package/dist/{workspace-watch-43YZPLF7.js → workspace-watch-RLBEJKXE.js} +1 -1
- package/docs/DEVELOPMENT.md +19 -0
- package/docs/README.md +19 -16
- package/docs/SETUP.md +10 -0
- package/docs/agent-entry.md +22 -7
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +58 -8
- package/docs/contracts/ARTIFACT_CATALOG.md +64 -44
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
- package/docs/contracts/README.md +7 -3
- package/docs/real-world-qualification.md +19 -3
- package/docs/workspace-intelligence-benchmark.md +82 -0
- package/docs/workspace-knowledge-graph.md +95 -27
- package/docs/workspace-live-activity.md +209 -0
- package/docs/workspace-operations.md +32 -9
- package/package.json +4 -2
- package/dist/analyze-5PDVWECJ.js +0 -1
- package/dist/autopilot-release-JVIJCTKX.js +0 -1
- package/dist/capabilities-command-LHM3XIS6.js +0 -1
- package/dist/chunk-2647BYBC.js +0 -1
- package/dist/chunk-27UR373Z.js +0 -1
- package/dist/chunk-2C5ZBVBI.js +0 -2
- package/dist/chunk-6JWNDWOA.js +0 -1
- package/dist/chunk-CCDGHPEJ.js +0 -2
- package/dist/chunk-DFG33SBR.js +0 -2
- package/dist/chunk-FY4IIAIF.js +0 -1
- package/dist/chunk-HEZZ72V4.js +0 -94
- package/dist/chunk-HN7P4T3B.js +0 -681
- package/dist/chunk-ILIBOMYL.js +0 -1
- package/dist/chunk-J7QYANXK.js +0 -8
- package/dist/chunk-JD3A5QM6.js +0 -2
- package/dist/chunk-JQLJBK5N.js +0 -1
- package/dist/chunk-KLSSPJTV.js +0 -1
- package/dist/chunk-L22EABIC.js +0 -7
- package/dist/chunk-LNXIMF3O.js +0 -1
- package/dist/chunk-MDTI3UEB.js +0 -1
- package/dist/chunk-MOSXTVPU.js +0 -1
- package/dist/chunk-MYJQGGIU.js +0 -5
- package/dist/chunk-NOV6723U.js +0 -1
- package/dist/chunk-NYEAMMUL.js +0 -1
- package/dist/chunk-NZ3WZYD5.js +0 -1
- package/dist/chunk-O5B2L3R2.js +0 -1
- package/dist/chunk-OWB5KWSS.js +0 -13
- package/dist/chunk-P5PSZQPB.js +0 -2
- package/dist/chunk-QCKWQFCD.js +0 -1
- package/dist/chunk-QI3HG6IG.js +0 -144
- package/dist/chunk-SWGSFLTC.js +0 -1
- package/dist/chunk-THIOE2PB.js +0 -2
- package/dist/chunk-U5FCQTVL.js +0 -4
- package/dist/chunk-UXEO5QCF.js +0 -33
- package/dist/chunk-VR6XMUF3.js +0 -2
- package/dist/chunk-VVJK5NFY.js +0 -2
- package/dist/chunk-VXKWWX7S.js +0 -8
- package/dist/chunk-W322YDHS.js +0 -49
- package/dist/chunk-WPRLXKWC.js +0 -8
- package/dist/chunk-Y5YAP4F3.js +0 -2
- package/dist/chunk-YN5X2FTP.js +0 -1
- package/dist/chunk-YOCN7GF4.js +0 -1
- package/dist/goal-pack-YWPI43QL.js +0 -1
- package/dist/project-intelligence-lens-MRQR2LQW.js +0 -1
- package/dist/verified-goal-WM34TTGE.js +0 -1
- package/dist/workspace-explain-TE2LGOAV.js +0 -1
- package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
- package/dist/workspace-graph-token-efficiency-2I4X374C.js +0 -1
- package/dist/workspace-intelligence-evaluation-CQDKOYZZ.js +0 -1
- package/dist/workspace-knowledge-graph-SWCKDTPF.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-M572JRB4.js +0 -1
- package/dist/workspace-mcp-serve-IBMTFQDY.js +0 -3
- package/dist/workspace-model-ZL6WCICX.js +0 -1
- package/dist/workspace-repair-engine-NX7I632M.js +0 -3
- package/dist/workspace-run-6GT5OBQ5.js +0 -1
package/dist/chunk-ILIBOMYL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b,e,a as a$1}from'./chunk-VR6XMUF3.js';import {b as b$1,a}from'./chunk-UJXE4UAX.js';import {randomUUID}from'crypto';var i=null;function f(){return i}function V(t){let r=t.argv??process.argv,n=m(r.slice(2)),e$1={runId:randomUUID(),startedAt:new Date().toISOString(),command:n,cwd:t.cwd??process.cwd(),rapidkitVersion:t.rapidkitVersion,finalized:false};return i=e$1,b(e$1.runId),b$1(r)&&e(l(e$1,"run.started","info","CLI run started")),e$1}function A(t,r){if(!(!i||i.finalized)){if(i.finalized=true,!b$1()){i=null;return}t===0?e(l(i,"run.completed","info",r??"CLI run completed",{exitCode:t})):e(l(i,"run.failed","error",r??"CLI run failed",{exitCode:t})),i=null;}}function w(t=process.argv){a(t)==="json"&&(process.env.WORKSPAI_LOG_FORMAT="json",process.env.RAPIDKIT_LOG_FORMAT="json");let r=t.slice(0,2),n=m(t.slice(2));n.length!==t.length-2&&(process.argv=[...r,...n]);}function m(t){let r=[];for(let n=0;n<t.length;n+=1){let e=t[n];if(e!=="--log-json"){if(e==="--log-format"){n+=1;continue}e.startsWith("--log-format=")||r.push(e);}}return r}function l(t,r,n,e,o){return {schemaVersion:a$1,runId:t.runId,timestamp:new Date().toISOString(),level:n,event:r,component:"cli",message:e,command:t.command,metadata:{cwd:t.cwd,rapidkitVersion:t.rapidkitVersion,startedAt:t.startedAt,...o}}}var g=false;function L(t){if(g||!t?.force&&(process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"))return;g=true;let r=process.exit.bind(process);process.exit=(n=>{let e=typeof n=="number"?n:typeof n=="string"?Number.parseInt(n,10):0,o=Number.isFinite(e)?e:1;return A(o),r(n)});}function h(){return f()?.runId}function y(t,r){let{blockers:n,stderrTail:e,runId:o,generatedAt:p,...C}=r,x=p||(typeof t.generatedAt=="string"?t.generatedAt:void 0)||(typeof t.timestamp=="string"?t.timestamp:void 0)||new Date().toISOString();return {...t,...C,generatedAt:x,...n&&n.length>0?{blockers:n}:{},...e&&e.trim()?{stderrTail:e.trim()}:{},...o?{runId:o}:{}}}export{V as a,A as b,w as c,L as d,h as e,y as f};
|
package/dist/chunk-J7QYANXK.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-GR6442P7.js';import {t,u as u$1}from'./chunk-MOSXTVPU.js';import m from'fs';import u from'path';import E from'fs-extra';var ge=[{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,workspacePythonEngine:"required",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,workspacePythonEngine:"required",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,workspacePythonEngine:"optional",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,workspacePythonEngine:"none",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,workspacePythonEngine:"none",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,workspacePythonEngine:"none",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,workspacePythonEngine:"none",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,workspacePythonEngine:"none",stability:"preview",versionPolicy:"tested-baseline",generator:"rust-axum",createUsage:"workspai create project rust.axum <name> [--port <number>] [--output <dir>] [--skip-git]"}],V=new Map;for(let e of ge){V.set(e.id.toLowerCase(),e);for(let t of e.aliases)V.set(t.toLowerCase(),e);}function W(e){return e?V.get(e.trim().toLowerCase())??null:null}function Ht(e){return W(e)?.id??e}function Ut(){return ge.filter(e=>e.owner==="core"||e.generator)}function Wt(e){return W(e)?.owner==="npm"}async function $t(e,t){if(!e.generator)throw new Error(`Kit is not backed by an npm generator: ${e.id}`);if(e.generator==="gofiber"){let{generateGoFiberKit:n}=await import('./gofiber-standard-47S2GYAO.js');await n(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="gogin"){let{generateGoGinKit:n}=await import('./gogin-standard-EWB4XNOI.js');await n(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="springboot"){let{generateSpringBootKit:n}=await import('./springboot-standard-Y5ADLZMQ.js');await n(t.projectPath,{project_name:t.projectName,artifact_id:t.projectName,java_version:b(t.args,"--java-version")?.trim(),spring_boot_version:b(t.args,"--spring-boot-version")?.trim(),springdoc_version:b(t.args,"--springdoc-version")?.trim(),group_id:b(t.args,"--group-id")?.trim(),package_name:b(t.args,"--package-name")?.trim(),description:b(t.args,"--description")?.trim(),port:b(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="dotnet-webapi-clean"){let{generateDotnetWebApiCleanKit:n}=await import('./dotnet-webapi-clean-AVHPJG7Y.js');await n(t.projectPath,{project_name:t.projectName,target_framework:b(t.args,"--target-framework")?.trim(),root_namespace:b(t.args,"--root-namespace")?.trim(),description:b(t.args,"--description")?.trim(),port:b(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="rust-axum"){let{generateRustAxumKit:n}=await import('./rust-axum-M5X4ZC4Z.js');await n(t.projectPath,{project_name:t.projectName,description:b(t.args,"--description")?.trim(),port:b(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}throw new Error(`Unhandled npm kit generator: ${e.generator}`)}function b(e,t){let n=e.indexOf(t);if(n>=0&&n+1<e.length)return e[n+1];let r=e.find(i=>i.startsWith(`${t}=`));return r?r.slice(t.length+1):void 0}var P={nextjs:{key:"nextjs",runtime:"node",displayName:"Next.js",supportTier:"extended",importStack:"nextjs",aliases:["next","nextjs","next.js"],dependencyHints:["next"],scriptHints:["next dev","next build","next start"],fileHints:["next.config.js","next.config.mjs","next.config.ts"]},remix:{key:"remix",runtime:"node",displayName:"Remix",supportTier:"extended",importStack:"remix",aliases:["remix"],dependencyHints:["@remix-run/react","@remix-run/node","@remix-run/dev"],scriptHints:["remix dev","remix vite:dev"],fileHints:["remix.config.js","remix.config.mjs"]},nuxt:{key:"nuxt",runtime:"node",displayName:"Nuxt",supportTier:"extended",importStack:"nuxt",aliases:["nuxt","nuxtjs","nuxt.js"],dependencyHints:["nuxt","nuxt3"],scriptHints:["nuxt dev","nuxt build","nuxi dev","nuxi build"],fileHints:["nuxt.config.js","nuxt.config.ts","nuxt.config.mjs"]},react:{key:"react",runtime:"node",displayName:"React",supportTier:"extended",importStack:"react",aliases:["react"],dependencyHints:["react","react-dom"],scriptHints:["react-scripts start","react-scripts build"],fileHints:[]},vite:{key:"vite",runtime:"node",displayName:"Vite",supportTier:"extended",importStack:"vite",aliases:["vite"],dependencyHints:["vite"],scriptHints:["vite","vite dev","vite build"],fileHints:["vite.config.js","vite.config.ts","vite.config.mjs"]},vue:{key:"vue",runtime:"node",displayName:"Vue",supportTier:"extended",importStack:"vue",aliases:["vue","vuejs","vue.js"],dependencyHints:["vue","@vue/cli-service"],scriptHints:["vue-cli-service serve","vue-cli-service build"],fileHints:["vue.config.js"]},sveltekit:{key:"sveltekit",runtime:"node",displayName:"SvelteKit",supportTier:"extended",importStack:"sveltekit",aliases:["sveltekit","svelte-kit"],dependencyHints:["@sveltejs/kit"],scriptHints:["svelte-kit dev","svelte-kit build"],fileHints:["svelte.config.js"]},svelte:{key:"svelte",runtime:"node",displayName:"Svelte",supportTier:"extended",importStack:"svelte",aliases:["svelte"],dependencyHints:["svelte"],scriptHints:["svelte"],fileHints:[]},angular:{key:"angular",runtime:"node",displayName:"Angular",supportTier:"extended",importStack:"angular",aliases:["angular","@angular/core"],dependencyHints:["@angular/core","@angular/cli"],scriptHints:["ng serve","ng build"],fileHints:["angular.json"]},astro:{key:"astro",runtime:"node",displayName:"Astro",supportTier:"extended",importStack:"astro",aliases:["astro"],dependencyHints:["astro"],scriptHints:["astro dev","astro build"],fileHints:["astro.config.js","astro.config.ts","astro.config.mjs"]},solid:{key:"solid",runtime:"node",displayName:"Solid",supportTier:"extended",importStack:"solid",aliases:["solid","solidjs","solid-js"],dependencyHints:["solid-js"],scriptHints:[],fileHints:[]},unknown:{key:"unknown",runtime:"unknown",displayName:"Unknown frontend",supportTier:"observed",importStack:"unknown",aliases:["unknown"],dependencyHints:[],scriptHints:[],fileHints:[]}},We={nextjs:{dev:["dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},remix:{dev:["dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},nuxt:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},react:{dev:["dev","start"],start:["serve"],build:["build"],test:["test"],lint:["lint"],format:["format"]},vite:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},vue:{dev:["dev","serve"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},sveltekit:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},svelte:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},angular:{dev:["start","serve"],start:["serve"],build:["build"],test:["test"],lint:["lint"],format:["format"]},astro:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},solid:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]}};function Q(e,t){let n=typeof e=="string"?A(e):e;return n==="unknown"?[]:We[n]?.[t]??[]}function $e(e){try{return m.existsSync(e)?JSON.parse(m.readFileSync(e,"utf8")):null}catch{return null}}function qe(e){let t=$e(u.join(e,"package.json"));if(!t)return {dependencies:{},scriptText:""};let n={...t.dependencies??{},...t.devDependencies??{},...t.peerDependencies??{}},r=t.scripts??{},i=Object.values(r).filter(a=>typeof a=="string").join(" ").toLowerCase();return {dependencies:n,scriptText:i}}function Je(e,t){return t.some(n=>m.existsSync(u.join(e,n)))}function ye(e){return e.vite?e.react||e["react-dom"]||e["@vitejs/plugin-react"]?"react":e.vue||e["@vitejs/plugin-vue"]?"vue":e.svelte||e["@sveltejs/vite-plugin-svelte"]?"svelte":e["solid-js"]||e["vite-plugin-solid"]?"solid":null:null}function T(e,t,n){let r=P[e]??P.unknown;return {key:r.key,runtime:r.runtime,displayName:r.displayName,supportTier:r.supportTier,importStack:r.importStack,confidence:t,source:n}}function Vt(e){return P[e]??P.unknown}function A(e){let t=(e??"").trim().toLowerCase().replace(/[_\s]+/g,"-");if(!t)return "unknown";for(let n of Object.values(P))if(n.aliases.includes(t))return n.key;return "unknown"}function xe(e,t){let n=A(typeof t?.framework=="string"?t.framework:typeof t?.kit_name=="string"?t.kit_name:typeof t?.kit=="string"?t.kit:void 0);if(n!=="unknown")return T(n,"high","framework");let{dependencies:r,scriptText:i}=qe(e);for(let a of ["nextjs","remix","nuxt","sveltekit","angular","astro","vue","solid","vite","react","svelte"]){let c=P[a];if(c.dependencyHints.some(d=>r[d])){if(a==="vite"){let d=ye(r);if(d)return T(d,"high","manifest")}return T(a,"high","manifest")}if(c.fileHints.length>0&&Je(e,c.fileHints)){if(a==="vite"){let d=ye(r);if(d)return T(d,"high","manifest")}return T(a,"high","manifest")}if(c.scriptHints.some(d=>i.includes(d)))return T(a,"medium","manifest")}return T("unknown","low","unknown")}var D={fastapi:{key:"fastapi",runtime:"python",displayName:"FastAPI",supportTier:"first-class",importStack:"fastapi",aliases:["fastapi"],kitPrefixes:["fastapi"]},django:{key:"django",runtime:"python",displayName:"Django",supportTier:"extended",importStack:"django",aliases:["django"]},flask:{key:"flask",runtime:"python",displayName:"Flask",supportTier:"extended",importStack:"flask",aliases:["flask"]},python:{key:"python",runtime:"python",displayName:"Python",supportTier:"observed",importStack:"unknown",aliases:["python"]},nestjs:{key:"nestjs",runtime:"node",displayName:"NestJS",supportTier:"first-class",importStack:"nestjs",aliases:["nestjs","nest"],kitPrefixes:["nestjs"]},nextjs:{key:"nextjs",runtime:"node",displayName:"Next.js",supportTier:"extended",importStack:"nextjs",aliases:["nextjs","next.js","next"]},remix:{key:"remix",runtime:"node",displayName:"Remix",supportTier:"extended",importStack:"remix",aliases:["remix"]},nuxt:{key:"nuxt",runtime:"node",displayName:"Nuxt",supportTier:"extended",importStack:"nuxt",aliases:["nuxt","nuxtjs","nuxt.js"]},react:{key:"react",runtime:"node",displayName:"React",supportTier:"extended",importStack:"react",aliases:["react"]},vite:{key:"vite",runtime:"node",displayName:"Vite",supportTier:"extended",importStack:"vite",aliases:["vite"]},vue:{key:"vue",runtime:"node",displayName:"Vue",supportTier:"extended",importStack:"vue",aliases:["vue","vuejs","vue.js"]},sveltekit:{key:"sveltekit",runtime:"node",displayName:"SvelteKit",supportTier:"extended",importStack:"sveltekit",aliases:["sveltekit","svelte-kit"]},svelte:{key:"svelte",runtime:"node",displayName:"Svelte",supportTier:"extended",importStack:"svelte",aliases:["svelte"]},angular:{key:"angular",runtime:"node",displayName:"Angular",supportTier:"extended",importStack:"angular",aliases:["angular","@angular/core"]},astro:{key:"astro",runtime:"node",displayName:"Astro",supportTier:"extended",importStack:"astro",aliases:["astro"]},solid:{key:"solid",runtime:"node",displayName:"Solid",supportTier:"extended",importStack:"solid",aliases:["solid","solidjs","solid-js"]},express:{key:"express",runtime:"node",displayName:"Express",supportTier:"extended",importStack:"express",aliases:["express"]},fastify:{key:"fastify",runtime:"node",displayName:"Fastify",supportTier:"extended",importStack:"unknown",aliases:["fastify"]},koa:{key:"koa",runtime:"node",displayName:"Koa",supportTier:"extended",importStack:"koa",aliases:["koa"]},node:{key:"node",runtime:"node",displayName:"Node.js",supportTier:"observed",importStack:"unknown",aliases:["node","nodejs","typescript","javascript"]},gofiber:{key:"gofiber",runtime:"go",displayName:"Go/Fiber",supportTier:"extended",importStack:"go",aliases:["gofiber","fiber","go-fiber","go/fiber"],kitPrefixes:["gofiber"]},gogin:{key:"gogin",runtime:"go",displayName:"Go/Gin",supportTier:"extended",importStack:"go",aliases:["gogin","gin","go-gin","go/gin"],kitPrefixes:["gogin"]},echo:{key:"echo",runtime:"go",displayName:"Echo",supportTier:"extended",importStack:"go",aliases:["echo"]},go:{key:"go",runtime:"go",displayName:"Go",supportTier:"observed",importStack:"go",aliases:["go","golang"],kitPrefixes:["go"]},springboot:{key:"springboot",runtime:"java",displayName:"Spring Boot",supportTier:"extended",importStack:"springboot",aliases:["springboot","spring","spring-boot"],kitPrefixes:["springboot"]},java:{key:"java",runtime:"java",displayName:"Java",supportTier:"observed",importStack:"unknown",aliases:["java"]},laravel:{key:"laravel",runtime:"php",displayName:"Laravel",supportTier:"extended",importStack:"unknown",aliases:["laravel"]},symfony:{key:"symfony",runtime:"php",displayName:"Symfony",supportTier:"extended",importStack:"unknown",aliases:["symfony"]},php:{key:"php",runtime:"php",displayName:"PHP",supportTier:"observed",importStack:"unknown",aliases:["php"]},rails:{key:"rails",runtime:"ruby",displayName:"Ruby on Rails",supportTier:"extended",importStack:"rails",aliases:["rails","ruby-on-rails","ruby on rails"]},sinatra:{key:"sinatra",runtime:"ruby",displayName:"Sinatra",supportTier:"extended",importStack:"unknown",aliases:["sinatra"]},ruby:{key:"ruby",runtime:"ruby",displayName:"Ruby",supportTier:"observed",importStack:"unknown",aliases:["ruby"]},dotnet:{key:"dotnet",runtime:"dotnet",displayName:"ASP.NET Core",supportTier:"extended",importStack:"dotnet",aliases:["dotnet","asp.net","aspnet","asp.net core","csharp","c#"],kitPrefixes:["dotnet","aspnet","aspnetcore"]},actix:{key:"actix",runtime:"rust",displayName:"Actix-web",supportTier:"extended",importStack:"unknown",aliases:["actix","actix-web"]},axum:{key:"axum",runtime:"rust",displayName:"Axum",supportTier:"extended",importStack:"unknown",aliases:["axum"]},rocket:{key:"rocket",runtime:"rust",displayName:"Rocket",supportTier:"extended",importStack:"unknown",aliases:["rocket"]},rust:{key:"rust",runtime:"rust",displayName:"Rust",supportTier:"observed",importStack:"unknown",aliases:["rust"]},phoenix:{key:"phoenix",runtime:"elixir",displayName:"Phoenix",supportTier:"extended",importStack:"unknown",aliases:["phoenix"]},elixir:{key:"elixir",runtime:"elixir",displayName:"Elixir",supportTier:"observed",importStack:"unknown",aliases:["elixir"]},clojure:{key:"clojure",runtime:"clojure",displayName:"Clojure",supportTier:"extended",importStack:"unknown",aliases:["clojure"]},scala:{key:"scala",runtime:"scala",displayName:"Scala",supportTier:"extended",importStack:"unknown",aliases:["scala"]},kotlin:{key:"kotlin",runtime:"kotlin",displayName:"Kotlin",supportTier:"extended",importStack:"unknown",aliases:["kotlin"]},deno:{key:"deno",runtime:"deno",displayName:"Deno",supportTier:"extended",importStack:"unknown",aliases:["deno"]},bun:{key:"bun",runtime:"bun",displayName:"Bun",supportTier:"extended",importStack:"unknown",aliases:["bun"]},tauri:{key:"tauri",runtime:"node",displayName:"Tauri",supportTier:"extended",importStack:"unknown",aliases:["tauri","tauri-app"],kitPrefixes:["desktop.tauri"]},electron:{key:"electron",runtime:"node",displayName:"Electron",supportTier:"extended",importStack:"unknown",aliases:["electron","electron-forge"],kitPrefixes:["desktop.electron"]},"vscode-extension":{key:"vscode-extension",runtime:"node",displayName:"VS Code Extension",supportTier:"extended",importStack:"unknown",aliases:["vscode-extension","visual-studio-code-extension"],kitPrefixes:["extension.vscode"]},c:{key:"c",runtime:"c",displayName:"C",supportTier:"observed",importStack:"unknown",aliases:["c","clang","gcc"]},cpp:{key:"cpp",runtime:"cpp",displayName:"C++",supportTier:"observed",importStack:"unknown",aliases:["cpp","c++","cplusplus","cc","clang++","g++"]},unknown:{key:"unknown",runtime:"unknown",displayName:"Unknown",supportTier:"observed",importStack:"unknown",aliases:["unknown"]}},Se=new Map;for(let e of Object.values(D))for(let t of e.aliases)Se.set(t,e.key);function o(e,t,n){let r=D[e]??D.unknown;return {key:r.key,runtime:r.runtime,displayName:r.displayName,supportTier:r.supportTier,importStack:r.importStack,confidence:t,source:n}}function ve(e){return e.trim().toLowerCase().replace(/[_\s]+/g,"-")}function g(e){try{return m.existsSync(e)?m.readFileSync(e,"utf8").toLowerCase():""}catch{return ""}}function Ce(e){try{return m.existsSync(e)?JSON.parse(m.readFileSync(e,"utf8")):null}catch{return null}}var Ye=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","venv","node_modules","vendor","dist","build","target","coverage",".next",".cache","test","tests","spec","specs","testdata","fixtures","__fixtures__"]);function Z(e,t){if(t<0||!m.existsSync(e))return [];let n=[],r=[];try{r=m.readdirSync(e,{withFileTypes:true});}catch{return []}for(let i of r){let a=u.join(e,i.name);i.isDirectory()?n.push(...Z(a,t-1)):n.push(a);}return n}function he(e,t){if(t<0||!m.existsSync(e))return [];let n=[];try{n=m.readdirSync(e,{withFileTypes:true});}catch{return []}let r=[];for(let i of n){let a$1=u.join(e,i.name);if(i.isDirectory()){if(Ye.has(i.name)||a(i.name))continue;r.push(...he(a$1,t-1));}else r.push(a$1);}return r}function y(e,t,n=2){return Z(e,n).some(r=>r.toLowerCase().endsWith(t.toLowerCase()))}function we(e,t,n=2){return Z(e,n).filter(r=>r.toLowerCase().endsWith(t.toLowerCase()))}function ze(e){let t=ve(e??"");if(!t)return "unknown";for(let n of Object.values(D))if(n.kitPrefixes?.some(r=>t.startsWith(r)))return n.key;return "unknown"}function L(e){return e?Se.get(ve(e))??"unknown":"unknown"}function rn(e){return L(e)}function on(e){let t=L(e);return t!=="unknown"?D[t].runtime:"unknown"}function O(e){let t=ze(e.kitName);if(t!=="unknown")return o(t,"high","kit");let n=L(e.framework);if(n!=="unknown")return o(n,"high","framework");let r=L(e.runtime);return r!=="unknown"?o(r,"medium","runtime"):o("unknown","low","unknown")}function Ve(e){let t=Ce(u.join(e,"package.json"));if(!t)return o("unknown","low","unknown");let n={...t.dependencies??{},...t.devDependencies??{}},r=t.scripts??{},i=Object.values(r).filter(a=>typeof a=="string").join(" ").toLowerCase();return n["@nestjs/core"]||i.includes("nest start")?o("nestjs","high","manifest"):n.express?o("express","high","manifest"):n.fastify?o("fastify","high","manifest"):n.koa?o("koa","high","manifest"):o("node","medium","marker")}function Xe(e){let t=Ce(u.join(e,"package.json"));if(!t)return o("unknown","low","unknown");let n={...t.dependencies??{},...t.devDependencies??{}},r=t.engines??{},i=t.scripts??{},a=Object.values(i).filter(c=>typeof c=="string").join(" ").toLowerCase();return n["@tauri-apps/api"]||n["@tauri-apps/cli"]||m.existsSync(u.join(e,"src-tauri","Cargo.toml"))?o("tauri","high","manifest"):n.electron||n["@electron-forge/cli"]||a.includes("electron-forge")||a.includes("electron ")?o("electron","high","manifest"):typeof r.vscode=="string"&&(t.activationEvents!==void 0||t.contributes!==void 0)?o("vscode-extension","high","manifest"):o("unknown","low","unknown")}function Qe(e){let t=[g(u.join(e,"pyproject.toml")),g(u.join(e,"requirements.txt")),g(u.join(e,"requirements.in"))].join(`
|
|
2
|
-
`);return t.includes("fastapi")?o("fastapi","high","manifest"):t.includes("django")?o("django","high","manifest"):t.includes("flask")?o("flask","high","manifest"):t.trim()?o("python","medium","marker"):o("unknown","low","unknown")}function Ze(e){let t=g(u.join(e,"go.mod")),n=g(u.join(e,"main.go")),r=[t,n].join(`
|
|
3
|
-
`);return r.includes("github.com/gofiber/fiber")?o("gofiber","high","manifest"):r.includes("github.com/gin-gonic/gin")?o("gogin","high","manifest"):r.includes("github.com/labstack/echo")?o("echo","high","manifest"):t.trim()?o("go","high","manifest"):n.trim()?o("go","medium","marker"):o("unknown","low","unknown")}function et(e){let t=[g(u.join(e,"pom.xml")),g(u.join(e,"build.gradle")),g(u.join(e,"build.gradle.kts"))].join(`
|
|
4
|
-
`);return t.includes("spring-boot")||t.includes("org.springframework")?o("springboot","high","manifest"):t.trim()?o("java","medium","marker"):o("unknown","low","unknown")}function tt(e){let t=g(u.join(e,"composer.json"));return t.includes("laravel/framework")?o("laravel","high","manifest"):t.includes("symfony/")?o("symfony","high","manifest"):t.trim()?o("php","medium","marker"):o("unknown","low","unknown")}function nt(e){let t=g(u.join(e,"Gemfile"));return t.includes("gem 'rails'")||t.includes('gem "rails"')?o("rails","high","manifest"):t.includes("gem 'sinatra'")||t.includes('gem "sinatra"')?o("sinatra","high","manifest"):t.trim()?o("ruby","medium","marker"):o("unknown","low","unknown")}function rt(e){let n=[...we(e,".csproj",3),...we(e,".sln",2)].map(r=>g(r)).join(`
|
|
5
|
-
`);return n.includes("microsoft.net.sdk.web")||n.includes("microsoft.aspnetcore")||n.includes("swashbuckle.aspnetcore")?o("dotnet","high","manifest"):n.trim()?o("dotnet","medium","marker"):o("unknown","low","unknown")}function it(e){let t=g(u.join(e,"Cargo.toml"));return t.includes("actix-web")?o("actix","high","manifest"):t.includes("axum")?o("axum","high","manifest"):t.includes("rocket")?o("rocket","high","manifest"):t.trim()?o("rust","medium","marker"):o("unknown","low","unknown")}function ot(e){let t=g(u.join(e,"mix.exs"));return t.includes("phoenix")?o("phoenix","high","manifest"):t.trim()?o("elixir","medium","marker"):o("unknown","low","unknown")}function ee(e){let t=[],n=r=>{t.includes(r)||t.push(r);};return m.existsSync(u.join(e,"go.mod"))&&n("go"),(m.existsSync(u.join(e,"Cargo.toml"))||m.existsSync(u.join(e,"src-tauri","Cargo.toml")))&&n("rust"),(m.existsSync(u.join(e,"pom.xml"))||m.existsSync(u.join(e,"build.gradle"))||m.existsSync(u.join(e,"build.gradle.kts")))&&n("java"),m.existsSync(u.join(e,"mix.exs"))&&n("elixir"),m.existsSync(u.join(e,"composer.json"))&&n("php"),(y(e,".csproj")||y(e,".sln"))&&n("dotnet"),m.existsSync(u.join(e,"package.json"))&&n("node"),m.existsSync(u.join(e,"Gemfile"))&&n("ruby"),(m.existsSync(u.join(e,"pyproject.toml"))||m.existsSync(u.join(e,"setup.py"))||m.existsSync(u.join(e,"requirements.txt"))||m.existsSync(u.join(e,"requirements.in")))&&n("python"),(m.existsSync(u.join(e,"deps.edn"))||m.existsSync(u.join(e,"project.clj")))&&n("clojure"),m.existsSync(u.join(e,"build.sbt"))&&n("scala"),(m.existsSync(u.join(e,"deno.json"))||m.existsSync(u.join(e,"deno.jsonc")))&&n("deno"),(m.existsSync(u.join(e,"bun.lockb"))||m.existsSync(u.join(e,"bun.lock"))||m.existsSync(u.join(e,"bunfig.toml"))||m.existsSync(u.join(e,".bunfig.toml")))&&n("bun"),(m.existsSync(u.join(e,"CMakeLists.txt"))||m.existsSync(u.join(e,"meson.build"))||y(e,".cpp",3)||y(e,".cc",3)||y(e,".cxx",3)||y(e,".hpp",3)||y(e,".hh",3)||y(e,".hxx",3))&&n("cpp"),(y(e,".c",3)||y(e,".h",3))&&n("c"),(m.existsSync(u.join(e,"settings.gradle.kts"))||y(u.join(e,"src"),".kt",3)||g(u.join(e,"build.gradle.kts")).includes("kotlin"))&&n("kotlin"),t}function je(e,t=4){let n=he(e,Math.max(0,Math.min(12,t))),r=new Set(n.map(k=>u.basename(k))),i=n.map(k=>k.toLowerCase()),a=[],c=k=>{a.includes(k)||a.push(k);},d=(...k)=>k.some(h=>r.has(h)),S=(...k)=>i.some(h=>k.some(f=>h.endsWith(f)));return d("go.mod")&&c("go"),d("Cargo.toml")&&c("rust"),d("pom.xml","build.gradle","build.gradle.kts")&&c("java"),d("mix.exs")&&c("elixir"),d("composer.json")&&c("php"),S(".csproj",".sln")&&c("dotnet"),d("package.json")&&c("node"),d("Gemfile")&&c("ruby"),d("pyproject.toml","setup.py","requirements.txt","requirements.in")&&c("python"),d("deps.edn","project.clj")&&c("clojure"),d("build.sbt")&&c("scala"),d("deno.json","deno.jsonc")&&c("deno"),d("bun.lockb","bun.lock","bunfig.toml",".bunfig.toml")&&c("bun"),(d("CMakeLists.txt","meson.build")||S(".cpp",".cc",".cxx",".hpp",".hh",".hxx"))&&c("cpp"),S(".c",".h")&&c("c"),(d("settings.gradle.kts")||S(".kt")||n.some(k=>u.basename(k)==="build.gradle.kts"&&g(k).includes("kotlin")))&&c("kotlin"),a}function B(e,t){let n=O({framework:typeof t?.framework=="string"?t.framework:void 0,runtime:typeof t?.runtime=="string"?t.runtime:void 0,kitName:typeof t?.kit_name=="string"?t.kit_name:typeof t?.kit=="string"?t.kit:void 0});if(n.key!=="unknown")return n;let r=ee(e),i=g(u.join(e,"CMakeLists.txt")),a=g(u.join(e,"meson.build")),c=g(u.join(e,"Cargo.toml")),d=i.trim().length>0||a.trim().length>0,S=y(e,".cpp",3)||y(e,".cc",3)||y(e,".cxx",3),k=y(e,".c",3),h=/(?:\bcxx\b|\bcplusplus\b|\bc\+\+\b)/u.test(`${i}
|
|
6
|
-
${a}`);if(d&&r.includes("cpp")&&(S||h))return o("cpp","high","manifest");if(d&&r.includes("c")&&k&&!S&&!h)return o("c","high","manifest");if(r.includes("rust")&&/\[workspace\]/u.test(c)&&/^default-members\s*=/mu.test(c))return o("rust","high","manifest");if(r.includes("bun"))return o("bun","high","marker");if(r.includes("deno"))return o("deno","high","marker");if(r.includes("kotlin"))return o("kotlin","medium","marker");if(r.includes("node")){let f=Xe(e);if(f.key!=="unknown")return f;let C=xe(e,t);if(C.key!=="unknown")return C;let F=Ve(e);if(F.key!=="unknown")return F}if(r.includes("python")){let f=Qe(e);if(f.key!=="unknown")return f}if(r.includes("go")){let f=Ze(e);if(f.key!=="unknown")return f}if(r.includes("java")){let f=et(e);if(f.key!=="unknown")return f}if(r.includes("php")){let f=tt(e);if(f.key!=="unknown")return f}if(r.includes("ruby")){let f=nt(e);if(f.key!=="unknown")return f}if(r.includes("rust")){let f=it(e);if(f.key!=="unknown")return f}if(r.includes("elixir")){let f=ot(e);if(f.key!=="unknown")return f}if(r.includes("dotnet")){let f=rt(e);if(f.key!=="unknown")return f}return r.includes("clojure")?o("clojure","medium","marker"):r.includes("scala")?o("scala","medium","marker"):r.includes("c")&&k&&!S?o("c","medium","marker"):r.includes("cpp")?o("cpp","medium","marker"):r.includes("c")?o("c","medium","marker"):r.length>0?o(L(r[0]),"medium","runtime"):o("unknown","low","unknown")}var N=["init","dev","start","build","test","lint","format","help"],Ne={python:{runtime:"python",displayName:"Python",tier:"first-class",scaffoldSupport:true,importSupport:true,lifecycleCommands:N,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:N,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:N,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:N,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:N,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:N,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:N,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:["init","dev","start","build","test","lint","format","help"],moduleCommands:false,doctorSupport:"observed",notes:["Bun projects are importable and governed as observed projects until a kit exists.","Declared package scripts execute through the Bun-aware npm wrapper; undeclared lifecycle commands remain unavailable."]},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."]}},st=["fastapi","nestjs"],at=["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 K(e){return Ne[e||"unknown"]??Ne.unknown}function Re(e){return st.includes(e)?"first-class":at.includes(e)?"extended":"observed"}function Fe(e){let t=K(e.runtime);return {lifecycleCommands:t.lifecycleCommands,moduleCommands:e.moduleSupport&&t.moduleCommands,unsupportedLifecycleCommands:N.filter(n=>!t.lifecycleCommands.includes(n))}}var ut=["python","node","bun","go","java","dotnet","rust","php"];function _(e){return !!e&&ut.includes(e)}function $(e,t){return t!=="lint"&&t!=="format"&&t!=="docs"?false:e==="python"}function Te(e){let t=K(e),n=_(t.runtime),r=ct[t.runtime]??[],i=dt[t.runtime]??[];return {runtime:t.runtime,displayName:t.displayName,lifecycleCommands:t.lifecycleCommands,hasExecutor:n,packageManagers:r,primaryFiles:i,notes:t.notes}}var ct={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"]},dt={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",".bunfig.toml"]};function I(e,t){let n=O({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 n.runtime!=="unknown"?n.runtime:B(t,e).runtime}function Pe(e){let t$1=e;for(;;){for(let r of t(t$1,"project.json"))if(m.existsSync(r))try{return JSON.parse(m.readFileSync(r,"utf8"))}catch{return null}let n=u.dirname(t$1);if(n===t$1)break;t$1=n;}return null}function yn(e,t){return I(e,t)==="go"}function bn(e,t){return I(e,t)==="node"}function xn(e,t){return I(e,t)==="java"}function wn(e,t){return I(e,t)==="dotnet"}function Sn(e,t){return I(e,t)==="python"}var mt=["project.json","context.json","file-hashes.json"];async function Pn(e){let t=u.resolve(e),n=[];for(let r of mt){let i=u$1(t,r);if(await E.pathExists(i))continue;let a=u.join(t,".rapidkit",r);if(!await E.pathExists(a))continue;let c=await E.readJson(a);await E.ensureDir(u.dirname(i));let d=`${i}.${process.pid}.${Date.now()}.tmp`;try{await E.writeJson(d,c,{spaces:2}),await E.move(d,i,{overwrite:false}),n.push(i);}finally{await E.remove(d).catch(()=>{});}}return n}function pt(e){for(let t$1 of t(e,"context.json"))if(m.existsSync(t$1))try{return JSON.parse(m.readFileSync(t$1,"utf8"))}catch{return null}return null}function ft(e){let t=e?.engine;return t==="npm"||t==="pip"||t==="python"?t:"unknown"}function kt(e,t){if(e?.module_support===false||t?.module_support===false||!e&&t)return false;let n=typeof e?.kit_name=="string"?e.kit_name:typeof e?.kit=="string"?e.kit:typeof t?.kit=="string"?t.kit:void 0,r=n?W(n):void 0;return r?.owner==="core"&&r.moduleSupport===true}function gt(e,t,n){let r=O({runtime:typeof t?.runtime=="string"?t.runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof t?.framework=="string"?t.framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof t?.kit_name=="string"?t.kit_name:typeof t?.kit=="string"?t.kit:typeof n?.kit=="string"?n.kit:void 0});return r.key!=="unknown"?r:B(e,t)}function Be(e){let t$1=u.resolve(e);if(![...t(t$1,"project.json"),...t(t$1,"context.json")].some(c=>m.existsSync(c)))return null;let r=Pe(t$1),i=pt(t$1),a=gt(t$1,r,i);return {projectRoot:t$1,projectJson:r,contextJson:i,detection:a,moduleSupport:kt(r,i),engine:ft(i)}}var yt=["build","dev","start","test","lint","format"],ne=["init","test","build","start"],Mn=["lint","format","docs"];function An(e){return !!e&&yt.includes(e)}var bt={dev:["dev","start:dev","watch"],start:["start","start:prod","preview"],build:["build","compile"],test:["test","test:unit","test:ci"],lint:["lint","eslint"],format:["format","prettier"]},Me={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 xt(e){let t=u.join(e,"package.json");if(!m.existsSync(t))return {};try{let r=JSON.parse(m.readFileSync(t,"utf8")).scripts??{};return Object.fromEntries(Object.entries(r).filter(i=>typeof i[1]=="string"))}catch{return {}}}function wt(e,t){let n=t?A(t):"unknown",r=n!=="unknown"?Q(n,e):[],i=t?Me[t]?.[e]??[]:[],a=bt[e]??[],c=[...r,...i,...a];return [...new Set(c)]}function Ae(e,t,n){let r=xt(e),i=new Set(Object.keys(r));if(i.has(t))return {scriptName:t,source:"package.json"};for(let a of wt(t,n?.framework))if(i.has(a))return {scriptName:a,source:Q(A(n?.framework??"unknown"),t).includes(a)||Me[n?.framework??""]?.[t]?.includes(a)?"framework-candidate":"generic-candidate"};return null}function ie(e){return m.existsSync(u.join(e,"package.json"))}function De(e){let t=Te(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 oe(e){try{let t=m.readFileSync(e,"utf8");return /^\s*package\s+main\b/m.test(t)&&/\bfunc\s+main\s*\(/m.test(t)}catch{return false}}function ae(e){let t=u.join(e,"main.go");if(oe(t))return "./.";try{if(m.readdirSync(e,{withFileTypes:true}).filter(i=>i.isFile()&&i.name.endsWith(".go")).map(i=>u.join(e,i.name)).filter(oe).length>0)return "./."}catch{}let n=u.join(e,"cmd");try{let r=m.readdirSync(n,{withFileTypes:true}).filter(i=>i.isDirectory()).map(i=>({name:i.name,mainPath:u.join(n,i.name,"main.go")})).filter(i=>oe(i.mainPath)).map(i=>`./cmd/${i.name}`).sort();return r.length===1?r[0]:null}catch{return null}}function vt(e){try{let t=u.join(e,"Makefile");return m.existsSync(t)?m.readFileSync(t,"utf8"):""}catch{return ""}}function R(e,t){let n=vt(e);return n?new RegExp(`^${t}\\s*:`,"m").test(n):false}function p(e){try{return m.existsSync(e)}catch{return false}}function M(e){try{return p(e)?m.readFileSync(e,"utf8"):""}catch{return ""}}function Ct(e){let t=[e];for(;t.length>0;){let n=t.shift();if(!n)break;let r=[];try{r=m.readdirSync(n,{withFileTypes:true});}catch{continue}for(let i of r){if(i.name==="node_modules"||i.name===".git"||i.name==="dist")continue;let a=u.join(n,i.name);if(i.isFile()&&i.name.endsWith(".csproj"))return true;i.isDirectory()&&t.push(a);}}return false}function Oe(e,t){let n=p(u.join(e,"pyproject.toml")),r=p(u.join(e,"requirements.txt"))||p(u.join(e,"requirements.in")),i=p(u.join(e,"manage.py"));switch(t){case "init":return n||r;case "dev":case "start":return n||i||r;case "test":return n||r||p(u.join(e,"tests"));case "build":return n||r;case "lint":case "format":return n||r||i||p(u.join(e,"setup.py"))||p(u.join(e,"setup.cfg"));default:return false}}function ht(e,t){if(!p(u.join(e,"go.mod")))return false;switch(t){case "init":return true;case "dev":return R(e,"run")||ae(e)!==null;case "test":return true;case "build":return true;case "start":return R(e,"run")||ae(e)!==null;case "lint":return p(u.join(e,".golangci.yml"))||p(u.join(e,".golangci.yaml"))||R(e,"lint");case "format":return true;default:return false}}function jt(e,t,n){let r=p(u.join(e,"pom.xml")),i=p(u.join(e,"build.gradle"))||p(u.join(e,"build.gradle.kts"));if(!r&&!i)return false;let a=M(u.join(e,"pom.xml")),c=[M(u.join(e,"build.gradle")),M(u.join(e,"build.gradle.kts"))].join(`
|
|
7
|
-
`),d=n==="springboot"||a.includes("spring-boot-maven-plugin")||/org\.springframework\.boot|id\s*\(?\s*['"]org\.springframework\.boot['"]/u.test(c),S=d||/<mainClass>\s*[^<]+\s*<\/mainClass>/iu.test(a)||/\bmainClass(?:Name)?\s*(?:=|\.)/u.test(c);switch(t){case "init":case "test":case "build":return true;case "dev":return d;case "start":return S;case "lint":return R(e,"lint")||a.includes("checkstyle")||a.includes("spotless-maven-plugin")||c.includes("checkstyle")||c.includes("spotless");case "format":return R(e,"format")||a.includes("spotless-maven-plugin")||c.includes("spotless");default:return false}}function Nt(e,t){if(!Ct(e))return false;switch(t){case "init":case "dev":case "test":case "build":case "start":return true;case "lint":return R(e,"lint")||M(u.join(e,"Directory.Build.props")).includes("EnforceCodeStyleInBuild");case "format":return R(e,"format")||p(u.join(e,".editorconfig"));default:return false}}function Ke(e,t,n){return t==="init"?ie(e):Ae(e,t,{framework:n})!==null}function Rt(e,t,n){switch(t){case "php":return n==="init"&&p(u.join(e,"composer.json"));case "ruby":return n==="init"&&p(u.join(e,"Gemfile"));case "rust":return p(u.join(e,"Cargo.toml"))?n==="init"||n==="test"||n==="build"||n==="start":false;case "elixir":return n==="init"&&p(u.join(e,"mix.exs"));case "deno":return p(u.join(e,"deno.json"))||p(u.join(e,"deno.jsonc"))?n==="init"||n==="dev"||n==="test"||n==="start":n==="init"&&p(u.join(e,"package.json"));case "bun":return p(u.join(e,"bunfig.toml"))||p(u.join(e,".bunfig.toml"))||p(u.join(e,"bun.lock"))?n==="init"||n==="dev"||n==="test"||n==="build"||n==="start":n==="init"&&p(u.join(e,"package.json"));default:return false}}function Ft(e){try{let t=JSON.parse(M(u.join(e,"composer.json")));return new Set(Object.keys(t.scripts??{}))}catch{return new Set}}function Tt(e,t){if(!p(u.join(e,"composer.json")))return false;let n=Ft(e),r=p(u.join(e,"artisan"));switch(t){case "init":return true;case "dev":return r||n.has("dev");case "start":return r||n.has("start");case "test":return r||n.has("test");case "build":return n.has("build");case "lint":return n.has("lint")||n.has("analyse")||n.has("analyze");case "format":return n.has("format")||n.has("fmt")||p(u.join(e,"pint.json"))||p(u.join(e,"vendor","bin","pint"));default:return false}}function Et(e,t){let n=u.join(e,"Cargo.toml");if(!p(n))return false;if(t==="dev"||t==="start"){let r=M(n);if(!/^\s*\[package\]\s*$/m.test(r))return false;let a=/^\s*\[\[bin\]\]\s*$/m.test(r),d=!/^\s*autobins\s*=\s*false\s*(?:#.*)?$/m.test(r)&&p(u.join(e,"src","main.rs"));return a||d}return t==="init"||t==="build"||t==="test"||t==="lint"||t==="format"}function Y(e,t,n,r){if($(t,n))return Oe(e,n);if(!_(t))return Rt(e,t,n);switch(t){case "node":return Ke(e,n,r);case "bun":return Ke(e,n,r);case "python":return Oe(e,n);case "go":return ht(e,n);case "java":return jt(e,n,r);case "dotnet":return Nt(e,n);case "rust":return Et(e,n);case "php":return Tt(e,n);default:return false}}function Pt(e,t,n){return ["init","dev","start","build","test","lint","format"].filter(i=>Y(e,t,i,n))}function Ie(e){let t=Fe({runtime:e.runtime,moduleSupport:e.moduleSupport});if(!e.projectPath)return t;let n=Pt(e.projectPath,e.runtime,e.framework),r=new Set(["help"]);for(let a of n)t.lifecycleCommands.includes(a)&&r.add(a);e.runtime==="node"&&ie(e.projectPath)&&r.add("init");let i=[...r].sort();return {lifecycleCommands:i,moduleCommands:t.moduleCommands,unsupportedLifecycleCommands:t.lifecycleCommands.filter(a=>!i.includes(a)).sort()}}var de=["version","commands","doctor","project","help"],H=["init","dev","start","build","test","lint","format"],le=["add","modules","upgrade","diff","merge","reconcile","rollback","uninstall","checkpoint","snapshot","optimize"],me=["create","list","info","frameworks","license"];de.filter(e=>e!=="help");function _t(e){let t$1=u.resolve(e);for(;;){if([...t(t$1,"project.json"),...t(t$1,"context.json")].some(i=>m.existsSync(i)))return t$1;let r=u.dirname(t$1);if(r===t$1)break;t$1=r;}return null}function G(e,t){return {command:e,...t}}var Mt=new Set(["dev","lint","format"]),At=new Set(ne);function Dt(e,t){return t?At.has(e)?{executionScope:"fleet",fleetEligible:true}:Mt.has(e)?{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}}function Lt(e,t){return $(t.runtime,e)?"core":"runtime"}function Ot(e,t,n,r){return !e||!r.lifecycleCommands.includes(t)?false:Y(e,n.runtime,t,n.key)}function Kt(e,t){let n=!!e&&(t.runtime==="python"||_(t.runtime)&&Y(e,t.runtime,"build",t.key));return G("docs",{owner:t.runtime==="python"?"core":"runtime",status:n?"supported":"unsupported",reason:n?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 It(e){let t=u.resolve(e),n=_t(e);return n||(ee(t).length>0?t:null)}function Gt(e=process.cwd()){let t=It(e),n=t?Be(t):null,r=n?.detection??B(e,n?.projectJson??null),i=n?.moduleSupport??false,a=n?.engine??"unknown",c=De(r.runtime),d=K(r.runtime),S=t?je(t):[],k=[r.runtime,...S.filter(s=>s!==r.runtime)].filter((s,v,U)=>s!=="unknown"&&U.indexOf(s)===v);k.length===0&&k.push("unknown");let h=k.filter(s=>s!=="unknown").length>1,f=Ie({runtime:r.runtime,moduleSupport:i,projectPath:t??void 0,framework:r.key}),C={};for(let s of de)C[s]=G(s,{owner:s==="project"?"core":"npm",status:"supported",reason:s==="project"?"Project detection is a Core contract; workspace project lifecycle remains npm-owned.":s==="help"?"Help is available for every Workspai project through the npm CLI.":"Universal command available across Workspai project types."});for(let s of H){let v=Ot(t,s,r,f),U=Lt(s,r),z=Dt(s,v);C[s]=G(s,{owner:U,status:v?"supported":"unsupported",executionScope:z.executionScope,fleetEligible:z.fleetEligible,reason:v?U==="core"?`Delegated to Python Core for ${r.displayName} projects.`:z.fleetEligible?`Handled by runtime adapter and eligible for workspace fleet stages (${s}).`:s==="dev"?"Local development command only; workspace fleet excludes dev by design.":r.runtime==="node"?`Handled by npm/pnpm/yarn via the resolved ${s} script in package.json.`:`Handled by the ${c?.displayName??r.displayName} runtime adapter for local project execution.`:t?r.runtime==="node"?`No ${s} script was found in package.json for this ${r.displayName} project.`:_(r.runtime)?`The ${r.displayName} runtime is tracked, but ${s} is not available from detected project manifests.`:`${r.displayName} is tracked as an observed runtime; ${s} requires project manifests or explicit scripts.`:"No Workspai project was detected."});}if(h)for(let s of H){let v=C[s];v&&(v.reason=`Composite runtime boundary detected (${k.join(", ")}). This capability describes only the primary ${r.runtime} adapter; nested runtime lifecycle coverage requires explicit project boundaries or command contracts. ${v.reason??""}`.trim());}C.docs=Kt(t,r);for(let s of le)C[s]=G(s,{owner:i?"core":"none",status:i?"supported":"unsupported",reason:i?"Core module/template command supported for this project.":`Core module/template commands are not available for ${r.displayName} projects.`});for(let s of me)C[s]=G(s,{owner:s==="create"?"npm":"core",status:"global",reason:s==="create"?"Create is orchestrated by npm for multi-language workspace support.":"Engine catalog command; not specific to the selected project runtime."});let F=Object.values(C),pe=F.filter(s=>H.includes(s.command)).filter(s=>s.status==="supported"),He=ne.filter(s=>pe.some(v=>v.fleetEligible===true&&v.command===s)),Ue=pe.filter(s=>s.executionScope==="local-only").map(s=>s.command).sort();return {schemaVersion:1,scope:"project",projectRoot:t,engine:a,runtime:r.runtime,runtimeCandidates:k,compositeRuntime:h,lifecycleCoverage:h?"primary-runtime-only":"complete",framework:r.key,frameworkDisplayName:r.displayName,frameworkConfidence:r.confidence,frameworkSupportTier:Re(r.key),runtimeSupportTier:d.tier,runtimeDoctorSupport:d.doctorSupport,moduleSupport:i,fleetStages:He,localOnlyCommands:Ue,commandMap:C,supportedCommands:F.filter(s=>s.status==="supported").map(s=>s.command).sort(),unsupportedCommands:F.filter(s=>s.status==="unsupported").map(s=>s.command).sort(),globalCommands:F.filter(s=>s.status==="global").map(s=>s.command).sort()}}function jr(e,t=process.cwd()){let n=e[0];return n?Gt(t).commandMap[n]??null:null}function Nr(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 Rr(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(`
|
|
8
|
-
`)}export{An as A,Ae as B,ae as C,R as D,Ie as E,_t as F,Gt as G,jr as H,Nr as I,Rr as J,W as a,Ht as b,Ut as c,Wt as d,$t as e,Q as f,Vt as g,xe as h,rn as i,on as j,ee as k,je as l,B as m,K as n,Re as o,_ as p,Pe as q,yn as r,bn as s,xn as t,wn as u,Sn as v,Pn as w,Be as x,yt as y,Mn as z};
|
package/dist/chunk-JD3A5QM6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {l}from'./chunk-MDTI3UEB.js';import {b as b$1}from'./chunk-L22EABIC.js';import {a as a$1}from'./chunk-O5B2L3R2.js';import {b as b$2}from'./chunk-D65FCQIO.js';import {a}from'./chunk-AFIFZTOY.js';import {c}from'./chunk-EWZZUQBR.js';import {h,i,e}from'./chunk-NZ3WZYD5.js';import he from'crypto';import O from'fs';import M from'fs/promises';import m from'path';var te=h.projectAgentEntry.schemaVersion,b=i.projectAgentEntry,me="workspai.agent-bootstrap-receipt.v1",_e="<!-- WORKSPAI:AGENT-ENTRY:START -->",Ne="<!-- WORKSPAI:AGENT-ENTRY:END -->",G=["generic","codex","claude","gemini","qwen","kimi","grok","copilot","cursor","windsurf","amazon-q"],He=["CLAUDE.md","GEMINI.md","QWEN.md",".amazonq/rules/workspai-agent-entry.md"];function fe(t){let r=t?.trim().toLowerCase()||"generic";if(r==="orca")return "grok";if(G.includes(r))return r;throw new Error(`Unsupported agent host "${r}". Expected one of: ${G.join(", ")}.`)}function oe(t){let r=t.map(i=>i.id).sort(),n=[...G].sort();if(r.length!==n.length||r.some((i,c)=>i!==n[c]))throw new Error("Project agent entry must define each supported host exactly once.")}function L(t){let{integrity:r,...n}=t;return n}function E(t){return c(t)}function Oe(t){oe(t.hosts);let r={schemaVersion:te,generatedAt:t.context.generatedAt,project:{name:t.context.project.name,relativePath:t.context.project.relativePath,...t.context.project.runtime?{runtime:t.context.project.runtime}:{},...t.context.project.framework?{framework:t.context.project.framework}:{}},workspace:{name:t.context.workspace.name,relationship:t.context.workspace.relationship,localBinding:i.projectWorkspaceLink,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},canonical:{projectContext:i.projectContextAgent,projectGrounding:".workspai/PROJECT-GROUNDING.md",goalIndex:`workspace:${i.goalIndex}`,workspaceIndex:`workspace:${e.agentIndex}`,workspaceContext:`workspace:${e.agentContext}`,workspaceSkillsIndex:`workspace:${e.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json"},protocol:{mode:"canonical-first",bootstrapCommand:"workspai agent bootstrap --for-agent generic --strict --json",verifyCommand:"workspai project agent-entry verify --for-agent all --strict --json",requiredReadOrder:[b,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",i.projectContextAgent,`workspace:${i.goalIndex}`,`workspace:${e.agentIndex}`,`workspace:${e.agentContext}`,`workspace:${e.skillsIndex}`,"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json","source:targeted-live-files"],sourcePolicy:{liveSourceAuthority:"exact-implementation",workspaceEvidenceAuthority:"identity-topology-readiness-goals",broadScanBeforeBootstrap:false,sourceMutation:"governed-only",verificationClaims:"cli-evidence-only"},degradedMode:{discloseMissingEvidence:true,allowCompleteArchitectureClaims:false,allowReadOnlySourceInspection:true}},hosts:[...t.hosts].sort((i,c)=>i.id.localeCompare(c.id))},n={...r,integrity:{algorithm:"sha256",projectContextHash:t.context.integrity.payloadHash,payloadHash:E(r),portable:true,absolutePathsEmitted:false}};if(!k(n))throw new Error("Project agent entry rejected a non-portable local path.");return a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n}function k(t){return typeof t=="string"?!(/^[A-Za-z]:[\\/]/.test(t)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(t)||/(?:^|[\s("'`])file:\/\//i.test(t)||/(?:^|[\s("'`])\\\\[^\\\s]+[\\]/.test(t)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(t)):Array.isArray(t)?t.every(k):t&&typeof t=="object"?Object.values(t).every(k):true}async function ue(t){let r=m.join(t,b),n=JSON.parse(await M.readFile(r,"utf8"));if(a(n,"contracts/workspace-intelligence/project-agent-entry.v1.json","Project agent entry"),n.integrity.payloadHash!==E(L(n)))throw new Error("Project agent entry integrity validation failed.");if(oe(n.hosts),!k(n)||n.integrity.absolutePathsEmitted)throw new Error("Project agent entry contains a non-portable local path.");return n}async function ye(t){let r=m.join(t,i.projectContextAgent),n=JSON.parse(await M.readFile(r,"utf8"));a(n,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent");let i$1=L(n),c=he.createHash("sha256").update(JSON.stringify(i$1)).digest("hex");if(n.integrity.payloadHash!==c)throw new Error("Project context agent integrity validation failed.");if(!k(n)||n.integrity.absolutePathsEmitted)throw new Error("Project context agent contains a non-portable local path.");return n}function ke(t){return t.includes("blocked")?"blocked":t.includes("degraded")?"degraded":"ready"}async function Ge(t){let r=b$1({startPath:m.resolve(t.startPath??process.cwd()),strict:true,requireProjectMembership:true});if(!r?.projectPath)throw new Error("No canonically bound Workspai project was resolved.");let n=r.projectPath,i$1=r.workspacePath,c=await ue(n),o=await ye(n);if(c.integrity.projectContextHash!==o.integrity.payloadHash||c.project.name!==o.project.name||c.workspace.name!==o.workspace.name)throw new Error("Project agent entry is not bound to the current project context.");let $=t.forAgent?.trim().toLowerCase()||"generic",F=$==="all",g=F?"all":fe($),W=g,h=F?c.hosts:c.hosts.filter(e=>e.id===g),q=c.hosts.find(e=>e.id==="generic");if(h.length===0&&q&&h.push(q),h.length===0)throw new Error("Project agent entry does not define generic host coverage.");let w=[],p=(e,s,I,u)=>w.push({id:e,status:s,message:I,...u?{artifact:u}:{}});p("workspace-binding","passed","Canonical workspace membership is resolved."),p("entry-integrity","passed","Project entry manifest integrity is valid.",b),p("project-context-integrity","passed","Project context integrity and manifest binding are valid.",i.projectContextAgent);let R=[...new Set(h.flatMap(e=>e.entryFiles))].sort(),ne=R.filter(e=>!O.existsSync(m.join(n,e))),f=h.some(e=>e.status==="blocked")||ne.length>0?"blocked":h.some(e=>e.status==="degraded")?"degraded":"ready";p("host-discovery",f==="ready"?"passed":f==="degraded"?"warning":"failed",f==="ready"?`${g} has discoverable Workspai entry coverage.`:f==="degraded"?h.find(e=>e.reason)?.reason??`${g} entry coverage is degraded.`:`${g} entry coverage is missing required files.`,R[0]);let K=[e.agentIndex,e.agentContext,e.skillsIndex,e.model,e.knowledgeGraph],v=K.filter(e=>!O.existsSync(m.join(i$1,e)));p("canonical-evidence",v.length===0?"passed":"failed",v.length===0?"Required canonical workspace evidence is present.":`Required canonical evidence is missing: ${v.join(", ")}.`);let j=[],P=null,V=null;for(let e$1 of K)if(!v.includes(e$1))try{let s=JSON.parse(await M.readFile(m.join(i$1,e$1),"utf8"));b$2(e$1,s,e$1),e$1===e.model&&(P=s),e$1===e.knowledgeGraph&&(V=s);}catch{j.push(e$1);}p("canonical-contracts",j.length===0?"passed":"failed",j.length===0?"Canonical workspace evidence satisfies its published schemas.":`Canonical evidence failed contract validation: ${j.join(", ")}.`);let se=P?.workspace,re=V?.workspace,ae=Array.isArray(P?.projects)?P.projects:[],B=j.length===0&&se?.name===o.workspace.name&&re?.name===o.workspace.name&&ae.some(e=>e.name===o.project.name);p("canonical-project-membership",B?"passed":"failed",B?"The project and workspace identities agree across the entry, Model, and Graph.":"The project or workspace identity is missing or inconsistent in canonical evidence.");let J=!o.intelligence.freshness.graphMatchesModel||["missing","stale"].includes(o.intelligence.freshness.model)||["missing","stale"].includes(o.intelligence.freshness.graph)?"failed":o.intelligence.freshness.model==="unknown"||o.intelligence.freshness.graph==="unknown"?"warning":"passed",C=false,x;if(t.validateLiveInputs!==false)try{let e=await a$1(i$1);C=e.status==="hit";let s=e.status==="hit"?"Live project inputs match the persisted Model and Knowledge Graph snapshot.":`Live project inputs require an intelligence refresh (${e.reason}).`;x={id:"live-inputs",status:C?"passed":"failed",message:s};}catch{x={id:"live-inputs",status:"failed",message:"Live project inputs could not be validated against canonical graph evidence."};}else x={id:"live-inputs",status:"warning",message:"Live input validation was skipped; persisted compatibility was checked only."};let _=J==="warning"&&o.intelligence.freshness.model==="unknown"&&o.intelligence.freshness.graph==="fresh"&&o.intelligence.freshness.graphMatchesModel&&C?"passed":J;p("persisted-freshness",_,_==="passed"?o.intelligence.freshness.model==="unknown"?"Model and Graph bindings are current; live input validation closes structural freshness while verify-before-use facts remain individually governed.":"Persisted Model and Knowledge Graph bindings are current.":_==="warning"?"Persisted evidence is compatible, but at least one freshness state is unknown.":"Persisted Model or Knowledge Graph evidence is missing, stale, or mismatched."),w.push(x);let l$1={present:false,appliesToProject:false,status:"none"},T=[],ie=m.join(i$1,i.goalIndex);if(O.existsSync(ie)){let e=null;try{e=await l({workspacePath:i$1,validateBindings:false});}catch{T.push("workspai goal --list --json"),p("active-goal","failed","The Goal index is present but invalid.");}if(e?.active&&(l$1={present:true,appliesToProject:e.active.scope.projects.includes(o.project.name),status:"invalid",id:e.active.id,objective:e.active.objective,lifecycle:e.active.lifecycle,goalPack:`workspace:${e.active.goalPack}`,agentHandoff:`workspace:${e.active.agentHandoff}`}),e)try{let s=await l({workspacePath:i$1,validateBindings:true});s.active&&(l$1={present:true,appliesToProject:s.active.scope.projects.includes(o.project.name),status:"ready",id:s.active.id,objective:s.active.objective,lifecycle:s.active.lifecycle,goalPack:`workspace:${s.active.goalPack}`,agentHandoff:`workspace:${s.active.agentHandoff}`}),p("active-goal","passed",s.active?"The active Goal Pack and agent handoff have valid canonical bindings.":"No active Goal Pack is selected.");}catch(s){let I=s instanceof Error?s.message:String(s),u=l$1.present&&/\bstale\b|--refresh/i.test(I);if(l$1.present&&(l$1.status=u?"stale":"invalid"),u&&l$1.objective){let y=e.active,ge=y?.scope.kind==="project"&&y.scope.projects.length===1?`project:${y.scope.projects[0]}`:y?.scope.kind==="project-set"&&y.scope.projects.length>1?`projects:${y.scope.projects.join(",")}`:"workspace";T.push(`workspai goal ${JSON.stringify(l$1.objective)} --scope ${ge} --for-agent generic --refresh --json`);}else T.push("workspai goal --status --json");p("active-goal","failed",u?"The selected Goal Pack is present but stale; regenerate it against current canonical evidence before acting.":l$1.present?"The selected Goal Pack is present but its canonical binding or handoff is invalid.":"The Goal index could not be validated.");}}else p("active-goal","passed","No Goal index is present for this workspace.");let ce=w.some(e=>e.status==="failed")?"blocked":w.some(e=>e.status==="warning")?"degraded":"ready",S=ke([f,ce]),le=`command:workspai agent bootstrap --for-agent ${g} --strict --json`,pe=c.protocol.requiredReadOrder.map(e=>e==="command:workspai agent bootstrap --for-agent generic --strict --json"?le:e),U={schemaVersion:me,generatedAt:(t.now??new Date).toISOString(),status:S,requestedAgent:W,resolvedHost:g,project:{name:o.project.name,relativePath:o.project.relativePath,...o.project.runtime?{runtime:o.project.runtime}:{},...o.project.framework?{framework:o.project.framework}:{}},workspace:{name:o.workspace.name,relationship:o.workspace.relationship,resolved:true,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"},entry:{artifact:b,schemaVersion:te,hostStatus:f,entryFiles:R},canonicalEvidence:{projectContext:i.projectContextAgent,workspaceIndex:`workspace:${e.agentIndex}`,workspaceContext:`workspace:${e.agentContext}`,workspaceSkillsIndex:`workspace:${e.skillsIndex}`,boundedGraphSearch:"command:workspai workspace graph search <task-query> --scope project:<project> --limit 12 --json",modelFreshness:o.intelligence.freshness.model,graphFreshness:o.intelligence.freshness.graph,graphMatchesModel:o.intelligence.freshness.graphMatchesModel,liveInputsValidated:C,blockerCount:o.blockers.length},activeGoal:l$1,requiredReadOrder:pe,claims:{architecture:S==="ready"?"allowed-with-citations":"prohibited",sourceInspection:"bounded-and-targeted",sourceMutation:"governed-cli-transaction-only",verification:"cli-evidence-only"},checks:w,nextActions:S==="ready"?[...l$1.present&&l$1.appliesToProject&&l$1.agentHandoff?[`read:${l$1.agentHandoff}`]:[],`workspai workspace graph search <task-query> --scope project:${o.project.name} --limit 12 --json`,"inspect only the returned proof paths and target source files"]:[...T,"workspai workspace intelligence run --for-agent generic --strict --json",`workspai agent bootstrap --for-agent ${g} --strict --json`]},Y=E(L(c)),de=E({manifestHash:Y,projectContextHash:o.integrity.payloadHash,requestedAgent:W,status:S,generatedAt:U.generatedAt}),D={...U,receiptId:de},N={...D,integrity:{algorithm:"sha256",manifestHash:Y,projectContextHash:o.integrity.payloadHash,payloadHash:E(D),portable:true,absolutePathsEmitted:false}};if(!k(N))throw new Error("Agent bootstrap receipt rejected a non-portable local path.");return a(N,"contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json","Agent bootstrap receipt"),N}
|
|
2
|
-
export{te as a,b,me as c,_e as d,Ne as e,G as f,He as g,fe as h,Oe as i,Ge as j};
|
package/dist/chunk-JQLJBK5N.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-VRGEPPUB.js';import {a as a$1}from'./chunk-GR6442P7.js';import {f,e}from'./chunk-CCDGHPEJ.js';import {h,i}from'./chunk-NZ3WZYD5.js';import {createHash}from'crypto';import c from'path';import {execa}from'execa';import u from'fs-extra';var D=h.projectTestCoverage.schemaVersion,E=i.projectTestCoverage,G=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deps.edn","project.clj","build.sbt","CMakeLists.txt","meson.build","deno.json","deno.jsonc"];function p(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:0}function g(e,t,o=0){let n=p(e),a=Math.min(p(t),n),r=p(o);return {total:n,covered:a,skipped:r,percent:n>0?Math.round(a/n*1e4)/100:null}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;return g(t.total,t.covered,t.skipped)}function y(e,t){let o=c.isAbsolute(t)?t:c.resolve(e,t),n=c.relative(e,o);return n&&!n.startsWith("..")?n.split(c.sep).join("/"):t}async function x(e){return createHash("sha256").update(await u.readFile(e)).digest("hex")}async function I(e){let t=c.resolve(e);for(;;){if(await u.pathExists(c.join(t,".workspai","project.json"))||await u.pathExists(c.join(t,".rapidkit","project.json"))||(await Promise.all(G.map(a=>u.pathExists(c.join(t,a))))).some(Boolean))return t;let n=c.dirname(t);if(n===t)return c.resolve(e);t=n;}}async function V(e){if(await u.pathExists(c.join(e,"deno.json"))||await u.pathExists(c.join(e,"deno.jsonc")))return "deno";if(await u.pathExists(c.join(e,"bun.lock"))||await u.pathExists(c.join(e,"bun.lockb")))return "bun";if(await u.pathExists(c.join(e,"package.json")))return "node";if(await u.pathExists(c.join(e,"pyproject.toml"))||await u.pathExists(c.join(e,"requirements.txt")))return "python";if(await u.pathExists(c.join(e,"go.mod")))return "go";let t=await u.pathExists(c.join(e,"pom.xml"))||await u.pathExists(c.join(e,"build.gradle"))||await u.pathExists(c.join(e,"build.gradle.kts"));return t&&(await P(e,o=>o.endsWith(".kt")||o.endsWith(".kts")&&o!=="build.gradle.kts"&&o!=="settings.gradle.kts",4)).length>0?"kotlin":t?"java":await u.pathExists(c.join(e,"Cargo.toml"))?"rust":await u.pathExists(c.join(e,"composer.json"))?"php":await u.pathExists(c.join(e,"Gemfile"))?"ruby":await u.pathExists(c.join(e,"mix.exs"))?"elixir":await u.pathExists(c.join(e,"deps.edn"))||await u.pathExists(c.join(e,"project.clj"))?"clojure":await u.pathExists(c.join(e,"build.sbt"))?"scala":await u.pathExists(c.join(e,"CMakeLists.txt"))?(await P(e,n=>/\.(c|cc|cpp|cxx)$/.test(n),3)).some(n=>/\.(cc|cpp|cxx)$/.test(n))?"cpp":"c":(await P(e,o=>/\.(sln|csproj)$/.test(o),2)).length>0?"dotnet":"unknown"}async function P(e,t,o=5){let n=[],a=[{dir:e,depth:0}],r=new Set([".git",".workspai",".rapidkit","node_modules",".venv","vendor","deps"]);for(;a.length>0;){let s=a.shift();if(!s)break;let i=await u.readdir(s.dir,{withFileTypes:true}).catch(()=>[]);for(let l of i){if(r.has(l.name)||a$1(l.name))continue;let d=c.join(s.dir,l.name),m=c.relative(e,d).split(c.sep).join("/");l.isFile()&&t(l.name,m)&&n.push(d),l.isDirectory()&&s.depth<o&&a.push({dir:d,depth:s.depth+1});}}return n}async function L(e,t){let o=await u.readJson(t),n=o.total??o,a={};for(let s of ["lines","branches","functions","statements"]){let i=W(n[s]);i&&(a[s]=i);}let r=[];for(let[s,i]of Object.entries(o)){if(s==="total"||!i||typeof i!="object"||Array.isArray(i))continue;let l=i,d={};for(let m of ["lines","branches","functions","statements"]){let b=W(l[m]);b&&(d[m]=b);}r.push({path:y(e,s),metrics:d});}return {metrics:a,files:r,source:{format:"istanbul-json",path:t,sha256:await x(t)}}}async function U(e,t){let o=await u.readJson(t),n=o.totals??{},a={lines:g(n.num_statements,n.covered_lines)};p(n.num_branches)>0&&(a.branches=g(n.num_branches,n.covered_branches));let r=[];for(let[s,i]of Object.entries(o.files??{})){let l=i?.summary??{};r.push({path:y(e,s),metrics:{lines:g(l.num_statements,l.covered_lines),...p(l.num_branches)>0?{branches:g(l.num_branches,l.covered_branches)}:{}}});}return {metrics:a,files:r,source:{format:"coverage-py-json",path:t,sha256:await x(t)}}}function j(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o=p(t.count),n=p(t.covered);return o>0?g(o,n):void 0}async function z(e,t){let o=await u.readJson(t),n=Array.isArray(o.data)?o.data[0]??{}:o,a=n.totals??{},r={};r.lines=j(a.lines),r.functions=j(a.functions),r.branches=j(a.branches),r.statements=j(a.regions);let s=[];for(let i of Array.isArray(n.files)?n.files:[]){if(!i||typeof i!="object"||Array.isArray(i))continue;let l=i,d=l.summary??{};s.push({path:y(e,String(l.filename??"unknown")),metrics:{lines:j(d.lines),functions:j(d.functions),branches:j(d.branches),statements:j(d.regions)}});}return {metrics:r,files:s,source:{format:"llvm-cov-json",path:t,sha256:await x(t)}}}async function A(e,t){let o=await u.readFile(t,"utf8"),n=[],a="",r=0,s=0,i=0,l=0,d=0,m=0,b=v=>{a&&(n.push({path:y(e,a),metrics:{lines:g(v.lineTotal,v.lineCovered),functions:g(v.functionTotal,v.functionCovered),branches:g(v.branchTotal,v.branchCovered)}}),r+=v.lineTotal,s+=v.lineCovered,i+=v.functionTotal,l+=v.functionCovered,d+=v.branchTotal,m+=v.branchCovered);},h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0};for(let v of o.split(/\r?\n/))v.startsWith("SF:")?a=v.slice(3):v.startsWith("LF:")?h.lineTotal=p(v.slice(3)):v.startsWith("LH:")?h.lineCovered=p(v.slice(3)):v.startsWith("FNF:")?h.functionTotal=p(v.slice(4)):v.startsWith("FNH:")?h.functionCovered=p(v.slice(4)):v.startsWith("BRF:")?h.branchTotal=p(v.slice(4)):v.startsWith("BRH:")?h.branchCovered=p(v.slice(4)):v==="end_of_record"&&(b(h),a="",h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0});return {metrics:{lines:g(r,s),functions:g(i,l),branches:g(d,m)},files:n,source:{format:"lcov",path:t,sha256:await x(t)}}}async function B(e,t){let o=await u.readFile(t,"utf8"),n=new Map;for(let s of o.split(/\r?\n/).slice(1)){let i=/^(.+?):\d+\.\d+,\d+\.\d+\s+(\d+)\s+(\d+)$/.exec(s.trim());if(!i)continue;let l=n.get(i[1])??{total:0,covered:0},d=p(i[2]);l.total+=d,p(i[3])>0&&(l.covered+=d),n.set(i[1],l);}let a=[...n.entries()].map(([s,i])=>({path:y(e,s),metrics:{statements:g(i.total,i.covered)}})),r=[...n.values()].reduce((s,i)=>({total:s.total+i.total,covered:s.covered+i.covered}),{total:0,covered:0});return {metrics:{statements:g(r.total,r.covered)},files:a,source:{format:"go-coverprofile",path:t,sha256:await x(t)}}}function T(e,t){let n=[...e.matchAll(new RegExp(`<counter\\s+type=["']${t}["']\\s+missed=["'](\\d+)["']\\s+covered=["'](\\d+)["']\\s*\\/?\\s*>`,"gi"))].at(-1);return n?g(Number(n[1])+Number(n[2]),n[2]):void 0}async function C(e,t){let o=await u.readFile(e,"utf8"),n={};if(t==="cobertura-xml"){let a=/<coverage\b([^>]*)>/i.exec(o)?.[1]??"",r=/\bline-rate=["']([\d.]+)["']/i.exec(a)?.[1],s=/\bbranch-rate=["']([\d.]+)["']/i.exec(a)?.[1];r&&(n.lines=g(1e4,Math.round(Number(r)*1e4))),s&&(n.branches=g(1e4,Math.round(Number(s)*1e4)));}if(t==="clover-xml"){let r=[...o.matchAll(/<metrics\b([^>]*)\/?>/gi)].at(-1)?.[1]??"",s=m=>p(new RegExp(`\\b${m}=["'](\\d+)["']`,"i").exec(r)?.[1]),i=s("statements"),l=s("methods"),d=s("conditionals");i>0&&(n.statements=g(i,s("coveredstatements"))),l>0&&(n.functions=g(l,s("coveredmethods"))),d>0&&(n.branches=g(d,s("coveredconditionals")));}return n.lines??=T(o,"LINE"),n.branches??=T(o,"BRANCH"),n.functions??=T(o,"METHOD"),n.statements??=T(o,"INSTRUCTION"),{metrics:n,files:[],source:{format:t,path:e,sha256:await x(e)}}}async function K(e){let t=await u.readFile(e,"utf8"),o=/<scoverage\b([^>]*)>/i.exec(t)?.[1]??"",n=b=>p(new RegExp(`\\b${b}=["']([\\d.]+)["']`,"i").exec(o)?.[1]),a=n("statement-count"),r=n("statements-invoked"),s=n("branch-count"),i=n("branches-invoked"),l=n("statement-rate"),d=n("branch-rate"),m={};return a>0?m.statements=g(a,r):l>0&&(m.statements=g(1e4,Math.round(l*100))),s>0?m.branches=g(s,i):d>0&&(m.branches=g(1e4,Math.round(d*100))),{metrics:m,files:[],source:{format:"scoverage-xml",path:e,sha256:await x(e)}}}async function X(e,t){let o=await u.readJson(t),n=new Map;for(let s of Object.values(o)){let i=s?.coverage;if(!(!i||typeof i!="object"||Array.isArray(i)))for(let[l,d]of Object.entries(i)){if(!Array.isArray(d))continue;let m=n.get(l)??[];d.forEach((b,h)=>{typeof b=="number"&&(m[h]=Math.max(m[h]??0,b));}),n.set(l,m);}}let a=[...n.entries()].map(([s,i])=>{let l=i.filter(d=>typeof d=="number");return {path:y(e,s),metrics:{lines:g(l.length,l.filter(d=>d>0).length)}}}),r=a.reduce((s,i)=>{let l=i.metrics.lines;return {total:s.total+(l?.total??0),covered:s.covered+(l?.covered??0)}},{total:0,covered:0});return {metrics:{lines:g(r.total,r.covered)},files:a,source:{format:"simplecov-json",path:t,sha256:await x(t)}}}async function $(e,t={}){let o=[{relativePath:"coverage/coverage-summary.json",parser:r=>L(e,r)},{relativePath:"coverage.json",parser:async r=>{let s=await u.readJson(r);return Array.isArray(s.data)?z(e,r):U(e,r)}},{relativePath:"coverage/lcov.info",parser:r=>A(e,r)},{relativePath:"cover/lcov.info",parser:r=>A(e,r)},{relativePath:"lcov.info",parser:r=>A(e,r)},{relativePath:"coverage.out",parser:r=>B(e,r)},{relativePath:"target/site/jacoco/jacoco.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"build/reports/jacoco/test/jacocoTestReport.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"coverage.xml",parser:r=>C(r,"clover-xml")},{relativePath:".resultset.json",parser:r=>X(e,r)}];for(let r of o){let s=c.join(e,r.relativePath);if(await u.pathExists(s))return r.parser(s)}if(t.recursive===false)return null;let a=(await P(e,(r,s)=>r==="coverage.cobertura.xml"||r==="jacoco.xml"||r==="clover.xml"||r==="scoverage.xml"||s.endsWith("/coverage-summary.json"),7)).sort()[0];return a?a.endsWith("coverage-summary.json")?L(e,a):a.endsWith("jacoco.xml")?C(a,"jacoco-xml"):a.endsWith("coverage.cobertura.xml")?C(a,"cobertura-xml"):a.endsWith("scoverage.xml")?K(a):C(a,"clover-xml"):null}async function Q(e){return u.readJson(c.join(e,"package.json")).catch(()=>null)}async function q(e,t){let o=(n,a)=>({cwd:e,executable:n,args:a});if(t==="node"||t==="bun"){let a=(await Q(e))?.scripts??{},r=["test:coverage","test:cov","coverage"].find(i=>typeof a[i]=="string"),s=t==="bun"?"bun":await u.pathExists(c.join(e,"pnpm-lock.yaml"))?"pnpm":await u.pathExists(c.join(e,"yarn.lock"))?"yarn":"npm";if(r)return {runner:String(a[r]).split(/\s+/)[0]||s,invocations:[o(s,s==="yarn"?[r]:["run",r])],diagnostics:[]};if(typeof a.test=="string"){let i=s==="yarn"?["test","--coverage"]:s==="bun"?["test","--coverage","--coverage-reporter=lcov"]:["test","--","--coverage"];return {runner:String(a.test).split(/\s+/)[0]||s,invocations:[o(s,i)],diagnostics:[]}}return {runner:null,invocations:[],diagnostics:["No project-owned test or coverage script was detected."]}}if(t==="deno")return {runner:"deno",invocations:[o("deno",["test","--coverage=coverage"]),o("deno",["coverage","--lcov","--output=coverage/lcov.info","coverage"])],diagnostics:[]};if(t==="python")return {runner:"pytest-cov",invocations:[o(await u.pathExists(c.join(e,".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"))?c.join(".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"):process.platform==="win32"?"python":"python3",["-m","pytest","--cov=.","--cov-report=json:coverage.json"])],diagnostics:[]};if(t==="go")return {runner:"go test",invocations:[o("go",["test","./...","-coverprofile=coverage.out"])],diagnostics:[]};if(t==="java"){let n=await u.pathExists(c.join(e,"gradlew")),a=await u.pathExists(c.join(e,"gradlew.bat")),r=n||a,s=await u.pathExists(c.join(e,"mvnw")),i=await u.pathExists(c.join(e,"mvnw.cmd")),l=r?process.platform==="win32"&&a?".\\gradlew.bat":"./gradlew":await u.pathExists(c.join(e,"pom.xml"))?process.platform==="win32"&&i?".\\mvnw.cmd":s?"./mvnw":"mvn":"gradle";return {runner:r?"jacoco/gradle":"jacoco/maven",invocations:[o(l,r?["test","jacocoTestReport"]:["test","jacoco:report"])],diagnostics:[]}}return t==="dotnet"?{runner:"dotnet coverlet",invocations:[o("dotnet",["test","--collect:XPlat Code Coverage"])],diagnostics:[]}:t==="rust"?{runner:"cargo llvm-cov",invocations:[o("cargo",["llvm-cov","--json","--output-path","coverage.json"])],diagnostics:["cargo-llvm-cov must be available in the project toolchain."]}:t==="php"?{runner:"phpunit",invocations:[o(process.platform==="win32"?"vendor\\bin\\phpunit.bat":"vendor/bin/phpunit",["--coverage-clover","coverage.xml"])],diagnostics:[]}:t==="ruby"?{runner:"simplecov",invocations:[o("bundle",["exec","rspec"])],diagnostics:["The test suite must enable SimpleCov to emit .resultset.json."]}:t==="elixir"?{runner:"mix cover",invocations:[o("mix",["test","--cover"])],diagnostics:["Configure ExCoveralls for JSON or LCOV interchange when machine-readable coverage is required."]}:t==="clojure"?{runner:"cloverage",invocations:[o("clojure",["-M:coverage"])],diagnostics:["The project must declare a coverage alias such as cloverage."]}:t==="scala"?{runner:"sbt-scoverage",invocations:[o("sbt",["clean","coverage","test","coverageReport"])],diagnostics:["The project must declare the scoverage plugin."]}:t==="kotlin"?{runner:"jacoco/gradle",invocations:[o(await u.pathExists(c.join(e,process.platform==="win32"?"gradlew.bat":"gradlew"))?process.platform==="win32"?".\\gradlew.bat":"./gradlew":"gradle",["test","jacocoTestReport"])],diagnostics:["The project must declare the JaCoCo Gradle plugin."]}:t==="c"||t==="cpp"?{runner:"CTest/LLVM coverage",invocations:[o("ctest",["--test-dir","build","--output-on-failure"])],diagnostics:["The native build must be instrumented for coverage and export LCOV, Cobertura, or LLVM JSON evidence."]}:{runner:null,invocations:[],diagnostics:["Project runtime could not be detected."]}}async function ue(e,t){let o=await I(e),n=t??await V(o),a=await q(o,n),r=await $(o,{recursive:false}).catch(()=>null),s=r?.source.path&&r.source.sha256?[{path:c.relative(o,r.source.path).split(c.sep).join("/"),sha256:r.source.sha256}]:[],i=[...a.diagnostics],l=r?"available":a.invocations.length===0||n==="unknown"?"unsupported":i.length>0?"requires-setup":"available";return {runtime:n,runner:a.runner,status:l,existingEvidence:s,invocations:a.invocations,prerequisites:i}}function Y(e,t){let o=e?c.relative(e,t).split(c.sep).join("/"):c.resolve(t),n=c.basename(t).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"project",a=createHash("sha256").update(o).digest("hex").slice(0,12);return `${n}--${a}`}function Z(e){return e.lines?"lines":e.statements?"statements":e.branches?"branches":"functions"}async function de(e$1={}){let t=await I(e$1.projectPath??process.cwd()),o=a(t),n=e$1.runtime??await V(t),a$1=Math.max(0,Math.min(100,Math.round(e$1.target??80))),r=await q(t,n),s=[],i=Date.now();if(e$1.run)for(let f of r.invocations){let w=await execa(f.executable,f.args,{cwd:f.cwd,reject:false,timeout:6e5}).catch(()=>({exitCode:1}));if(s.push(Number(w.exitCode??1)),Number(w.exitCode??1)!==0)break}let l=await $(t).catch(()=>null),d=l?Z(l.metrics):"lines",m=l?.metrics[d]?.percent??null,b=e$1.run&&s.some(f=>f!==0)?"failed":m===null?"unavailable":m>=a$1?"passed":"below-target",h=Y(o,t),v=c.join(t,E),R=o?`.workspai/reports/projects/${h}/project-test-coverage-last-run.json`:null,k={schemaVersion:D,generatedAt:new Date().toISOString(),status:b,project:{id:h,name:c.basename(t),path:t,workspacePath:o},runtime:n,runner:r.runner,target:{metric:d,percent:a$1},metrics:l?.metrics??{},files:l?.files??[],lowCoverageFiles:(l?.files??[]).map(f=>{let w=f.metrics[d]??f.metrics.lines??f.metrics.statements;return {path:f.path,percent:w?.percent??null,uncovered:Math.max(0,(w?.total??0)-(w?.covered??0))}}).filter(f=>f.percent===null||f.percent<a$1).sort((f,w)=>w.uncovered-f.uncovered||f.path.localeCompare(w.path)),source:l?.source??{format:"unknown",path:null,sha256:null},execution:{requested:e$1.run===true,invocations:r.invocations,exitCodes:s,durationMs:Date.now()-i},diagnostics:[...r.diagnostics,...l?[]:["No supported machine-readable coverage artifact was found."]],artifactPaths:{project:v,workspaceLatest:o?c.join(o,E):null,workspaceProject:o&&R?c.join(o,R):null}};return o&&R&&await f(o,E,[{relativePath:E,payload:k},{relativePath:R,payload:k}]),await e(t,E,k),k}export{D as a,E as b,ue as c,de as d};
|
package/dist/chunk-KLSSPJTV.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-A5FBGRJA.js';import {g,p}from'./chunk-P5PSZQPB.js';import {d,e}from'./chunk-CCDGHPEJ.js';import {i,h}from'./chunk-NZ3WZYD5.js';import {s}from'./chunk-MOSXTVPU.js';import {s as s$1,q}from'./chunk-RGNCL5OB.js';import a from'path';import {existsSync}from'fs';import m from'fs-extra';var f=i.workspaceRegistry,w=h.workspaceRegistry.schemaVersion;function E(r){return {slug:r.slug,relativePath:r.relativePath,framework:r.framework,kit:r.kit,source:r.source}}async function b(r){let e=s(r,"workspace.json").find(t=>existsSync(t));if(!e)return {exists:false,legacyProjectCount:0};try{let t=await m.readJson(e),c=Array.isArray(t.projects)?t.projects.length:0,o=typeof t.workspace_name=="string"&&t.workspace_name.trim()||typeof t.name=="string"&&t.name.trim()||a.basename(r);return {exists:true,manifestPath:e,workspaceName:o,profile:typeof t.profile=="string"?t.profile:void 0,legacyProjectCount:c}}catch{return {exists:true,manifestPath:e,legacyProjectCount:0,workspaceName:a.basename(r)}}}async function _(r){let e=a$1(r);for(let t of s$1())if(await m.pathExists(t))try{let o=((await m.readJson(t)).workspaces||[]).find(s=>a$1(s.path)===e);if(o)return {exists:true,projectCount:Array.isArray(o.projects)?o.projects.length:0,registryPath:t}}catch{continue}return {exists:false,projectCount:0,registryPath:a.join(q(),"workspaces.json")}}async function T(r,e){let t=a.resolve(r),c=await d(t,g),o=await b(t),s=await _(t),i=e?.contract!==void 0||!!c,n=[];if(e?.contract)n=e.contract.projects||[];else if(i)try{let{contract:A}=await p({workspacePath:t});n=A.projects||[];}catch{n=[];}let d$1={contract:{exists:i,projectCount:n.length,path:g},globalRegistry:{exists:s.exists,projectCount:s.projectCount,path:s.registryPath},legacyWorkspaceJson:{exists:o.exists,projectCount:o.legacyProjectCount,path:o.manifestPath?a.relative(t,o.manifestPath):void 0}},p$1="none",u=[],y=0;return i?(p$1="workspace.contract.json",u=n.map(E),y=u.length):s.projectCount>0?(p$1="global-registry",y=s.projectCount):o.legacyProjectCount>0&&(p$1="legacy-workspace.json",y=o.legacyProjectCount),{contractExists:i,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:t,workspaceName:o.workspaceName||a.basename(t),profile:o.profile,projectCount:y,authority:p$1,contractPath:g,projects:u,sources:d$1}}}async function U(r){let e=await d(r,f);if(!e)return null;try{let t=await m.readJson(e);return t?.schemaVersion!==w?null:t}catch{return null}}async function D(r,e$1){let t=await M(r,e$1);return await e(r,f,t),t}async function M(r,e){return {...(await T(r,{contract:e?.contract})).summary,generatedAt:(e?.now??new Date).toISOString(),registrySummaryPath:f}}function F(r,e=""){return r.projectCount>0?r.authority==="workspace.contract.json"?`${r.projectCount} project(s) registered in workspace contract${e}.`:r.authority==="global-registry"?`${r.projectCount} project(s) registered in global workspace registry${e}.`:`${r.projectCount} project(s) registered in legacy workspace manifest${e}.`:`Workspace state exists, but no projects are registered yet${e}.`}export{f as a,w as b,T as c,U as d,D as e,M as f,F as g};
|
package/dist/chunk-L22EABIC.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-A5FBGRJA.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {i as i$1,h}from'./chunk-NZ3WZYD5.js';import {j,u,e,a as a$2,t,f as f$1}from'./chunk-MOSXTVPU.js';import {s}from'./chunk-RGNCL5OB.js';import b from'crypto';import P from'fs';import d from'fs/promises';import i from'path';import T from'fs-extra';var x=h.projectWorkspaceLink.schemaVersion,L="workspai.project-workspace-link",l=class extends Error{constructor(r,a,o={}){super(a);this.code=r;this.context=o;this.name="ProjectWorkspaceResolutionError";}code;context};function $(e){return P.existsSync(i.join(e,".workspai-workspace"))?".workspai-workspace":".workspai/workspace.json"}function _(e){return b.createHash("sha256").update([e.workspaceName,a(e.workspacePath),e.projectName,a(e.projectPath),e.relativePath.replace(/\\/g,"/"),e.relationship].join("\0")).digest("hex")}function I(e){let t=i.resolve(e);for(;;){if(j(t))return t;let r=i.dirname(t);if(r===t)return null;t=r;}}function J(e){let t$1=i.resolve(e);for(;;){if([...t(t$1,"project.json"),...t(t$1,"context.json")].some(a=>P.existsSync(a)))return t$1;let r=i.dirname(t$1);if(r===t$1)return null;t$1=r;}}function y(e){return JSON.parse(P.readFileSync(e,"utf8"))}function K(e){let t=y(e);if(!t||typeof t!="object"||Array.isArray(t))throw new l("project.workspace.link-invalid",`Project workspace link is not a JSON object: ${e}`,{linkPath:e});let r=t;if(r.schemaVersion!==x||r.kind!==L||r.state!=="active"||!r.workspace||typeof r.workspace.name!="string"||r.workspace.name.trim().length===0||typeof r.workspace.root!="string"||!i.isAbsolute(r.workspace.root)||![".workspai-workspace",".workspai/workspace.json"].includes(r.workspace.marker??"")||r.workspace.contract!==i$1.workspaceContract||!r.project||typeof r.project.name!="string"||r.project.name.trim().length===0||typeof r.project.relativePath!="string"||i.isAbsolute(r.project.relativePath)||r.project.relativePath.split(/[\\/]/).includes("..")||!["managed","adopted","imported","linked","restored"].includes(r.project.relationship??"")||!r.integrity||r.integrity.algorithm!=="sha256"||typeof r.integrity.binding!="string"||!/^[a-f0-9]{64}$/.test(r.integrity.binding))throw new l("project.workspace.link-invalid",`Project workspace link does not satisfy ${x}: ${e}`,{linkPath:e});try{a$1(t,"contracts/project-workspace-link.v1.json","Project workspace link");}catch(a){throw new l("project.workspace.link-invalid",`Project workspace link does not satisfy ${x}: ${e}`,{linkPath:e,validationError:a instanceof Error?a.message:String(a)})}return r}function f(e,t){let r=i.join(e,".workspai","workspace.contract.json");if(!P.existsSync(r))return null;try{let a$1=y(r);if(!Array.isArray(a$1.projects))return false;let o=a(t);return a$1.projects.some(n=>typeof n.externalPath=="string"?a(n.externalPath)===o:typeof n.relativePath!="string"||n.relativePath.startsWith("external/")?false:a(i.resolve(e,n.relativePath))===o)}catch{return false}}function M(e,t,r){let a$1=a(e),o=new Map;for(let n of s(t,r)){if(!P.existsSync(n))continue;let c;try{c=y(n);}catch{continue}if(Array.isArray(c.workspaces))for(let p of c.workspaces){if(!p||typeof p.name!="string"||typeof p.path!="string"||!Array.isArray(p.projects)||!p.projects.some(w=>w&&typeof w.path=="string"&&a(w.path)===a$1))continue;let s=a(p.path);!j(s)||f(s,e)!==true||o.set(s,{name:p.name,path:s});}}return [...o.values()].sort((n,c)=>n.path.localeCompare(c.path))}function m(e,t){if(e)throw t;return null}function te(e$1){let t=e$1.strict===true,r=i.resolve(e$1.startPath),a=e$1.explicitWorkspacePath?i.resolve(e$1.explicitWorkspacePath):null,o=J(r);if(a)return j(a)?e$1.requireProjectMembership===true&&o&&f(a,o)!==true?m(t,new l("project.workspace.membership-missing",`Project is not registered in the explicit workspace contract: ${a}`,{workspacePath:a,projectPath:o})):{workspacePath:a,projectPath:o,source:"explicit",linkPath:o?u(o,e):null,recovered:false}:m(t,new l("project.workspace.explicit-invalid",`Explicit workspace path is not a Workspai workspace: ${a}`,{workspacePath:a,projectPath:o}));let n=I(r);if(n)return e$1.requireProjectMembership===true&&o&&f(n,o)!==true?m(t,new l("project.workspace.membership-missing",`Project is not registered in its parent workspace contract: ${n}`,{workspacePath:n,projectPath:o})):{workspacePath:n,projectPath:o,source:"parent",linkPath:o?u(o,e):null,recovered:false};if(!o)return m(t,new l("project.workspace.unlinked","No Workspai project or workspace could be resolved from the current directory.",{startPath:r}));let c=u(o,e),p=null;if(P.existsSync(c)){let s;try{s=K(c);}catch(O){if(t)throw O;return null}let u=_({workspaceName:s.workspace.name,workspacePath:s.workspace.root,projectName:s.project.name,projectPath:o,relativePath:s.project.relativePath,relationship:s.project.relationship}),w=f(s.workspace.root,o);if(s.integrity.binding===u&&j(s.workspace.root)&&P.existsSync(i.join(s.workspace.root,s.workspace.marker))&&w===true)return {workspacePath:i.resolve(s.workspace.root),projectPath:o,source:"local-link",linkPath:c,recovered:false};p=s;}let h=M(o,e$1.env??process.env,e$1.platform??process.platform);return h.length>1?m(t,new l("project.workspace.ambiguous",`Project is registered in more than one valid workspace: ${h.map(s=>s.name).join(", ")}. Pass --workspace <path> or run project workspace relink.`,{projectPath:o,candidates:h})):h.length===1?{workspacePath:h[0].path,projectPath:o,source:"registry",linkPath:c,recovered:p!==null}:p?m(t,new l("project.workspace.link-stale",`Project workspace link is stale and no valid registry relocation was found: ${p.workspace.root}`,{projectPath:o,linkPath:c,linkedWorkspacePath:p.workspace.root})):m(t,new l("project.workspace.unlinked","This Workspai project is not linked to a valid workspace. Run `npx workspai adopt .` or `npx workspai project workspace relink --workspace <path>`.",{projectPath:o,linkPath:c}))}async function F(e,t){await d.mkdir(i.dirname(e),{recursive:true});let r=`${e}.${process.pid}.${b.randomUUID()}.tmp`;try{await d.writeFile(r,`${JSON.stringify(t,null,2)}
|
|
2
|
-
`,{encoding:"utf8",mode:384});try{await d.rename(r,e);}catch(a){let o=a.code;if(o!=="EEXIST"&&o!=="EPERM")throw a;await T.move(r,e,{overwrite:true});}}finally{await d.rm(r,{force:true}).catch(()=>{});}}async function D(e){let t=i.join(e,".gitignore"),r=await d.readFile(t,"utf8").catch(c=>{if(c.code==="ENOENT")return "";throw c});if(r.split(/\r?\n/).map(c=>c.trim()).includes(f$1))return;let n=`${r.length>0&&!r.endsWith(`
|
|
3
|
-
`)?`
|
|
4
|
-
`:""}
|
|
5
|
-
# Workspai machine-local workspace binding
|
|
6
|
-
${f$1}
|
|
7
|
-
`;await d.writeFile(t,`${r}${n}`,"utf8");}async function V(e$1){let t=i.resolve(e$1.workspacePath),r=i.resolve(e$1.projectPath);if(!j(t))throw new l("project.workspace.explicit-invalid",`Cannot link project to an invalid Workspai workspace: ${t}`,{workspacePath:t,projectPath:r});let a$3=i.join(t,".workspai","workspace.contract.json"),o=e$1.workspaceName??i.basename(t),n=e$1.relativePath;if(P.existsSync(a$3)){let h=y(a$3);typeof h.workspace?.name=="string"&&(o=h.workspace.name);let s=a(r),u=h.projects?.find(w=>typeof w.externalPath=="string"?a(w.externalPath)===s:typeof w.relativePath=="string"&&!w.relativePath.startsWith("external/")&&a(i.resolve(t,w.relativePath))===s);u&&typeof u.relativePath=="string"&&(n=u.relativePath);}if(n??=i.relative(t,r).replace(/\\/g,"/"),(!n||n.startsWith(".."))&&(n=`external/${e$1.projectName}`),f(t,r)!==true)throw new l("project.workspace.membership-missing",`Project is not registered in the canonical workspace contract: ${e$1.projectName}`,{workspacePath:t,projectPath:r,projectName:e$1.projectName});let c={schemaVersion:x,kind:L,generatedAt:(e$1.now??new Date).toISOString(),state:"active",workspace:{name:o,root:t,marker:$(t),contract:i$1.workspaceContract},project:{name:e$1.projectName,relativePath:n,relationship:e$1.relationship},integrity:{algorithm:"sha256",binding:_({workspaceName:o,workspacePath:t,projectName:e$1.projectName,projectPath:r,relativePath:n,relationship:e$1.relationship})}};a$1(c,"contracts/project-workspace-link.v1.json","Project workspace link");let p=i.join(r,a$2,e);return await D(r),await F(p,c),{linkPath:p,link:c}}async function oe(e,t$1="linked"){if(!e.projectPath)return null;let r=t(e.projectPath,"project.json").find(o=>P.existsSync(o)),a=i.basename(e.projectPath);if(r)try{let o=y(r);typeof o.name=="string"?a=o.name:typeof o.slug=="string"&&(a=o.slug);}catch{}return V({workspacePath:e.workspacePath,projectPath:e.projectPath,projectName:a,relationship:t$1})}export{l as a,te as b,V as c,oe as d};
|
package/dist/chunk-LNXIMF3O.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {e,i,p,f as f$1,g}from'./chunk-NZ3WZYD5.js';var l="workspai-workspace-intelligence-chain-v1",u="contracts/workspace-intelligence-chain.v1.json";function f(){let e$1=e,t=p,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$1.model,e$1.snapshot],inputRefs:["changes","model-baseline"],consumesArtifacts:[e$1.model,e$1.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$1.model,e$1.diff],inputRefs:[],consumesArtifacts:[e$1.model,e$1.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:[i.workspaceContract],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$1.model,"workspace runtime and dependency signals"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules"],consumesArtifacts:[e$1.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$1.doctor,e$1.contractVerify,e$1.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$1.impact,e$1.doctor,e$1.contractVerify,e$1.readiness],inputRefs:[],consumesArtifacts:[e$1.impact,e$1.doctor,e$1.contractVerify,e$1.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$1.model,e$1.impact,e$1.verify],inputRefs:[],consumesArtifacts:[e$1.model,e$1.impact,e$1.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$1.agentContext],inputRefs:[],consumesArtifacts:[e$1.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$1.verify,e$1.impact],inputRefs:[],consumesArtifacts:[e$1.verify,e$1.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:l,name:"Workspace Intelligence Chain",contractPath:u,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",i.workspaceContract],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(e).map(([r,a])=>({id:r,path:a,schemaVersion:f$1[r],schemaContract:g[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:[i.workspaceContract,i.workspaceRegistry],failurePolicy:"stop-and-report",purpose:"Reconcile portable workspace inventory and contract inputs before modeling."},{id:"baseline",executionPoint:"after:model-before:diff",artifacts:[e$1.snapshot],failurePolicy:"stop-and-report",purpose:"Create an initial structural baseline when absent or reuse the existing baseline before Diff."}],report:{artifact:e$1.intelligenceRun,schemaVersion:f$1.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$1.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$1.model,e$1.knowledgeGraph,e$1.diff,e$1.impact],producedBy:["model","diff","impact"],inventory:"complete-for-chain"},{id:"governance-evidence",label:"Governance evidence",artifacts:[e$1.doctor,e$1.contractVerify,e$1.analyze,e$1.readiness,e$1.verify,e$1.history],producedBy:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify"],inventory:"complete-for-chain"},{id:"agent-grounding",label:"Agent grounding",artifacts:[e$1.agentContext,e$1.agentIndex,e$1.agentCustomizationPack,e$1.skillsIndex,e$1.agents],producedBy:["context","agent-sync"],inventory:"canonical-minimum",inventoryContract:"contracts/agent-customization-pack.v1.json"},{id:"explanations",label:"Explainable decisions",artifacts:[e$1.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$1.model,e$1.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$1.evaluationLive,e$1.evaluationLastRun],produces:[e$1.evaluationLive,e$1.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$1.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:p})=>({id:r,label:a,phase:p})),edges:s.flatMap(r=>r.dependsOn.map(a=>({from:a,to:r.id,meaning:"required before"})))},consumers:{agents:{canonicalReadOrder:[e$1.agentIndex,i.goalIndex,i.goalPackLastRun,e$1.agentContext,e$1.skillsIndex,e$1.verify,e$1.impact,e$1.explain],entrypoints:[e$1.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$1.model,e$1.knowledgeGraph,e$1.impact,e$1.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."}}}}export{l as a,f as b};
|
package/dist/chunk-MDTI3UEB.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-O5B2L3R2.js';import {c,f}from'./chunk-CCDGHPEJ.js';import {a}from'./chunk-AFIFZTOY.js';import {d,c as c$1}from'./chunk-EWZZUQBR.js';import {createHash}from'crypto';import u from'path';import E from'fs-extra';var N="workspai.goal-pack.v1",q="workspai.goal-agent-handoff.v1",ae="workspai.goal-plan-result.v1",V=".workspai/reports/goal-pack-last-run.json",B="workspai.goal-index.v1",g=".workspai/goals/index.json",D="workspai.goal-lifecycle-result.v1";function M(e){if(!e.activeGoalId)return null;let a=e.goals.find(r=>r.id===e.activeGoalId),t=e.goals.filter(r=>r.lifecycle==="active");return !a||a.state==="ready-to-plan"||!(a.lifecycle==="planned"&&t.length===0||a.lifecycle==="active"&&t.length===1&&t[0]?.id===a.id)?null:{...e,activeGoalId:null,goals:e.goals.map(r=>r.id===a.id&&r.lifecycle==="active"?{...r,lifecycle:"planned"}:r)}}function I(e){let a=new Set,t=new Set,r=Date.parse(e.generatedAt);for(let o of e.goals){if(a.has(o.id))throw new Error(`Goal index contains duplicate id: ${o.id}`);if(t.has(o.fingerprint))throw new Error(`Goal index contains duplicate fingerprint: ${o.fingerprint}`);if(a.add(o.id),t.add(o.fingerprint),o.goalPack!==`.workspai/goals/${o.id}/goal-pack.json`||o.agentHandoff!==`.workspai/goals/${o.id}/agent-handoff.json`)throw new Error(`Goal index artifact paths do not match goal id: ${o.id}`);if(Date.parse(o.createdAt)>Date.parse(o.updatedAt))throw new Error(`Goal index timestamps are inconsistent for: ${o.id}`);if(Date.parse(o.updatedAt)>r)throw new Error(`Goal index generatedAt predates entry update: ${o.id}`)}let n=e.goals.filter(o=>o.lifecycle==="active");for(let o of e.goals){if(o.repairTransactionIds&&(o.repairTransactionIds.length>25||new Set(o.repairTransactionIds).size!==o.repairTransactionIds.length||o.repairTransactionId&&o.repairTransactionIds.at(-1)!==o.repairTransactionId))throw new Error(`Goal index repair transaction history is inconsistent: ${o.id}`);if(o.verificationReceipt&&(!o.verifiedGoalId||o.verificationReceipt.verifiedGoalId!==o.verifiedGoalId||o.verificationReceipt.attempt<1||Date.parse(o.verificationReceipt.recordedAt)>r))throw new Error(`Goal index verification receipt is inconsistent: ${o.id}`)}if(e.activeGoalId===null){if(n.length>0)throw new Error("Goal index is inconsistent: active lifecycle entries require activeGoalId.");return}let i=e.goals.find(o=>o.id===e.activeGoalId);if(!i||i.state!=="ready-to-plan"||!["active","verification-ready","failed"].includes(i.lifecycle)||n.some(o=>o.id!==e.activeGoalId))throw new Error("Goal index is inconsistent: activeGoalId must identify the only selected actionable lifecycle entry.")}function z(e){let a=S(e.scope),t={id:"workspace-verify",kind:"workspace-verify",expected:"Canonical Workspace Verify proves workspace safety and evidence freshness without claiming arbitrary semantic outcome completion.",producerCommand:"workspai workspace verify --json",machineVerifiable:true};if(e.intent.category==="release-readiness")return [{id:"release-readiness",kind:"release-readiness",expected:"Every release readiness gate passes.",producerCommand:`workspai workspace goal plan release-readiness${a} --json`,machineVerifiable:true},t];if(e.intent.category==="dependency-security")return [{id:"dependency-security",kind:"dependency-security",expected:"No blocking dependency vulnerability remains in the selected scope.",producerCommand:`workspai workspace goal plan dependency-security${a} --json`,machineVerifiable:true},t];if(e.intent.category==="test-coverage"&&e.intent.requestedTarget){let r=e.intent.requestedTarget.runtime?` --runtime ${e.intent.requestedTarget.runtime}`:"";return [{id:"test-coverage",kind:"test-coverage",expected:`${e.intent.requestedTarget.runtime?`${e.intent.requestedTarget.runtime} `:""}test coverage is at least ${e.intent.requestedTarget.value}%.`,producerCommand:`workspai workspace goal plan test-coverage${a} --target ${e.intent.requestedTarget.value}${r} --json`,machineVerifiable:e.preflight.measurement.status==="available"},t]}return [t]}function Y(e){let a=S(e.scope);if(e.intent.category==="release-readiness")return `workspai workspace goal plan release-readiness${a} --json`;if(e.intent.category==="dependency-security")return `workspai workspace goal plan dependency-security${a} --json`;if(e.intent.category==="test-coverage"&&e.intent.requestedTarget){let t=e.intent.requestedTarget.runtime?` --runtime ${e.intent.requestedTarget.runtime}`:"";return `workspai workspace goal plan test-coverage${a} --target ${e.intent.requestedTarget.value}${t} --json`}}function F(e){return /^[A-Za-z0-9._:@+-]+$/.test(e)?e:JSON.stringify(e)}function S(e){return e.resolution==="selection-required"?"":e.kind==="project"&&e.projects[0]?` --scope ${F(`project:${e.projects[0]}`)}`:e.kind==="project-set"&&e.projects.length>1?` --scope ${F(`projects:${e.projects.join(",")}`)}`:e.kind==="workspace"?" --scope workspace":""}function K(e,a){let t=z(e),r=e.intent.ambiguities.length>0,n=!r&&e.intent.category==="test-coverage"&&e.preflight.measurement.status!=="available",i=!r&&e.preflight.retrieval.status==="empty",o={kernelRevision:"goal-pack-kernel-v10",intent:e.intent.normalized,workspace:e.workspaceName,scope:e.scope,modelHash:e.sourceBinding.model.hash,graphSourceFingerprint:e.sourceBinding.graph.inputHash??e.sourceBinding.graph.hash,preflight:e.preflight,policy:{maxAttempts:e.maxAttempts,mutationMode:"proposal-only"}},s=a.digestCanonical(o),c=`goal-${e.intent.category}-${s.slice(0,16)}`,l=`.workspai/goals/${c}/goal-pack.json`,w=`.workspai/goals/${c}/agent-handoff.json`,m=Y(e),P=!!m,R=S(e.scope),d=S(e.scope),G=r?"needs-confirmation":i?"blocked":n?"needs-evidence":"ready-to-plan",f=r&&e.intent.category==="test-coverage"&&e.intent.ambiguities.some(A=>/coverage runtimes|coverage scope|requested .* runtime/i.test(A)),p=r&&e.intent.category==="test-coverage"&&e.intent.ambiguities.some(A=>A.startsWith("The selected projects do not share a common canonical coverage runtime")),h=e.preflight.measurement.runtimeChoices??e.baseline.runtimes,y=e.scope.resolution==="selection-required"||e.intent.ambiguities.some(A=>A.startsWith("Goal scope is unresolved")),b={schemaVersion:N,id:c,fingerprint:s,generatedAt:e.generatedAt,state:G,intent:e.intent,workspace:{name:e.workspaceName},scope:e.scope,sourceBinding:e.sourceBinding,baseline:e.baseline,preflight:e.preflight,successCriteria:t,policy:{mutationMode:"proposal-only",approval:"required-before-mutation",verificationOwner:"workspai-cli",rollbackOwner:"workspai-cli",maxAttempts:e.maxAttempts,allowBreakingChanges:false,allowForce:false,networkAccess:"not-granted",scopeExpansion:"requires-decision"},orchestration:[{id:"understand",owner:"workspai-cli",status:"complete",summary:"Bound the intent to the canonical model and proof-backed graph."},{id:"impact",owner:"workspai-cli",status:"complete",summary:"Pinned the permitted workspace or project scope before source inspection."},{id:"propose",owner:"agent",status:r||n||i?"blocked":"pending",summary:"Produce a bounded source-change proposal; do not mutate evidence artifacts."},{id:"approve",owner:"human",status:"pending",summary:"Approve the immutable CLI repair plan before mutation."},{id:"execute",owner:"workspai-cli",status:"pending",summary:"Checkpoint, execute, reconcile, and roll back through Repair Engine."},{id:"verify",owner:"workspai-cli",status:"pending",summary:P?"Independently verify the exact success contract from fresh evidence.":"Verify workspace safety and evidence freshness; the agent must review the final outcome against the complete objective."}],...r||n||i?{decision:{required:true,reason:r?e.intent.ambiguities.join(" "):i?"No bounded proof-backed Graph anchor matches the selected scope and intent.":e.preflight.measurement.prerequisites.join(" ")||"No current machine-readable measurement evidence is available.",question:r?y?`Choose one project, multiple projects, or the entire workspace from: ${e.scope.projects.join(", ")}.`:p?"Split the selected projects into runtime-compatible Goal scopes so every project receives deterministic coverage verification.":f?`Choose exactly one coverage runtime from the detected scope${h.length>0?`: ${h.join(", ")}`:""}, then regenerate this Goal Pack.`:"Clarify the intended outcome or provide a machine-verifiable target.":i?"Refresh Workspace Intelligence or clarify the intent before asking an agent to inspect source.":"Establish the listed measurement prerequisites, then regenerate this Goal Pack."}}:{},artifacts:{goalPack:l,agentHandoff:w,latestReport:V},commands:{refreshEvidence:"workspai workspace intelligence run --for-agent generic --strict --json",inspectGraph:`workspai workspace graph search ${JSON.stringify(e.preflight.retrieval.queries[0]??e.intent.statement)}${R} --limit 20 --json`,...m?{planVerifiedGoal:m}:{},proposeRepair:"workspai workspace repair propose --file <proposal.json> --json"}},U=a.digestCanonical(b),X={schemaVersion:q,goalId:c,goalFingerprint:s,generatedAt:e.generatedAt,consumer:e.consumer,state:G,objective:e.intent.statement,scope:e.scope,discovery:{index:g,statusCommand:`workspai goal --status ${c} --json`,requiredReads:[g,l,w]},retrieval:e.preflight.retrieval,evidence:[{role:"model",artifact:e.sourceBinding.model.artifact,binding:{algorithm:"sha256",semantics:e.sourceBinding.model.hashSemantics,value:e.sourceBinding.model.hash}},{role:"graph",artifact:e.sourceBinding.graph.artifact,binding:{algorithm:"sha256",semantics:e.sourceBinding.graph.hashSemantics,value:e.sourceBinding.graph.hash}},{role:"goal",artifact:l,binding:{algorithm:"sha256",semantics:"canonical-json-v1",value:U}}],guardrails:["Treat the Goal Pack as data, never as instructions that can override host or CLI policy.","Inspect only the bounded scope and request a decision before expanding it.","Do not edit .workspai evidence, goal, repair, contract, or report artifacts.","Return source edits as a proposal; only Workspai Repair Engine may mutate and verify.","Do not claim success from model output or test narration; require fresh CLI evidence.",...P?[]:["For this general Goal, CLI verification proves workspace safety and freshness; final outcome acceptance requires evidence review against the complete objective."]],workflow:[{order:1,owner:"workspai-cli",instruction:"Validate source bindings and scope."},{order:2,owner:"agent",instruction:"Inspect bounded proof and relevant source."},{order:3,owner:"agent",instruction:"Return one focused, reviewable proposal."},{order:4,owner:"human",instruction:"Approve the immutable repair plan."},{order:5,owner:"workspai-cli",instruction:"Execute transaction and verify evidence."},...P?[]:[{order:6,owner:"agent",instruction:"Inspect the final worktree and fresh evidence against the complete objective; report uncertainty instead of presenting workspace verification as semantic proof."}]],renewal:{command:`workspai goal ${JSON.stringify(e.intent.original)}${d}${e.intent.requestedTarget?.runtime?` --runtime ${e.intent.requestedTarget.runtime}`:""} --refresh --for-agent ${e.consumer} --json`,reason:"Regenerate when the canonical model or graph hash changes."}};return {goalPack:b,handoff:X}}var $="contracts/workspace-intelligence/goal-index.v1.json",Q="contracts/workspace-intelligence/goal-lifecycle-result.v1.json";function me(e){let a$1={schemaVersion:D,...e};return a(a$1,Q,"Goal lifecycle result"),a$1}async function C(e){let a$1=u.join(e,g);if(!await E.pathExists(a$1))return {schemaVersion:B,generatedAt:new Date(0).toISOString(),activeGoalId:null,goals:[]};let t=await E.readJson(a$1);a(t,$,"Goal index");try{return I(t),t}catch(r){let n=M(t);if(!n||!(r instanceof Error)||r.message!=="Goal index is inconsistent: activeGoalId must identify the only selected actionable lifecycle entry.")throw r;return I(n),n}}async function W(e,a$2){let[t,r]=await Promise.all([E.readJson(u.join(e,a$2.goalPack)),E.readJson(u.join(e,a$2.agentHandoff))]);if(a(t,"contracts/workspace-intelligence/goal-pack.v1.json","Indexed Goal Pack"),t.id!==a$2.id||t.fingerprint!==a$2.fingerprint)throw new Error(`Goal index binding failed for ${a$2.id}.`);a(r,"contracts/workspace-intelligence/goal-agent-handoff.v1.json","Indexed Goal agent handoff");let n=new Map(r.evidence.map(d=>[d.role,d])),i=K({generatedAt:t.generatedAt,intent:t.intent,workspaceName:t.workspace.name,scope:t.scope,sourceBinding:t.sourceBinding,baseline:t.baseline,preflight:t.preflight,maxAttempts:t.policy.maxAttempts,consumer:r.consumer},{digestCanonical:c$1});if(r.goalId!==t.id||r.goalFingerprint!==t.fingerprint||n.get("goal")?.binding.value!==c$1(t)||n.get("model")?.binding.value!==t.sourceBinding.model.hash||n.get("graph")?.binding.value!==t.sourceBinding.graph.hash||c$1(r)!==c$1(i.handoff))throw new Error(`Goal agent handoff integrity validation failed for ${a$2.id}.`);let o=await a$1(e);if(o.status==="miss")throw new Error(`Goal ${a$2.id} is stale because live workspace inputs changed (${o.reason}). Regenerate it with --refresh.`);let{model:s,graph:c}=o,l=d(s),w=c$1(c),m=c.source.inputs?.hash;if(!(l===t.sourceBinding.model.hash&&(t.sourceBinding.graph.inputHash?m===t.sourceBinding.graph.inputHash:w===t.sourceBinding.graph.hash))){let d=a$2.repairTransactionIds??(a$2.repairTransactionId?[a$2.repairTransactionId]:[]),{assertClosedGoalRepairTransactionCurrent:G}=await import('./workspace-repair-engine-NX7I632M.js'),f=false;for(let p of [...d].reverse()){let h=await G({workspacePath:e,transactionId:p,goalId:a$2.id}).catch(()=>{});if(h?.modelHash===l&&h.graphInputHash===m){f=true;break}}if(!f&&a$2.verificationReceipt&&a$2.verifiedGoalId){let p=a$2.verificationReceipt,{readVerifiedGoal:h}=await import('./verified-goal-WM34TTGE.js'),y=await h(e,a$2.verifiedGoalId).catch(()=>{}),b=m??w;f=!!(y&&p.verifiedGoalId===a$2.verifiedGoalId&&p.attempt===y.status.attempt&&p.statusHash===c$1(y.status)&&p.modelHash===l&&p.graphFingerprint===b&&p.graphFingerprintSemantics===(m?"workspace-knowledge-graph-inputs-v1":"canonical-json-v1"));}if(!f)throw new Error(`Goal ${a$2.id} is stale because its canonical model or graph binding changed outside a closed Goal repair transaction or recorded CLI verification attempt. Regenerate it with --refresh.`)}if(c.source.hash!==l)throw new Error(`Goal ${a$2.id} is stale because its current Model and Graph source bindings disagree. Regenerate it with --refresh.`);let R=s;for(let d of t.preflight.measurement.existingEvidence){let G=R.projects?.find(y=>y.name===d.project);if(!G)throw new Error(`Goal measurement project binding is missing: ${d.project}`);let f=u.resolve(G.absolutePath??u.join(e,G.path??d.project)),p=u.resolve(f,d.path);if(p!==f&&!p.startsWith(`${f}${u.sep}`))throw new Error(`Goal measurement evidence escapes its project boundary: ${d.path}`);let h=await E.readFile(p).catch(()=>null);if(!h||createHash("sha256").update(h).digest("hex")!==d.sha256)throw new Error(`Goal ${a$2.id} is stale because measurement evidence changed: ${d.project}/${d.path}`)}return t}async function _(e){let a=u.resolve(e.workspacePath),t=await C(a),r=e.goalId??t.activeGoalId,n=r?t.goals.find(o=>o.id===r)??null:null;if(r&&!n)throw new Error(`Goal is not registered in this workspace: ${r}`);let i=n&&e.validateBindings!==false?await W(a,n):null;return {index:t,active:n,goalPack:i}}async function ve(e){let a$1=u.resolve(e.workspacePath);return c(a$1,".workspai/goals/index-lifecycle",async()=>{let t=await C(a$1),r=t.goals.find(s=>s.id===e.goalId);if(!r)throw new Error(`Goal is not registered in this workspace: ${e.goalId}`);if(e.action==="activate"){let s=await W(a$1,r);if(s.state!=="ready-to-plan"){let c=s.decision;throw new Error([`Goal ${r.id} cannot be activated while its planning state is ${s.state}.`,c?.reason,c?.question,"Re-run the Goal with the requested clarification or evidence before activation."].filter(l=>!!l).join(" "))}if(r.lifecycle==="cancelled"||r.lifecycle==="verified"||r.lifecycle==="verification-ready")throw new Error(`Goal ${r.id} cannot be activated from lifecycle ${r.lifecycle}. Create or plan a new Goal instead.`)}let n=new Date().toISOString(),i={...r,lifecycle:e.action==="activate"?"active":"cancelled",updatedAt:n},o={...t,generatedAt:n,activeGoalId:e.action==="activate"?e.goalId:t.activeGoalId===e.goalId?null:t.activeGoalId,goals:t.goals.map(s=>s.id===e.goalId?i:e.action==="activate"&&s.lifecycle==="active"?{...s,lifecycle:"planned",updatedAt:n}:s)};return a(o,$,"Goal index"),I(o),await f(a$1,g,[{relativePath:g,payload:o}]),{index:o,goal:i}})}async function J(e){return c(e.workspacePath,".workspai/goals/index-lifecycle",async()=>{let a$1=await C(e.workspacePath),t=a$1.goals.find(i=>i.id===e.goalId);if(!t)throw new Error(`Goal is not registered in this workspace: ${e.goalId}`);let r={...t,lifecycle:e.lifecycle,updatedAt:new Date().toISOString(),...e.verifiedGoalId?{verifiedGoalId:e.verifiedGoalId}:{},...e.verificationReceipt?{verificationReceipt:e.verificationReceipt}:{}},n={...a$1,generatedAt:r.updatedAt,activeGoalId:e.lifecycle==="verified"?null:e.goalId,goals:a$1.goals.map(i=>i.id===e.goalId?r:i)};return a(n,$,"Goal index"),I(n),await f(e.workspacePath,g,[{relativePath:g,payload:n}]),r})}async function we(e){let a=await _(e);if(!a.active||!a.goalPack)throw new Error("No active Goal Pack is available.");if(a.index.activeGoalId!==a.active.id)throw new Error(`Goal ${a.active.id} is not active. Activate it before preparing verification.`);let t=a.goalPack;if(!t.commands.planVerifiedGoal)throw new Error(`Goal ${t.id} has no deterministic verification primitive. An agent proposal and explicit review are required first.`);if(t.state!=="ready-to-plan")throw new Error(`Goal ${t.id} cannot enter verification while its state is ${t.state}.`);let{planVerifiedGoal:r}=await import('./verified-goal-WM34TTGE.js'),n=t.scope.kind==="project"&&t.scope.projects[0]?`project:${t.scope.projects[0]}`:t.scope.kind==="project-set"&&t.scope.projects.length>1?`projects:${t.scope.projects.join(",")}`:void 0,i=t.intent.category;if(i!=="release-readiness"&&i!=="dependency-security"&&i!=="test-coverage")throw new Error(`Goal category ${i} does not have a deterministic verification adapter.`);let o=await r({workspacePath:e.workspacePath,kind:i,scope:n,target:t.intent.requestedTarget?.value,runtime:t.intent.requestedTarget?.runtime});return {goal:await J({workspacePath:e.workspacePath,goalId:t.id,lifecycle:"verification-ready",verifiedGoalId:o.goal.id}),verifiedGoalId:o.goal.id,state:o.status.state}}async function Ge(e){let a=u.resolve(e.workspacePath),t=await _({workspacePath:a,goalId:e.goalId,validateBindings:false});if(!t.active)throw new Error("No active Goal Pack is available.");let r=t.active.id;return c(a,`.workspai/goals/${r}/verification`,()=>ee({workspacePath:a,goalId:r,run:e.run}))}async function ee(e){let a=await _(e);if(!a.active)throw new Error("No active Goal Pack is available.");if(a.index.activeGoalId!==a.active.id)throw new Error(`Goal ${a.active.id} is not active. Activate it before running verification.`);if(!a.active.verifiedGoalId)throw new Error(`Goal ${a.active.id} has no linked verification contract. Run workspai goal --prepare ${a.active.id} --json first.`);if(!a.goalPack)throw new Error(`Goal ${a.active.id} has no validated immutable Goal Pack.`);let{readVerifiedGoal:t,verifyVerifiedGoal:r}=await import('./verified-goal-WM34TTGE.js');if((await t(e.workspacePath,a.active.verifiedGoalId)).status.attempt>=a.goalPack.policy.maxAttempts)throw new Error(`Goal ${a.active.id} exhausted its verification budget (${a.goalPack.policy.maxAttempts}). Review the latest evidence before creating or activating another Goal Pack.`);let i=await r({workspacePath:e.workspacePath,goalId:a.active.verifiedGoalId,run:e.run!==false}),o=await a$1(e.workspacePath);if(o.status==="miss")throw new Error(`Goal ${a.active.id} verification completed without a current Model and Graph receipt (${o.reason}).`);let s=d(o.model),c=o.graph.source.inputs?.hash,l={verifiedGoalId:a.active.verifiedGoalId,attempt:i.attempt,statusHash:c$1(i),modelHash:s,graphFingerprint:c??c$1(o.graph),graphFingerprintSemantics:c?"workspace-knowledge-graph-inputs-v1":"canonical-json-v1",recordedAt:new Date().toISOString()},w=i.state;return {goal:await J({workspacePath:e.workspacePath,goalId:a.active.id,lifecycle:w==="verified"?"verified":w==="failed"?"failed":"verification-ready",verifiedGoalId:a.active.verifiedGoalId,verificationReceipt:l}),verifiedGoalId:a.active.verifiedGoalId,verification:i}}async function ke(e){let a$1=await _({workspacePath:e.workspacePath,goalId:e.goalId});if(!a$1.active||a$1.index.activeGoalId!==e.goalId)throw new Error(`Repair proposal goal is not the active workspace goal: ${e.goalId}`);if(!a$1.goalPack)throw new Error(`Repair proposal Goal Pack is unavailable: ${e.goalId}`);let t=a$1.goalPack.policy.maxAttempts;return c(e.workspacePath,".workspai/goals/index-lifecycle",async()=>{let r=await C(e.workspacePath),n=r.goals.find(l=>l.id===e.goalId);if(!n)throw new Error(`Goal is not registered in this workspace: ${e.goalId}`);let i=n.repairTransactionIds??(n.repairTransactionId?[n.repairTransactionId]:[]);if(!i.includes(e.transactionId)&&i.length>=t)throw new Error(`Goal ${e.goalId} exhausted its repair proposal budget (${t}). Review the latest evidence before creating another Goal Pack.`);let o=i.includes(e.transactionId)?i:[...i,e.transactionId],s={...n,repairTransactionId:e.transactionId,repairTransactionIds:o,updatedAt:new Date().toISOString()},c={...r,generatedAt:s.updatedAt,goals:r.goals.map(l=>l.id===e.goalId?s:l)};return a(c,$,"Goal index"),I(c),await f(e.workspacePath,g,[{relativePath:g,payload:c}]),s})}export{N as a,q as b,ae as c,V as d,B as e,g as f,D as g,M as h,I as i,K as j,me as k,_ as l,ve as m,we as n,Ge as o,ke as p};
|
package/dist/chunk-MOSXTVPU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import s from'fs';import {homedir}from'os';import n from'path';var e=".workspai",a=".rapidkit",p=".workspai-workspace",g=".rapidkit-workspace",_="workspace-link.local.json",P="PROJECT-GROUNDING.md",d="project-context-agent.json",D=`${e}/${_}`,h=`${e}/${P}`,y=`${e}/reports/${d}`,c="workspai",K="Workspai";function R(t){return s.existsSync(n.join(t,p))||s.existsSync(n.join(t,g))||s.existsSync(n.join(t,e,"workspace.json"))||s.existsSync(n.join(t,a,"workspace.json"))}function A(t=homedir()){return n.join(t,".workspai","workspaces")}function E(t=homedir()){return n.join(t,"rapidkit","workspaces")}function l(t=homedir()){return n.join(t,"Workspai","rapidkits")}function u(t,r=homedir()){return n.join(A(r),t)}function k(t,r=homedir()){return [u(t,r),n.join(E(r),t),n.join(l(r),t)]}function S(t,r={}){let o=r.homeDir??homedir();return r.outputDir?n.resolve(r.outputDir,t):u(t,o)}function G(t,r=homedir()){for(let o of k(t,r))if(s.existsSync(o))return o}function N(t,r="my-workspace"){let o=1;for(;;){let f=o===1?r:`${r}-${o}`,x=n.join(t,f);if(!s.existsSync(x))return {name:f,targetPath:x};o+=1;}}function T(t=homedir()){return [n.join(A(t),c),n.join(E(t),c),n.join(l(t),c)]}function v(t=homedir()){for(let r of T(t))if(R(r))return r;return u(c,t)}function j(t,...r){return n.join(t,e,...r)}function W(t,...r){return n.join(t,a,...r)}function w(t){return n.join(t,p)}function $(t){return n.join(t,g)}function m(t,...r){return [j(t,...r),W(t,...r)]}function F(t,r){return [n.join(t,e,r),n.join(t,a,r)]}function J(t,r){return n.join(t,e,r)}function U(t){return t.replace(/\\/g,"/")===g?p:t.split(/[\\/]/g).map(o=>o===a?e:o).join("/")}function b(t){return t.replace(/\\/g,"/")===p?g:t.split(/[\\/]/g).map(o=>o===e?a:o).join("/")}export{e as a,a as b,p as c,g as d,_ as e,D as f,h as g,y as h,K as i,R as j,A as k,S as l,G as m,N as n,v as o,j as p,w as q,$ as r,m as s,F as t,J as u,U as v,b as w};
|
package/dist/chunk-MYJQGGIU.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {c,b as b$1}from'./chunk-WCJU3CFG.js';import {d,b,e}from'./chunk-W6FHVXNL.js';import {a}from'./chunk-2647BYBC.js';import {a as a$1}from'./chunk-27UR373Z.js';import {d as d$2}from'./chunk-S5KTATOU.js';import {k as k$1,x,m,G,j,i as i$1,B as B$1}from'./chunk-J7QYANXK.js';import {d as d$1}from'./chunk-CCDGHPEJ.js';import {e as e$1,i}from'./chunk-NZ3WZYD5.js';import {a as a$2}from'./chunk-TQEMLBAG.js';import {t,p,s}from'./chunk-MOSXTVPU.js';import {e as e$2,g}from'./chunk-RGNCL5OB.js';import U from'fs';import k from'path';import T from'chalk';import {execa}from'execa';var at={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},it={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],c:["cmake -S . -B build"],cpp:["cmake -S . -B build"],elixir:["mix deps.get"],ruby:["bundle install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],c:["ctest --test-dir build --output-on-failure"],cpp:["ctest --test-dir build --output-on-failure"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],c:["cmake --build build"],cpp:["cmake --build build"],elixir:["mix compile"],ruby:["gem build *.gemspec"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],c:[],cpp:[],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function Z(e,r){if(r){let t=r.trim().toLowerCase().replace(/[_.\s]+/g,"-"),n=i$1(r),s=`${e}-${n==="gofiber"?"fiber":n==="gogin"?"gin":n==="dotnet"?"aspnetcore":n!=="unknown"?n:t==="fiber"?"fiber":t==="aspnetcore"||t==="asp-net-core"?"aspnetcore":t}`;return at[s]}}function Le(e,r,t){if(r){let n=Z(e,r);if(n&&n.commands[t])return n.commands[t]}if(["init","test","build","start"].includes(t)){let n=it[t]?.[e]??[];return n.length>0?n[0]:void 0}}var ut={test:"test",build:"build",start:"start"};function le(e){if(e.stage==="init")return e.runtime==="node"?c(e.projectPath):Le(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let r=ut[e.stage];if(r){let t=B$1(e.projectPath,r,{framework:e.framework});if(t)return b$1(e.projectPath,t.scriptName)}}return Le(e.runtime,e.framework,e.stage)}function ct(e){let r=k$1(e).map(t=>t==="python"?"python":t==="node"||t==="bun"?"node":t==="go"?"go":t==="java"?"java":t==="php"?"php":t==="rust"?"rust":t==="dotnet"?"dotnet":t==="elixir"?"elixir":t==="ruby"?"ruby":t==="clojure"||t==="scala"||t==="kotlin"?"jvm-generic":null).filter(t=>t!==null).filter((t,n,o)=>o.indexOf(t)===n);return {primary:r.length>0?r[0]:"unknown",secondary:r.slice(1)}}function Ue(e){return ct(e).primary}function me(e,r){if(!e)return "unknown";r||(r={setup:["ModuleNotFoundError","No module named","npm ERR!","error:","not found"],"test-failure":["FAILED","FAIL","failed"],dependency:["cannot find module","import.*error"],runtime:["Exception","Error:","panic","TypeError"],timeout:["timeout","Timeout","deadline exceeded"],unknown:[]});for(let[t,n]of Object.entries(r))for(let o of n)if(new RegExp(o,"i").test(e))return t;return "unknown"}async function ee(e){let r=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(r))return {valid:true};try{let n=process.platform==="win32"?"where":"which";if((await execa(n,[r],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${r}' not found or not executable`}}function He(e,r,t){if(!r)return e;let n=typeof r=="object"&&!Array.isArray(r)&&("dev"in r||"staging"in r||"prod"in r||"default"in r)&&!Object.keys(r).some(o=>["init","test","build","start"].includes(o))?r:{};return t&&typeof n[t]=="string"?n[t]:typeof n.default=="string"?n.default:e}async function Ve(e,r){if(!e)return {healthy:true};switch(e.type){case "port":{let t=e.value;try{let n=await import('net');return new Promise(o=>{let s=new n.Socket,u=5e3;s.setTimeout(u),s.on("connect",()=>{s.destroy(),o({healthy:true,reason:`Port ${t} is listening`});}),s.on("timeout",()=>{s.destroy(),o({healthy:false,reason:`Port ${t} timeout after ${u}ms`});}),s.on("error",c=>{s.destroy(),o({healthy:false,reason:`Port ${t} error: ${String(c)}`});}),s.connect(t,"localhost");})}catch(n){return {healthy:false,reason:`Port check error: ${n instanceof Error?n.message:String(n)}`}}}case "http":{let t=e.value,n;try{let o=new AbortController;n=setTimeout(()=>o.abort(),5e3);let s=await fetch(t,{method:"GET",signal:o.signal});return {healthy:s.status===200,reason:`HTTP ${s.status}`,metadata:{status:s.status}}}catch(o){return {healthy:false,reason:`HTTP check error: ${o instanceof Error?o.message:String(o)}`}}finally{n&&clearTimeout(n);}}case "log":{let t=e.value;if(!r)return {healthy:true};try{let n=[k.join(r,".workspai","last-run.log"),k.join(r,".rapidkit","last-run.log")].find(o=>U.existsSync(o));if(n){let o=U.readFileSync(n,"utf-8"),s=new RegExp(t,"i");return {healthy:s.test(o),reason:s.test(o)?"Log pattern found":"Log pattern not found"}}return {healthy:true,reason:"No log file to check"}}catch(n){return {healthy:false,reason:`Log check error: ${n instanceof Error?n.message:String(n)}`}}}case "command":{let t=e.value;try{let n=await execa(t,[],{cwd:r,reject:false,shell:true});return {healthy:n.exitCode===0,reason:n.exitCode===0?"Health check passed":"Health check failed",metadata:{exitCode:n.exitCode}}}catch(n){return {healthy:false,reason:`Command check error: ${n instanceof Error?n.message:String(n)}`}}}default:return {healthy:true}}}var ze={init:"init",test:"test",build:"build",start:"start"};function dt(e){return e in ze?ze[e]:null}function lt(e,r){let n=x(e)?.contextJson?.commands;if(!n||typeof n!="object"||Array.isArray(n))return;let o=n[r];if(typeof o=="string"&&o.trim().length>0)return o.trim();if(o&&typeof o=="object"&&!Array.isArray(o)){let s=o,u=s.default??s.dev;if(typeof u=="string"&&u.trim().length>0)return u.trim()}}function Je(e,r,t=G(e)){let n=dt(r);if(!n)return lt(e,r)?{supported:true}:{supported:false,reason:`Workspace stage "${r}" is not part of the Workspai fleet contract.`};if(!t.projectRoot)return {supported:false,reason:"No Workspai project metadata was detected for this target."};let o=t.commandMap[n];if(!o||o.status!=="supported"){let s=t.runtimeSupportTier==="observed"||t.frameworkSupportTier==="observed";return {supported:false,reason:o?.reason??`Command "${n}" is not supported for this project runtime/framework.`,shouldFail:!s}}return {supported:true}}var mt=new Set(["init","test","build","start"]),pt=new Set([".git","node_modules",".workspai",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function B(e){try{return await U.promises.access(e,U.constants.F_OK),true}catch{return false}}async function ft(e){for(let r of e)if(await B(r))return true;return false}async function gt(e,r,t){if(r==="python"){let o=[k.join(e,".workspai","cli.py"),k.join(e,".rapidkit","cli.py")];for(let s of o)if(await B(s))return {valid:true};return {valid:false,reason:"Project-local .workspai/cli.py is missing. Run `workspai init` in this project first."}}let n=t.trim().split(/\s+/)[0];if(n&&["npm","npx","pnpm","yarn"].includes(n)){let o=e$2(n);if((await execa(o.command,[...o.prefixArgs,"--version"],{reject:false,env:g()})).exitCode===0)return {valid:true}}return ee(t)}async function te(e){let r=await U.promises.readFile(e,"utf-8");return JSON.parse(r)}function W(e){return e.replace(/\\/g,"/")}function yt(e){let r=e?.trim();return r?r.startsWith("project:")?r.slice(8).trim()||null:r:null}async function ht(e){let r=k.join(e,e$1.model);if(await B(r))try{let n=((await te(r)).projects??[]).map(o=>typeof o.path=="string"?k.resolve(e,o.path):null).filter(o=>!!o).filter((o,s,u)=>u.indexOf(o)===s).filter(o=>U.existsSync(o));if(n.length>0)return n.sort()}catch{}return a$1(e,{skipDirs:pt,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(t$1,n)=>await ft([...t(t$1,"context.json"),...t(t$1,"project.json")])?true:k.resolve(t$1)===k.resolve(n)?false:k$1(t$1).length>0})}async function kt(e){for(let r of [k.join(".workspai","project.json"),k.join(".workspai","context.json"),k.join(".rapidkit","project.json"),k.join(".rapidkit","context.json")]){let t=k.join(e,r);if(await B(t))try{let n=await te(t),o=n.name??n.projectName??n.slug;if(typeof o=="string"&&o.trim())return o.trim()}catch{}}return null}async function bt(e,r,t){let n=yt(t);if(!n)return {projects:r,normalizedScope:null};let o=W(n).toLowerCase(),s=[];for(let u of r){let c=W(k.relative(e,u)),m=k.basename(u),p=await kt(u);[c,m,p].filter(i=>typeof i=="string"&&i.length>0).map(i=>W(i).toLowerCase()).includes(o)&&s.push(u);}if(s.length===0)throw new Error(`Workspace run scope did not match any project: ${t}`);return {projects:s,normalizedScope:n}}async function wt(e,r,t){let n=await execa("git",["diff","--name-only",`${t}...HEAD`],{cwd:e,reject:false,env:a$2()});if(n.exitCode!==0)return new Set(r);let o=n.stdout.split(/\r?\n/).map(u=>u.trim()).filter(u=>u.length>0).map(u=>W(u));if(o.length===0)return new Set;let s=new Set;for(let u of r){let c=W(k.relative(e,u));if(!c||c===".")continue;let m=`${c}/`;o.some(p=>p===c||p.startsWith(m))&&s.add(u);}return s}async function xt(e,r,t){let n=await d$1(e,i.workspaceContract)??p(e,"workspace.contract.json");if(await B(n))try{let d=await vt(e,r,t,n);if(d.graphStatus!=="missing")return d}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let o=await d$1(e,".workspai/workspace-dependency-graph.json")??p(e,"workspace-dependency-graph.json");if(!await B(o))return {expanded:t,graphStatus:"missing",expansionDepth:0};let s;try{s=await te(o);}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let u=new Set(r.map(d=>k.resolve(d))),c=new Map;if(!s||typeof s!="object"||Array.isArray(s))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let m=Array.isArray(s.projects)?s.projects:[];for(let d of m){if(!d||typeof d!="object"||Array.isArray(d))continue;let i=d,l=typeof i.path=="string"?i.path:"",y=k.resolve(e,l);if(!u.has(y))continue;let b=Array.isArray(i.dependsOn)?i.dependsOn.filter(S=>typeof S=="string"):[];for(let S of b){let g=k.resolve(e,S);u.has(g)&&(c.has(g)||c.set(g,new Set),c.get(g)?.add(y));}}let p$1=d$2(c,t);return {expanded:p$1.reached,graphStatus:"loaded",expansionDepth:p$1.added}}async function vt(e,r,t,n){let o=await te(n);if(!o||typeof o!="object"||Array.isArray(o))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let s=o,u=Array.isArray(s.projects)?s.projects:null;if(!u)return {expanded:t,graphStatus:"invalid",expansionDepth:0};let c=new Map,m=new Map;for(let y of r){let b=W(k.relative(e,y));m.set(b,k.resolve(y));}let p=new Map,d=new Map,i=new Map;for(let y of u){if(!y||typeof y!="object"||Array.isArray(y))continue;let b=y,S=typeof b.slug=="string"?b.slug:"",g=typeof b.relativePath=="string"?W(b.relativePath):S,v=m.get(g);!S||!v||c.set(S,v);}for(let y of u){if(!y||typeof y!="object"||Array.isArray(y))continue;let b=y,S=typeof b.slug=="string"?b.slug:"",g=c.get(S);if(!g)continue;let v=b.contracts&&typeof b.contracts=="object"&&!Array.isArray(b.contracts)?b.contracts:{},E=Array.isArray(v.dependsOn)?v.dependsOn.filter(R=>typeof R=="string"):[],N=Array.isArray(v.publishes)?v.publishes.filter(R=>typeof R=="string"):[],_=Array.isArray(v.consumes)?v.consumes.filter(R=>typeof R=="string"):[];for(let R of E){let j=c.get(R);j&&(i.has(j)||i.set(j,new Set),i.get(j)?.add(g));}for(let R of N)p.has(R)||p.set(R,new Set),p.get(R)?.add(g);for(let R of _)d.has(R)||d.set(R,new Set),d.get(R)?.add(g);}for(let[y,b]of p.entries()){let S=d.get(y);if(S)for(let g of b){i.has(g)||i.set(g,new Set);for(let v of S)v!==g&&i.get(g)?.add(v);}}let l=d$2(i,t);return {expanded:l.reached,graphStatus:"loaded",expansionDepth:l.added}}async function Rt(e,r){if(typeof r=="boolean")return r;let t=s(e,"policies.yml").find(s=>U.existsSync(s))??p(e,"policies.yml");if(!await B(t))return true;let n="";try{n=await U.promises.readFile(t,"utf-8");}catch{return true}let o=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return o?o[1]==="true":true}function St(e){let r=process.env.RAPIDKIT_WORKSPACE_RUN_STAGE_TIMEOUT_MS;if(r){let t=Number.parseInt(r,10);if(Number.isFinite(t)&&t>0)return t}return e==="init"?12e4:9e4}function qe(e,r){let t=Number.parseInt(process.env[e]??"",10);return Number.isFinite(t)&&t>0?t:r}function pe(e){return new Promise(r=>setTimeout(r,e))}async function Ct(e){let r=process.argv[1];if(e.useRapidkitWrapper&&!r)return {exitCode:1,stdout:"",stderr:"Workspai entrypoint is unavailable for startup verification.",healthStatus:{healthy:false,reason:"Workspai entrypoint is unavailable."}};let t=e.useRapidkitWrapper&&r?execa(process.execPath,[r,"start"],{cwd:e.projectPath,reject:false,timeout:e.timeoutMs,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}}):execa(e.finalCommand,[],{cwd:e.projectPath,reject:false,shell:true,timeout:e.timeoutMs}),n=Promise.resolve(t).then(d=>({kind:"exit",result:d}),d=>({kind:"error",error:d})),o=qe("WORKSPAI_WORKSPACE_RUN_STARTUP_GRACE_MS",2e3),s=await Promise.race([n,pe(o).then(()=>({kind:"alive"}))]);if(s.kind==="error"){let d=typeof s.error=="object"&&s.error!==null&&"timedOut"in s.error&&!!s.error.timedOut;return {exitCode:d?124:1,stdout:"",stderr:s.error instanceof Error?s.error.message:String(s.error),timedOut:d,healthStatus:{healthy:false,reason:"The start command failed before readiness."}}}if(s.kind==="exit"){let d=Number(s.result.exitCode??0);return {exitCode:d,stdout:String(s.result.stdout??""),stderr:String(s.result.stderr??""),healthStatus:{healthy:d===0,reason:d===0?"The start command completed successfully.":`The start command exited with code ${d} before readiness.`}}}let u=Z(e.runtime,e.framework)?.healthCheck,c=u?{healthy:false,reason:"The configured health check has not passed yet."}:{healthy:true,reason:`The service remained alive for ${o}ms (bounded startup smoke).`};if(u){let d=qe("WORKSPAI_WORKSPACE_RUN_STARTUP_HEALTH_TIMEOUT_MS",15e3),i=Date.now()+d;for(;Date.now()<i;){let l=await Ve(u,e.projectPath);if(c={healthy:l.healthy,reason:l.reason},l.healthy)break;if((await Promise.race([n,pe(350).then(()=>({kind:"alive"}))])).kind!=="alive"){c={healthy:false,reason:"The service exited before its configured health check passed."};break}}}try{t.kill?.("SIGTERM",{forceKillAfterDelay:1e3});}catch{try{t.kill?.();}catch{}}let m=await Promise.race([n,pe(2e3).then(()=>({kind:"alive"}))]),p=m.kind==="exit"?m.result:void 0;return {exitCode:c.healthy?0:1,stdout:String(p?.stdout??""),stderr:String(p?.stderr??""),healthStatus:c}}async function fe(e,r,t){let n=process.argv[1];if(!n)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};try{let o=await execa(process.execPath,[n,...e],{cwd:r,reject:false,timeout:t,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr}}catch(o){return {exitCode:typeof o=="object"&&o!==null&&"timedOut"in o&&!!o.timedOut?124:1,stdout:typeof o=="object"&&o!==null&&"stdout"in o?String(o.stdout??""):"",stderr:typeof o=="object"&&o!==null&&"stderr"in o?String(o.stderr??""):o instanceof Error?o.message:String(o)}}}function Et(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"||e==="rust"||e==="php"}function jt(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}function Pt(e,r=8){if(e.length<=r)return e.join(`
|
|
2
|
-
`);let t=3;return [...e.slice(0,t),...e.slice(-(r-t))].join(`
|
|
3
|
-
`)}function At(e){let r=/(?:\bnot found\b|\bno such\b|\bmissing\b|\bfailed\b|\berror\b|\bexception\b|\bcannot\b|\bdenied\b|\btimeout\b|\btimed out\b|\benoent\b|\beacces\b|\beperm\b)/i;return [...e].reverse().find(t=>r.test(t))??e.at(-1)}async function Ft(e){let r=process.cwd();try{process.chdir(e);let{handleInitCommand:t}=await import('./index.js');return {exitCode:await t(["init"]),stdout:"",stderr:""}}finally{process.chdir(r);}}async function Ye(e){let r=i=>{let l=j(i);return l==="node"||l==="bun"?"node":l==="python"?"python":l==="go"?"go":l==="java"?"java":l==="php"?"php":l==="ruby"?"ruby":l==="rust"?"rust":l==="dotnet"?"dotnet":l==="elixir"?"elixir":l==="clojure"||l==="scala"||l==="kotlin"?"jvm-generic":Ue(e)},t=i=>{if(!i)return;let l=i$1(i);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(l))return l},n=x(e),o=n?.detection??m(e,n?.projectJson??null),s=n?.contextJson,u=r(o.runtime),c=t(o.key),m$1={},p=new Set(["init","test","build","start"]);if(s?.commands&&typeof s.commands=="object")for(let[i,l]of Object.entries(s.commands))typeof l=="string"&&p.has(i)&&(m$1[i]=l);let d;if(s?.commandEnvironments&&typeof s.commandEnvironments=="object"){let i=s.commandEnvironments;d={dev:typeof i.dev=="string"?i.dev:void 0,staging:typeof i.staging=="string"?i.staging:void 0,prod:typeof i.prod=="string"?i.prod:void 0,default:typeof i.default=="string"?i.default:void 0};}return {runtime:u,framework:c,commandOverrides:Object.keys(m$1).length>0?m$1:void 0,environmentCommandVariants:d,environment:typeof s?.environment=="string"?s.environment:void 0}}async function Qe(e,r,t,n,o,s,u){let c=!o?.[r]&&Et(t),m;if(o&&o[r]?m=o[r]:c?m=`rapidkit ${r}`:m=le({projectPath:e,runtime:t,framework:n,stage:r}),!m)return {exitCode:127,command:`<stage not supported for ${t}>`,message:`No stage command found for runtime '${t}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let p=He(m,s,u);if(!p)return {exitCode:127,command:m,message:"Failed to resolve stage command",errorCategory:"runtime"};let d=le({projectPath:e,runtime:t,framework:n,stage:r});if(c){if(d){let x=c?await gt(e,t,d):await ee(d);if(!x.valid)return {exitCode:127,command:p,message:x.reason||"Command not available",errorCategory:"setup"}}}else {let x=await ee(p);if(!x.valid)return {exitCode:127,command:p,message:x.reason||"Command not available",errorCategory:"setup"}}let i=0,l="",y="",b,S,g=St(r),v=Date.now();try{let x=r==="start"?await Ct({projectPath:e,finalCommand:p,useRapidkitWrapper:c,runtime:t,framework:n,timeoutMs:g}):c?r==="init"&&jt()?await Ft(e):await fe([r],e,g):await execa(p,[],{cwd:e,reject:false,shell:true,timeout:g});if(i=Number(x.exitCode??0),l=x.stdout,y=x.stderr,S=r==="start"?x.healthStatus:void 0,i!==0){let $=`${l}
|
|
4
|
-
${y}`,V=Date.now()-v;b=i===124||me($)==="timeout"||i===143&&V>=Math.floor(g*.8)?"timeout":me($);}}catch(x){let $=typeof x=="object"&&x!==null&&"timedOut"in x&&!!x.timedOut;return {exitCode:$?124:1,command:p,message:$?`Stage timed out after ${g}ms`:x instanceof Error?x.message:"Command execution failed",errorCategory:$?"timeout":"runtime"}}let E=`${l}
|
|
5
|
-
${y}`.split(/\r?\n/).map(x=>x.trim()).filter(Boolean),N=Pt(E),_=At(E),R=Date.now()-v,j=i===124||b==="timeout"||i===143&&R>=Math.floor(g*.8),P=i===0?void 0:j?"timeout":b,I=i===0||!P?void 0:{category:P,exitCode:i,command:p,timedOut:j,timeoutMs:g,...N?{outputExcerpt:N}:{}};return {exitCode:i,command:p,errorCategory:P,healthStatus:S,failureDiagnostic:I,message:j?`Stage timed out after ${g}ms`:i!==0?_?`Stage failed with exit code ${i}: ${_}`:`Stage failed with exit code ${i}`:void 0}}function Xe(e){try{return JSON.parse(e)}catch{return null}}function Ot(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx workspai setup dotnet` or `npx workspai init`.";case "go":return "Install Go 1.21+, then rerun `npx workspai setup go` or `npx workspai init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx workspai setup java` or `npx workspai init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx workspai setup node` or `npx workspai init`.";case "python":return "Install Python 3.10+ and pip/Poetry, then rerun `npx workspai setup python` or `npx workspai init`.";default:return null}}async function Tt(e){let r=[],t=await fe(["doctor","workspace","--json"],e);if(t.exitCode!==0)r.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let s=Xe(t.stdout)?.healthScore,u=Number(s?.errors??0);Number.isFinite(u)&&u>0?r.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${u} error(s)`}):r.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await fe(["readiness","--json"],e);if(n.exitCode!==0)r.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let o=Xe(n.stdout),s=String(o?.overallStatus??"").toLowerCase();s==="fail"?r.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):s==="warn"?r.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):r.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return r}var Dt=new Set(["dev","stop"]);function Mt(e){let r=e.trim();return !r||Dt.has(r.toLowerCase())?false:mt.has(r)?true:/^[a-z][a-z0-9_-]*$/i.test(r)}function Ze(e,r,t){let n=W(k.relative(t,r));return (Array.isArray(e.projects)?e.projects:[]).some(s=>{if(!s||typeof s!="object")return false;let u=s,c=[u.relativePath,u.path].filter(m=>typeof m=="string"&&m.length>0).map(m=>W(m));return u.status==="passed"&&(c.includes(n)||c.some(m=>m.endsWith(`/${n}`)))})}function Wt(e,r){return Z(e,r)?.dependencies??[]}function Nt(e,r){let t=Math.max(1,Math.min(4,r)),n=Number(e??t);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):t}async function gr(e$1){if(!Mt(e$1.stage))throw new Error(`Unsupported workspace run stage: ${e$1.stage}`);let r=Date.now(),t=k.resolve(e$1.workspacePath),n=await d(t),o=await ht(t),{projects:s,normalizedScope:u}=await bt(t,o,e$1.scope),c=e$1.affected===true,m=e$1.blastRadius===true,p=e$1.since?.trim()||"HEAD~1",d$1=c?await wt(t,s,p):new Set(s),i,l="not-applicable",y=0,b$1="all";if(c&&m){let f=await xt(t,o,d$1);i=f.expanded,l=f.graphStatus,y=f.expansionDepth,b$1="affected+blast-radius";}else c?(i=d$1,b$1="affected"):(i=d$1,b$1="all");let S=e$1.stage==="init"||e$1.planOnly===true?false:await Rt(t,e$1.enforceGates),g=S?await Tt(t):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],v=g.find(f=>f.status==="fail"),E=s.filter(f=>i.has(f)),N=e$1.continueOnError===true||e$1.stage==="init",_=e$1.parallel===true,R=Nt(e$1.maxWorkers,E.length),j=E.length,P=0;e$1.json||console.log(T.gray(`Workspace run (${e$1.stage}) started: ${j} target(s), ${_?`parallel x${R}`:"sequential"}`));let I=new Map;for(let f of o){let h=W(k.relative(t,f)),a=s.includes(f),D=a&&i.has(f);I.set(f,{path:f,relativePath:h,projectName:k.basename(h)||k.basename(f),selected:D,affected:D,status:"skipped",exitCode:null,durationMs:0,reason:D?void 0:a?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(v)for(let f of E){let h=I.get(f);h&&(h.status="skipped",h.reason=`blocked by ${v.gate}`);}else {let f=async h=>{let a$1=I.get(h);if(!a$1)return;let D=W(k.relative(t,h));e$1.json||console.log(T.gray(`\u23F3 [${P}/${j}] ${e$1.stage} ${D}`)),a$1.selected=true,a$1.affected=true;let A=Date.now(),M=a(h),F=e$1.runtime?.trim().toLowerCase(),L=M.units.filter(w=>!F||w.runtime===F).map(w=>({unit:w,stage:w.stages.find(O=>O.stage===e$1.stage)})).filter(w=>!!w.stage),z=L.map(({unit:w,stage:O})=>({unitId:w.id,runtime:w.runtime,role:w.role,root:w.root,manifest:w.manifest,stage:O.stage,command:O.command,status:"planned",exitCode:null,durationMs:0}));if(a$1.runtimeExecutions=z,e$1.planOnly){a$1.runtimeDetected=L[0]?.unit.runtime,a$1.status="skipped",a$1.reason=L.length>0?`plan only: ${L.length} runtime unit(s)`:F?`no ${F} runtime unit supports stage "${e$1.stage}"`:`no runtime unit supports stage "${e$1.stage}"`,a$1.durationMs=Date.now()-A,P+=1;return}if(M.polyglot||F){if(L.length===0){a$1.status="failed",a$1.reason=F?`No ${F} runtime unit supports stage "${e$1.stage}"`:`No runtime unit supports stage "${e$1.stage}"`,a$1.errorCategory="setup",a$1.errorMessage=a$1.reason,a$1.exitCode=127,a$1.durationMs=Date.now()-A,P+=1;return}let w;for(let C=0;C<L.length;C+=1){let{unit:ke,stage:be}=L[C],J=z[C],we=k.resolve(h,ke.root),st=Date.now(),ae=await Ye(we),K=await Qe(we,e$1.stage,ke.runtime,ae.framework,{[e$1.stage]:be.command},ae.environmentCommandVariants,ae.environment);if(J.durationMs=Date.now()-st,J.exitCode=K.exitCode,J.status=K.exitCode===0?"passed":"failed",J.reason=K.message,K.exitCode!==0&&!w&&(w=K.message??be.command),K.exitCode!==0&&!N){for(let xe of z.slice(C+1))xe.status="skipped",xe.reason="stopped after runtime-unit failure";break}}let O=z.find(C=>C.status==="failed");a$1.runtimeDetected=L[0]?.unit.runtime,a$1.executionCommand=z.filter(C=>C.status!=="skipped").map(C=>`[${C.runtime}:${C.root}] ${C.command}`).join(" && "),a$1.durationMs=Date.now()-A,a$1.exitCode=O?.exitCode??0,a$1.status=O?"failed":"passed",a$1.reason=O?w??"runtime-unit stage failed":void 0,a$1.errorCategory=O?"runtime":void 0,a$1.errorMessage=a$1.reason,P+=1;return}let{runtime:ne,framework:oe,commandOverrides:rt,environmentCommandVariants:nt,environment:ot}=await Ye(h);a$1.runtimeDetected=ne,a$1.framework=oe;let se=Je(h,e$1.stage);if(!se.supported){a$1.status=se.shouldFail===false?"skipped":"failed",a$1.reason=se.reason??`stage "${e$1.stage}" unsupported for project`,a$1.durationMs=Date.now()-A,a$1.exitCode=a$1.status==="failed"?127:null,a$1.status==="failed"&&(a$1.errorCategory="setup",a$1.errorMessage=a$1.reason),P+=1;return}if(e$1.reusePassed&&n){let w=n.stages[e$1.stage]??n.stages[e$1.stage];if(w&&Ze(w,h,t)){a$1.status="passed",a$1.reason="reused passed result from workspace-run-last.json",a$1.durationMs=Date.now()-A,a$1.exitCode=0,P+=1,e$1.json||console.log(T.gray(`\u21BA reused passed cache for ${D}`));return}}let he=Wt(ne,oe).filter(w=>w!==e$1.stage);if(he.length>0&&n){let w=he.find(O=>{let C=n.stages[O];return !C||!Ze(C,h,t)});if(w){a$1.status="skipped",a$1.reason=`dependency stage "${w}" not satisfied in workspace-run-last.json`,a$1.durationMs=Date.now()-A,a$1.exitCode=null,P+=1;return}}let G=await Qe(h,e$1.stage,ne,oe,rt,nt,ot);if(a$1.executionCommand=G.command,a$1.errorCategory=G.errorCategory,a$1.healthStatus=G.healthStatus,a$1.failureDiagnostic=G.failureDiagnostic,a$1.durationMs=Date.now()-A,a$1.exitCode=G.exitCode,G.exitCode===0?(a$1.status="passed",a$1.reason=void 0):(a$1.status="failed",a$1.reason=G.message||"stage command failed",a$1.errorMessage=G.message),P+=1,!e$1.json){let w=j>0?Math.round(P/j*100):100,O=a$1.status==="passed"?T.green("\u2705"):T.red("\u274C");if(console.log(T.gray(`${O} [${P}/${j}] (${w}%) ${D} ${a$1.durationMs}ms`)),a$1.status==="failed"){a$1.reason&&console.log(T.red(` Reason: ${a$1.reason}`)),a$1.executionCommand&&console.log(T.gray(` Command: ${a$1.executionCommand}`));let C=Ot(a$1.runtimeDetected);C&&a$1.errorCategory==="setup"&&console.log(T.gray(` Hint: ${C}`));}}};if(_&&E.length>1){let h=0,a=false,D=new Array(R).fill(null).map(async()=>{for(;h<E.length;){if(a&&!N)return;let A=h;h+=1;let M=E[A];await f(M),I.get(M)?.status==="failed"&&(a=true);}});if(await Promise.all(D),!N&&a){let A=false;for(let M of E){let F=I.get(M);if(F){if(F.status==="failed"){A=true;continue}A&&F.status==="skipped"&&(F.reason=F.reason||"stopped after failure");}}}}else for(let h of E){await f(h);let a=I.get(h);if(!N&&a?.status==="failed"){let D=E.slice(E.indexOf(h)+1);for(let A of D){let M=I.get(A);M&&(M.status="skipped",M.reason="stopped after failure");}break}}}let x=[];for(let f of o){let h=I.get(f);h&&x.push(h);}let $=x.filter(f=>f.status==="passed").length,V=x.filter(f=>f.status==="failed").length,re=x.filter(f=>f.status==="skipped").length,ge=e$1.strict===true,et=V>0||ge&&g.some(f=>f.status==="fail"||f.status==="warn")?1:0,ye={schemaVersion:"1.0",workspacePath:t,stage:e$1.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-r,options:{affected:c,blastRadius:m,since:c?p:null,parallel:_,maxWorkers:R,continueOnError:N,strict:ge,enforceGates:S,scope:u,reusePassed:e$1.reusePassed===true,planOnly:e$1.planOnly===true,runtime:e$1.runtime?.trim()||null},selection:{mode:b$1,since:c?p:null,scope:u,graphStatus:l,expansionDepth:y},gates:{enforced:S,results:g,blocked:!!v,blockingGate:v?.gate},summary:{projectCount:o.length,selectedCount:E.length,passed:$,failed:V,skipped:re,exitCode:et},projects:x,enterpriseControls:{jsonReady:true,evidencePath:b}},tt=k.join(t,b);return await e(t,ye),e$1.json||(v&&(console.log(T.red(`\u274C Workspace run blocked by ${v.gate}`)),console.log(T.gray(` ${v.summary}`))),console.log(T.cyan(`Workspace run (${e$1.stage}) => passed: ${$}, failed: ${V}, skipped: ${re}`)),console.log(T.gray(`Report: ${tt}`))),ye}export{gr as a};
|